PageSourceSearch

https://learning-poc.base44.app/assets/index-jzS_LqvC.js

js learning-poc.base44.app collected 2026-10-03 03:15:04 UTC 2,419,147 bytes, 1,729 lines download raw bytes

vendor: 6,399 bytes, lines 1-9
1var SQ=Object.defineProperty;var XP=e=>{throw TypeError(e)};var kQ=(e,t,n)=>t in e?SQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Zn=(e,t,n)=>kQ(e,typeof t!="symbol"?t+"":t,n),_j=(e,t,n)=>t.has(e)||XP("Cannot "+n);var ge=(e,t,n)=>(_j(e,t,"read from private field"),n?n.call(e):t.get(e)),Vt=(e,t,n)=>t.has(e)?XP("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),vt=(e,t,n,s)=>(_j(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),yn=(e,t,n)=>(_j(e,t,"access private method"),n);var _x=(e,t,n,s)=>({set _(a){vt(e,t,a,n)},get _(){return ge(e,t,s)}});function CQ(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(s,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>s[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var Nx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Un(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nj={exports:{}},Bf={},Sj={exports:{}},dn={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var ZP;function EQ(){if(ZP)return dn;ZP=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(G){return G===null||typeof G!="object"?null:(G=m&&G[m]||G["@@iterator"],typeof G=="function"?G:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,b={};function y(G,q,F){this.props=G,this.context=q,this.refs=b,this.updater=F||x}y.prototype.isReactComponent={},y.prototype.setState=function(G,q){if(typeof G!="object"&&typeof G!="function"&&G!=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,G,q,"setState")},y.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function w(){}w.prototype=y.prototype;function _(G,q,F){this.props=G,this.context=q,this.refs=b,this.updater=F||x}var N=_.prototype=new w;N.constructor=_,j(N,y.prototype),N.isPureReactComponent=!0;var C=Array.isArray,k=Object.prototype.hasOwnProperty,S={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function T(G,q,F){var U,ee={},ne=null,X=null;if(q!=null)for(U in q.ref!==void 0&&(X=q.ref),q.key!==void 0&&(ne=""+q.key),q)k.call(q,U)&&!A.hasOwnProperty(U)&&(ee[U]=q[U]);var ie=arguments.length-2;if(ie===1)ee.children=F;else if(1<ie){for(var Z=Array(ie),ce=0;ce<ie;ce++)Z[ce]=arguments[ce+2];ee.children=Z}if(G&&G.defaultProps)for(U in ie=G.defaultProps,ie)ee[U]===void 0&&(ee[U]=ie[U]);return{$$typeof:e,type:G,key:ne,ref:X,props:ee,_owner:S.current}}function R(G,q){return{$$typeof:e,type:G.type,key:q,ref:G.ref,props:G.props,_owner:G._owner}}function B(G){return typeof G=="object"&&G!==null&&G.$$typeof===e}function D(G){var q={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(F){return q[F]})}var P=/\/+/g;function I(G,q){return typeof G=="object"&&G!==null&&G.key!=null?D(""+G.key):q.toString(36)}function z(G,q,F,U,ee){var ne=typeof G;(ne==="undefined"||ne==="boolean")&&(G=null);var X=!1;if(G===null)X=!0;else switch(ne){case"string":case"number":X=!0;break;case"object":switch(G.$$typeof){case e:case t:X=!0}}if(X)return X=G,ee=ee(X),G=U===""?"."+I(X,0):U,C(ee)?(F="",G!=null&&(F=G.replace(P,"$&/")+"/"),z(ee,q,F,"",function(ce){return ce})):ee!=null&&(B(ee)&&(ee=R(ee,F+(!ee.key||X&&X.key===ee.key?"":(""+ee.key).replace(P,"$&/")+"/")+G)),q.push(ee)),1;if(X=0,U=U===""?".":U+":",C(G))for(var ie=0;ie<G.length;ie++){ne=G[ie];var Z=U+I(ne,ie);X+=z(ne,q,F,Z,ee)}else if(Z=g(G),typeof Z=="function")for(G=Z.call(G),ie=0;!(ne=G.next()).done;)ne=ne.value,Z=U+I(ne,ie++),X+=z(ne,q,F,Z,ee);else if(ne==="object")throw q=String(G),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(G).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.");return X}function L(G,q,F){if(G==null)return G;var U=[],ee=0;return z(G,U,"","",function(ne){return q.call(F,ne,ee++)}),U}function H(G){if(G._status===-1){var q=G._result;q=q(),q.then(function(F){(G._status===0||G._status===-1)&&(G._status=1,G._result=F)},function(F){(G._status===0||G._status===-1)&&(G._status=2,G._result=F)}),G._status===-1&&(G._status=0,G._result=q)}if(G._status===1)return G._result.default;throw G._result}var W={current:null},V={transition:null},K={ReactCurrentDispatcher:W,ReactCurrentBatchConfig:V,ReactCurrentOwner:S};function M(){throw Error("act(...) is not supported in production builds of React.")}return dn.Children={map:L,forEach:function(G,q,F){L(G,function(){q.apply(this,arguments)},F)},count:function(G){var q=0;return L(G,function(){q++}),q},toArray:function(G){return L(G,function(q){return q})||[]},only:function(G){if(!B(G))throw Error("React.Children.only expected to receive a single React element child.");return G}},dn.Component=y,dn.Fragment=n,dn.Profiler=a,dn.PureComponent=_,dn.Str
vendor: 9,251 bytes, lines 9-33
9ictMode=s,dn.Suspense=c,dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K,dn.act=M,dn.cloneElement=function(G,q,F){if(G==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+G+".");var U=j({},G.props),ee=G.key,ne=G.ref,X=G._owner;if(q!=null){if(q.ref!==void 0&&(ne=q.ref,X=S.current),q.key!==void 0&&(ee=""+q.key),G.type&&G.type.defaultProps)var ie=G.type.defaultProps;for(Z in q)k.call(q,Z)&&!A.hasOwnProperty(Z)&&(U[Z]=q[Z]===void 0&&ie!==void 0?ie[Z]:q[Z])}var Z=arguments.length-2;if(Z===1)U.children=F;else if(1<Z){ie=Array(Z);for(var ce=0;ce<Z;ce++)ie[ce]=arguments[ce+2];U.children=ie}return{$$typeof:e,type:G.type,key:ee,ref:ne,props:U,_owner:X}},dn.createContext=function(G){return G={$$typeof:o,_currentValue:G,_currentValue2:G,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},G.Provider={$$typeof:i,_context:G},G.Consumer=G},dn.createElement=T,dn.createFactory=function(G){var q=T.bind(null,G);return q.type=G,q},dn.createRef=function(){return{current:null}},dn.forwardRef=function(G){return{$$typeof:l,render:G}},dn.isValidElement=B,dn.lazy=function(G){return{$$typeof:f,_payload:{_status:-1,_result:G},_init:H}},dn.memo=function(G,q){return{$$typeof:d,type:G,compare:q===void 0?null:q}},dn.startTransition=function(G){var q=V.transition;V.transition={};try{G()}finally{V.transition=q}},dn.unstable_act=M,dn.useCallback=function(G,q){return W.current.useCallback(G,q)},dn.useContext=function(G){return W.current.useContext(G)},dn.useDebugValue=function(){},dn.useDeferredValue=function(G){return W.current.useDeferredValue(G)},dn.useEffect=function(G,q){return W.current.useEffect(G,q)},dn.useId=function(){return W.current.useId()},dn.useImperativeHandle=function(G,q,F){return W.current.useImperativeHandle(G,q,F)},dn.useInsertionEffect=function(G,q){return W.current.useInsertionEffect(G,q)},dn.useLayoutEffect=function(G,q){return W.current.useLayoutEffect(G,q)},dn.useMemo=function(G,q){return W.current.useMemo(G,q)},dn.useReducer=function(G,q,F){return W.current.useReducer(G,q,F)},dn.useRef=function(G){return W.current.useRef(G)},dn.useState=function(G){return W.current.useState(G)},dn.useSyncExternalStore=function(G,q,F){return W.current.useSyncExternalStore(G,q,F)},dn.useTransition=function(){return W.current.useTransition()},dn.version="18.3.1",dn}var eO;function xb(){return eO||(eO=1,Sj.exports=EQ()),Sj.exports}/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var tO;function AQ(){if(tO)return Bf;tO=1;var e=xb(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,d){var f,m={},g=null,x=null;d!==void 0&&(g=""+d),c.key!==void 0&&(g=""+c.key),c.ref!==void 0&&(x=c.ref);for(f in c)s.call(c,f)&&!i.hasOwnProperty(f)&&(m[f]=c[f]);if(l&&l.defaultProps)for(f in c=l.defaultProps,c)m[f]===void 0&&(m[f]=c[f]);return{$$typeof:t,type:l,key:g,ref:x,props:m,_owner:a.current}}return Bf.Fragment=n,Bf.jsx=o,Bf.jsxs=o,Bf}var nO;function TQ(){return nO||(nO=1,Nj.exports=AQ()),Nj.exports}var r=TQ(),h=xb();const xe=Un(h),yb=CQ({__proto__:null,default:xe},[h]);var Sx={},kj={exports:{}},Ys={},Cj={exports:{}},Ej={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */var rO;function PQ(){return rO||(rO=1,(function(e){function t(V,K){var M=V.length;V.push(K);e:for(;0<M;){var G=M-1>>>1,q=V[G];if(0<a(q,K))V[G]=K,V[M]=q,M=G;else break e}}function n(V){return V.length===0?null:V[0]}function s(V){if(V.length===0)return null;var K=V[0],M=V.pop();if(M!==K){V[0]=M;e:for(var G=0,q=V.length,F=q>>>1;G<F;){var U=2*(G+1)-1,ee=V[U],ne=U+1,X=V[ne];if(0>a(ee,M))ne<q&&0>a(X,ee)?(V[G]=X,V[ne]=M,G=ne):(V[G]=ee,V[U]=M,G=U);else if(ne<q&&0>a(X,M))V[G]=X,V[ne]=M,G=ne;else break e}}return K}function a(V,K){var M=V.sortIndex-K.sortIndex;return M!==0?M:V.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],f=1,m=null,g=3,x=!1,j=!1,b=!1,y=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(V){for(var K=n(d);K!==null;){if(K.callback===null)s(d);else if(K.startTime<=V)s(d),K.sortIndex=K.expirationTime,t(c,K);else break;K=n(d)}}function C(V){if(b=!1,N(V),!j)if(n(c)!==null)j=!0,H(k);else{var K=n(d);K!==null&&W(C,K.startTime-V)}}function k(V,K){j=!1,b&&(b=!1,w(T),T=-1),x=!0;var M=g;try{for(N(K),m=n(c);m!==null&&(!(m.expirationTime>K)||V&&!D());){var G=m.callback;if(typeof G=="function"){m.callback=null,g=m.priorityLevel;var q=G(m.expirationTime<=K);K=e.unstable_now(),typeof q=="function"?m.callback=q:m===n(c)&&s(c),N(K)}else s(c);m=n(c)}if(m!==null)var F=!0;else{var U=n(d);U!==null&&W(C,U.startTime-K),F=!1}return F}finally{m=null,g=M,x=!1}}var S=!1,A=null,T=-1,R=5,B=-1;function D(){return!(e.unstable_now()-B<R)}function P(){if(A!==null){var V=e.unstable_now();B=V;var K=!0;try{K=A(!0,V)}finally{K?I():(S=!1,A=null)}}else S=!1}var I;if(typeof _=="function")I=function(){_(P)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,L=z.port2;z.port1.onmessage=P,I=function(){L.postMessage(null)}}else I=function(){y(P,0)};function H(V){A=V,S||(S=!0,I())}function W(V,K){T=y(function(){V(e.unstable_now())},K)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_continueExecution=function(){j||x||(j=!0,H(k))},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(V){switch(g){case 1:case 2:case 3:var K=3;break;default:K=g}var M=g;g=K;try{return V()}finally{g=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(V,K){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var M=g;g=V;try{return K()}finally{g=M}},e.unstable_scheduleCallback=function(V,K,M){var G=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?G+M:G):M=G,V){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=M+q,V={id:f++,callback:K,priorityLevel:V,startTime:M,expirationTime:q,sortIndex:-1},M>G?(V.sortIndex=M,t(d,V),n(c)===null&&V===n(d)&&(b?(w(T),T=-1):b=!0,W(C,M-G))):(V.sortIndex=q,t(c,V),j||x||(j=!0,H(k))),V},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(V){var K=g;return function(){var M=g;g=K;try{return V.apply(this,arguments)}finally{g=M}}}})(Ej)),Ej}var sO;function OQ(){return sO||(sO=1,Cj.exports=PQ()),Cj.exports}/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var aO;function IQ(){if(aO)return Ys;aO=1;var e=xb(),t=OQ();function n(u){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+u,v=1;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v]);return"Minified React error #"+u+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function i(u,p){o(u,p),o(u+"Capture",p)}function o(u,p){for(a[u]=p,u=0;u<p.length;u++)s.add(p[u])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,d=/^[: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]*$/,f={},m={};function g(u){return c.call(m,u)?!0:c.call(f,u)?!1:d.test(u)?m[u]=!0:(f[u]=!0,!1)}function x(u,p,v,E){if(v!==null&&v.type===0)return!1;switch(typeof p){case"function":case"symbol":return!0;case"boolean":return E?!1:v!==null?!v.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function j(u,p,v,E){if(p===null||typeof p>"u"||x(u,p,v,E))return!0;
vendor: 23,578 bytes, lines 33-37
33if(E)return!1;if(v!==null)switch(v.type){case 3:return!p;case 4:return p===!1;case 5:return isNaN(p);case 6:return isNaN(p)||1>p}return!1}function b(u,p,v,E,O,$,J){this.acceptsBooleans=p===2||p===3||p===4,this.attributeName=E,this.attributeNamespace=O,this.mustUseProperty=v,this.propertyName=u,this.type=p,this.sanitizeURL=$,this.removeEmptyString=J}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(u){y[u]=new b(u,0,!1,u,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(u){var p=u[0];y[p]=new b(p,1,!1,u[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(u){y[u]=new b(u,2,!1,u.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(u){y[u]=new b(u,2,!1,u,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(u){y[u]=new b(u,3,!1,u.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(u){y[u]=new b(u,3,!0,u,null,!1,!1)}),["capture","download"].forEach(function(u){y[u]=new b(u,4,!1,u,null,!1,!1)}),["cols","rows","size","span"].forEach(function(u){y[u]=new b(u,6,!1,u,null,!1,!1)}),["rowSpan","start"].forEach(function(u){y[u]=new b(u,5,!1,u.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function _(u){return u[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(u){var p=u.replace(w,_);y[p]=new b(p,1,!1,u,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(u){var p=u.replace(w,_);y[p]=new b(p,1,!1,u,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(u){var p=u.replace(w,_);y[p]=new b(p,1,!1,u,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(u){y[u]=new b(u,1,!1,u.toLowerCase(),null,!1,!1)}),y.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(u){y[u]=new b(u,1,!1,u.toLowerCase(),null,!0,!0)});function N(u,p,v,E){var O=y.hasOwnProperty(p)?y[p]:null;(O!==null?O.type!==0:E||!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(j(p,v,O,E)&&(v=null),E||O===null?g(p)&&(v===null?u.removeAttribute(p):u.setAttribute(p,""+v)):O.mustUseProperty?u[O.propertyName]=v===null?O.type===3?!1:"":v:(p=O.attributeName,E=O.attributeNamespace,v===null?u.removeAttribute(p):(O=O.type,v=O===3||O===4&&v===!0?"":""+v,E?u.setAttributeNS(E,p,v):u.setAttribute(p,v))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,k=Symbol.for("react.element"),S=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),B=Symbol.for("react.provider"),D=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),V=Symbol.iterator;function K(u){return u===null||typeof u!="object"?null:(u=V&&u[V]||u["@@iterator"],typeof u=="function"?u:null)}var M=Object.assign,G;function q(u){if(G===void 0)try{throw Error()}catch(v){var p=v.stack.trim().match(/\n( *(at )?)/);G=p&&p[1]||""}return`
34`+G+u}var F=!1;function U(u,p){if(!u||F)return"";F=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(p)if(p=function(){throw Error()},Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(Ie){var E=Ie}Reflect.construct(u,[],p)}else{try{p.call()}catch(Ie){E=Ie}u.call(p.prototype)}else{try{throw Error()}catch(Ie){E=Ie}u()}}catch(Ie){if(Ie&&E&&typeof Ie.stack=="string"){for(var O=Ie.stack.split(`
35`),$=E.stack.split(`
36`),J=O.length-1,se=$.length-1;1<=J&&0<=se&&O[J]!==$[se];)se--;for(;1<=J&&0<=se;J--,se--)if(O[J]!==$[se]){if(J!==1||se!==1)do if(J--,se--,0>se||O[J]!==$[se]){var pe=`
37`+O[J].replace(" at new "," at ");return u.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",u.displayName)),pe}while(1<=J&&0<=se);break}}}finally{F=!1,Error.prepareStackTrace=v}return(u=u?u.displayName||u.name:"")?q(u):""}function ee(u){switch(u.tag){case 5:return q(u.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return u=U(u.type,!1),u;case 11:return u=U(u.type.render,!1),u;case 1:return u=U(u.type,!0),u;default:return""}}function ne(u){if(u==null)return null;if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case A:return"Fragment";case S:return"Portal";case R:return"Profiler";case T:return"StrictMode";case I:return"Suspense";case z:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case D:return(u.displayName||"Context")+".Consumer";case B:return(u._context.displayName||"Context")+".Provider";case P:var p=u.render;return u=u.displayName,u||(u=p.displayName||p.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case L:return p=u.displayName||null,p!==null?p:ne(u.type)||"Memo";case H:p=u._payload,u=u._init;try{return ne(u(p))}catch{}}return null}function X(u){var p=u.type;switch(u.tag){case 24:return"Cache";case 9:return(p.displayName||"Context")+".Consumer";case 10:return(p._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return u=p.render,u=u.displayName||u.name||"",p.displayName||(u!==""?"ForwardRef("+u+")":"ForwardRef");case 7:return"Fragment";case 5:return p;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ne(p);case 8:return p===T?"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 p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p}return null}function ie(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Z(u){var p=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(p==="checkbox"||p==="radio")}function ce(u){var p=Z(u)?"checked":"value",v=Object.getOwnPropertyDescriptor(u.constructor.prototype,p),E=""+u[p];if(!u.hasOwnProperty(p)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var O=v.get,$=v.set;return Object.defineProperty(u,p,{configurable:!0,get:function(){return O.call(this)},set:function(J){E=""+J,$.call(this,J)}}),Object.defineProperty(u,p,{enumerable:v.enumerable}),{getValue:function(){return E},setValue:function(J){E=""+J},stopTracking:function(){u._valueTracker=null,delete u[p]}}}}function le(u){u._valueTracker||(u._valueTracker=ce(u))}function re(u){if(!u)return!1;var p=u._valueTracker;if(!p)return!0;var v=p.getValue(),E="";return u&&(E=Z(u)?u.checked?"true":"false":u.value),u=E,u!==v?(p.setValue(u),!0):!1}function Ue(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}function Ne(u,p){var v=p.checked;return M({},p,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:v??u._wrapperState.initialChecked})}function Oe(u,p){var v=p.defaultValue==null?"":p.defaultValue,E=p.checked!=null?p.checked:p.defaultChecked;v=ie(p.value!=null?p.value:v),u._wrapperState={initialChecked:E,initialValue:v,controlled:p.type==="checkbox"||p.type==="radio"?p.checked!=null:p.value!=null}}function Me(u,p){p=p.checked,p!=null&&N(u,"checked",p,!1)}function ue(u,p){Me(u,p);var v=ie(p.value),E=p.type;if(v!=null)E==="number"?(v===0&&u.value===""||u.value!=v)&&(u.value=""+v):u.value!==""+v&&(u.value=""+v);else if(E==="submit"||E==="reset"){u.removeAttribute("value");return}p.hasOwnProperty("value")?Xe(u,p.type,v):p.hasOwnProperty("defaultValue")&&Xe(u,p.type,ie(p.defaultValue)),p.checked==null&&p.defaultChecked!=null&&(u.defaultChecked=!!p.defaultChecked)}function Ve(u,p,v){if(p.hasOwnProperty("value")||p.hasOwnProperty("defaultValue")){var E=p.type;if(!(E!=="submit"&&E!=="reset"||p.value!==void 0&&p.value!==null))return;p=""+u._wrapperState.initialValue,v||p===u.value||(u.value=p),u.defaultValue=p}v=u.name,v!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,v!==""&&(u.name=v)}function Xe(u,p,v){(p!=="number"||Ue(u.ownerDocument)!==u)&&(v==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+v&&(u.defaultValue=""+v))}var te=Array.isArray;function De(u,p,v,E){if(u=u.options,p){p={};for(var O=0;O<v.length;O++)p["$"+v[O]]=!0;for(v=0;v<u.length;v++)O=p.hasOwnProperty("$"+u[v].value),u[v].selected!==O&&(u[v].selected=O),O&&E&&(u[v].defaultSelected=!0)}else{for(v=""+ie(v),p=null,O=0;O<u.length;O++){if(u[O].value===v){u[O].selected=!0,E&&(u[O].defaultSelected=!0);return}p!==null||u[O].disabled||(p=u[O])}p!==null&&(p.selected=!0)}}function _e(u,p){if(p.dangerouslySetInnerHTML!=null)throw Error(n(91));return M({},p,{value:void 0,defaultValue:void 0,children:""+u._wrapperState.initialValue})}function We(u,p){var v=p.value;if(v==null){if(v=p.children,p=p.defaultValue,v!=null){if(p!=null)throw Error(n(92));if(te(v)){if(1<v.length)throw Error(n(93));v=v[0]}p=v}p==null&&(p=""),v=p}u._wrapperState={initialValue:ie(v)}}function tt(u,p){var v=ie(p.value),E=ie(p.defaultValue);v!=null&&(v=""+v,v!==u.value&&(u.value=v),p.defaultValue==null&&u.defaultValue!==v&&(u.defaultValue=v)),E!=null&&(u.defaultValue=""+E)}function me(u){var p=u.textContent;p===u._wrapperState.initialValue&&p!==""&&p!==null&&(u.value=p)}function ae(u){switch(u){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Se(u,p){return u==null||u==="http://www.w3.org/1999/xhtml"?ae(p):u==="http://www.w3.org/2000/svg"&&p==="foreignObject"?"http://www.w3.org/1999/xhtml":u}var Le,He=(function(u){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(p,v,E,O){MSApp.execUnsafeLocalFunction(function(){return u(p,v,E,O)})}:u})(function(u,p){if(u.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in u)u.innerHTML=p;else{for(Le=Le||document.createElement("div"),Le.innerHTML="<svg>"+p.valueOf().toString()+"</svg>",p=Le.firstChild;u.firstChild;)u.removeChild(u.firstChild);for(;p.firstChild;)u.appendChild(p.firstChild)}});function ut(u,p){if(p){var v=u.firstChild;if(v&&v===u.lastChild&&v.nodeType===3){v.nodeValue=p;return}}u.textContent=p}var ze={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},fe=["Webkit","ms","Moz","O"];Object.keys(ze).forEach(function(u){fe.forEach(function(p){p=p+u.charAt(0).toUpperCase()+u.substring(1),ze[p]=ze[u]})});function dt(u,p,v){return p==null||typeof p=="boolean"||p===""?"":v||typeof p!="number"||p===0||ze.hasOwnProperty(u)&&ze[u]?(""+p).trim():p+"px"}function ct(u,p){u=u.style;for(var v in p)if(p.hasOwnProperty(v)){var E=v.indexOf("--")===0,O=dt(v,p[v],E);v==="float"&&(v="cssFloat"),E?u.setProperty(v,O):u[v]=O}}var Wt=M({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 bt(u,p){if(p){if(Wt[u]&&(p.children!=null||p.dangerouslySetInnerHTML!=null))throw Error(n(137,u));if(p.dangerouslySetInnerHTML!=null){if(p.children!=null)throw Error(n(60));if(typeof p.dangerouslySetInnerHTML!="object"||!("__html"in p.dangerouslySetInnerHTML))throw Error(n(61))}if(p.style!=null&&typeof p.style!="object")throw Error(n(62))}}function sn(u,p){if(u.indexOf("-")===-1)return typeof p.is=="string";switch(u){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 we=null;function Qe(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var it=null,at=null,Gt=null;function Cn(u){if(u=Nf(u)){if(typeof it!="function")throw Error(n(280));var p=u.stateNode;p&&(p=$g(p),it(u.stateNode,u.type,p))}}function Jn(u){at?Gt?Gt.push(u):Gt=[u]:at=u}function Hn(){if(at){var u=at,p=Gt;if(Gt=at=null,Cn(u),p)for(u=0;u<p.length;u++)Cn(p[u])}}function tn(u,p){return u(p)}function On(){}var as=!1;function $e(u,p,v){if(as)return u(p,v);as=!0;try{return tn(u,p,v)}finally{as=!1,(at!==null||Gt!==null)&&(On(),Hn())}}function he(u,p){var v=u.stateNode;if(v===null)return null;var E=$g(v);if(E===null)return null;v=E[p];e:switch(p){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(E=!E.disabled)||(u=u.type,E=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!E;break e;default:u=!1}if(u)return null;if(v&&typeof v!="function")throw Error(n(231,p,typeof v));return v}var Q=!1;if(l)try{var ke={};Object.defineProperty(ke,"passive",{get:function(){Q=!0}}),window.addEventListener("test",ke,ke),window.removeEventListener("test",ke,ke)}catch{Q=!1}function Ee(u,p,v,E,O,$,J,se,pe){var Ie=Array.prototype.slice.call(arguments,3);try{p.apply(v,Ie)}catch(Je){this.onError(Je)}}var Ye=!1,Tt=null,Ut=!1,$t=null,En={onError:function(u){Ye=!0,Tt=u}};function Pr(u,p,v,E,O,$,J,se,pe){Ye=!1,Tt=null,Ee.apply(En,arguments)}function zs(u,p,v,E,O,$,J,se,pe){if(Pr.apply(this,arguments),Ye){if(Ye){var Ie=Tt;Ye=!1,Tt=null}else throw Error(n(198));Ut||(Ut=!0,$t=Ie)}}function oe(u){var p=u,v=u;if(u.alternate)for(;p.return;)p=p.return;else{u=p;do p=u,(p.flags&4098)!==0&&(v=p.return),u=p.return;while(u)}return p.tag===3?v:null}function Be(u){if(u.tag===13){var p=u.memoizedState;if(p===null&&(u=u.alternate,u!==null&&(p=u.memoizedState)),p!==null)return p.dehydrated}return null}function Ze(u){if(oe(u)!==u)throw Error(n(188))}function pt(u){var p=u.alternate;if(!p){if(p=oe(u),p===null)throw Error(n(188));return p!==u?null:u}for(var v=u,E=p;;){var O=v.return;if(O===null)break;var $=O.alternate;if($===null){if(E=O.return,E!==null){v=E;continue}break}if(O.child===$.child){for($=O.child;$;){if($===v)return Ze(O),u;if($===E)return Ze(O),p;$=$.sibling}throw Error(n(188))}if(v.return!==E.return)v=O,E=$;else{for(var J=!1,se=O.child;se;){if(se===v){J=!0,v=O,E=$;break}if(se===E){J=!0,E=O,v=$;break}se=se.sibling}if(!J){for(se=$.child;se;){if(se===v){J=!0,v=$,E=O;break}if(se===E){J=!0,E=$,v=O;break}se=se.sibling}if(!J)throw Error(n(189))}}if(v.alternate!==E)throw Error(n(190))}if(v.tag!==3)throw Error(n(188));return v.stateNode.current===v?u:p}function qt(u){return u=pt(u),u!==null?Kt(u):null}function Kt(u){if(u.tag===5||u.tag===6)return u;for(u=u.child;u!==null;){var p=Kt(u);if(p!==null)return p;u=u.sibling}return null}var Xt=t.unstable_scheduleCallback,Nn=t.unstable_cancelCallback,Et=t.unstable_shouldYield,Zt=t.unstable_requestPaint,mn=t.unstable_now,Os=t.unstable_getCurrentPriorityLevel,la=t.unstable_ImmediatePriority,Ea=t.unstable_UserBlockingPriority,Ri=t.unstable_NormalPriority,Aa=t.unstable_LowPriority,po=t.unstable_IdlePriority,Mi=null,Is=null;function Us(u){if(Is&&typeof Is.onCommitFiberRoot=="function")try{Is.onCommitFiberRoot(Mi,u,void 0,(u.current.flags&128)===128)}catch{}}var hr=Math.clz32?Math.clz32:qs,Di=Math.log,Cc=Math.LN2;function qs(u){return u>>>=0,u===0?32:31-(Di(u)/Cc|0)|0}var Li=64,al=4194304;function Fr(u){switch(u&-u){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 u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Ta(u,p){var v=u.pendingLanes;if(v===0)return 0;var E=0,O=u.suspendedLanes,$=u.pingedLanes,J=v&268435455;if(J!==0){var se=J&~O;se!==0?E=Fr(se):($&=J,$!==0&&(E=Fr($)))}else J=v&~O,J!==0?E=Fr(J):$!==0&&(E=Fr($));if(E===0)return 0;if(p!==0&&p!==E&&(p&O)===0&&(O=E&-E,$=p&-p,O>=$||O===16&&($&4194240)!==0))return p;if((E&4)!==0&&(E|=v&16),p=u.entangledLanes,p!==0)for(u=u.entanglements,p&=E;0<p;)v=31-hr(p),O=1<<v,E|=u[v],p&=~O;return E}function il(u,p){switch(u){case 1:case 2:case 4:return p+250;case 8:case 16:case 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 p+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gd(u,p){for(var v=u.suspendedLanes,E=u.pingedLanes,O=u.expirationTimes,$=u.pendingLanes;0<$;){var J=31-hr($),se=1<<J,pe=O[J];pe===-1?((se&v)===0||(se&E)!==0)&&(O[J]=il(se,p)):pe<=p&&(u.expiredLanes|=se),$&=~se}}function go(u){return u=u.pendingLanes&-1073741825,u!==0?u:u&1073741824?1073741824:0}function Sr(){var u=Li;return Li<<=1,(Li&4194240)===0&&(Li=64),u}function li(u){for(var p=[],v=0;31>v;v++)p.push(u);return p}function $i(u,p,v){u.pendingLanes|=p,p!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,p=31-hr(p),u[p]=v}function Ec(u,p){var v=u.pendingLanes&~p;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=p,u.mutableReadLanes&=p,u.entangledLanes&=p,p=u.entanglements;var E=u.eventTimes;for(u=u.expirationTimes;0<v;){var O=31-hr(v),$=1<<O;p[O]=0,E[O]=-1,u[O]=-1,v&=~$}}function ye(u,p){var v=u.entangledLanes|=p;for(u=u.entanglements;v;){var E=31-hr(v),O=1<<E;O&p|u[E]&p&&(u[E]|=p),v&=~O}}var qe=0;function nt(u){return u&=-u,1<u?4<u?(u&268435455)!==0?16:536870912:4:1}var ft,Lt,Yt,pn,je,Ke=!1,Te=[],nn=null,_t=null,fn=null,Pa=new Map,is=new Map,zr=[],xo="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function df(u,p){switch(u){case"focusin":case"focusout":nn=null;break;case"dragenter":case"dragleave":_t=null;break;case"mouseover":case"mouseout":fn=null;break;case"pointerover":case"pointerout":Pa.delete(p.pointerId);break;case"gotpointercapture":case"lostpointercapture":is.delete(p.pointerId)}}function ol(u,p,v,E,O,$){return u===null||u.nativeEvent!==$?(u={blockedOn:p,domEventName:v,eventSystemFlags:E,nativeEvent:$,targetContainers:[O]},p!==null&&(p=Nf(p),p!==null&&Lt(p)),u):(u.eventSystemFlags|=E,p=u.targetContainers,O!==null&&p.indexOf(O)===-1&&p.push(O),u)}function Ng(u,p,v,E,O){switch(p){case"focusin":return nn=ol(nn,u,p,v,E,O),!0;case"dragenter":return _t=ol(_t,u,p,v,E,O),!0;case"mouseover":return fn=ol(fn,u,p,v,E,O),!0;case"pointerover":var $=O.pointerId;return Pa.set($,ol(Pa.get($)||null,u,p,v,E,O)),!0;case"gotpointercapture":return $=O.pointerId,is.set($,ol(is.get($)||null,u,p,v,E,O)),!0}return!1}function uf(u){var p=Tc(u.target);if(p!==null){var v=oe(p);if(v!==null){if(p=v.tag,p===13){if(p=Be(v),p!==null){u.blockedOn=p,je(u.priority,function(){Yt(v)});return}}else if(p===3&&v.stateNode.current.memoizedState.isDehydrated){u.blockedOn=v.tag===3?v.stateNode.containerInfo:null;return}}}u.blockedOn=null}function Ac(u){if(u.blockedOn!==null)return!1;for(var p=u.targetContainers;0<p.length;){var v=Jv(u.domEventName,u.eventSystemFlags,p[0],u.nativeEvent);if(v===null){v=u.nativeEvent;var E=new v.constructor(v.type,v);we=E,v.target.dispatchEvent(E),we=null}else return p=Nf(v),p!==null&&Lt(p),u.blockedOn=v,!1;p.shift()}return!0}function mf(u,p,v){Ac(u)&&v.delete(p)}function Sg(){Ke=!1,nn!==null&&Ac(nn)&&(nn=null),_t!==null&&Ac(_t)&&(_t=null),fn!==null&&Ac(fn)&&(fn=null),Pa.forEach(mf),is.forEach(mf)}function ll(u,p){u.blockedOn===p&&(u.blockedOn=null,Ke||(Ke=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Sg)))}function cl(u){function p(O){return ll(O,u)}if(0<Te.length){ll(Te[0],u);for(var v=1;v<Te.length;v++){var E=Te[v];E.blockedOn===u&&(E.blockedOn=null)}}for(nn!==null&&ll(nn,u),_t!==null&&ll(_t,u),fn!==null&&ll(fn,u),Pa.forEach(p),is.forEach(p),v=0;v<zr.length;v++)E=zr[v],E.blockedOn===u&&(E.blockedOn=null);for(;0<zr.length&&(v=zr[0],v.blockedOn===null);)uf(v),v.blockedOn===null&&zr.shift()}var yo=C.ReactCurrentBatchConfig,Bt=!0;function br(u,p,v,E){var O=qe,$=yo.transition;yo.transition=null;try{qe=1,Yv(u,p,v,E)}finally{qe=O,yo.transition=$}}function Gv(u,p,v,E){var O=qe,$=yo.transition;yo.transition=null;try{qe=4,Yv(u,p,v,E)}finally{qe=O,yo.transition=$}}function Yv(u,p,v,E){if(Bt){var O=Jv(u,p,v,E);if(O===null)fw(u,p,E,kg,v),df(u,E);else if(Ng(O,u,p,v,E))E.stopPropagation();else if(df(u,E),p&4&&-1<xo.indexOf(u)){for(;O!==null;){var $=Nf(O);if($!==null&&ft($),$=Jv(u,p,v,E),$===null&&fw(u,p,E,kg,v),$===O)break;O=$}O!==null&&E.stopPropagation()}else fw(u,p,E,null,v)}}var kg=null;function Jv(u,p,v,E){if(kg=null,u=Qe(E),u=Tc(u),u!==null)if(p=oe(u),p===null)u=null;else if(v=p.tag,v===13){if(u=Be(p),u!==null)return u;u=null}else if(v===3){if(p.stateNode.current.memoizedState.isDehydrated)return p.tag===3?p.stateNode.containerInfo:null;u=null}else p!==u&&(u=null);return kg=u,null}function $3(u){switch(u){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invali
37d":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Os()){case la:return 1;case Ea:return 4;case Ri:case Aa:return 16;case po:return 536870912;default:return 16}default:return 16}}var dl=null,Qv=null,Cg=null;function B3(){if(Cg)return Cg;var u,p=Qv,v=p.length,E,O="value"in dl?dl.value:dl.textContent,$=O.length;for(u=0;u<v&&p[u]===O[u];u++);var J=v-u;for(E=1;E<=J&&p[v-E]===O[$-E];E++);return Cg=O.slice(u,1<E?1-E:void 0)}function Eg(u){var p=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&p===13&&(u=13)):u=p,u===10&&(u=13),32<=u||u===13?u:0}function Ag(){return!0}function F3(){return!1}function ca(u){function p(v,E,O,$,J){this._reactName=v,this._targetInst=O,this.type=E,this.nativeEvent=$,this.target=J,this.currentTarget=null;for(var se in u)u.hasOwnProperty(se)&&(v=u[se],this[se]=v?v($):$[se]);return this.isDefaultPrevented=($.defaultPrevented!=null?$.defaultPrevented:$.returnValue===!1)?Ag:F3,this.isPropagationStopped=F3,this}return M(p.prototype,{preventDefault:function(){this.defaultPrevented=!0;var v=this.nativeEvent;v&&(v.preventDefault?v.preventDefault():typeof v.returnValue!="unknown"&&(v.returnValue=!1),this.isDefaultPrevented=Ag)},stopPropagation:function(){var v=this.nativeEvent;v&&(v.stopPropagation?v.stopPropagation():typeof v.cancelBubble!="unknown"&&(v.cancelBubble=!0),this.isPropagationStopped=Ag)},persist:function(){},isPersistent:Ag}),p}var Yd={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xv=ca(Yd),ff=M({},Yd,{view:0,detail:0}),XY=ca(ff),Zv,ew,hf,Tg=M({},ff,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nw,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==hf&&(hf&&u.type==="mousemove"?(Zv=u.screenX-hf.screenX,ew=u.screenY-hf.screenY):ew=Zv=0,hf=u),Zv)},movementY:function(u){return"movementY"in u?u.movementY:ew}}),z3=ca(Tg),ZY=M({},Tg,{dataTransfer:0}),eJ=ca(ZY),tJ=M({},ff,{relatedTarget:0}),tw=ca(tJ),nJ=M({},Yd,{animationName:0,elapsedTime:0,pseudoElement:0}),rJ=ca(nJ),sJ=M({},Yd,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),aJ=ca(sJ),iJ=M({},Yd,{data:0}),U3=ca(iJ),oJ={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},lJ={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},cJ={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dJ(u){var p=this.nativeEvent;return p.getModifierState?p.getModifierState(u):(u=cJ[u])?!!p[u]:!1}function nw(){return dJ}var uJ=M({},ff,{key:function(u){if(u.key){var p=oJ[u.key]||u.key;if(p!=="Unidentified")return p}
vendor: 17,479 bytes, lines 37-38
37return u.type==="keypress"?(u=Eg(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?lJ[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nw,charCode:function(u){return u.type==="keypress"?Eg(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?Eg(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),mJ=ca(uJ),fJ=M({},Tg,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),q3=ca(fJ),hJ=M({},ff,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nw}),pJ=ca(hJ),gJ=M({},Yd,{propertyName:0,elapsedTime:0,pseudoElement:0}),xJ=ca(gJ),yJ=M({},Tg,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),bJ=ca(yJ),vJ=[9,13,27,32],rw=l&&"CompositionEvent"in window,pf=null;l&&"documentMode"in document&&(pf=document.documentMode);var wJ=l&&"TextEvent"in window&&!pf,K3=l&&(!rw||pf&&8<pf&&11>=pf),V3=" ",H3=!1;function W3(u,p){switch(u){case"keyup":return vJ.indexOf(p.keyCode)!==-1;case"keydown":return p.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function G3(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Jd=!1;function jJ(u,p){switch(u){case"compositionend":return G3(p);case"keypress":return p.which!==32?null:(H3=!0,V3);case"textInput":return u=p.data,u===V3&&H3?null:u;default:return null}}function _J(u,p){if(Jd)return u==="compositionend"||!rw&&W3(u,p)?(u=B3(),Cg=Qv=dl=null,Jd=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(p.ctrlKey||p.altKey||p.metaKey)||p.ctrlKey&&p.altKey){if(p.char&&1<p.char.length)return p.char;if(p.which)return String.fromCharCode(p.which)}return null;case"compositionend":return K3&&p.locale!=="ko"?null:p.data;default:return null}}var NJ={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Y3(u){var p=u&&u.nodeName&&u.nodeName.toLowerCase();return p==="input"?!!NJ[u.type]:p==="textarea"}function J3(u,p,v,E){Jn(E),p=Mg(p,"onChange"),0<p.length&&(v=new Xv("onChange","change",null,v,E),u.push({event:v,listeners:p}))}var gf=null,xf=null;function SJ(u){hT(u,0)}function Pg(u){var p=tu(u);if(re(p))return u}function kJ(u,p){if(u==="change")return p}var Q3=!1;if(l){var sw;if(l){var aw="oninput"in document;if(!aw){var X3=document.createElement("div");X3.setAttribute("oninput","return;"),aw=typeof X3.oninput=="function"}sw=aw}else sw=!1;Q3=sw&&(!document.documentMode||9<document.documentMode)}function Z3(){gf&&(gf.detachEvent("onpropertychange",eT),xf=gf=null)}function eT(u){if(u.propertyName==="value"&&Pg(xf)){var p=[];J3(p,xf,u,Qe(u)),$e(SJ,p)}}function CJ(u,p,v){u==="focusin"?(Z3(),gf=p,xf=v,gf.attachEvent("onpropertychange",eT)):u==="focusout"&&Z3()}function EJ(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Pg(xf)}function AJ(u,p){if(u==="click")return Pg(p)}function TJ(u,p){if(u==="input"||u==="change")return Pg(p)}function PJ(u,p){return u===p&&(u!==0||1/u===1/p)||u!==u&&p!==p}var ci=typeof Object.is=="function"?Object.is:PJ;function yf(u,p){if(ci(u,p))return!0;if(typeof u!="object"||u===null||typeof p!="object"||p===null)return!1;var v=Object.keys(u),E=Object.keys(p);if(v.length!==E.length)return!1;for(E=0;E<v.length;E++){var O=v[E];if(!c.call(p,O)||!ci(u[O],p[O]))return!1}return!0}function tT(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function nT(u,p){var v=tT(u);u=0;for(var E;v;){if(v.nodeType===3){if(E=u+v.textContent.length,u<=p&&E>=p)return{node:v,offset:p-u};u=E}e:{for(;v;){if(v.nextSibling){v=v.nextSibling;break e}v=v.parentNode}v=void 0}v=tT(v)}}function rT(u,p){return u&&p?u===p?!0:u&&u.nodeType===3?!1:p&&p.nodeType===3?rT(u,p.parentNode):"contains"in u?u.contains(p):u.compareDocumentPosition?!!(u.compareDocumentPosition(p)&16):!1:!1}function sT(){for(var u=window,p=Ue();p instanceof u.HTMLIFrameElement;){try{var v=typeof p.contentWindow.location.href=="string"}catch{v=!1}if(v)u=p.contentWindow;else break;p=Ue(u.document)}return p}function iw(u){var p=u&&u.nodeName&&u.nodeName.toLowerCase();return p&&(p==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||p==="textarea"||u.contentEditable==="true")}function OJ(u){var p=sT(),v=u.focusedElem,E=u.selectionRange;if(p!==v&&v&&v.ownerDocument&&rT(v.ownerDocument.documentElement,v)){if(E!==null&&iw(v)){if(p=E.start,u=E.end,u===void 0&&(u=p),"selectionStart"in v)v.selectionStart=p,v.selectionEnd=Math.min(u,v.value.length);else if(u=(p=v.ownerDocument||document)&&p.defaultView||window,u.getSelection){u=u.getSelection();var O=v.textContent.length,$=Math.min(E.start,O);E=E.end===void 0?$:Math.min(E.end,O),!u.extend&&$>E&&(O=E,E=$,$=O),O=nT(v,$);var J=nT(v,E);O&&J&&(u.rangeCount!==1||u.anchorNode!==O.node||u.anchorOffset!==O.offset||u.focusNode!==J.node||u.focusOffset!==J.offset)&&(p=p.createRange(),p.setStart(O.node,O.offset),u.removeAllRanges(),$>E?(u.addRange(p),u.extend(J.node,J.offset)):(p.setEnd(J.node,J.offset),u.addRange(p)))}}for(p=[],u=v;u=u.parentNode;)u.nodeType===1&&p.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<p.length;v++)u=p[v],u.element.scrollLeft=u.left,u.element.scrollTop=u.top}}var IJ=l&&"documentMode"in document&&11>=document.documentMode,Qd=null,ow=null,bf=null,lw=!1;function aT(u,p,v){var E=v.window===v?v.document:v.nodeType===9?v:v.ownerDocument;lw||Qd==null||Qd!==Ue(E)||(E=Qd,"selectionStart"in E&&iw(E)?E={start:E.selectionStart,end:E.selectionEnd}:(E=(E.ownerDocument&&E.ownerDocument.defaultView||window).getSelection(),E={anchorNode:E.anchorNode,anchorOffset:E.anchorOffset,focusNode:E.focusNode,focusOffset:E.focusOffset}),bf&&yf(bf,E)||(bf=E,E=Mg(ow,"onSelect"),0<E.length&&(p=new Xv("onSelect","select",null,p,v),u.push({event:p,listeners:E}),p.target=Qd)))}function Og(u,p){var v={};return v[u.toLowerCase()]=p.toLowerCase(),v["Webkit"+u]="webkit"+p,v["Moz"+u]="moz"+p,v}var Xd={animationend:Og("Animation","AnimationEnd"),animationiteration:Og("Animation","AnimationIteration"),animationstart:Og("Animation","AnimationStart"),transitionend:Og("Transition","TransitionEnd")},cw={},iT={};l&&(iT=document.createElement("div").style,"AnimationEvent"in window||(delete Xd.animationend.animation,delete Xd.animationiteration.animation,delete Xd.animationstart.animation),"TransitionEvent"in window||delete Xd.transitionend.transition);function Ig(u){if(cw[u])return cw[u];if(!Xd[u])return u;var p=Xd[u],v;for(v in p)if(p.hasOwnProperty(v)&&v in iT)return cw[u]=p[v];return u}var oT=Ig("animationend"),lT=Ig("animationiteration"),cT=Ig("animationstart"),dT=Ig("transitionend"),uT=new Map,mT="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ul(u,p){uT.set(u,p),i(p,[u])}for(var dw=0;dw<mT.length;dw++){var uw=mT[dw],RJ=uw.toLowerCase(),MJ=uw[0].toUpperCase()+uw.slice(1);ul(RJ,"on"+MJ)}ul(oT,"onAnimationEnd"),ul(lT,"onAnimationIteration"),ul(cT,"onAnimationStart"),ul("dblclick","onDoubleClick"),ul("focusin","onFocus"),ul("focusout","onBlur"),ul(dT,"onTransitionEnd"),o("onMouseEnter",["mouseout","mouseover"]),o("onMouseLeave",["mouseout","mouseover"]),o("onPointerEnter",["pointerout","pointerover"]),o("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),DJ=new Set("cancel close invalid load scroll toggle".split(" ").concat(vf));function fT(u,p,v){var E=u.type||"unknown-event";u.currentTarget=v,zs(E,p,void 0,u),u.currentTarget=null}function hT(u,p){p=(p&4)!==0;for(var v=0;v<u.length;v++){var E=u[v],O=E.event;E=E.listeners;e:{var $=void 0;if(p)for(var J=E.length-1;0<=J;J--){var se=E[J],pe=se.instance,Ie=se.currentTarget;if(se=se.listener,pe!==$&&O.isPropagationStopped())break e;fT(O,se,Ie),$=pe}else for(J=0;J<E.length;J++){if(se=E[J],pe=se.instance,Ie=se.currentTarget,se=se.listener,pe!==$&&O.isPropagationStopped())break e;fT(O,se,Ie),$=pe}}}if(Ut)throw u=$t,Ut=!1,$t=null,u}function sr(u,p){var v=p[bw];v===void 0&&(v=p[bw]=new Set);var E=u+"__bubble";v.has(E)||(pT(p,u,2,!1),v.add(E))}function mw(u,p,v){var E=0;p&&(E|=4),pT(v,u,E,p)}var Rg="_reactListening"+Math.random().toString(36).slice(2);function wf(u){if(!u[Rg]){u[Rg]=!0,s.forEach(function(v){v!=="selectionchange"&&(DJ.has(v)||mw(v,!1,u),mw(v,!0,u))});var p=u.nodeType===9?u:u.ownerDocument;p===null||p[Rg]||(p[Rg]=!0,mw("selectionchange",!1,p))}}function pT(u,p,v,E){switch($3(p)){case 1:var O=br;break;case 4:O=Gv;break;default:O=Yv}v=O.bind(null,p,v,u),O=void 0,!Q||p!=="touchstart"&&p!=="touchmove"&&p!=="wheel"||(O=!0),E?O!==void 0?u.addEventListener(p,v,{capture:!0,passive:O}):u.addEventListener(p,v,!0):O!==void 0?u.addEventListener(p,v,{passive:O}):u.addEventListener(p,v,!1)}function fw(u,p,v,E,O){var $=E;if((p&1)===0&&(p&2)===0&&E!==null)e:for(;;){if(E===null)return;var J=E.tag;if(J===3||J===4){var se=E.stateNode.containerInfo;if(se===O||se.nodeType===8&&se.parentNode===O)break;if(J===4)for(J=E.return;J!==null;){var pe=J.tag;if((pe===3||pe===4)&&(pe=J.stateNode.containerInfo,pe===O||pe.nodeType===8&&pe.parentNode===O))return;J=J.return}for(;se!==null;){if(J=Tc(se),J===null)return;if(pe=J.tag,pe===5||pe===6){E=$=J;continue e}se=se.parentNode}}E=E.return}$e(function(){var Ie=$,Je=Qe(v),et=[];e:{var Ge=uT.get(u);if(Ge!==void 0){var xt=Xv,kt=u;switch(u){case"keypress":if(Eg(v)===0)break e;case"keydown":case"keyup":xt=mJ;break;case"focusin":kt="focus",xt=tw;break;case"focusout":kt="blur",xt=tw;break;case"beforeblur":case"afterblur":xt=tw;break;case"click":if(v.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":xt=z3;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":xt=eJ;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":xt=pJ;break;case oT:case lT:case cT:xt=rJ;break;case dT:xt=xJ;break;case"scroll":xt=XY;break;case"wheel":xt=bJ;break;case"copy":case"cut":case"paste":xt=aJ;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":xt=q3}var Pt=(p&4)!==0,kr=!Pt&&u==="scroll",Ce=Pt?Ge!==null?Ge+"Capture":null:Ge;Pt=[];for(var be=Ie,Ae;be!==null;){Ae=be;var st=Ae.stateNode;if(Ae.tag===5&&st!==null&&(Ae=st,Ce!==null&&(st=he(be,Ce),st!=null&&Pt.push(jf(be,st,Ae)))),kr)break;be=be.return}0<Pt.length&&(Ge=new xt(Ge,kt,null,v,Je),et.push({event:Ge,listeners:Pt}))}}if((p&7)===0){e:{if(Ge=u==="mouseover"||u==="pointerover",xt=u==="mouseout"||u==="pointerout",Ge&&v!==we&&(kt=v.relatedTarget||v.fromElement)&&(Tc(kt)||kt[bo]))break e;if((xt||Ge)&&(Ge=Je.window===Je?Je:(Ge=Je.ownerDocument)?Ge.defaultView||Ge.parentWindow:window,xt?(kt=v.relatedTarget||v.toElement,xt=Ie,kt=kt?Tc(kt):null,kt!==null&&(kr=oe(kt),kt!==kr||kt.tag!==5&&kt.tag!==6)&&(kt=null)):(xt=null,kt=Ie),xt!==kt)){if(Pt=z3,st="onMouseLeave",Ce="onMouseEnter",be="mouse",(u==="pointerout"||u==="pointerover")&&(Pt=q3,st="onPointerLeave",Ce="onPointerEnter",be="pointer"),kr=xt==null?Ge:tu(xt),Ae=kt==null?Ge:tu(kt),Ge=new Pt(st,be+"leave",xt,v,Je),Ge.target=kr,Ge.relatedTarget=Ae,st=null,Tc(Je)===Ie&&(Pt=new Pt(Ce,be+"enter",kt,v,Je),Pt.target=Ae,Pt.relatedTarget=kr,st=Pt),kr=st,xt&&kt)t:{for(Pt=xt,Ce=kt,be=0,Ae=Pt;Ae;Ae=Zd(Ae))be++;for(Ae=0,st=Ce;st;st=Zd(st))Ae++;for(;0<be-Ae;)Pt=Zd(Pt),be--;for(;0<Ae-be;)Ce=Zd(Ce),Ae--;for(;be--;){if(Pt===Ce||Ce!==null&&Pt===Ce.alternate)break t;Pt=Zd(Pt),Ce=Zd(Ce)}Pt=null}else Pt=null;xt!==null&&gT(et,Ge,xt,Pt,!1),kt!==null&&kr!==null&&gT(et,kr,kt,Pt,!0)}}e:{if(Ge=Ie?tu(Ie):window,xt=Ge.nodeName&&Ge.nodeName.toLowerCase(),xt==="select"||xt==="input"&&Ge.type==="file")var Ot=kJ;else if(Y3(Ge))if(Q3)Ot=TJ;else{Ot=EJ;var Ft=CJ}else(xt=Ge.nodeName)&&xt.toLowerCase()==="input"&&(Ge.type==="checkbox"||Ge.type==="radio")&&(Ot=AJ);if(Ot&&(Ot=Ot(u,Ie))){J3(et,Ot,v,Je);break e}Ft&&Ft(u,Ge,Ie),u==="focusout"&&(Ft=Ge._wrapperState)&&Ft.controlled&&Ge.type==="number"&&Xe(Ge,"number",Ge.value)}switch(Ft=Ie?tu(Ie):window,u){case"focusin":(Y3(Ft)||Ft.contentEditable==="true")&&(Qd=Ft,ow=Ie,bf=null);break;case"focusout":bf=ow=Qd=null;break;case"mousedown":lw=!0;break;case"contextmenu":case"mouseup":case"dragend":lw=!1,aT(et,v,Je);break;case"selectionchange":if(IJ)break;case"keydown":case"keyup":aT(et,v,Je)}var zt;if(rw)e:{switch(u){case"compositionstart":var Jt="onCompositionStart";break e;case"compositionend":Jt="onCompositionEnd";break e;case"compositionupdate":Jt="onCompositionUpdate";break e}Jt=void 0}else Jd?W3(u,v)&&(Jt="onCompositionEnd"):u==="keydown"&&v.keyCode===229&&(Jt="onCompositionStart");Jt&&(K3&&v.locale!=="ko"&&(Jd||Jt!=="onCompositionStart"?Jt==="onCompositionEnd"&&Jd&&(zt=B3()):(dl=Je,Qv="value"in dl?dl.value:dl.textContent,Jd=!0)),Ft=Mg(Ie,Jt),0<Ft.length&&(Jt=new U3(Jt,u,null,v,Je),et.push({event:Jt,listeners:Ft}),zt?Jt.data=zt:(zt=G3(v),zt!==null&&(Jt.data=zt)))),(zt=wJ?jJ(u,v):_J(u,v))&&(Ie=Mg(Ie,"onBeforeInput"),0<Ie.length&&(Je=new U3("onBeforeInput","beforeinput",null,v,Je),et.push({event:Je,listeners:Ie}),Je.data=zt))}hT(et,p)})}function jf(u,p,v){return{instance:u,listener:p,currentTarget:v}}function Mg(u,p){for(var v=p+"Capture",E=[];u!==null;){var O=u,$=O.stateNode;O.tag===5&&$!==null&&(O=$,$=he(u,v),$!=null&&E.unshift(jf(u,$,O)),$=he(u,p),$!=null&&E.push(jf(u,$,O))),u=u.return}return E}function Zd(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5);return u||null}function gT(u,p,v,E,O){for(var $=p._reactName,J=[];v!==null&&v!==E;){var se=v,pe=se.alternate,Ie=se.stateNode;if(pe!==null&&pe===E)break;se.tag===5&&Ie!==null&&(se=Ie,O?(pe=he(v,$),pe!=null&&J.unshift(jf(v,pe,se))):O||(pe=he(v,$),pe!=null&&J.push(jf(v,pe,se)))),v=v.return}J.length!==0&&u.push({event:p,listeners:J})}var LJ=/\r\n?/g,$J=/\u0000|\uFFFD/g;function xT(u){return(typeof u=="string"?u:""+u).replace(LJ,`
38`).replace($J,"")}function Dg(u,p,v){if(p=xT(p),xT(u)!==p&&v)throw Error(n(425))}function Lg(){}var hw=null,pw=null;function gw(u,p){return u==="textarea"||u==="noscript"||typeof p.children=="string"||typeof p.children=="number"||typeof p.dangerouslySetInnerHTML=="object"&&p.dangerouslySetInnerHTML!==null&&p.dangerouslySetInnerHTML.__html!=null}var xw=typeof setTimeout=="function"?setTimeout:void 0,BJ=typeof clearTimeout=="function"?clearTimeout:void 0,yT=typeof Promise=="function"?Promise:void 0,FJ=typeof queueMicrotask=="function"?queueMicrotask:typeof yT<"u"?function(u){return yT.resolve(null).then(u).catch(zJ)}:xw;function zJ(u){setTimeout(function(){throw u})}function yw(u,p){var v=p,E=0;do{var O=v.nextSibling;if(u.removeChild(v),O&&O.nodeType===8)if(v=O.data,v==="/$"){if(E===0){u.removeChild(O),cl(p);return}E--}else v!=="$"&&v!=="$?"&&v!=="$!"||E++;v=O}while(v);cl(p)}function ml(u){for(;u!=null;u=u.nextSibling){var p=u.nodeType;if(p===1||p===3)break;if(p===8){if(p=u.data,p==="$"||p==="$!"||p==="$?")break;if(p==="/$")return null}}return u}function bT(u){u=u.previousSibling;for(var p=0;u;){if(u.nodeType===8){var v=u.data;if(v==="$"||v==="$!"||v==="$?"){if(p===0)return u;p--}else v==="/$"&&p++}u=u.previousSibling}return null}var eu=Math.random().toString(36).slice(2),Bi="__reactFiber$"+eu,_f="__reactProps$"+eu,bo="__reactContainer$"+eu,bw="__reactEvents$"+eu,UJ="__reactListeners$"+eu,qJ="__reactHandles$"+eu;function Tc(u){var p=u[Bi];if(p)return p;for(var v=u.parentNode;v;){if(p=v[bo]||v[Bi]){if(v=p.alternate,p.child!==null||v!==null&&v.child!==null)for(u=bT(u);u!==null;){if(v=u[Bi])return v;u=bT(u)}return p}u=v,v=u.parentNode}return null}function Nf(u){return u=u[Bi]||u[bo],!u||u.tag!==5&&u.tag!==6&&u.tag!==13&&u.tag!==3?null:u}function tu(u){if(u.tag===5||u.tag===6)return u.stateNode;throw Error(n(33))}function $g(u){return u[_f]||null}var vw=[],nu=-1;function fl(u){return{current:u}}
vendor: 7,437 bytes, line 38
38function ar(u){0>nu||(u.current=vw[nu],vw[nu]=null,nu--)}function Xn(u,p){nu++,vw[nu]=u.current,u.current=p}var hl={},bs=fl(hl),Ks=fl(!1),Pc=hl;function ru(u,p){var v=u.type.contextTypes;if(!v)return hl;var E=u.stateNode;if(E&&E.__reactInternalMemoizedUnmaskedChildContext===p)return E.__reactInternalMemoizedMaskedChildContext;var O={},$;for($ in v)O[$]=p[$];return E&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=p,u.__reactInternalMemoizedMaskedChildContext=O),O}function Vs(u){return u=u.childContextTypes,u!=null}function Bg(){ar(Ks),ar(bs)}function vT(u,p,v){if(bs.current!==hl)throw Error(n(168));Xn(bs,p),Xn(Ks,v)}function wT(u,p,v){var E=u.stateNode;if(p=p.childContextTypes,typeof E.getChildContext!="function")return v;E=E.getChildContext();for(var O in E)if(!(O in p))throw Error(n(108,X(u)||"Unknown",O));return M({},v,E)}function Fg(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||hl,Pc=bs.current,Xn(bs,u),Xn(Ks,Ks.current),!0}function jT(u,p,v){var E=u.stateNode;if(!E)throw Error(n(169));v?(u=wT(u,p,Pc),E.__reactInternalMemoizedMergedChildContext=u,ar(Ks),ar(bs),Xn(bs,u)):ar(Ks),Xn(Ks,v)}var vo=null,zg=!1,ww=!1;function _T(u){vo===null?vo=[u]:vo.push(u)}function KJ(u){zg=!0,_T(u)}function pl(){if(!ww&&vo!==null){ww=!0;var u=0,p=qe;try{var v=vo;for(qe=1;u<v.length;u++){var E=v[u];do E=E(!0);while(E!==null)}vo=null,zg=!1}catch(O){throw vo!==null&&(vo=vo.slice(u+1)),Xt(la,pl),O}finally{qe=p,ww=!1}}return null}var su=[],au=0,Ug=null,qg=0,Oa=[],Ia=0,Oc=null,wo=1,jo="";function Ic(u,p){su[au++]=qg,su[au++]=Ug,Ug=u,qg=p}function NT(u,p,v){Oa[Ia++]=wo,Oa[Ia++]=jo,Oa[Ia++]=Oc,Oc=u;var E=wo;u=jo;var O=32-hr(E)-1;E&=~(1<<O),v+=1;var $=32-hr(p)+O;if(30<$){var J=O-O%5;$=(E&(1<<J)-1).toString(32),E>>=J,O-=J,wo=1<<32-hr(p)+O|v<<O|E,jo=$+u}else wo=1<<$|v<<O|E,jo=u}function jw(u){u.return!==null&&(Ic(u,1),NT(u,1,0))}function _w(u){for(;u===Ug;)Ug=su[--au],su[au]=null,qg=su[--au],su[au]=null;for(;u===Oc;)Oc=Oa[--Ia],Oa[Ia]=null,jo=Oa[--Ia],Oa[Ia]=null,wo=Oa[--Ia],Oa[Ia]=null}var da=null,ua=null,lr=!1,di=null;function ST(u,p){var v=La(5,null,null,0);v.elementType="DELETED",v.stateNode=p,v.return=u,p=u.deletions,p===null?(u.deletions=[v],u.flags|=16):p.push(v)}function kT(u,p){switch(u.tag){case 5:var v=u.type;return p=p.nodeType!==1||v.toLowerCase()!==p.nodeName.toLowerCase()?null:p,p!==null?(u.stateNode=p,da=u,ua=ml(p.firstChild),!0):!1;case 6:return p=u.pendingProps===""||p.nodeType!==3?null:p,p!==null?(u.stateNode=p,da=u,ua=null,!0):!1;case 13:return p=p.nodeType!==8?null:p,p!==null?(v=Oc!==null?{id:wo,overflow:jo}:null,u.memoizedState={dehydrated:p,treeContext:v,retryLane:1073741824},v=La(18,null,null,0),v.stateNode=p,v.return=u,u.child=v,da=u,ua=null,!0):!1;default:return!1}}function Nw(u){return(u.mode&1)!==0&&(u.flags&128)===0}function Sw(u){if(lr){var p=ua;if(p){var v=p;if(!kT(u,p)){if(Nw(u))throw Error(n(418));p=ml(v.nextSibling);var E=da;p&&kT(u,p)?ST(E,v):(u.flags=u.flags&-4097|2,lr=!1,da=u)}}else{if(Nw(u))throw Error(n(418));u.flags=u.flags&-4097|2,lr=!1,da=u}}}function CT(u){for(u=u.return;u!==null&&u.tag!==5&&u.tag!==3&&u.tag!==13;)u=u.return;da=u}function Kg(u){if(u!==da)return!1;if(!lr)return CT(u),lr=!0,!1;var p;if((p=u.tag!==3)&&!(p=u.tag!==5)&&(p=u.type,p=p!=="head"&&p!=="body"&&!gw(u.type,u.memoizedProps)),p&&(p=ua)){if(Nw(u))throw ET(),Error(n(418));for(;p;)ST(u,p),p=ml(p.nextSibling)}if(CT(u),u.tag===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(n(317));e:{for(u=u.nextSibling,p=0;u;){if(u.nodeType===8){var v=u.data;if(v==="/$"){if(p===0){ua=ml(u.nextSibling);break e}p--}else v!=="$"&&v!=="$!"&&v!=="$?"||p++}u=u.nextSibling}ua=null}}else ua=da?ml(u.stateNode.nextSibling):null;return!0}function ET(){for(var u=ua;u;)u=ml(u.nextSibling)}function iu(){ua=da=null,lr=!1}function kw(u){di===null?di=[u]:di.push(u)}var VJ=C.ReactCurrentBatchConfig;function Sf(u,p,v){if(u=v.ref,u!==null&&typeof u!="function"&&typeof u!="object"){if(v._owner){if(v=v._owner,v){if(v.tag!==1)throw Error(n(309));var E=v.stateNode}if(!E)throw Error(n(147,u));var O=E,$=""+u;return p!==null&&p.ref!==null&&typeof p.ref=="function"&&p.ref._stringRef===$?p.ref:(p=function(J){var se=O.refs;J===null?delete se[$]:se[$]=J},p._stringRef=$,p)}if(typeof u!="string")throw Error(n(284));if(!v._owner)throw Error(n(290,u))}return u}function Vg(u,p){throw u=Object.prototype.toString.call(p),Error(n(31,u==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":u))}function AT(u){var p=u._init;return p(u._payload)}function TT(u){function p(Ce,be){if(u){var Ae=Ce.deletions;Ae===null?(Ce.deletions=[be],Ce.flags|=16):Ae.push(be)}}function v(Ce,be){if(!u)return null;for(;be!==null;)p(Ce,be),be=be.sibling;return null}function E(Ce,be){for(Ce=new Map;be!==null;)be.key!==null?Ce.set(be.key,be):Ce.set(be.index,be),be=be.sibling;return Ce}function O(Ce,be){return Ce=_l(Ce,be),Ce.index=0,Ce.sibling=null,Ce}function $(Ce,be,Ae){return Ce.index=Ae,u?(Ae=Ce.alternate,Ae!==null?(Ae=Ae.index,Ae<be?(Ce.flags|=2,be):Ae):(Ce.flags|=2,be)):(Ce.flags|=1048576,be)}function J(Ce){return u&&Ce.alternate===null&&(Ce.flags|=2),Ce}function se(Ce,be,Ae,st){return be===null||be.tag!==6?(be=xj(Ae,Ce.mode,st),be.return=Ce,be):(be=O(be,Ae),be.return=Ce,be)}function pe(Ce,be,Ae,st){var Ot=Ae.type;return Ot===A?Je(Ce,be,Ae.props.children,st,Ae.key):be!==null&&(be.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===H&&AT(Ot)===be.type)?(st=O(be,Ae.props),st.ref=Sf(Ce,be,Ae),st.return=Ce,st):(st=px(Ae.type,Ae.key,Ae.props,null,Ce.mode,st),st.ref=Sf(Ce,be,Ae),st.return=Ce,st)}function Ie(Ce,be,Ae,st){return be===null||be.tag!==4||be.stateNode.containerInfo!==Ae.containerInfo||be.stateNode.implementation!==Ae.implementation?(be=yj(Ae,Ce.mode,st),be.return=Ce,be):(be=O(be,Ae.children||[]),be.return=Ce,be)}function Je(Ce,be,Ae,st,Ot){return be===null||be.tag!==7?(be=zc(Ae,Ce.mode,st,Ot),be.return=Ce,be):(be=O(be,Ae),be.return=Ce,be)}function et(Ce,be,Ae){if(typeof be=="string"&&be!==""||typeof be=="number")return be=xj(""+be,Ce.mode,Ae),be.return=Ce,be;if(typeof be=="object"&&be!==null){switch(be.$$typeof){case k:return Ae=px(be.type,be.key,be.props,null,Ce.mode,Ae),Ae.ref=Sf(Ce,null,be),Ae.return=Ce,Ae;case S:return be=yj(be,Ce.mode,Ae),be.return=Ce,be;case H:var st=be._init;return et(Ce,st(be._payload),Ae)}if(te(be)||K(be))return be=zc(be,Ce.mode,Ae,null),be.return=Ce,be;Vg(Ce,be)}return null}function Ge(Ce,be,Ae,st){var Ot=be!==null?be.key:null;if(typeof Ae=="string"&&Ae!==""||typeof Ae=="number")return Ot!==null?null:se(Ce,be,""+Ae,st);if(typeof Ae=="object"&&Ae!==null){switch(Ae.$$typeof){case k:return Ae.key===Ot?pe(Ce,be,Ae,st):null;case S:return Ae.key===Ot?Ie(Ce,be,Ae,st):null;case H:return Ot=Ae._init,Ge(Ce,be,Ot(Ae._payload),st)}if(te(Ae)||K(Ae))return Ot!==null?null:Je(Ce,be,Ae,st,null);Vg(Ce,Ae)}return null}function xt(Ce,be,Ae,st,Ot){if(typeof st=="string"&&st!==""||typeof st=="number")return Ce=Ce.get(Ae)||null,se(be,Ce,""+st,Ot);if(typeof st=="object"&&st!==null){switch(st.$$typeof){case k:return Ce=Ce.get(st.key===null?Ae:st.key)||null,pe(be,Ce,st,Ot);case S:return Ce=Ce.get(st.key===null?Ae:st.key)||null,Ie(be,Ce,st,Ot);case H:var Ft=st._init;return xt(Ce,be,Ae,Ft(st._payload),Ot)}if(te(st)||K(st))return Ce=Ce.get(Ae)||null,Je(be,Ce,st,Ot,null);Vg(be,st)}return null}function kt(Ce,be,Ae,st){for(var Ot=null,Ft=null,zt=be,Jt=be=0,Xr=null;zt!==null&&Jt<Ae.length;Jt++){zt.index>
vendor: 9,498 bytes, line 38
38Jt?(Xr=zt,zt=null):Xr=zt.sibling;var An=Ge(Ce,zt,Ae[Jt],st);if(An===null){zt===null&&(zt=Xr);break}u&&zt&&An.alternate===null&&p(Ce,zt),be=$(An,be,Jt),Ft===null?Ot=An:Ft.sibling=An,Ft=An,zt=Xr}if(Jt===Ae.length)return v(Ce,zt),lr&&Ic(Ce,Jt),Ot;if(zt===null){for(;Jt<Ae.length;Jt++)zt=et(Ce,Ae[Jt],st),zt!==null&&(be=$(zt,be,Jt),Ft===null?Ot=zt:Ft.sibling=zt,Ft=zt);return lr&&Ic(Ce,Jt),Ot}for(zt=E(Ce,zt);Jt<Ae.length;Jt++)Xr=xt(zt,Ce,Jt,Ae[Jt],st),Xr!==null&&(u&&Xr.alternate!==null&&zt.delete(Xr.key===null?Jt:Xr.key),be=$(Xr,be,Jt),Ft===null?Ot=Xr:Ft.sibling=Xr,Ft=Xr);return u&&zt.forEach(function(Nl){return p(Ce,Nl)}),lr&&Ic(Ce,Jt),Ot}function Pt(Ce,be,Ae,st){var Ot=K(Ae);if(typeof Ot!="function")throw Error(n(150));if(Ae=Ot.call(Ae),Ae==null)throw Error(n(151));for(var Ft=Ot=null,zt=be,Jt=be=0,Xr=null,An=Ae.next();zt!==null&&!An.done;Jt++,An=Ae.next()){zt.index>Jt?(Xr=zt,zt=null):Xr=zt.sibling;var Nl=Ge(Ce,zt,An.value,st);if(Nl===null){zt===null&&(zt=Xr);break}u&&zt&&Nl.alternate===null&&p(Ce,zt),be=$(Nl,be,Jt),Ft===null?Ot=Nl:Ft.sibling=Nl,Ft=Nl,zt=Xr}if(An.done)return v(Ce,zt),lr&&Ic(Ce,Jt),Ot;if(zt===null){for(;!An.done;Jt++,An=Ae.next())An=et(Ce,An.value,st),An!==null&&(be=$(An,be,Jt),Ft===null?Ot=An:Ft.sibling=An,Ft=An);return lr&&Ic(Ce,Jt),Ot}for(zt=E(Ce,zt);!An.done;Jt++,An=Ae.next())An=xt(zt,Ce,Jt,An.value,st),An!==null&&(u&&An.alternate!==null&&zt.delete(An.key===null?Jt:An.key),be=$(An,be,Jt),Ft===null?Ot=An:Ft.sibling=An,Ft=An);return u&&zt.forEach(function(NQ){return p(Ce,NQ)}),lr&&Ic(Ce,Jt),Ot}function kr(Ce,be,Ae,st){if(typeof Ae=="object"&&Ae!==null&&Ae.type===A&&Ae.key===null&&(Ae=Ae.props.children),typeof Ae=="object"&&Ae!==null){switch(Ae.$$typeof){case k:e:{for(var Ot=Ae.key,Ft=be;Ft!==null;){if(Ft.key===Ot){if(Ot=Ae.type,Ot===A){if(Ft.tag===7){v(Ce,Ft.sibling),be=O(Ft,Ae.props.children),be.return=Ce,Ce=be;break e}}else if(Ft.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===H&&AT(Ot)===Ft.type){v(Ce,Ft.sibling),be=O(Ft,Ae.props),be.ref=Sf(Ce,Ft,Ae),be.return=Ce,Ce=be;break e}v(Ce,Ft);break}else p(Ce,Ft);Ft=Ft.sibling}Ae.type===A?(be=zc(Ae.props.children,Ce.mode,st,Ae.key),be.return=Ce,Ce=be):(st=px(Ae.type,Ae.key,Ae.props,null,Ce.mode,st),st.ref=Sf(Ce,be,Ae),st.return=Ce,Ce=st)}return J(Ce);case S:e:{for(Ft=Ae.key;be!==null;){if(be.key===Ft)if(be.tag===4&&be.stateNode.containerInfo===Ae.containerInfo&&be.stateNode.implementation===Ae.implementation){v(Ce,be.sibling),be=O(be,Ae.children||[]),be.return=Ce,Ce=be;break e}else{v(Ce,be);break}else p(Ce,be);be=be.sibling}be=yj(Ae,Ce.mode,st),be.return=Ce,Ce=be}return J(Ce);case H:return Ft=Ae._init,kr(Ce,be,Ft(Ae._payload),st)}if(te(Ae))return kt(Ce,be,Ae,st);if(K(Ae))return Pt(Ce,be,Ae,st);Vg(Ce,Ae)}return typeof Ae=="string"&&Ae!==""||typeof Ae=="number"?(Ae=""+Ae,be!==null&&be.tag===6?(v(Ce,be.sibling),be=O(be,Ae),be.return=Ce,Ce=be):(v(Ce,be),be=xj(Ae,Ce.mode,st),be.return=Ce,Ce=be),J(Ce)):v(Ce,be)}return kr}var ou=TT(!0),PT=TT(!1),Hg=fl(null),Wg=null,lu=null,Cw=null;function Ew(){Cw=lu=Wg=null}function Aw(u){var p=Hg.current;ar(Hg),u._currentValue=p}function Tw(u,p,v){for(;u!==null;){var E=u.alternate;if((u.childLanes&p)!==p?(u.childLanes|=p,E!==null&&(E.childLanes|=p)):E!==null&&(E.childLanes&p)!==p&&(E.childLanes|=p),u===v)break;u=u.return}}function cu(u,p){Wg=u,Cw=lu=null,u=u.dependencies,u!==null&&u.firstContext!==null&&((u.lanes&p)!==0&&(Hs=!0),u.firstContext=null)}function Ra(u){var p=u._currentValue;if(Cw!==u)if(u={context:u,memoizedValue:p,next:null},lu===null){if(Wg===null)throw Error(n(308));lu=u,Wg.dependencies={lanes:0,firstContext:u}}else lu=lu.next=u;return p}var Rc=null;function Pw(u){Rc===null?Rc=[u]:Rc.push(u)}function OT(u,p,v,E){var O=p.interleaved;return O===null?(v.next=v,Pw(p)):(v.next=O.next,O.next=v),p.interleaved=v,_o(u,E)}function _o(u,p){u.lanes|=p;var v=u.alternate;for(v!==null&&(v.lanes|=p),v=u,u=u.return;u!==null;)u.childLanes|=p,v=u.alternate,v!==null&&(v.childLanes|=p),v=u,u=u.return;return v.tag===3?v.stateNode:null}var gl=!1;function Ow(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function IT(u,p){u=u.updateQueue,p.updateQueue===u&&(p.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function No(u,p){return{eventTime:u,lane:p,tag:0,payload:null,callback:null,next:null}}function xl(u,p,v){var E=u.updateQueue;if(E===null)return null;if(E=E.shared,(Sn&2)!==0){var O=E.pending;return O===null?p.next=p:(p.next=O.next,O.next=p),E.pending=p,_o(u,v)}return O=E.interleaved,O===null?(p.next=p,Pw(E)):(p.next=O.next,O.next=p),E.interleaved=p,_o(u,v)}function Gg(u,p,v){if(p=p.updateQueue,p!==null&&(p=p.shared,(v&4194240)!==0)){var E=p.lanes;E&=u.pendingLanes,v|=E,p.lanes=v,ye(u,v)}}function RT(u,p){var v=u.updateQueue,E=u.alternate;if(E!==null&&(E=E.updateQueue,v===E)){var O=null,$=null;if(v=v.firstBaseUpdate,v!==null){do{var J={eventTime:v.eventTime,lane:v.lane,tag:v.tag,payload:v.payload,callback:v.callback,next:null};$===null?O=$=J:$=$.next=J,v=v.next}while(v!==null);$===null?O=$=p:$=$.next=p}else O=$=p;v={baseState:E.baseState,firstBaseUpdate:O,lastBaseUpdate:$,shared:E.shared,effects:E.effects},u.updateQueue=v;return}u=v.lastBaseUpdate,u===null?v.firstBaseUpdate=p:u.next=p,v.lastBaseUpdate=p}function Yg(u,p,v,E){var O=u.updateQueue;gl=!1;var $=O.firstBaseUpdate,J=O.lastBaseUpdate,se=O.shared.pending;if(se!==null){O.shared.pending=null;var pe=se,Ie=pe.next;pe.next=null,J===null?$=Ie:J.next=Ie,J=pe;var Je=u.alternate;Je!==null&&(Je=Je.updateQueue,se=Je.lastBaseUpdate,se!==J&&(se===null?Je.firstBaseUpdate=Ie:se.next=Ie,Je.lastBaseUpdate=pe))}if($!==null){var et=O.baseState;J=0,Je=Ie=pe=null,se=$;do{var Ge=se.lane,xt=se.eventTime;if((E&Ge)===Ge){Je!==null&&(Je=Je.next={eventTime:xt,lane:0,tag:se.tag,payload:se.payload,callback:se.callback,next:null});e:{var kt=u,Pt=se;switch(Ge=p,xt=v,Pt.tag){case 1:if(kt=Pt.payload,typeof kt=="function"){et=kt.call(xt,et,Ge);break e}et=kt;break e;case 3:kt.flags=kt.flags&-65537|128;case 0:if(kt=Pt.payload,Ge=typeof kt=="function"?kt.call(xt,et,Ge):kt,Ge==null)break e;et=M({},et,Ge);break e;case 2:gl=!0}}se.callback!==null&&se.lane!==0&&(u.flags|=64,Ge=O.effects,Ge===null?O.effects=[se]:Ge.push(se))}else xt={eventTime:xt,lane:Ge,tag:se.tag,payload:se.payload,callback:se.callback,next:null},Je===null?(Ie=Je=xt,pe=et):Je=Je.next=xt,J|=Ge;if(se=se.next,se===null){if(se=O.shared.pending,se===null)break;Ge=se,se=Ge.next,Ge.next=null,O.lastBaseUpdate=Ge,O.shared.pending=null}}while(!0);if(Je===null&&(pe=et),O.baseState=pe,O.firstBaseUpdate=Ie,O.lastBaseUpdate=Je,p=O.shared.interleaved,p!==null){O=p;do J|=O.lane,O=O.next;while(O!==p)}else $===null&&(O.shared.lanes=0);Lc|=J,u.lanes=J,u.memoizedState=et}}function MT(u,p,v){if(u=p.effects,p.effects=null,u!==null)for(p=0;p<u.length;p++){var E=u[p],O=E.callback;if(O!==null){if(E.callback=null,E=v,typeof O!="function")throw Error(n(191,O));O.call(E)}}}var kf={},Fi=fl(kf),Cf=fl(kf),Ef=fl(kf);function Mc(u){if(u===kf)throw Error(n(174));return u}function Iw(u,p){switch(Xn(Ef,p),Xn(Cf,u),Xn(Fi,kf),u=p.nodeType,u){case 9:case 11:p=(p=p.documentElement)?p.namespaceURI:Se(null,"");break;default:u=u===8?p.parentNode:p,p=u.namespaceURI||null,u=u.tagName,p=Se(p,u)}ar(Fi),Xn(Fi,p)}function du(){ar(Fi),ar(Cf),ar(Ef)}function DT(u){Mc(Ef.current);var p=Mc(Fi.current),v=Se(p,u.type);p!==v&&(Xn(Cf,u),Xn(Fi,v))}function Rw(u){Cf.current===u&&(ar(Fi),ar(Cf))}var pr=fl(0);function Jg(u){for(var p=u;p!==null;){if(p.tag===13){var v=p.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||v.data==="$?"||v.data==="$!"))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if((p.flags&128)!==0)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===u)break;for(;p.sibling===null;){if(p.return===null||p.return===u)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var Mw=[];function Dw(){for(var u=0;u<Mw.length;u++)Mw[u]._workInProgressVersionPrimary=null;Mw.length=0}var Qg=C.ReactCurrentDispatcher,Lw=C.ReactCurrentBatchConfig,Dc=0,gr=null,Ur=null,Jr=null,Xg=!1,Af=!1,Tf=0,HJ=0;function vs(){throw Error(n(321))}function $w(u,p){if(p===null)return!1;for(var v=0;v<p.length&&v<u.length;v++)if(!ci(u[v],p[v]))return!1;return!0}function Bw(u,p,v,E,O,$){if(Dc=$,gr=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,Qg.current=u===null||u.memoizedState===null?JJ:QJ,u=v(E,O),Af){$=0;do{if(Af=!1,Tf=0,25<=$)throw Error(n(301));$+=1,Jr=Ur=null,p.updateQueue=null,Qg.current=XJ,u=v(E,O)}while(Af)}if(Qg.current=tx,p=Ur!==null&&Ur.next!==null,Dc=0,Jr=Ur=gr=null,Xg=!1,p)throw Error(n(300));return u}function Fw(){var u=Tf!==0;return Tf=0,u}function zi(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jr===null?gr.memoizedState=Jr=u:Jr=Jr.next=u,Jr}function Ma(){if(Ur===null){var u=gr.alternate;u=u!==null?u.memoizedState:null}else u=Ur.next;var p=Jr===null?gr.memoizedState:Jr.next;if(p!==null)Jr=p,Ur=u;else{if(u===null)throw Error(n(310));Ur=u,u={memoizedState:Ur.memoizedState,baseState:Ur.baseState,baseQueue:Ur.baseQueue,queue:Ur.queue,next:null},Jr===null?gr.memoizedState=Jr=u:Jr=Jr.next=u}return Jr}function Pf(u,p){return typeof p=="function"?p(u):p}function zw(u){var p=Ma(),v=p.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=u;var E=Ur,O=E.baseQueue,$=v.pending;if($!==null){if(O!==null){var J=O.next;
vendor: 4,529 bytes, line 38
38O.next=$.next,$.next=J}E.baseQueue=O=$,v.pending=null}if(O!==null){$=O.next,E=E.baseState;var se=J=null,pe=null,Ie=$;do{var Je=Ie.lane;if((Dc&Je)===Je)pe!==null&&(pe=pe.next={lane:0,action:Ie.action,hasEagerState:Ie.hasEagerState,eagerState:Ie.eagerState,next:null}),E=Ie.hasEagerState?Ie.eagerState:u(E,Ie.action);else{var et={lane:Je,action:Ie.action,hasEagerState:Ie.hasEagerState,eagerState:Ie.eagerState,next:null};pe===null?(se=pe=et,J=E):pe=pe.next=et,gr.lanes|=Je,Lc|=Je}Ie=Ie.next}while(Ie!==null&&Ie!==$);pe===null?J=E:pe.next=se,ci(E,p.memoizedState)||(Hs=!0),p.memoizedState=E,p.baseState=J,p.baseQueue=pe,v.lastRenderedState=E}if(u=v.interleaved,u!==null){O=u;do $=O.lane,gr.lanes|=$,Lc|=$,O=O.next;while(O!==u)}else O===null&&(v.lanes=0);return[p.memoizedState,v.dispatch]}function Uw(u){var p=Ma(),v=p.queue;if(v===null)throw Error(n(311));v.lastRenderedReducer=u;var E=v.dispatch,O=v.pending,$=p.memoizedState;if(O!==null){v.pending=null;var J=O=O.next;do $=u($,J.action),J=J.next;while(J!==O);ci($,p.memoizedState)||(Hs=!0),p.memoizedState=$,p.baseQueue===null&&(p.baseState=$),v.lastRenderedState=$}return[$,E]}function LT(){}function $T(u,p){var v=gr,E=Ma(),O=p(),$=!ci(E.memoizedState,O);if($&&(E.memoizedState=O,Hs=!0),E=E.queue,qw(zT.bind(null,v,E,u),[u]),E.getSnapshot!==p||$||Jr!==null&&Jr.memoizedState.tag&1){if(v.flags|=2048,Of(9,FT.bind(null,v,E,O,p),void 0,null),Qr===null)throw Error(n(349));(Dc&30)!==0||BT(v,p,O)}return O}function BT(u,p,v){u.flags|=16384,u={getSnapshot:p,value:v},p=gr.updateQueue,p===null?(p={lastEffect:null,stores:null},gr.updateQueue=p,p.stores=[u]):(v=p.stores,v===null?p.stores=[u]:v.push(u))}function FT(u,p,v,E){p.value=v,p.getSnapshot=E,UT(p)&&qT(u)}function zT(u,p,v){return v(function(){UT(p)&&qT(u)})}function UT(u){var p=u.getSnapshot;u=u.value;try{var v=p();return!ci(u,v)}catch{return!0}}function qT(u){var p=_o(u,1);p!==null&&hi(p,u,1,-1)}function KT(u){var p=zi();return typeof u=="function"&&(u=u()),p.memoizedState=p.baseState=u,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Pf,lastRenderedState:u},p.queue=u,u=u.dispatch=YJ.bind(null,gr,u),[p.memoizedState,u]}function Of(u,p,v,E){return u={tag:u,create:p,destroy:v,deps:E,next:null},p=gr.updateQueue,p===null?(p={lastEffect:null,stores:null},gr.updateQueue=p,p.lastEffect=u.next=u):(v=p.lastEffect,v===null?p.lastEffect=u.next=u:(E=v.next,v.next=u,u.next=E,p.lastEffect=u)),u}function VT(){return Ma().memoizedState}function Zg(u,p,v,E){var O=zi();gr.flags|=u,O.memoizedState=Of(1|p,v,void 0,E===void 0?null:E)}function ex(u,p,v,E){var O=Ma();E=E===void 0?null:E;var $=void 0;if(Ur!==null){var J=Ur.memoizedState;if($=J.destroy,E!==null&&$w(E,J.deps)){O.memoizedState=Of(p,v,$,E);return}}gr.flags|=u,O.memoizedState=Of(1|p,v,$,E)}function HT(u,p){return Zg(8390656,8,u,p)}function qw(u,p){return ex(2048,8,u,p)}function WT(u,p){return ex(4,2,u,p)}function GT(u,p){return ex(4,4,u,p)}function YT(u,p){if(typeof p=="function")return u=u(),p(u),function(){p(null)};if(p!=null)return u=u(),p.current=u,function(){p.current=null}}function JT(u,p,v){return v=v!=null?v.concat([u]):null,ex(4,4,YT.bind(null,p,u),v)}function Kw(){}function QT(u,p){var v=Ma();p=p===void 0?null:p;var E=v.memoizedState;return E!==null&&p!==null&&$w(p,E[1])?E[0]:(v.memoizedState=[u,p],u)}function XT(u,p){var v=Ma();p=p===void 0?null:p;var E=v.memoizedState;return E!==null&&p!==null&&$w(p,E[1])?E[0]:(u=u(),v.memoizedState=[u,p],u)}function ZT(u,p,v){return(Dc&21)===0?(u.baseState&&(u.baseState=!1,Hs=!0),u.memoizedState=v):(ci(v,p)||(v=Sr(),gr.lanes|=v,Lc|=v,u.baseState=!0),p)}function WJ(u,p){var v=qe;qe=v!==0&&4>v?v:4,u(!0);var E=Lw.transition;Lw.transition={};try{u(!1),p()}finally{qe=v,Lw.transition=E}}function eP(){return Ma().memoizedState}function GJ(u,p,v){var E=wl(u);if(v={lane:E,action:v,hasEagerState:!1,eagerState:null,next:null},tP(u))nP(p,v);else if(v=OT(u,p,v,E),v!==null){var O=Ms();hi(v,u,E,O),rP(v,p,E)}}function YJ(u,p,v){var E=wl(u),O={lane:E,action:v,hasEagerState:!1,eagerState:null,next:null};if(tP(u))nP(p,O);else{var $=u.alternate;if(u.lanes===0&&($===null||$.lanes===0)&&($=p.lastRenderedReducer,$!==null))try{var J=p.lastRenderedState,se=$(J,v);if(O.hasEagerState=!0,O.eagerState=se,ci(se,J)){var pe=p.interleaved;pe===null?(O.next=O,Pw(p)):(O.next=pe.next,pe.next=O),p.interleaved=O;return}}catch{}finally{}v=OT(u,p,O,E),v!==null&&(O=Ms(),hi(v,u,E,O),rP(v,p,E))}}function tP(u){var p=u.alternate;return u===gr||p!==null&&p===gr}function nP(u,p){Af=Xg=!0;var v=u.pending;
vendor: 8,793 bytes, lines 38-40
38v===null?p.next=p:(p.next=v.next,v.next=p),u.pending=p}function rP(u,p,v){if((v&4194240)!==0){var E=p.lanes;E&=u.pendingLanes,v|=E,p.lanes=v,ye(u,v)}}var tx={readContext:Ra,useCallback:vs,useContext:vs,useEffect:vs,useImperativeHandle:vs,useInsertionEffect:vs,useLayoutEffect:vs,useMemo:vs,useReducer:vs,useRef:vs,useState:vs,useDebugValue:vs,useDeferredValue:vs,useTransition:vs,useMutableSource:vs,useSyncExternalStore:vs,useId:vs,unstable_isNewReconciler:!1},JJ={readContext:Ra,useCallback:function(u,p){return zi().memoizedState=[u,p===void 0?null:p],u},useContext:Ra,useEffect:HT,useImperativeHandle:function(u,p,v){return v=v!=null?v.concat([u]):null,Zg(4194308,4,YT.bind(null,p,u),v)},useLayoutEffect:function(u,p){return Zg(4194308,4,u,p)},useInsertionEffect:function(u,p){return Zg(4,2,u,p)},useMemo:function(u,p){var v=zi();return p=p===void 0?null:p,u=u(),v.memoizedState=[u,p],u},useReducer:function(u,p,v){var E=zi();return p=v!==void 0?v(p):p,E.memoizedState=E.baseState=p,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:p},E.queue=u,u=u.dispatch=GJ.bind(null,gr,u),[E.memoizedState,u]},useRef:function(u){var p=zi();return u={current:u},p.memoizedState=u},useState:KT,useDebugValue:Kw,useDeferredValue:function(u){return zi().memoizedState=u},useTransition:function(){var u=KT(!1),p=u[0];return u=WJ.bind(null,u[1]),zi().memoizedState=u,[p,u]},useMutableSource:function(){},useSyncExternalStore:function(u,p,v){var E=gr,O=zi();if(lr){if(v===void 0)throw Error(n(407));v=v()}else{if(v=p(),Qr===null)throw Error(n(349));(Dc&30)!==0||BT(E,p,v)}O.memoizedState=v;var $={value:v,getSnapshot:p};return O.queue=$,HT(zT.bind(null,E,$,u),[u]),E.flags|=2048,Of(9,FT.bind(null,E,$,v,p),void 0,null),v},useId:function(){var u=zi(),p=Qr.identifierPrefix;if(lr){var v=jo,E=wo;v=(E&~(1<<32-hr(E)-1)).toString(32)+v,p=":"+p+"R"+v,v=Tf++,0<v&&(p+="H"+v.toString(32)),p+=":"}else v=HJ++,p=":"+p+"r"+v.toString(32)+":";return u.memoizedState=p},unstable_isNewReconciler:!1},QJ={readContext:Ra,useCallback:QT,useContext:Ra,useEffect:qw,useImperativeHandle:JT,useInsertionEffect:WT,useLayoutEffect:GT,useMemo:XT,useReducer:zw,useRef:VT,useState:function(){return zw(Pf)},useDebugValue:Kw,useDeferredValue:function(u){var p=Ma();return ZT(p,Ur.memoizedState,u)},useTransition:function(){var u=zw(Pf)[0],p=Ma().memoizedState;return[u,p]},useMutableSource:LT,useSyncExternalStore:$T,useId:eP,unstable_isNewReconciler:!1},XJ={readContext:Ra,useCallback:QT,useContext:Ra,useEffect:qw,useImperativeHandle:JT,useInsertionEffect:WT,useLayoutEffect:GT,useMemo:XT,useReducer:Uw,useRef:VT,useState:function(){return Uw(Pf)},useDebugValue:Kw,useDeferredValue:function(u){var p=Ma();return Ur===null?p.memoizedState=u:ZT(p,Ur.memoizedState,u)},useTransition:function(){var u=Uw(Pf)[0],p=Ma().memoizedState;return[u,p]},useMutableSource:LT,useSyncExternalStore:$T,useId:eP,unstable_isNewReconciler:!1};function ui(u,p){if(u&&u.defaultProps){p=M({},p),u=u.defaultProps;for(var v in u)p[v]===void 0&&(p[v]=u[v]);return p}return p}function Vw(u,p,v,E){p=u.memoizedState,v=v(E,p),v=v==null?p:M({},p,v),u.memoizedState=v,u.lanes===0&&(u.updateQueue.baseState=v)}var nx={isMounted:function(u){return(u=u._reactInternals)?oe(u)===u:!1},enqueueSetState:function(u,p,v){u=u._reactInternals;var E=Ms(),O=wl(u),$=No(E,O);$.payload=p,v!=null&&($.callback=v),p=xl(u,$,O),p!==null&&(hi(p,u,O,E),Gg(p,u,O))},enqueueReplaceState:function(u,p,v){u=u._reactInternals;var E=Ms(),O=wl(u),$=No(E,O);$.tag=1,$.payload=p,v!=null&&($.callback=v),p=xl(u,$,O),p!==null&&(hi(p,u,O,E),Gg(p,u,O))},enqueueForceUpdate:function(u,p){u=u._reactInternals;var v=Ms(),E=wl(u),O=No(v,E);O.tag=2,p!=null&&(O.callback=p),p=xl(u,O,E),p!==null&&(hi(p,u,E,v),Gg(p,u,E))}};function sP(u,p,v,E,O,$,J){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(E,$,J):p.prototype&&p.prototype.isPureReactComponent?!yf(v,E)||!yf(O,$):!0}function aP(u,p,v){var E=!1,O=hl,$=p.contextType;return typeof $=="object"&&$!==null?$=Ra($):(O=Vs(p)?Pc:bs.current,E=p.contextTypes,$=(E=E!=null)?ru(u,O):hl),p=new p(v,$),u.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=nx,u.stateNode=p,p._reactInternals=u,E&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=O,u.__reactInternalMemoizedMaskedChildContext=$),p}function iP(u,p,v,E){u=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(v,E),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(v,E),p.state!==u&&nx.enqueueReplaceState(p,p.state,null)}function Hw(u,p,v,E){var O=u.stateNode;O.props=v,O.state=u.memoizedState,O.refs={},Ow(u);var $=p.contextType;typeof $=="object"&&$!==null?O.context=Ra($):($=Vs(p)?Pc:bs.current,O.context=ru(u,$)),O.state=u.memoizedState,$=p.getDerivedStateFromProps,typeof $=="function"&&(Vw(u,p,$,v),O.state=u.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(p=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),p!==O.state&&nx.enqueueReplaceState(O,O.state,null),Yg(u,v,O,E),O.state=u.memoizedState),typeof O.componentDidMount=="function"&&(u.flags|=4194308)}function uu(u,p){try{var v="",E=p;do v+=ee(E),E=E.return;while(E);var O=v}catch($){O=`
39Error generating stack: `+$.message+`
40`+$.stack}return{value:u,source:p,stack:O,digest:null}}function Ww(u,p,v){return{value:u,source:null,stack:v??null,digest:p??null}}function Gw(u,p){try{console.error(p.value)}catch(v){setTimeout(function(){throw v})}}var ZJ=typeof WeakMap=="function"?WeakMap:Map;function oP(u,p,v){v=No(-1,v),v.tag=3,v.payload={element:null};var E=p.value;return v.callback=function(){cx||(cx=!0,cj=E),Gw(u,p)},v}function lP(u,p,v){v=No(-1,v),v.tag=3;var E=u.type.getDerivedStateFromError;if(typeof E=="function"){var O=p.value;v.payload=function(){return E(O)},v.callback=function(){Gw(u,p)}}var $=u.stateNode;return $!==null&&typeof $.componentDidCatch=="function"&&(v.callback=function(){Gw(u,p),typeof E!="function"&&(bl===null?bl=new Set([this]):bl.add(this));var J=p.stack;this.componentDidCatch(p.value,{componentStack:J!==null?J:""})}),v}function cP(u,p,v){var E=u.pingCache;if(E===null){E=u.pingCache=new ZJ;var O=new Set;E.set(p,O)}else O=E.get(p),O===void 0&&(O=new Set,E.set(p,O));O.has(v)||(O.add(v),u=fQ.bind(null,u,p,v),p.then(u,u))}function dP(u){do{var p;if((p=u.tag===13)&&(p=u.memoizedState,p=p!==null?p.dehydrated!==null:!0),p)return u;u=u.return}while(u!==null);return null}function uP(u,p,v,E,O){return(u.mode&1)===0?(u===p?u.flags|=65536:(u.flags|=128,v.flags|=131072,v.flags&=-52805,v.tag===1&&(v.alternate===null?v.tag=17:(p=No(-1,1),p.tag=2,xl(v,p,1))),v.lanes|=1),u):(u.flags|=65536,u.lanes=O,u)}var eQ=C.ReactCurrentOwner,Hs=!1;function Rs(u,p,v,E){p.child=u===null?PT(p,null,v,E):ou(p,u.child,v,E)}function mP(u,p,v,E,O){v=v.render;var $=p.ref;return cu(p,O),E=Bw(u,p,v,E,$,O),v=Fw(),u!==null&&!Hs?(p.updateQueue=u.updateQueue,p.flags&=-2053,u.lanes&=~O,So(u,p,O)):(lr&&v&&jw(p),p.flags|=1,Rs(u,p,E,O),p.child)}function fP(u,p,v,E,O){if(u===null){var $=v.type;return typeof $=="function"&&!gj($)&&$.defaultProps===void 0&&v.compare===null&&v.defaultProps===void 0?(p.tag=15,p.type=$,hP(u,p,$,E,O)):(u=px(v.type,null,E,p,p.mode,O),u.ref=p.ref,u.return=p,p.child=u)}if($=u.child,(u.lanes&O)===0){var J=$.memoizedProps;if(v=v.compare,v=v!==null?v:yf,v(J,E)&&u.ref===p.ref)return So(u,p,O)}return p.flags|=1,u=_l($,E),u.ref=p.ref,u.return=p,p.child=u}function hP(u,p,v,E,O){if(u!==null){var $=u.memoizedProps;if(yf($,E)&&u.ref===p.ref)if(Hs=!1,p.pendingProps=E=$,(u.lanes&O)!==0)(u.flags&131072)!==0&&(Hs=!0);else return p.lanes=u.lanes,So(u,p,O)}return Yw(u,p,v,E,O)}function pP(u,p,v){var E=p.pendingProps,O=E.children,$=u!==null?u.memoizedState:null;if(E.mode==="hidden")if((p.mode&1)===0)p.memoizedState={baseLanes:0,cachePool:null,transitions:null},Xn(fu,ma),ma|=v;else{if((v&1073741824)===0)return u=$!==null?$.baseLanes|v:v,p.lanes=p.childLanes=1073741824,p.memoizedState={baseLanes:u,cachePool:null,transitions:null},p.updateQueue=null,Xn(fu,ma),ma|=u,null;p.memoizedState={baseLanes:0,cachePool:null,transitions:null},E=$!==null?$.baseLanes:v,Xn(fu,ma),ma|=E}else $!==null?(E=$.baseLanes|v,p.memoizedState=null):E=v,Xn(fu,ma),ma|=E;return Rs(u,p,O,v),p.child}function gP(u,p){var v=p.ref;(u===null&&v!==null||u!==null&&u.ref!==v)&&(p.flags|=512,p.flags|=2097152)}function Yw(u,p,v,E,O){var $=Vs(v)?Pc:bs.current;return $=ru(p,$),cu(p,O),v=Bw(u,p,v,E,$,O),E=Fw(),u!==null&&!Hs?(p.updateQueue=u.updateQueue,p.flags&=-2053,u.lanes&=~O,So(u,p,O)):(lr&&E&&jw(p
vendor: 41,180 bytes, line 40
40),p.flags|=1,Rs(u,p,v,O),p.child)}function xP(u,p,v,E,O){if(Vs(v)){var $=!0;Fg(p)}else $=!1;if(cu(p,O),p.stateNode===null)sx(u,p),aP(p,v,E),Hw(p,v,E,O),E=!0;else if(u===null){var J=p.stateNode,se=p.memoizedProps;J.props=se;var pe=J.context,Ie=v.contextType;typeof Ie=="object"&&Ie!==null?Ie=Ra(Ie):(Ie=Vs(v)?Pc:bs.current,Ie=ru(p,Ie));var Je=v.getDerivedStateFromProps,et=typeof Je=="function"||typeof J.getSnapshotBeforeUpdate=="function";et||typeof J.UNSAFE_componentWillReceiveProps!="function"&&typeof J.componentWillReceiveProps!="function"||(se!==E||pe!==Ie)&&iP(p,J,E,Ie),gl=!1;var Ge=p.memoizedState;J.state=Ge,Yg(p,E,J,O),pe=p.memoizedState,se!==E||Ge!==pe||Ks.current||gl?(typeof Je=="function"&&(Vw(p,v,Je,E),pe=p.memoizedState),(se=gl||sP(p,v,se,E,Ge,pe,Ie))?(et||typeof J.UNSAFE_componentWillMount!="function"&&typeof J.componentWillMount!="function"||(typeof J.componentWillMount=="function"&&J.componentWillMount(),typeof J.UNSAFE_componentWillMount=="function"&&J.UNSAFE_componentWillMount()),typeof J.componentDidMount=="function"&&(p.flags|=4194308)):(typeof J.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=E,p.memoizedState=pe),J.props=E,J.state=pe,J.context=Ie,E=se):(typeof J.componentDidMount=="function"&&(p.flags|=4194308),E=!1)}else{J=p.stateNode,IT(u,p),se=p.memoizedProps,Ie=p.type===p.elementType?se:ui(p.type,se),J.props=Ie,et=p.pendingProps,Ge=J.context,pe=v.contextType,typeof pe=="object"&&pe!==null?pe=Ra(pe):(pe=Vs(v)?Pc:bs.current,pe=ru(p,pe));var xt=v.getDerivedStateFromProps;(Je=typeof xt=="function"||typeof J.getSnapshotBeforeUpdate=="function")||typeof J.UNSAFE_componentWillReceiveProps!="function"&&typeof J.componentWillReceiveProps!="function"||(se!==et||Ge!==pe)&&iP(p,J,E,pe),gl=!1,Ge=p.memoizedState,J.state=Ge,Yg(p,E,J,O);var kt=p.memoizedState;se!==et||Ge!==kt||Ks.current||gl?(typeof xt=="function"&&(Vw(p,v,xt,E),kt=p.memoizedState),(Ie=gl||sP(p,v,Ie,E,Ge,kt,pe)||!1)?(Je||typeof J.UNSAFE_componentWillUpdate!="function"&&typeof J.componentWillUpdate!="function"||(typeof J.componentWillUpdate=="function"&&J.componentWillUpdate(E,kt,pe),typeof J.UNSAFE_componentWillUpdate=="function"&&J.UNSAFE_componentWillUpdate(E,kt,pe)),typeof J.componentDidUpdate=="function"&&(p.flags|=4),typeof J.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof J.componentDidUpdate!="function"||se===u.memoizedProps&&Ge===u.memoizedState||(p.flags|=4),typeof J.getSnapshotBeforeUpdate!="function"||se===u.memoizedProps&&Ge===u.memoizedState||(p.flags|=1024),p.memoizedProps=E,p.memoizedState=kt),J.props=E,J.state=kt,J.context=pe,E=Ie):(typeof J.componentDidUpdate!="function"||se===u.memoizedProps&&Ge===u.memoizedState||(p.flags|=4),typeof J.getSnapshotBeforeUpdate!="function"||se===u.memoizedProps&&Ge===u.memoizedState||(p.flags|=1024),E=!1)}return Jw(u,p,v,E,$,O)}function Jw(u,p,v,E,O,$){gP(u,p);var J=(p.flags&128)!==0;if(!E&&!J)return O&&jT(p,v,!1),So(u,p,$);E=p.stateNode,eQ.current=p;var se=J&&typeof v.getDerivedStateFromError!="function"?null:E.render();return p.flags|=1,u!==null&&J?(p.child=ou(p,u.child,null,$),p.child=ou(p,null,se,$)):Rs(u,p,se,$),p.memoizedState=E.state,O&&jT(p,v,!0),p.child}function yP(u){var p=u.stateNode;p.pendingContext?vT(u,p.pendingContext,p.pendingContext!==p.context):p.context&&vT(u,p.context,!1),Iw(u,p.containerInfo)}function bP(u,p,v,E,O){return iu(),kw(O),p.flags|=256,Rs(u,p,v,E),p.child}var Qw={dehydrated:null,treeContext:null,retryLane:0};function Xw(u){return{baseLanes:u,cachePool:null,transitions:null}}function vP(u,p,v){var E=p.pendingProps,O=pr.current,$=!1,J=(p.flags&128)!==0,se;if((se=J)||(se=u!==null&&u.memoizedState===null?!1:(O&2)!==0),se?($=!0,p.flags&=-129):(u===null||u.memoizedState!==null)&&(O|=1),Xn(pr,O&1),u===null)return Sw(p),u=p.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?((p.mode&1)===0?p.lanes=1:u.data==="$!"?p.lanes=8:p.lanes=1073741824,null):(J=E.children,u=E.fallback,$?(E=p.mode,$=p.child,J={mode:"hidden",children:J},(E&1)===0&&$!==null?($.childLanes=0,$.pendingProps=J):$=gx(J,E,0,null),u=zc(u,E,v,null),$.return=p,u.return=p,$.sibling=u,p.child=$,p.child.memoizedState=Xw(v),p.memoizedState=Qw,u):Zw(p,J));if(O=u.memoizedState,O!==null&&(se=O.dehydrated,se!==null))return tQ(u,p,J,E,se,O,v);if($){$=E.fallback,J=p.mode,O=u.child,se=O.sibling;var pe={mode:"hidden",children:E.children};return(J&1)===0&&p.child!==O?(E=p.child,E.childLanes=0,E.pendingProps=pe,p.deletions=null):(E=_l(O,pe),E.subtreeFlags=O.subtreeFlags&14680064),se!==null?$=_l(se,$):($=zc($,J,v,null),$.flags|=2),$.return=p,E.return=p,E.sibling=$,p.child=E,E=$,$=p.child,J=u.child.memoizedState,J=J===null?Xw(v):{baseLanes:J.baseLanes|v,cachePool:null,transitions:J.transitions},$.memoizedState=J,$.childLanes=u.childLanes&~v,p.memoizedState=Qw,E}return $=u.child,u=$.sibling,E=_l($,{mode:"visible",children:E.children}),(p.mode&1)===0&&(E.lanes=v),E.return=p,E.sibling=null,u!==null&&(v=p.deletions,v===null?(p.deletions=[u],p.flags|=16):v.push(u)),p.child=E,p.memoizedState=null,E}function Zw(u,p){return p=gx({mode:"visible",children:p},u.mode,0,null),p.return=u,u.child=p}function rx(u,p,v,E){return E!==null&&kw(E),ou(p,u.child,null,v),u=Zw(p,p.pendingProps.children),u.flags|=2,p.memoizedState=null,u}function tQ(u,p,v,E,O,$,J){if(v)return p.flags&256?(p.flags&=-257,E=Ww(Error(n(422))),rx(u,p,J,E)):p.memoizedState!==null?(p.child=u.child,p.flags|=128,null):($=E.fallback,O=p.mode,E=gx({mode:"visible",children:E.children},O,0,null),$=zc($,O,J,null),$.flags|=2,E.return=p,$.return=p,E.sibling=$,p.child=E,(p.mode&1)!==0&&ou(p,u.child,null,J),p.child.memoizedState=Xw(J),p.memoizedState=Qw,$);if((p.mode&1)===0)return rx(u,p,J,null);if(O.data==="$!"){if(E=O.nextSibling&&O.nextSibling.dataset,E)var se=E.dgst;return E=se,$=Error(n(419)),E=Ww($,E,void 0),rx(u,p,J,E)}if(se=(J&u.childLanes)!==0,Hs||se){if(E=Qr,E!==null){switch(J&-J){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&(E.suspendedLanes|J))!==0?0:O,O!==0&&O!==$.retryLane&&($.retryLane=O,_o(u,O),hi(E,u,O,-1))}return pj(),E=Ww(Error(n(421))),rx(u,p,J,E)}return O.data==="$?"?(p.flags|=128,p.child=u.child,p=hQ.bind(null,u),O._reactRetry=p,null):(u=$.treeContext,ua=ml(O.nextSibling),da=p,lr=!0,di=null,u!==null&&(Oa[Ia++]=wo,Oa[Ia++]=jo,Oa[Ia++]=Oc,wo=u.id,jo=u.overflow,Oc=p),p=Zw(p,E.children),p.flags|=4096,p)}function wP(u,p,v){u.lanes|=p;var E=u.alternate;E!==null&&(E.lanes|=p),Tw(u.return,p,v)}function ej(u,p,v,E,O){var $=u.memoizedState;$===null?u.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:E,tail:v,tailMode:O}:($.isBackwards=p,$.rendering=null,$.renderingStartTime=0,$.last=E,$.tail=v,$.tailMode=O)}function jP(u,p,v){var E=p.pendingProps,O=E.revealOrder,$=E.tail;if(Rs(u,p,E.children,v),E=pr.current,(E&2)!==0)E=E&1|2,p.flags|=128;else{if(u!==null&&(u.flags&128)!==0)e:for(u=p.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&wP(u,v,p);else if(u.tag===19)wP(u,v,p);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===p)break e;for(;u.sibling===null;){if(u.return===null||u.return===p)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}E&=1}if(Xn(pr,E),(p.mode&1)===0)p.memoizedState=null;else switch(O){case"forwards":for(v=p.child,O=null;v!==null;)u=v.alternate,u!==null&&Jg(u)===null&&(O=v),v=v.sibling;v=O,v===null?(O=p.child,p.child=null):(O=v.sibling,v.sibling=null),ej(p,!1,O,v,$);break;case"backwards":for(v=null,O=p.child,p.child=null;O!==null;){if(u=O.alternate,u!==null&&Jg(u)===null){p.child=O;break}u=O.sibling,O.sibling=v,v=O,O=u}ej(p,!0,v,null,$);break;case"together":ej(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function sx(u,p){(p.mode&1)===0&&u!==null&&(u.alternate=null,p.alternate=null,p.flags|=2)}function So(u,p,v){if(u!==null&&(p.dependencies=u.dependencies),Lc|=p.lanes,(v&p.childLanes)===0)return null;if(u!==null&&p.child!==u.child)throw Error(n(153));if(p.child!==null){for(u=p.child,v=_l(u,u.pendingProps),p.child=v,v.return=p;u.sibling!==null;)u=u.sibling,v=v.sibling=_l(u,u.pendingProps),v.return=p;v.sibling=null}return p.child}function nQ(u,p,v){switch(p.tag){case 3:yP(p),iu();break;case 5:DT(p);break;case 1:Vs(p.type)&&Fg(p);break;case 4:Iw(p,p.stateNode.containerInfo);break;case 10:var E=p.type._context,O=p.memoizedProps.value;Xn(Hg,E._currentValue),E._currentValue=O;break;case 13:if(E=p.memoizedState,E!==null)return E.dehydrated!==null?(Xn(pr,pr.current&1),p.flags|=128,null):(v&p.child.childLanes)!==0?vP(u,p,v):(Xn(pr,pr.current&1),u=So(u,p,v),u!==null?u.sibling:null);Xn(pr,pr.current&1);break;case 19:if(E=(v&p.childLanes)!==0,(u.flags&128)!==0){if(E)return jP(u,p,v);p.flags|=128}if(O=p.memoizedState,O!==null&&(O.rendering=null,O.tail=null,O.lastEffect=null),Xn(pr,pr.current),E)break;return null;case 22:case 23:return p.lanes=0,pP(u,p,v)}return So(u,p,v)}var _P,tj,NP,SP;_P=function(u,p){for(var v=p.child;v!==null;){if(v.tag===5||v.tag===6)u.appendChild(v.stateNode);else if(v.tag!==4&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===p)break;for(;v.sibling===null;){if(v.return===null||v.return===p)return;v=v.return}v.sibling.return=v.return,v=v.sibling}},tj=function(){},NP=function(u,p,v,E){var O=u.memoizedProps;if(O!==E){u=p.stateNode,Mc(Fi.current);var $=null;switch(v){case"input":O=Ne(u,O),E=Ne(u,E),$=[];break;case"select":O=M({},O,{value:void 0}),E=M({},E,{value:void 0}),$=[];break;case"textarea":O=_e(u,O),E=_e(u,E),$=[];break;default:typeof O.onClick!="function"&&typeof E.onClick=="function"&&(u.onclick=Lg)}bt(v,E);var J;v=null;for(Ie in O)if(!E.hasOwnProperty(Ie)&&O.hasOwnProperty(Ie)&&O[Ie]!=null)if(Ie==="style"){var se=O[Ie];for(J in se)se.hasOwnProperty(J)&&(v||(v={}),v[J]="")}else Ie!=="dangerouslySetInnerHTML"&&Ie!=="children"&&Ie!=="suppressContentEditableWarning"&&Ie!=="suppressHydrationWarning"&&Ie!=="autoFocus"&&(a.hasOwnProperty(Ie)?$||($=[]):($=$||[]).push(Ie,null));for(Ie in E){var pe=E[Ie];if(se=O!=null?O[Ie]:void 0,E.hasOwnProperty(Ie)&&pe!==se&&(pe!=null||se!=null))if(Ie==="style")if(se){for(J in se)!se.hasOwnProperty(J)||pe&&pe.hasOwnProperty(J)||(v||(v={}),v[J]="");for(J in pe)pe.hasOwnProperty(J)&&se[J]!==pe[J]&&(v||(v={}),v[J]=pe[J])}else v||($||($=[]),$.push(Ie,v)),v=pe;else Ie==="dangerouslySetInnerHTML"?(pe=pe?pe.__html:void 0,se=se?se.__html:void 0,pe!=null&&se!==pe&&($=$||[]).push(Ie,pe)):Ie==="children"?typeof pe!="string"&&typeof pe!="number"||($=$||[]).push(Ie,""+pe):Ie!=="suppressContentEditableWarning"&&Ie!=="suppressHydrationWarning"&&(a.hasOwnProperty(Ie)?(pe!=null&&Ie==="onScroll"&&sr("scroll",u),$||se===pe||($=[])):($=$||[]).push(Ie,pe))}v&&($=$||[]).push("style",v);var Ie=$;(p.updateQueue=Ie)&&(p.flags|=4)}},SP=function(u,p,v,E){v!==E&&(p.flags|=4)};function If(u,p){if(!lr)switch(u.tailMode){case"hidden":p=u.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?u.tail=null:v.sibling=null;break;case"collapsed":v=u.tail;for(var E=null;v!==null;)v.alternate!==null&&(E=v),v=v.sibling;E===null?p||u.tail===null?u.tail=null:u.tail.sibling=null:E.sibling=null}}function ws(u){var p=u.alternate!==null&&u.alternate.child===u.child,v=0,E=0;if(p)for(var O=u.child;O!==null;)v|=O.lanes|O.childLanes,E|=O.subtreeFlags&14680064,E|=O.flags&14680064,O.return=u,O=O.sibling;else for(O=u.child;O!==null;)v|=O.lanes|O.childLanes,E|=O.subtreeFlags,E|=O.flags,O.return=u,O=O.sibling;return u.subtreeFlags|=E,u.childLanes=v,p}function rQ(u,p,v){var E=p.pendingProps;switch(_w(p),p.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ws(p),null;case 1:return Vs(p.type)&&Bg(),ws(p),null;case 3:return E=p.stateNode,du(),ar(Ks),ar(bs),Dw(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(u===null||u.child===null)&&(Kg(p)?p.flags|=4:u===null||u.memoizedState.isDehydrated&&(p.flags&256)===0||(p.flags|=1024,di!==null&&(mj(di),di=null))),tj(u,p),ws(p),null;case 5:Rw(p);var O=Mc(Ef.current);if(v=p.type,u!==null&&p.stateNode!=null)NP(u,p,v,E,O),u.ref!==p.ref&&(p.flags|=512,p.flags|=2097152);else{if(!E){if(p.stateNode===null)throw Error(n(166));return ws(p),null}if(u=Mc(Fi.current),Kg(p)){E=p.stateNode,v=p.type;var $=p.memoizedProps;switch(E[Bi]=p,E[_f]=$,u=(p.mode&1)!==0,v){case"dialog":sr("cancel",E),sr("close",E);break;case"iframe":case"object":case"embed":sr("load",E);break;case"video":case"audio":for(O=0;O<vf.length;O++)sr(vf[O],E);break;case"source":sr("error",E);break;case"img":case"image":case"link":sr("error",E),sr("load",E);break;case"details":sr("toggle",E);break;case"input":Oe(E,$),sr("invalid",E);break;case"select":E._wrapperState={wasMultiple:!!$.multiple},sr("invalid",E);break;case"textarea":We(E,$),sr("invalid",E)}bt(v,$),O=null;for(var J in $)if($.hasOwnProperty(J)){var se=$[J];J==="children"?typeof se=="string"?E.textContent!==se&&($.suppressHydrationWarning!==!0&&Dg(E.textContent,se,u),O=["children",se]):typeof se=="number"&&E.textContent!==""+se&&($.suppressHydrationWarning!==!0&&Dg(E.textContent,se,u),O=["children",""+se]):a.hasOwnProperty(J)&&se!=null&&J==="onScroll"&&sr("scroll",E)}switch(v){case"input":le(E),Ve(E,$,!0);break;case"textarea":le(E),me(E);break;case"select":case"option":break;default:typeof $.onClick=="function"&&(E.onclick=Lg)}E=O,p.updateQueue=E,E!==null&&(p.flags|=4)}else{J=O.nodeType===9?O:O.ownerDocument,u==="http://www.w3.org/1999/xhtml"&&(u=ae(v)),u==="http://www.w3.org/1999/xhtml"?v==="script"?(u=J.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild)):typeof E.is=="string"?u=J.createElement(v,{is:E.is}):(u=J.createElement(v),v==="select"&&(J=u,E.multiple?J.multiple=!0:E.size&&(J.size=E.size))):u=J.createElementNS(u,v),u[Bi]=p,u[_f]=E,_P(u,p,!1,!1),p.stateNode=u;e:{switch(J=sn(v,E),v){case"dialog":sr("cancel",u),sr("close",u),O=E;break;case"iframe":case"object":case"embed":sr("load",u),O=E;break;case"video":case"audio":for(O=0;O<vf.length;O++)sr(vf[O],u);O=E;break;case"source":sr("error",u),O=E;break;case"img":case"image":case"link":sr("error",u),sr("load",u),O=E;break;case"details":sr("toggle",u),O=E;break;case"input":Oe(u,E),O=Ne(u,E),sr("invalid",u);break;case"option":O=E;break;case"select":u._wrapperState={wasMultiple:!!E.multiple},O=M({},E,{value:void 0}),sr("invalid",u);break;case"textarea":We(u,E),O=_e(u,E),sr("invalid",u);break;default:O=E}bt(v,O),se=O;for($ in se)if(se.hasOwnProperty($)){var pe=se[$];$==="style"?ct(u,pe):$==="dangerouslySetInnerHTML"?(pe=pe?pe.__html:void 0,pe!=null&&He(u,pe)):$==="children"?typeof pe=="string"?(v!=="textarea"||pe!=="")&&ut(u,pe):typeof pe=="number"&&ut(u,""+pe):$!=="suppressContentEditableWarning"&&$!=="suppressHydrationWarning"&&$!=="autoFocus"&&(a.hasOwnProperty($)?pe!=null&&$==="onScroll"&&sr("scroll",u):pe!=null&&N(u,$,pe,J))}switch(v){case"input":le(u),Ve(u,E,!1);break;case"textarea":le(u),me(u);break;case"option":E.value!=null&&u.setAttribute("value",""+ie(E.value));break;case"select":u.multiple=!!E.multiple,$=E.value,$!=null?De(u,!!E.multiple,$,!1):E.defaultValue!=null&&De(u,!!E.multiple,E.defaultValue,!0);break;default:typeof O.onClick=="function"&&(u.onclick=Lg)}switch(v){case"button":case"input":case"select":case"textarea":E=!!E.autoFocus;break e;case"img":E=!0;break e;default:E=!1}}E&&(p.flags|=4)}p.ref!==null&&(p.flags|=512,p.flags|=2097152)}return ws(p),null;case 6:if(u&&p.stateNode!=null)SP(u,p,u.memoizedProps,E);else{if(typeof E!="string"&&p.stateNode===null)throw Error(n(166));if(v=Mc(Ef.current),Mc(Fi.current),Kg(p)){if(E=p.stateNode,v=p.memoizedProps,E[Bi]=p,($=E.nodeValue!==v)&&(u=da,u!==null))switch(u.tag){case 3:Dg(E.nodeValue,v,(u.mode&1)!==0);break;case 5:u.memoizedProps.suppressHydrationWarning!==!0&&Dg(E.nodeValue,v,(u.mode&1)!==0)}$&&(p.flags|=4)}else E=(v.nodeType===9?v:v.ownerDocument).createTextNode(E),E[Bi]=p,p.stateNode=E}return ws(p),null;case 13:if(ar(pr),E=p.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(lr&&ua!==null&&(p.mode&1)!==0&&(p.flags&128)===0)ET(),iu(),p.flags|=98560,$=!1;else if($=Kg(p),E!==null&&E.dehydrated!==null){if(u===null){if(!$)throw Error(n(318));if($=p.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(n(317));$[Bi]=p}else iu(),(p.flags&128)===0&&(p.memoizedState=null),p.flags|=4;ws(p),$=!1}else di!==null&&(mj(di),di=null),$=!0;if(!$)return p.flags&65536?p:null}return(p.flags&128)!==0?(p.lanes=v,p):(E=E!==null,E!==(u!==null&&u.memoizedState!==null)&&E&&(p.child.flags|=8192,(p.mode&1)!==0&&(u===null||(pr.current&1)!==0?qr===0&&(qr=3):pj())),p.updateQueue!==null&&(p.flags|=4),ws(p),null);case 4:return du(),tj(u,p),u===null&&wf(p.stateNode.containerInfo),ws(p),null;case 10:return Aw(p.type._context),ws(p),null;case 17:return Vs(p.type)&&Bg(),ws(p),null;case 19:if(ar(pr),$=p.memoizedState,$===null)return ws(p),null;if(E=(p.flags&128)!==0,J=$.rendering,J===null)if(E)If($,!1);else{if(qr!==0||u!==null&&(u.flags&128)!==0)for(u=p.child;u!==null;){if(J=Jg(u),J!==null){for(p.flags|=128,If($,!1),E=J.updateQueue,E!==null&&(p.updateQueue=E,p.flags|=4),p.subtreeFlags=0,E=v,v=p.child;v!==null;)$=v,u=E,$.flags&=14680066,J=$.alternate,J===null?($.childLanes=0,$.lanes=u,$.child=null,$.subtreeFlags=0,$.memoizedProps=null,$.memoizedState=null,$.updateQueue=null,$.dependencies=null,$.stateNode=null):($.childLanes=J.childLanes,$.lanes=J.lanes,$.child=J.child,$.subtreeFlags=0,$.deletions=null,$.memoizedProps=J.memoizedProps,$.memoizedState=J.memoizedState,$.updateQueue=J.updateQueue,$.type=J.type,u=J.dependencies,$.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),v=v.sibling;return Xn(pr,pr.current&1|2),p.child}u=u.sibling}$.tail!==null&&mn()>hu&&(p.flags|=128,E=!0,If($,!1),p.lanes=4194304)}else{if(!E)if(u=Jg(J),u!==null){if(p.flags|=128,E=!0,v=u.updateQueue,v!==null&&(p.updateQueue=v,p.flags|=4),If($,!0),$.tail===null&&$.tailMode==="hidden"&&!J.alternate&&!lr)return ws(p),null}else 2*mn()-$.renderingStartTime>hu&&v!==1073741824&&(p.flags|=128,E=!0,If($,!1),p.lanes=4194304);$.isBackwards?(J.sibling=p.child,p.child=J):(v=$.last,v!==null?v.sibling=J:p.child=J,$.last=J)}return $.tail!==null?(p=$.tail,$.rendering=p,$.tail=p.sibling,$.renderingStartTime=mn(),p.sibling=null,v=pr.current,Xn(pr,E?v&1|2:v&1),p):(ws(p),null);case 22:case 23:return hj(),E=p.memoizedState!==null,u!==null&&u.memoizedState!==null!==E&&(p.flags|=8192),E&&(p.mode&1)!==0?(ma&1073741824)!==0&&(ws(p),p.subtreeFlags&6&&(p.flags|=8192)):ws(p),null;case 24:return null;case 25:return null}throw Error(n(156,p.tag))}function sQ(u,p){switch(_w(p),p.tag){case 1:return Vs(p.type)&&Bg(),u=p.flags,u&65536?(p.flags=u&-65537|128,p):null;case 3:return du(),ar(Ks),ar(bs),Dw(),u=p.flags,(u&65536)!==0&&(u&128)===0?(p.flags=u&-65537|128,p):null;case 5:return Rw(p),null;case 13:if(ar(pr),u=p.memoizedState,u!==null&&u.dehydrated!==null){if(p.alternate===null)throw Error(n(340));iu()}return u=p.flags,u&65536?(p.flags=u&-65537|128,p):null;case 19:return ar(pr),null;case 4:return du(),null;case 10:return Aw(p.type._context),null;case 22:case 23:return hj(),null;case 24:return null;default:return null}}var ax=!1,js=!1,aQ=typeof WeakSet=="function"?WeakSet:Set,Nt=null;function mu(u,p){var v=u.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(E){vr(u,p,E)}else v.current=null}function nj(u,p,v){try{v()}catch(E){vr(u,p,E)}}var kP=!1;function iQ(u,p){if(hw=Bt,u=sT(),iw(u)){if("selectionStart"in u)var v={start:u.selectionStart,end:u.selectionEnd};else e:{v=(v=u.ownerDocument)&&v.defaultView||window;var E=v.getSelection&&v.getSelection();if(E&&E.rangeCount!==0){v=E.anchorNode;var O=E.anchorOffset,$=E.focusNode;E=E.focusOffset;try{v.nodeType,$.nodeType}catch{v=null;break e}var J=0,se=-1,pe=-1,Ie=0,Je=0,et=u,Ge=null;t:for(;;){for(var xt;et!==v||O!==0&&et.nodeType!==3||(se=J+O),et!==$||E!==0&&et.nodeType!==3||(pe=J+E),et.nodeType===3&&(J+=et.nodeValue.length),(xt=et.firstChild)!==null;)Ge=et,et=xt;for(;;){if(et===u)break t;if(Ge===v&&++Ie===O&&(se=J),Ge===$&&++Je===E&&(pe=J),(xt=et.nextSibling)!==null)break;et=Ge,Ge=et.parentNode}et=xt}v=se===-1||pe===-1?null:{start:se,end:pe}}else v=null}v=v||{start:0,end:0}}else v=null;for(pw={focusedElem:u,selectionRange:v},Bt=!1,Nt=p;Nt!==null;)if(p=Nt,u=p.child,(p.subtreeFlags&1028)!==0&&u!==null)u.return=p,Nt=u;else for(;Nt!==null;){p=Nt;try{var kt=p.alternate;if((p.flags&1024)!==0)switch(p.tag){case 0:case 11:case 15:break;case 1:if(kt!==null){var Pt=kt.memoizedProps,kr=kt.memoizedState,Ce=p.stateNode,be=Ce.getSnapshotBeforeUpdate(p.elementType===p.type?Pt:ui(p.type,Pt),kr);Ce.__reactInternalSnapshotBeforeUpdate=be}break;case 3:var Ae=p.stateNode.containerInfo;Ae.nodeType===1?Ae.textContent="":Ae.nodeType===9&&Ae.documentElement&&Ae.removeChild(Ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(st){vr(p,p.return,st)}if(u=p.sibling,u!==null){u.return=p.return,Nt=u;break}Nt=p.return}return kt=kP,kP=!1,kt}function Rf(u,p,v){var E=p.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var O=E=E.next;do{if((O.tag&u)===u){var $=O.destroy;O.destroy=void 0,$!==void 0&&nj(p,v,$)}O=O.next}while(O!==E)}}function ix(u,p){if(p=p.updateQueue,p=p!==null?p.lastEffect:null,p!==null){var v=p=p.next;do{if((v.tag&u)===u){var E=v.create;v.destroy=E()}v=v.next}while(v!==p)}}function rj(u){var p=u.ref;if(p!==null){var v=u.stateNode;switch(u.tag){case 5:u=v;break;default:u=v}typeof p=="function"?p(u):p.current=u}}function CP(u){var p=u.alternate;p!==null&&(u.alternate=null,CP(p)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(p=u.stateNode,p!==null&&(delete p[Bi],delete p[_f],delete p[bw],delete p[UJ],delete p[qJ])),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function EP(u){return u.tag===5||u.tag===3||u.tag===4}function AP(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||EP(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function sj(u,p,v){var E=u.tag;if(E===5||E===6)u=u.stateNode,p?v.nodeType===8?v.parentNode.insertBefore(u,p):v.insertBefore(u,p):(v.nodeType===8?(p=v.parentNode,p.insertBefore(u,v)):(p=v,p.appendChild(u)),v=v._reactRootContainer,v!=null||p.onclick!==null||(p.onclick=Lg));else if(E!==4&&(u=u.child,u!==null))for(sj(u,p,v),u=u.sibling;u!==null;)sj(u,p,v),u=u.sibling}function aj(u,p,v){var E=u.tag;if(E===5||E===6)u=u.stateNode,p?v.insertBefore(u,p):v.appendChild(u);else if(E!==4&&(u=u.child,u!==null))for(aj(u,p,v),u=u.sibling;u!==null;)aj(u,p,v),u=u.sibling}var os=null,mi=!1;function yl(u,p,v){for(v=v.child;v!==null;)TP(u,p,v),v=v.sibling}function TP(u,p,v){if(Is&&typeof Is.onCommitFiberUnmount=="function")try{Is.onCommitFiberUnmount(Mi,v)}catch{}switch(v.tag){case 5:js||mu(v,p);case 6:var E=os,O=mi;os=null,yl(u,p,v),os=E,mi=O,os!==null&&(mi?(u=os,v=v.stateNode,u.nodeType===8?u.parentNode.removeChild(v):u.removeChild(v)):os.removeChild(v.stateNode));break;case 18:os!==null&&(mi?(u=os,v=v.stateNode,u.nodeType===8?yw(u.parentNode,v):u.nodeType===1&&yw(u,v),cl(u)):yw(os,v.stateNode));break;case 4:E=os,O=mi,os=v.stateNode.containerInfo,mi=!0,yl(u,p,v),os=E,mi=O;break;case 0:case 11:case 14:case 15:if(!js&&(E=v.updateQueue,E!==null&&(E=E.lastEffect,E!==null))){O=E=E.next;do{var $=O,J=$.destroy;$=$.tag,J!==void 0&&(($&2)!==0||($&4)!==0)&&nj(v,p,J),O=O.next}while(O!==E)}yl(u,p,v);break;case 1:if(!js&&(mu(v,p),E=v.stateNode,typeof E.componentWillUnmount=="function"))try{E.props=v.memoizedProps,E.state=v.memoizedState,E.componentWillUnmount()}catch(se){vr(v,p,se)}yl(u,p,v);break;case 21:yl(u,p,v);break;case 22:v.mode&1?(js=(E=js)||v.memoizedState!==null,yl(u,p,v),js=E):yl(u,p,v);break;default:yl(u,p,v)}}function PP(u){var p=u.updateQueue;if(p!==null){u.updateQueue=null;var v=u.stateNode;v===null&&(v=u.stateNode=new aQ),p.forEach(function(E){var O=pQ.bind(null,u,E);v.has(E)||(v.add(E),E.then(O,O))})}}function fi(u,p){var v=p.deletions;if(v!==null)for(var E=0;E<v.length;E++){var O=v[E];try{var $=u,J=p,se=J;e:for(;se!==null;){switch(se.tag){case 5:os=se.stateNode,mi=!1;break e;case 3:os=se.stateNode.containerInfo,mi=!0;break e;case 4:os=se.stateNode.containerInfo,mi=!0;break e}se=se.return}if(os===null)throw Error(n(160));TP($,J,O),os=null,mi=!1;var pe=O.alternate;pe!==null&&(pe.return=null),O.return=null}catch(Ie){vr(O,p,Ie)}}if(p.subtreeFlags&12854)for(p=p.child;p!==null;)OP(p,u),p=p.sibling}function OP(u,p){var v=u.alternate,E=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(fi(p,u),Ui(u),E&4){try{Rf(3,u,u.return),ix(3,u)}catch(Pt){vr(u,u.return,Pt)}try{Rf(5,u,u.return)}catch(Pt){vr(u,u.return,Pt)}}break;case 1:fi(p,u),Ui(u),E&512&&v!==null&&mu(v,v.return);break;case 5:if(fi(p,u),Ui(u),E&512&&v!==null&&mu(v,v.return),u.flags&32){var O=u.stateNode;try{ut(O,"")}catch(Pt){vr(u,u.return,Pt)}}if(E&4&&(O=u.stateNode,O!=null)){var $=u.memoizedProps,J=v!==null?v.memoizedProps:$,se=u.type,pe=u.updateQueue;if(u.updateQueue=null,pe!==null)try{se==="input"&&$.type==="radio"&&$.name!=null&&Me(O,$),sn(se,J);var Ie=sn(se,$);for(J=0;J<pe.length;J+=2){var Je=pe[J],et=pe[J+1];Je==="style"?ct(O,et):Je==="dangerouslySetInnerHTML"?He(O,et):Je==="children"?ut(O,et):N(O,Je,et,Ie)}switch(se){case"input":ue(O,$);break;case"textarea":tt(O,$);break;case"select":var Ge=O._wrapperState.wasMultiple;O._wrapperState.wasMultiple=!!$.multiple;var xt=$.value;xt!=null?De(O,!!$.multiple,xt,!1):Ge!==!!$.multiple&&($.defaultValue!=null?De(O,!!$.multiple,$.defaultValue,!0):De(O,!!$.multiple,$.multiple?[]:"",!1))}O[_f]=$}catch(Pt){vr(u,u.return,Pt)}}break;case 6:if(fi(p,u),Ui(u),E&4){if(u.stateNode===null)throw Error(n(162));O=u.stateNode,$=u.memoizedProps;try{O.nodeValue=$}catch(Pt){vr(u,u.return,Pt)}}break;case 3:if(fi(p,u),Ui(u),E&4&&v!==null&&v.memoizedState.isDehydrated)try{cl(p.containerInfo)}catch(Pt){vr(u,u.return,Pt)}break;case 4:fi(p,u),Ui(u);break;case 13:fi(p,u),Ui(u),O=u.child,O.flags&8192&&($=O.memoizedState!==null,O.stateNode.isHidden=$,!$||O.alternate!==null&&O.alternate.memoizedState!==null||(lj=mn())),E&4&&PP(u);break;case 22:if(Je=v!==null&&v.memoizedState!==null,u.mode&1?(js=(Ie=js)||Je,fi(p,u),js=Ie):fi(p,u),Ui(u),E&8192){if(Ie=u.memoizedState!==null,(u.stateNode.isHidden=Ie)&&!Je&&(u.mode&1)!==0)for(Nt=u,Je=u.child;Je!==null;){for(et=Nt=Je;Nt!==null;){switch(Ge=Nt,xt=Ge.child,Ge.tag){case 0:case 11:case 14:case 15:Rf(4,Ge,Ge.return);break;case 1:mu(Ge,Ge.return);var kt=Ge.stateNode;if(typeof kt.componentWillUnmount=="function"){E=Ge,v=Ge.return;try{p=E,kt.props=p.memoizedProps,kt.state=p.memoizedState,kt.componentWillUnmount()}catch(Pt){vr(E,v,Pt)}}break;case 5:mu(Ge,Ge.return);break;case 22:if(Ge.memoizedState!==null){MP(et);continue}}xt!==null?(xt.return=Ge,Nt=xt):MP(et)}Je=Je.sibling}e:for(Je=null,et=u;;){if(et.tag===5){if(Je===null){Je=et;try{O=et.stateNode,Ie?($=O.style,typeof $.setProperty=="function"?$.setProperty("display","none","important"):$.display="none"):(se=et.stateNode,pe=et.memoizedProps.style,J=pe!=null&&pe.hasOwnProperty("display")?pe.display:null,se.style.display=dt("display",J))}catch(Pt){vr(u,u.return,Pt)}}}else if(et.tag===6){if(Je===null)try{et.stateNode.nodeValue=Ie?"":et.memoizedProps}catch(Pt){vr(u,u.return,Pt)}}else if((et.tag!==22&&et.tag!==23||et.memoizedState===null||et===u)&&et.child!==null){et.child.return=et,et=et.child;continue}if(et===u)break e;for(;et.sibling===null;){if(et.return===null||et.return===u)break e;Je===et&&(Je=null),et=et.return}Je===et&&(Je=null),et.sibling.return=et.return,et=et.sibling}}break;case 19:fi(p,u),Ui(u),E&4&&PP(u);break;case 21:break;default:fi(p,u),Ui(u)}}function Ui(u){var p=u.flags;if(p&2){try{e:{for(var v=u.return;v!==null;){if(EP(v)){var E=v;break e}v=v.return}throw Error(n(160))}switch(E.tag){case 5:var O=E.stateNode;E.flags&32&&(ut(O,""),E.flags&=-33);var $=AP(u);aj(u,$,O);break;case 3:case 4:var J=E.stateNode.containerInfo,se=AP(u);sj(u,se,J);break;default:throw Error(n(161))}}catch(pe){vr(u,u.return,pe)}u.flags&=-3}p&4096&&(u.flags&=-4097)}function oQ(u,p,v){Nt=u,IP(u)}function IP(u,p,v){for(var E=(u.mode&1)!==0;Nt!==null;){var O=Nt,$=O.child;if(O.tag===22&&E){var J=O.memoizedState!==null||ax;if(!J){var se=O.alternate,pe=se!==null&&se.memoizedState!==null||js;se=ax;var Ie=js;if(ax=J,(js=pe)&&!Ie)for(Nt=O;Nt!==null;)J=Nt,pe=J.child,J.tag===22&&J.memoizedState!==null?DP(O):pe!==null?(pe.return=J,Nt=pe):DP(O);for(;$!==null;)Nt=$,IP($),$=$.sibling;Nt=O,ax=se,js=Ie}RP(u)}else(O.subtreeFlags&8772)!==0&&$!==null?($.return=O,Nt=$):RP(u)}}function RP(u){for(;Nt!==null;){var p=Nt;if((p.flags&8772)!==0){var v=p.alternate;try{if((p.flags&8772)!==0)switch(p.tag){case 0:case 11:case 15:js||ix(5,p);break;case 1:var E=p.stateNode;if(p.flags&4&&!js)if(v===null)E.componentDidMount();else{var O=p.elementType===p.type?v.memoizedProps:ui(p.type,v.memoizedProps);E.componentDidUpdate(O,v.memoizedState,E.__reactInternalSnapshotBeforeUpdate)}var $=p.updateQueue;$!==null&&MT(p,$,E);break;case 3:var J=p.updateQueue;if(J!==null){if(v=null,p.child!==null)switch(p.child.tag){case 5:v=p.child.stateNode;break;case 1:v=p.child.stateNode}MT(p,J,v)}break;case 5:var se=p.stateNode;if(v===null&&p.flags&4){v=se;var pe=p.memoizedProps;switch(p.type){case"button":case"input":case"select":case"textarea":pe.autoFocus&&v.focus();break;case"img":pe.src&&(v.src=pe.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(p.memoizedState===null){var Ie=p.alternate;if(Ie!==null){var Je=Ie.memoizedState;if(Je!==null){var et=Je.dehydrated;et!==null&&cl(et)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}js||p.flags&512&&rj(p)}catch(Ge){vr(p,p.return,Ge)}}if(p===u){Nt=null;break}if(v=p.sibling,v!==null){v.return=p.return,Nt=v;break}Nt=p.return}}function MP(u){for(;Nt!==null;){var p=Nt;if(p===u){Nt=null;break}var v=p.sibling;if(v!==null){v.return=p.return,Nt=v;break}Nt=p.return}}function DP(u){for(;Nt!==null;){var p=Nt;try{switch(p.tag){case 0:case 11:case 15:var v=p.return;try{ix(4,p)}catch(pe){vr(p,v,pe)}break;case 1:var E=p.stateNode;if(typeof E.componentDidMount=="function"){var O=p.return;try{E.componentDidMount()}catch(pe){vr(p,O,pe)}}var $=p.return;try{rj(p)}catch(pe){vr(p,$,pe)}break;case 5:var J=p.return;try{rj(p)}catch(pe){vr(p,J,pe)}}}catch(pe){vr(p,p.return,pe)}if(p===u){Nt=null;break}var se=p.sibling;if(se!==null){se.return=p.return,Nt=se;break}Nt=p.return}}var lQ=Math.ceil,ox=C.ReactCurrentDispatcher,ij=C.ReactCurrentOwner,Da=C.ReactCurrentBatchConfig,Sn=0,Qr=null,Or=null,ls=0,ma=0,fu=fl(0),qr=0,Mf=null,Lc=0,lx=0,oj=0,Df=null,Ws=null,lj=0,hu=1/0,ko=null,cx=!1,cj=null,bl=null,dx=!1,vl=null,ux=0,Lf=0,dj=null,mx=-1,fx=0;function Ms(){return(Sn&6)!==0?mn():mx!==-1?mx:mx=mn()}function wl(u){return(u.mode&1)===0?1:(Sn&2)!==0&&ls!==0?ls&-ls:VJ.transition!==null?(fx===0&&(fx=Sr()),fx):(u=qe,u!==0||(u=window.event,u=u===void 0?16:$3(u.type)),u)}function hi(u,p,v,E){if(50<Lf)throw Lf=0,dj=null,Error(n(185));$i(u,v,E),((Sn&2)===0||u!==Qr)&&(u===Qr&&((Sn&2)===0&&(lx|=v),qr===4&&jl(u,ls)),Gs(u,E),v===1&&Sn===0&&(p.mode&1)===0&&(hu=mn()+500,zg&&pl()))}function Gs(u,p){var v=u.callbackNode;Gd(u,p);var E=Ta(u,u===Qr?ls:0);if(E===0)v!==null&&Nn(v),u.callbackNode=null,u.callbackPriority=0;else if(p=E&-E,u.callbackPriority!==p){if(v!=null&&Nn(v),p===1)u.tag===0?KJ($P.bind(null,u)):_T($P.bind(null,u)),FJ(function(){(Sn&6)===0&&pl()}),v=null;else{switch(nt(E)){case 1:v=la;break;case 4:v=Ea;break;case 16:v=Ri;break;case 536870912:v=po;break;default:v=Ri}v=HP(v,LP.bind(null,u))}u.callbackPriority=p,u.callbackNode=v}}function LP(u,p){if(mx=-1,fx=0,(Sn&6)!==0)throw Error(n(327));var v=u.callbackNode;if(pu()&&u.callbackNode!==v)return null;var E=Ta(u,u===Qr?ls:0);if(E===0)return null;if((E&30)!==0||(E&u.expiredLanes)!==0||p)p=hx(u,E);else{p=E;var O=Sn;Sn|=2;var $=FP();(Qr!==u||ls!==p)&&(ko=null,hu=mn()+500,Bc(u,p));do try{uQ();break}catch(se){BP(u,se)}while(!0);Ew(),ox.current=$,Sn=O,Or!==null?p=0:(Qr=null,ls=0,p=qr)}if(p!==0){if(p===2&&(O=go(u),O!==0&&(E=O,p=uj(u,O))),p===1)throw v=Mf,Bc(u,0),jl(u,E),Gs(u,mn()),v;if(p===6)jl(u,E);else{if(O=u.current.alternate,(E&30)===0&&!cQ(O)&&(p=hx(u,E),p===2&&($=go(u),$!==0&&(E=$,p=uj(u,$))),p===1))throw v=Mf,Bc(u,0),jl(u,E),Gs(u,mn()),v;switch(u.finishedWork=O,u.finishedLanes=E,p){case 0:case 1:throw Error(n(345));case 2:Fc(u,Ws,ko);break;case 3:if(jl(u,E),(E&130023424)===E&&(p=lj+500-mn(),10<p)){if(Ta(u,0)!==0)break;if(O=u.suspendedLanes,(O&E)!==E){Ms(),u.pingedLanes|=u.suspendedLanes&O;break}u.timeoutHandle=xw(Fc.bind(null,u,Ws,ko),p);break}Fc(u,Ws,ko);break;case 4:if(jl(u,E),(E&4194240)===E)break;for(p=u.eventTimes,O=-1;0<E;){var J=31-hr(E);$=1<<J,J=p[J],J>O&&(O=J),E&=~$}if(E=O,E=mn()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*lQ(E/1960))-E,10<E){u.timeoutHandle=xw(Fc.bind(null,u,Ws,ko),E);break}Fc(u,Ws,ko);break;case 5:Fc(u,Ws,ko);break;default:throw Error(n(329))}}}return Gs(u,mn()),u.callbackNode===v?LP.bind(null,u):null}function uj(u,p){var v=Df;return u.current.memoizedState.isDehydrated&&(Bc(u,p).flags|=256),u=hx(u,p),u!==2&&(p=Ws,Ws=v,p!==null&&mj(p)),u}function mj(u){Ws===null?Ws=u:Ws.push.apply(Ws,u)}function cQ(u){for(var p=u;;){if(p.flags&16384){var v=p.updateQueue;if(v!==null&&(v=v.stores,v!==null))for(var E=0;E<v.length;E++){var O=v[E],$=O.getSnapshot;O=O.value;try{if(!ci($(),O))return!1}catch{return!1}}}if(v=p.child,p.subtreeFlags&16384&&v!==null)v.return=p,p=v;else{if(p===u)break;for(;p.sibling===null;){if(p.return===null||p.return===u)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function jl(u,p){for(p&=~oj,p&=~lx,u.suspendedLanes|=p,u.pingedLanes&=~p,u=u.expirationTimes;0<p;){var v=31-hr(p),E=1<<v;u[v]=-1,p&=~E}}function $P(u){if((Sn&6)!==0)throw Error(n(327));pu();var p=Ta(u,0);if((p&1)===0)return Gs(u,mn()),null;var v=hx(u,p);if(u.tag!==0&&v===2){var E=go(u);E!==0&&(p=E,v=uj(u,E))}if(v===1)throw v=Mf,Bc(u,0),jl(u,p),Gs(u,mn()),v;if(v===6)throw Error(n(345));return u.finishedWork=u.current.alternate,u.finishedLanes=p,Fc(u,Ws,ko),Gs(u,mn()),null}function fj(u,p){var v=Sn;Sn|=1;try{return u(p)}finally{Sn=v,Sn===0&&(hu=mn()+500,zg&&pl())}}function $c(u){vl!==null&&vl.tag===0&&(Sn&6)===0&&pu();var p=Sn;Sn|=1;var v=Da.transition,E=qe;try{if(Da.transition=null,qe=1,u)return u()}finally{qe=E,Da.transition=v,Sn=p,(Sn&6)===0&&pl()}}function hj(){ma=fu.current,ar(fu)}function Bc(u,p){u.finishedWork=null,u.finishedLanes=0;var v=u.timeoutHandle;if(v!==-1&&(u.timeoutHandle=-1,BJ(v)),Or!==null)for(v=Or.return;v!==null;){var E=v;switch(_w(E),E.tag){case 1:E=E.type.childContextTypes,E!=null&&Bg();break;case 3:du(),ar(Ks),ar(bs),Dw();break;case 5:Rw(E);break;case 4:du();break;case 13:ar(pr);break;case 19:ar(pr);break;case 10:Aw(E.type._context);break;case 22:case 23:hj()}v=v.return}if(Qr=u,Or=u=_l(u.current,null),ls=ma=p,qr=0,Mf=null,oj=lx=Lc=0,Ws=Df=null,Rc!==null){for(p=0;p<Rc.length;p++)if(v=Rc[p],E=v.interleaved,E!==null){v.interleaved=null;var O=E.next,$=v.pending;if($!==null){var J=$.next;$.next=O,E.next=J}v.pending=E}Rc=null}return u}function BP(u,p){do{var v=Or;try{if(Ew(),Qg.current=tx,Xg){for(var E=gr.memoizedState;E!==null;){var O=E.queue;O!==null&&(O.pending=null),E=E.next}Xg=!1}if(Dc=0,Jr=Ur=gr=null,Af=!1,Tf=0,ij.current=null,v===null||v.return===null){qr=1,Mf=p,Or=null;break}e:{var $=u,J=v.return,se=v,pe=p;if(p=ls,se.flags|=32768,pe!==null&&typeof pe=="object"&&typeof pe.then=="function"){var Ie=pe,Je=se,et=Je.tag;if((Je.mode&1)===0&&(et===0||et===11||et===15)){var Ge=Je.alternate;Ge?(Je.updateQueue=Ge.updateQueue,Je.memoizedState=Ge.memoizedState,Je.lanes=Ge.lanes):(Je.updateQueue=null,Je.memoizedState=null)}var xt=dP(J);if(xt!==null){xt.flags&=-257,uP(xt,J,se,$,p),xt.mode&1&&cP($,Ie,p),p=xt,pe=Ie;var kt=p.updateQueue;if(kt===null){var Pt=new Set;Pt.add(pe),p.updateQueue=Pt}else kt.add(pe);break e}else{if((p&1)===0){cP($,Ie,p),pj();break e}pe=Error(n(426))}}else if(lr&&se.mode&1){var kr=dP(J);if(kr!==null){(kr.flags&65536)===0&&(kr.flags|=256),uP(kr,J,se,$,p),kw(uu(pe,se));break e}}$=pe=uu(pe,se),qr!==4&&(qr=2),Df===null?Df=[$]:Df.push($),$=J;do{switch($.tag){case 3:$.flags|=65536,p&=-p,$.lanes|=p;var Ce=oP($,pe,p);RT($,Ce);break e;case 1:se=pe;var be=$.type,Ae=$.stateNode;if(($.flags&128)===0&&(typeof be.getDerivedStateFromError=="function"||Ae!==null&&typeof Ae.componentDidCatch=="function"&&(bl===null||!bl.has(Ae)))){$.flags|=65536,p&=-p,$.lanes|=p;var st=lP($,se,p);RT($,st);break e}}$=$.return}while($!==null)}UP(v)}catch(Ot){p=Ot,Or===v&&v!==null&&(Or=v=v.return);continue}break}while(!0)}function FP(){var u=ox.current;return ox.current=tx,u===null?tx:u}function pj(){(qr===0||qr===3||qr===2)&&(qr=4),Qr===null||(Lc&268435455)===0&&(lx&268435455)===0||jl(Qr,ls)}function hx(u,p){var v=Sn;Sn|=2;var E=FP();(Qr!==u||ls!==p)&&(ko=null,Bc(u,p));do try{dQ();break}catch(O){BP(u,O)}while(!0);if(Ew(),Sn=v,ox.current=E,Or!==null)throw Error(n(261));return Qr=null,ls=0,qr}function dQ(){for(;Or!==null;)zP(Or)}function uQ(){for(;Or!==null&&!Et();)zP(Or)}function zP(u){var p=VP(u.alternate,u,ma);u.memoizedProps=u.pendingProps,p===null?UP(u):Or=p,ij.current=null}function UP(u){var p=u;do{var v=p.alternate;if(u=p.return,(p.flags&32768)===0){if(v=rQ(v,p,ma),v!==null){Or=v;return}}else{if(v=sQ(v,p),v!==null){v.flags&=32767,Or=v;return}if(u!==null)u.flags|=32768,u.subtreeFlags=0,u.deletions=null;else{qr=6,Or=null;return}}if(p=p.sibling,p!==null){Or=p;return}Or=p=u}while(p!==null);qr===0&&(qr=5)}function Fc(u,p,v){var E=qe,O=Da.transition;try{Da.transition=null,qe=1,mQ(u,p,v,E)}finally{Da.transition=O,qe=E}return null}function mQ(u,p,v,E){do pu();while(vl!==null);if((Sn&6)!==0)throw Error(n(327));v=u.finishedWork;var O=u.finishedLanes;if(v===null)return null;if(u.finishedWork=null,u.finishedLanes=0,v===u.current)throw Error(n(177));u.callbackNode=null,u.callbackPriority=0;var $=v.lanes|v.childLanes;if(Ec(u,$),u===Qr&&(Or=Qr=null,ls=0),(v.subtreeFlags&2064)===0&&(v.flags&2064)===0||dx||(dx=!0,HP(Ri,function(){return pu(),null})),$=(v.flags&15990)!==0,(v.subtreeFlags&15990)!==0||$){$=Da.transition,Da.transition=null;var J=qe;qe=1;var se=Sn;Sn|=4,ij.current=null,iQ(u,v),OP(v,u),OJ(pw),Bt=!!hw,pw=hw=null,u.current=v,oQ(v),Zt(),Sn=se,qe=J,Da.transition=$}else u.current=v;if(dx&&(dx=!1,vl=u,ux=O),$=u.pendingLanes,$===0&&(bl=null),Us(v.stateNode),Gs(u,mn()),p!==null)for(E=u.onRecoverableError,v=0;v<p.length;v++)O=p[v],E(O.value,{componentStack:O.stack,digest:O.digest});if(cx)throw cx=!1,u=cj,cj=null,u;return(ux&1)!==0&&u.tag!==0&&pu(),$=u.pendingLanes,($&1)!==0?u===dj?Lf++:(Lf=0,dj=u):Lf=0,pl(),null}function pu(){if(vl!==null){var u=nt(ux),p=Da.transition,v=qe;try{if(Da.transition=null,qe=16>u?16:u,vl===null)var E=!1;else{if(u=vl,vl=null,ux=0,(Sn&6)!==0)throw Error(n(331));var O=Sn;for(Sn|=4,Nt=u.current;Nt!==null;){var $=Nt,J=$.child;if((Nt.flags&16)!==0){var se=$.deletions;if(se!==null){for(var pe=0;pe<se.length;pe++){var Ie=se[pe];for(Nt=Ie;Nt!==null;){var Je=Nt;switch(Je.tag){case 0:case 11:case 15:Rf(8,Je,$)}var et=Je.child;if(et!==null)et.return=Je,Nt=et;else for(;Nt!==null;){Je=Nt;var Ge=Je.sibling,xt=Je.return;if(CP(Je),Je===Ie){Nt=null;break}if(Ge!==null){Ge.return=xt,Nt=Ge;break}Nt=xt}}}var kt=$.alternate;if(kt!==null){var Pt=kt.child;if(Pt!==null){kt.child=null;do{var kr=Pt.sibling;Pt.sibling=null,Pt=kr}while(Pt!==null)}}Nt=$}}if(($.subtreeFlags&2064)!==0&&J!==null)J.return=$,Nt=J;else e:for(;Nt!==null;){if($=Nt,($.flags&2048)!==0)switch($.tag){case 0:case 11:case 15:Rf(9,$,$.return)}var Ce=$.sibling;if(Ce!==null){Ce.return=$.return,Nt=Ce;break e}Nt=$.return}}var be=u.current;for(Nt=be;Nt!==null;){J=Nt;var Ae=J.child;if((J.subtreeFlags&2064)!==0&&Ae!==null)Ae.return=J,Nt=Ae;else e:for(J=be;Nt!==null;){if(se=Nt,(se.flags&2048)!==0)try{switch(se.tag){case 0:case 11:case 15:ix(9,se)}}catch(Ot){vr(se,se.return,Ot)}if(se===J){Nt=null;break e}var st=se.sibling;if(st!==null){st.return=se.return,Nt=st;break e}Nt=se.return}}if(Sn=O,pl(),Is&&typeof Is.onPostCommitFiberRoot=="function")try{Is.onPostCommitFiberRoot(Mi,u)}catch{}E=!0}return E}finally{qe=v,Da.transition=p}}return!1}function qP(u,p,v){p=uu(v,p),p=oP(u,p,1),u=xl(u,p,1),p=Ms(),u!==null&&($i(u,1,p),Gs(u,p))}function vr(u,p,v){if(u.tag===3)qP(u,u,v);else for(;p!==null;){if(p.tag===3){qP(p,u,v);break}else if(p.tag===1){var E=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof E.componentDidCatch=="function"&&(bl===null||!bl.has(E))){u=uu(v,u),u=lP(p,u,1),p=xl(p,u,1),u=Ms(),p!==null&&($i(p,1,u),Gs(p,u));break}}p=p.return}}function fQ(u,p,v){var E=u.pingCache;E!==null&&E.delete(p),p=Ms(),u.pingedLanes|=u.suspendedLanes&v,Qr===u&&(ls&v)===v&&(qr===4||qr===3&&(ls&130023424)===ls&&500>mn()-lj?Bc(u,0):oj|=v),Gs(u,p)}function KP(u,p){p===0&&((u.mode&1)===0?p=1:(p=al,al<<=1,(al&130023424)===0&&(al=4194304)));var v=Ms();u=_o(u,p),u!==null&&($i(u,p,v),Gs(u,v))}function hQ(u){var p=u.memoizedState,v=0;p!==null&&(v=p.retryLane),KP(u,v)}
vendor: 4,291 bytes, line 40
40function pQ(u,p){var v=0;switch(u.tag){case 13:var E=u.stateNode,O=u.memoizedState;O!==null&&(v=O.retryLane);break;case 19:E=u.stateNode;break;default:throw Error(n(314))}E!==null&&E.delete(p),KP(u,v)}var VP;VP=function(u,p,v){if(u!==null)if(u.memoizedProps!==p.pendingProps||Ks.current)Hs=!0;else{if((u.lanes&v)===0&&(p.flags&128)===0)return Hs=!1,nQ(u,p,v);Hs=(u.flags&131072)!==0}else Hs=!1,lr&&(p.flags&1048576)!==0&&NT(p,qg,p.index);switch(p.lanes=0,p.tag){case 2:var E=p.type;sx(u,p),u=p.pendingProps;var O=ru(p,bs.current);cu(p,v),O=Bw(null,p,E,u,O,v);var $=Fw();return p.flags|=1,typeof O=="object"&&O!==null&&typeof O.render=="function"&&O.$$typeof===void 0?(p.tag=1,p.memoizedState=null,p.updateQueue=null,Vs(E)?($=!0,Fg(p)):$=!1,p.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,Ow(p),O.updater=nx,p.stateNode=O,O._reactInternals=p,Hw(p,E,u,v),p=Jw(null,p,E,!0,$,v)):(p.tag=0,lr&&$&&jw(p),Rs(null,p,O,v),p=p.child),p;case 16:E=p.elementType;e:{switch(sx(u,p),u=p.pendingProps,O=E._init,E=O(E._payload),p.type=E,O=p.tag=xQ(E),u=ui(E,u),O){case 0:p=Yw(null,p,E,u,v);break e;case 1:p=xP(null,p,E,u,v);break e;case 11:p=mP(null,p,E,u,v);break e;case 14:p=fP(null,p,E,ui(E.type,u),v);break e}throw Error(n(306,E,""))}return p;case 0:return E=p.type,O=p.pendingProps,O=p.elementType===E?O:ui(E,O),Yw(u,p,E,O,v);case 1:return E=p.type,O=p.pendingProps,O=p.elementType===E?O:ui(E,O),xP(u,p,E,O,v);case 3:e:{if(yP(p),u===null)throw Error(n(387));E=p.pendingProps,$=p.memoizedState,O=$.element,IT(u,p),Yg(p,E,null,v);var J=p.memoizedState;if(E=J.element,$.isDehydrated)if($={element:E,isDehydrated:!1,cache:J.cache,pendingSuspenseBoundaries:J.pendingSuspenseBoundaries,transitions:J.transitions},p.updateQueue.baseState=$,p.memoizedState=$,p.flags&256){O=uu(Error(n(423)),p),p=bP(u,p,E,v,O);break e}else if(E!==O){O=uu(Error(n(424)),p),p=bP(u,p,E,v,O);break e}else for(ua=ml(p.stateNode.containerInfo.firstChild),da=p,lr=!0,di=null,v=PT(p,null,E,v),p.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(iu(),E===O){p=So(u,p,v);break e}Rs(u,p,E,v)}p=p.child}return p;case 5:return DT(p),u===null&&Sw(p),E=p.type,O=p.pendingProps,$=u!==null?u.memoizedProps:null,J=O.children,gw(E,O)?J=null:$!==null&&gw(E,$)&&(p.flags|=32),gP(u,p),Rs(u,p,J,v),p.child;case 6:return u===null&&Sw(p),null;case 13:return vP(u,p,v);case 4:return Iw(p,p.stateNode.containerInfo),E=p.pendingProps,u===null?p.child=ou(p,null,E,v):Rs(u,p,E,v),p.child;case 11:return E=p.type,O=p.pendingProps,O=p.elementType===E?O:ui(E,O),mP(u,p,E,O,v);case 7:return Rs(u,p,p.pendingProps,v),p.child;case 8:return Rs(u,p,p.pendingProps.children,v),p.child;case 12:return Rs(u,p,p.pendingProps.children,v),p.child;case 10:e:{if(E=p.type._context,O=p.pendingProps,$=p.memoizedProps,J=O.value,Xn(Hg,E._currentValue),E._currentValue=J,$!==null)if(ci($.value,J)){if($.children===O.children&&!Ks.current){p=So(u,p,v);break e}}else for($=p.child,$!==null&&($.return=p);$!==null;){var se=$.dependencies;if(se!==null){J=$.child;for(var pe=se.firstContext;pe!==null;){if(pe.context===E){if($.tag===1){pe=No(-1,v&-v),pe.tag=2;var Ie=$.updateQueue;if(Ie!==null){Ie=Ie.shared;var Je=Ie.pending;Je===null?pe.next=pe:(pe.next=Je.next,Je.next=pe),Ie.pending=pe}}$.lanes|=v,pe=$.alternate,pe!==null&&(pe.lanes|=v),Tw($.return,v,p),se.lanes|=v;break}pe=pe.next}}else if($.tag===10)J=$.type===p.type?null:$.child;else if($.tag===18){if(J=$.return,J===null)throw Error(n(341));J.lanes|=v,se=J.alternate,se!==null&&(se.lanes|=v),Tw(J,v,p),J=$.sibling}else J=$.child;if(J!==null)J.return=$;else for(J=$;J!==null;){if(J===p){J=null;break}if($=J.sibling,$!==null){$.return=J.return,J=$;break}J=J.return}$=J}Rs(u,p,O.children,v),p=p.child}return p;case 9:return O=p.type,E=p.pendingProps.children,cu(p,v),O=Ra(O),E=E(O),p.flags|=1,Rs(u,p,E,v),p.child;case 14:return E=p.type,O=ui(E,p.pendingProps),O=ui(E.type,O),fP(u,p,E,O,v);case 15:return hP(u,p,p.type,p.pendingProps,v);case 17:return E=p.type,O=p.pendingProps,O=p.elementType===E?O:ui(E,O),sx(u,p),p.tag=1,Vs(E)?(u=!0,Fg(p)):u=!1,cu(p,v),aP(p,E,O),Hw(p,E,O,v),Jw(null,p,E,!0,u,v);case 19:return jP(u,p,v);case 22:return pP(u,p,v)}throw Error(n(156,p.tag))};function HP(u,p){return Xt(u,p)}function gQ(u,p,v,E){this.tag=u,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.t
vendor: 8,987 bytes, line 40
40ype=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=p,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function La(u,p,v,E){return new gQ(u,p,v,E)}function gj(u){return u=u.prototype,!(!u||!u.isReactComponent)}function xQ(u){if(typeof u=="function")return gj(u)?1:0;if(u!=null){if(u=u.$$typeof,u===P)return 11;if(u===L)return 14}return 2}function _l(u,p){var v=u.alternate;return v===null?(v=La(u.tag,p,u.key,u.mode),v.elementType=u.elementType,v.type=u.type,v.stateNode=u.stateNode,v.alternate=u,u.alternate=v):(v.pendingProps=p,v.type=u.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=u.flags&14680064,v.childLanes=u.childLanes,v.lanes=u.lanes,v.child=u.child,v.memoizedProps=u.memoizedProps,v.memoizedState=u.memoizedState,v.updateQueue=u.updateQueue,p=u.dependencies,v.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},v.sibling=u.sibling,v.index=u.index,v.ref=u.ref,v}function px(u,p,v,E,O,$){var J=2;if(E=u,typeof u=="function")gj(u)&&(J=1);else if(typeof u=="string")J=5;else e:switch(u){case A:return zc(v.children,O,$,p);case T:J=8,O|=8;break;case R:return u=La(12,v,p,O|2),u.elementType=R,u.lanes=$,u;case I:return u=La(13,v,p,O),u.elementType=I,u.lanes=$,u;case z:return u=La(19,v,p,O),u.elementType=z,u.lanes=$,u;case W:return gx(v,O,$,p);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case B:J=10;break e;case D:J=9;break e;case P:J=11;break e;case L:J=14;break e;case H:J=16,E=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return p=La(J,v,p,O),p.elementType=u,p.type=E,p.lanes=$,p}function zc(u,p,v,E){return u=La(7,u,E,p),u.lanes=v,u}function gx(u,p,v,E){return u=La(22,u,E,p),u.elementType=W,u.lanes=v,u.stateNode={isHidden:!1},u}function xj(u,p,v){return u=La(6,u,null,p),u.lanes=v,u}function yj(u,p,v){return p=La(4,u.children!==null?u.children:[],u.key,p),p.lanes=v,p.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},p}function yQ(u,p,v,E,O){this.tag=p,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=li(0),this.expirationTimes=li(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=li(0),this.identifierPrefix=E,this.onRecoverableError=O,this.mutableSourceEagerHydrationData=null}function bj(u,p,v,E,O,$,J,se,pe){return u=new yQ(u,p,v,se,pe),p===1?(p=1,$===!0&&(p|=8)):p=0,$=La(3,null,null,p),u.current=$,$.stateNode=u,$.memoizedState={element:E,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ow($),u}function bQ(u,p,v){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:S,key:E==null?null:""+E,children:u,containerInfo:p,implementation:v}}function WP(u){if(!u)return hl;u=u._reactInternals;e:{if(oe(u)!==u||u.tag!==1)throw Error(n(170));var p=u;do{switch(p.tag){case 3:p=p.stateNode.context;break e;case 1:if(Vs(p.type)){p=p.stateNode.__reactInternalMemoizedMergedChildContext;break e}}p=p.return}while(p!==null);throw Error(n(171))}if(u.tag===1){var v=u.type;if(Vs(v))return wT(u,v,p)}return p}function GP(u,p,v,E,O,$,J,se,pe){return u=bj(v,E,!0,u,O,$,J,se,pe),u.context=WP(null),v=u.current,E=Ms(),O=wl(v),$=No(E,O),$.callback=p??null,xl(v,$,O),u.current.lanes=O,$i(u,O,E),Gs(u,E),u}function xx(u,p,v,E){var O=p.current,$=Ms(),J=wl(O);return v=WP(v),p.context===null?p.context=v:p.pendingContext=v,p=No($,J),p.payload={element:u},E=E===void 0?null:E,E!==null&&(p.callback=E),u=xl(O,p,J),u!==null&&(hi(u,O,J,$),Gg(u,O,J)),J}function yx(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return u.child.stateNode;default:return u.child.stateNode}}function YP(u,p){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var v=u.retryLane;u.retryLane=v!==0&&v<p?v:p}}function vj(u,p){YP(u,p),(u=u.alternate)&&YP(u,p)}function vQ(){return null}var JP=typeof reportError=="function"?reportError:function(u){console.error(u)};function wj(u){this._internalRoot=u}bx.prototype.render=wj.prototype.render=function(u){var p=this._internalRoot;if(p===null)throw Error(n(409));xx(u,p,null,null)},bx.prototype.unmount=wj.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var p=u.containerInfo;$c(function(){xx(null,u,null,null)}),p[bo]=null}};function bx(u){this._internalRoot=u}bx.prototype.unstable_scheduleHydration=function(u){if(u){var p=pn();u={blockedOn:null,target:u,priority:p};for(var v=0;v<zr.length&&p!==0&&p<zr[v].priority;v++);zr.splice(v,0,u),v===0&&uf(u)}};function jj(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function vx(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11&&(u.nodeType!==8||u.nodeValue!==" react-mount-point-unstable "))}function QP(){}function wQ(u,p,v,E,O){if(O){if(typeof E=="function"){var $=E;E=function(){var Ie=yx(J);$.call(Ie)}}var J=GP(p,E,u,0,null,!1,!1,"",QP);return u._reactRootContainer=J,u[bo]=J.current,wf(u.nodeType===8?u.parentNode:u),$c(),J}for(;O=u.lastChild;)u.removeChild(O);if(typeof E=="function"){var se=E;E=function(){var Ie=yx(pe);se.call(Ie)}}var pe=bj(u,0,!1,null,null,!1,!1,"",QP);return u._reactRootContainer=pe,u[bo]=pe.current,wf(u.nodeType===8?u.parentNode:u),$c(function(){xx(p,pe,v,E)}),pe}function wx(u,p,v,E,O){var $=v._reactRootContainer;if($){var J=$;if(typeof O=="function"){var se=O;O=function(){var pe=yx(J);se.call(pe)}}xx(p,J,u,O)}else J=wQ(v,p,u,O,E);return yx(J)}ft=function(u){switch(u.tag){case 3:var p=u.stateNode;if(p.current.memoizedState.isDehydrated){var v=Fr(p.pendingLanes);v!==0&&(ye(p,v|1),Gs(p,mn()),(Sn&6)===0&&(hu=mn()+500,pl()))}break;case 13:$c(function(){var E=_o(u,1);if(E!==null){var O=Ms();hi(E,u,1,O)}}),vj(u,1)}},Lt=function(u){if(u.tag===13){var p=_o(u,134217728);if(p!==null){var v=Ms();hi(p,u,134217728,v)}vj(u,134217728)}},Yt=function(u){if(u.tag===13){var p=wl(u),v=_o(u,p);if(v!==null){var E=Ms();hi(v,u,p,E)}vj(u,p)}},pn=function(){return qe},je=function(u,p){var v=qe;try{return qe=u,p()}finally{qe=v}},it=function(u,p,v){switch(p){case"input":if(ue(u,v),p=v.name,v.type==="radio"&&p!=null){for(v=u;v.parentNode;)v=v.parentNode;for(v=v.querySelectorAll("input[name="+JSON.stringify(""+p)+'][type="radio"]'),p=0;p<v.length;p++){var E=v[p];if(E!==u&&E.form===u.form){var O=$g(E);if(!O)throw Error(n(90));re(E),ue(E,O)}}}break;case"textarea":tt(u,v);break;case"select":p=v.value,p!=null&&De(u,!!v.multiple,p,!1)}},tn=fj,On=$c;var jQ={usingClientEntryPoint:!1,Events:[Nf,tu,$g,Jn,Hn,fj]},$f={findFiberByHostInstance:Tc,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},_Q={bundleType:$f.bundleType,version:$f.version,rendererPackageName:$f.rendererPackageName,rendererConfig:$f.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(u){return u=qt(u),u===null?null:u.stateNode},findFiberByHostInstance:$f.findFiberByHostInstance||vQ,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var jx=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!jx.isDisabled&&jx.supportsFiber)try{Mi=jx.inject(_Q),Is=jx}catch{}}return Ys.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jQ,Ys.createPortal=function(u,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!jj(p))throw Error(n(200));return bQ(u,p,null,v)},Ys.createRoot=function(u,p){if(!jj(u))throw Error(n(299));var v=!1,E="",O=JP;return p!=null&&(p.unstable_strictMode===!0&&(v=!0),p.identifierPrefix!==void 0&&(E=p.identifierPrefix),p.onRecoverableError!==void 0&&(O=p.onRecoverableError)),p=bj(u,1,!1,null,null,v,!1,E,O),u[bo]=p.current,wf(u.nodeType===8?u.parentNode:u),new wj(p)},Ys.findDOMNode=function(u){if(u==null)return null;if(u.nodeType===1)return u;var p=u._reactInternals;if(p===void 0)throw typeof u.render=="function"?Error(n(188)):(u=Object.keys(u).join(","),Error(n(268,u)));return u=qt(p),u=u===null?null:u.stateNode,u},Ys.flushSync=function(u){return $c(u)},Ys.hydrate=function(u,p,v){if(!vx(p))throw Error(n(200));return wx(null,u,p,!0,v)},Ys.hydrateRoot=function(u,p,v){if(!jj(u))throw Error(n(405));var E=v!=null&&v.hydratedSources||null,O=!1,$="",J=JP;if(v!=null&&(v.unstable_strictMode===!0&&(O=!0),v.identifierPrefix!==void 0&&($=v.identifierPrefix),v.onRecoverableError!==void 0&&(J=v.onRecoverableError)),p=GP(p,null,u,1,v??null,O,!1,$,J),u[bo]=p.current,wf(u),E)for(u=0;
40u<E.length;u++)v=E[u],O=v._getVersion,O=O(v._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[v,O]:p.mutableSourceEagerHydrationData.push(v,O);return new bx(p)},Ys.render=function(u,p,v){if(!vx(p))throw Error(n(200));return wx(null,u,p,!1,v)},Ys.unmountComponentAtNode=function(u){if(!vx(u))throw Error(n(40));return u._reactRootContainer?($c(function(){wx(null,null,u,!1,function(){u._reactRootContainer=null,u[bo]=null})}),!0):!1},Ys.unstable_batchedUpdates=fj,Ys.unstable_renderSubtreeIntoContainer=function(u,p,v,E){if(!vx(v))throw Error(n(200));if(u==null||u._reactInternals===void 0)throw Error(n(38));return wx(u,p,v,!1,E)},Ys.version="18.3.1-next-f1338f8080-20240426",Ys}var iO;function xz(){if(iO)return kj.exports;iO=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),kj.exports=IQ(),kj.exports}var oO;function RQ(){if(oO)return Sx;oO=1;var e=xz();return Sx.createRoot=e.createRoot,Sx.hydrateRoot=e.hydrateRoot,Sx}var MQ=RQ();const DQ=Un(MQ),LQ=20,$Q=1e6,Do={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Aj=0;function BQ(){return Aj=(Aj+1)%Number.MAX_VALUE,Aj.toString()}const Tj=new Map,lO=e=>{if(Tj.has(e))return;const t=setTimeout(()=>{Tj.delete(e),vh({type:Do.REMOVE_TOAST,toastId:e})},$Q);Tj.set(e,t)},FQ=(e,t)=>{switch(t.type){case Do.ADD_TOAST:return{...e,toasts:[t.toast,...e.toasts].slice(0,LQ)};case Do.UPDATE_TOAST:return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case Do.DISMISS_TOAST:{const{toastId:n}=t;return n?lO(n):e.toasts.forEach(s=>{lO(s.id)}),{...e,toasts:e.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case Do.REMOVE_TOAST:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},g0=[];let x0={toasts:[]};function vh(e){x0=FQ(x0,e),g0.forEach(t=>{t(x0)})}function yz({...e}){const t=BQ(),n=a=>vh({type:Do.UPDATE_TOAST,toast:{...a,id:t}}),s=()=>vh({type:Do.DISMISS_TOAST,toastId:t});return vh({type:Do.ADD_TOAST,toast:{...e,id:t,open:!0,onOpenChange:a=>{a||s()}}}),{id:t,dismiss:s,update:n}}function bb(){const[e,t]=h.useState(x0);return h.useEffect(()=>(g0.push(t),()=>{const n=g0.indexOf(t);n>-1&&g0.splice(n,1)}),[e]),{...e,toast:yz,dismiss:n=>vh({type:Do.DISMISS_TOAST,toastId:n})}}var fc=xz();const bz=Un(fc);function Rt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function cO(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ei(...e){return t=>{let n=!1;const s=e.map(a=>{const i=cO(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<s.length;a++){const i=s[a];typeof i=="function"?i():cO(e[a],null)}}}}function xn(...e){return h.useCallback(ei(...e),e)}function zQ(e,t){const n=h.createContext(t),s=i=>{const{children:o,...l}=i,c=h.useMemo(()=>l,Object.values(l));return r.jsx(n.Provider,{value:c,children:o})};s.displayName=e+"Provider";function a(i){const o=h.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,a]}function Ti(e,t=[]){let n=[];function s(i,o){const l=h.createContext(o),c=n.length;n=[...n,o];const d=m=>{var w;const{scope:g,children:x,...j}=m,b=((w=g==null?void 0:g[e])==null?void 0:w[c])||l,y=h.useMemo(()=>j,Object.values(j));return r.jsx(b.Provider,{value:y,children:x})};d.displayName=i+"Provider";function f(m,g){var b;const x=((b=g==null?void 0:g[e])==null?void 0:b[c])||l,j=h.useContext(x);if(j)return j;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[d,f]}const a=()=>{const i=n.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[s,UQ(a,...t)]}function UQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));
vendor: 12,884 bytes, line 40
40return function(i){const o=s.reduce((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function dO(e){const t=qQ(e),n=h.forwardRef((s,a)=>{const{children:i,...o}=s,l=h.Children.toArray(i),c=l.find(VQ);if(c){const d=c.props.children,f=l.map(m=>m===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:m);return r.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,f):null})}return r.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function qQ(e){const t=h.forwardRef((n,s)=>{const{children:a,...i}=n;if(h.isValidElement(a)){const o=WQ(a),l=HQ(i,a.props);return a.type!==h.Fragment&&(l.ref=s?ei(s,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var KQ=Symbol("radix.slottable");function VQ(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===KQ}function HQ(e,t){const n={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function WQ(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function vb(e){const t=e+"CollectionProvider",[n,s]=Ti(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:y,children:w}=b,_=xe.useRef(null),N=xe.useRef(new Map).current;return r.jsx(a,{scope:y,itemMap:N,collectionRef:_,children:w})};o.displayName=t;const l=e+"CollectionSlot",c=dO(l),d=xe.forwardRef((b,y)=>{const{scope:w,children:_}=b,N=i(l,w),C=xn(y,N.collectionRef);return r.jsx(c,{ref:C,children:_})});d.displayName=l;const f=e+"CollectionItemSlot",m="data-radix-collection-item",g=dO(f),x=xe.forwardRef((b,y)=>{const{scope:w,children:_,...N}=b,C=xe.useRef(null),k=xn(y,C),S=i(f,w);return xe.useEffect(()=>(S.itemMap.set(C,{ref:C,...N}),()=>void S.itemMap.delete(C))),r.jsx(g,{[m]:"",ref:k,children:_})});x.displayName=f;function j(b){const y=i(e+"CollectionConsumer",b);return xe.useCallback(()=>{const _=y.collectionRef.current;if(!_)return[];const N=Array.from(_.querySelectorAll(`[${m}]`));return Array.from(y.itemMap.values()).sort((S,A)=>N.indexOf(S.ref.current)-N.indexOf(A.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:o,Slot:d,ItemSlot:x},j,s]}function GQ(e){const t=YQ(e),n=h.forwardRef((s,a)=>{const{children:i,...o}=s,l=h.Children.toArray(i),c=l.find(QQ);if(c){const d=c.props.children,f=l.map(m=>m===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:m);return r.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,f):null})}return r.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function YQ(e){const t=h.forwardRef((n,s)=>{const{children:a,...i}=n;if(h.isValidElement(a)){const o=ZQ(a),l=XQ(i,a.props);return a.type!==h.Fragment&&(l.ref=s?ei(s,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JQ=Symbol("radix.slottable");function QQ(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JQ}function XQ(e,t){const n={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function ZQ(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var eX=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mt=eX.reduce((e,t)=>{const n=GQ(`Primitive.${t}`),s=h.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function vz(e,t){e&&fc.flushSync(()=>e.dispatchEvent(t))}function ti(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function tX(e,t=globalThis==null?void 0:globalThis.document){const n=ti(e);h.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var nX="DismissableLayer",Yk="dismissableLayer.update",rX="dismissableLayer.pointerDownOutside",sX="dismissableLayer.focusOutside",uO,wz=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kp=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,d=h.useContext(wz),[f,m]=h.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=h.useState({}),j=xn(t,A=>m(A)),b=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=b.indexOf(y),_=f?b.indexOf(f):-1,N=d.layersWithOutsidePointerEventsDisabled.size>0,C=_>=w,k=iX(A=>{const T=A.target,R=[...d.branches].some(B=>B.contains(T));!C||R||(a==null||a(A),o==null||o(A),A.defaultPrevented||l==null||l())},g),S=oX(A=>{const T=A.target;[...d.branches].some(B=>B.contains(T))||(i==null||i(A),o==null||o(A),A.defaultPrevented||l==null||l())},g);return tX(A=>{_===d.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&l&&(A.preventDefault(),l()))},g),h.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(uO=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),mO(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=uO)}},[f,g,n,d]),h.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),mO())},[f,d]),h.useEffect(()=>{const A=()=>x({});return document.addEventListener(Yk,A),()=>document.removeEventListener(Yk,A)},[]),r.jsx(Mt.div,{...c,ref:j,style:{pointerEvents:N?C?"auto":"none":void 0,...e.style},onFocusCapture:Rt(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Rt(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Rt(e.onPointerDownCapture,k.onPointerDownCapture)})});Kp.displayName=nX;var aX="DismissableLayerBranch",jz=h.forwardRef((e,t)=>{const n=h.useContext(wz),s=h.useRef(null),a=xn(t,s);return h.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),r.jsx(Mt.div,{...e,ref:a})});jz.displayName=aX;function iX(e,t=globalThis==null?void 0:globalThis.document){const n=ti(e),s=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!s.current){let c=function(){_z(rX,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function oX(e,t=globalThis==null?void 0:globalThis.document){const n=ti(e),s=h.useRef(!1);return h.useEffect(()=>{const a=i=>{i.target&&!s.current&&_z(sX,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function mO(){const e=new CustomEvent(Yk);document.dispatchEvent(e)}function _z(e,t,n,{discrete:s}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?vz(a,i):a.dispatchEvent(i)}var lX=Kp,cX=jz,xs=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},dX="Portal",Vp=h.forwardRef((e,t)=>{var l;const{container:n,...s}=e,[a,i]=h.useState(!1);xs(()=>i(!0),[]);const o=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?bz.createPortal(r.jsx(Mt.div,{...s,ref:t}),o):null});Vp.displayName=dX;function uX(e,t){return h.useReducer((n,s)=>t[n][s]??n,e)}var Xo=e=>{const{present:t,children:n}=e,s=mX(t),a=typeof n=="function"?n({present:s.isPresent}):h.Children.only(n),i=xn(s.ref,fX(a));return typeof n=="function"||s.isPresent?h.cloneElement(a,{ref:i}):null};Xo.displayName="Presence";function mX(e){const[t,n]=h.useState(),s=h.useRef(null),a=h.useRef(e),i=h.useRef("none"),o=e?"mounted":"unmounted",[l,c]=uX(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const d=kx(s.current);i.current=l==="mounted"?d:"none"},[l]),xs(()=>{const d=s.current,f=a.current;if(f!==e){const g=i.current,x=kx(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&g!==x?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),xs(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,m=x=>{const b=kx(s.current).includes(CSS.escape(x.animationName));if(x.target===t&&b&&(c("ANIMATION_END"),!a.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},g=x=>{x.target===t&&(i.current=kx(s.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(d=>{s.current=d?getComputedStyle(d):null,n(d)},[])}}function kx(e){return(e==null?void 0:e.animationName)||"none"}function fX(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var hX=yb[" useInsertionEffect ".trim().toString()]||xs;function so({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,i,o]=pX({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:a;{const f=h.useRef(e!==void 0);h.useEffect(()=>{const m=f.current;m!==l&&console.warn(`${s} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=l},[l,s])}const d=h.useCallback(f=>{var m;if(l){const g=gX(f)?f(e):f;g!==e&&((m=o.current)==null||m.call(o,g))}else i(f)},[l,e,i,o]);return[c,d]}function pX({defaultProp:e,onChange:t}){const[n,s]=h.useState(e),a=h.useRef(n),i=h.useRef(t);return hX(()=>{i.current=t},[t]),h.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,s,i]}function gX(e){return typeof e=="function"}var Nz=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),xX="VisuallyHidden",F5=h.forwardRef((e,t)=>r.jsx(Mt.span,{...e,ref:t,style:{...Nz,...e.style}}));F5.displayName=xX;var z5="ToastProvider",[U5,yX,bX]=vb("Toast"),[Sz]=Ti("Toast",[bX]),[vX,wb]=Sz(z5),kz=e=>{const{__scopeToast:t,label:n="Notification",duration:s=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:o}=e,[l,c]=h.useState(null),[d,f]=h.useState(0),m=h.useRef(!1),g=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${z5}\`. Expected non-empty \`string\`.`),r.jsx(U5.Provider,{scope:t,children:r.jsx(vX,{scope:t,label:n,duration:s,swipeDirection:a,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:h.useCallback(()=>f(x=>x+1),[]),onToastRemove:h.useCallback(()=>f(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:o})})};kz.displayName=z5;var Cz="ToastViewport",wX=["F8"],Jk="toast.viewportPause",Qk="toast.viewportResume",Ez=h.forwardRef((e,t)=>
40{const{__scopeToast:n,hotkey:s=wX,label:a="Notifications ({hotkey})",...i}=e,o=wb(Cz,n),l=yX(n),c=h.useRef(null),d=h.useRef(null),f=h.useRef(null),m=h.useRef(null),g=xn(t,m,o.onViewportChange),x=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),j=o.toastCount>0;h.useEffect(()=>{const y=w=>{var N;s.length!==0&&s.every(C=>w[C]||w.code===C)&&((N=m.current)==null||N.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]),h.useEffect(()=>{const y=c.current,w=m.current;if(j&&y&&w){const _=()=>{if(!o.isClosePausedRef.current){const S=new CustomEvent(Jk);w.dispatchEvent(S),o.isClosePausedRef.current=!0}},N=()=>{if(o.isClosePausedRef.current){const S=new CustomEvent(Qk);w.dispatchEvent(S),o.isClosePausedRef.current=!1}},C=S=>{!y.contains(S.relatedTarget)&&N()},k=()=>{y.contains(document.activeElement)||N()};return y.addEventListener("focusin",_),y.addEventListener("focusout",C),y.addEventListener("pointermove",_),y.addEventListener("pointerleave",k),window.addEventListener("blur",_),window.addEventListener("focus",N),()=>{y.removeEventListener("focusin",_),y.removeEventListener("focusout",C),y.removeEventListener("pointermove",_),y.removeEventListener("pointerleave",k),window.removeEventListener("blur",_),window.removeEventListener("focus",N)}}},[j,o.isClosePausedRef]);const b=h.useCallback(({tabbingDirection:y})=>{const _=l().map(N=>{const C=N.ref.current,k=[C,...RX(C)];return y==="forwards"?k:k.reverse()});return(y==="forwards"?_.reverse():_).flat()},[l]);return h.useEffect(()=>{const y=m.current;if(y){const w=_=>{var k,S,A;const N=_.altKey||_.ctrlKey||_.metaKey;if(_.key==="Tab"&&!N){const T=document.activeElement,R=_.shiftKey;if(_.target===y&&R){(k=d.current)==null||k.focus();return}const P=b({tabbingDirection:R?"backwards":"forwards"}),I=P.findIndex(z=>z===T);Pj(P.slice(I+1))?_.preventDefault():R?(S=d.current)==null||S.focus():(A=f.current)==null||A.focus()}};return y.addEventListener("keydown",w),()=>y.removeEventListener("keydown",w)}},[l,b]),r.jsxs(cX,{ref:c,role:"region","aria-label":a.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:j?void 0:"none"},children:[j&&r.jsx(Xk,{ref:d,onFocusFromOutsideViewport:()=>{const y=b({tabbingDirection:"forwards"});Pj(y)}}),r.jsx(U5.Slot,{scope:n,children:r.jsx(Mt.ol,{tabIndex:-1,...i,ref:g})}),j&&r.jsx(Xk,{ref:f,onFocusFromOutsideViewport:()=>{const y=b({tabbingDirection:"backwards"});Pj(y)}})]})});Ez.displayName=Cz;var Az="ToastFocusProxy",Xk=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...a}=e,i=wb(Az,n);return r.jsx(F5,{tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const l=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&s()}})});Xk.displayName=Az;var Hp="Toast",jX="toast.swipeStart",_X="toast.swipeMove",NX="toast.swipeCancel",SX="toast.swipeEnd",Tz=h.forwardRef((e,t)=>{const{forceMount:n,open:s,defaultOpen:a,onOpenChange:i,...o}=e,[l,c]=so({prop:s,defaultProp:a??!0,onChange:i,caller:Hp});return r.jsx(Xo,{present:n||l,children:r.jsx(EX,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:ti(e.onPause),onResume:ti(e.onResume),onSwipeStart:Rt(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Rt(e.onSwipeMove,d=>{const{x:f,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Rt(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Rt(e.onSwipeEnd,d=>{const{x:f,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),c(!1)})})})});Tz.displayName=Hp;var[kX,CX]=Sz(Hp,{onClose(){}}),EX=h.forwardRef((e,t)=>
40{const{__scopeToast:n,type:s="foreground",duration:a,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:f,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...j}=e,b=wb(Hp,n),[y,w]=h.useState(null),_=xn(t,z=>w(z)),N=h.useRef(null),C=h.useRef(null),k=a||b.duration,S=h.useRef(0),A=h.useRef(k),T=h.useRef(0),{onToastAdd:R,onToastRemove:B}=b,D=ti(()=>{var L;(y==null?void 0:y.contains(document.activeElement))&&((L=b.viewport)==null||L.focus()),o()}),P=h.useCallback(z=>{!z||z===1/0||(window.clearTimeout(T.current),S.current=new Date().getTime(),T.current=window.setTimeout(D,z))},[D]);h.useEffect(()=>{const z=b.viewport;if(z){const L=()=>{P(A.current),d==null||d()},H=()=>{const W=new Date().getTime()-S.current;A.current=A.current-W,window.clearTimeout(T.current),c==null||c()};return z.addEventListener(Jk,H),z.addEventListener(Qk,L),()=>{z.removeEventListener(Jk,H),z.removeEventListener(Qk,L)}}},[b.viewport,k,c,d,P]),h.useEffect(()=>{i&&!b.isClosePausedRef.current&&P(k)},[i,k,b.isClosePausedRef,P]),h.useEffect(()=>(R(),()=>B()),[R,B]);const I=h.useMemo(()=>y?Lz(y):null,[y]);return b.viewport?r.jsxs(r.Fragment,{children:[I&&r.jsx(AX,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite",children:I}),r.jsx(kX,{scope:n,onClose:D,children:fc.createPortal(r.jsx(U5.ItemSlot,{scope:n,children:r.jsx(lX,{asChild:!0,onEscapeKeyDown:Rt(l,()=>{b.isFocusedToastEscapeKeyDownRef.current||D(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Mt.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":b.swipeDirection,...j,ref:_,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Rt(e.onKeyDown,z=>{z.key==="Escape"&&(l==null||l(z.nativeEvent),z.nativeEvent.defaultPrevented||(b.is
40FocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:Rt(e.onPointerDown,z=>{z.button===0&&(N.current={x:z.clientX,y:z.clientY})}),onPointerMove:Rt(e.onPointerMove,z=>{if(!N.current)return;const L=z.clientX-N.current.x,H=z.clientY-N.current.y,W=!!C.current,V=["left","right"].includes(b.swipeDirection),K=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,M=V?K(0,L):0,G=V?0:K(0,H),q=z.pointerType==="touch"?10:2,F={x:M,y:G},U={originalEvent:z,delta:F};W?(C.current=F,Cx(_X,m,U,{discrete:!1})):fO(F,b.swipeDirection,q)?(C.current=F,Cx(jX,f,U,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(L)>q||Math.abs(H)>q)&&(N.current=null)}),onPointerUp:Rt(e.onPointerUp,z=>{const L=C.current,H=z.target;if(H.hasPointerCapture(z.pointerId)&&H.releasePointerCapture(z.pointerId),C.current=null,N.current=null,L){const W=z.currentTarget,V={originalEvent:z,delta:L};fO(L,b.swipeDirection,b.swipeThreshold)?Cx(SX,x,V,{discrete:!0}):Cx(NX,g,V,{discrete:!0}),W.addEventListener("click",K=>K.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),AX=e=>{const{__scopeToast:t,children:n,...s}=e,a=wb(Hp,t),[i,o]=h.useState(!1),[l,c]=h.useState(!1);return OX(()=>o(!0)),h.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:r.jsx(Vp,{asChild:!0,children:r.jsx(F5,{...s,children:i&&r.jsxs(r.Fragment,{children:[a.label," ",n]})})})},TX="ToastTitle",Pz=h.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Mt.div,{...s,ref:t})});Pz.displayName=TX;var PX="ToastDescription",Oz=h.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Mt.div,{...s,ref:t})});Oz.displayName=PX;var Iz="ToastAction",Rz=h.forwardRef((e,t)=>{const{altText:n,...s}=e;return n.trim()?r.jsx(Dz,{altText:n,asChild:!0,children:r.jsx(q5,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Iz}\`. Expected non-empty \`string\`.`),null)});Rz.displayName=Iz;var Mz="ToastClose",q5=h.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e,a=CX(Mz,n);return r.jsx(Dz,{asChild:!0,children:r.jsx(Mt.button,{type:"button",...s,ref:t,onClick:Rt(e.onClick,a.onClose)})})});q5.displayName=Mz;var Dz=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:s,...a}=e;return r.jsx(Mt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...a,ref:t})});function Lz(e){const t=[];return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),IX(s)){const a=s.ariaHidden||s.hidden||s.style.display==="none",i=s.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const o=s.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...Lz(s))}}),t}function Cx(e,t,n,{discrete:s}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?vz(a,i):a.dispatchEvent(i)}var fO=(e,t,n=0)=>{const s=Math.abs(e.x),a=Math.abs(e.y),i=s>a;return t==="left"||t==="right"?i&&s>n:!i&&a>n};function OX(e=()=>{}){const t=ti(e);xs(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[t])}function IX(e){return e.nodeType===e.ELEMENT_NODE}function RX(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Pj(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var MX=kz,$z=Ez,Bz=Tz,Fz=Pz,zz=Oz,Uz=Rz,qz=q5;function Kz(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Kz(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function wn(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Kz(e))&&(s&&(s+=" "),s+=t);return s}const hO=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,pO=wn,jb=(e,t)=>
vendor: 7,186 bytes, lines 40-130
40n=>{var s;if((t==null?void 0:t.variants)==null)return pO(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const f=n==null?void 0:n[d],m=i==null?void 0:i[d];if(f===null)return null;const g=hO(f)||hO(m);return a[d][g]}),l=n&&Object.entries(n).reduce((d,f)=>{let[m,g]=f;return g===void 0||(d[m]=g),d},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((d,f)=>{let{class:m,className:g,...x}=f;return Object.entries(x).every(j=>{let[b,y]=j;return Array.isArray(y)?y.includes({...i,...l}[b]):{...i,...l}[b]===y})?[...d,m,g]:d},[]);return pO(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};/**
41 * @license lucide-react v0.475.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */const DX=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Vz=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
46 * @license lucide-react v0.475.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */var LX={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"};/**
51 * @license lucide-react v0.475.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const $X=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...l},c)=>h.createElement("svg",{ref:c,...LX,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Vz("lucide",a),...l},[...o.map(([d,f])=>h.createElement(d,f)),...Array.isArray(i)?i:[i]]));/**
56 * @license lucide-react v0.475.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const Re=(e,t)=>{const n=h.forwardRef(({className:s,...a},i)=>h.createElement($X,{ref:i,iconNode:t,className:Vz(`lucide-${DX(e)}`,s),...a}));return n.displayName=`${e}`,n};/**
61 * @license lucide-react v0.475.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const BX=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Hz=Re("Activity",BX);/**
66 * @license lucide-react v0.475.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const FX=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],zX=Re("AlignCenter",FX);/**
71 * @license lucide-react v0.475.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const UX=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],qX=Re("AlignLeft",UX);/**
76 * @license lucide-react v0.475.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const KX=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],VX=Re("AlignRight",KX);/**
81 * @license lucide-react v0.475.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const HX=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Ih=Re("Archive",HX);/**
86 * @license lucide-react v0.475.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const WX=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],GX=Re("ArrowDown",WX);/**
91 * @license lucide-react v0.475.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const YX=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],JX=Re("ArrowLeftRight",YX);/**
96 * @license lucide-react v0.475.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const QX=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],or=Re("ArrowLeft",QX);/**
101 * @license lucide-react v0.475.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const XX=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Rh=Re("ArrowRight",XX);/**
106 * @license lucide-react v0.475.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const ZX=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],eZ=Re("ArrowUp",ZX);/**
111 * @license lucide-react v0.475.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const tZ=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Wz=Re("Bold",tZ);/**
116 * @license lucide-react v0.475.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const nZ=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],ao=Re("BookOpen",nZ);/**
121 * @license lucide-react v0.475.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const rZ=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Vn=Re("Bot",rZ);/**
126 * @license lucide-react v0.475.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const sZ=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}
130],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]],aZ=Re("BrainCircuit",sZ);/**
131 * @license lucide-react v0.475.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const iZ=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],Zk=Re("Brain",iZ);/**
136 * @license lucide-react v0.475.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const oZ=[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]],Mh=Re("Bug",oZ);/**
141 * @license lucide-react v0.475.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const lZ=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Lm=Re("Calendar",lZ);/**
146 * @license lucide-react v0.475.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const cZ=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],dZ=Re("Camera",cZ);/**
151 * @license lucide-react v0.475.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const uZ=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],P0=Re("ChartColumn",uZ);/**
156 * @license lucide-react v0.475.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const mZ=[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]],Wp=Re("ChartNoAxesColumn",mZ);/**
161 * @license lucide-react v0.475.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const fZ=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Tn=Re("Check",fZ);/**
166 * @license lucide-react v0.475.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const hZ=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],gt=Re("ChevronDown",hZ);/**
171 * @license lucide-react v0.475.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const pZ=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ii=Re("ChevronLeft",pZ);/**
176 * @license lucide-react v0.475.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const gZ=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],en=Re("ChevronRight",gZ);/**
181 * @license lucide-react v0.475.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const xZ=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Mn=Re("ChevronUp",xZ);/**
186 * @license lucide-react v0.475.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const yZ=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],bZ=Re("ChevronsUpDown",yZ);/**
191 * @license lucide-react v0.475.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const vZ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],fr=Re("CircleAlert",vZ);/**
196 * @license lucide-react v0.475.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const wZ=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Bd=Re("CircleCheckBig",wZ);/**
201 * @license lucide-react v0.475.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const jZ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],mr=Re("CircleCheck",jZ);/**
206 * @license lucide-react v0.475.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const _Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Gp=Re("CircleMinus",_Z);/**
211 * @license lucide-react v0.475.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const NZ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],am=Re("CirclePause",NZ);/**
216 * @license lucide-react v0.475.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const SZ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]],rc=Re("CirclePlay",SZ);/**
221 * @license lucide-react v0.475.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const kZ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],CZ=Re("CircleStop",kZ);/**
226 * @license lucide-react v0.475.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const EZ=[["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"}]],Gz=Re("CircleUser",EZ);/**
231 * @license lucide-react v0.475.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const AZ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],sc=Re("CircleX",AZ);/**
236 * @license lucide-react v0.475.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const TZ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]],PZ=Re("Clock3",TZ);/**
241 * @license lucide-react v0.475.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const OZ=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],ni=Re("Clock",OZ);/**
246 * @license lucide-react v0.475.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const IZ=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],RZ=Re("CloudDownload",IZ);/**
251 * @license lucide-react v0.475.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const MZ=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],dr=Re("CodeXml",MZ);/**
256 * @license lucide-react v0.475.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const DZ=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],LZ=Re("Code",DZ);/**
261 * @license lucide-react v0.475.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const $Z=[["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"}]],ri=Re("Copy",$Z);/**
266 * @license lucide-react v0.475.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const BZ=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],_n=Re("Database",BZ);/**
271 * @license lucide-react v0.475.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const FZ=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],Yz=Re("Download",FZ);/**
276 * @license lucide-react v0.475.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const zZ=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],UZ=Re("Eraser",zZ);/**
281 * @license lucide-react v0.475.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const qZ=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],yr=Re("ExternalLink",qZ);/**
286 * @license lucide-react v0.475.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const KZ=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],$m=Re("EyeOff",KZ);/**
291 * @license lucide-react v0.475.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const VZ=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ts=Re("Eye",VZ);/**
296 * @license lucide-react v0.475.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const HZ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]],K5=Re("FileChartColumnIncreasing",HZ);/**
301 * @license lucide-react v0.475.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const WZ=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",ke
305y:"1mlx9k"}]],O0=Re("FileCode",WZ);/**
306 * @license lucide-react v0.475.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const GZ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],I0=Re("FileJson",GZ);/**
311 * @license lucide-react v0.475.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const YZ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],JZ=Re("FileSpreadsheet",YZ);/**
316 * @license lucide-react v0.475.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const QZ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ns=Re("FileText",QZ);/**
321 * @license lucide-react v0.475.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const XZ=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],ZZ=Re("File",XZ);/**
326 * @license lucide-react v0.475.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const eee=[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]],Yp=Re("Filter",eee);/**
331 * @license lucide-react v0.475.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const tee=[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]],R0=Re("Flag",tee);/**
336 * @license lucide-react v0.475.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const nee=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],si=Re("FlaskConical",nee);/**
341 * @license lucide-react v0.475.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const ree=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],Jp=Re("FolderInput",ree);/**
346 * @license lucide-react v0.475.0 - ISC
347 *
348 * This source code is licensed under the ISC license.
349 * See the LICENSE file in the root directory of this source tree.
350 */const see=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],aee=Re("FolderOpen",see);/**
351 * @license lucide-react v0.475.0 - ISC
352 *
353 * This source code is licensed under the ISC license.
354 * See the LICENSE file in the root directory of this source tree.
355 */const iee=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],wh=Re("Folder",iee);/**
356 * @license lucide-react v0.475.0 - ISC
357 *
358 * This source code is licensed under the ISC license.
359 * See the LICENSE file in the root directory of this source tree.
360 */const oee=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],_b=Re("GitBranch",oee);/**
361 * @license lucide-react v0.475.0 - ISC
362 *
363 * This source code is licensed under the ISC license.
364 * See the LICENSE file in the root directory of this source tree.
365 */const lee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Na=Re("Globe",lee);
365/**
366 * @license lucide-react v0.475.0 - ISC
367 *
368 * This source code is licensed under the ISC license.
369 * See the LICENSE file in the root directory of this source tree.
370 */const cee=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],dee=Re("GripHorizontal",cee);/**
371 * @license lucide-react v0.475.0 - ISC
372 *
373 * This source code is licensed under the ISC license.
374 * See the LICENSE file in the root directory of this source tree.
375 */const uee=[["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"}]],Jz=Re("GripVertical",uee);/**
376 * @license lucide-react v0.475.0 - ISC
377 *
378 * This source code is licensed under the ISC license.
379 * See the LICENSE file in the root directory of this source tree.
380 */const mee=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ys=Re("Hash",mee);/**
381 * @license lucide-react v0.475.0 - ISC
382 *
383 * This source code is licensed under the ISC license.
384 * See the LICENSE file in the root directory of this source tree.
385 */const fee=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],hee=Re("Heading1",fee);/**
386 * @license lucide-react v0.475.0 - ISC
387 *
388 * This source code is licensed under the ISC license.
389 * See the LICENSE file in the root directory of this source tree.
390 */const pee=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],gee=Re("Heading2",pee);/**
391 * @license lucide-react v0.475.0 - ISC
392 *
393 * This source code is licensed under the ISC license.
394 * See the LICENSE file in the root directory of this source tree.
395 */const xee=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],yee=Re("Heading3",xee);/**
396 * @license lucide-react v0.475.0 - ISC
397 *
398 * This source code is licensed under the ISC license.
399 * See the LICENSE file in the root directory of this source tree.
400 */const bee=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Qz=Re("History",bee);/**
401 * @license lucide-react v0.475.0 - ISC
402 *
403 * This source code is licensed under the ISC license.
404 * See the LICENSE file in the root directory of this source tree.
405 */const vee=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Xz=Re("Image",vee);/**
406 * @license lucide-react v0.475.0 - ISC
407 *
408 * This source code is licensed under the ISC license.
409 * See the LICENSE file in the root directory of this source tree.
410 */const wee=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],_d=Re("Info",wee);/**
411 * @license lucide-react v0.475.0 - ISC
412 *
413 * This source code is licensed under the ISC license.
414 * See the LICENSE file in the root directory of this source tree.
415 */const jee=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],Zz=Re("Italic",jee);/**
416 * @license lucide-react v0.475.0 - ISC
417 *
418 * This source code is licensed under the ISC license.
419 * See the LICENSE file in the root directory of this source tree.
420 */const _ee=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],e2=Re("KeyRound",_ee);
420/**
421 * @license lucide-react v0.475.0 - ISC
422 *
423 * This source code is licensed under the ISC license.
424 * See the LICENSE file in the root directory of this source tree.
425 */const Nee=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],V5=Re("Languages",Nee);/**
426 * @license lucide-react v0.475.0 - ISC
427 *
428 * This source code is licensed under the ISC license.
429 * See the LICENSE file in the root directory of this source tree.
430 */const See=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Sa=Re("Layers",See);/**
431 * @license lucide-react v0.475.0 - ISC
432 *
433 * This source code is licensed under the ISC license.
434 * See the LICENSE file in the root directory of this source tree.
435 */const kee=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],Cee=Re("Library",kee);/**
436 * @license lucide-react v0.475.0 - ISC
437 *
438 * This source code is licensed under the ISC license.
439 * See the LICENSE file in the root directory of this source tree.
440 */const Eee=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Zo=Re("Lightbulb",Eee);/**
441 * @license lucide-react v0.475.0 - ISC
442 *
443 * This source code is licensed under the ISC license.
444 * See the LICENSE file in the root directory of this source tree.
445 */const Aee=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Oj=Re("Link2",Aee);/**
446 * @license lucide-react v0.475.0 - ISC
447 *
448 * This source code is licensed under the ISC license.
449 * See the LICENSE file in the root directory of this source tree.
450 */const Tee=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Qp=Re("Link",Tee);/**
451 * @license lucide-react v0.475.0 - ISC
452 *
453 * This source code is licensed under the ISC license.
454 * See the LICENSE file in the root directory of this source tree.
455 */const Pee=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],el=Re("ListChecks",Pee);/**
456 * @license lucide-react v0.475.0 - ISC
457 *
458 * This source code is licensed under the ISC license.
459 * See the LICENSE file in the root directory of this source tree.
460 */const Oee=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],Iee=Re("ListOrdered",Oee);/**
461 * @license lucide-react v0.475.0 - ISC
462 *
463 * This source code is licensed under the ISC license.
464 * See the LICENSE file in the root directory of this source tree.
465 */const Ree=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],Bm=Re("List",Ree);/**
466 * @license lucide-react v0.475.0 - ISC
467 *
468 * This source code is licensed under the ISC license.
469 * See the LICENSE file in the root directory of this source tree.
470 */const Mee=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Pe=Re("LoaderCircle",Mee);/**
471 * @license lucide-react v0.475.0 - ISC
472 *
473 * This source code is licensed under the ISC license.
474 * See the LICENSE file in the root directory of this source tree.
475 */const Dee=[["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"}]],xd=Re("Lock",Dee);/**
476 * @license lucide-react v0.475.0 - ISC
477 *
478 * This source code is licensed under the ISC license.
479 * See the LICENSE file in the root directory of this source tree.
480 */const Lee=[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",ke
480y:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]],$ee=Re("LogIn",Lee);/**
481 * @license lucide-react v0.475.0 - ISC
482 *
483 * This source code is licensed under the ISC license.
484 * See the LICENSE file in the root directory of this source tree.
485 */const Bee=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]],Dh=Re("Mail",Bee);/**
486 * @license lucide-react v0.475.0 - ISC
487 *
488 * This source code is licensed under the ISC license.
489 * See the LICENSE file in the root directory of this source tree.
490 */const Fee=[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],Nd=Re("Maximize2",Fee);/**
491 * @license lucide-react v0.475.0 - ISC
492 *
493 * This source code is licensed under the ISC license.
494 * See the LICENSE file in the root directory of this source tree.
495 */const zee=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],Uee=Re("Menu",zee);/**
496 * @license lucide-react v0.475.0 - ISC
497 *
498 * This source code is licensed under the ISC license.
499 * See the LICENSE file in the root directory of this source tree.
500 */const qee=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],Br=Re("MessageSquare",qee);/**
501 * @license lucide-react v0.475.0 - ISC
502 *
503 * This source code is licensed under the ISC license.
504 * See the LICENSE file in the root directory of this source tree.
505 */const Kee=[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],Lh=Re("Minimize2",Kee);/**
506 * @license lucide-react v0.475.0 - ISC
507 *
508 * This source code is licensed under the ISC license.
509 * See the LICENSE file in the root directory of this source tree.
510 */const Vee=[["path",{d:"M5 12h14",key:"1ays0h"}]],Hee=Re("Minus",Vee);/**
511 * @license lucide-react v0.475.0 - ISC
512 *
513 * This source code is licensed under the ISC license.
514 * See the LICENSE file in the root directory of this source tree.
515 */const Wee=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Gee=Re("Monitor",Wee);/**
516 * @license lucide-react v0.475.0 - ISC
517 *
518 * This source code is licensed under the ISC license.
519 * See the LICENSE file in the root directory of this source tree.
520 */const Yee=[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]],e7=Re("MoveRight",Yee);/**
521 * @license lucide-react v0.475.0 - ISC
522 *
523 * This source code is licensed under the ISC license.
524 * See the LICENSE file in the root directory of this source tree.
525 */const Jee=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Qee=Re("Music",Jee);/**
526 * @license lucide-react v0.475.0 - ISC
527 *
528 * This source code is licensed under the ISC license.
529 * See the LICENSE file in the root directory of this source tree.
530 */const Xee=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],Zee=Re("Palette",Xee);/**
531 * @license lucide-react v0.475.0 - ISC
532 *
533 * This source code is licensed under the ISC license.
534 * See the LICENSE file in the root directory of this source tree.
535 */const ete=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],t7=Re("PanelLeftClose",ete);/**
536 * @license lucide-react v0.475.0 - ISC
537 *
538 * This source code is licensed under the ISC license.
539 * See the LICENSE file in the root directory of this source tree.
540 */const tte=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],t2=Re("PanelLeftOpen",tte);/**
541 * @license lucide-react v0.475.0 - ISC
542 *
543 * This source code is licensed under the ISC license.
544 * See the LICENSE file in the root directory of this source tree.
545 */const nte=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],n7=Re("PanelRightClose",nte);/**
546 * @license lucide-react v0.475.0 - ISC
547 *
548 * This source code is licensed under the ISC license.
549 * See the LICENSE file in the root directory of this source tree.
550 */const rte=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],n2=Re("PanelRightOpen",rte);/**
551 * @license lucide-react v0.475.0 - ISC
552 *
553 * This source code is licensed under the ISC license.
554 * See the LICENSE file in the root directory of this source tree.
555 */const ste=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],ra=Re("Pencil",ste);/**
556 * @license lucide-react v0.475.0 - ISC
557 *
558 * This source code is licensed under the ISC license.
559 * See the LICENSE file in the root directory of this source tree.
560 */const ate=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Bo=Re("Play",ate);
560/**
561 * @license lucide-react v0.475.0 - ISC
562 *
563 * This source code is licensed under the ISC license.
564 * See the LICENSE file in the root directory of this source tree.
565 */const ite=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],ote=Re("Plug",ite);/**
566 * @license lucide-react v0.475.0 - ISC
567 *
568 * This source code is licensed under the ISC license.
569 * See the LICENSE file in the root directory of this source tree.
570 */const lte=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ln=Re("Plus",lte);/**
571 * @license lucide-react v0.475.0 - ISC
572 *
573 * This source code is licensed under the ISC license.
574 * See the LICENSE file in the root directory of this source tree.
575 */const cte=[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7.5 4.2c-.3-.5-.9-.7-1.3-.4C3.9 5.5 2.3 8.1 2 11c-.1.5.4 1 1 1h5c0-1.5.8-2.8 2-3.4-1.1-1.9-2-3.5-2.5-4.4z",key:"wy49g3"}],["path",{d:"M21 12c.6 0 1-.4 1-1-.3-2.9-1.8-5.5-4.1-7.1-.4-.3-1.1-.2-1.3.3-.6.9-1.5 2.5-2.6 4.3 1.2.7 2 2 2 3.5h5z",key:"vklnvr"}],["path",{d:"M7.5 19.8c-.3.5-.1 1.1.4 1.3 2.6 1.2 5.6 1.2 8.2 0 .5-.2.7-.8.4-1.3-.5-.9-1.4-2.5-2.5-4.3-1.2.7-2.8.7-4 0-1.1 1.8-2 3.4-2.5 4.3z",key:"wkdf1o"}]],Xp=Re("Radiation",cte);/**
576 * @license lucide-react v0.475.0 - ISC
577 *
578 * This source code is licensed under the ISC license.
579 * See the LICENSE file in the root directory of this source tree.
580 */const dte=[["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"}]],Rn=Re("RefreshCw",dte);/**
581 * @license lucide-react v0.475.0 - ISC
582 *
583 * This source code is licensed under the ISC license.
584 * See the LICENSE file in the root directory of this source tree.
585 */const ute=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Dr=Re("RotateCcw",ute);/**
586 * @license lucide-react v0.475.0 - ISC
587 *
588 * This source code is licensed under the ISC license.
589 * See the LICENSE file in the root directory of this source tree.
590 */const mte=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}
590]],Ar=Re("Save",mte);/**
591 * @license lucide-react v0.475.0 - ISC
592 *
593 * This source code is licensed under the ISC license.
594 * See the LICENSE file in the root directory of this source tree.
595 */const fte=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],Nb=Re("Scissors",fte);/**
596 * @license lucide-react v0.475.0 - ISC
597 *
598 * This source code is licensed under the ISC license.
599 * See the LICENSE file in the root directory of this source tree.
600 */const hte=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],ur=Re("Search",hte);/**
601 * @license lucide-react v0.475.0 - ISC
602 *
603 * This source code is licensed under the ISC license.
604 * See the LICENSE file in the root directory of this source tree.
605 */const pte=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Fd=Re("Send",pte);/**
606 * @license lucide-react v0.475.0 - ISC
607 *
608 * This source code is licensed under the ISC license.
609 * See the LICENSE file in the root directory of this source tree.
610 */const gte=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],xte=Re("Server",gte);/**
611 * @license lucide-react v0.475.0 - ISC
612 *
613 * This source code is licensed under the ISC license.
614 * See the LICENSE file in the root directory of this source tree.
615 */const yte=[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],H5=Re("Settings2",yte);/**
616 * @license lucide-react v0.475.0 - ISC
617 *
618 * This source code is licensed under the ISC license.
619 * See the LICENSE file in the root directory of this source tree.
620 */const bte=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Zp=Re("Settings",bte);/**
621 * @license lucide-react v0.475.0 - ISC
622 *
623 * This source code is licensed under the ISC license.
624 * See the LICENSE file in the root directory of this source tree.
625 */const vte=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]],wte=Re("Sheet",vte);/**
626 * @license lucide-react v0.475.0 - ISC
627 *
628 * This source code is licensed under the ISC license.
629 * See the LICENSE file in the root directory of this source tree.
630 */const jte=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],_te=Re("ShieldAlert",jte);/**
631 * @license lucide-react v0.475.0 - ISC
632 *
633 * This source code is licensed under the ISC license.
634 * See the LICENSE file in the root directory of this source tree.
635 */const Nte=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
635y:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],M0=Re("ShieldCheck",Nte);/**
636 * @license lucide-react v0.475.0 - ISC
637 *
638 * This source code is licensed under the ISC license.
639 * See the LICENSE file in the root directory of this source tree.
640 */const Ste=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],$h=Re("ShieldOff",Ste);/**
641 * @license lucide-react v0.475.0 - ISC
642 *
643 * This source code is licensed under the ISC license.
644 * See the LICENSE file in the root directory of this source tree.
645 */const kte=[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]],r7=Re("Signal",kte);/**
646 * @license lucide-react v0.475.0 - ISC
647 *
648 * This source code is licensed under the ISC license.
649 * See the LICENSE file in the root directory of this source tree.
650 */const Cte=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],s7=Re("SlidersHorizontal",Cte);/**
651 * @license lucide-react v0.475.0 - ISC
652 *
653 * This source code is licensed under the ISC license.
654 * See the LICENSE file in the root directory of this source tree.
655 */const Ete=[["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"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],Yn=Re("Sparkles",Ete);/**
656 * @license lucide-react v0.475.0 - ISC
657 *
658 * This source code is licensed under the ISC license.
659 * See the LICENSE file in the root directory of this source tree.
660 */const Ate=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],D0=Re("SquareCheckBig",Ate);/**
661 * @license lucide-react v0.475.0 - ISC
662 *
663 * This source code is licensed under the ISC license.
664 * See the LICENSE file in the root directory of this source tree.
665 */const Tte=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],L0=Re("Square",Tte);/**
666 * @license lucide-react v0.475.0 - ISC
667 *
668 * This source code is licensed under the ISC license.
669 * See the LICENSE file in the root directory of this source tree.
670 */const Pte=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Xi=Re("Star",Pte);/**
671 * @license lucide-react v0.475.0 - ISC
672 *
673 * This source code is licensed under the ISC license.
674 * See the LICENSE file in the root directory of this source tree.
675 */const Ote=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ac=Re("Tag",Ote);/**
676 * @license lucide-react v0.475.0 - ISC
677 *
678 * This source code is licensed under the ISC license.
679 * See the LICENSE file in the root directory of this source tree.
680 */const Ite=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],r2=Re("Target",Ite);
680/**
681 * @license lucide-react v0.475.0 - ISC
682 *
683 * This source code is licensed under the ISC license.
684 * See the LICENSE file in the root directory of this source tree.
685 */const Rte=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],W5=Re("Terminal",Rte);/**
686 * @license lucide-react v0.475.0 - ISC
687 *
688 * This source code is licensed under the ISC license.
689 * See the LICENSE file in the root directory of this source tree.
690 */const Mte=[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]],Fm=Re("TestTubeDiagonal",Mte);/**
691 * @license lucide-react v0.475.0 - ISC
692 *
693 * This source code is licensed under the ISC license.
694 * See the LICENSE file in the root directory of this source tree.
695 */const Dte=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],Lte=Re("Thermometer",Dte);/**
696 * @license lucide-react v0.475.0 - ISC
697 *
698 * This source code is licensed under the ISC license.
699 * See the LICENSE file in the root directory of this source tree.
700 */const $te=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],hc=Re("ThumbsDown",$te);/**
701 * @license lucide-react v0.475.0 - ISC
702 *
703 * This source code is licensed under the ISC license.
704 * See the LICENSE file in the root directory of this source tree.
705 */const Bte=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],qo=Re("ThumbsUp",Bte);/**
706 * @license lucide-react v0.475.0 - ISC
707 *
708 * This source code is licensed under the ISC license.
709 * See the LICENSE file in the root directory of this source tree.
710 */const Fte=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]],a7=Re("ToggleLeft",Fte);/**
711 * @license lucide-react v0.475.0 - ISC
712 *
713 * This source code is licensed under the ISC license.
714 * See the LICENSE file in the root directory of this source tree.
715 */const zte=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]],i7=Re("ToggleRight",zte);/**
716 * @license lucide-react v0.475.0 - ISC
717 *
718 * This source code is licensed under the ISC license.
719 * See the LICENSE file in the root directory of this source tree.
720 */const Ute=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],un=Re("Trash2",Ute);/**
721 * @license lucide-react v0.475.0 - ISC
722 *
723 * This source code is licensed under the ISC license.
724 * See the LICENSE file in the root directory of this source tree.
725 */const qte=[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]],o7=Re("TrendingUp",qte);/**
726 * @license lucide-react v0.475.0 - ISC
727 *
728 * This source code is licensed under the ISC license.
729 * See the LICENSE file in the root directory of this source tree.
730 */const Kte=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Nr=Re("TriangleAlert",Kte);/**
731 * @license lucide-react v0.475.0 - ISC
732 *
733 * This source code is licensed under the ISC license.
734 * See the LICENSE file in the root directory of this source tree.
735 */const Vte=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],Hte=Re("Underline",Vte);/**
736 * @license lucide-react v0.475.0 - ISC
737 *
738 * This source code is licensed under the ISC license.
739 * See the LICENSE file in the root directory of this source tree.
740 */const Wte=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],G5=Re("Upload",Wte);/**
741 * @license lucide-react v0.475.0 - ISC
742 *
743 * This source code is licensed under the ISC license.
744 * See the LICENSE file in the root directory of this source tree.
745 */const Gte=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Yte=Re("UserPlus",Gte);/**
746 * @license lucide-react v0.475.0 - ISC
747 *
748 * This source code is licensed under the ISC license.
749 * See the LICENSE file in the root directory of this source tree.
750 */const Jte=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ci=Re("User",Jte);/**
751 * @license lucide-react v0.475.0 - ISC
752 *
753 * This source code is licensed under the ISC license.
754 * See the LICENSE file in the root directory of this source tree.
755 */const Qte=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],eg=Re("Users",Qte);/**
756 * @license lucide-react v0.475.0 - ISC
757 *
758 * This source code is licensed under the ISC license.
759 * See the LICENSE file in the root directory of this source tree.
760 */const Xte=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],$0=Re("Video",Xte);/**
761 * @license lucide-react v0.475.0 - ISC
762 *
763 * This source code is licensed under the ISC license.
764 * See the LICENSE file in the root directory of this source tree.
765 */const Zte=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],yd=Re("WandSparkles",Zte);/**
766 * @license lucide-react v0.475.0 - ISC
767 *
768 * This source code is licensed under the ISC license.
769 * See the LICENSE file in the root directory of this source tree.
770 */const ene=[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]],tne=Re("Waves",ene);/**
771 * @license lucide-react v0.475.0 - ISC
772 *
773 * This source code is licensed under the ISC license.
774 * See the LICENSE file in the root directory of this source tree.
775 */const nne=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}
vendor: 4,167 bytes, lines 775-790
775],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],l7=Re("WifiOff",nne);/**
776 * @license lucide-react v0.475.0 - ISC
777 *
778 * This source code is licensed under the ISC license.
779 * See the LICENSE file in the root directory of this source tree.
780 */const rne=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],c7=Re("Wifi",rne);/**
781 * @license lucide-react v0.475.0 - ISC
782 *
783 * This source code is licensed under the ISC license.
784 * See the LICENSE file in the root directory of this source tree.
785 */const sne=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jt=Re("X",sne);/**
786 * @license lucide-react v0.475.0 - ISC
787 *
788 * This source code is licensed under the ISC license.
789 * See the LICENSE file in the root directory of this source tree.
790 */const ane=[["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"}]],zn=Re("Zap",ane),ine=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},one=(e,t)=>({classGroupId:e,validator:t}),d7=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),B0="-",gO=[],lne="arbitrary..",cne=e=>{const t=une(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return dne(o);const l=o.split(B0),c=l[0]===""&&l.length>1?1:0;return u7(l,c,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=s[o],d=n[o];return c?d?ine(d,c):c:d||gO}return n[o]||gO}}},u7=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],i=n.nextPart.get(a);if(i){const d=u7(e,t+1,i);if(d)return d}const o=n.validators;if(o===null)return;const l=t===0?e.join(B0):e.slice(t).join(B0),c=o.length;for(let d=0;d<c;d++){const f=o[d];if(f.validator(l))return f.classGroupId}},dne=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?lne+s:void 0})(),une=e=>{const{theme:t,classGroups:n}=e;return mne(n,t)},mne=(e,t)=>{const n=d7();for(const s in e){const a=e[s];Y5(a,n,s,t)}return n},Y5=(e,t,n,s)=>{const a=e.length;for(let i=0;i<a;i++){const o=e[i];fne(o,t,n,s)}},fne=(e,t,n,s)=>{if(typeof e=="string"){hne(e,t,n);return}if(typeof e=="function"){pne(e,t,n,s);return}gne(e,t,n,s)},hne=(e,t,n)=>{const s=e===""?t:m7(t,e);s.classGroupId=n},pne=(e,t,n,s)=>{if(xne(e)){Y5(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(one(n,e))},gne=(e,t,n,s)=>{const a=Object.entries(e),i=a.length;for(let o=0;o<i;o++){const[l,c]=a[o];Y5(c,m7(t,l),n,s)}},m7=(e,t)=>{let n=e;const s=t.split(B0),a=s.length;for(let i=0;i<a;i++){const o=s[i];let l=n.nextPart.get(o);l||(l=d7(),n.nextPart.set(o,l)),n=l}return n},xne=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,yne=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const a=(i,o)=>{n[i]=o,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=s[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},s2="!",xO=":",bne=[],yO=(e,t,n,s,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:a}),vne=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=a=>{const i=[];let o=0,l=0,c=0,d;const f=a.length;for(let b=0;b<f;b++){const y=a[b];if(o===0&&l===0){if(y===xO){i.push(a.slice(c,b)),c=b+1;continue}if(y==="/"){d=b;continue}}y==="["?o++:y==="]"?o--:y==="("?l++:y===")"&&l--}const m=i.length===0?a:a.slice(c);let g=m,x=!1;m.endsWith(s2)?(g=m.slice(0,-1),x=!0):m.startsWith(s2)&&(g=m.slice(1),x=!0);const j=d&&d>c?d-c:void 0;return yO(i,x,g,j)};if(t){const a=t+xO,i=s;s=o=>o.startsWith(a)?i(o.slice(a.length)):yO(bne,!1,o,void 0,!0)}if(n){const a=s;s=i=>n({className:i,parseClassName:a})}return s},wne=e=>{const t=new Map;
vendor: 5,498 bytes, line 790
790return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let a=[];for(let i=0;i<n.length;i++){const o=n[i],l=o[0]==="[",c=t.has(o);l||c?(a.length>0&&(a.sort(),s.push(...a),a=[]),s.push(o)):a.push(o)}return a.length>0&&(a.sort(),s.push(...a)),s}},jne=e=>({cache:yne(e.cacheSize),parseClassName:vne(e),sortModifiers:wne(e),...cne(e)}),_ne=/\s+/,Nne=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(_ne);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:b}=n(f);if(m){c=f+(c.length>0?" "+c:c);continue}let y=!!b,w=s(y?j.substring(0,b):j);if(!w){if(!y){c=f+(c.length>0?" "+c:c);continue}if(w=s(j),!w){c=f+(c.length>0?" "+c:c);continue}y=!1}const _=g.length===0?"":g.length===1?g[0]:i(g).join(":"),N=x?_+s2:_,C=N+w;if(o.indexOf(C)>-1)continue;o.push(C);const k=a(w,y);for(let S=0;S<k.length;++S){const A=k[S];o.push(N+A)}c=f+(c.length>0?" "+c:c)}return c},Sne=(...e)=>{let t=0,n,s,a="";for(;t<e.length;)(n=e[t++])&&(s=f7(n))&&(a&&(a+=" "),a+=s);return a},f7=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=f7(e[s]))&&(n&&(n+=" "),n+=t);return n},kne=(e,...t)=>{let n,s,a,i;const o=c=>{const d=t.reduce((f,m)=>m(f),e());return n=jne(d),s=n.cache.get,a=n.cache.set,i=l,l(c)},l=c=>{const d=s(c);if(d)return d;const f=Nne(c,n);return a(c,f),f};return i=o,(...c)=>i(Sne(...c))},Cne=[],Kr=e=>{const t=n=>n[e]||Cne;return t.isThemeGetter=!0,t},h7=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,p7=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ene=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ane=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Tne=/\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$/,Pne=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,One=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ine=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sl=e=>Ene.test(e),cn=e=>!!e&&!Number.isNaN(Number(e)),kl=e=>!!e&&Number.isInteger(Number(e)),Ij=e=>e.endsWith("%")&&cn(e.slice(0,-1)),Co=e=>Ane.test(e),g7=()=>!0,Rne=e=>Tne.test(e)&&!Pne.test(e),J5=()=>!1,Mne=e=>One.test(e),Dne=e=>Ine.test(e),Lne=e=>!Ct(e)&&!At(e),$ne=e=>pc(e,b7,J5),Ct=e=>h7.test(e),Uc=e=>pc(e,v7,Rne),bO=e=>pc(e,Hne,cn),Bne=e=>pc(e,j7,g7),Fne=e=>pc(e,w7,J5),vO=e=>pc(e,x7,J5),zne=e=>pc(e,y7,Dne),Ex=e=>pc(e,_7,Mne),At=e=>p7.test(e),Ff=e=>zd(e,v7),Une=e=>zd(e,w7),wO=e=>zd(e,x7),qne=e=>zd(e,b7),Kne=e=>zd(e,y7),Ax=e=>zd(e,_7,!0),Vne=e=>zd(e,j7,!0),pc=(e,t,n)=>{const s=h7.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},zd=(e,t,n=!1)=>{const s=p7.exec(e);return s?s[1]?t(s[1]):n:!1},x7=e=>e==="position"||e==="percentage",y7=e=>e==="image"||e==="url",b7=e=>e==="length"||e==="size"||e==="bg-size",v7=e=>e==="length",Hne=e=>e==="number",w7=e=>e==="family-name",j7=e=>e==="number"||e==="weight",_7=e=>e==="shadow",Wne=()=>{const e=Kr("color"),t=Kr("font"),n=Kr("text"),s=Kr("font-weight"),a=Kr("tracking"),i=Kr("leading"),o=Kr("breakpoint"),l=Kr("container"),c=Kr("spacing"),d=Kr("radius"),f=Kr("shadow"),m=Kr("inset-shadow"),g=Kr("text-shadow"),x=Kr("drop-shadow"),j=Kr("blur"),b=Kr("perspective"),y=Kr("aspect"),w=Kr("ease"),_=Kr("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...C(),At,Ct],S=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],T=()=>[At,Ct,c],R=()=>[Sl,"full","auto",...T()],B=()=>[kl,"none","subgrid",At,Ct],D=()=>["auto",{span:["full",kl,At,Ct]},kl,At,Ct],P=()=>[kl,"auto",At,Ct],I=()=>["auto","min","max","fr",At,Ct],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...T()],W=()=>[Sl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],V=()=>[Sl,"screen","full","dvw","lvw","svw","min","max","fit",...T()],K=()=>[Sl,"screen","full","lh","dvh","lvh","svh","min","max","fit",...T()],M=()=>[e,At,Ct],G=()=>[...C(),wO,vO,{position:[At,Ct]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",qne,$ne,{size:[At,Ct]}],U=()=>[Ij,Ff,Uc],ee=()=>["","none","full",d,At,Ct],ne=()=>["",cn,Ff,Uc],X=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>[cn,Ij,wO,vO],ce=()=>["","none",j,At,Ct],le=()=>["none",cn,At,Ct],re=()=>["none",cn,At,Ct],Ue=()=>[cn,At,Ct],Ne=()=>[Sl,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Co],breakpoint:[Co],color:[g7],container:[Co],"drop-shadow":[Co],ease:["in","out","in-out"],font:[Lne],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Co],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Co],shadow:[Co],spacing:["px",cn],text:[Co],"text-shadow":[Co],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Sl,Ct,At,y]}
vendor: 6,096 bytes, line 790
790],container:["container"],columns:[{columns:[cn,Ct,At,l]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{"inset-s":R(),start:R()}],end:[{"inset-e":R(),end:R()}],"inset-bs":[{"inset-bs":R()}],"inset-be":[{"inset-be":R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[kl,"auto",At,Ct]}],basis:[{basis:[Sl,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[cn,Sl,"auto","initial","none",Ct]}],grow:[{grow:["",cn,At,Ct]}],shrink:[{shrink:["",cn,At,Ct]}],order:[{order:[kl,"first","last","none",At,Ct]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mbs:[{mbs:H()}],mbe:[{mbe:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...K()]}],"min-block-size":[{"min-block":["auto",...K()]}],"max-block-size":[{"max-block":["none",...K()]}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Ff,Uc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,Vne,Bne]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ij,Ct]}],"font-family":[{font:[Une,Fne,t]}],"font-features":[{"font-features":[Ct]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,At,Ct]}],"line-clamp":[{"line-clamp":[cn,"none",At,bO]}],leading:[{leading:[i,...T()]}],"list-image":[{"list-image":["none",At,Ct]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",At,Ct]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[cn,"from-font","auto",At,Uc]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[cn,"auto",At,Ct]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",At,Ct]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",At,Ct]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},kl,At,Ct],radial:["",At,Ct],conic:[kl,At,Ct]},Kne,zne]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:U()}
790],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}
vendor: 5,736 bytes, line 790
790],"divide-color":[{divide:M()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[cn,At,Ct]}],"outline-w":[{outline:["",cn,Ff,Uc]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",f,Ax,Ex]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",m,Ax,Ex]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[cn,Uc]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",g,Ax,Ex]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[cn,At,Ct]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[cn]}],"mask-image-linear-from-pos":[{"mask-linear-from":Z()}],"mask-image-linear-to-pos":[{"mask-linear-to":Z()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":Z()}],"mask-image-t-to-pos":[{"mask-t-to":Z()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":Z()}],"mask-image-r-to-pos":[{"mask-r-to":Z()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":Z()}],"mask-image-b-to-pos":[{"mask-b-to":Z()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":Z()}],"mask-image-l-to-pos":[{"mask-l-to":Z()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":Z()}],"mask-image-x-to-pos":[{"mask-x-to":Z()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":Z()}],"mask-image-y-to-pos":[{"mask-y-to":Z()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[At,Ct]}],"mask-image-radial-from-pos":[{"mask-radial-from":Z()}],"mask-image-radial-to-pos":[{"mask-radial-to":Z()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[cn]}],"mask-image-conic-from-pos":[{"mask-conic-from":Z()}],"mask-image-conic-to-pos":[{"mask-conic-to":Z()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",At,Ct]}],filter:[{filter:["","none",At,Ct]}],blur:[{blur:ce()}],brightness:[{brightness:[cn,At,Ct]}],contrast:[{contrast:[cn,At,Ct]}],"drop-shadow":[{"drop-shadow":["","none",x,Ax,Ex]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",cn,At,Ct]}],"hue-rotate":[{"hue-rotate":[cn,At,Ct]}],invert:[{invert:["",cn,At,Ct]}],saturate:[{saturate:[cn,At,Ct]}],sepia:[{sepia:["",cn,At,Ct]}],"backdrop-filter":[{"backdrop-filter":["","none",At,Ct]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[cn,At,Ct]}],"backdrop-contrast":[{"backdrop-contrast":[cn,At,Ct]}],"backdrop-grayscale":[{"backdrop-grayscale":["",cn,At,Ct]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[cn,At,Ct]}],"backdrop-invert":[{"backdrop-invert":["",cn,At,Ct]}],"backdrop-opacity":[{"backdrop-opacity":[cn,At,Ct]}],"backdrop-saturate":[{"backdrop-saturate":[cn,At,Ct]}],"backdrop-sepia":[{"backdrop-sepia":["",cn,At,Ct]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",At,Ct]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[cn,"initial",At,Ct]}],ease:[{ease:["linear","initial",w,At,Ct]}],delay:[{delay:[cn,At,Ct]}],animate:[{animate:["none",_,At,Ct]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,At,Ct]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:Ue()}],"skew-x":[{"skew-x":Ue()}],"skew-y":[{"skew-y":Ue()}],transform:[{transform:[At,Ct,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ne()}],"translate-x":[{"translate-x":Ne()}],"translate-y":[{"translate-y":Ne()}],"translate-z":[{"translate-z":Ne()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}
vendor: 4,997 bytes, line 790
790],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",At,Ct]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",At,Ct]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[cn,Ff,Uc,bO]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","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-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Gne=kne(Wne);function rn(...e){return Gne(wn(e))}const Yne=MX,N7=h.forwardRef(({className:e,...t},n)=>r.jsx($z,{ref:n,className:rn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));
790N7.displayName=$z.displayName;const Jne=jb("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),S7=h.forwardRef(({className:e,variant:t,...n},s)=>r.jsx(Bz,{ref:s,className:rn(Jne({variant:t}),e),...n}));S7.displayName=Bz.displayName;const Qne=h.forwardRef(({className:e,...t},n)=>r.jsx(Uz,{ref:n,className:rn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));Qne.displayName=Uz.displayName;const k7=h.forwardRef(({className:e,...t},n)=>r.jsx(qz,{ref:n,className:rn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsx(jt,{className:"h-4 w-4"})}));k7.displayName=qz.displayName;const C7=h.forwardRef(({className:e,...t},n)=>r.jsx(Fz,{ref:n,className:rn("text-sm font-semibold",e),...t}));C7.displayName=Fz.displayName;const E7=h.forwardRef(({className:e,...t},n)=>r.jsx(zz,{ref:n,className:rn("text-sm opacity-90",e),...t}));E7.displayName=zz.displayName;function Xne(){const{toasts:e}=bb();return r.jsxs(Yne,{children:[e.map(function({id:t,title:n,description:s,action:a,...i}){return r.jsxs(S7,{...i,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(C7,{children:n}),s&&r.jsx(E7,{children:s})]}),a,r.jsx(k7,{})]},t)}),r.jsx(N7,{})]})}var tg=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Zne={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Rl,B5,iz,ere=(iz=class{constructor(){Vt(this,Rl,Zne);Vt(this,B5,!1)}setTimeoutProvider(e){vt(this,Rl,e)}setTimeout(e,t){return ge(this,Rl).setTimeout(e,t)}clearTimeout(e){ge(this,Rl).clearTimeout(e)}setInterval(e,t){return ge(this,Rl).setInterval(e,t)}clearInterval(e){ge(this,Rl).clearInterval(e)}},Rl=new WeakMap,B5=new WeakMap,iz),td=new ere;function tre(e){setTimeout(e,0)}var Sd=typeof window>"u"||"Deno"in globalThis;function Zs(){}function nre(e,t){return typeof e=="function"?e(t):e}function a2(e){return typeof e=="number"&&e>=0&&e!==1/0}function A7(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Gl(e,t){return typeof e=="function"?e(t):e}function Ka(e,t){return typeof e=="function"?e(t):e}function jO(e,t){const{type:n="all",exact:s,fetchStatus:a,predicate:i,queryKey:o,stale:l}=e;if(o){if(s){if(t.queryHash!==Q5(o,t.options))return!1}else if(!Fh(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||i&&!i(t))}function _O(e,t){const{exact:n,status:s,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Bh(t.options.mutationKey)!==Bh(i))return!1}else if(!Fh(t.options.mutationKey,i))return!1}return!(s&&t.state.status!==s||a&&!a(t))}function Q5(e,t){return((t==null?void 0:t.queryKeyHashFn)||Bh)(e)}function Bh(e){return JSON.stringify(e,(t,n)=>o2(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function Fh(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Fh(e[n],t[n])):!1}var rre=Object.prototype.hasOwnProperty;function T7(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=NO(e)&&NO(t);if(!s&&!(o2(e)&&o2(t)))return t;const i=(s?e:Object.keys(e)).length,o=s?t:Object.keys(t),l=o.length,c=s?new Array(l):{};let d=0;for(let f=0;f<l;f++){const m=s?f:o[f],g=e[m],x=t[m];if(g===x){c[m]=g,(s?f<i:rre.call(e,m))&&d++;continue}if(g===null||x===null||typeof g!="object"||typeof x!="object"){c[m]=x;continue}const j=T7(g,x,n+1);c[m]=j,j===g&&d++}return i===l&&d===i?e:c}function i2(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function NO(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function o2(e){if(!SO(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!SO(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function SO(e){return Object.prototype.toString.call(e)==="[object Object]"}function sre(e){return new Promise(t=>{td.setTimeout(t,e)})}function l2(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?T7(e,t):t}function are(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function ire(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var X5=Symbol();function P7(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===X5?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function O7(e,t){return typeof e=="function"?e(...t):!!e}function ore(e,t,n){let s=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),s||(s=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),e}var ld,Ml,Wu,oz,lre=(oz=class extends tg{constructor(){super();Vt(this,ld);Vt(this,Ml);Vt(this,Wu);vt(this,Wu,t=>{if(!Sd&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,Ml)||this.setEventListener(ge(this,Wu))}onUnsubscribe(){var t;this.hasListeners()||((t=ge(this,Ml))==null||t.call(this),vt(this,Ml,void 0))}setEventListener(t){var n;vt(this,Wu,t),(n=ge(this,Ml))==null||n.call(this),vt(this,Ml,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){ge(this,ld)!==t&&(vt(this,ld,t),this.onFocus())}onFocus(){const t=this.isFocused();
vendor: 4,638 bytes, line 790
790this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof ge(this,ld)=="boolean"?ge(this,ld):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ld=new WeakMap,Ml=new WeakMap,Wu=new WeakMap,oz),Z5=new lre;function c2(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function s(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{s({status:"fulfilled",value:a}),e(a)},n.reject=a=>{s({status:"rejected",reason:a}),t(a)},n}var cre=tre;function dre(){let e=[],t=0,n=l=>{l()},s=l=>{l()},a=cre;const i=l=>{t?e.push(l):a(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&a(()=>{s(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{s=l},setScheduler:l=>{a=l}}}var ms=dre(),Gu,Dl,Yu,lz,ure=(lz=class extends tg{constructor(){super();Vt(this,Gu,!0);Vt(this,Dl);Vt(this,Yu);vt(this,Yu,t=>{if(!Sd&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){ge(this,Dl)||this.setEventListener(ge(this,Yu))}onUnsubscribe(){var t;this.hasListeners()||((t=ge(this,Dl))==null||t.call(this),vt(this,Dl,void 0))}setEventListener(t){var n;vt(this,Yu,t),(n=ge(this,Dl))==null||n.call(this),vt(this,Dl,t(this.setOnline.bind(this)))}setOnline(t){ge(this,Gu)!==t&&(vt(this,Gu,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return ge(this,Gu)}},Gu=new WeakMap,Dl=new WeakMap,Yu=new WeakMap,lz),F0=new ure;function mre(e){return Math.min(1e3*2**e,3e4)}function I7(e){return(e??"online")==="online"?F0.isOnline():!0}var d2=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function R7(e){let t=!1,n=0,s;const a=c2(),i=()=>a.status!=="pending",o=b=>{var y;if(!i()){const w=new d2(b);g(w),(y=e.onCancel)==null||y.call(e,w)}},l=()=>{t=!0},c=()=>{t=!1},d=()=>Z5.isFocused()&&(e.networkMode==="always"||F0.isOnline())&&e.canRun(),f=()=>I7(e.networkMode)&&e.canRun(),m=b=>{i()||(s==null||s(),a.resolve(b))},g=b=>{i()||(s==null||s(),a.reject(b))},x=()=>new Promise(b=>{var y;s=w=>{(i()||d())&&b(w)},(y=e.onPause)==null||y.call(e)}).then(()=>{var b;s=void 0,i()||(b=e.onContinue)==null||b.call(e)}),j=()=>{if(i())return;let b;const y=n===0?e.initialPromise:void 0;try{b=y??e.fn()}catch(w){b=Promise.reject(w)}Promise.resolve(b).then(m).catch(w=>{var S;if(i())return;const _=e.retry??(Sd?0:3),N=e.retryDelay??mre,C=typeof N=="function"?N(n,w):N,k=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,w);if(t||!k){g(w);return}n++,(S=e.onFail)==null||S.call(e,n,w),sre(C).then(()=>d()?void 0:x()).then(()=>{t?g(w):j()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:f,start:()=>(f()?j():x().then(j),a)}}var cd,cz,M7=(cz=class{constructor(){Vt(this,cd)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),a2(this.gcTime)&&vt(this,cd,td.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Sd?1/0:300*1e3))}clearGcTimeout(){ge(this,cd)&&(td.clearTimeout(ge(this,cd)),vt(this,cd,void 0))}},cd=new WeakMap,cz),dd,Ju,qa,ud,Zr,Bp,md,yi,Oo,dz,fre=(dz=class extends M7{constructor(t){super();Vt(this,yi);Vt(this,dd);Vt(this,Ju);Vt(this,qa);Vt(this,ud);Vt(this,Zr);Vt(this,Bp);Vt(this,md);vt(this,md,!1),vt(this,Bp,t.defaultOptions),this.setOptions(t.options),this.observers=[],vt(this,ud,t.client),vt(this,qa,ge(this,ud).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,vt(this,dd,CO(this.options)),this.state=t.state??ge(this,dd),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=ge(this,Zr))==null?void 0:t.promise}setOptions(t){if(this.options={...ge(this,Bp),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=CO(this.options);n.data!==void 0&&(this.setState(kO(n.data,n.dataUpdatedAt)),vt(this,dd,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,qa).remove(this)}setData(t,n){const s=l2(this.state.data,t,this.options);return yn(this,yi,Oo).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){yn(this,yi,Oo).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,a;const n=(s=ge(this,Zr))==null?void 0:s.promise;
790return(a=ge(this,Zr))==null||a.cancel(t),n?n.then(Zs).catch(Zs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ge(this,dd))}isActive(){return this.observers.some(t=>Ka(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===X5||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Gl(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!A7(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=ge(this,Zr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=ge(this,Zr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),ge(this,qa).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(ge(this,Zr)&&(ge(this,md)?ge(this,Zr).cancel({revert:!0}):ge(this,Zr).cancelRetry()),this.scheduleGc()),ge(this,qa).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||yn(this,yi,Oo).call(this,{type:"invalidate"})}async fetch(t,n){var c,d,f,m,g,x,j,b,y,w,_,N;if(this.state.fetchStatus!=="idle"&&((c=ge(this,Zr))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,Zr))return ge(this,Zr).continueRetry(),ge(this,Zr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(k=>k.options.queryFn);C&&this.setOptions(C.options)}const s=new AbortController,a=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(vt(this,md,!0),s.signal)})},i=()=>{const C=P7(this.options,n),S=(()=>{const A={client:ge(this,ud),queryKey:this.queryKey,meta:this.meta};return a(A),A})();return vt(this,md,!1),this.options.persister?this.options.persister(C,S,this):C(S)},l=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,ud),state:this.state,fetchFn:i};return a(C),C})();(d=this.options.behavior)==null||d.onFetch(l,this),vt(this,Ju,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=l.fetchOptions)==null?void 0:f.meta))&&yn(this,yi,Oo).call(this,{type:"fetch",meta:(m=l.fetchOptions)==null?void 0:m.meta}),vt(this,Zr,R7({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:C=>{C instanceof d2&&C.revert&&this.setState({...ge(this,Ju),fetchStatus:"idle"}),s.abort()},onFail:(C,k)=>{yn(this,yi,Oo).call(this,{type:"failed",failureCount:C,error:k})},onPause:()=>{yn(this,yi,Oo).call(this,{type:"pause"})},onContinue:()=>{yn(this,yi,Oo).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const C=await ge(this,Zr).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(x=(g=ge(this,qa).config).onSuccess)==null||x.call(g,C,this),(b=(j=ge(this,qa).config).onSettled)==null||b.call(j,C,this.state.error,this),C}catch(C){if(C instanceof d2){if(C.silent)return ge(this,Zr).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw yn(this,yi,Oo).call(this,{type:"error",error:C}),(w=(y=ge(this,qa).config).onError)==null||w.call(y,C,this),(N=(_=ge(this,qa).config).onSettled)==null||N.call(_,this.state.data,C,this),C}finally{this.scheduleGc()}}},dd=new WeakMap,Ju=new WeakMap,qa=new WeakMap,ud=new WeakMap,Zr=new WeakMap,Bp=new WeakMap,md=new WeakMap,yi=new WeakSet,Oo=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...D7(s.data,this.options),fetchMeta:t.meta??null};case"success":const a={...s,...kO(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return vt(this,Ju,t.manual?a:void 0),a;case"error":const i=t.error;
vendor: 9,621 bytes, line 790
790return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),ms.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),ge(this,qa).notify({query:this,type:"updated",action:t})})},dz);function D7(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:I7(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function kO(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function CO(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Xs,bn,Fp,$s,fd,Qu,Ro,Ll,zp,Xu,Zu,hd,pd,$l,em,Fn,mh,u2,m2,f2,h2,p2,g2,x2,L7,uz,hre=(uz=class extends tg{constructor(t,n){super();Vt(this,Fn);Vt(this,Xs);Vt(this,bn);Vt(this,Fp);Vt(this,$s);Vt(this,fd);Vt(this,Qu);Vt(this,Ro);Vt(this,Ll);Vt(this,zp);Vt(this,Xu);Vt(this,Zu);Vt(this,hd);Vt(this,pd);Vt(this,$l);Vt(this,em,new Set);this.options=n,vt(this,Xs,t),vt(this,Ll,null),vt(this,Ro,c2()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,bn).addObserver(this),EO(ge(this,bn),this.options)?yn(this,Fn,mh).call(this):this.updateResult(),yn(this,Fn,h2).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return y2(ge(this,bn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return y2(ge(this,bn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,yn(this,Fn,p2).call(this),yn(this,Fn,g2).call(this),ge(this,bn).removeObserver(this)}setOptions(t){const n=this.options,s=ge(this,bn);if(this.options=ge(this,Xs).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ka(this.options.enabled,ge(this,bn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");yn(this,Fn,x2).call(this),ge(this,bn).setOptions(this.options),n._defaulted&&!i2(this.options,n)&&ge(this,Xs).getQueryCache().notify({type:"observerOptionsUpdated",query:ge(this,bn),observer:this});const a=this.hasListeners();a&&AO(ge(this,bn),s,this.options,n)&&yn(this,Fn,mh).call(this),this.updateResult(),a&&(ge(this,bn)!==s||Ka(this.options.enabled,ge(this,bn))!==Ka(n.enabled,ge(this,bn))||Gl(this.options.staleTime,ge(this,bn))!==Gl(n.staleTime,ge(this,bn)))&&yn(this,Fn,u2).call(this);const i=yn(this,Fn,m2).call(this);a&&(ge(this,bn)!==s||Ka(this.options.enabled,ge(this,bn))!==Ka(n.enabled,ge(this,bn))||i!==ge(this,$l))&&yn(this,Fn,f2).call(this,i)}getOptimisticResult(t){const n=ge(this,Xs).getQueryCache().build(ge(this,Xs),t),s=this.createResult(n,t);return gre(this,s)&&(vt(this,$s,s),vt(this,Qu,this.options),vt(this,fd,ge(this,bn).state)),s}getCurrentResult(){return ge(this,$s)}trackResult(t,n){return new Proxy(t,{get:(s,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&ge(this,Ro).status==="pending"&&ge(this,Ro).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,a))})}trackProp(t){ge(this,em).add(t)}getCurrentQuery(){return ge(this,bn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=ge(this,Xs).defaultQueryOptions(t),s=ge(this,Xs).getQueryCache().build(ge(this,Xs),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return yn(this,Fn,mh).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),ge(this,$s)))}createResult(t,n){var R;const s=ge(this,bn),a=this.options,i=ge(this,$s),o=ge(this,fd),l=ge(this,Qu),d=t!==s?t.state:ge(this,Fp),{state:f}=t;let m={...f},g=!1,x;if(n._optimisticResults){const B=this.hasListeners(),D=!B&&EO(t,n),P=B&&AO(t,s,n,a);(D||P)&&(m={...m,...D7(f.data,t.options)}),n._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:j,errorUpdatedAt:b,status:y}=m;x=m.data;let w=!1;if(n.placeholderData!==void 0&&x===void 0&&y==="pending"){let B;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(B=i.data,w=!0):B=typeof n.placeholderData=="function"?n.placeholderData((R=ge(this,Zu))==null?void 0:R.state.data,ge(this,Zu)):n.placeholderData,B!==void 0&&(y="success",x=l2(i==null?void 0:i.data,B,n),g=!0)}if(n.select&&x!==void 0&&!w)if(i&&x===(o==null?void 0:o.data)&&n.select===ge(this,zp))x=ge(this,Xu);else try{vt(this,zp,n.select),x=n.select(x),x=l2(i==null?void 0:i.data,x,n),vt(this,Xu,x),vt(this,Ll,null)}catch(B){vt(this,Ll,B)}ge(this,Ll)&&(j=ge(this,Ll),x=ge(this,Xu),b=Date.now(),y="error");const _=m.fetchStatus==="fetching",N=y==="pending",C=y==="error",k=N&&_,S=x!==void 0,T={status:y,fetchStatus:m.fetchStatus,isPending:N,isSuccess:y==="success",isError:C,isInitialLoading:k,isLoading:k,data:x,dataUpdatedAt:m.dataUpdatedAt,error:j,errorUpdatedAt:b,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:_,isRefetching:_&&!N,isLoadingError:C&&!S,isPaused:m.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:C&&S,isStale:eE(t,n),refetch:this.refetch,promise:ge(this,Ro),isEnabled:Ka(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const B=T.data!==void 0,D=T.status==="error"&&!B,P=L=>{D?L.reject(T.error):B&&L.resolve(T.data)},I=()=>{const L=vt(this,Ro,T.promise=c2());P(L)},z=ge(this,Ro);switch(z.status){case"pending":t.queryHash===s.queryHash&&P(z);break;case"fulfilled":(D||T.data!==z.value)&&I();break;case"rejected":(!D||T.error!==z.reason)&&I();break}}return T}updateResult(){const t=ge(this,$s),n=this.createResult(ge(this,bn),this.options);if(vt(this,fd,ge(this,bn).state),vt(this,Qu,this.options),ge(this,fd).data!==void 0&&vt(this,Zu,ge(this,bn)),i2(n,t))return;vt(this,$s,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!ge(this,em).size)return!0;const o=new Set(i??ge(this,em));return this.options.throwOnError&&o.add("error"),Object.keys(ge(this,$s)).some(l=>{const c=l;return ge(this,$s)[c]!==t[c]&&o.has(c)})};yn(this,Fn,L7).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&yn(this,Fn,h2).call(this)}},Xs=new WeakMap,bn=new WeakMap,Fp=new WeakMap,$s=new WeakMap,fd=new WeakMap,Qu=new WeakMap,Ro=new WeakMap,Ll=new WeakMap,zp=new WeakMap,Xu=new WeakMap,Zu=new WeakMap,hd=new WeakMap,pd=new WeakMap,$l=new WeakMap,em=new WeakMap,Fn=new WeakSet,mh=function(t){yn(this,Fn,x2).call(this);let n=ge(this,bn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Zs)),n},u2=function(){yn(this,Fn,p2).call(this);const t=Gl(this.options.staleTime,ge(this,bn));if(Sd||ge(this,$s).isStale||!a2(t))return;const s=A7(ge(this,$s).dataUpdatedAt,t)+1;vt(this,hd,td.setTimeout(()=>{ge(this,$s).isStale||this.updateResult()},s))},m2=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ge(this,bn)):this.options.refetchInterval)??!1},f2=function(t){yn(this,Fn,g2).call(this),vt(this,$l,t),!(Sd||Ka(this.options.enabled,ge(this,bn))===!1||!a2(ge(this,$l))||ge(this,$l)===0)&&vt(this,pd,td.setInterval(()=>{(this.options.refetchIntervalInBackground||Z5.isFocused())&&yn(this,Fn,mh).call(this)},ge(this,$l)))},h2=function(){yn(this,Fn,u2).call(this),yn(this,Fn,f2).call(this,yn(this,Fn,m2).call(this))},p2=function(){ge(this,hd)&&(td.clearTimeout(ge(this,hd)),vt(this,hd,void 0))},g2=function(){ge(this,pd)&&(td.clearInterval(ge(this,pd)),vt(this,pd,void 0))},x2=function(){const t=ge(this,Xs).getQueryCache().build(ge(this,Xs),this.options);if(t===ge(this,bn))return;const n=ge(this,bn);vt(this,bn,t),vt(this,Fp,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},L7=function(t){ms.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(ge(this,$s))}),ge(this,Xs).getQueryCache().notify({query:ge(this,bn),type:"observerResultsUpdated"})})},uz);function pre(e,t){return Ka(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function EO(e,t){return pre(e,t)||e.state.data!==void 0&&y2(e,t,t.refetchOnMount)}function y2(e,t,n){if(Ka(t.enabled,e)!==!1&&Gl(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&eE(e,t)}return!1}function AO(e,t,n,s){return(e!==t||Ka(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&eE(e,n)}function eE(e,t){return Ka(t.enabled,e)!==!1&&e.isStaleByTime(Gl(t.staleTime,e))}function gre(e,t){return!i2(e.getCurrentResult(),t)}function TO(e){return{onFetch:(t,n)=>{var f,m,g,x,j;const s=t.options,a=(g=(m=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:m.fetchMore)==null?void 0:g.direction,i=((x=t.state.data)==null?void 0:x.pages)||[],o=((j=t.state.data)==null?void 0:j.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let b=!1;const y=N=>{ore(N,()=>t.signal,()=>b=!0)}
vendor: 4,362 bytes, line 790
790,w=P7(t.options,t.fetchOptions),_=async(N,C,k)=>{if(b)return Promise.reject();if(C==null&&N.pages.length)return Promise.resolve(N);const A=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:C,direction:k?"backward":"forward",meta:t.options.meta};return y(D),D})(),T=await w(A),{maxPages:R}=t.options,B=k?ire:are;return{pages:B(N.pages,T,R),pageParams:B(N.pageParams,C,R)}};if(a&&i.length){const N=a==="backward",C=N?xre:PO,k={pages:i,pageParams:o},S=C(s,k);l=await _(k,S,N)}else{const N=e??i.length;do{const C=c===0?o[0]??s.initialPageParam:PO(s,l);if(c>0&&C==null)break;l=await _(l,C),c++}while(c<N)}return l};t.options.persister?t.fetchFn=()=>{var b,y;return(y=(b=t.options).persister)==null?void 0:y.call(b,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function PO(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function xre(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}var Up,Vi,Ns,gd,Hi,Pl,mz,yre=(mz=class extends M7{constructor(t){super();Vt(this,Hi);Vt(this,Up);Vt(this,Vi);Vt(this,Ns);Vt(this,gd);vt(this,Up,t.client),this.mutationId=t.mutationId,vt(this,Ns,t.mutationCache),vt(this,Vi,[]),this.state=t.state||bre(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){ge(this,Vi).includes(t)||(ge(this,Vi).push(t),this.clearGcTimeout(),ge(this,Ns).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){vt(this,Vi,ge(this,Vi).filter(n=>n!==t)),this.scheduleGc(),ge(this,Ns).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){ge(this,Vi).length||(this.state.status==="pending"?this.scheduleGc():ge(this,Ns).remove(this))}continue(){var t;return((t=ge(this,gd))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,d,f,m,g,x,j,b,y,w,_,N,C,k,S,A;const n=()=>{yn(this,Hi,Pl).call(this,{type:"continue"})},s={client:ge(this,Up),meta:this.options.meta,mutationKey:this.options.mutationKey};vt(this,gd,R7({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(T,R)=>{yn(this,Hi,Pl).call(this,{type:"failed",failureCount:T,error:R})},onPause:()=>{yn(this,Hi,Pl).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,Ns).canRun(this)}));const a=this.state.status==="pending",i=!ge(this,gd).canStart();try{if(a)n();else{yn(this,Hi,Pl).call(this,{type:"pending",variables:t,isPaused:i}),ge(this,Ns).config.onMutate&&await ge(this,Ns).config.onMutate(t,this,s);const R=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,s));R!==this.state.context&&yn(this,Hi,Pl).call(this,{type:"pending",context:R,variables:t,isPaused:i})}const T=await ge(this,gd).start();return await((d=(c=ge(this,Ns).config).onSuccess)==null?void 0:d.call(c,T,t,this.state.context,this,s)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,T,t,this.state.context,s)),await((x=(g=ge(this,Ns).config).onSettled)==null?void 0:x.call(g,T,null,this.state.variables,this.state.context,this,s)),await((b=(j=this.options).onSettled)==null?void 0:b.call(j,T,null,t,this.state.context,s)),yn(this,Hi,Pl).call(this,{type:"success",data:T}),T}catch(T){try{await((w=(y=ge(this,Ns).config).onError)==null?void 0:w.call(y,T,t,this.state.context,this,s))}catch(R){Promise.reject(R)}try{await((N=(_=this.options).onError)==null?void 0:N.call(_,T,t,this.state.context,s))}catch(R){Promise.reject(R)}try{await((k=(C=ge(this,Ns).config).onSettled)==null?void 0:k.call(C,void 0,T,this.state.variables,this.state.context,this,s))}catch(R){Promise.reject(R)}try{await((A=(S=this.options).onSettled)==null?void 0:A.call(S,void 0,T,t,this.state.context,s))}catch(R){Promise.reject(R)}throw yn(this,Hi,Pl).call(this,{type:"error",error:T}),T}finally{ge(this,Ns).runNext(this)}}},Up=new WeakMap,Vi=new WeakMap,Ns=new WeakMap,gd=new WeakMap,Hi=new WeakSet,Pl=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};
790case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ms.batch(()=>{ge(this,Vi).forEach(s=>{s.onMutationUpdate(t)}),ge(this,Ns).notify({mutation:this,type:"updated",action:t})})},mz);function bre(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Mo,bi,qp,fz,vre=(fz=class extends tg{constructor(t={}){super();Vt(this,Mo);Vt(this,bi);Vt(this,qp);this.config=t,vt(this,Mo,new Set),vt(this,bi,new Map),vt(this,qp,0)}build(t,n,s){const a=new yre({client:t,mutationCache:this,mutationId:++_x(this,qp)._,options:t.defaultMutationOptions(n),state:s});return this.add(a),a}add(t){ge(this,Mo).add(t);const n=Tx(t);if(typeof n=="string"){const s=ge(this,bi).get(n);s?s.push(t):ge(this,bi).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(ge(this,Mo).delete(t)){const n=Tx(t);if(typeof n=="string"){const s=ge(this,bi).get(n);if(s)if(s.length>1){const a=s.indexOf(t);a!==-1&&s.splice(a,1)}else s[0]===t&&ge(this,bi).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Tx(t);if(typeof n=="string"){const s=ge(this,bi).get(n),a=s==null?void 0:s.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var s;const n=Tx(t);if(typeof n=="string"){const a=(s=ge(this,bi).get(n))==null?void 0:s.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ms.batch(()=>{ge(this,Mo).forEach(t=>{this.notify({type:"removed",mutation:t})}),ge(this,Mo).clear(),ge(this,bi).clear()})}getAll(){return Array.from(ge(this,Mo))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>_O(n,s))}findAll(t={}){return this.getAll().filter(n=>_O(t,n))}notify(t){ms.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ms.batch(()=>Promise.all(t.map(n=>n.continue().catch(Zs))))}},Mo=new WeakMap,bi=new WeakMap,qp=new WeakMap,fz);function Tx(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Wi,hz,wre=(hz=class extends tg{constructor(t={}){super();Vt(this,Wi);this.config=t,vt(this,Wi,new Map)}build(t,n,s){const a=n.queryKey,i=n.queryHash??Q5(a,n);let o=this.get(i);return o||(o=new fre({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){ge(this,Wi).has(t.queryHash)||(ge(this,Wi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=ge(this,Wi).get(t.queryHash);n&&(t.destroy(),n===t&&ge(this,Wi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ms.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return ge(this,Wi).get(t)}getAll(){return[...ge(this,Wi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>jO(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>jO(t,s)):n}notify(t){ms.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ms.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ms.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Wi=new WeakMap,hz),wr,Bl,Fl,tm,nm,zl,rm,sm,pz,jre=(pz=class{constructor(e={}){Vt(this,wr);Vt(this,Bl);Vt(this,Fl);Vt(this,tm);Vt(this,nm);Vt(this,zl);Vt(this,rm);Vt(this,sm);vt(this,wr,e.queryCache||new wre),vt(this,Bl,e.mutationCache||new vre),vt(this,Fl,e.defaultOptions||{}),vt(this,tm,new Map),vt(this,nm,new Map),vt(this,zl,0)}mount(){_x(this,zl)._++,ge(this,zl)===1&&(vt(this,rm,Z5.subscribe(async e=>{e&&(await this.resumePausedMutations(),ge(this,wr).onFocus())})),vt(this,sm,F0.subscribe(async e=>{e&&(await this.resumePausedMutations(),ge(this,wr).onOnline())})))}unmount(){var e,t;_x(this,zl)._--,ge(this,zl)===0&&((e=ge(this,rm))==null||e.call(this),vt(this,rm,void 0),(t=ge(this,sm))==null||t.call(this),vt(this,sm,void 0))}isFetching(e){return ge(this,wr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return ge(this,Bl).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ge(this,wr).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=ge(this,wr).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Gl(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return ge(this,wr).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),a=ge(this,wr).get(s.queryHash),i=a==null?void 0:a.state.data,o=nre(t,i);if(o!==void 0)return ge(this,wr).build(this,s).setData(o,{...n,manual:!0})}
790setQueriesData(e,t,n){return ms.batch(()=>ge(this,wr).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ge(this,wr).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=ge(this,wr);ms.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=ge(this,wr);return ms.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=ms.batch(()=>ge(this,wr).findAll(e).map(a=>a.cancel(n)));return Promise.all(s).then(Zs).catch(Zs)}invalidateQueries(e,t={}){return ms.batch(()=>(ge(this,wr).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=ms.batch(()=>ge(this,wr).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(Zs)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(Zs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=ge(this,wr).build(this,t);return n.isStaleByTime(Gl(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Zs).catch(Zs)}fetchInfiniteQuery(e){return e.behavior=TO(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Zs).catch(Zs)}ensureInfiniteQueryData(e){return e.behavior=TO(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return F0.isOnline()?ge(this,Bl).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,wr)}getMutationCache(){return ge(this,Bl)}getDefaultOptions(){return ge(this,Fl)}setDefaultOptions(e){vt(this,Fl,e)}setQueryDefaults(e,t){ge(this,tm).set(Bh(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...ge(this,tm).values()],n={};return t.forEach(s=>{Fh(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){ge(this,nm).set(Bh(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...ge(this,nm).values()],n={};return t.forEach(s=>{Fh(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...ge(this,Fl).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Q5(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===X5&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...ge(this,Fl).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){ge(this,wr).clear(),ge(this,Bl).clear()}},wr=new WeakMap,Bl=new WeakMap,Fl=new WeakMap,tm=new WeakMap,nm=new WeakMap,zl=new WeakMap,rm=new WeakMap,sm=new WeakMap,pz),$7=h.createContext(void 0),_re=e=>{const t=h.useContext($7);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Nre=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx($7.Provider,{value:e,children:t})),B7=h.createContext(!1),Sre=()=>h.useContext(B7);B7.Provider;function kre(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Cre=h.createContext(kre()),Ere=()=>h.useContext(Cre),Are=(e,t,n)=>{const s=n!=null&&n.state.error&&typeof e.throwOnError=="function"?O7(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))},Tre=e=>{h.useEffect(()=>{e.clearReset()},[e])},Pre=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(a&&e.data===void 0||O7(n,[e.error,s])),Ore=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...a)=>n(s(...a)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Ire=(e,t)=>
790e.isLoading&&e.isFetching&&!t,Rre=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,OO=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Mre(e,t,n){var g,x,j,b;const s=Sre(),a=Ere(),i=_re(),o=i.defaultQueryOptions(e);(x=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||x.call(g,o);const l=i.getQueryCache().get(o.queryHash);o._optimisticResults=s?"isRestoring":"optimistic",Ore(o),Are(o,a,l),Tre(a);const c=!i.getQueryCache().get(o.queryHash),[d]=h.useState(()=>new t(i,o)),f=d.getOptimisticResult(o),m=!s&&e.subscribed!==!1;if(h.useSyncExternalStore(h.useCallback(y=>{const w=m?d.subscribe(ms.batchCalls(y)):Zs;return d.updateResult(),w},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),h.useEffect(()=>{d.setOptions(o)},[o,d]),Rre(o,f))throw OO(o,d,a);if(Pre({result:f,errorResetBoundary:a,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw f.error;if((b=(j=i.getDefaultOptions().queries)==null?void 0:j._experimental_afterQuery)==null||b.call(j,o,f),o.experimental_prefetchInRender&&!Sd&&Ire(f,s)){const y=c?OO(o,d,a):l==null?void 0:l.promise;y==null||y.catch(Zs).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Dre(e,t){return Mre(e,hre)}const Lre=new jre({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});function F7(e,t){return function(){return e.apply(t,arguments)}}const{toString:$re}=Object.prototype,{getPrototypeOf:im}=Object,{iterator:ng,toStringTag:z7}=Symbol,z0=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),zh=(e,t)=>{let n=e;const s=[];for(;n!=null&&n!==Object.prototype;){if(s.indexOf(n)!==-1)return!1;if(s.push(n),z0(n,t))return!0;n=im(n)}return!1},Bre=(e,t)=>e!=null&&zh(e,t)?e[t]:void 0,tE=(e=>t=>{const n=$re.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Pi=e=>(e=e.toLowerCase(),t=>tE(t)===e),Sb=e=>t=>typeof t===e,{isArray:kd}=Array,om=Sb("undefined");function zm(e){return e!==null&&!om(e)&&e.constructor!==null&&!om(e.constructor)&&ta(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const U7=Pi("ArrayBuffer");function Fre(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&U7(e.buffer),t}const zre=Sb("string"),ta=Sb("function"),q7=Sb("number"),Um=e=>e!==null&&typeof e=="object",Ure=e=>e===!0||e===!1,y0=e=>{if(!Um(e))return!1;const t=im(e);return(t===null||t===Object.prototype||im(t)===null)&&!zh(e,z7)&&!zh(e,ng)},qre=e=>{if(!Um(e)||zm(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Kre=Pi("Date"),Vre=Pi("File"),Hre=e=>!!(e&&typeof e.uri<"u"),Wre=e=>e&&typeof e.getParts<"u",Gre=Pi("Blob"),Yre=Pi("FileList"),Jre=e=>Um(e)&&ta(e.pipe);function Qre(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const IO=Qre(),RO=typeof IO.FormData<"u"?IO.FormData:void 0,Xre=e=>{if(!e)return!1;if(RO&&e instanceof RO)return!0;const t=im(e);if(!t||t===Object.prototype||!ta(e.append))return!1;const n=tE(e);return n==="formdata"||n==="object"&&ta(e.toString)&&e.toString()==="[object FormData]"},Zre=Pi("URLSearchParams"),[ese,tse,nse,rse]=["ReadableStream","Request","Response","Headers"].map(Pi),sse=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function rg(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,a;if(typeof e!="object"&&(e=[e]),kd(e))for(s=0,a=e.length;s<a;s++)t.call(null,e[s],s,e);else{if(zm(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(s=0;s<o;s++)l=i[s],t.call(null,e[l],l,e)}}function K7(e,t){if(zm(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,a;for(;s-- >0;)if(a=n[s],t===a.toLowerCase())return a;return null}const nd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,V7=e=>!om(e)&&e!==nd;function b2(...e){const{caseless:t,skipUndefined:n}=V7(this)&&this||{},s={},a=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const l=t&&typeof o=="string"&&K7(s,o)||o,c=z0(s,l)?s[l]:void 0;y0(c)&&y0(i)?s[l]=b2(c,i):y0(i)?s[l]=b2({},i):kd(i)?s[l]=i.slice():(!n||!om(i))&&(s[l]=i)};for(let i=0,o=e.length;i<o;i++){const l=e[i];if(!l||zm(l)||(rg(l,a),typeof l!="object"||kd(l)))continue;const c=Object.getOwnPropertySymbols(l);for(let d=0;d<c.length;d++){const f=c[d];gse.call(l,f)&&a(l[f],f)}}return s}const ase=(e,t,n,{allOwnKeys:s}={})=>(rg(t,(a,i)=>{n&&ta(a)?Object.defineProperty(e,i,{__proto__:null,value:F7(a,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:a,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),ise=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ose=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,
vendor: 4,603 bytes, lines 790-791
790configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},lse=(e,t,n,s)=>{let a,i,o;const l={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),i=a.length;i-- >0;)o=a[i],(!s||s(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&im(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},cse=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},dse=e=>{if(!e)return null;if(kd(e))return e;let t=e.length;if(!q7(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},use=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&im(Uint8Array)),mse=(e,t)=>{const s=(e&&e[ng]).call(e);let a;for(;(a=s.next())&&!a.done;){const i=a.value;t.call(e,i[0],i[1])}},fse=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},hse=Pi("HTMLFormElement"),pse=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,a){return s.toUpperCase()+a}),{propertyIsEnumerable:gse}=Object.prototype,xse=Pi("RegExp"),H7=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};rg(n,(a,i)=>{let o;(o=t(a,i,e))!==!1&&(s[i]=o||a)}),Object.defineProperties(e,s)},yse=e=>{H7(e,(t,n)=>{if(ta(e)&&["arguments","caller","callee"].includes(n))return!1;const s=e[n];if(ta(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},bse=(e,t)=>{const n={},s=a=>{a.forEach(i=>{n[i]=!0})};return kd(e)?s(e):s(String(e).split(t)),n},vse=()=>{},wse=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function jse(e){return!!(e&&ta(e.append)&&e[z7]==="FormData"&&e[ng])}const _se=e=>{const t=new WeakSet,n=s=>{if(Um(s)){if(t.has(s))return;if(zm(s))return s;if(!("toJSON"in s)){t.add(s);const a=kd(s)?[]:{};return rg(s,(i,o)=>{const l=n(i);!om(l)&&(a[o]=l)}),t.delete(s),a}}return s};return n(e)},Nse=Pi("AsyncFunction"),Sse=e=>e&&(Um(e)||ta(e))&&ta(e.then)&&ta(e.catch),W7=((e,t)=>e?setImmediate:t?((n,s)=>(nd.addEventListener("message",({source:a,data:i})=>{a===nd&&i===n&&s.length&&s.shift()()},!1),a=>{s.push(a),nd.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ta(nd.postMessage)),kse=typeof queueMicrotask<"u"?queueMicrotask.bind(nd):typeof process<"u"&&process.nextTick||W7,G7=e=>e!=null&&ta(e[ng]),Cse=e=>e!=null&&zh(e,ng)&&G7(e),ve={isArray:kd,isArrayBuffer:U7,isBuffer:zm,isFormData:Xre,isArrayBufferView:Fre,isString:zre,isNumber:q7,isBoolean:Ure,isObject:Um,isPlainObject:y0,isEmptyObject:qre,isReadableStream:ese,isRequest:tse,isResponse:nse,isHeaders:rse,isUndefined:om,isDate:Kre,isFile:Vre,isReactNativeBlob:Hre,isReactNative:Wre,isBlob:Gre,isRegExp:xse,isFunction:ta,isStream:Jre,isURLSearchParams:Zre,isTypedArray:use,isFileList:Yre,forEach:rg,merge:b2,extend:ase,trim:sse,stripBOM:ise,inherits:ose,toFlatObject:lse,kindOf:tE,kindOfTest:Pi,endsWith:cse,toArray:dse,forEachEntry:mse,matchAll:fse,isHTMLForm:hse,hasOwnProperty:z0,hasOwnProp:z0,hasOwnInPrototypeChain:zh,getSafeProp:Bre,reduceDescriptors:H7,freezeMethods:yse,toObjectSet:bse,toCamelCase:pse,noop:vse,toFiniteNumber:wse,findKey:K7,global:nd,isContextDefined:V7,isSpecCompliantForm:jse,toJSONObject:_se,isAsyncFn:Nse,isThenable:Sse,setImmediate:W7,asap:kse,isIterable:G7,isSafeIterable:Cse},Ese=ve.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"]),Ase=e=>{const t={};let n,s,a;return e&&e.split(`
791`).forEach(function(o){a=o.indexOf(":"),n=o.substring(0,a).trim().toLowerCase(),s=o.substring(a+1).trim(),!(!n||t[n]&&Ese[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t};function Tse(e){let t=0,n=e.length;for(;t<n;){const s=e.charCodeAt(t);if(s!==9&&s!==32)break;t+=1}for(;n>t;){const s=e.charCodeAt(n-1);if(s!==9&&s!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const Pse=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Ose=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function nE(e,t){return ve.isArray(e)?e.map(n=>nE(n,t)):Tse(String(e).replace(t,""))}const Ise=e=>nE(e,Pse),Rse=e=>nE(e,Ose);function Y7(e){const t=Object.create(null);return ve.forEach(e.toJSON(),(n,s)=>{t[s]=Rse(n)}),t}const MO=Symbol("internals");function zf(e){return e&&String(e).trim().toLowerCase()}function b0(e){return e===!1||e==null?e:ve.isArray(e)?e.map(b0):Ise(String(e))}function Mse(e){const t=Object.create(null),n=/([^\s,;
791=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Dse=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Rj(e,t,n,s,a){if(ve.isFunction(s))return s.call(this,t,n);if(a&&(t=n),!!ve.isString(t)){if(ve.isString(s))return t.indexOf(s)!==-1;if(ve.isRegExp(s))return s.test(t)}}function Lse(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function $se(e,t){const n=ve.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{__proto__:null,value:function(a,i,o){return this[s].call(this,t,a,i,o)},configurable:!0})})}let As=class{constructor(t){t&&this.set(t)}set(t,n,s){const a=this;function i(l,c,d){const f=zf(c);if(!f)return;const m=ve.findKey(a,f);(!m||a[m]===void 0||d===!0||d===void 0&&a[m]!==!1)&&(a[m||c]=b0(l))}const o=(l,c)=>ve.forEach(l,(d,f)=>i(d,f,c));if(ve.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(ve.isString(t)&&(t=t.trim())&&!Dse(t))o(Ase(t),n);else if(ve.isObject(t)&&ve.isSafeIterable(t)){let l=Object.create(null),c,d;for(const f of t){if(!ve.isArray(f))throw new TypeError("Object iterator must return a key-value pair");d=f[0],ve.hasOwnProp(l,d)?(c=l[d],l[d]=ve.isArray(c)?[...c,f[1]]:[c,f[1]]):l[d]=f[1]}o(l,n)}else t!=null&&i(n,t,s);return this}get(t,n){if(t=zf(t),t){const s=ve.findKey(this,t);if(s){const a=this[s];if(!n)return a;if(n===!0)return Mse(a);if(ve.isFunction(n))return n.call(this,a,s);if(ve.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=zf(t),t){const s=ve.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||Rj(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let a=!1;function i(o){if(o=zf(o),o){const l=ve.findKey(s,o);l&&(!n||Rj(s,s[l],l,n))&&(delete s[l],a=!0)}}return ve.isArray(t)?t.forEach(i):i(t),a}clear(t){const n=Object.keys(this);let s=n.length,a=!1;for(;s--;){const i=n[s];(!t||Rj(this,this[i],i,t,!0))&&(delete this[i],a=!0)}return a}normalize(t){const n=this,s={};return ve.forEach(this,(a,i)=>{const o=ve.findKey(s,i);if(o){n[o]=b0(a),delete n[i];return}const l=t?Lse(i):String(i).trim();l!==i&&delete n[i],n[l]=b0(a),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ve.forEach(this,(s,a)=>{s!=null&&s!==!1&&(n[a]=t&&ve.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
792`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(a=>s.set(a)),s}static accessor(t){const s=(this[MO]=this[MO]={accessors:{}}).accessors,a=this.prototype;function i(o){const l=zf(o);s[l]||($se(a,o),s[l]=!0)}return ve.isArray(t)?t.forEach(i):i(t),this}};As.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ve.reduceDescriptors(As.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});ve.freezeMethods(As);const Bse="[REDACTED ****]";function Fse(e){if(ve.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(ve.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function zse(e,t){const n=new Set(t.map(i=>String(i).toLowerCase())),s=[],a=i=>{if(i===null||typeof i!="object"||ve.isBuffer(i))return i;if(s.indexOf(i)!==-1)return;i instanceof As&&(i=i.toJSON()),s.push(i);let o;if(ve.isArray(i))o=[],i.forEach((l,c)=>{const d=a(l);ve.isUndefined(d)||(o[c]=d)});else{if(!ve.isPlainObject(i)&&Fse(i))return s.pop(),i;o=Object.create(null);for(const[l,c]of Object.entries(i)){const d=n.has(l.toLowerCase())?Bse:a(c);ve.isUndefined(d)||(o[l]=d)}}return s.pop(),o};return a(e)}let mt=class J7 extends Error{static from(t,n,s,a,i,o){const l=new J7(t.message,n||t.code,s,a,i);return Object.defineProperty(l,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),l.name=t.name,t.status!=null&&l.status==null&&(l.status=t.status),o&&Object.assign(l,o),l}constructor(t,n,s,a,i){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),s&&(this.config=s),a&&(this.request=a),i&&(this.response=i,this.status=i.status)}toJSON(){const t=this.config,n=t&&ve.hasOwnProp(t,"redact")?t.redact:void 0,s=ve.isArray(n)&&n.length>0?zse(t,n):ve.toJSONObject(t);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:s,code:this.code,status:this.status}}};mt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";mt.ERR_BAD_OPTION="ERR_BAD_OPTION";mt.ECONNABORTED="ECONNABORTED";mt.ETIMEDOUT="ETIMEDOUT";mt.ECONNREFUSED="ECONNREFUSED";mt.ERR_NETWORK="ERR_NETWORK";mt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";mt.ERR_DEPRECATED="ERR_DEPRECATED";mt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";mt.ERR_BAD_REQUEST="ERR_BAD_REQUEST";mt.ERR_CANCELED="ERR_CANCELED";mt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";mt.ERR_INVALID_URL="ERR_INVALID_URL";mt.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Use=null,Q7=100;function v2(e){return ve.isPlainObject(e)||ve.isArray(e)}function X7(e){return ve.endsWith(e,"[]")?e.slice(0,-2):e}function Mj(e,t,n){return e?e.concat(t).map(function(a,i){return a=X7(a),!n&&i?"["+a+"]":a}).join(n?".":""):t}function qse(e){return ve.isArray(e)&&!e.some(v2)}const Kse=ve.toFlatObject(ve,{},null,function(t){return/^is[A-Z]/.test(t)});function kb(e,t,n){if(!ve.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ve.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(_,N){return!ve.isUndefined(N[_])});const s=n.metaTokens,a=n.visitor||j,i=n.dots,o=n.indexes,l=n.Blob||typeof Blob<"u"&&Blob,c=n.maxDepth===void 0?Q7:n.maxDepth,d=l&&ve.isSpecCompliantForm(t),f=[];
vendor: 5,727 bytes, line 792
792if(!ve.isFunction(a))throw new TypeError("visitor must be a function");function m(w){if(w===null)return"";if(ve.isDate(w))return w.toISOString();if(ve.isBoolean(w))return w.toString();if(!d&&ve.isBlob(w))throw new mt("Blob is not supported. Use a Buffer instead.");if(ve.isArrayBuffer(w)||ve.isTypedArray(w)){if(d&&typeof l=="function")return new l([w]);if(typeof Buffer<"u")return Buffer.from(w);throw new mt("Blob is not supported. Use a Buffer instead.",mt.ERR_NOT_SUPPORT)}return w}function g(w){if(w>c)throw new mt("Object is too deeply nested ("+w+" levels). Max depth: "+c,mt.ERR_FORM_DATA_DEPTH_EXCEEDED)}function x(w,_){if(c===1/0)return JSON.stringify(w);const N=[];return JSON.stringify(w,function(k,S){if(!ve.isObject(S))return S;for(;N.length&&N[N.length-1]!==this;)N.pop();return N.push(S),g(_+N.length-1),S})}function j(w,_,N){let C=w;if(ve.isReactNative(t)&&ve.isReactNativeBlob(w))return t.append(Mj(N,_,i),m(w)),!1;if(w&&!N&&typeof w=="object"){if(ve.endsWith(_,"{}"))_=s?_:_.slice(0,-2),w=x(w,1);else if(ve.isArray(w)&&qse(w)||(ve.isFileList(w)||ve.endsWith(_,"[]"))&&(C=ve.toArray(w)))return _=X7(_),C.forEach(function(S,A){!(ve.isUndefined(S)||S===null)&&t.append(o===!0?Mj([_],A,i):o===null?_:_+"[]",m(S))}),!1}return v2(w)?!0:(t.append(Mj(N,_,i),m(w)),!1)}const b=Object.assign(Kse,{defaultVisitor:j,convertValue:m,isVisitable:v2});function y(w,_,N=0){if(!ve.isUndefined(w)){if(g(N),f.indexOf(w)!==-1)throw new Error("Circular reference detected in "+_.join("."));f.push(w),ve.forEach(w,function(k,S){(!(ve.isUndefined(k)||k===null)&&a.call(t,k,ve.isString(S)?S.trim():S,_,b))===!0&&y(k,_?_.concat(S):[S],N+1)}),f.pop()}}if(!ve.isObject(e))throw new TypeError("data must be an object");return y(e),t}function DO(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(s){return t[s]})}function rE(e,t){this._pairs=[],e&&kb(e,this,t)}const Z7=rE.prototype;Z7.append=function(t,n){this._pairs.push([t,n])};Z7.toString=function(t){const n=t?s=>t.call(this,s,DO):DO;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function Vse(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function eU(e,t,n){if(!t)return e;e=e||"";const s=ve.isFunction(n)?{serialize:n}:n,a=ve.getSafeProp(s,"encode")||Vse,i=ve.getSafeProp(s,"serialize");let o;if(i?o=i(t,s):o=ve.isURLSearchParams(t)?t.toString():new rE(t,s).toString(a),o){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class LO{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ve.forEach(this.handlers,function(s){s!==null&&t(s)})}}const sE={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Hse=typeof URLSearchParams<"u"?URLSearchParams:rE,Wse=typeof FormData<"u"?FormData:null,Gse=typeof Blob<"u"?Blob:null,Yse={isBrowser:!0,classes:{URLSearchParams:Hse,FormData:Wse,Blob:Gse},protocols:["http","https","file","blob","url","data"]},aE=typeof window<"u"&&typeof document<"u",w2=typeof navigator=="object"&&navigator||void 0,Jse=aE&&(!w2||["ReactNative","NativeScript","NS"].indexOf(w2.product)<0),Qse=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Xse=aE&&window.location.href||"http://localhost",Zse=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:aE,hasStandardBrowserEnv:Jse,hasStandardBrowserWebWorkerEnv:Qse,navigator:w2,origin:Xse},Symbol.toStringTag,{value:"Module"})),fs={...Zse,...Yse};function eae(e,t){return kb(e,new fs.classes.URLSearchParams,{visitor:function(n,s,a,i){return fs.isNode&&ve.isBuffer(n)?(this.append(s,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}const $O=Q7;function tU(e){if(e>$O)throw new mt("FormData field is too deeply nested ("+e+" levels). Max depth: "+$O,mt.ERR_FORM_DATA_DEPTH_EXCEEDED)}function tae(e){const t=[],n=/\w+|\[(\w*)]/g;let s;for(;(s=n.exec(e))!==null;)tU(t.length),t.push(s[0]==="[]"?"":s[1]||s[0]);return t}function nae(e){const t={},n=Object.keys(e);let s;const a=n.length;let i;for(s=0;s<a;s++)i=n[s],t[i]=e[i];return t}function nU(e){function t(n,s,a,i){tU(i);let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),c=i>=n.length;return o=!o&&ve.isArray(a)?a.length:o,c?(ve.hasOwnProp(a,o)?a[o]=ve.isArray(a[o])?a[o].concat(s):[a[o],s]:a[o]=s,!l):((!ve.hasOwnProp(a,o)||!ve.isObject(a[o]))&&(a[o]=[]),t(n,s,a[o],i)&&ve.isArray(a[o])&&(a[o]=nae(a[o])),!l)}if(ve.isFormData(e)&&ve.isFunction(e.entries)){const n={};return ve.forEachEntry(e,(s,a)=>{t(tae(s),a,n,0)}),n}return null}const gu=(e,t)=>e!=null&&ve.hasOwnProp(e,t)?e[t]:void 0;function rae(e,t,n){if(ve.isString(e))try{return(t||JSON.parse)(e),ve.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const sg={transitional:sE,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",a=s.indexOf("application/json")>-1,i=ve.isObject(t);if(i&&ve.isHTMLForm(t)&&(t=new FormData(t)),ve.isFormData(t))return a?JSON.stringify(nU(t)):t;if(ve.isArrayBuffer(t)||ve.isBuffer(t)||ve.isStream(t)||ve.isFile(t)||ve.isBlob(t)||ve.isReadableStream(t))return t;if(ve.isArrayBufferView(t))return t.buffer;if(ve.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;
vendor: 11,331 bytes, line 792
792if(i){const c=gu(this,"formSerializer");if(s.indexOf("application/x-www-form-urlencoded")>-1)return eae(t,c).toString();if((l=ve.isFileList(t))||s.indexOf("multipart/form-data")>-1){const d=gu(this,"env"),f=d&&d.FormData;return kb(l?{"files[]":t}:t,f&&new f,c)}}return i||a?(n.setContentType("application/json",!1),rae(t)):t}],transformResponse:[function(t){const n=gu(this,"transitional")||sg.transitional,s=n&&n.forcedJSONParsing,a=gu(this,"responseType"),i=a==="json";if(ve.isResponse(t)||ve.isReadableStream(t))return t;if(t&&ve.isString(t)&&(s&&!a||i)){const l=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,gu(this,"parseReviver"))}catch(c){if(l)throw c.name==="SyntaxError"?mt.from(c,mt.ERR_BAD_RESPONSE,this,null,gu(this,"response")):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fs.classes.FormData,Blob:fs.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ve.forEach(["delete","get","head","post","put","patch","query"],e=>{sg.headers[e]={}});function Dj(e,t){const n=this||sg,s=t||n,a=As.from(s.headers);let i=s.data;return ve.forEach(e,function(l){i=l.call(n,i,a.normalize(),t?t.status:void 0)}),a.normalize(),i}function rU(e){return!!(e&&e.__CANCEL__)}let ag=class extends mt{constructor(t,n,s){super(t??"canceled",mt.ERR_CANCELED,n,s),this.name="CanceledError",this.__CANCEL__=!0}};function sU(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new mt("Request failed with status code "+n.status,n.status>=400&&n.status<500?mt.ERR_BAD_REQUEST:mt.ERR_BAD_RESPONSE,n.config,n.request,n))}function sae(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function aae(e,t){e=e||10;const n=new Array(e),s=new Array(e);let a=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),f=s[i];o||(o=d),n[a]=c,s[a]=d;let m=i,g=0;for(;m!==a;)g+=n[m++],m=m%e;if(a=(a+1)%e,a===i&&(i=(i+1)%e),d-o<t)return;const x=f&&d-f;return x?Math.round(g*1e3/x):void 0}}function iae(e,t){let n=0,s=1e3/t,a,i;const o=(d,f=Date.now())=>{n=f,a=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const f=Date.now(),m=f-n;m>=s?o(d,f):(a=d,i||(i=setTimeout(()=>{i=null,o(a)},s-m)))},()=>a&&o(a)]}const U0=(e,t,n=3)=>{let s=0;const a=aae(50,250);return iae(i=>{if(!i||typeof i.loaded!="number")return;const o=i.loaded,l=i.lengthComputable?i.total:void 0,c=l!=null?Math.min(o,l):o,d=Math.max(0,c-s),f=a(d);s=Math.max(s,c);const m={loaded:c,total:l,progress:l?c/l:void 0,bytes:d,rate:f||void 0,estimated:f&&l?(l-c)/f:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(m)},n)},BO=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},FO=e=>(...t)=>ve.asap(()=>e(...t)),oae=fs.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,fs.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(fs.origin),fs.navigator&&/(msie|trident)/i.test(fs.navigator.userAgent)):()=>!0,lae=fs.hasStandardBrowserEnv?{write(e,t,n,s,a,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];ve.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),ve.isString(s)&&l.push(`path=${s}`),ve.isString(a)&&l.push(`domain=${a}`),i===!0&&l.push("secure"),ve.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const s=t[n].replace(/^\s+/,""),a=s.indexOf("=");if(a!==-1&&s.slice(0,a)===e)try{return decodeURIComponent(s.slice(a+1))}catch{return s.slice(a+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function cae(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function dae(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const uae=/^https?:(?!\/\/)/i,mae=/[\t\n\r]/g;function fae(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function hae(e){return fae(e).replace(mae,"")}function zO(e,t){if(typeof e=="string"&&uae.test(hae(e)))throw new mt('Invalid URL: missing "//" after protocol',mt.ERR_INVALID_URL,t)}function aU(e,t,n,s){zO(t,s);let a=!cae(t);return e&&(a||n===!1)?(zO(e,s),dae(e,t)):t}const UO=e=>e instanceof As?{...e}:e;function Cd(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function s(f,m,g,x){return ve.isPlainObject(f)&&ve.isPlainObject(m)?ve.merge.call({caseless:x},f,m):ve.isPlainObject(m)?ve.merge({},m):ve.isArray(m)?m.slice():m}function a(f,m,g,x){if(ve.isUndefined(m)){if(!ve.isUndefined(f))return s(void 0,f,g,x)}else return s(f,m,g,x)}function i(f,m){if(!ve.isUndefined(m))return s(void 0,m)}function o(f,m){if(ve.isUndefined(m)){if(!ve.isUndefined(f))return s(void 0,f)}else return s(void 0,m)}function l(f){const m=ve.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!ve.isUndefined(m))if(ve.isPlainObject(m)){if(ve.hasOwnProp(m,f))return m[f]}else return;const g=ve.hasOwnProp(e,"transitional")?e.transitional:void 0;if(ve.isPlainObject(g)&&ve.hasOwnProp(g,f))return g[f]}function c(f,m,g){if(ve.hasOwnProp(t,g))return s(f,m);if(ve.hasOwnProp(e,g))return s(void 0,f)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(f,m,g)=>a(UO(f),UO(m),g,!0)};return ve.forEach(Object.keys({...e,...t}),function(m){if(m==="__proto__"||m==="constructor"||m==="prototype")return;const g=ve.hasOwnProp(d,m)?d[m]:a,x=ve.hasOwnProp(e,m)?e[m]:void 0,j=ve.hasOwnProp(t,m)?t[m]:void 0,b=g(x,j,m);ve.isUndefined(b)&&g!==c||(n[m]=b)}),ve.hasOwnProp(t,"validateStatus")&&ve.isUndefined(t.validateStatus)&&l("validateStatusUndefinedResolves")===!1&&(ve.hasOwnProp(e,"validateStatus")?n.validateStatus=s(void 0,e.validateStatus):delete n.validateStatus),n}const pae=["content-type","content-length"];function gae(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([s,a])=>{pae.includes(s.toLowerCase())&&e.set(s,a)})}const xae=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function iU(e){const t=Cd({},e),n=g=>ve.hasOwnProp(t,g)?t[g]:void 0,s=n("data");let a=n("withXSRFToken");const i=n("xsrfHeaderName"),o=n("xsrfCookieName");let l=n("headers");const c=n("auth"),d=n("baseURL"),f=n("allowAbsoluteUrls"),m=n("url");if(t.headers=l=As.from(l),t.url=eU(aU(d,m,f,t),n("params"),n("paramsSerializer")),c){const g=ve.getSafeProp(c,"username")||"",x=ve.getSafeProp(c,"password")||"";try{l.set("Authorization","Basic "+btoa(g+":"+(x?xae(x):"")))}catch(j){throw mt.from(j,mt.ERR_BAD_OPTION_VALUE,e)}}if(ve.isFormData(s)&&(fs.hasStandardBrowserEnv||fs.hasStandardBrowserWebWorkerEnv||ve.isReactNative(s)?l.setContentType(void 0):ve.isFunction(s.getHeaders)&&gae(l,s.getHeaders(),n("formDataHeaderPolicy"))),fs.hasStandardBrowserEnv&&(ve.isFunction(a)&&(a=a(t)),a===!0||a==null&&oae(t.url))){const x=i&&o&&lae.read(o);x&&l.set(i,x)}return t}const yae=typeof XMLHttpRequest<"u",bae=yae&&function(e){return new Promise(function(n,s){const a=iU(e);let i=a.data;const o=As.from(a.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:d}=a,f,m,g,x,j;function b(){x&&x(),j&&j(),a.cancelToken&&a.cancelToken.unsubscribe(f),a.signal&&a.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(a.method.toUpperCase(),a.url,!0),y.timeout=a.timeout;function w(){if(!y)return;const N=As.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),k={data:!l||l==="text"||l==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:N,config:e,request:y};sU(function(A){n(A),b()},function(A){s(A),b()},k),y=null}"onloadend"in y?y.onloadend=w:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.startsWith("file:"))||setTimeout(w)},y.onabort=function(){y&&(s(new mt("Request aborted",mt.ECONNABORTED,e,y)),b(),y=null)},y.onerror=function(C){const k=C&&C.message?C.message:"Network Error",S=new mt(k,mt.ERR_NETWORK,e,y);S.event=C||null,s(S),b(),y=null},y.ontimeout=function(){let C=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const k=a.transitional||sE;a.timeoutErrorMessage&&(C=a.timeoutErrorMessage),s(new mt(C,k.clarifyTimeoutError?mt.ETIMEDOUT:mt.ECONNABORTED,e,y)),b(),y=null},i===void 0&&o.setContentType(null),"setRequestHeader"in y&&ve.forEach(Y7(o),function(C,k){y.setRequestHeader(k,C)}),ve.isUndefined(a.withCredentials)||(y.withCredentials=!!a.withCredentials),l&&l!=="json"&&(y.responseType=a.responseType),d&&([g,j]=U0(d,!0),y.addEventListener("progress",g)),c&&y.upload&&([m,x]=U0(c),y.upload.addEventListener("progress",m),y.upload.addEventListener("loadend",x)),(a.cancelToken||a.signal)&&(f=N=>{y&&(s(!N||N.type?new ag(null,e,y):N),y.abort(),b(),y=null)},a.cancelToken&&a.cancelToken.subscribe(f),a.signal&&(a.signal.aborted?f():a.signal.addEventListener("abort",f)));const _=sae(a.url);if(_&&!fs.protocols.includes(_)){s(new mt("Unsupported protocol "+_+":",mt.ERR_BAD_REQUEST,e)),b();return}y.send(i||null)})},vae=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let s=!1;const a=function(c){if(!s){s=!0,o();const d=c instanceof Error?c:this.reason;n.abort(d instanceof mt?d:new ag(d instanceof Error?d.message:d))}};let i=t&&setTimeout(()=>{i=null,a(new mt(`timeout of ${t}ms exceeded`,mt.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(a):c.removeEventListener("abort",a)}),e=null)};e.forEach(c=>c.addEventListener("abort",a,{once:!0}));const{signal:l}=n;return l.unsubscribe=()=>ve.asap(o),l},wae=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,a;for(;s<n;)a=s+t,yield e.slice(s,a),s=a},jae=async function*(e,t){for await(const n of _ae(e))yield*wae(n,t)},_ae=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},qO=(e,t,n,s)=>{const a=jae(e,t);let i=0,o,l=c=>{o||(o=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:d,value:f}=await a.next();if(d){l(),c.close();return}let m=f.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(f))}catch(d){throw l(d),d}},cancel(c){return l(c),a.return()}},{highWaterMark:2})},q0=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Nae=(e,t,n)=>t+2<n&&q0(e.charCodeAt(t+1))&&q0(e.charCodeAt(t+2));function Sae(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),s=e.slice(t+1);if(/;base64/i.test(n)){let o=s.length;const l=s.length;for(let x=0;x<l;x++)if(s.charCodeAt(x)===37&&x+2<l){const j=s.charCodeAt(x+1),b=s.charCodeAt(x+2);q0(j)&&q0(b)&&(o-=2,x+=2)}let c=0,d=l-1;const f=x=>x>
vendor: 3,471 bytes, line 792
792=2&&s.charCodeAt(x-2)===37&&s.charCodeAt(x-1)===51&&(s.charCodeAt(x)===68||s.charCodeAt(x)===100);d>=0&&(s.charCodeAt(d)===61?(c++,d--):f(d)&&(c++,d-=3)),c===1&&d>=0&&(s.charCodeAt(d)===61||f(d))&&c++;const g=Math.floor(o/4)*3-(c||0);return g>0?g:0}let i=0;for(let o=0,l=s.length;o<l;o++){const c=s.charCodeAt(o);if(c===37&&Nae(s,o,l))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<l){const d=s.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i}const iE="1.18.1",KO=64*1024,{isFunction:Px}=ve,kae=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),VO=e=>{if(!ve.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},HO=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Cae=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},Eae=e=>{const t=ve.global!==void 0&&ve.global!==null?ve.global:globalThis,{ReadableStream:n,TextEncoder:s}=t;e=ve.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:a,Request:i,Response:o}=e,l=a?Px(a):typeof fetch=="function",c=Px(i),d=Px(o);if(!l)return!1;const f=l&&Px(n),m=l&&(typeof s=="function"?(w=>_=>w.encode(_))(new s):async w=>new Uint8Array(await new i(w).arrayBuffer())),g=c&&f&&HO(()=>{let w=!1;const _=new i(fs.origin,{body:new n,method:"POST",get duplex(){return w=!0,"half"}}),N=_.headers.has("Content-Type");return _.body!=null&&_.body.cancel(),w&&!N}),x=d&&f&&HO(()=>ve.isReadableStream(new o("").body)),j={stream:x&&(w=>w.body)};l&&["text","arrayBuffer","blob","formData","stream"].forEach(w=>{!j[w]&&(j[w]=(_,N)=>{let C=_&&_[w];if(C)return C.call(_);throw new mt(`Response type '${w}' is not supported`,mt.ERR_NOT_SUPPORT,N)})});const b=async w=>{if(w==null)return 0;if(ve.isBlob(w))return w.size;if(ve.isSpecCompliantForm(w))return(await new i(fs.origin,{method:"POST",body:w}).arrayBuffer()).byteLength;if(ve.isArrayBufferView(w)||ve.isArrayBuffer(w))return w.byteLength;if(ve.isURLSearchParams(w)&&(w=w+""),ve.isString(w))return(await m(w)).byteLength},y=async(w,_)=>{const N=ve.toFiniteNumber(w.getContentLength());return N??b(_)};return async w=>{let{url:_,method:N,data:C,signal:k,cancelToken:S,timeout:A,onDownloadProgress:T,onUploadProgress:R,responseType:B,headers:D,withCredentials:P="same-origin",fetchOptions:I,maxContentLength:z,maxBodyLength:L}=iU(w);const H=ve.isNumber(z)&&z>-1,W=ve.isNumber(L)&&L>-1,V=ne=>ve.hasOwnProp(w,ne)?w[ne]:void 0;let K=a||fetch;B=B?(B+"").toLowerCase():"text";let M=vae([k,S&&S.toAbortSignal()],A),G=null;const q=M&&M.unsubscribe&&(()=>{M.unsubscribe()});let F,U=null;const ee=()=>new mt("Request body larger than maxBodyLength limit",mt.ERR_BAD_REQUEST,w,G);try{let ne;const X=V("auth");if(X){const Me=ve.getSafeProp(X,"username")||"",ue=ve.getSafeProp(X,"password")||"";ne={username:Me,password:ue}}if(Cae(_)){const Me=new URL(_,fs.origin);if(!ne&&(Me.username||Me.password)){const ue=VO(Me.username),Ve=VO(Me.password);ne={username:ue,password:Ve}}(Me.username||Me.password)&&(Me.username="",Me.password="",_=Me.href)}if(ne&&(D.delete("authorization"),D.set("Authorization","Basic "+btoa(kae((ne.username||"")+":"+(ne.password||""))))),H&&typeof _=="string"&&_.startsWith("data:")&&Sae(_)>z)throw new mt("maxContentLength size of "+z+" exceeded",mt.ERR_BAD_RESPONSE,w,G);if(W&&N!=="get"&&N!=="head"){const Me=await b(C);if(typeof Me=="number"&&isFinite(Me)&&(F=Me,Me>L))throw ee()}
vendor: 3,460 bytes, line 792
792const ie=W&&(ve.isReadableStream(C)||ve.isStream(C)),Z=(Me,ue,Ve)=>qO(Me,KO,Xe=>{if(W&&Xe>L)throw U=ee();ue&&ue(Xe)},Ve);if(g&&N!=="get"&&N!=="head"&&(R||ie)){if(F=F??await y(D,C),F!==0||ie){let Me=new i(_,{method:"POST",body:C,duplex:"half"}),ue;if(ve.isFormData(C)&&(ue=Me.headers.get("content-type"))&&D.setContentType(ue),Me.body){const[Ve,Xe]=R&&BO(F,U0(FO(R)))||[];C=Z(Me.body,Ve,Xe)}}}else if(ie&&!c&&f&&N!=="get"&&N!=="head")C=Z(C);else if(ie&&c&&!g&&N!=="get"&&N!=="head")throw new mt("Stream request bodies are not supported by the current fetch implementation",mt.ERR_NOT_SUPPORT,w,G);ve.isString(P)||(P=P?"include":"omit");const ce=c&&"credentials"in i.prototype;if(ve.isFormData(C)){const Me=D.getContentType();Me&&/^multipart\/form-data/i.test(Me)&&!/boundary=/i.test(Me)&&D.delete("content-type")}D.set("User-Agent","axios/"+iE,!1);const le={...I,signal:M,method:N.toUpperCase(),headers:Y7(D.normalize()),body:C,duplex:"half",credentials:ce?P:void 0};G=c&&new i(_,le);let re=await(c?K(G,I):K(_,le));const Ue=As.from(re.headers);if(H){const Me=ve.toFiniteNumber(Ue.getContentLength());if(Me!=null&&Me>z)throw new mt("maxContentLength size of "+z+" exceeded",mt.ERR_BAD_RESPONSE,w,G)}const Ne=x&&(B==="stream"||B==="response");if(x&&re.body&&(T||H||Ne&&q)){const Me={};["status","statusText","headers"].forEach(_e=>{Me[_e]=re[_e]});const ue=ve.toFiniteNumber(Ue.getContentLength()),[Ve,Xe]=T&&BO(ue,U0(FO(T),!0))||[];let te=0;const De=_e=>{if(H&&(te=_e,te>z))throw new mt("maxContentLength size of "+z+" exceeded",mt.ERR_BAD_RESPONSE,w,G);Ve&&Ve(_e)};re=new o(qO(re.body,KO,De,()=>{Xe&&Xe(),q&&q()}),Me)}B=B||"text";let Oe=await j[ve.findKey(j,B)||"text"](re,w);if(H&&!x&&!Ne){let Me;if(Oe!=null&&(typeof Oe.byteLength=="number"?Me=Oe.byteLength:typeof Oe.size=="number"?Me=Oe.size:typeof Oe=="string"&&(Me=typeof s=="function"?new s().encode(Oe).byteLength:Oe.length)),typeof Me=="number"&&Me>z)throw new mt("maxContentLength size of "+z+" exceeded",mt.ERR_BAD_RESPONSE,w,G)}return!Ne&&q&&q(),await new Promise((Me,ue)=>{sU(Me,ue,{data:Oe,headers:As.from(re.headers),status:re.status,statusText:re.statusText,config:w,request:G})})}catch(ne){if(q&&q(),M&&M.aborted&&M.reason instanceof mt){const X=M.reason;throw X.config=w,G&&(X.request=G),ne!==X&&Object.defineProperty(X,"cause",{__proto__:null,value:ne,writable:!0,enumerable:!1,configurable:!0}),X}if(U)throw G&&!U.request&&(U.request=G),U;if(ne instanceof mt)throw G&&!ne.request&&(ne.request=G),ne;if(ne&&ne.name==="TypeError"&&/Load failed|fetch/i.test(ne.message)){const X=new mt("Network Error",mt.ERR_NETWORK,w,G,ne&&ne.response);throw Object.defineProperty(X,"cause",{__proto__:null,value:ne.cause||ne,writable:!0,enumerable:!1,configurable:!0}),X}throw mt.from(ne,ne&&ne.code,w,G,ne&&ne.response)}}},Aae=new Map,oU=e=>{let t=e&&e.env||{};const{fetch:n,Request:s,Response:a}=t,i=[s,a,n];let o=i.length,l=o,c,d,f=Aae;for(;l--;)c=i[l],d=f.get(c),d===void 0&&f.set(c,d=l?new Map:Eae(t)),f=d;return d};oU();const oE={http:Use,xhr:bae,fetch:{get:oU}};ve.forEach(oE,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const WO=e=>`- ${e}`,Tae=e=>ve.isFunction(e)||e===null||e===!1;function Pae(e,t){e=ve.isArray(e)?e:[e];const{length:n}=e;let s,a;const i={};for(let o=0;o<n;o++){s=e[o];let l;if(a=s,!Tae(s)&&(a=oE[(l=String(s)).toLowerCase()],a===void 0))throw new mt(`Unknown adapter '${l}'`);
vendor: 5,732 bytes, lines 792-798
792if(a&&(ve.isFunction(a)||(a=a.get(t))))break;i[l||"#"+o]=a}if(!a){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
793`+o.map(WO).join(`
794`):" "+WO(o[0]):"as no adapter specified";throw new mt("There is no suitable adapter to dispatch the request "+l,mt.ERR_NOT_SUPPORT)}return a}const lU={getAdapter:Pae,adapters:oE};function Lj(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ag(null,e)}function GO(e){return Lj(e),e.headers=As.from(e.headers),e.data=Dj.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),lU.getAdapter(e.adapter||sg.adapter,e)(e).then(function(s){Lj(e),e.response=s;try{s.data=Dj.call(e,e.transformResponse,s)}finally{delete e.response}return s.headers=As.from(s.headers),s},function(s){if(!rU(s)&&(Lj(e),s&&s.response)){e.response=s.response;try{s.response.data=Dj.call(e,e.transformResponse,s.response)}finally{delete e.response}s.response.headers=As.from(s.response.headers)}return Promise.reject(s)})}const Cb={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Cb[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const YO={};Cb.transitional=function(t,n,s){function a(i,o){return"[Axios v"+iE+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return(i,o,l)=>{if(t===!1)throw new mt(a(o," has been removed"+(n?" in "+n:"")),mt.ERR_DEPRECATED);return n&&!YO[o]&&(YO[o]=!0,console.warn(a(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};Cb.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Oae(e,t,n){if(typeof e!="object"||e===null)throw new mt("options must be an object",mt.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let a=s.length;for(;a-- >0;){const i=s[a],o=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(o){const l=e[i],c=l===void 0||o(l,i,e);if(c!==!0)throw new mt("option "+i+" must be "+c,mt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new mt("Unknown option "+i,mt.ERR_BAD_OPTION)}}const v0={assertOptions:Oae,validators:Cb},_s=v0.validators;let bd=class{constructor(t){this.defaults=t||{},this.interceptors={request:new LO,response:new LO}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const i=(()=>{if(!a.stack)return"";const o=a.stack.indexOf(`
795`);return o===-1?"":a.stack.slice(o+1)})();try{if(!s.stack)s.stack=i;else if(i){const o=i.indexOf(`
796`),l=o===-1?-1:i.indexOf(`
797`,o+1),c=l===-1?"":i.slice(l+1);String(s.stack).endsWith(c)||(s.stack+=`
798`+i)}}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Cd(this.defaults,n);const{transitional:s,paramsSerializer:a,headers:i}=n;s!==void 0&&v0.assertOptions(s,{silentJSONParsing:_s.transitional(_s.boolean),forcedJSONParsing:_s.transitional(_s.boolean),clarifyTimeoutError:_s.transitional(_s.boolean),legacyInterceptorReqResOrdering:_s.transitional(_s.boolean),advertiseZstdAcceptEncoding:_s.transitional(_s.boolean),validateStatusUndefinedResolves:_s.transitional(_s.boolean)},!1),a!=null&&(ve.isFunction(a)?n.paramsSerializer={serialize:a}:v0.assertOptions(a,{encode:_s.function,serialize:_s.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),v0.assertOptions(n,{baseUrl:_s.spelling("baseURL"),withXsrfToken:_s.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&ve.merge(i.common,i[n.method]);i&&ve.forEach(["delete","get","head","post","put","patch","query","common"],j=>{delete i[j]}),n.headers=As.concat(o,i);const l=[];let c=!0;this.interceptors.request.forEach(function(b){if(typeof b.runWhen=="function"&&b.runWhen(n)===!1)return;c=c&&b.synchronous;const y=n.transitional||sE;y&&y.legacyInterceptorReqResOrdering?l.unshift(b.fulfilled,b.rejected):l.push(b.fulfilled,b.rejected)});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let f,m=0,g;if(!c){const j=[GO.bind(this),void 0];for(j.unshift(...l),j.push(...d),g=j.length,f=Promise.resolve(n);m<g;)f=f.then(j[m++],j[m++]);return f}g=l.length;let x=n;for(;m<g;){const j=l[m++],b=l[m++];try{x=j(x)}catch(y){b.call(this,y);break}}try{f=GO.call(this,x)}catch(j){return Promise.reject(j)}for(m=0,g=d.length;m<g;)f=f.then(d[m++],d[m++]);return f}getUri(t){t=Cd(this.defaults,t);const n=aU(t.baseURL,t.url,t.allowAbsoluteUrls,t);return eU(n,t.params,t.paramsSerializer)}};ve.forEach(["delete","get","head","options"],function(t){bd.prototype[t]=function(n,s){return this.request(Cd(s||{},{method:t,url:n,data:s&&ve.hasOwnProp(s,"data")?s.data:void 0}))}});ve.forEach(["post","put","patch","query"],function(t){function n(s){return function(i,o,l){return this.request(Cd(l||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}bd.prototype[t]=n(),t!=="query"&&(bd.prototype[t+"Form"]=n(!0))});let Iae=class cU{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const s=this;this.promise.then(a=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](a);s._listeners=null}),this.promise.then=a=>{let i;const o=new Promise(l=>{s.subscribe(l),i=l}).then(a);return o.cancel=function(){s.unsubscribe(i)},o},t(function(i,o,l){s.reason||(s.reason=new ag(i,o,l),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}
798subscribe(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)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new cU(function(a){t=a}),cancel:t}}};function Rae(e){return function(n){return e.apply(null,n)}}function Mae(e){return ve.isObject(e)&&e.isAxiosError===!0}const j2={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(j2).forEach(([e,t])=>{j2[t]=e});function dU(e){const t=new bd(e),n=F7(bd.prototype.request,t);return ve.extend(n,bd.prototype,t,{allOwnKeys:!0}),ve.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return dU(Cd(e,a))},n}const Tr=dU(sg);Tr.Axios=bd;Tr.CanceledError=ag;Tr.CancelToken=Iae;Tr.isCancel=rU;Tr.VERSION=iE;Tr.toFormData=kb;Tr.AxiosError=mt;Tr.Cancel=Tr.CanceledError;Tr.all=function(t){return Promise.all(t)};Tr.spread=Rae;Tr.isAxiosError=Mae;Tr.mergeConfig=Cd;Tr.AxiosHeaders=As;Tr.formToJSON=e=>nU(ve.isHTMLForm(e)?new FormData(e):e);Tr.getAdapter=lU.getAdapter;Tr.HttpStatusCode=j2;Tr.default=Tr;const{Axios:zFe,AxiosError:UFe,CanceledError:qFe,isCancel:KFe,CancelToken:VFe,VERSION:HFe,all:WFe,Cancel:GFe,isAxiosError:YFe,spread:JFe,toFormData:QFe,AxiosHeaders:XFe,HttpStatusCode:ZFe,formToJSON:eze,getAdapter:tze,mergeConfig:nze,create:rze}=Tr,uU=typeof window>"u",JO=!uU&&window.self!==window.top,Dae=!uU&&typeof document>"u",mU=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),cs=[];for(let e=0;e<256;++e)cs.push((e+256).toString(16).slice(1));function Lae(e,t=0){return(cs[e[t+0]]+cs[e[t+1]]+cs[e[t+2]]+cs[e[t+3]]+"-"+cs[e[t+4]]+cs[e[t+5]]+"-"+cs[e[t+6]]+cs[e[t+7]]+"-"+cs[e[t+8]]+cs[e[t+9]]+"-"+cs[e[t+10]]+cs[e[t+11]]+cs[e[t+12]]+cs[e[t+13]]+cs[e[t+14]]+cs[e[t+15]]).toLowerCase()}let $j;const $ae=new Uint8Array(16);function Bae(){if(!$j){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");$j=crypto.getRandomValues.bind(crypto)}return $j($ae)}const Fae=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),QO={randomUUID:Fae};function zae(e,t,n){var a;e=e||{};const s=e.random??((a=e.rng)==null?void 0:a.call(e))??Bae();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Lae(s)}function Uae(e,t,n){return QO.randomUUID&&!e?QO.randomUUID():zae(e)}const Uf=typeof window<"u"?window:{base44SharedInstances:{}};function qae(e,t){return Uf.base44SharedInstances||(Uf.base44SharedInstances={}),Uf.base44SharedInstances[e]||(Uf.base44SharedInstances[e]={instance:t()}),Uf.base44SharedInstances[e].instance}const Kae="__user_heartbeat_event__",Vae="__initialization_event__",Hae="__session_duration_event__",XO="analytics-enable",ZO="base44_analytics_session_id",Wae={enabled:!0,maxQueueSize:1e3,throttleTime:1e3,batchSize:30,heartBeatInterval:60*1e3},Gae="analytics",$n=qae(Gae,()=>({requestsQueue:[],isProcessing:!1,isHeartBeatProcessing:!1,wasInitializationTracked:!1,sessionContext:null,sessionStartTime:null,fallbackSessionId:null,config:{...Wae,...nie()}})),Yae=({axiosClient:e,serverUrl:t,appId:n,userAuthModule:s,enabled:a})=>{var i;const{maxQueueSize:o,throttleTime:l,batchSize:c}=$n.config;if(!a||!(!((i=$n.config)===null||i===void 0)&&i.enabled)||Dae)return{track:()=>{},cleanup:()=>{}};let d;const f=`${t}/api/apps/${n}/analytics/track/batch`,m=async C=>{await e.request({method:"POST",url:`/apps/${n}/analytics/track/batch`,data:{events:C}})},g=C=>{try{const k=JSON.stringify({events:C}),S=new Blob([k],{type:"application/json"});return typeof navigator>"u"||k.length>6e4||!navigator.sendBeacon(f,S)}catch{return!1}},x=async(C,k={})=>
798{if(C.length===0)return;const S=await tie(s),A=C.map(eie(S));try{(!k.isBeacon||!g(A))&&await m(A)}catch{}},j=()=>{t4(x,{throttleTime:l,batchSize:c})},b=C=>{if($n.requestsQueue.length>=o)return;const k=Zae();$n.requestsQueue.push({...C,...k}),j()},y=()=>{t4(x,{throttleTime:l,batchSize:c}),d=n4(b),Qae()},w=()=>{e4(),d==null||d(),Xae(b);const C=$n.requestsQueue.splice(0);x(C,{isBeacon:!0})},_=()=>{typeof window>"u"||(document.visibilityState==="hidden"?w():document.visibilityState==="visible"&&y())},N=()=>{e4(),d==null||d(),typeof window<"u"&&window.removeEventListener("visibilitychange",_)};return j(),d=n4(b),Jae(b),typeof window<"u"&&window.addEventListener("visibilitychange",_),{track:b,cleanup:N}};function e4(){$n.isProcessing=!1}async function t4(e,t){if($n.isProcessing)return;$n.isProcessing=!0;const{throttleTime:n=1e3,batchSize:s=30}=t??{};for(;$n.isProcessing&&$n.requestsQueue.length>0;){const a=$n.requestsQueue.splice(0,s);a.length&&await e(a),await new Promise(i=>setTimeout(i,n))}$n.isProcessing=!1}function n4(e){var t;if(typeof window>"u"||$n.isHeartBeatProcessing||((t=$n.config.heartBeatInterval)!==null&&t!==void 0?t:0)<10)return()=>{};$n.isHeartBeatProcessing=!0;const n=setInterval(()=>{e({eventName:Kae})},$n.config.heartBeatInterval);return()=>{clearInterval(n),$n.isHeartBeatProcessing=!1}}function Jae(e){typeof window>"u"||$n.wasInitializationTracked||($n.wasInitializationTracked=!0,e({eventName:Vae,properties:{referrer:document==null?void 0:document.referrer}}))}function Qae(){typeof window>"u"||$n.sessionStartTime!==null||($n.sessionStartTime=new Date().toISOString())}function Xae(e){if(typeof window>"u"||$n.sessionStartTime===null)return;const t=new Date().getTime()-new Date($n.sessionStartTime).getTime();$n.sessionStartTime=null,e({eventName:Hae,properties:{sessionDuration:t}})}function Zae(){var e,t;return{timestamp:new Date().toISOString(),pageUrl:typeof window<"u"&&(t=(e=window.location)===null||e===void 0?void 0:e.pathname)!==null&&t!==void 0?t:null}}function eie(e){return t=>({event_name:t.eventName,properties:t.properties,timestamp:t.timestamp,page_url:t.pageUrl,...e})}let fh=null;function r4(){$n.sessionContext=null,fh=null}async function tie(e){if(!$n.sessionContext){if(!e.hasToken())return{user_id:null,session_id:K0()};if(!fh){const s=K0();fh=e.me().then(a=>({user_id:a.id,session_id:s})).catch(()=>({user_id:null,session_id:s}))}const t=fh,n=await t;return fh===t&&($n.sessionContext=n),n}return $n.sessionContext}function nie(){if(typeof window>"u"||!window.location)return;const t=new URLSearchParams(window.location.search).get(XO);if(t==null||!t.length)return;const n=new URLSearchParams(window.location.search);n.delete(XO);const s=window.location.pathname+(n.toString()?"?"+n.toString():"");return window.history.replaceState({},"",s),{enabled:t==="true"}}function s4(){var e;return(e=$n.fallbackSessionId)!==null&&e!==void 0?e:$n.fallbackSessionId=mU()}function K0(){if(typeof window>"u")return s4();try{const e=localStorage.getItem(ZO);if(!e){const t=mU();return localStorage.setItem(ZO,t),t}return e}catch{return s4()}}class rie extends Error{constructor(t,n,s,a,i){super(t),this.name="Base44Error",this.status=n,this.code=s,this.data=a,this.originalError=i}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code,data:this.data}}}function Tu({baseURL:e,headers:t={},token:n,interceptResponses:s=!0,onError:a}){const i=Tr.create({baseURL:e,headers:{"Content-Type":"application/json",Accept:"application/json",...t}});return n&&(i.defaults.headers.common.Authorization=`Bearer ${n}`),i.interceptors.request.use(o=>{typeof window<"u"&&(window.location&&o.headers.set("X-Origin-URL",window.location.href),o.headers.get("Authorization")||o.headers.set("X-Base44-Anonymous-Id",K0()));const l=Uae();if(o.requestId=l,JO)try{window.parent.postMessage({type:"api-request-start",requestId:l,data:{url:e+o.url,method:o.method,body:o.data instanceof FormData?"[FormData object]":o.data}},"*")}catch{}return o}),s&&i.interceptors.response.use(o=>{var l;const c=(l=o.config)===null||l===void 0?void 0:l.requestId;try{JO&&c&&window.parent.postMessage({type:"api-request-end",requestId:c,data:{statusCode:o.status,response:o.data}},"*")}catch{}return o.data},o=>{var l,c,d,f,m,g,x,j,b,y,w,_;const N=(l=o.response)===null||l===void 0?void 0:l.data,C=((c=N==null?void 0:N.error)===null||c===void 0?void 0:c.message)||(N==null?void 0:N.message)||(N==null?void 0:N.detail)||o.message,k=new rie(C,(d=o.response)===null||d===void 0?void 0:d.status,(y=(g=(m=(f=N==null?void 0:N.error)===null||f===void 0?void 0:f.code)!==null&&m!==void 0?m:N==null?void 0:N.co
798de)!==null&&g!==void 0?g:(b=(j=(x=o.response)===null||x===void 0?void 0:x.headers)===null||j===void 0?void 0:j.get)===null||b===void 0?void 0:b.call(j,"x-base44-connector-error"))!==null&&y!==void 0?y:(_=(w=o.response)===null||w===void 0?void 0:w.headers)===null||_===void 0?void 0:_["x-base44-connector-error"],N,o);return a==null||a(k),Promise.reject(k)}),i}function a4(e){const{axios:t,appId:n,getSocket:s}=e;return new Proxy({},{get(a,i){if(!(typeof i!="string"||i==="then"||i.startsWith("_")))return iie(t,n,i,s)}})}function sie(e){var t;try{const n=JSON.parse(e);return{type:n.type,data:n.data,id:n.id||((t=n.data)===null||t===void 0?void 0:t.id),timestamp:n.timestamp||new Date().toISOString()}}catch(n){return console.warn("[Base44 SDK] Failed to parse realtime message:",n),null}}const aie=100;function i4(e){return typeof e=="object"&&e!==null}function iie(e,t,n,s){const a=`/apps/${t}/entities/${n}`,i=c=>Array.isArray(c)?c.join(","):c,o=(c,d,f,m,g)=>{const x={};return g&&(x.q=JSON.stringify(g)),c&&(x.sort=c),d&&(x.limit=d),f&&(x.skip=f),m&&(x.fields=i(m)),e.get(a,{params:x})},l=(c,d)=>{const f={};return d&&(f.q=JSON.stringify(d)),f.limit=c.limit||aie,c.cursor&&(f.cursor=c.cursor),"distinct"in c?f.distinct=c.distinct:(c.sort&&(f.sort=c.sort),c.fields&&(f.fields=i(c.fields))),e.get(`${a}/v2/list`,{params:f})};return{async list(...c){const[d,f,m,g]=c;return i4(d)?l(d):o(d,f,m,g)},async filter(c,...d){const[f,m,g,x]=d;return i4(f)?l(f,c):o(f,m,g,x,c)},async get(c){return e.get(`${a}/${c}`)},async create(c){return e.post(a,c)},async update(c,d){return e.put(`${a}/${c}`,d)},async delete(c){return e.delete(`${a}/${c}`)},async deleteMany(c){return e.delete(a,{data:c})},async bulkCreate(c){return e.post(`${a}/bulk`,c)},async updateMany(c,d){return e.patch(`${a}/update-many`,{query:c,data:d})},async count(c){const d={};return c&&(d.q=JSON.stringify(c)),(await e.get(`${a}/count`,{params:d})).count},async aggregate(c){return e.post(`${a}/aggregate`,c)},async upsert(c,d){return e.post(`${a}/upsert`,{records:c,key:d.key})},async bulkUpdate(c){return e.put(`${a}/bulk`,c)},async importEntities(c){const d=new FormData;return d.append("file",c,c.name),e.post(`${a}/import`,d,{headers:{"Content-Type":"multipart/form-data"}})},subscribe(c){const d=`entities:${t}:${n}`;return s().subscribeToRoom(d,{update_model:g=>{var x;const j=sie(g.data);if(j){j.type!=="delete"&&(!((x=j.data)===null||x===void 0)&&x._oversize)&&console.error(`[Base44 SDK] Realtime broadcast for ${n}#${j.id} was oversize and got slimmed for transport. Fields >10 KB are empty and the rest of the record may be a stub. Call \`entities.${n}.get("${j.id}")\` to fetch the full record.`);try{c(j)}catch(b){console.error("[Base44 SDK] Subscription callback error:",b)}}}})}}}function oie(e,t){return{async call(n,s,a){if(!(n!=null&&n.trim()))throw new Error("Integration slug is required and cannot be empty");if(!(s!=null&&s.trim()))throw new Error("Operation ID is required and cannot be empty");const{pathParams:i,queryParams:o,...l}=a??{},c={...l,...i&&{path_params:i},...o&&{query_params:o}};return await e.post(`/apps/${t}/integrations/custom/${n}/${s}`,c)}}}function o4(e,t){const n=oie(e,t);return new Proxy({},{get(s,a){if(!(typeof a!="string"||a==="then"||a.startsWith("_")))return a==="custom"?n:new Proxy({},{get(i,o){if(!(typeof o!="string"||o==="then"||o.startsWith("_")))return async l=>{if(typeof l=="string")throw new Error(`Integration ${o} must receive an object with named parameters, received: ${l}`);let c,d;return l instanceof FormData||l&&Object.values(l).some(f=>f instanceof File)?(c=new FormData,Object.keys(l).forEach(f=>{l[f]instanceof File?c.append(f,l[f],l[f].name):typeof l[f]=="object"&&l[f]!==null?c.append(f,JSON.stringify(l[f])):c.append(f,l[f])}),d="multipart/form-data"):(c=l,d="application/json"),a==="Core"?e.post(`/apps/${t}/integration-endpoints/Core/${o}`,c||l,{headers:{"Content-Type":d}}):e.post(`/apps/${t}/integration-endpoints/installable/${a}/integration-endpoints/${o}`,c||l,{headers:{"Content-Type":d}})}}})}})}function lie(){return typeof window>"u"?!1:window!==window.parent}function cie(e,t,n){const i=Math.round(window.screenX+(window.outerWidth-500)/2),o=Math.round(window.screenY+(window.outerHeight-600)/2),l=window.open(e,"base44_auth",`width=500,height=600,left=${i},top=${o},resizable=yes,scrollbars=yes`);if(!l)return;const c=()=>{window.removeEventListener("message",d),clearInterval(f),l.closed||l.close()},d=m=>{var g;if(m.origin!==n||m.source!==l||!(!((g=m.data)===null||g===void 0)&&g.access_token))return;c();const x=new URL(t),{access_token:j,is_new_user:b}=m.data;x.searchParams.set("access_token",j),b!=null&&x.searchParams.set("is_new_user",String(b)),window.location.href=x.toString()},f=setInterval(()=>{l.closed&&c()},500);window.addEventListener("message",d)}function die(e,t,n,s){let a=null;const i=()=>{a=null};let o=!!s.token;return{hasToken(){return o},async me(){const l=a??e.get(`/apps/${n}/entities/User/me`).finally(()=>{a===l&&(a=null)});return a=l,l},async updateMe(l){return e.put(`/apps/${n}/entities/User/me`,l)},redirectToLogin(l){if(typeof window>"u")throw new Error("Login method can only be used in a browser environment");const c=l?new URL(l,window.location.origin).toString():window.location.href,d=`${s.appBaseUrl}/login?from_url=${encodeURIComponent(c)}`;window.location.href=d},loginWithProvider(l,c="/"){const d=new URL(c,window.location.origin).toString(),f=`app_id=${n}&from_url=${encodeURIComponent(d)}`;let m;l==="sso"?m=`/apps/${n}/auth/sso/login`:m=`/apps/auth${l==="google"?"":`/${l}`}/login`;const g=`${s.appBaseUrl}/api${m}?${f}`;if(lie()){const x=`${g}&popup_origin=${encodeURIComponent(window.location.origin)}`;return cie(x,d,window.location.origin)}window.location.href=g},logout(l){if(delete e.defaults.headers.common.Authorization,i(),r4(),o=!1,typeof window<"u"){if(window.localStorage)try{window.localStorage.removeItem("base44_access_token"),window.localStorage.removeItem("token")}catch(f){console.error("Failed to remove token from localStorage:",f)}const c=l||window.location.href,d=`${s.appBaseUrl}/api/apps/auth/logout?from_url=${encodeURIComponent(c)}`;window.location.href=d}},setToken(l,c=!0){if(l&&(i(),r4(),o=!0,e.defaults.headers.common.Authorization=`Bearer ${l}`,t.defaults.headers.common.Authorization=`Bearer ${l}`,c&&typeof window<"u"&&window.localStorage))try{window.localStorage.setItem("base44_access_token",l),window.localStorage.setItem("token",l)}catch(d){console.error("Failed to save token to localStorage:",d)}},async loginViaEmailPassword(l,c,d){var f;try{const m=await e.post(`/apps/${n}/auth/login`,{email:l,password:c,...d&&{turnstile_token:d}}),{access_token:g,user:x}=m;return g&&this.setToken(g),{access_token:g,user:x}}catch(m){throw((f=m.response)===null||f===void 0?void 0:f.status)===401&&await this.logout(),m}},async isAuthenticated(){try{return await this.me(),!0}catch{return!1}},inviteUser(l,c){return e.post(`/apps/${n}/users/invite-user`,{user_email:l,role:c})},register(l){return e.post(`/apps/${n}/auth/register`,l)},verifyOtp({email:l,otpCode:c}){return e.post(`/apps/${n}/auth/verify-otp`,{email:l,otp_code:c})},resendOtp(l){return e.post(`/apps/${n}/auth/resend-otp`,{email:l})},resetPasswordRequest(l){return e.post(`/apps/${n}/auth/reset-password-request`,{email:l})},resetPassword({resetToken:l,newPassword:c}){return e.post(`/apps/${n}/auth/reset-password`,{reset_token:l,new_password:c})},changePassword({userId:l,currentPassword:c,newPassword:d}){return e.post(`/apps/${n}/auth/change-password`,{user_id:l,current_password:c,new_password:d})}}}function uie(e,t){return{async getAccessToken(n){const s=`/apps/${t}/auth/sso/accesstoken/${n}`;return e.get(s)},async getIdToken(n){const s=`/apps/${t}/auth/sso/idtoken/${n}`;return e.get(s)}}}const mie=new Set(["GET","POST","PUT","PATCH","DELETE","HEAD"]);
798function fie(e,t){return{async getAccessToken(n){if(!n||typeof n!="string")throw new Error("Integration type is required and must be a string");return(await e.get(`/apps/${t}/external-auth/tokens/${encodeURIComponent(n)}`)).access_token},async getConnection(n){var s;if(!n||typeof n!="string")throw new Error("Integration type is required and must be a string");const i=await e.get(`/apps/${t}/external-auth/tokens/${encodeURIComponent(n)}`);return{accessToken:i.access_token,connectionConfig:(s=i.connection_config)!==null&&s!==void 0?s:null}},async getWorkspaceConnection(n){var s;if(!n||typeof n!="string")throw new Error("Connector ID is required and must be a string");const i=await e.get(`/apps/${t}/external-auth/tokens/connectors/${encodeURIComponent(n)}`);return{accessToken:i.access_token,connectionConfig:(s=i.connection_config)!==null&&s!==void 0?s:null}},async getCurrentAppUserAccessToken(n){if(!n||typeof n!="string")throw new Error("Connector ID is required and must be a string");return(await e.get(`/apps/${t}/app-user-auth/connectors/${encodeURIComponent(n)}/token`)).access_token},async getCurrentAppUserConnection(n){var s;if(!n||typeof n!="string")throw new Error("Connector ID is required and must be a string");const i=await e.get(`/apps/${t}/app-user-auth/connectors/${encodeURIComponent(n)}/token`);return{accessToken:i.access_token,connectionConfig:(s=i.connection_config)!==null&&s!==void 0?s:null}},async callApi(n,s){return fU(n,"Integration type"),hie(e,`/apps/${t}/connectors/${encodeURIComponent(n)}/call`,s)}}}function fU(e,t){if(!e||typeof e!="string")throw new Error(`${t} is required and must be a string`)}async function hie(e,t,n){var s,a,i,o,l,c,d,f,m;if(!n||typeof n!="object")throw new Error("Request is required and must be an object");fU(n.path,"Request path");const g=(s=n.method)!==null&&s!==void 0?s:"GET";if(!mie.has(g))throw new Error("Request method must be one of GET, POST, PUT, PATCH, DELETE, or HEAD");const j=await e.post(t,{method:g,...n.host==null?{}:{host:n.host},path:n.path,query:(a=n.query)!==null&&a!==void 0?a:{},headers:(i=n.headers)!==null&&i!==void 0?i:{},body:(o=n.body)!==null&&o!==void 0?o:null});return{success:j.success,phase:j.phase,status:(l=j.status_code)!==null&&l!==void 0?l:null,data:j.data,dataBase64:(c=j.data_base64)!==null&&c!==void 0?c:null,contentType:(d=j.content_type)!==null&&d!==void 0?d:null,headers:(f=j.headers)!==null&&f!==void 0?f:{},creditsCharged:(m=j.credits_charged)!==null&&m!==void 0?m:0}}function pie(e,t){return{async connectAppUser(n){if(!n||typeof n!="string")throw new Error("Connector ID is required and must be a string");return(await e.post(`/apps/${t}/app-user-auth/connectors/${encodeURIComponent(n)}/initiate`)).redirect_url},async disconnectAppUser(n){if(!n||typeof n!="string")throw new Error("Connector ID is required and must be a string");await e.delete(`/apps/${t}/app-user-auth/connectors/${encodeURIComponent(n)}`)}}}function Ul(e={}){const{storageKey:t="base44_access_token",paramName:n="access_token",saveToStorage:s=!0,removeFromUrl:a=!0}=e;let i=null;if(typeof window<"u"&&window.location)try{const o=new URLSearchParams(window.location.search);if(i=o.get(n),i){if(s&&gie(i,{storageKey:t}),a){o.delete(n);const l=`${window.location.pathname}${o.toString()?`?${o.toString()}`:""}${window.location.hash}`;window.history.replaceState({},document.title,l)}return i}}catch(o){console.error("Error retrieving token from URL:",o)}if(typeof window<"u"&&window.localStorage)try{return i=window.localStorage.getItem(t),i}catch(o){console.error("Error retrieving token from local storage:",o)}return null}function gie(e,t){const{storageKey:n="base44_access_token"}=t;if(typeof window>"u"||!window.localStorage||!e)return!1;try{return window.localStorage.setItem(n,e),window.localStorage.setItem("token",e),!0}catch(s){return console.error("Error saving token to local storage:",s),!1}}function xie({axios:e,serviceRoleAxios:t,appId:n,serverUrl:s,functionsVersion:a,platformHeaders:i}){const o=new Headers(i),l=c=>{const d=c.defaults.headers.common.Authorization;return typeof d=="string"&&d.startsWith("Bearer ")?d:null};return async function(d,f={}){yie(d);const{fetch:m=fetch,...g}=f,x=new Headers(f.headers),j=(b,y)=>{y&&!x.has(b)&&x.set(b,y)};return j("Authorization",l(e)),j("Base44-Service-Authorization",l(t)),j("Base44-App-Id",n),j("Base44-Api-Url",s),j("Base44-Functions-Version",a),j("Base44-State",o.get("Base44-State")),j("X-Data-Env",o.get("X-Data-Env")),m(d,{...g,headers:x})}}function yie(e){if(typeof e!="string"||e==="")throw new Error("fetchWithAuth() requires a path, such as '/api/orders'.");const t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(!t.startsWith("/")||t.startsWith("//")||t.startsWith("/\\"))throw new Error(`fetchWithAuth() only sends requests to your app's own origin, so your app's credentials never reach a third party. "${e}" is not a path on it — pass a relative path such as '/api/orders'. Use base44.functions.fetch() to call a Base44 backend function, or plain fetch() for another origin.`)}function l4(e,t,n){const s=(i,o)=>i?`${String(i).replace(/\/$/,"")}${o}`:o,a=i=>{const o=new Headers;if(n!=null&&n.getAuthHeaders){const l=n.getAuthHeaders();Object.entries(l).forEach(([c,d])=>{d!=null&&o.set(c,String(d))})}
798return i&&new Headers(i).forEach((l,c)=>{o.set(c,l)}),o};return{async invoke(i,o){if(typeof o=="string")throw new Error(`Function ${i} must receive an object with named parameters, received: ${o}`);let l,c;return o instanceof FormData||o&&Object.values(o).some(d=>d instanceof File)?(l=new FormData,Object.keys(o).forEach(d=>{o[d]instanceof File?l.append(d,o[d],o[d].name):typeof o[d]=="object"&&o[d]!==null?l.append(d,JSON.stringify(o[d])):l.append(d,o[d])}),c="multipart/form-data"):(l=o,c="application/json"),e.post(`/apps/${t}/functions/${i}`,l||o,{headers:{"Content-Type":c}})},async fetch(i,o={}){const c=`/functions${i.startsWith("/")?i:`/${i}`}`,d=a(o.headers),f={...o,headers:d};return await fetch(s(n==null?void 0:n.baseURL,c),f)}}}function c4({axios:e,getSocket:t,appId:n,serverUrl:s,token:a}){const i=`/apps/${n}/agents`,o={},l=()=>e.get(`${i}/conversations`),c=b=>e.get(`${i}/conversations/${b}`);return{getConversations:l,getConversation:c,listConversations:b=>e.get(`${i}/conversations`,{params:b}),createConversation:b=>e.post(`${i}/conversations`,b),addMessage:async(b,y)=>e.post(`${i}/conversations/v2/${b.id}/messages`,y),subscribeToConversation:(b,y)=>{const w=`/agent-conversations/${b}`,_=t(),N=c(b).then(C=>(o[b]=C,C));return _.subscribeToRoom(w,{connect:()=>{},update_model:async({data:C})=>{const k=JSON.parse(C);if(k._message){await N;const S=k._message,A=o[b];if(A){const T=A.messages||[],R=T.findIndex(D=>D.id===S.id),B=R!==-1?T.map((D,P)=>P===R?S:D):[...T,S];o[b]={...A,messages:B},y==null||y(o[b])}}}})},getWhatsAppConnectURL:b=>{const y=`${s}/api/apps/${n}/agents/${encodeURIComponent(b)}/whatsapp`,w=a??Ul();return w?`${y}?token=${w}`:y},getTelegramConnectURL:b=>{const y=`${s}/api/apps/${n}/agents/${encodeURIComponent(b)}/telegram`,w=a??Ul();return w?`${y}?token=${w}`:y}}}const d4={openai:"openai",typesafe:"typesafe"};function u4({serverUrl:e,token:t,appId:n,headers:s={}}){return{connection:({provider:i="openai"}={})=>{var o;if(!Object.prototype.hasOwnProperty.call(d4,i))throw new Error(`Unsupported AI Gateway provider: ${i}`);const l=d4[i];return{baseURL:`${e}/api/apps/${n}/ai/${l}/v1`,token:(o=t??Ul())!==null&&o!==void 0?o:"",headers:{...s}}}}}function m4(e,t){const n=`/app-logs/${t}`;return{async logUserInApp(s){await e.post(`${n}/log-user-in-app/${s}`)},async fetchLogs(s={}){return await e.get(n,{params:s})},async getStats(s={}){return await e.get(`${n}/stats`,{params:s})}}}function bie(e,t){return{async getPublicSettings(){return e.get(`/apps/public/prod/public-settings/by-id/${t}`)}}}function vie(e,t){return{async inviteUser(n,s){if(s!=="user"&&s!=="admin")throw new Error(`Invalid role: "${s}". Role must be either "user" or "admin".`);return await e.post(`/apps/${t}/runtime/users/invite-user`,{user_email:n,role:s})}}}const io=Object.create(null);io.open="0";io.close="1";io.ping="2";io.pong="3";io.message="4";io.upgrade="5";io.noop="6";const w0=Object.create(null);Object.keys(io).forEach(e=>{w0[io[e]]=e});const _2={type:"error",data:"parser error"},hU=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",pU=typeof ArrayBuffer=="function",gU=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,lE=({type:e,data:t},n,s)=>hU&&t instanceof Blob?n?s(t):f4(t,s):pU&&(t instanceof ArrayBuffer||gU(t))?n?s(t):f4(new Blob([t]),s):s(io[e]+(t||"")),f4=(e,t)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];t("b"+(s||""))},n.readAsDataURL(e)};function h4(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Bj;function wie(e,t){if(hU&&e.data instanceof Blob)return e.data.arrayBuffer().then(h4).then(t);if(pU&&(e.data instanceof ArrayBuffer||gU(e.data)))return t(h4(e.data));lE(e,!1,n=>{Bj||(Bj=new TextEncoder),t(Bj.encode(n))})}const p4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<p4.length;e++)hh[p4.charCodeAt(e)]=e;const jie=e=>{let t=e.length*.75,n=e.length,s,a=0,i,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),f=new Uint8Array(d);for(s=0;s<n;s+=4)i=hh[e.charCodeAt(s)],o=hh[e.charCodeAt(s+1)],l=hh[e.charCodeAt(s+2)],c=hh[e.charCodeAt(s+3)],f[a++]=i<<2|o>>4,f[a++]=(o&15)<<4|l>>2,f[a++]=(l&3)<<6|c&63;return d},_ie=typeof ArrayBuffer=="function",cE=(e,t)=>{if(typeof e!="string")return{type:"message",data:xU(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Nie(e.substring(1),t)}:w0[n]?e.length>1?{type:w0[n],data:e.substring(1)}:{type:w0[n]}:_2},Nie=(e,t)=>{if(_ie){const n=jie(e);return xU(n,t)}else return{base64:!0,data:e}},xU=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},yU="�",Sie=(e,t)=>{const n=e.length,s=new Array(n);let a=0;e.forEach((i,o)=>{lE(i,!1,l=>{s[o]=l,++a===n&&t(s.join(yU))})})},kie=(e,t)=>{const n=e.split(yU),s=[];for(let a=0;a<n.length;a++){const i=cE(n[a],t);if(s.push(i),i.type==="error")break}return s};function Cie(){return new TransformStream({transform(e,t){wie(e,n=>{const s=n.length;let a;if(s<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,s);else if(s<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,s)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let Fj;function Ox(e){return e.reduce((t,n)=>t+n.length,0)}function Ix(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let s=0;for(let a=0;a<t;a++)n[a]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),n}function Eie(e,t){Fj||(Fj=new TextDecoder);const n=[];let s=0,a=-1,i=!1;return new TransformStream({transform(o,l){for(n.push(o);;){if(s===0){if(Ox(n)<1)break;const c=Ix(n,1);i=(c[0]&128)===128,a=c[0]&127,a<126?s=3:a===126?s=1:s=2}else if(s===1){if(Ox(n)<2)break;const c=Ix(n,2);a=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(Ox(n)<8)break;const c=Ix(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),f=d.getUint32(0);if(f>Math.pow(2,21)-1){l.enqueue(_2);break}a=f*Math.pow(2,32)+d.getUint32(4),s=3}else{if(Ox(n)<a)break;const c=Ix(n,a);l.enqueue(cE(i?c:Fj.decode(c),t)),s=0}if(a===0||a>e){l.enqueue(_2);break}}}})}const bU=4;function Lr(e){if(e)return Aie(e)}function Aie(e){for(var t in Lr.prototype)e[t]=Lr.prototype[t];return e}Lr.prototype.on=Lr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Lr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Lr.prototype.off=Lr.prototype.removeListener=Lr.prototype.removeAllListeners=Lr.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,a=0;a<n.length;a++)if(s=n[a],s===t||s.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this};Lr.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,a=n.length;s<a;++s)n[s].apply(this,t)}return this};Lr.prototype.emitReserved=Lr.prototype.emit;Lr.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Lr.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Eb=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Va=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Tie="arraybuffer";function vU(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const Pie=Va.setTimeout,Oie=Va.clearTimeout;function Ab(e,t){t.useNativeTimers?(e.setTimeoutFn=Pie.bind(Va),e.clearTimeoutFn=Oie.bind(Va)):(e.setTimeoutFn=Va.setTimeout.bind(Va),e.clearTimeoutFn=Va.clearTimeout.bind(Va))}const Iie=1.33;function Rie(e){return typeof e=="string"?Mie(e):Math.ceil((e.byteLength||e.size)*Iie)}function Mie(e){let t=0,n=0;for(let s=0,a=e.length;s<a;s++)t=e.charCodeAt(s),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(s++,n+=4);return n}function wU(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Die(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Lie(e){let t={},n=e.split("&");for(let s=0,a=n.length;s<a;s++){let i=n[s].split("=");
vendor: 6,278 bytes, line 798
798t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class $ie extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class dE extends Lr{constructor(t){super(),this.writable=!1,Ab(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,s){return super.emitReserved("error",new $ie(t,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=cE(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Die(t);return n.length?"?"+n:""}}class Bie extends dE{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};kie(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Sie(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=wU()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let jU=!1;try{jU=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Fie=jU;function zie(){}class Uie extends Bie{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,n){const s=this.request({method:"POST",data:t});s.on("success",n),s.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=t}}class Zi extends Lr{constructor(t,n,s){super(),this.createRequest=t,Ab(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var t;const n=vU(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&s.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var a;s.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=Zi.requestsCount++,Zi.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=zie,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Zi.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Zi.requestsCount=0;Zi.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",g4);else if(typeof addEventListener=="function"){const e="onpagehide"in Va?"pagehide":"unload";addEventListener(e,g4,!1)}}function g4(){for(let e in Zi.requests)Zi.requests.hasOwnProperty(e)&&Zi.requests[e].abort()}const qie=(function(){const e=_U({xdomain:!1});return e&&e.responseType!==null})();class Kie extends Uie{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=qie&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Zi(_U,this.uri(),t)}}function _U(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Fie))return new XMLHttpRequest}catch{}if(!t)try{return new Va[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const NU=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Vie extends dE{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=NU?{}:vU(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,s)}catch(a){return this.emitReserved("error",a)}
vendor: 16,028 bytes, line 798
798this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],a=n===t.length-1;lE(s,this.supportsBinary,i=>{try{this.doWrite(s,i)}catch{}a&&Eb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=wU()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const zj=Va.WebSocket||Va.MozWebSocket;class Hie extends Vie{createSocket(t,n,s){return NU?new zj(t,n,s):n?new zj(t,n):new zj(t)}doWrite(t,n){this.ws.send(n)}}class Wie extends dE{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=Eie(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),a=Cie();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const i=()=>{s.read().then(({done:l,value:c})=>{l||(this.onPacket(c),i())}).catch(l=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],a=n===t.length-1;this._writer.write(s).then(()=>{a&&Eb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Gie={websocket:Hie,webtransport:Wie,polling:Kie},Yie=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Jie=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function N2(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),s=e.indexOf("]");n!=-1&&s!=-1&&(e=e.substring(0,n)+e.substring(n,s).replace(/:/g,";")+e.substring(s,e.length));let a=Yie.exec(e||""),i={},o=14;for(;o--;)i[Jie[o]]=a[o]||"";return n!=-1&&s!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Qie(i,i.path),i.queryKey=Xie(i,i.query),i}function Qie(e,t){const n=/\/{2,9}/g,s=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Xie(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,a,i){a&&(n[a]=i)}),n}const S2=typeof addEventListener=="function"&&typeof removeEventListener=="function",j0=[];S2&&addEventListener("offline",()=>{j0.forEach(e=>e())},!1);class Yl extends Lr{constructor(t,n){if(super(),this.binaryType=Tie,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const s=N2(t);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=N2(n.host).host);Ab(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(s=>{const a=s.prototype.name;this.transports.push(a),this._transportsByName[a]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Lie(this.opts.query)),S2&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},j0.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=bU,n.transport=t,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Yl.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Yl.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const a=this.writeBuffer[s].data;if(a&&(n+=Rie(a)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Eb(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,s){return this._sendPacket("message",t,n,s),this}send(t,n,s){return this._sendPacket("message",t,n,s),this}_sendPacket(t,n,s,a){if(typeof n=="function"&&(a=n,n=void 0),typeof s=="function"&&(a=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const i={type:t,data:n,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():t()}):this.upgrading?s():t()),this}_onError(t){if(Yl.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),S2&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=j0.indexOf(this._offlineEventListener);s!==-1&&j0.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Yl.protocol=bU;class Zie extends Yl{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),s=!1;Yl.priorWebsocketSuccess=!1;const a=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!s)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Yl.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(f(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function i(){s||(s=!0,f(),n.close(),n=null)}const o=m=>{const g=new Error("probe error: "+m);g.transport=n.name,i(),this.emitReserved("upgradeError",g)};function l(){o("transport closed")}function c(){o("socket closed")}function d(m){n&&m.name!==n.name&&i()}const f=()=>{n.removeListener("open",a),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",d)};n.once("open",a),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&n.push(t[s]);return n}}let eoe=class extends Zie{constructor(t,n={}){const s=typeof t=="object"?t:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(a=>Gie[a]).filter(a=>!!a)),super(t,s)}};function toe(e,t="",n){let s=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),s=N2(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+t,s.href=s.protocol+"://"+i+(n&&n.port===s.port?"":":"+s.port),s}const noe=typeof ArrayBuffer=="function",roe=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,SU=Object.prototype.toString,soe=typeof Blob=="function"||typeof Blob<"u"&&SU.call(Blob)==="[object BlobConstructor]",aoe=typeof File=="function"||typeof File<"u"&&SU.call(File)==="[object FileConstructor]";function uE(e){return noe&&(e instanceof ArrayBuffer||roe(e))||soe&&e instanceof Blob||aoe&&e instanceof File}function _0(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,s=e.length;n<s;n++)if(_0(e[n]))return!0;return!1}if(uE(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return _0(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&_0(e[n]))return!0;return!1}function ioe(e){const t=[],n=e.data,s=e;return s.data=k2(n,t),s.attachments=t.length,{packet:s,buffers:t}}function k2(e,t){if(!e)return e;if(uE(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=k2(e[s],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=k2(e[s],t));return n}return e}function ooe(e,t){return e.data=C2(e.data,t),delete e.attachments,e}function C2(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=C2(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=C2(e[n],t));return e}const loe=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var vn;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(vn||(vn={}));class coe{constructor(t){this.replacer=t}encode(t){return(t.type===vn.EVENT||t.type===vn.ACK)&&_0(t)?this.encodeAsBinary({type:t.type===vn.EVENT?vn.BINARY_EVENT:vn.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===vn.BINARY_EVENT||t.type===vn.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=ioe(t),s=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(s),a}}class mE extends Lr{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const s=n.type===vn.BINARY_EVENT;s||n.type===vn.BINARY_ACK?(n.type=s?vn.EVENT:vn.ACK,this.reconstructor=new doe(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(uE(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const s={type:Number(t.charAt(0))};if(vn[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===vn.BINARY_EVENT||s.type===vn.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(i,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););s.nsp=t.substring(i,n)}else s.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const i=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}s.id=Number(t.substring(i,n+1))}
vendor: 4,508 bytes, line 798
798if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(mE.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case vn.CONNECT:return x4(n);case vn.DISCONNECT:return n===void 0;case vn.CONNECT_ERROR:return typeof n=="string"||x4(n);case vn.EVENT:case vn.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&loe.indexOf(n[0])===-1);case vn.ACK:case vn.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class doe{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=ooe(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function x4(e){return Object.prototype.toString.call(e)==="[object Object]"}const uoe=Object.freeze(Object.defineProperty({__proto__:null,Decoder:mE,Encoder:coe,get PacketType(){return vn}},Symbol.toStringTag,{value:"Module"}));function vi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const moe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class kU extends Lr{constructor(t,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[vi(t,"open",this.onopen.bind(this)),vi(t,"packet",this.onpacket.bind(this)),vi(t,"error",this.onerror.bind(this)),vi(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var s,a,i;if(moe.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:vn.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const f=this.ids++,m=n.pop();this._registerAckCallback(f,m),o.id=f}const l=(a=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||a===void 0?void 0:a.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var s;const a=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},a),o=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((s,a)=>{const i=(o,l)=>o?a(o):s(l);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...i)=>(this._queue[0],a!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:vn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}
vendor: 7,089 bytes, line 798
798_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case vn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case vn.EVENT:case vn.BINARY_EVENT:this.onevent(t);break;case vn.ACK:case vn.BINARY_ACK:this.onack(t);break;case vn.DISCONNECT:this.ondisconnect();break;case vn.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let s=!1;return function(...a){s||(s=!0,n.packet({type:vn.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:vn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,t.data)}}}function qm(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}qm.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};qm.prototype.reset=function(){this.attempts=0};qm.prototype.setMin=function(e){this.ms=e};qm.prototype.setMax=function(e){this.max=e};qm.prototype.setJitter=function(e){this.jitter=e};class E2 extends Lr{constructor(t,n){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Ab(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new qm({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||uoe;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new eoe(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const a=vi(n,"open",function(){s.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=vi(n,"error",i);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(a),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(vi(t,"ping",this.onping.bind(this)),vi(t,"data",this.ondata.bind(this)),vi(t,"error",this.onerror.bind(this)),vi(t,"close",this.onclose.bind(this)),vi(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Eb(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new kU(this,t,n),this.nsps[t]=s),s}_destroy(t){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let s=0;s<n.length;s++)this.engine.write(n[s],t.options)}
798cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const qf={};function N0(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=toe(e,t.path||"/socket.io"),s=n.source,a=n.id,i=n.path,o=qf[a]&&i in qf[a].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new E2(s,t):(qf[a]||(qf[a]=new E2(s,t)),c=qf[a]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(N0,{Manager:E2,Socket:kU,io:N0,connect:N0});const foe=250;function y4(e,t){var n;const s=(n=e.token)!==null&&n!==void 0?n:Ul(),a={app_id:e.appId};s?a.token=s:a.anonymous_id=K0();const i=N0(e.serverUrl,{path:e.mountPath,transports:e.transports,query:a});return i.on("connect",async()=>{var o;return console.log("connect",i.id),(o=t.connect)===null||o===void 0?void 0:o.call(t)}),i.on("update_model",async o=>{var l;return(l=t.update_model)===null||l===void 0?void 0:l.call(t,o)}),i.on("error",async o=>{var l;return(l=t.error)===null||l===void 0?void 0:l.call(t,o)}),i.on("connect_error",async o=>{var l;return console.error("connect_error",o),(l=t.error)===null||l===void 0?void 0:l.call(t,o)}),i}function hoe({config:e}){let t={...e};const n={},s={},a={connect:async()=>{const w=[];Object.keys(n).forEach(_=>{const N=g(_);N.length!==0&&(d(_),N.forEach(({connect:C})=>{const k=async()=>C==null?void 0:C();w.push(k())}))}),await Promise.all(w)},update_model:async w=>{const N=g(w.room).map(C=>{var k;return(k=C.update_model)===null||k===void 0?void 0:k.call(C,w)});await Promise.all(N)},error:async w=>{console.error("error",w);const _=Object.values(n).flat().map(N=>{var C;return(C=N.error)===null||C===void 0?void 0:C.call(N,w)});await Promise.all(_)}};let i=y4(e,a);function o(){l()}function l(){j(),i&&i.disconnect()}function c(w){o(),t={...t,...w},i=y4(t,a)}function d(w){i.emit("join",w)}function f(w){i.emit("leave",w)}async function m(w,_){var N;const C=JSON.stringify(_);return(N=a.update_model)===null||N===void 0?void 0:N.call(a,{room:w,data:C})}function g(w){var _;return(_=n[w])!==null&&_!==void 0?_:[]}function x(w){const _=s[w];_&&(clearTimeout(_),delete s[w])}function j(){Object.keys(s).forEach(w=>{var _,N;clearTimeout(s[w]),delete s[w],((N=(_=n[w])===null||_===void 0?void 0:_.length)!==null&&N!==void 0?N:0)===0&&delete n[w]})}function b(w){x(w),s[w]=setTimeout(()=>{var _,N;delete s[w],!(((N=(_=n[w])===null||_===void 0?void 0:_.length)!==null&&N!==void 0?N:0)>0)&&(f(w),delete n[w])},foe)}return{socket:i,subscribeToRoom:(w,_)=>{n[w]?x(w):(d(w),n[w]=[]),n[w].push(_);let N=!1;return()=>{var C,k;N||(N=!0,n[w]=(k=(C=n[w])===null||C===void 0?void 0:C.filter(S=>S!==_))!==null&&k!==void 0?k:[],n[w].length===0&&b(w))}},updateConfig:c,updateModel:m,disconnect:l}}(!globalThis.EventTarget||!globalThis.Event)&&console.error(`
799  PartySocket requires a global 'EventTarget' class to be available!
800  You can polyfill this global by adding this to your code before any partysocket imports: 
801  
802  \`\`\`
803  import 'partysocket/event-target-polyfill';
804  \`\`\`
805  Please file an issue at https://github.com/partykit/partykit if you're still having trouble.
806`);
vendor: 4,425 bytes, line 806
806var CU=class extends Event{constructor(t,n){super("error",n);Zn(this,"message");Zn(this,"error");this.message=t.message,this.error=t}},EU=class extends Event{constructor(t=1e3,n="",s){super("close",s);Zn(this,"code");Zn(this,"reason");Zn(this,"wasClean",!0);this.code=t,this.reason=n}},Uj={Event,ErrorEvent:CU,CloseEvent:EU};function poe(e,t){if(!e)throw new Error(t)}function goe(e){return new e.constructor(e.type,e)}function xoe(e){return"data"in e?new MessageEvent(e.type,e):"code"in e||"reason"in e?new EU(e.code||1999,e.reason||"unknown reason",e):"error"in e?new CU(e.error,e):new Event(e.type,e)}var gz,yoe=typeof process<"u"&&typeof((gz=process.versions)==null?void 0:gz.node)<"u"&&typeof document>"u",Rx=yoe?xoe:goe,qc={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},b4=!1,boe=class Wc extends EventTarget{constructor(n,s,a={}){super();Zn(this,"_ws");Zn(this,"_retryCount",-1);Zn(this,"_uptimeTimeout");Zn(this,"_connectTimeout");Zn(this,"_shouldReconnect",!0);Zn(this,"_connectLock",!1);Zn(this,"_binaryType","blob");Zn(this,"_closeCalled",!1);Zn(this,"_messageQueue",[]);Zn(this,"_url");Zn(this,"_protocols");Zn(this,"_options");Zn(this,"onclose",null);Zn(this,"onerror",null);Zn(this,"onmessage",null);Zn(this,"onopen",null);Zn(this,"_handleOpen",n=>{this._debug("open event");const{minUptime:s=qc.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),s),poe(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(a=>{var i;return(i=this._ws)==null?void 0:i.send(a)}),this._messageQueue=[],this.onopen&&this.onopen(n),this.dispatchEvent(Rx(n))});Zn(this,"_handleMessage",n=>{this._debug("message event"),this.onmessage&&this.onmessage(n),this.dispatchEvent(Rx(n))});Zn(this,"_handleError",n=>{this._debug("error event",n.message),this._disconnect(void 0,n.message==="TIMEOUT"?"timeout":void 0),this.onerror&&this.onerror(n),this._debug("exec error listeners"),this.dispatchEvent(Rx(n)),this._connect()});Zn(this,"_handleClose",n=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(n),this.dispatchEvent(Rx(n))});this._url=n,this._protocols=s,this._options=a,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return Wc.CONNECTING}get OPEN(){return Wc.OPEN}get CLOSING(){return Wc.CLOSING}get CLOSED(){return Wc.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(n){this._binaryType=n,this._ws&&(this._ws.binaryType=n)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((s,a)=>(typeof a=="string"?s+=a.length:a instanceof Blob?s+=a.size:s+=a.byteLength,s),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?Wc.CLOSED:Wc.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}close(n=1e3,s){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(n,s)}reconnect(n,s){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(n,s),this._connect())}send(n){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",n),this._ws.send(n);else{const{maxEnqueuedMessages:s=qc.maxEnqueuedMessages}=this._options;this._messageQueue.length<s&&(this._debug("enqueue",n),this._messageQueue.push(n))}}_debug(...n){this._options.debug&&console.log.apply(console,["RWS>",...n])}_getNextDelay(){const{reconnectionDelayGrowFactor:n=qc.reconnectionDelayGrowFactor,minReconnectionDelay:s=qc.minReconnectionDelay,maxReconnectionDelay:a=qc.maxReconnectionDelay}=this._options;let i=0;return this._retryCount>0&&(i=s*Math.pow(n,this._retryCount-1),i>a&&(i=a)),this._debug("next delay",i),i}
806_wait(){return new Promise(n=>{setTimeout(n,this._getNextDelay())})}_getNextProtocols(n){if(!n)return Promise.resolve(null);if(typeof n=="string"||Array.isArray(n))return Promise.resolve(n);if(typeof n=="function"){const s=n();if(!s)return Promise.resolve(null);if(typeof s=="string"||Array.isArray(s))return Promise.resolve(s);if(s.then)return s}throw Error("Invalid protocols")}_getNextUrl(n){if(typeof n=="string")return Promise.resolve(n);if(typeof n=="function"){const s=n();if(typeof s=="string")return Promise.resolve(s);if(s.then)return s}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:n=qc.maxRetries,connectionTimeout:s=qc.connectionTimeout}=this._options;if(this._retryCount>=n){this._debug("max retries reached",this._retryCount,">=",n);return}this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then(()=>Promise.all([this._getNextUrl(this._url),this._getNextProtocols(this._protocols||null)])).then(([a,i])=>{if(this._closeCalled){this._connectLock=!1;return}!this._options.WebSocket&&typeof WebSocket>"u"&&!b4&&(console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket. 
807
808For example, if you're using node.js, run \`npm install ws\`, and then in your code:
809
810import PartySocket from 'partysocket';
811import WS from 'ws';
812
813const partysocket = new PartySocket({
814  host: "127.0.0.1:1999",
815  room: "test-room",
816  WebSocket: WS
817});
818
819`),b4=!0);const o=this._options.WebSocket||WebSocket;this._debug("connect",{url:a,protocols:i}),this._ws=i?new o(a,i):new o(a),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),s)}).catch(a=>{this._connectLock=!1,this._handleError(new Uj.ErrorEvent(Error(a.message),this))})}_handleTimeout(){this._debug("timeout event"),this._handleError(new Uj.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(n=1e3,s){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(n,s),this._handleClose(new Uj.CloseEvent(n,s,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};/*!
820 * Reconnecting WebSocket
821 * by Pedro Ladaria <[email protected]>
822 * https://github.com/pladaria/reconnecting-websocket
823 * License MIT
824 */const voe=1e3,woe=3e3,joe=new Set([405,409,422,503]),_oe=new Set([400,403,404]);function Noe(e){const t=e&&typeof e=="object"?e.status:void 0;return typeof t=="number"?t:void 0}function Soe(e){return e instanceof Error?e:new Error(String(e))}class koe{constructor(t,n,s,a,i){var o;this.onClose=i,this.listeners=new Set,this.heartbeat=null,this.closed=!1,this.id=(o=a==null?void 0:a.id)!==null&&o!==void 0?o:crypto.randomUUID();let l=s.transport==="proxy";const c=async()=>{var g;if(this.closed)throw new Error("Actor connection is closed");if(!l)try{const{websocket_url:x,token:j}=await s.mintConnectionToken(t,n,this.id),b=x.includes("?")?"&":"?";return`${x}${b}token=${encodeURIComponent(j)}`}catch(x){const j=Noe(x);if(!(s.transport!=="direct"&&j!==void 0&&joe.has(j))){j!==void 0&&_oe.has(j)&&this.close();try{(g=s.onMintError)===null||g===void 0||g.call(s,Soe(x))}catch{}throw x}l=!0}return Eoe(s.host,t,n,this.id,s.appId,s.getAuthToken(),s.functionsVersion)},d=new boe(c);this.ws=d;let f=Date.now();const m=()=>{f=Date.now()};d.addEventListener("open",m),d.addEventListener("message",g=>{m();let x;try{x=JSON.parse(g.data)}catch{return}if((x&&typeof x=="object"?x.type:void 0)!=="__pong")for(const b of this.listeners)b(x)}),this.heartbeat=setInterval(()=>{if(Date.now()-f>woe){m(),d.readyState===d.OPEN&&d.reconnect();return}try{d.send(JSON.stringify({type:"__ping"}))}catch{}},voe)}subscribe(t){return this.listeners.add(t),{unsubscribe:()=>{this.listeners.delete(t)}}}send(t){this.closed||this.ws.send(JSON.stringify(t))}close(){this.closed||(this.closed=!0,this.heartbeat&&(clearInterval(this.heartbeat),this.heartbeat=null),this.listeners.clear(),this.ws.close(),this.onClose())}}function Coe(e,t,n,s){let a=null;return{connect(i){if(a)return a;const o=new koe(e,t,n,i,()=>{s.delete(o),a===o&&(a=null)});return a=o,s.add(o),o}}}function Eoe(e,t,n,s,a,i,o){let l=e.replace(/^(http|https|ws|wss):\/\//,"");l.endsWith("/")&&(l=l.slice(0,-1));const c=l.startsWith("localhost:")||l.startsWith("127.0.0.1:")||l.startsWith("192.168.")||l.startsWith("10.")||l.startsWith("172.")&&l.split(".")[1]>="16"&&l.split(".")[1]<="31"||l.startsWith("[::ffff:7f00:1]:"),d=new URLSearchParams([["_pk",s],["app_id",a],["handler",t]]);
824return i&&d.append("token",i),o&&d.append("fv",o),`${c?"ws":"wss"}://${l}/parties/${t}/${n}?${d}`}function Aoe(e,t){return e&&!e.startsWith("/")?e:t??e}function Toe(e){const t=new Set;return{module:new Proxy({},{get(s,a){if(!(typeof a!="string"||a==="then"))return i=>Coe(a,i,e,t)}}),closeAll:()=>{for(const s of[...t])s.close()}}}function Poe(e){var t,n,s,a;const{serverUrl:i="https://base44.app",appId:o,analytics:l,token:c,serviceToken:d,requiresAuth:f=!1,appBaseUrl:m,options:g,functionsVersion:x,headers:j}=e,b=typeof m=="string"?m:"",y={serverUrl:i,mountPath:"/ws-user-apps/socket.io/",transports:["websocket"],appId:o,token:c};let w=null;const _=()=>(w||(w=hoe({config:y})),w),N={...j,"X-App-Id":String(o)},C=j==null?void 0:j["Base44-State"],k=C?{"Base44-State":C}:{},S=x?{...N,"Base44-Functions-Version":x}:N,A=Tu({baseURL:`${i}/api`,headers:N,token:c,onError:g==null?void 0:g.onError}),T=Tu({baseURL:`${i}/api`,headers:S,token:c,interceptResponses:!1,onError:g==null?void 0:g.onError}),R={...N,...c?{"on-behalf-of":`Bearer ${c}`}:{}},B=Tu({baseURL:`${i}/api`,headers:R,token:d,onError:g==null?void 0:g.onError}),D=Tu({baseURL:`${i}/api`,headers:S,token:d,interceptResponses:!1}),P=Tu({baseURL:`${i}/api`,headers:N}),I=die(A,T,o,{appBaseUrl:b,token:c});if(typeof window<"u"){const V=c||Ul();V&&I.setToken(V)}const z=Toe({appId:o,host:Aoe(i,typeof window<"u"?(t=window.location)===null||t===void 0?void 0:t.origin:void 0),functionsVersion:x,getAuthToken:()=>c||Ul(),mintConnectionToken:async(V,K,M)=>{const G=c||Ul();return await P.post(`/apps/${o}/actors/${encodeURIComponent(V)}/connection-token`,{room:K,connection_id:M},{headers:{...G?{Authorization:`Bearer ${G}`}:{},...x?{"Base44-Functions-Version":x}:{}}})},transport:g==null?void 0:g.actorsTransport,onMintError:g==null?void 0:g.onError}),L={entities:a4({axios:A,appId:o,getSocket:_}),integrations:o4(A,o),connectors:pie(A,o),auth:I,functions:l4(T,o,{getAuthHeaders:()=>{const V={},K=c||Ul();return K&&(V.Authorization=`Bearer ${K}`),V},baseURL:(n=T.defaults)===null||n===void 0?void 0:n.baseURL}),agents:c4({axios:A,getSocket:_,appId:o,serverUrl:i,token:c}),aiGateway:u4({serverUrl:i,token:c,appId:o,headers:k}),appLogs:m4(A,o),app:bie(A,o),users:vie(A,o),analytics:Yae({axiosClient:A,serverUrl:i,appId:o,userAuthModule:I,enabled:(s=l==null?void 0:l.enabled)!==null&&s!==void 0?s:!0}),actors:z.module,cleanup:()=>{L.analytics.cleanup(),z.closeAll(),w&&w.disconnect()}},H={entities:a4({axios:B,appId:o,getSocket:_}),integrations:o4(B,o),sso:uie(B,o),connectors:fie(B,o),functions:l4(D,o,{getAuthHeaders:()=>{const V={};return d&&(V.Authorization=`Bearer ${d}`),V},baseURL:(a=D.defaults)===null||a===void 0?void 0:a.baseURL}),agents:c4({axios:B,getSocket:_,appId:o,serverUrl:i,token:c}),aiGateway:u4({serverUrl:i,token:d,appId:o,headers:k}),appLogs:m4(B,o),cleanup:()=>{w&&w.disconnect()}};return f&&typeof window<"u"&&setTimeout(async()=>{try{await L.auth.isAuthenticated()||L.auth.redirectToLogin(window.location.href)}catch(V){console.error("Authentication check failed:",V),L.auth.redirectToLogin(window.location.href)}},0),{...L,fetchWithAuth:xie({axios:A,serviceRoleAxios:B,appId:String(o),serverUrl:i,functionsVersion:x,platformHeaders:j}),setToken(V){L.auth.setToken(V),w&&w.updateConfig({token:V}),y.token=V},getConfig(){return{serverUrl:i,appId:o,requiresAuth:f}},get asServiceRole(){if(!d)throw new Error("Service token is required to use asServiceRole. Please provide a serviceToken when creating the client.");return H}}}const AU=typeof window>"u",Ooe=AU?{localStorage:new Map}:window,jh=Ooe.localStorage,Ioe=e=>e.replace(/([A-Z])/g,"_$1").toLowerCase(),xu=(e,{defaultValue:t=void 0,removeFromUrl:n=!1}={})=>{if(AU)return t;const s=`base44_${Ioe(e)}`,a=new URLSearchParams(window.location.search),i=a.get(e);if(n){a.delete(e);const l=`${window.location.pathname}${a.toString()?`?${a.toString()}`:""}${window.location.hash}`;window.history.replaceState({},document.title,l)}if(i)return jh.setItem(s,i),i;if(t)return jh.setItem(s,t),t;const o=jh.getItem(s);return o||null},Roe=()=>(xu("clear_access_token")==="true"&&(jh.removeItem("base44_access_token"),jh.removeItem("token")),{appId:xu("app_id",{defaultValue:"69a08931b5cc2a35e746378a"}),token:xu("access_token",{removeFromUrl:!0}),fromUrl:xu("from_url",{defaultValue:window.location.href}),functionsVersion:xu("functions_version",{defaultValue:"prod"}),appBaseUrl:xu("app_base_url",{defaultValue:void 0})}),rd={...Roe()},{appId:Moe,token:Doe,functionsVersion:Loe,appBaseUrl:$oe}=rd,Y=Poe({appId:Moe,token:Doe,functionsVersion:Loe,serverUrl:"",requiresAuth:!1,appBaseUrl:$oe});var Boe=Symbol.for("react.lazy"),V0=yb[" use ".trim().toString()];function Foe(e){return typeof e=="object"&&e!==null&&"then"in e}function TU(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Boe&&"_payload"in e&&Foe(e._payload)}function fE(e){const t=Uoe(e),n=h.forwardRef((s,a)=>{let{children:i,...o}=s;TU(i)&&typeof V0=="function"&&(i=V0(i._payload));const l=h.Children.toArray(i),c=l.find(Koe);if(c){const d=c.props.children,f=l.map(m=>m===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:m);return r.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,f):null})}return r.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var zoe=fE("Slot");function Uoe(e){const t=h.forwardRef((n,s)=>{let{children:a,...i}=n;
824if(TU(a)&&typeof V0=="function"&&(a=V0(a._payload)),h.isValidElement(a)){const o=Hoe(a),l=Voe(i,a.props);return a.type!==h.Fragment&&(l.ref=s?ei(s,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qoe=Symbol("radix.slottable");function Koe(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qoe}function Voe(e,t){const n={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Hoe(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Woe=jb("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),de=h.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...a},i)=>{const o=s?zoe:"button";return r.jsx(o,{className:rn(Woe({variant:t,size:n,className:e})),ref:i,...a})});de.displayName="Button";/**
825 * @remix-run/router v1.23.2
826 *
827 * Copyright (c) Remix Software Inc.
828 *
829 * This source code is licensed under the MIT license found in the
830 * LICENSE.md file in the root directory of this source tree.
831 *
832 * @license MIT
833 */function Uh(){return Uh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Uh.apply(this,arguments)}var ql;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(ql||(ql={}));const v4="popstate";function Goe(e){e===void 0&&(e={});function t(s,a){let{pathname:i,search:o,hash:l}=s.location;return A2("",{pathname:i,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(s,a){return typeof a=="string"?a:H0(a)}return Joe(t,n,null,e)}function Er(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function hE(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Yoe(){return Math.random().toString(36).substr(2,8)}function w4(e,t){return{usr:e.state,key:e.key,idx:t}}function A2(e,t,n,s){return n===void 0&&(n=null),Uh({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Km(t):t,{state:n,key:t&&t.key||s||Yoe()})}function H0(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Km(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function Joe(e,t,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:i=!1}=s,o=a.history,l=ql.Pop,c=null,d=f();d==null&&(d=0,o.replaceState(Uh({},o.state,{idx:d}),""));function f(){return(o.state||{idx:null}).idx}function m(){l=ql.Pop;let y=f(),w=y==null?null:y-d;d=y,c&&c({action:l,location:b.location,delta:w})}function g(y,w){l=ql.Push;let _=A2(b.location,y,w);d=f()+1;let N=w4(_,d),C=b.createHref(_);try{o.pushState(N,"",C)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;a.location.assign(C)}i&&c&&c({action:l,location:b.location,delta:1})}function x(y,w){l=ql.Replace;let _=A2(b.location,y,w);d=f();let N=w4(_,d),C=b.createHref(_);o.replaceState(N,"",C),i&&c&&c({action:l,location:b.location,delta:0})}function j(y){let w=a.location.origin!=="null"?a.location.origin:a.location.href,_=typeof y=="string"?y:H0(y);return _=_.replace(/ $/,"%20"),Er(w,"No window.location.(origin|href) available to create URL for href: "+_),new URL(_,w)}let b={get action(){return l},get location(){return e(a,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(v4,m),c=y,()=>{a.removeEventListener(v4,m),c=null}},createHref(y){return t(a,y)},createURL:j,encodeLocation(y){let w=j(y);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:g,replace:x,go(y){return o.go(y)}};return b}var j4;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(j4||(j4={}));function Qoe(e,t,n){return n===void 0&&(n="/"),Xoe(e,t,n)}function Xoe(e,t,n,s){let a=typeof t=="string"?Km(t):t,i=pE(a.pathname||"/",n);if(i==null)return null;let o=PU(e);Zoe(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=ule(i);l=lle(o[c],d)}return l}function PU(e,t,n,s){t===void 0&&(t=[]),n===void 0&&(n=[]),s===void 0&&(s="");let a=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Er(c.relativePath.startsWith(s),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+s+'" is not val
833id. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(s.length));let d=Jl([s,c.relativePath]),f=n.concat(c);i.children&&i.children.length>0&&(Er(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),PU(i.children,t,f,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:ile(d,i.index),routesMeta:f})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,o);else for(let c of OU(i.path))a(i,o,c)}),t}function OU(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return a?[i,""]:[i];let o=OU(s.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Zoe(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ole(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const ele=/^:[\w-]+$/,tle=3,nle=2,rle=1,sle=10,ale=-2,_4=e=>e==="*";function ile(e,t){let n=e.split("/"),s=n.length;return n.some(_4)&&(s+=ale),t&&(s+=nle),n.filter(a=>!_4(a)).reduce((a,i)=>a+(ele.test(i)?tle:i===""?rle:sle),s)}function ole(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function lle(e,t,n){let{routesMeta:s}=e,a={},i="/",o=[];for(let l=0;l<s.length;++l){let c=s[l],d=l===s.length-1,f=i==="/"?t:t.slice(i.length)||"/",m=cle({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},f),g=c.route;if(!m)return null;
vendor: 4,811 bytes, lines 833-842
833Object.assign(a,m.params),o.push({params:a,pathname:Jl([i,m.pathname]),pathnameBase:gle(Jl([i,m.pathnameBase])),route:g}),m.pathnameBase!=="/"&&(i=Jl([i,m.pathnameBase]))}return o}function cle(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=dle(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:s.reduce((d,f,m)=>{let{paramName:g,isOptional:x}=f;if(g==="*"){let b=l[m]||"";o=i.slice(0,i.length-b.length).replace(/(.)\/+$/,"$1")}const j=l[m];return x&&!j?d[g]=void 0:d[g]=(j||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function dle(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),hE(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 s=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(s.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function ule(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return hE(!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 pE(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}const mle=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fle=e=>mle.test(e);function hle(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?Km(e):e,i;if(n)if(fle(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),hE(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=N4(n.substring(1),"/"):i=N4(n,t)}else i=t;return{pathname:i,search:xle(s),hash:yle(a)}}function N4(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function qj(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function ple(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function gE(e,t){let n=ple(e);return t?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function xE(e,t,n,s){s===void 0&&(s=!1);let a;typeof e=="string"?a=Km(e):(a=Uh({},e),Er(!a.pathname||!a.pathname.includes("?"),qj("?","pathname","search",a)),Er(!a.pathname||!a.pathname.includes("#"),qj("#","pathname","hash",a)),Er(!a.search||!a.search.includes("#"),qj("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=n;else{let m=t.length-1;if(!s&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;a.pathname=g.join("/")}l=m>=0?t[m]:"/"}let c=hle(a,l),d=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||f)&&(c.pathname+="/"),c}const Jl=e=>e.join("/").replace(/\/\/+/g,"/"),gle=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),xle=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,yle=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ble(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const IU=["post","put","patch","delete"];new Set(IU);const vle=["get",...IU];new Set(vle);/**
834 * React Router v6.30.3
835 *
836 * Copyright (c) Remix Software Inc.
837 *
838 * This source code is licensed under the MIT license found in the
839 * LICENSE.md file in the root directory of this source tree.
840 *
841 * @license MIT
842 */function qh(){return qh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},qh.apply(this,arguments)}const yE=h.createContext(null),wle=h.createContext(null),gc=h.createContext(null),Tb=h.createContext(null),tl=h.createContext({outlet:null,matches:[],isDataRoute:!1}),RU=h.createContext(null);function jle(e,t){let{relative:n}=t===void 0?{}:t;Vm()||Er(!1);let{basename:s,navigator:a}=h.useContext(gc),{hash:i,pathname:o,search:l}=DU(e,{relative:n}),c=o;
vendor: 5,048 bytes, line 842
842return s!=="/"&&(c=o==="/"?s:Jl([s,o])),a.createHref({pathname:c,search:l,hash:i})}function Vm(){return h.useContext(Tb)!=null}function Ud(){return Vm()||Er(!1),h.useContext(Tb).location}function MU(e){h.useContext(gc).static||h.useLayoutEffect(e)}function Ca(){let{isDataRoute:e}=h.useContext(tl);return e?Lle():_le()}function _le(){Vm()||Er(!1);let e=h.useContext(yE),{basename:t,future:n,navigator:s}=h.useContext(gc),{matches:a}=h.useContext(tl),{pathname:i}=Ud(),o=JSON.stringify(gE(a,n.v7_relativeSplatPath)),l=h.useRef(!1);return MU(()=>{l.current=!0}),h.useCallback(function(d,f){if(f===void 0&&(f={}),!l.current)return;if(typeof d=="number"){s.go(d);return}let m=xE(d,JSON.parse(o),i,f.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Jl([t,m.pathname])),(f.replace?s.replace:s.push)(m,f.state,f)},[t,s,o,i,e])}const Nle=h.createContext(null);function Sle(e){let t=h.useContext(tl).outlet;return t&&h.createElement(Nle.Provider,{value:e},t)}function DU(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=h.useContext(gc),{matches:a}=h.useContext(tl),{pathname:i}=Ud(),o=JSON.stringify(gE(a,s.v7_relativeSplatPath));return h.useMemo(()=>xE(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function kle(e,t){return Cle(e,t)}function Cle(e,t,n,s){Vm()||Er(!1);let{navigator:a}=h.useContext(gc),{matches:i}=h.useContext(tl),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=Ud(),f;if(t){var m;let y=typeof t=="string"?Km(t):t;c==="/"||(m=y.pathname)!=null&&m.startsWith(c)||Er(!1),f=y}else f=d;let g=f.pathname||"/",x=g;if(c!=="/"){let y=c.replace(/^\//,"").split("/");x="/"+g.replace(/^\//,"").split("/").slice(y.length).join("/")}let j=Qoe(e,{pathname:x}),b=Ole(j&&j.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:Jl([c,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:Jl([c,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,n,s);return t&&b?h.createElement(Tb.Provider,{value:{location:qh({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:ql.Pop}},b):b}function Ele(){let e=Dle(),t=ble(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:a},n):null,null)}const Ale=h.createElement(Ele,null);class Tle extends h.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?h.createElement(tl.Provider,{value:this.props.routeContext},h.createElement(RU.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Ple(e){let{routeContext:t,match:n,children:s}=e,a=h.useContext(yE);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(tl.Provider,{value:t},s)}function Ole(e,t,n,s){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=s)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(a=n)==null?void 0:a.errors;if(l!=null){let f=o.findIndex(m=>m.route.id&&(l==null?void 0:l[m.route.id])!==void 0);f>=0||Er(!1),o=o.slice(0,Math.min(o.length,f+1))}let c=!1,d=-1;if(n&&s&&s.v7_partialHydration)for(let f=0;f<o.length;f++){let m=o[f];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(d=f),m.route.id){let{loaderData:g,errors:x}=n,j=m.route.loader&&g[m.route.id]===void 0&&(!x||x[m.route.id]===void 0);if(m.route.lazy||j){c=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let x,j=!1,b=null,y=null;n&&(x=l&&m.route.id?l[m.route.id]:void 0,b=m.route.errorElement||Ale,c&&(d<0&&g===0?($le("route-fallback"),j=!0,y=null):d===g&&(j=!0,y=m.route.hydrateFallbackElement||null)));let w=t.concat(o.slice(0,g+1)),_=()=>{let N;return x?N=b:j?N=y:m.route.Component?N=h.createElement(m.route.Component,null):m.route.element?N=m.route.element:N=f,h.createElement(Ple,{match:m,routeContext:{outlet:f,matches:w,isDataRoute:n!=null},children:N})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?h.createElement(Tle,{location:n.location,revalidation:n.revalidation,component:b,error:x,children:_(),routeC
842ontext:{outlet:null,matches:w,isDataRoute:!0}}):_()},null)}var LU=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(LU||{}),$U=(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})($U||{});function Ile(e){let t=h.useContext(yE);return t||Er(!1),t}function Rle(e){let t=h.useContext(wle);return t||Er(!1),t}function Mle(e){let t=h.useContext(tl);return t||Er(!1),t}function BU(e){let t=Mle(),n=t.matches[t.matches.length-1];return n.route.id||Er(!1),n.route.id}function Dle(){var e;let t=h.useContext(RU),n=Rle(),s=BU();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function Lle(){let{router:e}=Ile(LU.UseNavigateStable),t=BU($U.UseNavigateStable),n=h.useRef(!1);return MU(()=>{n.current=!0}),h.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,qh({fromRouteId:t},i)))},[e,t])}const S4={};function $le(e,t,n){S4[e]||(S4[e]=!0)}function Ble(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function k4(e){let{to:t,replace:n,state:s,relative:a}=e;Vm()||Er(!1);let{future:i,static:o}=h.useContext(gc),{matches:l}=h.useContext(tl),{pathname:c}=Ud(),d=Ca(),f=xE(t,gE(l,i.v7_relativeSplatPath),c,a==="path"),m=JSON.stringify(f);return h.useEffect(()=>d(JSON.parse(m),{replace:n,state:s,relative:a}),[d,m,a,n,s]),null}function Fle(e){return Sle(e.context)}function on(e){Er(!1)}function zle(e){let{basename:t="/",children:n=null,location:s,navigationType:a=ql.Pop,navigator:i,static:o=!1,future:l}=e;Vm()&&Er(!1);let c=t.replace(/^\/*/,"/"),d=h.useMemo(()=>({basename:c,navigator:i,static:o,future:qh({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof s=="string"&&(s=Km(s));let{pathname:f="/",search:m="",hash:g="",state:x=null,key:j="default"}=s,b=h.useMemo(()=>{let y=pE(f,c);return y==null?null:{location:{pathname:y,search:m,hash:g,state:x,key:j},navigationType:a}},[c,f,m,g,x,j,a]);return b==null?null:h.createElement(gc.Provider,{value:d},h.createElement(Tb.Provider,{children:n,value:b}))}function Ule(e){let{children:t,location:n}=e;return kle(T2(t),n)}new Promise(()=>{});function T2(e,t){t===void 0&&(t=[]);let n=[];return h.Children.forEach(e,(s,a)=>{if(!h.isValidElement(s))return;let i=[...t,a];if(s.type===h.Fragment){n.push.apply(n,T2(s.props.children,i));return}s.type!==on&&Er(!1),!s.props.index||!s.props.children||Er(!1);let o={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(o.children=T2(s.props.children,i)),n.push(o)}),n}/**
843 * React Router DOM v6.30.3
844 *
845 * Copyright (c) Remix Software Inc.
846 *
847 * This source code is licensed under the MIT license found in the
848 * LICENSE.md file in the root directory of this source tree.
849 *
850 * @license MIT
851 */function P2(){return P2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},P2.apply(this,arguments)}function qle(e,t){if(e==null)return{};var n={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Kle(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Vle(e,t){return e.button===0&&(!t||t==="_self")&&!Kle(e)}function O2(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function Hle(e,t){let n=O2(e);return t&&t.forEach((s,a)=>
851{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}const Wle=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Gle="6";try{window.__reactRouterVersion=Gle}catch{}const Yle="startTransition",C4=yb[Yle];function Jle(e){let{basename:t,children:n,future:s,window:a}=e,i=h.useRef();i.current==null&&(i.current=Goe({window:a,v5Compat:!0}));let o=i.current,[l,c]=h.useState({action:o.action,location:o.location}),{v7_startTransition:d}=s||{},f=h.useCallback(m=>{d&&C4?C4(()=>c(m)):c(m)},[c,d]);return h.useLayoutEffect(()=>o.listen(f),[o,f]),h.useEffect(()=>Ble(s),[s]),h.createElement(zle,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:s})}const Qle=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Xle=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,wt=h.forwardRef(function(t,n){let{onClick:s,relative:a,reloadDocument:i,replace:o,state:l,target:c,to:d,preventScrollReset:f,viewTransition:m}=t,g=qle(t,Wle),{basename:x}=h.useContext(gc),j,b=!1;if(typeof d=="string"&&Xle.test(d)&&(j=d,Qle))try{let N=new URL(window.location.href),C=d.startsWith("//")?new URL(N.protocol+d):new URL(d),k=pE(C.pathname,x);C.origin===N.origin&&k!=null?d=k+C.search+C.hash:b=!0}catch{}let y=jle(d,{relative:a}),w=Zle(d,{replace:o,state:l,target:c,preventScrollReset:f,relative:a,viewTransition:m});function _(N){s&&s(N),N.defaultPrevented||w(N)}return h.createElement("a",P2({},g,{href:j||y,onClick:b||i?s:_,ref:n,target:c}))});var E4;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(E4||(E4={}));var A4;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(A4||(A4={}));function Zle(e,t){let{target:n,replace:s,state:a,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=Ca(),d=Ud(),f=DU(e,{relative:o});return h.useCallback(m=>{if(Vle(m,n)){m.preventDefault();let g=s!==void 0?s:H0(d)===H0(f);c(e,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:l})}},[d,c,f,s,a,n,e,i,o,l])}function FU(e){let t=h.useRef(O2(e)),n=h.useRef(!1),s=Ud(),a=h.useMemo(()=>Hle(s.search,n.current?null:t.current),[s.search]),i=Ca(),o=h.useCallback((l,c)=>{const d=O2(typeof l=="function"?l(a):l);n.current=!0,i("?"+d,c)},[i,a]);return[a,o]}function yt(e){return"/"+e.replace(/ /g,"-")}const It=h.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:rn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...n}));It.displayName="Input";function Pb({value:e,onChange:t,hidePreview:n=!1}){const[s,a]=h.useState("upload"),[i,o]=h.useState(""),[l,c]=h.useState(!1);async function d(m){var j;const g=(j=m.target.files)==null?void 0:j[0];if(!g)return;c(!0);const{file_url:x}=await Y.integrations.Core.UploadFile({file:g});t(x),c(!1)}async function f(){if(!i.trim())return;c(!0);const{url:m}=await Y.integrations.Core.GenerateImage({prompt:`A clean, minimalist icon for: ${i}. Simple flat design, transparent or white background, suitable as a small app icon.`});t(m),c(!1)}return r.jsxs("div",{className:"flex items-center gap-3",children:[!n&&r.jsx("div",{className:"w-14 h-14 rounded-xl border bg-gray-50 flex items-center justify-center overflow-hidden shrink-0",children:e?r.jsx("img",{src:e,alt:"icon",className:"w-full h-full object-contain"}):r.jsx(Xz,{className:"w-6 h-6 text-gray-300"})}),r.jsx("div",{className:"flex-1 space-y-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:d,disabled:l}),r.jsxs(de,{variant:"outline",size:"sm",className:"gap-1.5 pointer-events-none h-7 text-xs",disabled:l,children:[l&&s==="upload"?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(G5,{className:"w-3 h-3"}),"Upload"]})]}),r.jsx("span",{className:"text-xs text-gray-400",children:"or generate with AI:"}),r.jsx(It,{value:i,onChange:m=>o(m.target.value),placeholder:"Describe icon...",className:"text-xs h-7 flex-1",onKeyDown:m=>m.key==="Enter"&&f()}),r.jsxs(de,{size:"sm",onClick:f,disabled:l||!i.trim(),className:"gap-1 shrink-0 h-7 text-xs",children:[l&&s==="ai"?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Yn,{className:"w-3 h-3"}),"Generate"]}),e&&r.jsx("button",{onClick:()=>t(""),className:"text-xs text-gray-400 hover:text-red-500 shrink-0",children:"Remove"})]})})]})}const ece=["Test","Investigation","Knowledge","Learning Assistant"];
851function T4({value:e,onChange:t}){const n=h.useRef(null),s=h.useRef(!1);h.useEffect(()=>{n.current&&!s.current&&n.current.innerHTML!==(e||"")&&(n.current.innerHTML=e||""),s.current=!1},[e]);const a=()=>{s.current=!0,t(n.current.innerHTML)},i=(l,c)=>{var d;(d=n.current)==null||d.focus(),document.execCommand(l,!1,c||null),s.current=!0,t(n.current.innerHTML)},o=()=>{const l=prompt("Enter URL:");l&&i("createLink",l)};return r.jsxs("div",{className:"border-t",children:[r.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b bg-gray-50",children:[r.jsx("button",{type:"button",onMouseDown:l=>{l.preventDefault(),i("bold")},className:"p-1 rounded hover:bg-gray-200 text-gray-600",title:"Bold",children:r.jsx(Wz,{className:"w-3.5 h-3.5"})}),r.jsx("button",{type:"button",onMouseDown:l=>{l.preventDefault(),i("italic")},className:"p-1 rounded hover:bg-gray-200 text-gray-600",title:"Italic",children:r.jsx(Zz,{className:"w-3.5 h-3.5"})}),r.jsx("button",{type:"button",onMouseDown:l=>{l.preventDefault(),i("insertUnorderedList")},className:"p-1 rounded hover:bg-gray-200 text-gray-600",title:"Bullet list",children:r.jsx(Bm,{className:"w-3.5 h-3.5"})}),r.jsx("button",{type:"button",onMouseDown:l=>{l.preventDefault(),o()},className:"p-1 rounded hover:bg-gray-200 text-gray-600",title:"Insert link",children:r.jsx(Qp,{className:"w-3.5 h-3.5"})})]}),r.jsx("div",{ref:n,contentEditable:!0,onInput:a,className:"min-h-[80px] px-3 py-2 text-sm text-gray-700 focus:outline-none prose prose-sm max-w-none",style:{lineHeight:"1.5"},"data-placeholder":"Welcome message shown on the landing page...",suppressContentEditableWarning:!0}),r.jsx("style",{children:`
852        [data-placeholder]:empty:before {
853          content: attr(data-placeholder);
854          color: #aaa;
855          pointer-events: none;
856        }
857      `})]})}function tce({data:e,setData:t,iconExpanded:n,setIconExpanded:s}){const[a,i]=h.useState(!1),[o,l]=h.useState(!1),[c,d]=h.useState(!1);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl border bg-gray-50 flex items-center justify-center overflow-hidden shrink-0 mt-1",children:e.icon_url?r.jsx("img",{src:e.icon_url,alt:"icon",className:"w-full h-full object-contain"}):r.jsx("div",{className:"w-5 h-5 rounded-full bg-gray-200"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("input",{value:e.name,onChange:f=>t({...e,name:f.target.value}),placeholder:"Assistant name...",className:"text-xl font-bold text-gray-900 w-full border-0 border-b-2 border-transparent focus:border-indigo-400 focus:outline-none bg-transparent placeholder-gray-300 pb-0.5"}),r.jsx(It,{value:e.description,onChange:f=>t({...e,description:f.target.value}),placeholder:"Description (optional)",className:"text-xs text-gray-500 mt-1 h-7 border-0 border-b border-gray-100 focus:border-indigo-300 rounded-none px-0 focus-visible:ring-0 shadow-none"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 border-b border-gray-100",children:[r.jsx("span",{className:"text-[10px] text-gray-400 shrink-0 font-medium",children:"Key:"}),r.jsx("input",{value:e.assistant_key||"",onChange:f=>t({...e,assistant_key:f.target.value.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}),placeholder:"assistant-key",className:"text-xs text-gray-500 h-7 border-0 focus:outline-none bg-transparent placeholder-gray-300 font-mono flex-1"}),r.jsxs("select",{value:e.embed_page_type||"original",onChange:f=>t({...e,embed_page_type:f.target.value}),className:"text-[10px] text-gray-500 border border-gray-200 rounded-md px-1.5 py-0.5 bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 shrink-0",title:"Which embedded landing page this assistant is accessible on",children:[r.jsx("option",{value:"original",children:"Original"}),r.jsx("option",{value:"learning",children:"Learning"})]})]}),e.assistant_key&&r.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[r.jsx("a",{href:(e.embed_page_type||"original")==="learning"?`/LearningAssistant/v2/${e.assistant_key}`:`/assistant/${e.assistant_key}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-indigo-500 hover:text-indigo-700 font-mono underline underline-offset-2 break-all",children:(e.embed_page_type||"original")==="learning"?`${window.location.origin}/LearningAssistant/v2/${e.assistant_key}`:`${window.location.origin}/assistant/${e.assistant_key}`}),r.jsx(yr,{className:"w-3 h-3 text-indigo-400 shrink-0"})]}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 border-b border-gray-100",children:[r.jsx("span",{className:"text-[10px] text-gray-400 shrink-0 font-medium",children:"Tab title:"}),r.jsx("input",{value:e.chat_title||"",onChange:f=>t({...e,chat_title:f.target.value}),placeholder:"Browser tab title...",className:"text-xs text-gray-500 h-7 border-0 focus:outline-none bg-transparent placeholder-gray-300 flex-1"})]}),r.jsxs("div",{className:"mt-2 border border-gray-100 rounded-lg overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>i(f=>!f),className:"w-full flex items-center gap-2 px-2 py-1.5 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsx("span",{className:"text-[10px] text-gray-400 font-medium flex-1",children:"Public page welcome message"}),a?r.jsx(gt,{className:"w-3 h-3 text-gray-400"}):r.jsx(en,{className:"w-3 h-3 text-gray-400"})]}),a&&r.jsx(T4,{value:e.public_page_message||"",onChange:f=>t({...e,public_page_message:f})})]}),r.jsxs("div",{className:"mt-2 border border-gray-100 rounded-lg overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>l(f=>!f),className:"w-full flex items-center gap-2 px-2 py-1.5 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsx("span",{className:"text-[10px] text-gray-400 font-medium flex-1",children:"Page-aware welcome (Current page mode)"}),o?r.jsx(gt,{className:"w-3 h-3 text-gray-400"}):r.jsx(en,{className:"w-3 h-3 text-gray-400"})]}),o&&r.jsxs("div",{children:[r.jsx(T4,{value:e.page_aware_welcome||"",onChange:f=>t({...e,page_aware_welcome:f})}),r.jsxs("p",{className:"px-3 py-1.5 text-[10px] text-gray-400 bg-gray-50 border-t",children:['Shown when a page URL is present and the assistant is in "Current page" mode. Use ',r.jsx("code",{className:"text-indigo-500 font-mono",children:"{{page_name}}"})," to insert the page name. Falls back to the public page welcome if empty."]})]})]}),r.jsx("div",{className:"mt-2",children:r.jsxs("div",{className:"flex items-center gap-2 border-b border-gray-100",children:[r.jsx("span",{className:"text-[10px] text-gray-400 shrink-0 font-medium",children:"AI Memory label:"}),r.jsx("input",{value:e.library_label||"",onChange:f=>t({...e,library_label:f.target.value}
857),placeholder:"e.g. POCUS Library (shown when in Whole library mode)",className:"text-xs text-gray-500 h-7 border-0 focus:outline-none bg-transparent placeholder-gray-300 flex-1"})]})}),r.jsxs("div",{className:"mt-2 border border-gray-100 rounded-lg overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>d(f=>!f),className:"w-full flex items-center gap-2 px-2 py-1.5 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsx("span",{className:"text-[10px] text-gray-400 font-medium flex-1",children:"Disclaimer (shown below the chat input)"}),c?r.jsx(gt,{className:"w-3 h-3 text-gray-400"}):r.jsx(en,{className:"w-3 h-3 text-gray-400"})]}),c&&r.jsx("textarea",{value:e.disclaimer||"",onChange:f=>t({...e,disclaimer:f.target.value}),placeholder:"e.g. AI may make mistakes. Verify important information.",className:"w-full px-3 py-2 text-xs text-gray-700 focus:outline-none resize-none border-t",rows:3})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsx("select",{value:e.type,onChange:f=>t({...e,type:f.target.value}),className:"border rounded-lg px-3 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:ece.map(f=>r.jsx("option",{value:f,children:f},f))}),r.jsxs("select",{value:e.status,onChange:f=>t({...e,status:f.target.value}),className:"border rounded-lg px-3 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"inactive",children:"Inactive"})]}
857),r.jsxs("select",{value:e.embed_debug_mode||"system",onChange:f=>t({...e,embed_debug_mode:f.target.value}),className:"border rounded-lg px-3 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",title:"Debug mode for the chat landing page",children:[r.jsx("option",{value:"system",children:"🔧 System (AppConfig)"}),r.jsx("option",{value:"production",children:"🟢 Production"}),r.jsx("option",{value:"debug",children:"🟡 Debug Mode"})]})]}),r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("button",{onClick:()=>s(f=>!f),className:"w-full flex items-center gap-2 px-4 py-2.5 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsx(Zee,{className:"w-3.5 h-3.5 text-gray-400"}),r.jsx("span",{className:"text-xs font-medium text-gray-500",children:"Icon / Appearance"}),r.jsx("span",{className:"ml-auto",children:n?r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400"}):r.jsx(en,{className:"w-3.5 h-3.5 text-gray-400"})})]}),n&&r.jsxs("div",{className:"px-4 py-3 border-t bg-white flex items-center gap-3 flex-wrap",children:[r.jsx("span",{className:"text-xs text-gray-400 shrink-0",children:"Icon:"}),r.jsx(Pb,{value:e.icon_url,onChange:f=>t({...e,icon_url:f}),hidePreview:!0})]})]})]})}const rr=h.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:rn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));rr.displayName="Textarea";var nce=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rce=nce.reduce((e,t)=>{const n=fE(`Primitive.${t}`),s=h.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),sce="Label",zU=h.forwardRef((e,t)=>r.jsx(rce.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));zU.displayName=sce;var UU=zU;const ace=jb("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ot=h.forwardRef(({className:e,...t},n)=>r.jsx(UU,{ref:n,className:rn(ace(),e),...t}));ot.displayName=UU.displayName;const ice=jb("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Gr({className:e,variant:t,...n}){return r.jsx("div",{className:rn(ice({variant:t}),e),...n})}const bE=h.createContext(null);function qU({data:e={},onChange:t,readOnly:n=!1}){const[s,a]=h.useState(""),[i,o]=h.useState(!1),l=(f,m)=>t({...e,[f]:m}),c=f=>{const m={...e};delete m[f],t(m)},d=()=>{s.trim()&&(t({...e,[s.trim()]:""}),a(""),o(!1))};return r.jsxs("div",{className:"space-y-2",children:[Object.entries(e).map(([f,m])=>r.jsx(lce,{fieldKey:f,value:m,readOnly:n,onChange:g=>l(f,g),onRemove:()=>c(f)},f)),Object.keys(e).length===0&&!i&&r.jsx("p",{className:"text-xs text-gray-400 italic",children:"Empty object."}),!n&&(i?r.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[r.jsx(It,{autoFocus:!0,value:s,onChange:f=>a(f.target.value),onKeyDown:f=>{f.key==="Enter"&&d(),f.key==="Escape"&&o(!1)},placeholder:"key name",className:"h-8 text-xs w-40"}),r.jsx("button",{onClick:d,className:"text-xs text-indigo-600 hover:underline font-medium",children:"Add"}),r.jsx("button",{onClick:()=>{o(!1),a("")},className:"text-xs text-gray-400 hover:text-gray-600",children:"Cancel"})]}):r.jsxs("button",{onClick:()=>o(!0),className:"flex items-center gap-1 text-xs text-indigo-600 hover:underline pt-1",children:[r.jsx(ln,{className:"w-3 h-3"})," Add field"]}))]})}const oce=["string","number","integer","boolean","object","array","null"];function lce({fieldKey:e,value:t,onChange:n,onRemove:s,readOnly:a}){const i=t!==null&&typeof t=="object"&&!Array.isArray(t),o=Array.isArray(t),l=e==="type"&&typeof t=="string",c=typeof t=="boolean",d=typeof t=="number",f=typeof t=="string"&&t.length>60&&!l;return r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"shrink-0 w-36 text-xs font-semibold text-gray-500 pt-2 truncate",title:e,children:e}),r.jsx("div",{className:"flex-1 min-w-0",children:i?r.jsx(VU,{value:t,onChange:n,readOnly:a}):l?r.jsx("select",{value:t,disabled:a,onChange:m=>n(m.target.value),className:"h-8 w-full border rounded-md text-sm px-2 bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 disabled:bg-gray-50 font-mono",children:oce.map(m=>r.jsx("option",{value:m,children:m},m))}):o?r.jsx(KU,{value:t,onChange:n,readOnly:a}):c?r.jsxs("select",{value:String(t),disabled:a,onChange:m=>n(m.target.value==="true"),className:"h-8 w-full border rounded-md text-sm px-2 bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 disabled:bg-gray-50",children:[r.jsx("option",{value:"true",children:"true"}),r.jsx("option",{value:"false",children:"false"})]}):d?r.jsx(It,{type:"number",value:t,disabled:a,onChange:m=>n(Number(m.target.value)),className:"h-8 text-sm"}):f?r.jsx(rr,{value:t,disabled:a,onChange:m=>n(m.target.value),className:"text-sm min-h-[64px]"}):r.jsx(It,{value:t??"",disabled:a,onChange:m=>n(m.target.value),className:"h-8 text-sm"})}),!a&&r.jsx("button",{onClick:s,className:"shrink-0 mt-2 text-gray-300 hover:text-red-500 transition-colors",title:"Remove",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]})}
857function KU({value:e,onChange:t,readOnly:n}){const s=h.useContext(bE),[a,i]=h.useState(!1);h.useEffect(()=>{(s==null?void 0:s.signal)==="expand"?i(!0):(s==null?void 0:s.signal)==="collapse"&&i(!1)},[s==null?void 0:s.signal]);const o=e.length,l=(f,m)=>{const g=[...e];g[f]=m,t(g)},c=f=>t(e.filter((m,g)=>g!==f)),d=()=>{const f=e.some(m=>m!==null&&typeof m=="object"&&!Array.isArray(m));t([...e,f?{}:""])};return e.length>0&&e.every(f=>f!==null&&typeof f=="object"&&!Array.isArray(f)),r.jsxs("div",{className:"border rounded-md bg-gray-50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>i(f=>!f),className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-gray-500 hover:text-gray-800 w-full text-left",children:[a?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"}),r.jsx("span",{children:a?"collapse":"expand"}),r.jsxs("span",{className:"text-gray-400",children:["(",o," ",o===1?"item":"items",")"]})]}),a&&r.jsxs("div",{className:"px-3 pb-3 border-t bg-white space-y-2 pt-2",children:[e.map((f,m)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"shrink-0 w-6 text-xs text-gray-400 pt-2 text-right",children:m}),r.jsx("div",{className:"flex-1 min-w-0",children:f!==null&&typeof f=="object"&&!Array.isArray(f)?r.jsx(VU,{value:f,onChange:g=>l(m,g),readOnly:n}):Array.isArray(f)?r.jsx(KU,{value:f,onChange:g=>l(m,g),readOnly:n}):r.jsx(It,{value:f??"",disabled:n,onChange:g=>l(m,g.target.value),className:"h-8 text-sm"})}),!n&&r.jsx("button",{onClick:()=>c(m),className:"shrink-0 mt-2 text-gray-300 hover:text-red-500 transition-colors",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]},m)),e.length===0&&r.jsx("p",{className:"text-xs text-gray-400 italic",children:"Empty array."}),!n&&(e.length===0?r.jsxs("div",{className:"flex items-center gap-3 pt-1",children:[r.jsxs("button",{onClick:()=>t([...e,{}]),className:"flex items-center gap-1 text-xs text-indigo-600 hover:underline",children:[r.jsx(ln,{className:"w-3 h-3"})," Add object item"]}),r.jsxs("button",{onClick:()=>t([...e,""]),className:"flex items-center gap-1 text-xs text-gray-500 hover:underline",children:[r.jsx(ln,{className:"w-3 h-3"})," Add string item"]})]}):r.jsxs("button",{onClick:d,className:"flex items-center gap-1 text-xs text-indigo-600 hover:underline pt-1",children:[r.jsx(ln,{className:"w-3 h-3"})," Add item"]}))]})]})}function VU({value:e,onChange:t,readOnly:n}){const s=h.useContext(bE),[a,i]=h.useState(!1),o=Object.keys(e).length;return h.useEffect(()=>{(s==null?void 0:s.signal)==="expand"?i(!0):(s==null?void 0:s.signal)==="collapse"&&i(!1)},[s==null?void 0:s.signal]),r.jsxs("div",{className:"border rounded-md bg-gray-50 overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>i(l=>!l),className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-gray-500 hover:text-gray-800 w-full text-left",children:[a?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"}),r.jsx("span",{children:a?"collapse":"expand"}),r.jsxs("span",{className:"text-gray-400",children:["(",o," ",o===1?"field":"fields",")"]})]}),a&&r.jsx("div",{className:"px-3 pb-3 border-t bg-white",children:r.jsx(qU,{data:e,onChange:t,readOnly:n})})]})}function Ed({title:e,description:t,value:n={},onChange:s,onLoadDefault:a,aiPrompt:i,extraHeaderContent:o,objectType:l=""}){const[c,d]=h.useState(null),[f,m]=h.useState(!1),[g,x]=h.useState(""),[j,b]=h.useState(""),[y,w]=h.useState([]),[_,N]=h.useState(!1),[C,k]=h.useState(""),[S,A]=h.useState(!1),T=new Set(["string","number","integer","boolean","object","array","null"]);function R(W,V=""){const K=[];if(!W||typeof W!="object"||Array.isArray(W))return K;for(const[M,G]of Object.entries(W)){const q=V?`${V}.${M}`:M;M==="type"&&typeof G=="string"&&!T.has(G)&&K.push(`"${q}" has invalid value "${G}"`),G&&typeof G=="object"&&!Array.isArray(G)&&K.push(...R(G,q.endsWith(".type")?V:q))}return K}function B(){x(JSON.stringify(n,null,2)),b(""),w([]),m(!0)}function D(W=!1){if(W){b(""),w([]),m(!1),A(!1);return}try{const V=JSON.parse(g),K=R(V);w(K),s(V),b(""),m(!1),A(!1)}catch{b("Invalid JSON — fix before switching, or discard changes.")}}function P(){try{const W=JSON.parse(g);w(R(W))}catch{}}function I(){f?D():B()}function z(W){x(W),b(""),w([]);try{const V=JSON.parse(W);s(V)}catch{}}async function L(){if(!i)return;N(!0);const W=i.replace(/\{\{userQuery\}\}/g,C||"Generate a useful JSON schema object").replace(/\{\{currentObject\}\}/g,JSON.stringify(n,null,2)).replace(/\{\{objectType\}\}/g,l),V=await Y.integrations.Core.InvokeLLM({prompt:W});let K=null;if(typeof V=="string")try{const M=V.trim().replace(/^```json\n?/,"").replace(/\n?```$/,"");K=JSON.parse(M)}catch{K=null}else V&&typeof V=="object"&&(K=(V==null?void 0:V.json_object)||V);K&&typeof K=="object"&&(s(K),f&&x(JSON.stringify(K,null,2))),N(!1)}const H=r.jsxs("div",{className:"space-y-1 flex-1 flex flex-col",children:[r.jsx("textarea",{value:g,onChange:W=>
857z(W.target.value),onBlur:P,spellCheck:!1,className:`w-full rounded-lg px-3 py-2 text-xs font-mono resize-none bg-black text-green-400 border border-gray-700 focus:outline-none focus:ring-1 focus:ring-violet-500 ${S?"flex-1":"h-64"}`,style:S?{flex:1}:{}}),j&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("p",{className:"text-xs text-red-500",children:j}),r.jsx("button",{onClick:()=>D(!0),className:"text-xs text-gray-400 hover:text-red-400 underline shrink-0",children:"Discard & switch to form"})]}),y.length>0&&r.jsxs("div",{className:"bg-amber-50 border border-amber-300 rounded-lg px-3 py-2 space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold text-amber-700",children:"⚠ Invalid JSON Schema type(s) — valid: string, number, integer, boolean, object, array, null"}),y.map((W,V)=>r.jsx("p",{className:"text-xs text-amber-600 font-mono",children:W},V))]})]});return S&&f?r.jsxs("div",{className:"fixed inset-0 z-50 bg-gray-950 flex flex-col p-4 gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[r.jsxs("span",{className:"text-sm font-semibold text-gray-200",children:[e," — Raw JSON"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[i&&r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{placeholder:"Describe changes...",value:C,onChange:W=>k(W.target.value),className:"text-xs h-8 w-56 bg-gray-800 border-gray-700 text-gray-200 placeholder-gray-500",onKeyDown:W=>W.key==="Enter"&&L()}),r.jsxs(de,{size:"sm",onClick:L,disabled:_,className:"gap-1.5 bg-violet-600 hover:bg-violet-700 h-8 text-xs shrink-0",children:[r.jsx(Yn,{className:"w-3.5 h-3.5"}),_?"Generating...":"AI Generate"]})]}),r.jsxs(de,{size:"sm",variant:"outline",onClick:D,className:"gap-1.5 h-8 text-xs border-gray-600 text-gray-300 hover:bg-gray-800",children:[r.jsx(jt,{className:"w-3.5 h-3.5"})," Close & Apply"]})]})]}),r.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:H})]}):r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:e}),t&&r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:t})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a&&r.jsxs("button",{onClick:a,className:"flex items-center gap-1 text-xs text-violet-600 hover:text-violet-800",children:[r.jsx(Rn,{className:"w-3.5 h-3.5"})," Load from settings"]}),o&&o,!f&&Object.keys(n).length>0&&r.jsxs("div",{className:"flex items-center gap-1 border rounded-md overflow-hidden text-xs",children:[r.jsx("button",{onClick:()=>d("expand"),className:"px-2 py-1 text-gray-500 hover:bg-gray-100 transition-colors",children:"Expand all"}),r.jsx("div",{className:"w-px h-4 bg-gray-200"}),r.jsx("button",{onClick:()=>d("collapse"),className:"px-2 py-1 text-gray-500 hover:bg-gray-100 transition-colors",children:"Collapse all"})]}),f&&r.jsxs("button",{onClick:()=>A(!0),className:"flex items-center gap-1 text-xs text-gray-500 hover:text-gray-800",children:[r.jsx(Nd,{className:"w-3.5 h-3.5"})," Fullscreen"]}),r.jsxs("button",{onClick:I,className:"flex items-center gap-1 text-xs text-gray-500 hover:text-gray-800",children:[r.jsx(dr,{className:"w-3.5 h-3.5"}),f?"Form view":"Raw JSON"]})]})]}),i&&r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{placeholder:"Describe the object to generate...",value:C,onChange:W=>k(W.target.value),className:"text-xs h-8 flex-1",onKeyDown:W=>W.key==="Enter"&&L()}),r.jsxs(de,{size:"sm",onClick:L,disabled:_,className:"gap-1.5 bg-violet-600 hover:bg-violet-700 h-8 text-xs shrink-0",children:[r.jsx(Yn,{className:"w-3.5 h-3.5"}),_?"Generating...":"AI Generate"]})]}),f?H:r.jsx(bE.Provider,{value:{signal:c},children:r.jsx(qU,{data:n,onChange:s})})]})}function Kj({label:e,content:t,color:n="gray",defaultOpen:s=!1}){const[a,i]=h.useState(s),o={gray:"bg-gray-900 text-gray-200",yellow:"bg-gray-900 text-yellow-200",cyan:"bg-gray-900 text-cyan-200",green:"bg-gray-900 text-green-300",amber:"bg-amber-950 text-amber-100"};return r.jsxs("div",{className:"border rounded-xl overflow-hidden text-xs",children:[r.jsxs("button",{onClick:()=>i(l=>!l),className:"w-full flex items-center gap-2 px-3 py-2 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsx(dr,{className:"w-3.5 h-3.5 text-gray-400"}),r.jsx("span",{className:"font-medium text-gray-600 flex-1",children:e}),a?r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400"}):r.jsx(en,{className:"w-3.5 h-3.5 text-gray-400"})]}),a&&r.jsx("pre",{className:`${o[n]} p-3 text-xs font-mono whitespace-pre-wrap overflow-auto max-h-64 leading-relaxed`,children:t})]})}function cce({assistantId:e,users:t=[],testUserId:n,setTestUserId:s}){const[a,i]=h.useState(""),[o,l]=h.useState(!1),[c,d]=h.useState(!1),[f,m]=h.useState(""),[g,x]=h.useState(null),[j,b]=h.useState(""),[y,w]=h.useState(null),[_,N]=h.useState(""),[C,k]=h.useState(""),[S,A]=h.useState(!1),[T,R]=h.useState({source_page:"",assistant_mode:"PAGE_ONLY",suggest_content:"NO",user_browser_language:typeof navigator<"u"&&navigator.language||"en",user_country:"",user_selected_language:""});async function B(){var P;if(!(!a.trim()||!e)){d(!0),b(""),k("");try{const I=t.find(L=>
857L.email===n),z=await Y.functions.invoke("assistantPromptBuilder",{assistant_id:e,user_message:a,user_email:(I==null?void 0:I.email)||"",user_id:(I==null?void 0:I.id)||"preview",user_name:(I==null?void 0:I.full_name)||"",history:[],...T});b(((P=z.data)==null?void 0:P.full_prompt)||"")}catch(I){k(I.message||"Failed to build prompt")}finally{d(!1)}}}async function D(){var I,z;if(!a.trim()||!e)return;l(!0),m(""),x(null),b(""),w(null),N(""),k("");const P=t.find(L=>L.email===n);try{const H=(await Y.functions.invoke("invokeAssistant",{assistant_id:e,message:a,user_id:(P==null?void 0:P.id)||"preview",_internal_user_email:(P==null?void 0:P.email)||"",_internal_user_name:(P==null?void 0:P.full_name)||"",no_persist:!0,...T})).data||{};H.error?N(H.error):(m(String(H.answer||"")),x(H.data||null),b(((I=H.debug_info)==null?void 0:I.full_prompt)||""),w(((z=H.debug_info)==null?void 0:z.full_llm_response)||null))}catch(L){N(L.message||"Request failed")}finally{l(!1)}}return r.jsxs("div",{className:"bg-yellow-50 border-2 border-dashed border-yellow-200 rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bo,{className:"w-4 h-4 text-green-600"}),r.jsx("h3",{className:"font-semibold text-sm text-gray-700",children:"Prompt Test Panel"})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1",children:[r.jsx("span",{className:"text-[10px] text-gray-400 font-semibold uppercase tracking-wide",children:"Backend Functions Used"}),r.jsxs("div",{className:"flex gap-1.5 flex-wrap justify-end",children:[r.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] bg-green-100 border border-green-300 text-green-800 rounded-full px-2 py-0.5 font-mono",children:[r.jsx(Bo,{className:"w-2.5 h-2.5"})," invokeAssistant"]}),r.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] bg-blue-100 border border-blue-300 text-blue-800 rounded-full px-2 py-0.5 font-mono",children:[r.jsx(dr,{className:"w-2.5 h-2.5"})," assistantPromptBuilder"]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ci,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsxs("select",{value:n,onChange:P=>s(P.target.value),className:"flex-1 border rounded-lg px-3 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:"— No user (variables will be empty) —"}),t.map(P=>r.jsxs("option",{value:P.email,children:[P.full_name," (",P.email,")"]},P.email))]})]}),r.jsxs("div",{className:"border border-yellow-200 rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>A(P=>!P),className:"w-full flex items-center gap-2 px-3 py-2 bg-yellow-100 hover:bg-yellow-200 transition-colors text-left",children:[r.jsx("span",{className:"text-xs font-semibold text-yellow-800",children:"Landing Page Context"}),r.jsx("span",{className:"text-[10px] text-yellow-600",children:"(source_page, assistant_mode, suggest_content, language, country, selected_language)"}),S?r.jsx(gt,{className:"w-3.5 h-3.5 text-yellow-600 ml-auto"}):r.jsx(en,{className:"w-3.5 h-3.5 text-yellow-600 ml-auto"})]}),S&&r.jsx("div",{className:"p-3 bg-white space-y-2",children:r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-500 uppercase",children:"Source Page (URL)"}),r.jsx(It,{value:T.source_page,onChange:P=>R(I=>({...I,source_page:P.target.value})),placeholder:"https://...",className:"h-8 text-xs"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-500 uppercase",children:"Assistant Mode"}),r.jsxs("select",{value:T.assistant_mode,onChange:P=>R(I=>({...I,assistant_mode:P.target.value})),className:"h-8 w-full border rounded-md text-xs px-2 bg-white",children:[r.jsx("option",{value:"PAGE_ONLY",children:"PAGE_ONLY"}),r.jsx("option",{value:"LIBRARY",children:"LIBRARY"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-500 uppercase",children:"Suggest Content"}),r.jsxs("select",{value:T.suggest_content,onChange:P=>R(I=>({...I,suggest_content:P.target.value})),className:"h-8 w-full border rounded-md text-xs px-2 bg-white",children:[r.jsx("option",{value:"NO",children:"NO"}),r.jsx("option",{value:"YES",children:"YES"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-500 uppercase",children:"Browser Language"}),r.jsx(It,{value:T.user_browser_language,onChange:P=>R(I=>({...I,user_browser_language:P.target.value})),placeholder:"pt-BR",className:"h-8 text-xs"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-500 uppercase",children:"User Country"}),r.jsx(It,{value:T.user_country,onChange:P=>R(I=>({...I,user_country:P.target.value})),placeholder:"Brazil",className:"h-8 text-xs"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-500 uppercase",children:"Selected Language (v2 UI)"}),r.jsx(It,{value:T.user_selected_language,onChange:P=>R(I=>({...I,user_selected_language:P.target.value})),placeholder:"pt",className:"h-8 text-xs"})]})]})})]}),r.jsx(rr,{value:a,onChange:P=>i(P.target.value),placeholder:"Type a test user message...",rows:3,className:"text-sm"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(de,{size:"sm",className:"gap-1.5 text-xs bg-green-600 hover:bg-green-700",onClick:D,disabled:!a.trim()||!e||o,children:[o?r.jsx(Rn,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Bo,{className:"w-3.5 h-3.5"}),o?"Running...":"Invoke Assistant"]}),r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 text-xs",onClick:B,disabled:!a.trim()||!e||c,children:[c?r.jsx(Rn,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(dr,{className:"w-3.5 h-3.5"}),c?"Building...":"Build Prompt"]})]}),_&&r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg px-3 py-2 text-xs text-red-700",children:["⚠ ",_]}),C&&r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg px-3 py-2 text-xs text-red-700",children:["⚠ ",C]}),f&&r.jsxs("div",{className:"bg-emerald-50 border-2 border-emerald-200 rounded-xl px-4 py-3",children:[r.jsx("p",{className:"text-xs font-semibold text-emerald-600 mb-1",children:"Answer"}),r.jsx("p",{className:"text-gray-800 text-sm leading-relaxed whitespace-pre-wrap",children:f})]}),g&&r.jsx(Kj,{label:"Extracted Data (response_object)",content:JSON.stringify(g,null,2),color:"cyan",defaultOpen:!0}),y&&r.jsx(Kj,{label:"Full LLM Response (raw JSON)",content:JSON.stringify(y,null,2),color:"green"}),j&&r.jsx(Kj,{label:"Full Prompt Sent to LLM",content:j,color:"yellow"})]})}const dce=[{var:"{{user_name}}",desc:"The full name of the current user"},{var:"{{user_email}}",desc:"The email address of the current user"},{var:"{{user_id}}",desc:"The unique ID of the current user"},{var:"{{date}}",desc:"Today's date in readable format"},{var:"{{kb_names}}",desc:"Comma-separated list of linked knowledge base names"},{var:"{{kb_block}}",desc:"Formatted knowledge base items block (all linked KBs)"},{var:"{{userBio}}",desc:"User's bio / personal description from their profile"},{var:"{{userInvestigations}}",desc:"All user investigation records (from UserInvestigation entity)"},{var:"{{source_page}}",desc:"The source page URL passed from the embed landing page (page_url)"},{var:"{{assistant_mode}}",desc:"The assistant mode from the landing page (PAGE_ONLY or LIBRARY)"},{var:"{{suggest_content}}",desc:"Whether content suggestion is enabled on the landing page (YES/NO)"},{var:"{{user_browser_language}}",desc:"The visitor's browser language (e.g. pt-BR)"},{var:"{{user_country}}",desc:"The visitor's country (from IP geolocation)"},{var:"{{user_selected_language}}",desc:"The language the user selected in the v2 embed UI (e.g. pt, en)"}],uce=[{var:"{{investigations_list}}",desc:"JSON list of all available investigation definitions"}];function mce({data:e,setData:t,editId:n,appConfig:s,agents:a,users:i,testUserId:o,setTestUserId:l}){var q,F;const[c,d]=h.useState(""),[f,m]=h.useState("both"),[g,x]=h.useState(!1),[j,b]=h.useState(""),[y,w]=h.useState(!1),[_,N]=h.useState(null),[C,k]=h.useState(""),S=e.type==="Investigation",A=e.response_object||{},T=((q=s==null?void 0:s.default_answer_by_type)==null?void 0:q[e.type])!==void 0,R=((F=s==null?void 0:s.default_response_object_by_type)==null?void 0:F[e.type])!==void 0;function B(U,ee=""){const ne=[];return!U||typeof U!="object"||Array.isArray(U)||Object.entries(U).forEac
857h(([X,ie])=>{const Z=ee?`${ee}.${X}`:X;ne.push(Z),ie&&typeof ie=="object"&&!Array.isArray(ie)&&ne.push(...B(ie,Z))}),ne}const D=B(A),P=Object.keys(A).map(U=>({var:`{{${U}}}`,desc:`Node "${U}" from Response Object`}));function I(U,ee="prompt_instructions",ne="prompt-instructions-textarea"){const X=document.getElementById(ne);if(X){const ie=X.selectionStart,Z=X.selectionEnd,ce=e[ee],le=ce.slice(0,ie)+U+ce.slice(Z);t({...e,[ee]:le}),setTimeout(()=>{X.focus(),X.setSelectionRange(ie+U.length,ie+U.length)},0)}else t(ie=>({...ie,[ee]:(ie[ee]||"")+" "+U}))}async function z(){const U=e.prompt_instructions;if(!U.trim()&&!j.trim())return;x(!0);const ee=`You are an expert AI assistant prompt engineer.
858ASSISTANT: ${e.name||"(unnamed)"}, Type: ${e.type}
859Available variables: {{investigations_list}}, {{userInvestigations}}, {{userBio}}, {{user_name}}, {{user_email}}, {{user_id}}, {{date}}, {{kb_names}}
860
861CURRENT PROMPT TO IMPROVE:
862"""
863${U||"(empty — write a new one from scratch)"}
864"""
865
866USER INSTRUCTION: ${j||"Improve clarity, structure, and effectiveness. Make it comprehensive and production-ready."}
867
868Return ONLY the improved prompt text, nothing else.`,ne=await Y.integrations.Core.InvokeLLM({prompt:ee});t(X=>({...X,prompt_instructions:ne})),w(!1),b(""),x(!1)}function L(U){return typeof U=="string"?{text:U,scope:"both"}:{text:(U==null?void 0:U.text)||"",scope:(U==null?void 0:U.scope)||"both"}}function H(){c.trim()&&(t({...e,suggested_prompts:[...e.suggested_prompts||[],{text:c.trim(),scope:f}]}),d(""))}function W(U){const ee=[...e.suggested_prompts||[]];ee.splice(U,1),t({...e,suggested_prompts:ee})}function V(U,ee){const ne=[...e.suggested_prompts||[]],X=L(ne[U]);ne[U]={text:X.text,scope:ee},t({...e,suggested_prompts:ne})}function K(U,ee){const ne=[...e.suggested_prompts||[]],X=U+ee;X<0||X>=ne.length||([ne[U],ne[X]]=[ne[X],ne[U]],t({...e,suggested_prompts:ne}))}function M(U){N(U),k(L((e.suggested_prompts||[])[U]).text)}function G(){if(_===null)return;const U=[...e.suggested_prompts||[]],ee=L(U[_]);U[_]={text:C.trim()||ee.text,scope:ee.scope},t({...e,suggested_prompts:U}),N(null),k("")}return r.jsxs("div",{className:"space-y-4",children:[S&&r.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ur,{className:"w-4 h-4 text-amber-600"}),r.jsx("h2",{className:"font-semibold text-sm text-amber-800",children:"Investigation Agent"})]}),r.jsx("p",{className:"text-xs text-amber-700",children:"The linked agent receives structured data extracted by the LLM and updates the user's profile."}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Agent"}),r.jsxs("select",{value:e.agent_name,onChange:U=>t({...e,agent_name:U.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-amber-400 font-mono",children:[r.jsx("option",{value:"",children:"— None —"}),a.map(U=>r.jsxs("option",{value:U.name,children:[U.label," (",U.name,")"]},U.name))]})]}),e.agent_name&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Current Investigations Data Node"}),r.jsxs("select",{value:e.investigation_data_node,onChange:U=>t({...e,investigation_data_node:U.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-amber-400",children:[r.jsx("option",{value:"",children:"— Full response object —"}),D.map(U=>r.jsx("option",{value:U,children:U},U))]}),r.jsx("p",{className:"text-xs text-amber-600",children:"Which node of the response object to send to the agent."})]})]})]}),r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-indigo-700",children:[r.jsx(_d,{className:"w-3.5 h-3.5"})," Available Variables",r.jsx("span",{className:"ml-1 text-indigo-400 font-normal",children:"— click to insert into Instructions"})]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:dce.map(U=>r.jsx("button",{onClick:()=>I(U.var),title:U.desc,className:"text-xs bg-white border border-indigo-200 text-indigo-700 rounded-lg px-2.5 py-1.5 hover:bg-indigo-600 hover:text-white hover:border-indigo-600 transition-all font-mono",children:U.var},U.var))}),S&&r.jsx("div",{className:"pt-1 border-t border-indigo-100 flex flex-wrap gap-2",children:uce.map(U=>r.jsx("button",{onClick:()=>I(U.var),title:U.desc,className:"text-xs bg-white border border-amber-200 text-amber-700 rounded-lg px-2.5 py-1.5 hover:bg-amber-500 hover:text-white hover:border-amber-500 transition-all font-mono",children:U.var},U.var))})]}),r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("button",{onClick:()=>w(U=>!U),className:"w-full flex items-center gap-2 px-4 py-3 bg-gradient-to-r from-violet-50 to-indigo-50 hover:from-violet-100 hover:to-indigo-100 transition-colors text-left",children:[r.jsx(Yn,{className:"w-4 h-4 text-violet-600"}),r.jsx("span",{className:"text-sm font-medium text-violet-800",children:"AI Improve Instructions"}
868),r.jsx(Gr,{className:"ml-1 bg-violet-100 text-violet-700 border-0 text-[10px]",children:"AI"}),r.jsx("span",{className:"ml-auto text-xs text-violet-400",children:y?"Hide":"Expand"}),y?r.jsx(gt,{className:"w-4 h-4 text-violet-400"}):r.jsx(en,{className:"w-4 h-4 text-violet-400"})]}),y&&r.jsxs("div",{className:"p-4 space-y-3 bg-white border-t",children:[r.jsx("p",{className:"text-xs text-gray-500",children:"Describe how to improve the Instructions section, or leave blank for automatic improvement."}),r.jsx(It,{value:j,onChange:U=>b(U.target.value),placeholder:"e.g. More concise, friendly tone..."}),r.jsxs(de,{onClick:z,disabled:g,className:"gap-2 bg-violet-600 hover:bg-violet-700",children:[r.jsx(Yn,{className:"w-4 h-4"}),g?"Improving...":"Improve with AI"]})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Instructions & Answer"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"These two sections compose the conversational part of the prompt."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{className:"text-sm font-semibold text-gray-600",children:"Instructions"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Persona, tone, goals, and behavioral rules for the LLM."}),r.jsx(rr,{id:"prompt-instructions-textarea",value:e.prompt_instructions,onChange:U=>t({...e,prompt_instructions:U.target.value}),rows:9,placeholder:"You are a friendly specialist...",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"space-y-2 pt-3 border-t",children:[r.jsx(ot,{className:"text-sm font-semibold text-gray-600",children:"Answer"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Instructions on how to format the reply shown to the user. Use"," ",r.jsx("code",{className:"bg-gray-100 px-1 rounded text-xs",children:"{{node_name}}"})," to reference Response Object nodes."]}),P.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1.5",children:P.map(U=>r.jsx("button",{onClick:()=>I(U.var,"prompt_answer","prompt-answer-textarea"),title:U.desc,className:"text-xs bg-sky-50 border border-sky-200 text-sky-700 rounded-lg px-2 py-1 hover:bg-sky-600 hover:text-white transition-all font-mono",children:U.var},U.var))}),T&&r.jsxs("button",{onClick:()=>t(U=>({...U,prompt_answer:s.default_answer_by_type[e.type]})),className:"flex items-center gap-1 text-xs text-violet-600 hover:text-violet-800",children:[r.jsx(Rn,{className:"w-3 h-3"})," Load from settings"]}),r.jsx(rr,{id:"prompt-answer-textarea",value:e.prompt_answer,onChange:U=>t({...e,prompt_answer:U.target.value}),rows:4,placeholder:"Answer in a concise, friendly tone...",className:"font-mono text-sm"})]}),r.jsxs("div",{className:"space-y-2 pt-3 border-t",children:[r.jsx(ot,{className:"text-sm font-semibold text-gray-600",children:"Answer Data Node"}),r.jsxs("select",{value:e.answer_data_node,onChange:U=>t({...e,answer_data_node:U.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:'— Use default "answer" field —'}),D.map(U=>r.jsx("option",{value:U,children:U},U))]}),r.jsx("p",{className:"text-xs text-gray-400",children:"Which field in the Response Object contains the LLM's conversational reply to show the user."})]})]}),r.jsx(Ed,{title:"Response Object",description:"JSON schema the LLM populates each conversation turn. Nodes can be referenced as {{node_name}} in the Answer section.",value:e.response_object||{},onChange:U=>t({...e,response_object:U}),onLoadDefault:R?()=>t(U=>({...U,response_object:s.default_response_object_by_type[e.type]})):void 0,aiPrompt:s==null?void 0:s.json_object_prompt,objectType:"responseObject"}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-sm text-gray-600 mb-1",children:"Suggested Starter Prompts"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Shown to users when the chat is empty. Set scope to control when each prompt appears."})]}),r.jsxs("div",{className:"flex items-center gap-2 pb-1",children:[r.jsx(ot,{className:"text-xs text-gray-500 shrink-0",children:"Max on-screen"}),r.jsx("input",{type:"number",min:0,step:1,value:e.max_suggested_prompts??0,onChange:U=>t({...e,max_suggested_prompts:Math.max(0,parseInt(U.target.value)||0)}),className:"w-20 border rounded-lg px-2 py-1 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("span",{className:"text-xs text-gray-400",children:"0 = show all. When more prompts exist, they rotate in batches of this size."})]}),(e.suggested_prompts||[]).map((U,ee)=>{const ne=L(U),X=ne.scope==="page"?"bg-sky-100 text-sky-700 border-sky-200":ne.scope==="library"?"bg-violet-100 text-violet-700 border-violet-200":"bg-gray-100 text-gray-600 border-gray-200",ie=_===ee;return r.jsxs("div",{className:"flex items-center gap-1.5 bg-gray-50 rounded-lg px-2 py-1.5",children:[r.jsxs("div",{className:"flex flex-col shrink-0",children:[r.jsx("button",{onClick:()=>K(ee,-1),disabled:ee===0,className:"text-gray-300 hover:text-indigo-600 disabled:opacity-30 disabled:hover:text-gray-300 leading-none",children:r.jsx(Mn,{className:"w-3 h-3"})}),r.jsx("button",{onClick:()=>K(ee,1),disabled:ee===(e.suggested_prompts||[]).length-1,className:"text-gray-300 hover:text-indigo-600 disabled:opacity-30 disabled:hover:text-gray-300 leading-none",children:r.jsx(gt,{className:"w-3 h-3"})})]}),ie?r.jsx("input",{autoFocus:!0,value:C,onChange:Z=>k(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&G(),Z.key==="Escape"&&N(null)},onBlur:G,className:"flex-1 text-sm border border-indigo-300 rounded-md px-2 py-1 focus:outline-none focus:ring-1 focus:ring-indigo-400 min-w-0"}):r.jsx("button",{onClick:()=>M(ee),className:"text-sm text-gray-700 flex-1 text-left hover:text-indigo-600 truncate",title:"Click to edit",children:ne.text}
868),r.jsxs("select",{value:ne.scope,onChange:Z=>V(ee,Z.target.value),className:`text-[10px] font-medium border rounded-md px-1.5 py-1 bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 shrink-0 ${X}`,title:"When this prompt should be shown",children:[r.jsx("option",{value:"both",children:"Both modes"}),r.jsx("option",{value:"page",children:"Page only"}),r.jsx("option",{value:"library",children:"Library only"})]}),r.jsx("button",{onClick:()=>W(ee),className:"text-gray-300 hover:text-red-500 transition-colors shrink-0",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]},ee)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{value:c,onChange:U=>d(U.target.value),placeholder:"Add a suggested prompt...",onKeyDown:U=>U.key==="Enter"&&H()}),r.jsxs("select",{value:f,onChange:U=>m(U.target.value),className:"text-xs border rounded-lg px-2 py-2 bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 shrink-0",title:"When this prompt should be shown",children:[r.jsx("option",{value:"both",children:"Both"}),r.jsx("option",{value:"page",children:"Page only"}),r.jsx("option",{value:"library",children:"Library only"})]}),r.jsxs(de,{variant:"outline",onClick:H,disabled:!c.trim(),className:"gap-1 shrink-0",children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," Add"]})]})]}),n&&r.jsx(cce,{assistantId:n,users:i,testUserId:o,setTestUserId:l})]})}function Ob(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Ib(e){const[t,n]=h.useState(void 0);return xs(()=>
868{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var Rb="Switch",[fce]=Ti(Rb),[hce,pce]=fce(Rb),HU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:a,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:f,...m}=e,[g,x]=h.useState(null),j=xn(t,N=>x(N)),b=h.useRef(!1),y=g?f||!!g.closest("form"):!0,[w,_]=so({prop:a,defaultProp:i??!1,onChange:d,caller:Rb});return r.jsxs(hce,{scope:n,checked:w,disabled:l,children:[r.jsx(Mt.button,{type:"button",role:"switch","aria-checked":w,"aria-required":o,"data-state":JU(w),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:j,onClick:Rt(e.onClick,N=>{_(C=>!C),y&&(b.current=N.isPropagationStopped(),b.current||N.stopPropagation())})}),y&&r.jsx(YU,{control:g,bubbles:!b.current,name:s,value:c,checked:w,required:o,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});HU.displayName=Rb;var WU="SwitchThumb",GU=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,a=pce(WU,n);return r.jsx(Mt.span,{"data-state":JU(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t})});GU.displayName=WU;var gce="SwitchBubbleInput",YU=h.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...a},i)=>{const o=h.useRef(null),l=xn(o,i),c=Ob(n),d=Ib(t);return h.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&x){const j=new Event("click",{bubbles:s});x.call(f,n),f.dispatchEvent(j)}},[c,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});YU.displayName=gce;function JU(e){return e?"checked":"unchecked"}var QU=HU,xce=GU;const Gc=h.forwardRef(({className:e,...t},n)=>r.jsx(QU,{className:rn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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-input",e),...t,ref:n,children:r.jsx(xce,{className:rn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Gc.displayName=QU.displayName;function W0(e,[t,n]){return Math.min(n,Math.max(t,e))}var yce=h.createContext(void 0);function Mb(e){const t=h.useContext(yce);return e||t||"ltr"}var XU=["PageUp","PageDown"],ZU=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],e8={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Hm="Slider",[I2,bce,vce]=vb(Hm),[t8]=Ti(Hm,[vce]),[wce,Db]=t8(Hm),n8=h.forwardRef((e,t)=>{const{name:n,min:s=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[s],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:j,...b}=e,y=h.useRef(new Set),w=h.useRef(0),N=o==="horizontal"?jce:_ce,[C=[],k]=so({prop:f,defaultProp:d,onChange:D=>{var I;(I=[...y.current][w.current])==null||I.focus(),m(D)}}),S=h.useRef(C);function A(D){const P=Ece(C,D);B(D,P)}function T(D){B(D,w.current)}function R(){const D=S.current[w.current];C[w.current]!==D&&g(C)}function B(D,P,{commit:I}={commit:!1}){const z=Oce(i),L=Ice(Math.round((D-s)/i)*i+s,z),H=W0(L,[s,a]);k((W=[])=>{const V=kce(W,H,P);if(Pce(V,c*i)){w.current=V.indexOf(H);const K=String(V)!==String(W);return K&&I&&g(V),K?V:W}else return W})}return r.jsx(wce,{scope:e.__scopeSlider,name:n,disabled:l,min:s,max:a,valueIndexToChangeRef:w,thumbs:y.current,values:C,orientation:o,form:j,children:r.jsx(I2.Provider,{scope:e.__scopeSlider,children:r.jsx(I2.Slot,{scope:e.__scopeSlider,children:r.jsx(N,{"aria-disabled":l,"data-disabled":l?"":void 0,...b,ref:t,onPointerDown:Rt(b.onPointerDown,()=>{l||(S.current=C)}),min:s,max:a,inverted:x,onSlideStart:l?void 0:A,onSlideMove:l?void 0:T,onSlideEnd:l?void 0:R,onHomeKeyDown:()=>!l&&B(s,0,{commit:!0}),onEndKeyDown:()=>!l&&B(a,C.length-1,{commit:!0}),onStepKeyDown:({event:D,direction:P})=>{if(!l){const L=XU.includes(D.key)||D.shiftKey&&ZU.includes(D.key)?10:1,H=w.current,W=C[H],V=i*L*P;B(W+V,H,{commit:!0})}}})})})})});n8.displayName=Hm;var[r8,s8]=t8(Hm,{startEdge:"left",endEdge:"right",size:"width",direction:1}),jce=h.forwardRef((e,t)=>
868{const{min:n,max:s,dir:a,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...f}=e,[m,g]=h.useState(null),x=xn(t,N=>g(N)),j=h.useRef(void 0),b=Mb(a),y=b==="ltr",w=y&&!i||!y&&i;function _(N){const C=j.current||m.getBoundingClientRect(),k=[0,C.width],A=vE(k,w?[n,s]:[s,n]);return j.current=C,A(N-C.left)}return r.jsx(r8,{scope:e.__scopeSlider,startEdge:w?"left":"right",endEdge:w?"right":"left",direction:w?1:-1,size:"width",children:r.jsx(a8,{dir:b,"data-orientation":"horizontal",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:N=>{const C=_(N.clientX);o==null||o(C)},onSlideMove:N=>{const C=_(N.clientX);l==null||l(C)},onSlideEnd:()=>{j.current=void 0,c==null||c()},onStepKeyDown:N=>{const k=e8[w?"from-left":"from-right"].includes(N.key);d==null||d({event:N,direction:k?-1:1})}})})}),_ce=h.forwardRef((e,t)=>{const{min:n,max:s,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...d}=e,f=h.useRef(null),m=xn(t,f),g=h.useRef(void 0),x=!a;function j(b){const y=g.current||f.current.getBoundingClientRect(),w=[0,y.height],N=vE(w,x?[s,n]:[n,s]);return g.current=y,N(b-y.top)}return r.jsx(r8,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:r.jsx(a8,{"data-orientation":"vertical",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const y=j(b.clientY);i==null||i(y)},onSlideMove:b=>{const y=j(b.clientY);o==null||o(y)},onSlideEnd:()=>{g.current=void 0,l==null||l()},onStepKeyDown:b=>{const w=e8[x?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:w?-1:1})}})})}),a8=h.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...d}=e,f=Db(Hm,n);return r.jsx(Mt.span,{...d,ref:t,onKeyDown:Rt(e.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):XU.concat(ZU).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:Rt(e.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():s(m)}),onPointerMove:Rt(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:Rt(e.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),i8="SliderTrack",o8=h.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=Db(i8,n);return r.jsx(Mt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:t})});o8.displayName=i8;var R2="SliderRange",l8=h.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=Db(R2,n),i=s8(R2,n),o=h.useRef(null),l=xn(t,o),c=a.values.length,d=a.values.map(g=>u8(g,a.min,a.max)),f=c>1?Math.min(...d):0,m=100-Math.max(...d);return r.jsx(Mt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:l,style:{...e.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});l8.displayName=R2;var M2="SliderThumb",c8=h.forwardRef((e,t)=>{const n=bce(e.__scopeSlider),[s,a]=h.useState(null),i=xn(t,l=>a(l)),o=h.useMemo(()=>s?n().findIndex(l=>l.ref.current===s):-1,[n,s]);return r.jsx(Nce,{...e,ref:i,index:o})}),Nce=h.forwardRef((e,t)=>{const{__scopeSlider:n,index:s,name:a,...i}=e,o=Db(M2,n),l=s8(M2,n),[c,d]=h.useState(null),f=xn(t,_=>d(_)),m=c?o.form||!!c.closest("form"):!0,g=Ib(c),x=o.values[s],j=x===void 0?0:u8(x,o.min,o.max),b=Cce(s,o.values.length),y=g==null?void 0:g[l.size],w=y?Ace(y,j,l.direction):0;return h.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${j}% + ${w}px)`},children:[r.jsx(I2.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(Mt.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":o.min,"aria-valuenow":x,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:x===void 0?{display:"none"}:e.style,onFocus:Rt(e.onFocus,()=>{o.valueIndexToChangeRef.current=s})})}),m&&r.jsx(d8,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:x},s)]})});c8.displayName=M2;var Sce="RadioBubbleInput",d8=h.forwardRef(({__scopeSlider:e,value:t,...n},s)=>{const a=h.useRef(null),i=xn(a,s),o=Ob(t);return h.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&f){const m=new Event("input",{bubbles:!0});f.call(l,t),l.dispatchEvent(m)}},[o,t]),r.jsx(Mt.input,{style:{display:"none"},...n,ref:i,defaultValue:t})});d8.displayName=Sce;function kce(e=[],t,n){const s=[...e];return s[n]=t,s.sort((a,i)=>a-i)}function u8(e,t,n){const i=100/(n-t)*(e-t);return W0(i,[0,100])}function Cce(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Ece(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),s=Math.min(...n);return n.indexOf(s)}function Ace(e,t,n){const s=e/2,i=vE([0,50],[0,s]);return(s-i(t)*n)*n}function Tce(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Pce(e,t){if(t>0){const n=Tce(e);return Math.min(...n)>=t}return!0}function vE(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function Oce(e){return(String(e).split(".")[1]||"").length}function Ice(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var m8=n8,Rce=o8,Mce=l8,Dce=c8;const xr=h.forwardRef(({className:e,...t},n)=>r.jsxs(m8,{ref:n,className:rn("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(Rce,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:r.jsx(Mce,{className:"absolute h-full bg-primary"})}
868),r.jsx(Dce,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));xr.displayName=m8.displayName;const P4=["jina-embeddings-v5-text-small","jina-embeddings-v3"],Lce=[{value:"auto",label:"Auto-detect"},{value:"en",label:"English"},{value:"pt",label:"Portuguese"},{value:"es",label:"Spanish"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"zh",label:"Chinese"},{value:"ja",label:"Japanese"}];function $ce({data:e,setData:t,editId:n,appConfig:s}){var c;const[a,i]=h.useState(""),[o,l]=h.useState(!1);return r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Behavior & RAG Settings"}),r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-violet-50 border-violet-200",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-violet-800",children:"JSON Answer Mode"}),r.jsx("div",{className:"text-xs text-violet-600",children:"The Response Object is sent as response_json_schema to InvokeLLM"})]}),r.jsx(Gc,{checked:e.json_answer??!0,onCheckedChange:d=>t({...e,json_answer:d})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"LLM Model"}),r.jsxs("select",{value:e.model||"automatic",onChange:d=>t({...e,model:d.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 font-mono",children:[r.jsx("option",{value:"automatic",children:"automatic (default)"}),r.jsx("option",{value:"gpt_5_mini",children:"gpt_5_mini"}),r.jsx("option",{value:"gemini_3_flash",children:"gemini_3_flash"}),r.jsx("option",{value:"gpt_5",children:"gpt_5"}),r.jsx("option",{value:"gpt_5_4",children:"gpt_5_4"}),r.jsx("option",{value:"gemini_3_1_pro",children:"gemini_3_1_pro"}),r.jsx("option",{value:"claude_sonnet_4_6",children:"claude_sonnet_4_6"}),r.jsx("option",{value:"claude_opus_4_6",children:"claude_opus_4_6"})]}),r.jsx("p",{className:"text-xs text-gray-400",children:"Non-default models use more integration credits."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Temperature (Creativity)"}),r.jsx("span",{className:"font-mono font-semibold text-indigo-600",children:e.temperature})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-400",children:[r.jsx("span",{children:"Precise"}),r.jsx(xr,{value:[e.temperature],onValueChange:([d])=>t({...e,temperature:d}),min:0,max:1,step:.05,className:"flex-1"}),r.jsx("span",{children:"Creative"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Max Context Items"}),r.jsx("span",{className:"font-mono font-semibold text-indigo-600",children:e.max_context_items})]}),r.jsx(xr,{value:[e.max_context_items],onValueChange:([d])=>t({...e,max_context_items:d}),min:1,max:50,step:1,className:"w-full"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Conversation History Window"}),r.jsxs("span",{className:"font-mono font-semibold text-indigo-600",children:[e.context_messages," messages"]})]}),r.jsx(xr,{value:[e.context_messages],onValueChange:([d])=>t({...e,context_messages:d}),min:2,max:40,step:2,className:"w-full"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Max Chars Per KB Item"}),r.jsx("span",{className:"font-mono font-semibold text-indigo-600",children:e.max_chars_per_item.toLocaleString()})]}),r.jsx(xr,{value:[e.max_chars_per_item],onValueChange:([d])=>t({...e,max_chars_per_item:d}),min:500,max:1e4,step:500,className:"w-full"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Embedding Task (Jina)"}),r.jsxs("select",{value:e.jina_task||"retrieval.query",onChange:d=>t({...e,jina_task:d.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 font-mono",children:[r.jsx("option",{value:"retrieval.query",children:"retrieval.query — for search/query embedding (default)"}),r.jsx("option",{value:"retrieval.passage",children:"retrieval.passage — for document/passage embedding"}),r.jsx("option",{value:"text-matching",children:"text-matching — symmetric similarity"})]}),r.jsx("p",{className:"text-xs text-gray-400",children:"Jina task type used when embedding the user query during search. Falls back to AppConfig global setting if not set."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Search Function"}),r.jsxs("select",{value:e.search_function||"ItemsVectorSemanticSearch",onChange:d=>t({...e,search_function:d.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 font-mono",children:[r.jsx("option",{value:"ItemsVectorSemanticSearch",children:"ItemsVectorSemanticSearch — Direct Supabase vector similarity search (no LLM)"}),r.jsx("option",{value:"directQuery",children:"directQuery — Direct query execution"})]}),r.jsx("p",{className:"text-xs text-gray-400",children:e.search_function==="directQuery"?"Executes a direct query against the knowledge base.":"Queries Supabase directly using vector embeddings. No LLM ranking calls — fastest option, pure cosine similarity."})]}),(e.search_function||"ItemsVectorSemanticSearch")==="ItemsVectorSemanticSearch"&&r.jsxs("div",{className:"border rounded-xl p-4 space-y-5 bg-violet-50 border-violet-200",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-violet-800",children:"ItemsVectorSemanticSearch Options"}),r.jsx("p",{className:"text-xs text-violet-600 mt-0.5",children:"Settings specific to the direct Supabase vector search function."})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-white border-violet-200",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-violet-800",children:"Include Item Summaries"}),r.jsxs("div",{className:"text-xs text-violet-600",children:["Attach ",r.jsx("code",{children:"human_summary"})," and ",r.jsx("code",{children:"semantic_summary"})," to each result. Useful for richer context in the prompt."]})]}
868),r.jsx(Gc,{checked:e.ivss_include_summaries??!1,onCheckedChange:d=>t({...e,ivss_include_summaries:d})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Primary Query Model"}),r.jsx("select",{value:e.ivss_query_model_primary||"jina-embeddings-v5-text-small",onChange:d=>t({...e,ivss_query_model_primary:d.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-violet-400 font-mono",children:P4.map(d=>r.jsx("option",{value:d,children:d},d))}),r.jsx("p",{className:"text-xs text-violet-600",children:"Jina model used for the first (primary) embedding round during search."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Secondary Query Model"}),r.jsxs("select",{value:e.ivss_query_model_secondary||"none",onChange:d=>t({...e,ivss_query_model_secondary:d.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-violet-400 font-mono",children:[r.jsx("option",{value:"none",children:"none — single round only"}),P4.map(d=>r.jsx("option",{value:d,children:d},d))]}),r.jsx("p",{className:"text-xs text-violet-600",children:"Optional second embedding round — results are merged (best score per item wins). Falls back to AppConfig default if not set."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Top K Multiple"}),r.jsxs("span",{className:"font-mono font-semibold text-violet-700",children:[e.ivss_top_k_multiple??1,"×"]})]}),r.jsx("input",{type:"number",min:1,max:20,step:1,value:e.ivss_top_k_multiple??1,onChange:d=>t({...e,ivss_top_k_multiple:Math.max(1,parseInt(d.target.value)||1)}),className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-violet-400"}),r.jsxs("p",{className:"text-xs text-violet-600",children:[r.jsx("code",{children:"match_count = max_context_items × top_k_multiple"}),". Higher values fetch more candidates before per-item deduplication, improving recall. Default: 1."]})]})]}),r.jsxs("div",{className:"border rounded-xl p-4 space-y-5 bg-indigo-50 border-indigo-100",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-indigo-800",children:"Multi-Stage Semantic Search"}),r.jsx("p",{className:"text-xs text-indigo-600 mt-0.5",children:"Controls the 3-stage KB → Item → Chunk pipeline."})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-white border-indigo-200",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-indigo-800",children:"Summary Search Mode"}),r.jsx("div",{className:"text-xs text-indigo-600",children:"Skip Stage 3 (chunk ranking). Returns top items with their human summaries as context. Faster but less granular."})]}),r.jsx(Gc,{checked:e.use_summary_mode??!1,onCheckedChange:d=>t({...e,use_summary_mode:d})})]}),[{key:"min_kb_score",label:"KB Min Score",hint:"Knowledge bases whose summary scores below this are skipped.",pct:!0,default:.3},{key:"min_item_score",label:"Item Min Score",hint:"KB items whose summary scores below this won't have their chunks retrieved.",pct:!0,default:.4},{key:"min_chunk_score",label:"Chunk Min Score",hint:"Chunks scoring below this are excluded from the final context sent to the LLM.",pct:!0,default:0},{key:"early_exit_score",label:"Early Exit Score",hint:"If all collected context chunks already exceed this score, skip the fallback broadening pass.",pct:!0,default:.85}].map(({key:d,label:f,hint:m,pct:g,default:x})=>r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:f}),r.jsx("span",{className:"font-mono font-semibold text-indigo-600",children:g?`${Math.round((e[d]??x)*100)}%`:e[d]??x})]}),r.jsx(xr,{value:[g?(e[d]??x)*100:e[d]??x],onValueChange:([j])=>t({...e,[d]:g?Math.round(j)/100:j}),min:0,max:g?100:20,step:g?5:1,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-500",children:m})]},d)),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Max Items per KB"}),r.jsx("span",{className:"font-mono font-semibold text-indigo-600",children:e.max_items_per_kb??5})]}
868),r.jsx(xr,{value:[e.max_items_per_kb??5],onValueChange:([d])=>t({...e,max_items_per_kb:d}),min:1,max:20,step:1,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-500",children:"Maximum number of items per KB to retrieve chunks from."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Max Stage 3 LLM Calls"}),r.jsx("span",{className:"font-mono font-semibold text-indigo-600",children:(e.max_stage3_llm_calls??0)===0?"∞ all":e.max_stage3_llm_calls})]}),r.jsx(xr,{value:[e.max_stage3_llm_calls??0],onValueChange:([d])=>t({...e,max_stage3_llm_calls:d}),min:0,max:10,step:1,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-500",children:"Max sequential LLM calls in Stage 3 (each ranks 30 shuffled chunks). 0 = no limit, rank all chunks."})]}),r.jsxs("div",{className:"border-t border-indigo-200 pt-4 space-y-3",children:[r.jsx("p",{className:"text-xs font-semibold text-indigo-700 uppercase tracking-wide",children:"Keyword Boost"}),[{key:"keyword_boost_kbs",label:"Boost KBs on keyword match",hint:"KBs whose name/description matches a query keyword bypass min_kb_score (Stage 1)",defaultVal:!1},{key:"keyword_boost_items",label:"Boost Items on keyword match",hint:"Items whose title/summary matches a query keyword bypass min_item_score (Stage 2)",defaultVal:!0}].map(({key:d,label:f,hint:m,defaultVal:g})=>r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-700",children:f}),r.jsx("p",{className:"text-xs text-gray-400",children:m})]}),r.jsx(Gc,{checked:e[d]??g,onCheckedChange:x=>t({...e,[d]:x})})]},d))]})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-gray-50",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-700",children:"Allow Internet Search"}),r.jsx("div",{className:"text-xs text-gray-400",children:"Let the assistant search the web for additional context"})]}),r.jsx(Gc,{checked:e.use_internet,onCheckedChange:d=>t({...e,use_internet:d})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Response Language"}),r.jsx("select",{value:e.response_language,onChange:d=>t({...e,response_language:d.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:Lce.map(d=>r.jsx("option",{value:d.value,children:d.label},d.value))}),r.jsx("p",{className:"text-xs text-gray-400",children:"Force the assistant to respond in a specific language, or auto-detect."})]}),r.jsxs("div",{className:"border rounded-xl p-4 space-y-5 bg-amber-50 border-amber-200",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-amber-800",children:"Semantic Search — Ignore Keywords"}),r.jsx("p",{className:"text-xs text-amber-700 mt-0.5",children:"Words in this list are filtered out of query terms before keyword boosting, preventing generic words from skewing retrieval."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Ignore Keyword Prompt"}),r.jsx(rr,{value:e.ignore_keyword_prompt||"",onChange:d=>t({...e,ignore_keyword_prompt:d.target.value}),rows:4,placeholder:"Leave empty to use the global default from Settings…",className:"font-mono text-xs"}),r.jsxs("p",{className:"text-xs text-amber-600",children:[(c=e.ignore_keyword_prompt)!=null&&c.trim()?"Using assistant-specific prompt.":"Empty — will use global prompt from Settings as fallback."," ","This assistant's name, description, KB names, and instructions are automatically injected as context."]})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-white border-amber-200",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-700",children:"Auto-update ignore list"}),r.jsx("div",{className:"text-xs text-gray-400",children:"When enabled, the list is refreshed by the LLM on the first search after saving."})]}
868),r.jsx(Gc,{checked:e.auto_update_ignore_list??!0,onCheckedChange:d=>t({...e,auto_update_ignore_list:d})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ot,{children:"Ignore Keywords List"}),n&&!e.auto_update_ignore_list&&r.jsxs("button",{onClick:async()=>{var f;l(!0);const d=await Y.functions.invoke("updateAssistantIgnoreKeywords",{assistant_id:n});(f=d==null?void 0:d.data)!=null&&f.keywords&&t(m=>({...m,ignore_keywords_list:d.data.keywords})),l(!1)},disabled:o,className:"text-xs text-amber-700 bg-amber-100 border border-amber-300 hover:bg-amber-200 px-2.5 py-1 rounded-lg flex items-center gap-1 transition-colors disabled:opacity-50",children:[r.jsx(Rn,{className:`w-3 h-3 ${o?"animate-spin":""}`}),o?"Generating…":"Generate with AI"]})]}),e.auto_update_ignore_list?r.jsxs("div",{className:"bg-white border border-amber-200 rounded-lg p-3",children:[(e.ignore_keywords_list||[]).length>0?r.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-32 overflow-y-auto",children:(e.ignore_keywords_list||[]).map(d=>r.jsx("span",{className:"text-xs font-mono bg-amber-50 border border-amber-200 text-amber-700 rounded-full px-2 py-0.5",children:d},d))}):r.jsx("p",{className:"text-xs text-gray-400 italic",children:((s==null?void 0:s.ignore_keywords_list)||[]).length>0?`Using global list (${s.ignore_keywords_list.length} words) — will be auto-updated on first search.`:"No list yet — will be generated automatically on first search."}),r.jsx("p",{className:"text-[10px] text-amber-600 mt-2",children:"Auto-update is ON — list is managed automatically."})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"flex gap-2",children:r.jsx("input",{value:a,onChange:d=>i(d.target.value),onKeyDown:d=>{if(d.key==="Enter"){const f=a.trim().toLowerCase();f&&!(e.ignore_keywords_list||[]).includes(f)&&t(m=>({...m,ignore_keywords_list:[...m.ignore_keywords_list||[],f]})),i("")}},placeholder:"Type a word and press Enter…",className:"flex-1 border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-amber-400"})}),r.jsxs("div",{className:"flex flex-wrap gap-1.5 max-h-32 overflow-y-auto",children:[(e.ignore_keywords_list||[]).map(d=>r.jsxs("span",{className:"inline-flex items-center gap-1 bg-amber-50 border border-amber-200 text-amber-800 text-xs font-mono rounded-full px-2.5 py-1",children:[d,r.jsx("button",{onClick:()=>t(f=>({...f,ignore_keywords_list:(f.ignore_keywords_list||[]).filter(m=>m!==d)})),className:"text-amber-400 hover:text-red-500 transition-colors",children:r.jsx(jt,{className:"w-3 h-3"})})]},d)),(e.ignore_keywords_list||[]).length===0&&r.jsx("p",{className:"text-xs text-gray-400 italic",children:"No keywords yet."})]})]})]})]})]})}var Lb="Checkbox",[Bce]=Ti(Lb),[Fce,wE]=Bce(Lb);function zce(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:a,disabled:i,form:o,name:l,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:m}=e,[g,x]=so({prop:n,defaultProp:a??!1,onChange:c,caller:Lb}),[j,b]=h.useState(null),[y,w]=h.useState(null),_=h.useRef(!1),N=j?!!o||!!j.closest("form"):!0,C={checked:g,disabled:i,setChecked:x,control:j,setControl:b,name:l,form:o,value:f,hasConsumerStoppedPropagationRef:_,required:d,defaultChecked:Ql(a)?!1:a,isFormControl:N,bubbleInput:y,setBubbleInput:w};return r.jsx(Fce,{scope:t,...C,children:Uce(m)?m(C):s})}var f8="CheckboxTrigger",h8=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},a)=>{const{control:i,value:o,disabled:l,checked:c,required:d,setControl:f,setChecked:m,hasConsumerStoppedPropagationRef:g,isFormControl:x,bubbleInput:j}=wE(f8,e),b=xn(a,f),y=h.useRef(c);return h.useEffect(()=>{const w=i==null?void 0:i.form;if(w){const _=()=>m(y.current);return w.addEventListener("reset",_),()=>w.removeEventListener("reset",_)}},[i,m]),r.jsx(Mt.button,{type:"button",role:"checkbox","aria-checked":Ql(c)?"mixed":c,"aria-required":d,"data-state":b8(c),"data-disabled":l?"":void 0,disabled:l,value:o,...s,ref:b,onKeyDown:Rt(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:Rt(n,w=>{m(_=>Ql(_)?!0:!_),j&&x&&(g.current=w.isPropagationStopped(),g.current||w.stopPropagation())})})});h8.displayName=f8;var jE=h.forwardRef((e,t)=>
868{const{__scopeCheckbox:n,name:s,checked:a,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:d,form:f,...m}=e;return r.jsx(zce,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:l,required:o,onCheckedChange:d,name:s,form:f,value:c,internal_do_not_use_render:({isFormControl:g})=>r.jsxs(r.Fragment,{children:[r.jsx(h8,{...m,ref:t,__scopeCheckbox:n}),g&&r.jsx(y8,{__scopeCheckbox:n})]})})});jE.displayName=Lb;var p8="CheckboxIndicator",g8=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...a}=e,i=wE(p8,n);return r.jsx(Xo,{present:s||Ql(i.checked)||i.checked===!0,children:r.jsx(Mt.span,{"data-state":b8(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});g8.displayName=p8;var x8="CheckboxBubbleInput",y8=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:o,required:l,disabled:c,name:d,value:f,form:m,bubbleInput:g,setBubbleInput:x}=wE(x8,e),j=xn(n,x),b=Ob(i),y=Ib(s);h.useEffect(()=>{const _=g;if(!_)return;const N=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(N,"checked").set,S=!a.current;if(b!==i&&k){const A=new Event("click",{bubbles:S});_.indeterminate=Ql(i),k.call(_,Ql(i)?!1:i),_.dispatchEvent(A)}},[g,b,i,a]);const w=h.useRef(Ql(i)?!1:i);return r.jsx(Mt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??w.current,required:l,disabled:c,name:d,value:f,form:m,...t,tabIndex:-1,ref:j,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});y8.displayName=x8;function Uce(e){return typeof e=="function"}function Ql(e){return e==="indeterminate"}function b8(e){return Ql(e)?"indeterminate":e?"checked":"unchecked"}const v8=h.forwardRef(({className:e,...t},n)=>r.jsx(jE,{ref:n,className:rn("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(g8,{className:rn("flex items-center justify-center text-current"),children:r.jsx(Tn,{className:"h-4 w-4"})})}));v8.displayName=jE.displayName;const qce={indigo:"bg-indigo-500",blue:"bg-blue-500",emerald:"bg-emerald-500",teal:"bg-teal-500",cyan:"bg-cyan-500",violet:"bg-violet-500",purple:"bg-purple-500",fuchsia:"bg-fuchsia-500",pink:"bg-pink-500",rose:"bg-rose-500",red:"bg-red-500",orange:"bg-orange-500",amber:"bg-amber-500",yellow:"bg-yellow-500",lime:"bg-lime-500",green:"bg-green-500",slate:"bg-slate-500",gray:"bg-gray-400"};function _E(e){return qce[e]||"bg-indigo-500"}function Kce({kb:e,library:t,action:n,onAct:s}){const a=n==="add";return r.jsxs("button",{type:"button",onClick:()=>s(e.id),title:a?`Add ${e.name}`:`Remove ${e.name}`,className:`group w-full flex items-center gap-2.5 px-2.5 py-2 rounded-xl border text-left transition-all
869        ${a?"bg-white border-gray-200 hover:border-indigo-400 hover:bg-indigo-50/60":"bg-white border-indigo-100 hover:border-red-300 hover:bg-red-50/40"}`,children:[e.icon_url?r.jsx("img",{src:e.icon_url,alt:"",className:"w-7 h-7 rounded-lg object-contain shrink-0 border bg-white"}):r.jsx("span",{className:"w-7 h-7 rounded-lg bg-indigo-100 flex items-center justify-center shrink-0",children:r.jsx(_n,{className:"w-3.5 h-3.5 text-indigo-500"})}),r.jsxs("span",{className:"flex-1 min-w-0",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-sm font-medium text-gray-800 truncate",children:e.name}),e.status==="inactive"&&r.jsx("span",{className:"text-[10px] bg-gray-100 text-gray-400 border border-gray-200 px-1.5 rounded-full shrink-0",children:"inactive"})]}),r.jsxs("span",{className:"flex items-center gap-1.5 mt-0.5",children:[r.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${_E(t==null?void 0:t.color)}`}),r.jsx("span",{className:"text-[10px] text-gray-400 truncate",children:t?t.name:"Not in a library"}),e.type&&r.jsxs("span",{className:"text-[10px] text-gray-300 shrink-0",children:["· ",e.type]})]})]}),r.jsx("span",{className:`shrink-0 inline-flex items-center justify-center w-6 h-6 rounded-full border transition-colors
870        ${a?"border-indigo-200 text-indigo-500 group-hover:bg-indigo-500 group-hover:text-white group-hover:border-indigo-500":"border-gray-200 text-gray-400 group-hover:bg-red-500 group-hover:text-white group-hover:border-red-500"}`,children:a?r.jsx(ln,{className:"w-3.5 h-3.5"}):r.jsx(jt,{className:"w-3.5 h-3.5"})})]})}function O4({title:e,count:t,countTone:n="gray",emptyText:s,action:a,groups:i,onActGroup:o,onActKb:l}){const c=a==="add";return r.jsxs("div",{className:"flex flex-col rounded-2xl border border-gray-200 bg-gray-50/70 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 px-3.5 py-2.5 border-b border-gray-200 bg-white",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:e}),r.jsx("span",{className:`text-[10px] font-semibold px-2 py-0.5 rounded-full border
871          ${n==="indigo"?"bg-indigo-50 text-indigo-600 border-indigo-200":"bg-gray-50 text-gray-500 border-gray-200"}`,children:t})]}),r.jsx("div",{className:"flex-1 max-h-[440px] overflow-y-auto p-2 space-y-2.5",children:i.length===0?r.jsx("p",{className:"text-xs text-gray-400 italic text-center py-12 px-4",children:s}):i.map(d=>r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 pb-1",children:[r.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${_E(d.color)}`}),r.jsx("span",{className:"text-[11px] font-semibold text-gray-500 truncate",children:d.name}),r.jsx("span",{className:"text-[10px] text-gray-400 shrink-0",children:d.kbs.length}),r.jsx("button",{type:"button",onClick:()=>o(d.kbs.map(f=>f.id)),className:`ml-auto text-[10px] font-medium shrink-0 transition-colors
872                    ${c?"text-indigo-500 hover:text-indigo-700":"text-gray-400 hover:text-red-500"}`,children:c?"Add library":"Remove library"})]}),r.jsx("div",{className:"space-y-1.5",children:d.kbs.map(f=>r.jsx(Kce,{kb:f,library:d.lib,action:a,onAct:l},f.id))})]},d.key))})]})}function I4({active:e,onClick:t,dot:n,children:s}){return r.jsxs("button",{type:"button",onClick:t,className:`inline-flex items-center gap-1.5 shrink-0 text-[11px] font-medium rounded-full border px-2.5 py-1 transition-colors
873        ${e?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-500 border-gray-200 hover:border-indigo-300 hover:text-indigo-600"}`,children:[n&&r.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${e?"bg-white":_E(n)}`}),s]})}function Vce({kbs:e,libraries:t,selectedIds:n,onChange:s}){const a=n||[],[i,o]=h.useState(""),[l,c]=h.useState("all"),d=h.useMemo(()=>
873new Set(a),[a]),f=h.useMemo(()=>{const k={};return(t||[]).forEach(S=>{k[S.id]=S}),k},[t]),m=h.useMemo(()=>{const k=new Map;for(const A of e){const T=A.library_id?f[A.library_id]:null,R=T?T.id:"__none__";k.has(R)||k.set(R,{key:R,name:T?T.name:"Not in a library",color:T?T.color:"gray",lib:T,kbs:[]}),k.get(R).kbs.push(A)}const S=[...k.values()];return S.sort((A,T)=>A.key==="__none__"?1:T.key==="__none__"?-1:(A.name||"").localeCompare(T.name||"")),S.forEach(A=>A.kbs.sort((T,R)=>(T.name||"").localeCompare(R.name||""))),S},[e,f]),g=i.trim().toLowerCase(),x=k=>{var S;return!g||(k.name||"").toLowerCase().includes(g)||(k.description||"").toLowerCase().includes(g)||e.length&&(((S=f[k.library_id])==null?void 0:S.name)||"").toLowerCase().includes(g)},j=h.useMemo(()=>m.filter(k=>l==="all"||k.key===l).map(k=>({...k,kbs:k.kbs.filter(x)})).filter(k=>k.kbs.length>0),[m,g,l,e,f]),b=j.map(k=>({...k,kbs:k.kbs.filter(S=>!d.has(S.id))})).filter(k=>k.kbs.length>0),y=j.map(k=>({...k,kbs:k.kbs.filter(S=>d.has(S.id))})).filter(k=>k.kbs.length>0),w=b.reduce((k,S)=>k+S.kbs.length,0),_=y.reduce((k,S)=>k+S.kbs.length,0);function N(k){s([...new Set([...a,...k])])}function C(k){const S=new Set(k);s(a.filter(A=>!S.has(A)))}return e.length===0?r.jsx("p",{className:"text-sm text-gray-400 italic text-center py-8",children:"No knowledge bases found. Create one first."}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ur,{className:"w-3.5 h-3.5 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),r.jsx(It,{value:i,onChange:k=>o(k.target.value),placeholder:"Search knowledge bases or libraries…",className:"pl-9 pr-8 h-9 text-sm"}),i&&r.jsx("button",{type:"button",onClick:()=>o(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 p-0.5",children:r.jsx(jt,{className:"w-3.5 h-3.5"})})]}),a.length>0&&r.jsx("button",{type:"button",onClick:()=>s([]),className:"text-[11px] text-gray-400 hover:text-red-500 shrink-0 transition-colors",children:"Clear all"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 overflow-x-auto pb-1",children:[r.jsx(I4,{active:l==="all",onClick:()=>c("all"),children:"All libraries"}),m.map(k=>{const S=k.kbs.length,A=k.kbs.filter(T=>d.has(T.id)).length;return r.jsxs(I4,{active:l===k.key,onClick:()=>c(k.key),dot:k.color,children:[k.name," · ",A,"/",S]},k.key)})]}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(O4,{title:"Available",count:w,emptyText:g||l!=="all"?"Nothing matches this filter.":"Every knowledge base is already added.",action:"add",groups:b,onActGroup:N,onActKb:k=>N([k])}),r.jsx(O4,{title:"In this assistant",count:a.length,countTone:"indigo",emptyText:"Nothing added yet — pick knowledge bases on the left.",action:"remove",groups:y,onActGroup:C,onActKb:k=>C([k])})]}),_!==a.length&&r.jsxs("p",{className:"text-[11px] text-amber-600",children:[a.length-_," linked knowledge base",a.length-_===1?"":"s"," no longer exist."]})]})}function Hce({data:e,setData:t,kbs:n,libraries:s,investigations:a}){const i=e.type==="Investigation";function o(l){const c=(e.investigation_ids||[]).includes(l)?(e.investigation_ids||[]).filter(d=>d!==l):[...e.investigation_ids||[],l];t({...e,investigation_ids:c})}return r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Knowledge Bases"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Add or remove the knowledge bases this assistant can use for RAG retrieval. Click a knowledge base to move it between the two lists, or move a whole library at once."})]}),r.jsxs(Gr,{className:"bg-indigo-50 text-indigo-600 border border-indigo-200 text-[10px] shrink-0",children:[(e.knowledge_base_ids||[]).length," added"]})]}),r.jsx(Vce,{kbs:n,libraries:s,selectedIds:e.knowledge_base_ids,onChange:l=>t({...e,knowledge_base_ids:l})})]}),i&&r.jsxs("div",{className:"bg-white border border-amber-200 rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(ur,{className:"w-4 h-4 text-amber-600"}),r.jsx("h2",{className:"font-semibold text-sm text-amber-800",children:"Available Investigations"}),r.jsxs(Gr,{className:"bg-amber-100 text-amber-700 border-0 text-[10px]",children:[(e.investigation_ids||[]).length," selected"]})]}),r.jsxs("p",{className:"text-xs text-amber-700 ml-6",children:["Injected as ",r.jsx("code",{className:"bg-amber-100 px-1 rounded",children:"{{investigations_list}}"})," in the prompt."]})]}),a.length===0?r.jsx("p",{className:"text-sm text-amber-500 italic text-center py-8",children:"No investigations foun
873d."}):r.jsx("div",{className:"space-y-2",children:a.map(l=>r.jsxs("label",{className:`flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-all
874                  ${(e.investigation_ids||[]).includes(l.id)?"bg-amber-50 border-amber-300":"bg-gray-50 hover:bg-amber-50 hover:border-amber-200"}`,children:[r.jsx(v8,{checked:(e.investigation_ids||[]).includes(l.id),onCheckedChange:()=>o(l.id),className:"mt-0.5"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-800",children:l.name}),r.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium border
875                        ${l.type==="profile"?"bg-blue-50 text-blue-600 border-blue-200":l.type==="interest"?"bg-purple-50 text-purple-600 border-purple-200":"bg-emerald-50 text-emerald-600 border-emerald-200"}`,children:l.type})]}),l.description&&r.jsx("p",{className:"text-xs text-gray-400 mt-0.5 truncate",children:l.description})]})]},l.id))})]})]})}const Wce=[{id:"prompt",label:"Prompt",icon:Br},{id:"behavior",label:"Behavior",icon:s7},{id:"knowledge",label:"Knowledge",icon:_n}],Vj={name:"",assistant_key:"",description:"",type:"Knowledge",status:"active",icon_url:"",prompt_instructions:"",prompt_answer:"",response_object:{},json_answer:!0,answer_data_node:"",investigation_data_node:"",knowledge_base_ids:[],investigation_ids:[],agent_name:"",model:"automatic",temperature:.3,max_context_items:10,context_messages:6,max_chars_per_item:2e3,min_chunk_score:0,min_kb_score:.3,min_item_score:.4,max_items_per_kb:5,early_exit_score:.85,max_stage3_llm_calls:0,keyword_boost_kbs:!1,keyword_boost_items:!0,ivss_top_k_multiple:1,ivss_include_summaries:!1,ivss_query_model_primary:"jina-embeddings-v5-text-small",ivss_query_model_secondary:"none",search_function:"ItemsVectorSemanticSearch",jina_task:"retrieval.query",use_summary_mode:!1,use_internet:!1,response_language:"auto",suggested_prompts:[],chat_title:"",public_page_message:"",page_aware_welcome:"",library_label:"",disclaimer:"",ignore_keyword_prompt:"",auto_update_ignore_list:!0,ignore_keywords_list:[],embed_debug_mode:"system",embed_page_type:"original"};function Gce(){const e=Ca(),t=new URLSearchParams(window.location.search),[n,s]=h.useState(t.get("id")),[a,i]=h.useState([]),[o,l]=h.useState([]),[c,d]=h.useState([]),[f,m]=h.useState([]),[g,x]=h.useState(!!t.get("id")),[j,b]=h.useState(!1),[y,w]=h.useState(Vj),[_,N]=h.useState(Vj),[C,k]=h.useState("prompt"),[S,A]=h.useState(!0),[T,R]=h.useState(!1),[B,D]=h.useState(null),[P,I]=h.useState([]),[z,L]=h.useState("");h.useEffect(()=>{Y.entities.User.list().then(I).catch(()=>{}),Y.entities.AppConfig.filter({key:"global"}).then(K=>{const M=K[0]||null;D(M),!n&&M&&w(G=>({...G,ignore_keyword_prompt:M.ignore_keyword_prompt||"",ignore_keywords_list:M.ignore_keywords_list||[]}))}).catch(()=>{})},[]),h.useEffect(()=>{async function K(){const[M,G,q]=await Promise.all([Y.entities.KnowledgeBase.list(),Y.entities.Investigation.list(),Y.entities.Library.list()]);if(i(M),l(q),d(G.filter(F=>F.status==="active")),m([{name:"investigation_agent",label:"Investigation Agent"}]),n){const F=await Y.entities.Assistant.filter({id:n});if(F[0]){const U=F[0],ee={...Vj,name:U.name||"",description:U.description||"",type:U.type||"Knowledge",status:U.status||"active",icon_url:U.icon_url||"",prompt_instructions:U.prompt_instructions||U.system_prompt||"",prompt_answer:U.prompt_answer||"",response_object:U.response_object||U.prompt_data_object||{},json_answer:U.json_answer??!1,answer_data_node:U.answer_data_node||"",investigation_data_node:U.investigation_data_node||U.agent_data_node||"",knowledge_base_ids:U.knowledge_base_ids||[],investigation_ids:U.investigation_ids||[],agent_name:U.agent_name||"",model:U.model||"automatic",temperature:U.temperature??.3,max_context_items:U.max_context_items??10,context_messages:U.context_messages??6,max_chars_per_item:U.max_chars_per_item??2e3,min_chunk_score:U.min_chunk_score??U.min_score??0,min_kb_score:U.min_kb_score??.3,min_item_score:U.min_item_score??.4,max_items_per_kb:U.max_items_per_kb??5,early_exit_score:U.early_exit_score??.85,max_stage3_llm_calls:U.max_stage3_llm_calls??0,keyword_boost_kbs:U.keyword_boost_kbs??!1,keyword_boost_items:U.keyword_boost_items??!0,ivss_top_k_multiple:U.ivss_top_k_multiple??1,ivss_include_summaries:U.ivss_include_summaries??!1,ivss_query_model_primary:U.ivss_query_model_primary||"jina-embeddings-v5-text-small",ivss_query_model_secondary:U.ivss_query_model_secondary||"none",search_function:U.search_function||"ItemsVectorSemanticSearch",jina_task:U.jina_task||"retrieval.query",use_summary_mode:U.use_summary_mode??!1,use_internet:U.use_internet??!1,response_language:U.response_language||"auto",assistant_key:U.assistant_key||"",suggested_prompts:U.suggested_prompts||[],chat_title:U.chat_title||"",public_page_message:U.public_page_message||"",page_aware_welcome:U.page_aware_welcome||"",library_label:U.library_label||"",disclaimer:U.disclaimer||"",ignore_keyword_prompt:U.ignore_keyword_prompt||"",auto_update_ignore_list:U.auto_update_ignore_list??!0,ignore_keywords_list:U.ignore_keywords_list||[],embed_debug_mode:U.embed_debug_mode||"system",embed_page_type:U.embed_page_type||"original"};w(ee),N(ee)}x(!1)}}K()},[n]);const H=JSON.stringify(y)!==JSON.stringify(_);async function W(){if(y.name.trim()){if(b(!0),n)await Y.entities.Assistant.update(n,y);else{const K=await Y.entities.Assistant.create(y);s(K.id)}N(y),b(!1)}}function V(){H&&!window.confirm("You have unsaved changes. Leave without saving?")||e(yt("Assistants"))}return g?r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading..."}):r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:n?"Edit Assistant":"New Assistant"}),r.jsx("p",{className:"text-gray-500 text-xs mt-0.5",children:"Configure how your AI assistant behaves"})]}),r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx("button",{onClick:()=>A(K=>!K),className:"text-gray-400 hover:text-gray-700 p-1.5 rounded transition-colors",children:S?r.jsx(Lh,{className:"w-4 h-4"}):r.jsx(Nd,{className:"w-4 h-4"})}),H&&r.jsx("span",{className:"text-xs text-amber-600 font-medium bg-amber-50 border border-amber-200 rounded-lg px-2.5 py-1",children:"Unsaved changes"}),r.jsxs(de,{onClick:W,disabled:!y.name.trim()||j||!H,className:"gap-1.5",children:[r.jsx(Ar,{className:"w-4 h-4"}),j?"Saving...":"Save"]}),r.jsxs(de,{variant:"outline",onClick:V,className:"gap-1.5",children:[r.jsx(jt,{className:"w-4 h-4"})," Close"]})]})]}),r.jsx("div",{className:"border-b bg-white px-6 py-4 shrink-0",children:r.jsx("div",{className:`${S?"w-full":"max-w-2xl mx-auto"}`,children:r.jsx(tce,{data:y,setData:w,iconExpanded:T,setIconExpanded:R})})}),r.jsx("div",{className:"border-b bg-white px-6 shrink-0",children:r.jsx("div",{className:"flex gap-0",children:Wce.map(K=>r.jsxs("button",{onClick:()=>k(K.id),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 transition-colors
876                ${C===K.id?"border-indigo-500 text-indigo-700":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[r.jsx(K.icon,{className:"w-4 h-4"}),K.label]},K.id))})}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsxs("div",{className:`${S?"w-full":"max-w-2xl mx-auto"} space-y-5`,children:[C==="prompt"&&r.jsx(mce,{data:y,setData:w,editId:n,appConfig:B,agents:f,users:P,testUserId:z,setTestUserId:L}),C==="behavior"&&r.jsx($ce,{data:y,setData:w,editId:n,appConfig:B}),C==="knowledge"&&r.jsx(Hce,{data:y,setData:w,kbs:a,libraries:o,investigations:c})]})})]})}function Yce(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Jce=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qce=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xce={};function R4(e,t){return(Xce.jsx?Qce:Jce).test(e)}const Zce=/[ \t\n\f\r]/g;function ede(e){return typeof e=="object"?e.type==="text"?M4(e.value):!1:M4(e)}function M4(e){return e.replace(Zce,"")===""}class ig{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}ig.prototype.normal={};ig.prototype.property={};ig.prototype.space=void 0;function w8(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new ig(n,s,t)}function D2(e){return e.toLowerCase()}class sa{constructor(t,n){this.attribute=n,this.property=t}}sa.prototype.attribute="";sa.prototype.booleanish=!1;sa.prototype.boolean=!1;sa.prototype.commaOrSpaceSeparated=!1;sa.prototype.commaSeparated=!1;sa.prototype.defined=!1;sa.prototype.mustUseProperty=!1;sa.prototype.number=!1;sa.prototype.overloadedBoolean=!1;sa.prototype.property="";sa.prototype.spaceSeparated=!1;sa.prototype.space=void 0;let tde=0;const an=qd(),Ir=qd(),L2=qd(),rt=qd(),er=qd(),$u=qd(),fa=qd();function qd(){return 2**++tde}const $2=Object.freeze(Object.defineProperty({__proto__:null,boolean:an,booleanish:Ir,commaOrSpaceSeparated:fa,commaSeparated:$u,number:rt,overloadedBoolean:L2,spaceSeparated:er},Symbol.toStringTag,{value:"Module"})),Hj=Object.keys($2);class NE extends sa{constructor(t,n,s,a){let i=-1;
vendor: 4,264 bytes, line 876
876if(super(t,n),D4(this,"space",a),typeof s=="number")for(;++i<Hj.length;){const o=Hj[i];D4(this,Hj[i],(s&$2[o])===$2[o])}}}NE.prototype.defined=!0;function D4(e,t,n){n&&(e[t]=n)}function Wm(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const i=new NE(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[D2(s)]=s,n[D2(i.attribute)]=s}return new ig(t,n,e.space)}const j8=Wm({properties:{ariaActiveDescendant:null,ariaAtomic:Ir,ariaAutoComplete:null,ariaBusy:Ir,ariaChecked:Ir,ariaColCount:rt,ariaColIndex:rt,ariaColSpan:rt,ariaControls:er,ariaCurrent:null,ariaDescribedBy:er,ariaDetails:null,ariaDisabled:Ir,ariaDropEffect:er,ariaErrorMessage:null,ariaExpanded:Ir,ariaFlowTo:er,ariaGrabbed:Ir,ariaHasPopup:null,ariaHidden:Ir,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:er,ariaLevel:rt,ariaLive:null,ariaModal:Ir,ariaMultiLine:Ir,ariaMultiSelectable:Ir,ariaOrientation:null,ariaOwns:er,ariaPlaceholder:null,ariaPosInSet:rt,ariaPressed:Ir,ariaReadOnly:Ir,ariaRelevant:null,ariaRequired:Ir,ariaRoleDescription:er,ariaRowCount:rt,ariaRowIndex:rt,ariaRowSpan:rt,ariaSelected:Ir,ariaSetSize:rt,ariaSort:null,ariaValueMax:rt,ariaValueMin:rt,ariaValueNow:rt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function _8(e,t){return t in e?e[t]:t}function N8(e,t){return _8(e,t.toLowerCase())}const nde=Wm({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$u,acceptCharset:er,accessKey:er,action:null,allow:null,allowFullScreen:an,allowPaymentRequest:an,allowUserMedia:an,alt:null,as:null,async:an,autoCapitalize:null,autoComplete:er,autoFocus:an,autoPlay:an,blocking:er,capture:null,charSet:null,checked:an,cite:null,className:er,cols:rt,colSpan:null,content:null,contentEditable:Ir,controls:an,controlsList:er,coords:rt|$u,crossOrigin:null,data:null,dateTime:null,decoding:null,default:an,defer:an,dir:null,dirName:null,disabled:an,download:L2,draggable:Ir,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:an,formTarget:null,headers:er,height:rt,hidden:L2,high:rt,href:null,hrefLang:null,htmlFor:er,httpEquiv:er,id:null,imageSizes:null,imageSrcSet:null,inert:an,inputMode:null,integrity:null,is:null,isMap:an,itemId:null,itemProp:er,itemRef:er,itemScope:an,itemType:er,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:an,low:rt,manifest:null,max:null,maxLength:rt,media:null,method:null,min:null,minLength:rt,multiple:an,muted:an,name:null,nonce:null,noModule:an,noValidate:an,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:an,optimum:rt,pattern:null,ping:er,placeholder:null,playsInl
876ine:an,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:an,referrerPolicy:null,rel:er,required:an,reversed:an,rows:rt,rowSpan:rt,sandbox:er,scope:null,scoped:an,seamless:an,selected:an,shadowRootClonable:an,shadowRootDelegatesFocus:an,shadowRootMode:null,shape:null,size:rt,sizes:null,slot:null,span:rt,spellCheck:Ir,src:null,srcDoc:null,srcLang:null,srcSet:null,start:rt,step:null,style:null,tabIndex:rt,target:null,title:null,translate:null,type:null,typeMustMatch:an,useMap:null,value:Ir,width:rt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:er,axis:null,background:null,bgColor:null,border:rt,borderColor:null,bottomMargin:rt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:an,declare:an,event:null,face:null,frame:null,frameBorder:null,hSpace:rt,leftMargin:rt,link:null,longDesc:null,lowSrc:null,marginHeight:rt,marginWidth:rt,noResize:an,noHref:an,noShade:an,noWrap:an,object:null,profile:null,prompt:null,rev:null,rightMargin:rt,rules:null,scheme:null,scrolling:Ir,standby:null,summary:null,text:null,topMargin:rt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:rt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:an,disableRemotePlayback:an,prefix:null,property:null,results:rt,security:null,unselectable:null},space:"html",transform:N8}),rde=Wm({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav
876-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:fa,accentHeight:rt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:rt,amplitude:rt,arabicForm:null,ascent:rt,attributeName:null,attributeType:null,azimuth:rt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:rt,by:null,calcMode:null,capHeight:rt,className:er,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:rt,diffuseConstant:rt,direction:null,display:null,dur:null,divisor:rt,dominantBaseline:null,download:an,dx:null,dy:null,edgeMode:null,editable:null,elevation:rt,enableBackground:null,end:null,event:null,exponent:rt,externalResourcesRequired:null,fill:null,fillOpacity:rt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:$u,g2:$u,glyphName:$u,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:rt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:rt,horizOriginX:rt,horizOriginY:rt,id:null,ideographic:rt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:rt,k:rt,k1:rt,k2:rt,k3:rt,k4:rt,kernelMatrix:fa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:rt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:rt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
vendor: 4,107 bytes, lines 876-877
876Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:rt,overlineThickness:rt,paintOrder:null,panose1:null,path:null,pathLength:rt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:er,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:rt,pointsAtY:rt,pointsAtZ:rt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fa,rev:fa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fa,requiredFeatures:fa,requiredFonts:fa,requiredFormats:fa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:rt,specularExponent:rt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:rt,strikethroughThickness:rt,string:null,stroke:null,strokeDashArray:fa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:rt,strokeOpacity:rt,strokeWidth:null,style:null,surfaceScale:rt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fa,tabIndex:rt,tableValues:null,target:null,targetX:rt,targetY:rt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:rt,underlineThickness:rt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:rt,values:null,vAlphabetic:rt,vMathematical:rt,vectorEffect:null,vHanging:rt,vIdeographic:rt,version:null,vertAdvY:rt,vertOriginX:rt,vertOriginY:rt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:rt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:_8}),S8=Wm({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),k8=Wm({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:N8}),C8=Wm({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),sde={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},ade=/[A-Z]/g,L4=/-[a-z]/g,ide=/^data[-\w.:]+$/i;function ode(e,t){const n=D2(t);let s=t,a=sa;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ide.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(L4,cde);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!L4.test(i)){let o=i.replace(ade,lde);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=NE}return new a(s,t)}function lde(e){return"-"+e.toLowerCase()}function cde(e){return e.charAt(1).toUpperCase()}const dde=w8([j8,nde,S8,k8,C8],"html"),SE=w8([j8,rde,S8,k8,C8],"svg");function ude(e){return e.join(" ").trim()}var yu={},Wj,$4;function mde(){if($4)return Wj;$4=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
877`,d="/",f="*",m="",g="comment",x="declaration";function j(y,w){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];w=w||{};var _=1,N=1;function C(z){var L=z.match(t);
vendor: 5,015 bytes, line 877
877L&&(_+=L.length);var H=z.lastIndexOf(c);N=~H?z.length-H:N+z.length}function k(){var z={line:_,column:N};return function(L){return L.position=new S(z),R(),L}}function S(z){this.start=z,this.end={line:_,column:N},this.source=w.source}S.prototype.content=y;function A(z){var L=new Error(w.source+":"+_+":"+N+": "+z);if(L.reason=z,L.filename=w.source,L.line=_,L.column=N,L.source=y,!w.silent)throw L}function T(z){var L=z.exec(y);if(L){var H=L[0];return C(H),y=y.slice(H.length),L}}function R(){T(n)}function B(z){var L;for(z=z||[];L=D();)L!==!1&&z.push(L);return z}function D(){var z=k();if(!(d!=y.charAt(0)||f!=y.charAt(1))){for(var L=2;m!=y.charAt(L)&&(f!=y.charAt(L)||d!=y.charAt(L+1));)++L;if(L+=2,m===y.charAt(L-1))return A("End of comment missing");var H=y.slice(2,L-2);return N+=2,C(H),y=y.slice(L),N+=2,z({type:g,comment:H})}}function P(){var z=k(),L=T(s);if(L){if(D(),!T(a))return A("property missing ':'");var H=T(i),W=z({type:x,property:b(L[0].replace(e,m)),value:H?b(H[0].replace(e,m)):m});return T(o),W}}function I(){var z=[];B(z);for(var L;L=P();)L!==!1&&(z.push(L),B(z));return z}return R(),I()}function b(y){return y?y.replace(l,m):m}return Wj=j,Wj}var B4;function fde(){if(B4)return yu;B4=1;var e=yu&&yu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(yu,"__esModule",{value:!0}),yu.default=n;const t=e(mde());function n(s,a){let i=null;if(!s||typeof s!="string")return i;const o=(0,t.default)(s),l=typeof a=="function";return o.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:f}=c;l?a(d,f,c):f&&(i=i||{},i[d]=f)}),i}return yu}var Kf={},F4;function hde(){if(F4)return Kf;F4=1,Object.defineProperty(Kf,"__esModule",{value:!0}),Kf.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,i=function(d){return!d||n.test(d)||e.test(d)},o=function(d,f){return f.toUpperCase()},l=function(d,f){return"".concat(f,"-")},c=function(d,f){return f===void 0&&(f={}),i(d)?d:(d=d.toLowerCase(),f.reactCompat?d=d.replace(a,l):d=d.replace(s,l),d.replace(t,o))};return Kf.camelCase=c,Kf}var Vf,z4;function pde(){if(z4)return Vf;z4=1;var e=Vf&&Vf.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(fde()),n=hde();function s(a,i){var o={};return!a||typeof a!="string"||(0,t.default)(a,function(l,c){l&&c&&(o[(0,n.camelCase)(l,i)]=c)}),o}return s.default=s,Vf=s,Vf}var gde=pde();const xde=Un(gde),E8=A8("end"),kE=A8("start");function A8(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function yde(e){const t=kE(e),n=E8(e);if(t&&n)return{start:t,end:n}}function _h(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?U4(e.position):"start"in e||"end"in e?U4(e):"line"in e||"column"in e?B2(e):""}function B2(e){return q4(e&&e.line)+":"+q4(e&&e.column)}function U4(e){return B2(e&&e.start)+"-"+B2(e&&e.end)}function q4(e){return e&&typeof e=="number"?e:1}class Ps extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?i.ruleId=s:(i.source=s.slice(0,c),i.ruleId=s.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=_h(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ps.prototype.file="";Ps.prototype.name="";Ps.prototype.reason="";Ps.prototype.message="";Ps.prototype.stack="";Ps.prototype.column=void 0;Ps.prototype.line=void 0;Ps.prototype.ancestors=void 0;Ps.prototype.cause=void 0;Ps.prototype.fatal=void 0;Ps.prototype.place=void 0;Ps.prototype.ruleId=void 0;Ps.prototype.source=void 0;const CE={}.hasOwnProperty,bde=new Map,vde=/[A-Z]/g,wde=new Set(["table","tbody","thead","tfoot","tr"]),jde=new Set(["td","th"]),T8="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function _de(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=Pde(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 6,347 bytes, line 877
877if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=Tde(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?SE:dde,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=P8(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function P8(e,t,n){if(t.type==="element")return Nde(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Sde(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Cde(e,t,n);if(t.type==="mdxjsEsm")return kde(e,t);if(t.type==="root")return Ede(e,t,n);if(t.type==="text")return Ade(e,t)}function Nde(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=SE,e.schema=a),e.ancestors.push(t);const i=I8(e,t.tagName,!1),o=Ode(e,t);let l=AE(e,t);return wde.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!ede(c):!0})),O8(e,o,i,t),EE(o,l),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Sde(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Kh(e,t.position)}function kde(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Kh(e,t.position)}function Cde(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=SE,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:I8(e,t.name,!0),o=Ide(e,t),l=AE(e,t);return O8(e,o,i,t),EE(o,l),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function Ede(e,t,n){const s={};return EE(s,AE(e,t)),e.create(t,e.Fragment,s,n)}function Ade(e,t){return t.value}function O8(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function EE(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Tde(e,t,n){return s;function s(a,i,o,l){const d=Array.isArray(o.children)?n:t;return l?d(i,o,l):d(i,o)}}function Pde(e,t){return n;function n(s,a,i,o){const l=Array.isArray(i.children),c=kE(s);return t(a,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function Ode(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&CE.call(t.properties,a)){const i=Rde(e,a,t.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&jde.has(t.tagName)?s=l:n[o]=l}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function Ide(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Kh(e,t.position);else{const a=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const l=s.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else Kh(e,t.position);else i=s.value===null?!0:s.value;n[a]=i}return n}function AE(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:bde;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=a.get(c)||0;o=c+"-"+d,a.set(c,d+1)}}const l=P8(e,i,o);l!==void 0&&n.push(l)}return n}function Rde(e,t,n){const s=ode(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?Yce(n):ude(n)),s.property==="style"){let a=typeof n=="object"?n:Mde(e,String(n));return e.stylePropertyNameCase==="css"&&(a=Dde(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?sde[s.property]||s.property:s.attribute,n]}}function Mde(e,t){try{return xde(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Ps("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=T8+"#cannot-parse-style-attribute",a}}function I8(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const l=R4(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}s=o}else s=R4(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return CE.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);Kh(e)}function Kh(e,t){const n=new Ps("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=T8+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Dde(e){const t={};let n;for(n in e)CE.call(e,n)&&(t[Lde(n)]=e[n]);return t}function Lde(e){let t=e.replace(vde,$de);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function $de(e){return"-"+e.toLowerCase()}const Gj={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Bde={};function Fde(e,t){const n=Bde,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return R8(e,s,a)}function R8(e,t,n){if(zde(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return K4(e.children,t,n)}return Array.isArray(e)?K4(e,t,n):""}function K4(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=R8(e[a],t,n);return s.join("")}function zde(e){return!!(e&&typeof e=="object")}const V4=document.createElement("i");function TE(e){const t="&"+e+";";V4.innerHTML=t;const n=V4.textContent;
vendor: 10,925 bytes, line 877
877return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function oo(e,t,n,s){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Ha(e,t){return e.length>0?(oo(e,e.length,0,t),e):t}const H4={}.hasOwnProperty;function Ude(e){const t={};let n=-1;for(;++n<e.length;)qde(t,e[n]);return t}function qde(e,t){let n;for(n in t){const a=(H4.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){H4.call(a,o)||(a[o]=[]);const l=i[o];Kde(a[o],Array.isArray(l)?l:l?[l]:[])}}}function Kde(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);oo(e,0,0,s)}function M8(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Bu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Gi=xc(/[A-Za-z]/),ba=xc(/[\dA-Za-z]/),Vde=xc(/[#-'*+\--9=?A-Z^-~]/);function F2(e){return e!==null&&(e<32||e===127)}const z2=xc(/\d/),Hde=xc(/[\dA-Fa-f]/),Wde=xc(/[!-/:-@[-`{-~]/);function Qt(e){return e!==null&&e<-2}function na(e){return e!==null&&(e<0||e===32)}function In(e){return e===-2||e===-1||e===32}const Gde=xc(new RegExp("\\p{P}|\\p{S}","u")),Yde=xc(/\s/);function xc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gm(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&ba(e.charCodeAt(n+1))&&ba(e.charCodeAt(n+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,n),encodeURIComponent(o)),s=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function nr(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return In(c)?(e.enter(n),l(c)):t(c)}function l(c){return In(c)&&i++<a?(e.consume(c),l):(e.exit(n),t(c))}}const Jde={tokenize:Qde};function Qde(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),nr(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Qt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const Xde={tokenize:Zde},W4={tokenize:eue};function Zde(e){const t=this,n=[];let s=0,a,i,o;return l;function l(N){if(s<n.length){const C=n[s];return t.containerState=C[1],e.attempt(C[0].continuation,c,d)(N)}return d(N)}function c(N){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&_();const C=t.events.length;let k=C,S;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){S=t.events[k][1].end;break}w(s);let A=C;for(;A<t.events.length;)t.events[A][1].end={...S},A++;return oo(t.events,k+1,0,t.events.slice(C)),t.events.length=A,d(N)}return l(N)}function d(N){if(s===n.length){if(!a)return g(N);if(a.currentConstruct&&a.currentConstruct.concrete)return j(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(W4,f,m)(N)}function f(N){return a&&_(),w(s),g(N)}function m(N){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,j(N)}function g(N){return t.containerState={},e.attempt(W4,x,j)(N)}function x(N){return s++,n.push([t.currentConstruct,t.containerState]),g(N)}function j(N){if(N===null){a&&_(),w(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),b(N)}function b(N){if(N===null){y(e.exit("chunkFlow"),!0),w(0),e.consume(N);return}return Qt(N)?(e.consume(N),y(e.exit("chunkFlow")),s=0,t.interrupt=void 0,l):(e.consume(N),b)}function y(N,C){const k=t.sliceStream(N);if(C&&k.push(null),N.previous=i,i&&(i.next=N),i=N,a.defineSkip(N.start),a.write(k),t.parser.lazy[N.start.line]){let S=a.events.length;for(;S--;)if(a.events[S][1].start.offset<o&&(!a.events[S][1].end||a.events[S][1].end.offset>o))return;const A=t.events.length;let T=A,R,B;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(R){B=t.events[T][1].end;break}R=!0}for(w(s),S=A;S<t.events.length;)t.events[S][1].end={...B},S++;oo(t.events,T+1,0,t.events.slice(A)),t.events.length=S}}function w(N){let C=n.length;for(;C-- >N;){const k=n[C];t.containerState=k[1],k[0].exit.call(t,e)}n.length=N}function _(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function eue(e,t,n){return nr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function G4(e){if(e===null||na(e)||Yde(e))return 1;if(Gde(e))return 2}function PE(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const U2={name:"attention",resolveAll:tue,tokenize:nue};function tue(e,t){let n=-1,s,a,i,o,l,c,d,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[s][1].end},g={...e[n][1].start};Y4(m,-c),Y4(g,c),o={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...e[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[s][1].end={...o.start},e[n][1].start={...l.end},d=[],e[s][1].end.offset-e[s][1].start.offset&&(d=Ha(d,[["enter",e[s][1],t],["exit",e[s][1],t]])),d=Ha(d,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),d=Ha(d,PE(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),d=Ha(d,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,d=Ha(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,oo(e,s-1,n-s+3,d),n=s+d.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function nue(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=G4(s);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const d=e.exit("attentionSequence"),f=G4(c),m=!f||f===2&&a||n.includes(c),g=!a||a===2&&f||n.includes(s);return d._open=!!(i===42?m:m&&(a||!g)),d._close=!!(i===42?g:g&&(f||!m)),t(c)}}function Y4(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const rue={name:"autolink",tokenize:sue};function sue(e,t,n){let s=0;return a;function a(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(x){return Gi(x)?(e.consume(x),o):x===64?n(x):d(x)}function o(x){return x===43||x===45||x===46||ba(x)?(s=1,l(x)):d(x)}function l(x){return x===58?(e.consume(x),s=0,c):(x===43||x===45||x===46||ba(x))&&s++<32?(e.consume(x),l):(s=0,d(x))}function c(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||F2(x)?n(x):(e.consume(x),c)}function d(x){return x===64?(e.consume(x),f):Vde(x)?(e.consume(x),d):n(x)}function f(x){return ba(x)?m(x):n(x)}function m(x){return x===46?(e.consume(x),s=0,f):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):g(x)}function g(x){if((x===45||ba(x))&&s++<63){const j=x===45?g:m;return e.consume(x),j}return n(x)}}const $b={partial:!0,tokenize:aue};function aue(e,t,n){return s;function s(i){return In(i)?nr(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||Qt(i)?t(i):n(i)}}const D8={continuation:{tokenize:oue},exit:lue,name:"blockQuote",tokenize:iue};function iue(e,t,n){const s=this;return a;function a(o){if(o===62){const l=s.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return In(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function oue(e,t,n){const s=this;return a;function a(o){return In(o)?nr(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(D8,t,n)(o)}}function lue(e){e.exit("blockQuote")}const L8={name:"characterEscape",tokenize:cue};function cue(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return Wde(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const $8={name:"characterReference",tokenize:due};function due(e,t,n){const s=this;let a=0,i,o;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),c}function c(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,o=ba,f(m))}function d(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=Hde,f):(e.enter("characterReferenceValue"),i=7,o=z2,f(m))}function f(m){if(m===59&&a){const g=e.exit("characterReferenceValue");return o===ba&&!TE(s.sliceSerialize(g))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(m)&&a++<i?(e.consume(m),f):n(m)}}const J4={partial:!0,tokenize:mue},Q4={concrete:!0,name:"codeFenced",tokenize:uue};function uue(e,t,n){const s=this,a={partial:!0,tokenize:k};let i=0,o=0,l;return c;function c(S){return d(S)}function d(S){const A=s.events[s.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=S,e.enter("co
877deFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(S)}function f(S){return S===l?(o++,e.consume(S),f):o<3?n(S):(e.exit("codeFencedFenceSequence"),In(S)?nr(e,m,"whitespace")(S):m(S))}function m(S){return S===null||Qt(S)?(e.exit("codeFencedFence"),s.interrupt?t(S):e.check(J4,b,C)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||Qt(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(S)):In(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),nr(e,x,"whitespace")(S)):S===96&&S===l?n(S):(e.consume(S),g)}function x(S){return S===null||Qt(S)?m(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),j(S))}function j(S){return S===null||Qt(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(S)):S===96&&S===l?n(S):(e.consume(S),j)}function b(S){return e.attempt(a,C,y)(S)}function y(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),w}function w(S){return i>0&&In(S)?nr(e,_,"linePrefix",i+1)(S):_(S)}function _(S){return S===null||Qt(S)?e.check(J4,b,C)(S):(e.enter("codeFlowValue"),N(S))}function N(S){return S===null||Qt(S)?(e.exit("codeFlowValue"),_(S)):(e.consume(S),N)}function C(S){return e.exit("codeFenced"),t(S)}function k(S,A,T){let R=0;return B;function B(L){return S.enter("lineEnding"),S.consume(L),S.exit("lineEnding"),D}function D(L){return S.enter("codeFencedFence"),In(L)?nr(S,P,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):P(L)}function P(L){return L===l?(S.enter("codeFencedFenceSequence"),I(L)):T(L)}function I(L){return L===l?(R++,S.consume(L),I):R>=o?(S.exit("codeFencedFenceSequence"),In(L)?nr(S,z,"whitespace")(L):z(L)):T(L)}function z(L){return L===null||Qt(L)?(S.exit("codeFencedFence"),A(L)):T(L)}}}function mue(e,t,n){const s=this;return a;function a(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}const Yj={name:"codeIndented",tokenize:hue},fue={partial:!0,tokenize:pue};function hue(e,t,n){const s=this;return a;function a(d){return e.enter("codeIndented"),nr(e,i,"linePrefix",5)(d)}function i(d){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(d):n(d)}function o(d){return d===null?c(d):Qt(d)?e.attempt(fue,o,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||Qt(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function pue(e,t,n){const s=this;return a;function a(o){return s.parser.lazy[s.now().line]?n(o):Qt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):nr(e,i,"linePrefix",5)(o)}function i(o){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):Qt(o)?a(o):n(o)}}const gue={name:"codeText",previous:yue,resolve:xue,tokenize:bue};function xue(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function yue(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function bue(e,t,n){let s=0,a,i;return o;function o(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),s++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(i=e.enter("codeTextSequence"),a=0,f(m)):Qt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||Qt(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),d)}function f(m){return m===96?(e.consume(m),a++,f):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",d(m))}}class vue{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Hf(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Hf(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Hf(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Hf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Hf(this.left,n.reverse())}}}function Hf(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function B8(e){const t={};let n=-1,s,a,i,o,l,c,d;const f=new vue(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(s=f.get(n),n&&s[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=s[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,wue(f,n)),n=t[n],d=!0);else if(s[1]._container){for(i=n,a=void 0;i--;)if(o=f.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(f.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(s[1].end={...f.get(a)[1].start},l=f.slice(a,n),l.unshift(s),f.splice(a,n-a+1,l))}}return oo(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!d}function wue(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],d={};let f,m,g=-1,x=n,j=0,b=0;const y=[b];for(;x;){for(;e.get(++a)[1]!==x;);
vendor: 22,920 bytes, line 877
877i.push(a),x._tokenizer||(f=s.sliceStream(x),x.next||f.push(null),m&&o.defineSkip(x.start),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(f),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),m=x,x=x.next}for(x=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(b=g+1,y.push(b),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(o.events=[],x?(x._tokenizer=void 0,x.previous=void 0):y.pop(),g=y.length;g--;){const w=l.slice(y[g],y[g+1]),_=i.pop();c.push([_,_+w.length-1]),e.splice(_,2,w)}for(c.reverse(),g=-1;++g<c.length;)d[j+c[g][0]]=j+c[g][1],j+=c[g][1]-c[g][0]-1;return d}const jue={resolve:Nue,tokenize:Sue},_ue={partial:!0,tokenize:kue};function Nue(e){return B8(e),e}function Sue(e,t){let n;return s;function s(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):Qt(l)?e.check(_ue,o,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function kue(e,t,n){const s=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),nr(e,i,"linePrefix")}function i(o){if(o===null||Qt(o))return n(o);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function F8(e,t,n,s,a,i,o,l,c){const d=c||Number.POSITIVE_INFINITY;let f=0;return m;function m(w){return w===60?(e.enter(s),e.enter(a),e.enter(i),e.consume(w),e.exit(i),g):w===null||w===32||w===41||F2(w)?n(w):(e.enter(s),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(w))}function g(w){return w===62?(e.enter(i),e.consume(w),e.exit(i),e.exit(a),e.exit(s),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),x(w))}function x(w){return w===62?(e.exit("chunkString"),e.exit(l),g(w)):w===null||w===60||Qt(w)?n(w):(e.consume(w),w===92?j:x)}function j(w){return w===60||w===62||w===92?(e.consume(w),x):x(w)}function b(w){return!f&&(w===null||w===41||na(w))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(s),t(w)):f<d&&w===40?(e.consume(w),f++,b):w===41?(e.consume(w),f--,b):w===null||w===32||w===40||F2(w)?n(w):(e.consume(w),w===92?y:b)}function y(w){return w===40||w===41||w===92?(e.consume(w),b):b(w)}}function z8(e,t,n,s,a,i){const o=this;let l=0,c;return d;function d(x){return e.enter(s),e.enter(a),e.consume(x),e.exit(a),e.enter(i),f}function f(x){return l>999||x===null||x===91||x===93&&!c||x===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(x):x===93?(e.exit(i),e.enter(a),e.consume(x),e.exit(a),e.exit(s),t):Qt(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||Qt(x)||l++>999?(e.exit("chunkString"),f(x)):(e.consume(x),c||(c=!In(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(e.consume(x),l++,m):m(x)}}function U8(e,t,n,s,a,i){let o;return l;function l(g){return g===34||g===39||g===40?(e.enter(s),e.enter(a),e.consume(g),e.exit(a),o=g===40?41:g,c):n(g)}function c(g){return g===o?(e.enter(a),e.consume(g),e.exit(a),e.exit(s),t):(e.enter(i),d(g))}function d(g){return g===o?(e.exit(i),c(o)):g===null?n(g):Qt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),nr(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===o||g===null||Qt(g)?(e.exit("chunkString"),d(g)):(e.consume(g),g===92?m:f)}function m(g){return g===o||g===92?(e.consume(g),f):f(g)}}function Nh(e,t){let n;return s;function s(a){return Qt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):In(a)?nr(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const Cue={name:"definition",tokenize:Aue},Eue={partial:!0,tokenize:Tue};function Aue(e,t,n){const s=this;let a;return i;function i(x){return e.enter("definition"),o(x)}function o(x){return z8.call(s,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function l(x){return a=Bu(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),c):n(x)}function c(x){return na(x)?Nh(e,d)(x):d(x)}function d(x){return F8(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return e.attempt(Eue,m,m)(x)}function m(x){return In(x)?nr(e,g,"whitespace")(x):g(x)}function g(x){return x===null||Qt(x)?(e.exit("definition"),s.parser.defined.push(a),t(x)):n(x)}}function Tue(e,t,n){return s;function s(l){return na(l)?Nh(e,a)(l):n(l)}function a(l){return U8(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return In(l)?nr(e,o,"whitespace")(l):o(l)}function o(l){return l===null||Qt(l)?t(l):n(l)}}const Pue={name:"hardBreakEscape",tokenize:Oue};function Oue(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return Qt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Iue={name:"headingAtx",resolve:Rue,tokenize:Mue};function Rue(e,t){let n=e.length-2,s=3,a,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},oo(e,s,n-s+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function Mue(e,t,n){let s=0;return a;function a(f){return e.enter("atxHeading"),i(f)}function i(f){return e.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&s++<6?(e.consume(f),o):f===null||na(f)?(e.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(e.enter("atxHeadingSequence"),c(f)):f===null||Qt(f)?(e.exit("atxHeading"),t(f)):In(f)?nr(e,l,"whitespace")(f):(e.enter("atxHeadingText"),d(f))}function c(f){return f===35?(e.consume(f),c):(e.exit("atxHeadingSequence"),l(f))}function d(f){return f===null||f===35||na(f)?(e.exit("atxHeadingText"),l(f)):(e.consume(f),d)}}const Due=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],X4=["pre","script","style","textarea"],Lue={concrete:!0,name:"htmlFlow",resolveTo:Fue,tokenize:zue},$ue={partial:!0,tokenize:que},Bue={partial:!0,tokenize:Uue};function Fue(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function zue(e,t,n){const s=this;let a,i,o,l,c;return d;function d(F){return f(F)}function f(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),m}function m(F){return F===33?(e.consume(F),g):F===47?(e.consume(F),i=!0,b):F===63?(e.consume(F),a=3,s.interrupt?t:M):Gi(F)?(e.consume(F),o=String.fromCharCode(F),y):n(F)}function g(F){return F===45?(e.consume(F),a=2,x):F===91?(e.consume(F),a=5,l=0,j):Gi(F)?(e.consume(F),a=4,s.interrupt?t:M):n(F)}function x(F){return F===45?(e.consume(F),s.interrupt?t:M):n(F)}function j(F){const U="CDATA[";return F===U.charCodeAt(l++)?(e.consume(F),l===U.length?s.interrupt?t:P:j):n(F)}function b(F){return Gi(F)?(e.consume(F),o=String.fromCharCode(F),y):n(F)}function y(F){if(F===null||F===47||F===62||na(F)){const U=F===47,ee=o.toLowerCase();return!U&&!i&&X4.includes(ee)?(a=1,s.interrupt?t(F):P(F)):Due.includes(o.toLowerCase())?(a=6,U?(e.consume(F),w):s.interrupt?t(F):P(F)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(F):i?_(F):N(F))}return F===45||ba(F)?(e.consume(F),o+=String.fromCharCode(F),y):n(F)}function w(F){return F===62?(e.consume(F),s.interrupt?t:P):n(F)}function _(F){return In(F)?(e.consume(F),_):B(F)}function N(F){return F===47?(e.consume(F),B):F===58||F===95||Gi(F)?(e.consume(F),C):In(F)?(e.consume(F),N):B(F)}function C(F){return F===45||F===46||F===58||F===95||ba(F)?(e.consume(F),C):k(F)}function k(F){return F===61?(e.consume(F),S):In(F)?(e.consume(F),k):N(F)}function S(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),c=F,A):In(F)?(e.consume(F),S):T(F)}function A(F){return F===c?(e.consume(F),c=null,R):F===null||Qt(F)?n(F):(e.consume(F),A)}function T(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||na(F)?k(F):(e.consume(F),T)}function R(F){return F===47||F===62||In(F)?N(F):n(F)}function B(F){return F===62?(e.consume(F),D):n(F)}function D(F){return F===null||Qt(F)?P(F):In(F)?(e.consume(F),D):n(F)}function P(F){return F===45&&a===2?(e.consume(F),H):F===60&&a===1?(e.consume(F),W):F===62&&a===4?(e.consume(F),G):F===63&&a===3?(e.consume(F),M):F===93&&a===5?(e.consume(F),K):Qt(F)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check($ue,q,I)(F)):F===null||Qt(F)?(e.exit("htmlFlowData"),I(F)):(e.consume(F),P)}function I(F){return e.check(Bue,z,q)(F)}function z(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),L}function L(F){return F===null||Qt(F)?I(F):(e.enter("htmlFlowData"),P(F))}function H(F){return F===45?(e.consume(F),M):P(F)}function W(F){return F===47?(e.consume(F),o="",V):P(F)}function V(F){if(F===62){const U=o.toLowerCase();return X4.includes(U)?(e.consume(F),G):P(F)}return Gi(F)&&o.length<8?(e.consume(F),o+=String.fromCharCode(F),V):P(F)}function K(F){return F===93?(e.consume(F),M):P(F)}function M(F){return F===62?(e.consume(F),G):F===45&&a===2?(e.consume(F),M):P(F)}function G(F){return F===null||Qt(F)?(e.exit("htmlFlowData"),q(F)):(e.consume(F),G)}function q(F){return e.exit("htmlFlow"),t(F)}}function Uue(e,t,n){const s=this;return a;function a(o){return Qt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function que(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt($b,t,n)}}const Kue={name:"htmlText",tokenize:Vue};function Vue(e,t,n){const s=this;let a,i,o;return l;function l(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),c}function c(M){return M===33?(e.consume(M),d):M===47?(e.consume(M),k):M===63?(e.consume(M),N):Gi(M)?(e.consume(M),T):n(M)}function d(M){return M===45?(e.consume(M),f):M===91?(e.consume(M),i=0,j):Gi(M)?(e.consume(M),_):n(M)}function f(M){return M===45?(e.consume(M),x):n(M)}function m(M){return M===null?n(M):M===45?(e.consume(M),g):Qt(M)?(o=m,W(M)):(e.consume(M),m)}function g(M){return M===45?(e.consume(M),x):m(M)}function x(M){return M===62?H(M):M===45?g(M):m(M)}function j(M){const G="CDATA[";return M===G.charCodeAt(i++)?(e.consume(M),i===G.length?b:j):n(M)}function b(M){return M===null?n(M):M===93?(e.consume(M),y):Qt(M)?(o=b,W(M)):(e.consume(M),b)}function y(M){return M===93?(e.consume(M),w):b(M)}function w(M){return M===62?H(M):M===93?(e.consume(M),w):b(M)}function _(M){return M===null||M===62?H(M):Qt(M)?(o=_,W(M)):(e.consume(M),_)}function N(M){return M===null?n(M):M===63?(e.consume(M),C):Qt(M)?(o=N,W(M)):(e.consume(M),N)}function C(M){return M===62?H(M):N(M)}function k(M){return Gi(M)?(e.consume(M),S):n(M)}function S(M){return M===45||ba(M)?(e.consume(M),S):A(M)}function A(M){return Qt(M)?(o=A,W(M)):In(M)?(e.consume(M),A):H(M)}function T(M){return M===45||ba(M)?(e.consume(M),T):M===47||M===62||na(M)?R(M):n(M)}function R(M){return M===47?(e.consume(M),H):M===58||M===95||Gi(M)?(e.consume(M),B):Qt(M)?(o=R,W(M)):In(M)?(e.consume(M),R):H(M)}function B(M){return M===45||M===46||M===58||M===95||ba(M)?(e.consume(M),B):D(M)}function D(M){return M===61?(e.consume(M),P):Qt(M)?(o=D,W(M)):In(M)?(e.consume(M),D):R(M)}function P(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),a=M,I):Qt(M)?(o=P,W(M)):In(M)?(e.consume(M),P):(e.consume(M),z)}function I(M){return M===a?(e.consume(M),a=void 0,L):M===null?n(M):Qt(M)?(o=I,W(M)):(e.consume(M),I)}function z(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||na(M)?R(M):(e.consume(M),z)}function L(M){return M===47||M===62||na(M)?R(M):n(M)}function H(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function W(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),V}function V(M){return In(M)?nr(e,K,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):K(M)}function K(M){return e.enter("htmlTextData"),o(M)}}const OE={name:"labelEnd",resolveAll:Yue,resolveTo:Jue,tokenize:Que},Hue={tokenize:Xue},Wue={tokenize:Zue},Gue={tokenize:eme};function Yue(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&oo(e,0,e.length,n),e}function Jue(e,t){let n=e.length,s=0,a,i,o,l;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(o=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},f={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=Ha(l,e.slice(i+1,i+s+3)),l=Ha(l,[["enter",f,t]]),l=Ha(l,PE(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),l=Ha(l,[["exit",f,t],e[o-2],e[o-1],["exit",d,t]]),l=Ha(l,e.slice(o+1)),l=Ha(l,[["exit",c,t]]),oo(e,i,e.length,l),e}function Que(e,t,n){const s=this;let a=s.events.length,i,o;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){i=s.events[a][1];break}return l;function l(g){return i?i._inactive?m(g):(o=s.parser.defined.includes(Bu(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),c):n(g)}function c(g){return g===40?e.attempt(Hue,f,o?f:m)(g):g===91?e.attempt(Wue,f,o?d:m)(g):o?f(g):m(g)}function d(g){return e.attempt(Gue,f,m)(g)}function f(g){return t(g)}function m(g){return i._balanced=!0,n(g)}}function Xue(e,t,n){return s;function s(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return na(m)?Nh(e,i)(m):i(m)}function i(m){return m===41?f(m):F8(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function o(m){return na(m)?Nh(e,c)(m):f(m)}function l(m){return n(m)}function c(m){return m===34||m===39||m===40?U8(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):f(m)}function d(m){return na(m)?Nh(e,f)(m):f(m)}function f(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function Zue(e,t,n){const s=this;return a;function a(l){return z8.call(s,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return s.parser.defined.includes(Bu(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function eme(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const tme={name:"labelStartImage",resolveAll:OE.resolveAll,tokenize:nme};function nme(e,t,n){const s=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):t(l)}}const rme={name:"labelStartLink",resolveAll:OE.resolveAll,tokenize:sme};function sme(e,t,n){const s=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):t(o)}}const Jj={name:"lineEnding",tokenize:ame};function ame(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),nr(e,t,"linePrefix")}}const S0={name:"thematicBreak",tokenize:ime};function ime(e,t,n){let s=0,a;return i;function i(d){return e.enter("thematicBreak"),o(d)}function o(d){return a=d,l(d)}function l(d){return d===a?(e.enter("thematicBreakSequence"),c(d)):s>=3&&(d===null||Qt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function c(d){return d===a?(e.consume(d),s++,c):(e.exit("thematicBreakSequence"),In(d)?nr(e,l,"whitespace")(d):l(d))}}const Qs={continuation:{tokenize:dme},exit:mme,name:"list",tokenize:cme},ome={partial:!0,tokenize:fme},lme={partial:!0,tokenize:ume};function cme(e,t,n){const s=this,a=s.events[s.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(x){const j=s.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(j==="listUnordered"?!s.containerState.marker||x===s.containerState.marker:z2(x)){if(s.containerState.type||(s.containerState.type=j,e.enter(j,{_container:!0})),j==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(S0,n,d)(x):d(x);if(!s.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(x)}return n(x)}function c(x){return z2(x)&&++o<10?(e.consume(x),c):(!s.interrupt||o<2)&&(s.containerState.marker?x===s.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),d(x)):n(x)}function d(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||x,e.check($b,s.interrupt?n:f,e.attempt(ome,g,m))}function f(x){return s.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return In(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),g):n(x)}function g(x){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function dme(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check($b,a,i);function a(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,nr(e,t,"listItemIndent",s.containerState.size+1)(l)}function i(l){return s.containerState.furtherBlankLines||!In(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(lme,t,o)(l))}function o(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,nr(e,e.attempt(Qs,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function ume(e,t,n){const s=this;return nr(e,a,"listItemIndent",s.containerState.size+1);function a(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):n(i)}}function mme(e){e.exit(this.containerState.type)}function fme(e,t,n){const s=this;return nr(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=s.events[s.events.length-1];return!In(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Z4={name:"setextUnderline",resolveTo:hme,tokenize:pme};function hme(e,t){let n=e.length,s,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function pme(e,t,n){const s=this;let a;return i;function i(d){let f=s.events.length,m;for(;f--;)if(s.events[f][1].type!=="lineEnding"&&s.events[f][1].type!=="linePrefix"&&s.events[f][1].type!=="content"){m=s.events[f][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(e.enter("setextHeadingLine"),a=d,o(d)):n(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===a?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),In(d)?nr(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||Qt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const gme={tokenize:xme};function xme(e){const t=this,n=e.attempt($b,s,e.attempt(this.parser.constructs.flowInitial,a,nr(e,e.attempt(this.parser.constructs.flow,a,e.attempt(jue,a)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const yme={resolveAll:K8()},bme=q8("string"),vme=q8("text");function q8(e){return{resolveAll:K8(e==="text"?wme:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],i=n.attempt(a,o,l);return o;function o(f){return d(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return d(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function d(f){if(f===null)return!0;const m=a[f];let g=-1;if(m)for(;++g<m.length;){const x=m[g];if(!x.previous||x.previous.call(s,s.previous))return!0}return!1}}}function K8(e){return t;function t(n,s){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,s):n}}function wme(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let i=a.length,o=-1,l=0,c;for(;i--;){const d=a[i];
vendor: 5,636 bytes, lines 877-879
877if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const jme={42:Qs,43:Qs,45:Qs,48:Qs,49:Qs,50:Qs,51:Qs,52:Qs,53:Qs,54:Qs,55:Qs,56:Qs,57:Qs,62:D8},_me={91:Cue},Nme={[-2]:Yj,[-1]:Yj,32:Yj},Sme={35:Iue,42:S0,45:[Z4,S0],60:Lue,61:Z4,95:S0,96:Q4,126:Q4},kme={38:$8,92:L8},Cme={[-5]:Jj,[-4]:Jj,[-3]:Jj,33:tme,38:$8,42:U2,60:[rue,Kue],91:rme,92:[Pue,L8],93:OE,95:U2,96:gue},Eme={null:[U2,yme]},Ame={null:[42,95]},Tme={null:[]},Pme=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Ame,contentInitial:_me,disable:Tme,document:jme,flow:Sme,flowInitial:Nme,insideSpan:Eme,string:kme,text:Cme},Symbol.toStringTag,{value:"Module"}));function Ome(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},i=[];let o=[],l=[];const c={attempt:A(k),check:A(S),consume:_,enter:N,exit:C,interrupt:A(S,{interrupt:!0})},d={code:null,containerState:{},defineSkip:b,events:[],now:j,parser:e,previous:null,sliceSerialize:g,sliceStream:x,write:m};let f=t.tokenize.call(d,c);return t.resolveAll&&i.push(t),d;function m(D){return o=Ha(o,D),y(),o[o.length-1]!==null?[]:(T(t,0),d.events=PE(i,d.events,d),d.events)}function g(D,P){return Rme(x(D),P)}function x(D){return Ime(o,D)}function j(){const{_bufferIndex:D,_index:P,line:I,column:z,offset:L}=s;return{_bufferIndex:D,_index:P,line:I,column:z,offset:L}}function b(D){a[D.line]=D.column,B()}function y(){let D;for(;s._index<o.length;){const P=o[s._index];if(typeof P=="string")for(D=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===D&&s._bufferIndex<P.length;)w(P.charCodeAt(s._bufferIndex));else w(P)}}function w(D){f=f(D)}function _(D){Qt(D)?(s.line++,s.column=1,s.offset+=D===-3?2:1,B()):D!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=D}function N(D,P){const I=P||{};return I.type=D,I.start=j(),d.events.push(["enter",I,d]),l.push(I),I}function C(D){const P=l.pop();return P.end=j(),d.events.push(["exit",P,d]),P}function k(D,P){T(D,P.from)}function S(D,P){P.restore()}function A(D,P){return I;function I(z,L,H){let W,V,K,M;return Array.isArray(z)?q(z):"tokenize"in z?q([z]):G(z);function G(ne){return X;function X(ie){const Z=ie!==null&&ne[ie],ce=ie!==null&&ne.null,le=[...Array.isArray(Z)?Z:Z?[Z]:[],...Array.isArray(ce)?ce:ce?[ce]:[]];return q(le)(ie)}}function q(ne){return W=ne,V=0,ne.length===0?H:F(ne[V])}function F(ne){return X;function X(ie){return M=R(),K=ne,ne.partial||(d.currentConstruct=ne),ne.name&&d.parser.constructs.disable.null.includes(ne.name)?ee():ne.tokenize.call(P?Object.assign(Object.create(d),P):d,c,U,ee)(ie)}}function U(ne){return D(K,M),L}function ee(ne){return M.restore(),++V<W.length?F(W[V]):H}}}function T(D,P){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&oo(d.events,P,d.events.length-P,D.resolve(d.events.slice(P),d)),D.resolveTo&&(d.events=D.resolveTo(d.events,d))}function R(){const D=j(),P=d.previous,I=d.currentConstruct,z=d.events.length,L=Array.from(l);return{from:z,restore:H};function H(){s=D,d.previous=P,d.currentConstruct=I,d.events.length=z,l=L,B()}}function B(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function Ime(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(s,i)];else{if(o=e.slice(n,a),s>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(s):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function Rme(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
878`;break}case-3:{o=`\r
879`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,s.push(o)}return s.join("")}function Mme(e){const s={constructs:Ude([Pme,...(e||{}).extensions||[]]),content:a(Jde),defined:[],document:a(Xde),flow:a(gme),lazy:{},string:a(bme),text:a(vme)};return s;function a(i){return o;function o(l){return Ome(s,i,l)}}}function Dme(e){for(;!B8(e););return e}const eI=/[\0\t\n\r]/g;function Lme(){let e=1,t="",n=!0,s;return a;function a(i,o,l){const c=[];let d,f,m,g,x;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(eI.lastIndex=m,d=eI.exec(i),g=d&&d.index!==void 0?d.index:i.length,x=i.charCodeAt(g),!d){t=i.slice(m);break}if(x===10&&m===g&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),m<g&&(c.push(i.slice(m,g)),e+=g-m),x){case 0:{c.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,c.push(-2);e++<f;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:s=!0,e=1}m=g+1}return l&&(s&&c.push(-5),t&&c.push(t),c.push(null)),c}}const $me=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Bme(e){return e.replace($me,Fme)}function Fme(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return M8(n.slice(i?2:1),i?16:10)}return TE(n)||e}const V8={}.hasOwnProperty;function zme(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Ume(n)(Dme(Mme(n).document().write(Lme()(e,t,!0))
vendor: 10,383 bytes, line 879
879))}function Ume(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Xe),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(Oe),blockQuote:i(ce),characterEscape:R,characterReference:R,codeFenced:i(le),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(le,o),codeText:i(re,o),codeTextData:R,data:R,codeFlowValue:R,definition:i(Ue),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ne),hardBreakEscape:i(Me),hardBreakTrailing:i(Me),htmlFlow:i(ue,o),htmlFlowData:R,htmlText:i(ue,o),htmlTextData:R,image:i(Ve),label:o,link:i(Xe),listItem:i(De),listItemValue:g,listOrdered:i(te,m),listUnordered:i(te),paragraph:i(_e),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Oe),strong:i(We),thematicBreak:i(me)},exit:{atxHeading:c(),atxHeadingSequence:k,autolink:c(),autolinkEmail:Z,autolinkProtocol:ie,blockQuote:c(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:ne,characterReference:X,codeFenced:c(y),codeFencedFence:b,codeFencedFenceInfo:x,codeFencedFenceMeta:j,codeFlowValue:B,codeIndented:c(w),codeText:c(L),codeTextData:B,data:B,definition:c(),definitionDestinationString:C,definitionLabelString:_,definitionTitleString:N,emphasis:c(),hardBreakEscape:c(P),hardBreakTrailing:c(P),htmlFlow:c(I),htmlFlowData:B,htmlText:c(z),htmlTextData:B,image:c(W),label:K,labelText:V,lineEnding:D,link:c(H),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:U,resourceDestinationString:M,resourceTitleString:G,resource:q,setextHeading:c(T),setextHeadingLineSequence:A,setextHeadingText:S,strong:c(),thematicBreak:c()}};H8(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ae){let Se={type:"root",children:[]};const Le={stack:[Se],tokenStack:[],config:t,enter:l,exit:d,buffer:o,resume:f,data:n},He=[];let ut=-1;for(;++ut<ae.length;)if(ae[ut][1].type==="listOrdered"||ae[ut][1].type==="listUnordered")if(ae[ut][0]==="enter")He.push(ut);else{const ze=He.pop();ut=a(ae,ze,ut)}for(ut=-1;++ut<ae.length;){const ze=t[ae[ut][0]];V8.call(ze,ae[ut][1].type)&&ze[ae[ut][1].type].call(Object.assign({sliceSerialize:ae[ut][2].sliceSerialize},Le),ae[ut][1])}if(Le.tokenStack.length>0){const ze=Le.tokenStack[Le.tokenStack.length-1];(ze[1]||tI).call(Le,void 0,ze[0])}for(Se.position={start:Cl(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Cl(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},ut=-1;++ut<t.transforms.length;)Se=t.transforms[ut](Se)||Se;return Se}function a(ae,Se,Le){let He=Se-1,ut=-1,ze=!1,fe,dt,ct,Wt;for(;++He<=Le;){const bt=ae[He];switch(bt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{bt[0]==="enter"?ut++:ut--,Wt=void 0;break}case"lineEndingBlank":{bt[0]==="enter"&&(fe&&!Wt&&!ut&&!ct&&(ct=He),Wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wt=void 0}if(!ut&&bt[0]==="enter"&&bt[1].type==="listItemPrefix"||ut===-1&&bt[0]==="exit"&&(bt[1].type==="listUnordered"||bt[1].type==="listOrdered")){if(fe){let sn=He;for(dt=void 0;sn--;){const we=ae[sn];if(we[1].type==="lineEnding"||we[1].type==="lineEndingBlank"){if(we[0]==="exit")continue;dt&&(ae[dt][1].type="lineEndingBlank",ze=!0),we[1].type="lineEnding",dt=sn}else if(!(we[1].type==="linePrefix"||we[1].type==="blockQuotePrefix"||we[1].type==="blockQuotePrefixWhitespace"||we[1].type==="blockQuoteMarker"||we[1].type==="listItemIndent"))break}ct&&(!dt||ct<dt)&&(fe._spread=!0),fe.end=Object.assign({},dt?ae[dt][1].start:bt[1].end),ae.splice(dt||He,0,["exit",fe,bt[2]]),He++,Le++}if(bt[1].type==="listItemPrefix"){const sn={type:"listItem",_spread:!1,start:Object.assign({},bt[1].start),end:void 0};fe=sn,ae.splice(He,0,["enter",sn,bt[2]]),He++,Le++,ct=void 0,Wt=!0}}}return ae[Se][1]._spread=ze,Le}function i(ae,Se){return Le;function Le(He){l.call(this,ae(He),He),Se&&Se.call(this,He)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(ae,Se,Le){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([Se,Le||void 0]),ae.position={start:Cl(Se.start),end:void 0}}function c(ae){return Se;function Se(Le){ae&&ae.call(this,Le),d.call(this,Le)}}function d(ae,Se){const Le=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==ae.type&&(Se?Se.call(this,ae,He[0]):(He[1]||tI).call(this,ae,He[0]));else throw new Error("Cannot close `"+ae.type+"` ("+_h({start:ae.start,end:ae.end})+"): it’s not open");Le.position.end=Cl(ae.end)}function f(){return Fde(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(ae){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function x(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=ae}function j(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=ae}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ae.replace(/(\r?\n|\r)$/g,"")}function _(ae){const Se=this.resume(),Le=this.stack[this.stack.length-1];Le.label=Se,Le.identifier=Bu(this.sliceSerialize(ae)).toLowerCase()}function N(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ae}function C(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ae}function k(ae){const Se=this.stack[this.stack.length-1];if(!Se.depth){const Le=this.sliceSerialize(ae).length;Se.depth=Le}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function A(ae){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function R(ae){const Le=this.stack[this.stack.length-1].children;let He=Le[Le.length-1];(!He||He.type!=="text")&&(He=tt(),He.position={start:Cl(ae.start),end:void 0},Le.push(He)),this.stack.push(He)}function B(ae){const Se=this.stack.pop();Se.value+=this.sliceSerialize(ae),Se.position.end=Cl(ae.end)}function D(ae){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=Se.children[Se.children.length-1];Le.position.end=Cl(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Se.type)&&(R.call(this,ae),B.call(this,ae))}function P(){this.data.atHardBreak=!0}function I(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ae}function z(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ae}function L(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ae}function H(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=Se,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function W(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=Se,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function V(ae){const Se=this.sliceSerialize(ae),Le=this.stack[this.stack.length-2];Le.label=Bme(Se),Le.identifier=Bu(Se).toLowerCase()}function K(){const ae=this.stack[this.stack.length-1],Se=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const He=ae.children;Le.children=He}else Le.alt=Se}function M(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ae}function G(){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ae}function q(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function U(ae){const Se=this.resume(),Le=this.stack[this.stack.length-1];Le.label=Se,Le.identifier=Bu(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function ee(ae){this.data.characterReferenceType=ae.type}function ne(ae){const Se=this.sliceSerialize(ae),Le=this.data.characterReferenceType;let He;Le?(He=M8(Se,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=TE(Se);const ut=this.stack[this.stack.length-1];ut.value+=He}function X(ae){const Se=this.stack.pop();Se.position.end=Cl(ae.end)}function ie(ae){B.call(this,ae);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(ae)}function Z(ae){B.call(this,ae);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(ae)}function ce(){return{type:"blockquote",children:[]}}function le(){return{type:"code",lang:null,meta:null,value:""}}function re(){return{type:"inlineCode",value:""}}function Ue(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ne(){return{type:"emphasis",children:[]}}function Oe(){return{type:"heading",depth:0,children:[]}}function Me(){return{type:"break"}}function ue(){return{type:"html",value:""}}function Ve(){return{type:"image",title:null,url:"",alt:null}}function Xe(){return{type:"link",title:null,url:"",children:[]}}function te(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function De(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function _e(){return{type:"paragraph",children:[]}}function We(){return{type:"strong",children:[]}}function tt(){return{type:"text",value:""}}function me(){return{type:"thematicBreak"}}}function Cl(e){return{line:e.line,column:e.column,offset:e.offset}}function H8(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?H8(e,s):qme(e,s)}}function qme(e,t){let n;for(n in t)if(V8.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function tI(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+_h({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+_h({start:t.start,end:t.end}
vendor: 12,132 bytes, lines 879-883
879)+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+_h({start:t.start,end:t.end})+") is still open")}function Kme(e){const t=this;t.parser=n;function n(s){return zme(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Vme(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Hme(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
880`}]}function Wme(e,t){const n=t.value?t.value+`
881`:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Gme(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Yme(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jme(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Gm(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,l=e.footnoteCounts.get(s);l===void 0?(l=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function Qme(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xme(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function W8(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=s:a.push({type:"text",value:s}),a}function Zme(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return W8(e,t);const a={src:Gm(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function efe(e,t){const n={src:Gm(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function tfe(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function nfe(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return W8(e,t);const a={href:Gm(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function rfe(e,t){const n={href:Gm(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function sfe(e,t,n){const s=e.all(t),a=n?afe(n):G8(t),i={},o=[];if(typeof t.checked=="boolean"){const f=s[0];let m;f&&f.type==="element"&&f.tagName==="p"?m=f:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const f=s[l];(a||l!==0||f.type!=="element"||f.tagName!=="p")&&o.push({type:"text",value:`
882`}),f.type==="element"&&f.tagName==="p"&&!a?o.push(...f.children):o.push(f)}const c=s[s.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
883`});const d={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,d),e.applyData(t,d)}function afe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=G8(n[s])}return t}function G8(e){const t=e.spread;return t??e.children.length>1}function ife(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const o=s[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function ofe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lfe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function cfe(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dfe(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),a.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=kE(t.children[1]),c=E8(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),a.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function ufe(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const d=[];for(;++c<l;){const m=t.children[c],g={},x=o?o[c]:void 0;x&&(g.align=x);let j={type:"element",tagName:i,properties:g,children:[]};m&&(j.children=e.all(m),e.patch(m,j),j=e.applyData(m,j)),d.push(j)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,f),e.applyData(t,f)}function mfe(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const nI=9,rI=32;function ffe(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const i=[];for(;s;)i.push(sI(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return i.push(sI(t.slice(a),a>0,!1)),i.join("")}function sI(e,t,n){let s=0,a=e.length;if(t){let i=e.codePointAt(s);for(;i===nI||i===rI;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(a-1);for(;i===nI||i===rI;)a--,i=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function hfe(e,t){const n={type:"text",value:ffe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function pfe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const gfe={blockquote:Vme,break:Hme,code:Wme,delete:Gme,emphasis:Yme,footnoteReference:Jme,heading:Qme,html:Xme,imageReference:Zme,image:efe,inlineCode:tfe,linkReference:nfe,link:rfe,listItem:sfe,list:ife,paragraph:ofe,root:lfe,strong:cfe,table:dfe,tableCell:mfe,tableRow:ufe,text:hfe,thematicBreak:pfe,toml:Mx,yaml:Mx,definition:Mx,footnoteDefinition:Mx};function Mx(){}const Y8=-1,Bb=0,Sh=1,G0=2,IE=3,RE=4,ME=5,DE=6,J8=7,Q8=8,aI=typeof self=="object"?self:globalThis,xfe=(e,t)=>{const n=(a,i)=>(e.set(i,a),a),s=a=>{if(e.has(a))return e.get(a);const[i,o]=t[a];switch(i){case Bb:case Y8:return n(o,a);case Sh:{const l=n([],a);for(const c of o)l.push(s(c));return l}case G0:{const l=n({},a);for(const[c,d]of o)l[s(c)]=s(d);return l}case IE:return n(new Date(o),a);case RE:{const{source:l,flags:c}=o;return n(new RegExp(l,c),a)}case ME:{const l=n(new Map,a);for(const[c,d]of o)l.set(s(c),s(d));return l}case DE:{const l=n(new Set,a);for(const c of o)l.add(s(c));return l}case J8:{const{name:l,message:c}=o;return n(new aI[l](c),a)}case Q8:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new aI[i](o),a)};return s},iI=e=>xfe(new Map,e)(0),bu="",{toString:yfe}={},{keys:bfe}=Object,Wf=e=>{const t=typeof e;if(t!=="object"||!e)return[Bb,t];const n=yfe.call(e).slice(8,-1);switch(n){case"Array":return[Sh,bu];case"Object":return[G0,bu];case"Date":return[IE,bu];case"RegExp":return[RE,bu];case"Map":return[ME,bu];case"Set":return[DE,bu];case"DataView":return[Sh,n]}return n.includes("Array")?[Sh,n]:n.includes("Error")?[J8,n]:[G0,n]},Dx=([e,t])=>e===Bb&&(t==="function"||t==="symbol"),vfe=(e,t,n,s)=>{const a=(o,l)=>{const c=s.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=Wf(o);switch(l){case Bb:{let f=o;switch(c){case"bigint":l=Q8,f=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return a([Y8],o)}return a([l,f],o)}case Sh:{if(c){let g=o;return c==="DataView"?g=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(o)),a([c,[...g]],o)}const f=[],m=a([l,f],o);for(const g of o)f.push(i(g));return m}case G0:{if(c)switch(c){case"BigInt":return a([c,o.toString()],o);case"Boolean":case"Number":case"String":return a([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const f=[],m=a([l,f],o);for(const g of bfe(o))(e||!Dx(Wf(o[g])))&&f.push([i(g),i(o[g])]);return m}case IE:return a([l,o.toISOString()],o);case RE:{const{source:f,flags:m}=o;return a([l,{source:f,flags:m}],o)}case ME:{const f=[],m=a([l,f],o);for(const[g,x]of o)(e||!(Dx(Wf(g))||Dx(Wf(x))))&&f.push([i(g),i(x)]);return m}case DE:{const f=[],m=a([l,f],o);for(const g of o)(e||!Dx(Wf(g)))&&f.push(i(g));return m}}const{message:d}=o;return a([l,{name:c,message:d}],o)};return i},oI=(e,{json:t,lossy:n}={})=>{const s=[];return vfe(!(t||n),!!t,new Map,s)(e),s},Y0=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?iI(oI(e,t)):structuredClone(e):(e,t)=>iI(oI(e,t));function wfe(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function jfe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function _fe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||wfe,s=e.options.footnoteBackLabel||jfe,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const f=e.all(d),m=String(d.identifier).toUpperCase(),g=Gm(m.toLowerCase());let x=0;const j=[],b=e.footnoteCounts.get(m);for(;b!==void 0&&++x<=b;){j.length>0&&j.push({type:"text",value:" "});let _=typeof n=="string"?n:n(c,x);typeof _=="string"&&(_={type:"text",value:_}),j.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,x),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const y=f[f.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const _=y.children[y.children.length-1];_&&_.type==="text"?_.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...j)}else f.push(...j);const w={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(f,!0)};e.patch(d,w),l.push(w)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Y0(o),id:"footnote-label"},children:[{type:"text",value:a}]}
vendor: 5,689 bytes, lines 883-889
883,{type:"text",value:`
884`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
885`}]}}const X8=(function(e){if(e==null)return Cfe;if(typeof e=="function")return Fb(e);if(typeof e=="object")return Array.isArray(e)?Nfe(e):Sfe(e);if(typeof e=="string")return kfe(e);throw new Error("Expected function, string, or object as test")});function Nfe(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=X8(e[n]);return Fb(s);function s(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function Sfe(e){const t=e;return Fb(n);function n(s){const a=s;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function kfe(e){return Fb(t);function t(n){return n&&n.type===e}}function Fb(e){return t;function t(n,s,a){return!!(Efe(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function Cfe(){return!0}function Efe(e){return e!==null&&typeof e=="object"&&"type"in e}const Z8=[],Afe=!0,lI=!1,Tfe="skip";function Pfe(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const i=X8(a),o=s?-1:1;l(e,void 0,[])();function l(c,d,f){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const x=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(c.type+(x?"<"+x+">":""))+")"})}return g;function g(){let x=Z8,j,b,y;if((!t||i(c,d,f[f.length-1]||void 0))&&(x=Ofe(n(c,f)),x[0]===lI))return x;if("children"in c&&c.children){const w=c;if(w.children&&x[0]!==Tfe)for(b=(s?w.children.length:-1)+o,y=f.concat(w);b>-1&&b<w.children.length;){const _=w.children[b];if(j=l(_,b,y)(),j[0]===lI)return j;b=typeof j[1]=="number"?j[1]:b+o}}return x}}}function Ofe(e){return Array.isArray(e)?e:typeof e=="number"?[Afe,e]:e==null?Z8:[e]}function eq(e,t,n,s){let a,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,a=n):(i=t,o=n,a=s),Pfe(e,i,l,a);function l(c,d){const f=d[d.length-1],m=f?f.children.indexOf(c):void 0;return o(c,m,f)}}const q2={}.hasOwnProperty,Ife={};function Rfe(e,t){const n=t||Ife,s=new Map,a=new Map,i=new Map,o={...gfe,...n.handlers},l={all:d,applyData:Dfe,definitionById:s,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:n,patch:Mfe,wrap:$fe};return eq(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const m=f.type==="definition"?s:a,g=String(f.identifier).toUpperCase();m.has(g)||m.set(g,f)}}),l;function c(f,m){const g=f.type,x=l.handlers[g];if(q2.call(l.handlers,g)&&x)return x(l,f,m);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in f){const{children:b,...y}=f,w=Y0(y);return w.children=l.all(f),w}return Y0(f)}return(l.options.unknownHandler||Lfe)(l,f,m)}function d(f){const m=[];if("children"in f){const g=f.children;let x=-1;for(;++x<g.length;){const j=l.one(g[x],f);if(j){if(x&&g[x-1].type==="break"&&(!Array.isArray(j)&&j.type==="text"&&(j.value=cI(j.value)),!Array.isArray(j)&&j.type==="element")){const b=j.children[0];b&&b.type==="text"&&(b.value=cI(b.value))}Array.isArray(j)?m.push(...j):m.push(j)}}}return m}}function Mfe(e,t){e.position&&(t.position=yde(e))}function Dfe(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Y0(i)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function Lfe(e,t){const n=t.data||{},s="value"in t&&!(q2.call(n,"hProperties")||q2.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function $fe(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
886`});++s<e.length;)s&&n.push({type:"text",value:`
887`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
888`}),n}function cI(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function dI(e,t){const n=Rfe(e,t),s=n.one(e,void 0),a=_fe(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
889`},a),i}function Bfe(e,t){return e&&"run"in e?async function(n,s){const a=dI(n,{file:s,...t});await e.run(a,s)}:function(n,s){return dI(n,{file:s,...e||t})}}function uI(e){if(e)throw e}var Qj,mI;function Ffe(){if(mI)return Qj;mI=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(d){return typeof Array.isArray=="function"?Array.isArray(d):t.call(d)==="[object Array]"},i=function(d){if(!d||t.call(d)!=="[object Object]")return!1;var f=e.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!f&&!m)return!1;var g;for(g in d);return typeof g>"u"||e.call(d,g)},o=function(d,f){n&&f.name==="__proto__"?n(d,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):d[f.name]=f.newValue},l=function(d,f){if(f==="__proto__")if(e.call(d,f)){if(s)return s(d,f).value}else return;return d[f]};return Qj=function c(){var d,f,m,g,x,j,b=arguments[0],y=1,w=arguments.length,_=!1;for(typeof b=="boolean"&&(_=b,b=arguments[1]||{},y=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});y<w;++y)if(d=arguments[y],d!=null)for(f in d)m=l(b,f),g=l(d,f),b!==g&&(_&&g&&(i(g)||(x=a(g)))?(x?(x=!1,j=m&&a(m)?m:[]):j=m&&i(m)?m:{},o(b,{name:f,newValue:c(_,j,g)})):typeof g<"u"&&o(b,{name:f,newValue:g}));return b},Qj}var zfe=Ffe();const Xj=Un(zfe);function K2(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);
vendor: 4,395 bytes, line 889
889return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Ufe(){const e=[],t={run:n,use:s};return t;function n(...a){let i=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(c,...d){const f=e[++i];let m=-1;if(c){o(c);return}for(;++m<a.length;)(d[m]===null||d[m]===void 0)&&(d[m]=a[m]);a=d,f?qfe(f,l)(...d):o(null,...d)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function qfe(e,t){let n;return s;function s(...o){const l=e.length>o.length;let c;l&&o.push(a);try{c=e.apply(this,o)}catch(d){const f=d;if(l&&n)throw f;return a(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,a):c instanceof Error?a(c):i(c))}function a(o,...l){n||(n=!0,t(o,...l))}function i(o){a(null,o)}}const Ki={basename:Kfe,dirname:Vfe,extname:Hfe,join:Wfe,sep:"/"};function Kfe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');og(e);let n=0,s=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let o=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else o<0&&(i=!0,o=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(s=a):(l=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function Vfe(e){if(og(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Hfe(e){og(e);let t=e.length,n=-1,s=0,a=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function Wfe(...e){let t=-1,n;for(;++t<e.length;)og(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Gfe(n)}function Gfe(e){og(e);const t=e.codePointAt(0)===47;let n=Yfe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Yfe(e,t){let n="",s=0,a=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(a===o-1||i===1))if(a!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),a=o,i=0;continue}}else if(n.length>0){n="",s=0,a=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,o):n=e.slice(a+1,o),s=o-a-1;a=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function og(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Jfe={cwd:Qfe};function Qfe(){return"/"}function V2(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Xfe(e){if(typeof e=="string")e=new URL(e);else if(!V2(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Zfe(e)}function Zfe(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Zj=["history","path","basename","stem","extname","dirname"];class tq{constructor(t){let n;t?V2(t)?n={path:t}:typeof t=="string"||ehe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Jfe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Zj.length;){const i=Zj[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Zj.includes(a)||(this[a]=n[a])}
vendor: 4,320 bytes, line 889
889get basename(){return typeof this.path=="string"?Ki.basename(this.path):void 0}set basename(t){t1(t,"basename"),e1(t,"basename"),this.path=Ki.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ki.dirname(this.path):void 0}set dirname(t){fI(this.basename,"dirname"),this.path=Ki.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ki.extname(this.path):void 0}set extname(t){if(e1(t,"extname"),fI(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ki.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){V2(t)&&(t=Xfe(t)),t1(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ki.basename(this.path,this.extname):void 0}set stem(t){t1(t,"stem"),e1(t,"stem"),this.path=Ki.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new Ps(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function e1(e,t){if(e&&e.includes(Ki.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ki.sep+"`")}function t1(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function fI(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ehe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const the=(function(e){const s=this.constructor.prototype,a=s[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,s),i}),nhe={}.hasOwnProperty;class LE extends the{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ufe()}copy(){const t=new LE;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Xj(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(s1("data",this.frozen),this.namespace[t]=n,this):nhe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(s1("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Lx(t),s=this.parser||this.Parser;return n1("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),n1("process",this.parser||this.Parser),r1("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,o){const l=Lx(t),c=s.parse(l);s.run(c,l,function(f,m,g){if(f||!m||!g)return d(f);const x=m,j=s.stringify(x,g);ahe(j)?g.value=j:g.result=j,d(f,g)});function d(f,m){f||!m?o(f):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,s;return this.freeze(),n1("processSync",this.parser||this.Parser),r1("processSync",this.compiler||this.Compiler),this.process(t,a),pI("processSync","process",n),s;function a(i,o){n=!0,uI(i),s=o}}run(t,n,s){hI(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,l){const c=Lx(n);a.run(t,c,d);function d(f,m,g){const x=m||t;f?l(f):o?o(x):s(void 0,x,g)}}}runSync(t,n){let s=!1,a;return this.run(t,n,i),pI("runSync","run",s),a;function i(o,l){uI(o),a=l,s=!0}}stringify(t,n){this.freeze();const s=Lx(n),a=this.compiler||this.Compiler;return r1("stringify",a),hI(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(s1("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[f,...m]=d;c(f,m)}
889else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(a.settings=Xj(!0,a.settings,d.settings))}function l(d){let f=-1;if(d!=null)if(Array.isArray(d))for(;++f<d.length;){const m=d[f];i(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,f){let m=-1,g=-1;for(;++m<s.length;)if(s[m][0]===d){g=m;break}if(g===-1)s.push([d,...f]);else if(f.length>0){let[x,...j]=f;const b=s[g][1];K2(b)&&K2(x)&&(x=Xj(!0,b,x)),s[g]=[d,x,...j]}}}}const rhe=new LE().freeze();function n1(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function r1(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function s1(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function hI(e){if(!K2(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function pI(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Lx(e){return she(e)?e:new tq(e)}function she(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ahe(e){return typeof e=="string"||ihe(e)}function ihe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ohe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",gI=[],xI={allowDangerousHtml:!0},lhe=/^(https?|ircs?|mailto|xmpp)$/i,che=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ym(e){const t=dhe(e),n=uhe(e);return mhe(t.runSync(t.parse(n),n),e)}function dhe(e){const t=e.rehypePlugins||gI,n=e.remarkPlugins||gI,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xI}:xI;return rhe().use(Kme).use(n).use(Bfe,s).use(t)}function uhe(e){const t=e.children||"",n=new tq;return typeof t=="string"&&(n.value=t),n}function mhe(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||fhe;for(const f of che)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+ohe+f.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),eq(e,d),_de(e,{Fragment:r.Fragment,components:a,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function d(f,m,g){if(f.type==="raw"&&g&&typeof m=="number")return o?g.children.splice(m,1):g.children[m]={type:"text",value:f.value},m;if(f.type==="element"){let x;for(x in Gj)if(Object.hasOwn(Gj,x)&&Object.hasOwn(f.properties,x)){const j=f.properties[x],b=Gj[x];(b===null||b.includes(f.tagName))&&(f.properties[x]=c(String(j||""),x,f))}}if(f.type==="element"){let x=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!x&&s&&typeof m=="number"&&(x=!s(f,m,g)),x&&g&&typeof m=="number")return l&&f.children?g.children.splice(m,1,...f.children):g.children.splice(m,1),m}}}function fhe(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||lhe.test(e.slice(0,t))?e:""}function nq({shell:e,assistantsMap:t,selectedId:n,onSelect:s,depth:a=0,allShells:i}){const o=t[e.assistant_id],l=e.id===n,c=i.filter(m=>m.parent_shell_id===e.id),[d,f]=h.useState(!0);return r.jsxs("div",{children:[r.jsxs("div",{className:`flex items-center gap-1.5 px-2 py-1.5 rounded-lg cursor-pointer group transition-colors
890          ${l?"bg-indigo-50 border border-indigo-200":"hover:bg-gray-50"}`,style:{paddingLeft:`${8+a*16}px`},onClick:()=>s(e),children:[c.length>0?r.jsx("button",{onClick:m=>{m.stopPropagation(),f(g=>!g)},className:"text-gray-400 hover:text-gray-600",children:d?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"})}):r.jsx("span",{className:"w-3"}),a>0&&r.jsx(_b,{className:"w-3 h-3 text-gray-300 shrink-0"}),r.jsx(Sa,{className:`w-3.5 h-3.5 shrink-0 ${l?"text-indigo-600":"text-gray-400"}`}),r.jsx("span",{className:`text-xs font-medium truncate flex-1 ${l?"text-indigo-700":"text-gray-700"}`,children:e.name}),o&&r.jsxs("span",{className:"text-[9px] text-gray-400 truncate max-w-[80px] shrink-0",children:["(",o.name,")"]})]}),d&&c.map(m=>r.jsx(nq,{shell:m,assistantsMap:t,selectedId:n,onSelect:s,depth:a+1,allShells:i},m.id))]})}function hhe({shell:e,shells:t,assistants:n,onSave:s,onDelete:a,onAddSubshell:i,onCancel:o}){const[l,c]=h.useState({name:"",description:"",assistant_id:"",parent_shell_id:"",routing_instructions:"",transition_instructions:"",status:"active"}),[d,f]=h.useState(!1);h.useEffect(()=>{c(e?{name:e.name||"",description:e.description||"",assistant_id:e.assistant_id||"",parent_shell_id:e.parent_shell_id||"",routing_instructions:e.routing_instructions||"",transition_instructions:e.transition_instructions||"",status:e.status||"active"}:{name:"",description:"",assistant_id:"",parent_shell_id:"",routing_instructions:"",transition_instructions:"",status:"active"})},[e==null?void 0:e.id]);const m=(x,j)=>c(b=>({...b,[x]:j}));async function g(){!l.name.trim()||!l.assistant_id||(f(!0),await s(l),f(!1))}return r.jsxs("div",{className:"p-3 space-y-3 overflow-y-auto h-full",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-bold text-gray-600 uppercase tracking-wide",children:e?"Edit Shell":"New Shell"}),r.jsxs("div",{className:"flex gap-1",children:[e&&r.jsxs(de,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:i,children:[r.jsx(ln,{className:"w-3 h-3"})," Sub-shell"]}),o&&r.jsx(de,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:o,children:r.jsx(jt,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{children:[r.jsx(ot,{className:"text-xs",children:"Name *"}),r.jsx(It,{value:l.name,onChange:x=>m("name",x.target.value),placeholder:"ShellName",className:"h-7 text-xs mt-0.5"})]}),r.jsxs("div",{children:[r.jsx(ot,{className:"text-xs",children:"Assistant *"}),r.jsxs("select",{value:l.assistant_id,onChange:x=>m("assistant_id",x.target.value),className:"w-full border rounded-md px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 mt-0.5",children:[r.jsx("option",{value:"",children:"— select —"}),n.map(x=>r.jsx("option",{value:x.id,children:x.name},x.id))]})]}),r.jsxs("div",{children:[r.jsx(ot,{className:"text-xs",children:"Parent Shell"}),r.jsxs("select",{value:l.parent_shell_id,onChange:x=>m("parent_shell_id",x.target.value),className:"w-full border rounded-md px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 mt-0.5",children:[r.jsx("option",{value:"",children:"— none (root) —"}),t.filter(x=>x.id!==(e==null?void 0:e.id)).map(x=>r.jsx("option",{value:x.id,children:x.name},x.id))]})]}),r.jsxs("div",{children:[r.jsx(ot,{className:"text-xs",children:"Description"}),r.jsx(rr,{value:l.description,onChange:x=>m("description",x.target.value),placeholder:"Purpose...",className:"text-xs min-h-[56px] mt-0.5"})]}),r.jsxs("div",{children:[r.jsx(ot,{className:"text-xs",children:"Routing Instructions"}),r.jsx(rr,{value:l.routing_instructions,onChange:x=>m("routing_instructions",x.target.value),placeholder:"When to transition...",className:"text-xs min-h-[56px] mt-0.5"})]}),r.jsxs("div",{children:[r.jsx(ot,{className:"text-xs",children:"Transition Instru
890ctions"}),r.jsx(rr,{value:l.transition_instructions,onChange:x=>m("transition_instructions",x.target.value),placeholder:"How to greet the user when entering this shell...",className:"text-xs min-h-[56px] mt-0.5"})]}),r.jsxs("div",{children:[r.jsx(ot,{className:"text-xs",children:"Status"}),r.jsxs("select",{value:l.status,onChange:x=>m("status",x.target.value),className:"w-full border rounded-md px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 mt-0.5",children:[r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"inactive",children:"Inactive"})]})]})]}),r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(de,{size:"sm",onClick:g,disabled:d||!l.name.trim()||!l.assistant_id,className:"gap-1.5 flex-1 h-7 text-xs",children:[d?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Ar,{className:"w-3 h-3"}),e?"Save":"Create"]}),e&&r.jsx(de,{size:"sm",variant:"destructive",onClick:async()=>{confirm(`Delete "${e.name}"?`)&&await a(e.id)},className:"h-7 text-xs gap-1",children:r.jsx(un,{className:"w-3 h-3"})})]})]})}function phe({shells:e,assistants:t,assistantsMap:n,onReload:s}){const[a,i]=h.useState(null),[o,l]=h.useState(!1),[c,d]=h.useState(null),f=h.useRef(null),[m,g]=h.useState(55),x=h.useRef(!1),j=h.useCallback(N=>{N.preventDefault(),x.current=!0;function C(S){if(!x.current||!f.current)return;const A=f.current.getBoundingClientRect(),T=Math.min(80,Math.max(20,(S.clientY-A.top)/A.height*100));g(T)}function k(){x.current=!1,window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",k)}window.addEventListener("mousemove",C),window.addEventListener("mouseup",k)},[]),b=e.filter(N=>!N.parent_shell_id),y=o?c?{parent_shell_id:c}:null:a;async function w(N){const C={...N,parent_shell_id:o&&c?c:N.parent_shell_id||null};if(!o&&a)await Y.entities.Shell.update(a.id,C);
890else{const k=await Y.entities.Shell.create(C);i(k),l(!1)}await s()}async function _(N){await Y.entities.Shell.delete(N),i(null),l(!1),await s()}return r.jsxs("div",{ref:f,className:"flex flex-col h-full min-h-0 border-r border-gray-200 overflow-hidden",children:[r.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:`${m}%`},children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-gray-100 shrink-0",children:[r.jsx("span",{className:"text-xs font-bold text-gray-600 uppercase tracking-wide",children:"Shell Tree"}),r.jsxs(de,{size:"sm",variant:"outline",className:"h-6 text-[10px] gap-1 px-2",onClick:()=>{d(null),i(null),l(!0)},children:[r.jsx(ln,{className:"w-3 h-3"})," Root"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:b.length===0?r.jsx("p",{className:"text-xs text-gray-400 text-center mt-4",children:"No shells yet."}):b.map(N=>r.jsx(nq,{shell:N,assistantsMap:n,selectedId:o?null:a==null?void 0:a.id,onSelect:C=>{i(C),l(!1)},depth:0,allShells:e},N.id))})]}),r.jsx("div",{onMouseDown:j,className:"h-2 bg-gray-100 border-y border-gray-200 flex items-center justify-center cursor-row-resize shrink-0 hover:bg-indigo-50 transition-colors group",children:r.jsx(dee,{className:"w-4 h-3 text-gray-300 group-hover:text-indigo-400"})}),r.jsxs("div",{className:"flex flex-col overflow-hidden flex-1",children:[r.jsx("div",{className:"px-3 py-1.5 border-b border-gray-100 shrink-0",children:r.jsx("span",{className:"text-[9px] font-mono text-gray-300 uppercase tracking-widest",children:o?"New Shell":a?`/${a.name}`:"Select a shell"})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:a||o?r.jsx(hhe,{shell:y,shells:e,assistants:t,onSave:w,onDelete:_,onAddSubshell:()=>{d((a==null?void 0:a.id)||null),i(null),l(!0)},onCancel:o?()=>l(!1):null}):r.jsx("div",{className:"flex items-center justify-center h-full text-xs text-gray-300 p-4 text-center",children:"Select a shell to edit, or create a new one"})})]})]})}function ghe({info:e}){const[t,n]=h.useState(!1);return e?r.jsxs("div",{className:"mt-1.5",children:[r.jsxs("button",{onClick:()=>n(s=>!s),className:"flex items-center gap-1.5 text-[10px] text-gray-400 hover:text-indigo-500 transition-colors",children:[r.jsx(dr,{className:"w-3 h-3"}),"routing debug · ",e.action||e.type,t?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]}),t&&r.jsxs("div",{className:"mt-1 space-y-1.5",children:[r.jsx("div",{className:"bg-gray-900 text-green-300 text-[10px] font-mono rounded p-2 overflow-auto max-h-32 whitespace-pre-wrap",children:JSON.stringify({type:e.type,action:e.action,from:e.from_shell,to:e.to_shell,reason:e.reason},null,2)}),e.candidate_scores&&e.candidate_scores.length>0&&r.jsxs("div",{className:"bg-gray-50 border rounded-lg p-2 space-y-1",children:[r.jsxs("p",{className:"text-[10px] font-semibold text-gray-500 flex items-center gap-1",children:[r.jsx(Wp,{className:"w-3 h-3"})," Shell Probabilities"]}),[...e.candidate_scores].sort((s,a)=>a.probability-s.probability).map((s,a)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] text-gray-600 w-24 truncate",children:s.shell_name}),r.jsx("div",{className:"flex-1 bg-gray-200 rounded-full h-1.5",children:r.jsx("div",{className:"bg-indigo-400 h-1.5 rounded-full",style:{width:`${(s.probability*100).toFixed(0)}%`}})}),r.jsxs("span",{className:"text-[10px] text-gray-500 w-8 text-right",children:[(s.probability*100).toFixed(0),"%"]})]},a))]}),e.routing_prompt&&r.jsxs("details",{className:"text-[10px]",children:[r.jsx("summary",{className:"text-gray-400 cursor-pointer hover:text-gray-600",children:"routing prompt"}),r.jsx("pre",{className:"bg-gray-900 text-yellow-200 p-2 rounded mt-1 whitespace-pre-wrap overflow-auto max-h-40",children:e.routing_prompt})]})]})]}):null}function xhe({info:e}){const[t,n]=h.useState(!1),[s,a]=h.useState(!1),[i,o]=h.useState(!1);return e?r.jsxs("div",{className:"mt-1 space-y-0.5",children:[r.jsxs("button",{onClick:()=>n(l=>!l),className:"flex items-center gap-1.5 text-[10px] text-gray-400 hover:text-violet-500 transition-colors",children:[r.jsx(dr,{className:"w-3 h-3"}),"kb debug · ",e.kb_items_used??0," items",t?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]}),t&&r.jsx("pre",{className:"mt-1 bg-gray-900 text-violet-300 text-[10px] font-mono rounded p-2 overflow-auto max-h-32 whitespace-pre-wrap",children:JSON.stringify(e.search,null,2)}),e.full_prompt&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>a(l=>!l),className:"flex items-center gap-1.5 text-[10px] text-gray-400 hover:text-amber-500 transition-colors",children:[r.jsx(dr,{className:"w-3 h-3"}),"full prompt · ",e.full_prompt.length," chars",s?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]}),s&&r.jsx("pre",{className:"mt-1 bg-gray-900 text-amber-200 text-[10px] font-mono rounded p-2 overflow-auto max-h-64 whitespace-pre-wrap",children:e.full_prompt})]}),e.full_llm_response&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>o(l=>!l),className:"flex items-center gap-1.5 text-[10px] text-gray-400 hover:text-emerald-500 transition-colors",children:[r.jsx(dr,{className:"w-3 h-3"}),"full llm response",i?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]}),i&&r.jsx("pre",{className:"mt-1 bg-gray-900 text-emerald-200 text-[10px] font-mono rounded p-2 overflow-auto max-h-64 whitespace-pre-wrap",children:JSON.stringify(e.full_llm_response,null,2)})]})]}):null}function yhe({msg:e,showDebug:t}){const n=e.role==="user";return r.jsx("div",{className:`flex gap-2 ${n?"justify-end":"justify-start"}`,children:r.jsxs("div",{className:`max-w-[82%] ${n?"order-2":""}`,children:[r.jsx("div",{className:`rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed
891          ${n?"bg-indigo-600 text-white":"bg-white border border-gray-200 text-gray-800"}`,children:n?e.content:r.jsx(Ym,{className:"prose prose-sm max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e.content})}),!n&&(e.shell_name||e.total_ms)&&r.jsxs("div",{className:"mt-0.5 ml-1 flex items-center gap-1.5 flex-wrap",children:[e.shell_name&&r.jsxs(Gr,{className:"bg-indigo-50 text-indigo-600 border border-indigo-100 text-[9px]",children:[r.jsx(Sa,{className:"w-2.5 h-2.5 mr-1"}),e.shell_name]}),e.total_ms&&r.jsx("span",{className:"text-[9px] text-gray-300 font-mono",children:e.timing?`🕐 total ${e.total_ms}ms · routing ${e.timing.routing_ms??"?"}ms · llm ${e.timing.invoke_ms??0}ms`:`${e.total_ms}ms`})]}),!n&&t&&r.jsxs("div",{className:"ml-1 mt-1 space-y-0.5",children:[r.jsx(ghe,{info:e.routing_debug_info}),r.jsx(xhe,{info:e.llm_debug_info})]})]})})}function bhe({selectedShell:e,assistantsMap:t,showDebug:n}){const[s,a]=h.useState(null),[i,o]=h.useState([]),[l,c]=h.useState([]),[d,f]=h.useState(""),[m,g]=h.useState(!1),[x,j]=h.useState(""),[b,y]=h.useState(null),w=h.useRef(null);h.useEffect(()=>{e&&(c([]),a(null),y(e.name),localStorage.setItem("shelltest_last_shell_id",e.id),Y.entities.Chat.filter({root_shell_id:e.id,conversation_type:"shell"},"-started_at",20).then(S=>{o(S);
891const A=localStorage.getItem(`shelltest_last_chat_${e.id}`);A&&S.find(T=>T.id===A)&&_(A)}).catch(()=>o([])))},[e==null?void 0:e.id]);async function _(S,A){if(!S){c([]),a(null),y(e==null?void 0:e.name);return}a(S),c([]),g(!0),j("Loading messages…");const T=await Y.entities.Message.filter({chat_id:S});T.sort((R,B)=>R.sent_at>B.sent_at?1:-1),c(T.map(R=>{var B;return{role:R.role,content:R.content,shell_name:R.shell_id||null,routing_debug_info:R.debug_summary?{action:R.debug_summary.routing_action,reason:R.debug_summary.routing_reason,type:"loaded"}:null,llm_debug_info:((B=R.debug_summary)==null?void 0:B.kb_items_used)!=null?{kb_items_used:R.debug_summary.kb_items_used}:null}})),g(!1),j("")}async function N(S){e&&localStorage.setItem(`shelltest_last_chat_${e.id}`,S||""),await _(S)}h.useEffect(()=>{var S;(S=w.current)==null||S.scrollIntoView({behavior:"smooth"})},[l]);async function C(){if(!d.trim()||!e)return;const S=d.trim();f(""),c(P=>[...P,{role:"user",content:S}]),g(!0);const A={message:S,root_shell_id:e.id};s&&(A.chat_id=s),j("Routing message…");const T=Date.now();j("Calling assistant…");const B=(await Y.functions.invoke("ShellChat",A)).data,D=Date.now()-T;!s&&B.chat_id&&(a(B.chat_id),o(P=>[{id:B.chat_id,title:S.slice(0,60),started_at:new Date().toISOString()},...P])),B.current_shell_name&&y(B.current_shell_name),c(P=>[...P,{role:"assistant",content:B.answer||B.error||"No response",shell_name:B.current_shell_name,routing_debug_info:B.routing_debug_info,llm_debug_info:B.llm_debug_info,timing:B.timing,total_ms:D}]),g(!1),j("")}const k=t==null?void 0:t[e==null?void 0:e.assistant_id];return r.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[r.jsx("div",{className:"px-3 pt-2 pb-1 shrink-0",children:r.jsx("span",{className:"text-[9px] font-mono font-bold text-gray-300 uppercase tracking-widest",children:"ShellChat"})}),r.jsx("div",{className:"px-3 pb-2 shrink-0 space-y-1.5",children:e?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs(Gr,{className:"bg-indigo-50 text-indigo-700 border border-indigo-200 text-xs gap-1 flex items-center",children:[r.jsx(Sa,{className:"w-3 h-3"})," Root: ",e.name]}),b&&b!==e.name&&r.jsxs(Gr,{className:"bg-violet-50 text-violet-700 border border-violet-200 text-xs",children:["Active: ",b]}),s&&r.jsxs("span",{className:"text-[9px] font-mono text-gray-300",children:["chat: ",s.slice(-8)]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-[10px] text-gray-400 shrink-0",children:"Chat:"}),r.jsxs("select",{value:s||"",onChange:S=>N(S.target.value),className:"border rounded-lg px-2 py-1 text-[11px] bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 flex-1 min-w-0",children:[r.jsx("option",{value:"",children:"✦ New conversation"}),i.map(S=>r.jsxs("option",{value:S.id,children:[S.title||"Untitled"," · ",new Date(S.started_at).toLocaleDateString()]},S.id))]})]}),k&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[r.jsx(Vn,{className:"w-3.5 h-3.5 text-violet-500"}),r.jsx("span",{className:"font-medium text-gray-700",children:k.name}),k.type&&r.jsxs("span",{className:"text-gray-400",children:["· ",k.type]})]})]}):r.jsx("p",{className:"text-xs text-gray-400 italic",children:"Select a root shell to start chatting"})}),r.jsx("div",{className:"border-t border-gray-100 shrink-0"}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-3 min-h-0",children:[l.length===0&&e&&r.jsxs("div",{className:"text-center text-gray-400 text-sm mt-8",children:[r.jsx(Vn,{className:"w-8 h-8 mx-auto mb-2 text-gray-200"}),r.jsxs("p",{children:["Start chatting in shell ",r.jsx("strong",{children:e.name})]}),r.jsxs("p",{className:"text-xs mt-1 text-gray-300",children:["Type ",r.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"/exit"})," to go up · ",r.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"/ShellName"})," to navigate"]})]}),l.map((S,A)=>r.jsx(yhe,{msg:S,showDebug:n},A)),m&&r.jsx("div",{className:"flex gap-2 justify-start",children:r.jsxs("div",{className:"bg-white border rounded-2xl px-4 py-2.5 flex items-center gap-2",children:[r.jsx("div",{className:"flex gap-1",children:[0,1,2].map(S=>r.jsx("div",{className:"w-1.5 h-1.5 bg-gray-300 rounded-full animate-bounce",style:{animationDelay:`${S*.15}s`}},S))}),x&&r.jsx("span",{className:"text-[11px] text-gray-400 italic",children:x})]})}),r.jsx("div",{ref:w})]}),r.jsx("div",{className:"border-t border-gray-100 p-3 shrink-0",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{value:d,onChange:S=>f(S.target.value),onKeyDown:S=>S.key==="Enter"&&!S.shiftKey&&C(),placeholder:e?`Message ${e.name}…`:"Select a shell first",disabled:!e||m,className:"flex-1 text-sm"}),r.jsx(de,{size:"sm",onClick:C,disabled:!d.trim()||!e||m,className:"bg-indigo-600 hover:bg-indigo-700 shrink-0",children:r.jsx(Fd,{className:"w-3.5 h-3.5"})})]})})]})}function rq(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState(!0),[o,l]=h.useState(null),[c,d]=h.useState(!0),[f,m]=h.useState(35),[g,x]=h.useState(!0),j=h.useRef(null),b=h.useRef(!1),y=h.useCallback(C=>{C.preventDefault(),b.current=!0;function k(A){if(!b.current||!j.current)return;const T=j.current.getBoundingClientRect(),R=Math.min(70,Math.max(20,(A.clientX-T.left)/T.width*100));
891m(R)}function S(){b.current=!1,window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",S)}window.addEventListener("mousemove",k),window.addEventListener("mouseup",S)},[]);h.useEffect(()=>{w()},[]);async function w(){i(!0);const[C,k]=await Promise.all([Y.entities.Shell.list(),Y.entities.Assistant.list()]);t(C),s(k),i(!1);const S=localStorage.getItem("shelltest_last_shell_id");if(S){const A=C.find(T=>T.id===S&&!T.parent_shell_id);A&&l(A)}}const _=Object.fromEntries(n.map(C=>[C.id,C])),N=e.filter(C=>!C.parent_shell_id);return r.jsxs("div",{className:"flex flex-col bg-gray-50",style:{height:"calc(100vh - 48px)"},children:[r.jsxs("div",{className:"bg-white border-b px-4 py-2.5 flex items-center gap-3 shrink-0",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg bg-indigo-600 flex items-center justify-center",children:r.jsx(Sa,{className:"w-4 h-4 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-sm font-bold text-gray-900",children:"Shell Test"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Shell management + conversational testing with routing debug"})]}),r.jsxs("button",{onClick:()=>x(C=>!C),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-medium border transition-colors
892            ${g?"bg-indigo-50 border-indigo-200 text-indigo-700":"bg-white border-gray-200 text-gray-500 hover:border-gray-300"}`,children:[r.jsx(dr,{className:"w-3.5 h-3.5"}),"Debug ",g?"ON":"OFF"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-gray-500",children:"Root Shell:"}),r.jsxs("select",{value:(o==null?void 0:o.id)||"",onChange:C=>l(N.find(k=>k.id===C.target.value)||null),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 min-w-[160px]",children:[r.jsx("option",{value:"",children:"— select root shell —"}),N.map(C=>{const k=_[C.assistant_id];return r.jsxs("option",{value:C.id,children:[C.name,k?` (${k.name})`:""]},C.id)})]})]}),r.jsx("button",{onClick:()=>d(C=>!C),className:"p-1.5 rounded-lg hover:bg-gray-100 text-gray-400 hover:text-indigo-600 transition-colors",title:c?"Hide shell manager":"Show shell manager",children:c?r.jsx(t7,{className:"w-4 h-4"}):r.jsx(t2,{className:"w-4 h-4"})})]}),a?r.jsxs("div",{className:"flex-1 flex items-center justify-center text-gray-400",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin mr-2"})," Loading shells…"]}):r.jsxs("div",{ref:j,className:"flex flex-1 min-h-0 overflow-hidden",children:[c&&r.jsx("div",{className:"bg-white shrink-0 overflow-hidden",style:{width:`${f}%`},children:r.jsx(phe,{shells:e,assistants:n,assistantsMap:_,onReload:w})}),c&&r.jsx("div",{onMouseDown:y,className:"w-2 bg-gray-100 border-x border-gray-200 flex items-center justify-center cursor-col-resize shrink-0 hover:bg-indigo-50 transition-colors group",children:r.jsx(Jz,{className:"w-3 h-4 text-gray-300 group-hover:text-indigo-400"})}),r.jsx("div",{className:"flex-1 min-w-0 bg-white overflow-hidden",children:r.jsx(bhe,{selectedShell:o,assistantsMap:_,showDebug:g})})]})]})}const Fu=[{label:"FAST Exam Protocol",level:88},{label:"Cardiac Echo Windows",level:72},{label:"Lung Ultrasound (B-lines)",level:65},{label:"Vascular Access Guidance",level:80},{label:"Abdominal POCUS",level:55}],sq=["Emergency Medicine","Critical Care","Resuscitation","Airway Management","Trauma","Pediatric POCUS"],Kl=[{label:"Professional Formation",hint:"Residency, fellowship, specialty board — we don't know yet."},{label:"Clinical Setting",hint:"ED, ICU, rural clinic? This shapes your learning path."},{label:"Years of POCUS Practice",hint:"Helps us gauge your experience level accurately."},{label:"Scan Volume (cases/month)",hint:"How many scans do you perform monthly?"},{label:"Board Certification",hint:"Let us know your certifications or exams in progress."},{label:"Primary Specialty",hint:"Your main clinical specialty or training area."}],aq=[{skill:"Transesophageal Echo (TEE)",skillIcon:Zk,skillColor:"text-violet-600",skillBg:"bg-violet-50",skillBorder:"border-violet-200",desc:"You're strong in TTE — TEE is the natural next step for advanced critical care.",contents:[{title:"TEE for the ICU Intensivist",type:"Webinar",duration:"18 min"},{title:"TEE Probe Manipulation Guide",type:"Article",duration:"8 min"},{title:"TEE Safety & Contraindications",type:"Lesson",duration:"12 min"}]},{skill:"Advanced Lung Protocols",skillIcon:Yn,skillColor:"text-amber-600",
892skillBg:"bg-amber-50",skillBorder:"border-amber-200",desc:"You know B-lines — structured protocols like BLUE/FALLS elevate diagnostic accuracy.",contents:[{title:"BLUE Protocol: Step-by-Step",type:"Lesson",duration:"25 min"},{title:"FALLS Protocol in Shock",type:"Webinar",duration:"20 min"},{title:"5 Pitfalls in Lung Ultrasound",type:"Blog",duration:"6 min"}]},{skill:"Optic Nerve Sheath (ONSD)",skillIcon:r2,skillColor:"text-emerald-600",skillBg:"bg-emerald-50",skillBorder:"border-emerald-200",desc:"Elevated ICP assessment via ONSD is underutilized — high impact for ICU practice.",contents:[{title:"Optic Nerve Sheath Measurement",type:"Article",duration:"10 min"},{title:"ONSD in Trauma Patients",type:"Lesson",duration:"15 min"},{title:"ICP Monitoring via POCUS",type:"Webinar",duration:"18 min"}]},{skill:"Pediatric POCUS",skillIcon:zn,skillColor:"text-blue-600",skillBg:"bg-blue-50",skillBorder:"border-blue-200",desc:"Pediatric probe selection and views differ significantly from adult practice.",contents:[{title:"Pediatric Echo Windows",type:"Webinar",duration:"22 min"},{title:"Pediatric FAST Adaptations",type:"Lesson",duration:"14 min"},{title:"Neonatal Lung Ultrasound",type:"Article",duration:"9 min"}]},{skill:"Cardiac Output Assessment",skillIcon:Zk,skillColor:"text-rose-600",skillBg:"bg-rose-50",skillBorder:"border-rose-200",desc:"VTI and stroke volume estimation are key for hemodynamic management in the ICU.",contents:[{title:"VTI for Cardiac Output",type:"Lesson",duration:"16 min"},{title:"LVOT Diameter Measurement",type:"Article",duration:"7 min"},{title:"Hemodynamic Monitoring with POCUS",type:"Webinar",duration:"30 min"}]},{skill:"Point-of-Care DVT",skillIcon:r2,skillColor:"text-indigo-600",skillBg:"bg-indigo-50",skillBorder:"border-indigo-200",desc:"2-point and 3-point compression DVT protocols are fast and effective at the bedside.",contents:[{title:"2-Point Compression Technique",type:"Lesson",duration:"12 min"},{title:"DVT in the ICU Patient",type:"Webinar",duration:"19 min"},{title:"Lower Extremity Venous Anatomy",type:"Article",duration:"8 min"}]},{skill:"Gallbladder & Biliary POCUS",skillIcon:Yn,skillColor:"text-teal-600",skillBg:"bg-teal-50",skillBorder:"border-teal-200",desc:"Rapid gallbladder assessment can rule in cholecystitis and biliary obstruction at the bedside.",contents:[{title:"Gallbladder Scanning Technique",type:"Lesson",duration:"14 min"},{title:"Biliary Dilation: What to Look For",type:"Article",duration:"8 min"},{title:"RUQ POCUS Mastery",type:"Webinar",duration:"24 min"}]}],yI=[{role:"assistant",content:"Hi! I'm your POCUS learning assistant. I can see you're strong in FAST exams and vascular access. Would you like to explore what's next in your learning journey?"},{role:"user",content:"Yes! I want to get better at lung ultrasound."},{role:"assistant",content:"Great choice! You already know B-lines, so the next step is the BLUE Protocol — a structured algorithm for acute dyspnea. I also found a module on the FALLS Protocol which pairs well. Want me to pull those from the Learning KB?"}];function iq({level:e}){const t=Math.round(e/100*5);return r.jsx("div",{className:"flex gap-0.5 shrink-0",children:[1,2,3,4,5].map(n=>r.jsx(Xi,{className:`w-5 h-5 ${n<=t?"text-amber-400 fill-amber-400":"text-gray-200 fill-gray-200"}`},n))})}function oq({card:e}){const t=e.skillIcon;return r.jsxs("div",{className:`flex flex-col rounded-xl border ${e.skillBorder} ${e.skillBg} p-3 h-full`,children:[r.jsxs("div",{className:"flex items-start gap-2 mb-2 shrink-0",children:[r.jsx("div",{className:"w-9 h-9 rounded-lg bg-white/80 flex items-center justify-center shrink-0 shadow-sm",children:r.jsx(t,{className:`w-5 h-5 ${e.skillColor}`})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"text-xs font-bold text-gray-800 leading-tight",children:e.skill}),r.jsx("p",{className:"text-[10px] text-gray-500 leading-snug mt-0.5",children:e.desc})]})]}),r.jsx("div",{className:"border-t border-white/60 mb-2 shrink-0"}),r.jsx("div",{className:"flex flex-col gap-2 flex-1 overflow-y-auto",children:e.contents.map((n,s)=>r.jsxs("div",{className:"bg-white/80 rounded-lg p-2 flex flex-col gap-1 shrink-0",children:[r.jsxs("div",{className:"flex items-start gap-1",children:[r.jsx(ao,{className:"w-3 h-3 text-gray-400 mt-0.5 shrink-0"}),r.jsx("p",{className:"text-[10px] font-semibold text-gray-700 leading-tight",children:n.title})]}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r.jsx("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded-full bg-gray-100 text-gray-500 uppercase tracking-wide",children:n.type}),r.jsxs("span",{className:"text-[9px] text-gray-400 flex items-center gap-0.5",children:[r.jsx(ni,{className:"w-2.5 h-2.5"}),n.duration]})]}),r.jsxs("div",{className:"flex gap-1 mt-0.5",children:[r.jsxs("button",{className:"flex items-center gap-0.5 text-[9px] font-semibold text-white bg-indigo-500 hover:bg-indigo-600 px-2 py-0.5 rounded-md transition-colors",children:[r.jsx(rc,{className:"w-2.5 h-2.5"})," Learn"]}),r.jsxs("button",{className:"flex items-center gap-0.5 text-[9px] font-semibold text-gray-600 bg-white border border-gray-200 hover:bg-gray-50 px-2 py-0.5 rounded-md transition-colors",children:[r.jsx(Br,{className:"w-2.5 h-2.5"})," Ask AI"]})]})]},s))})]})}function vhe({cards:e}){const[t,n]=h.useState(0),s=3,a=e.length,i=()=>n(c=>Math.max(0,c-1)),o=()=>n(c=>Math.min(a-s,c+1)),l=e.slice(t,t+s);return r.jsxs("div",{className:"flex flex-col flex-1 min-h-0 gap-2",children:[r.jsx("div",{className:"flex gap-2 flex-1 min-h-0",children:l.map(c=>r.jsx("div",{className:"flex-1 min-w-0 min-h-0 overflow-hidden flex flex-col",children:r.jsx(oq,{card:c})},c.skill))}),r.jsxs("div",{className:"flex items-center justify-center gap-4 shrink-0",children:[r.jsx("button",{onClick:i,disabled:t===0,className:"w-9 h-9 rounded-full border-2 border-indigo-300 bg-white flex items-center justify-center disabled:opacity-30 hover:bg-indigo-50 hover:border-indigo-500 transition-all shadow-sm",children:r.jsx(ii,{className:"w-5 h-5 text-indigo-600"})}),r.jsx("div",{className:"flex gap-1.5",children:Array.from({length:a-s+1}).map((c,d)=>r.jsx("button",{onClick:()=>n(d),className:`w-2 h-2 rounded-full transition-all ${d===t?"bg-indigo-600 w-4":"bg-gray-300 hover:bg-gray-400"}`},d))}),r.jsx("button",{onClick:o,disabled:t+s>=a,className:"w-9 h-9 rounded-full border-2 border-indigo-300 bg-white flex items-center justify-center disabled:opacity-30 hover:bg-indigo-50 hover:border-indigo-500 transition-all shadow-sm",children:r.jsx(en,{className:"w-5 h-5 text-indigo-600"})})]})]})}function whe({cards:e}){const[t,n]=h.useState(0);return r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("div",{style:{minHeight:320},className:"flex flex-col",children:r.jsx(oq,{card:e[t]})}),r.jsxs("div",{className:"flex items-center justify-center gap-4",children:[r.jsx("button",{onClick:()=>n(s=>Math.max(0,s-1)),disabled:t===0,className:"w-10 h-10 rounded-full border-2 border-indigo-300 bg-white flex items-center justify-center disabled:opacity-30 hover:bg-indigo-50 hover:border-indigo-500 transition-all shadow-sm",children:r.jsx(ii,{className:"w-6 h-6 text-indigo-600"})}),r.jsxs("span",{className:"text-sm font-semibold text-gray-500",children:[t+1," / ",e.length]}),r.jsx("button",{onClick:()=>n(s=>Math.min(e.length-1,s+1)),disabled:t===e.length-1,className:"w-10 h-10 rounded-full border-2 border-indigo-300 bg-white flex items-center justify-center disabled:opacity-30 hover:bg-indigo-50 hover:border-indigo-500 transition-all shadow-sm",children:r.jsx(en,{className:"w-6 h-6 text-indigo-600"})})]})]})}function jhe({hideHeader:e}){const[t,n]=h.useState("stars"),[s,a]=h.useState(!1),[i,o]=h.useState(!1),[l,c]=h.useState(!1),[d,f]=h.useState(sq.map(j=>({label:j,liked:null}))),m=s?Fu:Fu.slice(0,2),g=i?d:d.slice(0,3),x=l?Kl:Kl.slice(0,3);return r.jsxs("div",{className:"flex flex-col h-full gap-2 overflow-hidden",children:[!e&&r.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:"About Me"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex items-center gap-1 bg-gray-100 rounded-lg p-0.5",children:[r.jsx("button",{onClick:()=>n("bars"),className:`px-2 py-1 rounded-md transition-colors ${t==="bars"?"bg-white shadow-sm text-indigo-600":"text-gray-400 hover:text-gray-600"}`,title:"Bar chart",children:r.jsx(P0,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>n("stars"),className:`px-2 py-1 rounded-md transition-colors ${t==="stars"?"bg-white shadow-sm text-amber-500":"text-gray-400 hover:text-gray-600"}`,title:"Stars",children:r.jsx(Xi,{className:"w-3.5 h-3.5"})})]}),r.jsx("span",{className:"text-xs font-semibold text-amber-600",children:"62% complete"})]})]}),e&&r.jsxs("div",{className:"flex items-center gap-2 justify-end shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1 bg-gray-100 rounded-lg p-0.5",children:[r.jsx("button",{onClick:()=>n("bars"),className:`px-2 py-1 rounded-md transition-colors ${t==="bars"?"bg-white shadow-sm text-indigo-600":"text-gray-400 hover:text-gray-600"}`,title:"Bar chart",children:r.jsx(P0,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>n("stars"),className:`px-2 py-1 rounded-md transition-colors ${t==="stars"?"bg-white shadow-sm text-amber-500":"text-gray-400 hover:text-gray-600"}`,title:"Stars",children:r.jsx(Xi,{className:"w-3.5 h-3.5"})})]}),r.jsx("span",{className:"text-xs font-semibold text-amber-600",children:"62% complete"})]}),r.jsxs("div",{className:"flex gap-3 flex-1 min-h-0 overflow-hidden",children:[r.jsxs("div",{className:"w-[40%] shrink-0 flex flex-col gap-2 overflow-y-auto",children:[m.map(j=>r.jsx("div",{children:t==="bars"?r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"h-10 w-full rounded-md overflow-hidden bg-indigo-100",children:r.jsx("div",{className:"h-full bg-indigo-500 rounded-md flex items-center px-3",style:{width:`${j.level}%`},children:r.jsx("span",{className:"text-sm font-semibold text-white truncate",children:j.label})})}),r.jsxs("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs font-bold text-indigo-700",children:[j.level,"%"]})]}):r.jsxs("div",{className:"flex items-center justify-between gap-2 py-1.5",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700 flex-1 min-w-0",children:j.label}),r.jsx(iq,{level:j.level})]})},j.label)),r.jsxs("button",{onClick:()=>a(j=>!j),className:"text-[10px] font-semibold text-indigo-500 hover:text-indigo-700 flex items-center gap-0.5 transition-colors",children:[s?"less":`more… (${Fu.length-2} more)`,s?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]}),r.jsxs("div",{className:"flex items-center justify-between mt-1",children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"Interests"}),r.jsx("button",{className:"w-5 h-5 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center hover:bg-indigo-200 transition-colors",children:r.jsx(ln,{className:"w-3 h-3"})})]}),r.jsx("div",{className:"flex flex-col gap-1",children:g.map((j,b)=>r.jsxs("div",{className:"flex items-center justify-between bg-indigo-50 border border-indigo-100 rounded-lg px-2 py-1",children:[r.jsx("span",{className:"text-[10px] font-medium text-indigo-700 truncate flex-1",children:j.label}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0 ml-1",children:[r.jsx("button",{onClick:()=>f(y=>y.map((w,_)=>_===b?{...w,liked:w.liked===!0?null:!0}:w)),className:`transition-colors ${j.liked===!0?"text-emerald-500":"text-emerald-400 hover:text-emerald-600"}`,children:r.jsx(qo,{className:"w-3 h-3"})}),r.jsx("button",{onClick:()=>f(y=>y.map((w,_)=>_===b?{...w,liked:w.liked===!1?null:!1}:w)),className:`transition-colors ${j.liked===!1?"text-red-400":"text-red-300 hover:text-red-500"}`,children:r.jsx(hc,{className:"w-3 h-3"})})]})]},j.label))}),d.length>3&&r.jsxs("button",{onClick:()=>o(j=>!j),className:"text-[10px] font-semibold text-indigo-500 hover:text-indigo-700 flex items-center gap-0.5 transition-colors",children:[i?"less":`more… (${d.length-3} more)`,i?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]})]}),r.jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2 overflow-hidden",children:[r.jsx("p",{className:"text-sm font-bold text-gray-900 shrink-0",children:"Tell more about you"}),r.jsx("div",{className:"flex flex-col gap-2 flex-1 overflow-y-auto",children:x.map(j=>r.jsx("button",{className:"bg-amber-50 border border-amber-100 rounded-lg p-3.5 shrink-0 text-left hover:bg-amber-100 hover:border-amber-300 transition-colors w-full",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(fr,{className:"w-5 h-5 text-amber-400 mt-0.5 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-semibold text-gray-800",children:j.label}),r.jsx("p",{className:"text-xs text-gray-600 leading-snug mt-0.5",children:j.hint})]}),r.jsx(Rh,{className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5"})]})},j.label))}),Kl.length>3&&r.jsxs("button",{onClick:()=>c(j=>!j),className:"text-[10px] font-semibold text-amber-500 hover:text-amber-700 flex items-center gap-0.5 transition-colors shrink-0",children:[l?"less":`more… (${Kl.length-3} more)`,l?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]})]})]})]})}function _he(){const[e,t]=h.useState(!0),[n,s]=h.useState(!0);return r.jsxs("div",{className:"flex flex-col flex-1 min-w-0 divide-y divide-gray-100 overflow-hidden",children:[r.jsxs("div",{className:`flex flex-col overflow-hidden bg-white transition-all ${e?"flex-1 min-h-0":"shrink-0"}`,children:[r.jsxs("button",{onClick:()=>t(a=>!a),className:"flex items-center gap-2 px-4 py-2.5 shrink-0 hover:bg-gray-50 transition-colors border-b border-gray-50",children:[r.jsx(Xi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-semibold text-sm text-gray-800 flex-1 text-left",children:"About Me"}),e?r.jsx(Mn,{className:"w-4 h-4 text-gray-400"}):r.jsx(gt,{className:"w-4 h-4 text-gray-400"})]}),e&&r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:r.jsx(jhe,{hideHeader:!0})})]}),r.jsxs("div",{className:`flex flex-col overflow-hidden bg-white transition-all ${n?"flex-1 min-h-0":"shrink-0"}`,children:[r.jsxs("button",{onClick:()=>s(a=>!a),className:"flex items-center gap-2 px-4 py-2.5 shrink-0 hover:bg-gray-50 transition-colors border-b border-gray-50",children:[r.jsx(Zo,{className:"w-5 h-5 text-indigo-500"}),r.jsx("span",{className:"font-bold text-base text-gray-800 flex-1 text-left",children:"AI Suggested Learning"}),r.jsx(Gr,{className:"text-[10px] bg-indigo-100 text-indigo-700 border-0 mr-2",children:"AI Powered"}),n?r.jsx(Mn,{className:"w-4 h-4 text-gray-400"}):r.jsx(gt,{className:"w-4 h-4 text-gray-400"})]}),n&&r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:r.jsx(vhe,{cards:aq})})]})]})}function a1({title:e,defaultOpen:t,children:n}){const[s,a]=h.useState(t??!0);return r.jsxs("div",{className:"border border-gray-100 rounded-xl overflow-hidden",children:[r.jsxs("button",{onClick:()=>a(i=>!i),className:"w-full flex items-center justify-between px-3 py-2.5 bg-gray-50 text-left",children:[r.jsx("span",{className:"text-sm font-semibold text-gray-700",children:e}),s?r.jsx(Mn,{className:"w-4 h-4 text-gray-400"}):r.jsx(gt,{className:"w-4 h-4 text-gray-400"})]}),s&&r.jsx("div",{className:"p-3",children:n})]})}function Nhe(){const[e,t]=h.useState("stars"),[n,s]=h.useState(!1),[a,i]=h.useState(!1),[o,l]=h.useState(!1),[c,d]=h.useState(sq.map(x=>({label:x,liked:null}
892))),f=n?Fu:Fu.slice(0,2),m=a?c:c.slice(0,3),g=o?Kl:Kl.slice(0,3);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(a1,{title:"Tell more about you",defaultOpen:!0,children:r.jsxs("div",{className:"space-y-2",children:[g.map(x=>r.jsxs("div",{className:"bg-amber-50 border border-amber-100 rounded-lg p-2.5",children:[r.jsxs("div",{className:"flex items-start gap-1.5",children:[r.jsx(fr,{className:"w-3.5 h-3.5 text-amber-400 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-gray-700",children:x.label}),r.jsx("p",{className:"text-[11px] text-gray-400 leading-snug",children:x.hint})]})]}),r.jsxs("button",{className:"mt-1.5 text-[11px] font-semibold text-amber-600 flex items-center gap-0.5",children:["Tell us more ",r.jsx(Rh,{className:"w-3 h-3"})]})]},x.label)),Kl.length>3&&r.jsxs("button",{onClick:()=>l(x=>!x),className:"text-xs font-semibold text-amber-500 flex items-center gap-0.5",children:[o?"less":`more… (${Kl.length-3} more)`,o?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})]})]})}),r.jsxs(a1,{title:"Skills",defaultOpen:!0,children:[r.jsx("div",{className:"flex items-center justify-end mb-2",children:r.jsxs("div",{className:"flex items-center gap-1 bg-gray-100 rounded-lg p-0.5",children:[r.jsx("button",{onClick:()=>t("bars"),className:`px-2 py-1 rounded-md transition-colors ${e==="bars"?"bg-white shadow-sm text-indigo-600":"text-gray-400"}`,children:r.jsx(P0,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>t("stars"),className:`px-2 py-1 rounded-md transition-colors ${e==="stars"?"bg-white shadow-sm text-amber-500":"text-gray-400"}`,children:r.jsx(Xi,{className:"w-3.5 h-3.5"})})]})}),r.jsxs("div",{className:"space-y-2",children:[f.map(x=>r.jsx("div",{children:e==="bars"?r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"h-8 w-full rounded-md overflow-hidden bg-indigo-100",children:r.jsx("div",{className:"h-full bg-indigo-500 rounded-md flex items-center px-2",style:{width:`${x.level}%`},children:r.jsx("span",{className:"text-xs font-semibold text-white truncate",children:x.label})})}),r.jsxs("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs font-bold text-indigo-700",children:[x.level,"%"]})]}):r.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.jsx("span",{className:"text-xs text-gray-700",children:x.label}),r.jsx(iq,{level:x.level})]})},x.label)),r.jsxs("button",{onClick:()=>s(x=>!x),className:"text-xs font-semibold text-indigo-500 flex items-center gap-0.5",children:[n?"less":`more… (${Fu.length-2} more)`,n?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})]})]})]}),r.jsx(a1,{title:"Interests",defaultOpen:!1,children:r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("div",{className:"flex justify-end mb-1",children:r.jsx("button",{className:"w-6 h-6 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center hover:bg-indigo-200 transition-colors",children:r.jsx(ln,{className:"w-3.5 h-3.5"})})}),m.map((x,j)=>r.jsxs("div",{className:"flex items-center justify-between bg-indigo-50 border border-indigo-100 rounded-lg px-3 py-2",children:[r.jsx("span",{className:"text-xs font-medium text-indigo-700",children:x.label}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>d(b=>b.map((y,w)=>w===j?{...y,liked:y.liked===!0?null:!0}:y)),className:`transition-colors ${x.liked===!0?"text-emerald-500":"text-emerald-400 hover:text-emerald-600"}`,children:r.jsx(qo,{className:"w-4 h-4"})}),r.jsx("button",{onClick:()=>d(b=>b.map((y,w)=>w===j?{...y,liked:y.liked===!1?null:!1}:y)),className:`transition-colors ${x.liked===!1?"text-red-400":"text-red-300 hover:text-red-500"}`,children:r.jsx(hc,{className:"w-4 h-4"})})]})]},x.label)),c.length>3&&r.jsxs("button",{onClick:()=>i(x=>!x),className:"text-xs font-semibold text-indigo-500 flex items-center gap-0.5",children:[a?"less":`more… (${c.length-3} more)`,a?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})]})]})})]})}function i1({title:e,icon:t,iconColor:n,defaultOpen:s,footer:a,children:i}){const[o,l]=h.useState(s??!1);return r.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:[r.jsxs("button",{onClick:()=>l(c=>!c),className:"w-full flex items-center gap-3 px-5 py-4 text-left",children:[r.jsx(t,{className:`w-6 h-6 ${n}`}),r.jsx("span",{className:"font-bold text-lg text-gray-900 flex-1",children:e}),o?r.jsx(Mn,{className:"w-5 h-5 text-gray-400"}):r.jsx(gt,{className:"w-5 h-5 text-gray-400"})]}),!o&&a&&r.jsx("div",{className:"px-5 pb-4",children:a}),o&&r.jsx("div",{className:"px-5 pb-5 pt-1",children:i})]})}function bI(){const[e,t]=h.useState(!1);return r.jsxs("div",{className:"flex flex-col bg-gray-50 overflow-hidden",style:{height:"calc(100vh - 48px)"},children:[r.jsxs("div",{className:"bg-white border-b px-6 py-3 flex items-center gap-3 shrink-0",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-indigo-600 flex items-center justify-center",children:r.jsx(ao,{className:"w-4 h-4 text-white"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-base font-bold text-gray-900",children:"My Learning Journey"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Personalized POCUS learning based on your profile"})]}),r.jsx(Gr,{className:"ml-auto text-xs bg-amber-100 text-amber-700 border-0 px-2.5",children:"✦ UX Prototype V2"})]}),r.jsxs("div",{className:"hidden md:flex flex-1 min-h-0 overflow-hidden",children:[r.jsx(_he,{}),r.jsxs("div",{className:"border-l border-gray-200 bg-white flex flex-col overflow-hidden transition-all duration-300",style:{width:e?480:360},children:[r.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 pb-2 border-b border-gray-100 shrink-0",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg bg-indigo-600 flex items-center justify-center",children:r.jsx(Vn,{className:"w-4 h-4 text-white"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-semibold text-gray-800",children:"POCUS Learning Assistant"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Personalized to your profile"})]}),r.jsxs(Gr,{className:"text-[10px] bg-emerald-100 text-emerald-700 border-0 flex items-center gap-1",children:[r.jsx(mr,{className:"w-2.5 h-2.5"})," Online"]}),r.jsx("button",{onClick:()=>t(n=>!n),className:"ml-2 p-1.5 rounded-lg hover:bg-gray-100 text-gray-400 hover:text-indigo-600 transition-colors",title:e?"Collapse chat":"Expand chat",children:e?r.jsx(n7,{className:"w-4 h-4"}):r.jsx(n2,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"flex-1 overflow-y-auto py-3 px-4 space-y-3 min-h-0",children:yI.map((n,s)=>r.jsx("div",{className:`flex ${n.role==="user"?"justify-end":"justify-start"}`,children:r.jsx("div",{className:`max-w-[88%] rounded-2xl px-3.5 py-2.5 text-xs leading-relaxed
893                  ${n.role==="user"?"bg-indigo-600 text-white rounded-br-sm":"bg-gray-100 text-gray-800 rounded-bl-sm"}`,children:n.content})},s))}),r.jsx("div",{className:"px-4 pb-1 shrink-0 flex gap-2 flex-wrap",children:["What should I learn next?","My lung US gaps","FAST exam tips"].map(n=>r.jsx("button",{className:"text-xs font-medium px-3 py-1.5 rounded-md border border-indigo-200 text-indigo-600 hover:bg-indigo-50 transition-colors",children:n},n))}),r.jsx("div",{className:"px-4 pb-4 shrink-0",children:r.jsx(o1,{})})]})]}),r.jsxs("div",{className:"md:hidden flex-1 overflow-y-auto p-3 space-y-3",children:[r.jsx(i1,{title:"About Me",icon:Xi,iconColor:"text-amber-500",defaultOpen:!0,children:r.jsx(Nhe,{})}),r.jsx(i1,{title:"AI Suggested Learning",icon:Zo,iconColor:"text-indigo-500",children:r.jsx(whe,{cards:aq})}),r.jsx(i1,{title:"Learning Assistant",icon:Vn,iconColor:"text-indigo-600",defaultOpen:!1,footer:r.jsx(o1,{}),children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("div",{className:"space-y-3",children:yI.map((n,s)=>r.jsx("div",{className:`flex ${n.role==="user"?"justify-end":"justify-start"}`,children:r.jsx("div",{className:`max-w-[88%] rounded-2xl px-3.5 py-2.5 text-xs leading-relaxed
894                    ${n.role==="user"?"bg-indigo-600 text-white rounded-br-sm":"bg-gray-100 text-gray-800 rounded-bl-sm"}`,children:n.content})},s))}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:["What should I learn next?","My lung US gaps","FAST exam tips"].map(n=>r.jsx("button",{className:"text-xs font-medium px-3 py-1.5 rounded-md border border-indigo-200 text-indigo-600 hover:bg-indigo-50 transition-colors",children:n},n))}),r.jsx(o1,{})]})})]})]})}function o1(){const[e,t]=h.useState("");function n(){e.trim()&&t("")}return r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{value:e,onCh
894ange:s=>t(s.target.value),onKeyDown:s=>s.key==="Enter"&&n(),placeholder:"Ask your POCUS assistant...",className:"text-sm h-9"}),r.jsx(de,{size:"sm",onClick:n,disabled:!e.trim(),className:"bg-indigo-600 hover:bg-indigo-700 shrink-0 px-3",children:r.jsx(Fd,{className:"w-3.5 h-3.5"})})]})}function She(){const t=new URLSearchParams(window.location.search).get("assistant_id"),[n,s]=h.useState(null),[a,i]=h.useState([]),[o,l]=h.useState(!0);h.useEffect(()=>{t&&c()},[t]);async function c(){l(!0);const[m,g]=await Promise.all([Y.entities.Assistant.filter({id:t}),Y.entities.Chat.filter({assistant_id:t},"-started_at",50)]);s(m[0]),i(g),l(!1)}async function d(m,g){g.stopPropagation(),confirm(`Delete chat "${m.title||"Untitled"}"?`)&&(await Y.entities.Chat.delete(m.id),c())}function f(m){return m?new Date(m).toLocaleString("pt-BR",{dateStyle:"short",timeStyle:"short"}):""}return o?r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading..."}):n?r.jsxs("div",{className:"p-6 max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[r.jsx(wt,{to:yt("Assistants"),children:r.jsxs(de,{variant:"ghost",size:"sm",className:"gap-1",children:[r.jsx(or,{className:"w-4 h-4"})," Back"]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg bg-violet-100 flex items-center justify-center",children:r.jsx(Vn,{className:"w-4 h-4 text-violet-600"})}),r.jsxs("div",{children:[r.jsxs("h1",{className:"text-xl font-bold text-gray-900",children:[n.name," — Sessions"]}),r.jsxs("p",{className:"text-sm text-gray-400",children:[a.length," saved chat",a.length!==1?"s":""]})]})]}),r.jsx(wt,{to:yt(`Chat?assistant_id=${t}`),children:r.jsxs(de,{size:"sm",className:"gap-1.5",children:[r.jsx(Br,{className:"w-3.5 h-3.5"})," New Chat"]})})]}),a.length===0?r.jsxs("div",{className:"text-center py-20 border-2 border-dashed border-gray-200 rounded-2xl text-gray-400",children:[r.jsx(Br,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No sessions yet. Start a chat to create one."})]}):r.jsx("div",{className:"space-y-2",children:a.map(m=>r.jsx(wt,{to:yt(`Chat?assistant_id=${t}&chat_id=${m.id}`),children:r.jsxs("div",{className:"flex items-center gap-3 border rounded-xl px-4 py-3.5 bg-white hover:shadow-md hover:border-indigo-200 transition-all group cursor-pointer",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-gray-900 text-sm",children:m.title||"Untitled"}),r.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[r.jsx("span",{className:"text-xs text-gray-300",children:m.user_email}),r.jsx("span",{className:"text-xs text-gray-300",children:f(m.started_at)})]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx("button",{onClick:g=>d(m,g),className:"opacity-0 group-hover:opacity-100 text-gray-200 hover:text-red-500 transition-all",children:r.jsx(un,{className:"w-4 h-4"})}),r.jsx(en,{className:"w-4 h-4 text-gray-300"})]})]})},m.id))})]}):r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Assistant not found."})}const Ru={indigo:"bg-indigo-400",emerald:"bg-emerald-400",violet:"bg-violet-400",amber:"bg-amber-400",rose:"bg-rose-400",sky:"bg-sky-400",gray:"bg-gray-400"},khe=Object.keys(Ru);function Che({library:e,onSave:t,onClose:n}){const[s,a]=h.useState((e==null?void 0:e.name)||""),[i,o]=h.useState((e==null?void 0:e.description)||""),[l,c]=h.useState((e==null?void 0:e.color)||"indigo");async function d(){s.trim()&&(await t({name:s.trim(),description:i,color:l}),n())}return r.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-sm p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"font-semibold text-sm text-gray-900",children:e!=null&&e.id?"Edit Library":"New Library"}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Name *"}),r.jsx(It,{value:s,onChange:f=>a(f.target.value),placeholder:"Library name",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Description"}),r.jsx(It,{value:i,onChange:f=>o(f.target.value),placeholder:"Optional description"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Color"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:khe.map(f=>r.jsx("button",{onClick:()=>c(f),className:`w-6 h-6 rounded-full border-2 transition-all ${Ru[f]} ${l===f?"border-gray-800 scale-110":"border-transparent opacity-70 hover:opacity-100"}`,title:f},f))})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[r.jsx(de,{variant:"outline",size:"sm",onClick:n,children:"Cancel"}),r.jsxs(de,{size:"sm",onClick:d,disabled:!s.trim(),children:[r.jsx(Tn,{className:"w-3.5 h-3.5 mr-1"})," Save"]})]})]})})}function zb({libraries:e,selected:t,onSelect:n,counts:s={},onLibrariesChange:a,onItemsUnassigned:i,storageKey:o}){const l=o?`libsidebar_collapsed_${o}`:null,[c,d]=h.useState(()=>l?localStorage.getItem(l)==="true":!1),[f,m]=h.useState(null);function g(){const b=!c;d(b),l&&localStorage.setItem(l,String(b))}async function x(b){if(f!=null&&f.id)await Y.entities.Library.update(f.id,b),a(e.map(y=>y.id===f.id?{...y,...b}:y));else{const y=await Y.entities.Library.create(b);a([...e,y])}m(null)}async function j(b){confirm(`Delete library "${b.name}"? Items inside will become unassigned.`)&&(await Y.entities.Library.delete(b.i
894d),a(e.filter(y=>y.id!==b.id)),i&&i(b.id),t===b.id&&n("all"))}return c?r.jsxs("div",{className:"w-10 shrink-0 border-r bg-gray-50 flex flex-col items-center py-3 gap-2",children:[r.jsx("button",{onClick:g,title:"Expand sidebar",className:"p-1.5 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(en,{className:"w-4 h-4"})}),r.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[r.jsx("div",{onClick:()=>{n("all"),d(!1),l&&localStorage.setItem(l,"false")},className:`w-2.5 h-2.5 rounded-full cursor-pointer transition-all ${t==="all"?"bg-indigo-500 scale-125":"bg-gray-300 hover:bg-gray-400"}`,title:"All"}),e.map(b=>{const y=Ru[b.color]||Ru.indigo,w=t===b.id;return r.jsx("div",{onClick:()=>{n(b.id),d(!1),l&&localStorage.setItem(l,"false")},className:`w-2.5 h-2.5 rounded-full cursor-pointer transition-all ${y} ${w?"scale-125 ring-2 ring-offset-1 ring-gray-400":"opacity-60 hover:opacity-100"}`,title:b.name},b.id)})]})]}):r.jsxs("div",{className:"w-52 shrink-0 border-r bg-gray-50 flex flex-col overflow-y-auto",children:[r.jsxs("div",{className:"px-3 pt-4 pb-2 flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-gray-400",children:"Libraries"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("button",{onClick:()=>m({}),title:"New library",className:"p-1 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ln,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:g,title:"Collapse sidebar",className:"p-1 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("button",{onClick:()=>n("all"),className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left
895          ${t==="all"?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,children:[r.jsx(aee,{className:"w-4 h-4 shrink-0"}),r.jsx("span",{className:"flex-1 truncate",children:"All"}),r.jsx("span",{className:"text-xs opacity-50",children:s.__all__??""})]}),e.map(b=>{const y=t===b.id,w=Ru[b.color]||Ru.indigo;return r.jsxs("div",{onClick:()=>n(b.id),className:`group flex items-center gap-2 px-3 py-2 text-sm transition-colors cursor-pointer
896              ${y?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,children:[r.jsx("div",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${w}`}),r.jsx("span",{className:"flex-1 truncate",children:b.name}),r.jsx("span",{className:"text-xs opacity-50 group-hover:hidden",children:s[b.id]??0}),r.jsxs("div",{className:"hidden group-hover:flex items-center gap-0.5",children:[r.jsx("button",{onClick:_=>{_.stopPropagation(),m(b)},className:"p-0.5 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-700",children:r.jsx(ra,{className:"w-3 h-3"})}),r.jsx("button",{onClick:_=>{_.stopPropagation(),j(b)},className:"p-0.5 rounded hover:bg-red-50 text-gray-400 hover:text-red-500",children:r.jsx(un,{className:"w-3 h-3"})})]})]},b.id)}),r.jsxs("button",{onClick:()=>n("none"),className:`flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left mt-1 border-t
897          ${t==="none"?"bg-gray-100 text-gray-700 font-medium":"text-gray-400 hover:bg-gray-100"}`,children:[r.jsx(wh,{className:"w-4 h-4 shrink-0 opacity-40"}),r.jsx("span",{className:"flex-1 truncate italic",children:"Not in a Library"}),r.jsx("span",{className:"text-xs opacity-50",children:s.__none__??0})]}),f!==null&&r.jsx(Che,{library:f!=null&&f.id?f:null,onSave:x,onClose:()=>m(null)})]})}function Ub({itemName:e,libraries:t,currentLibraryId:n,onMove:s,onClose:a}){return r.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-xs p-5 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("h3",{className:"font-semibold text-sm text-gray-900 flex items-center gap-2",children:[r.jsx(wh,{className:"w-4 h-4 text-indigo-500"})," Move to Library"]}),r.jsx("button",{onClick:a,className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("p",{className:"text-xs text-gray-500 truncate",children:['"',e,'"']}),r.jsxs("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:[r.jsxs("button",{onClick:()=>s(""),className:`w-full text-left flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors
898              ${n?"text-gray-500 hover:bg-gray-50":"bg-gray-100 font-medium text-gray-700"}`,children:[r.jsx(wh,{className:"w-3.5 h-3.5 opacity-30 shrink-0"}),"No library (uncategorized)",!n&&r.jsx(Tn,{className:"w-3.5 h-3.5 ml-auto text-gray-500"})]}),t.map(i=>{const o=n===i.id;return r.jsxs("button",{onClick:()=>s(i.id),className:`w-full text-left flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors
899                  ${o?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-50"}`,children:[r.jsx(wh,{className:"w-3.5 h-3.5 shrink-0"}),i.name,o&&r.jsx(Tn,{className:"w-3.5 h-3.5 ml-auto"})]},i.id)})]}),r.jsx("div",{className:"flex justify-end pt-1",children:r.jsx(de,{variant:"outline",size:"sm",onClick:a,children:"Cancel"})})]})})}var l1,vI;function aa(){if(vI)return l1;vI=1;var e=Array.isArray;return l1=e,l1}var c1,wI;function lq(){if(wI)return c1;wI=1;var e=typeof Nx=="object"&&Nx&&Nx.Object===Object&&Nx;return c1=e,c1}var d1,jI;function fo(){if(jI)return d1;jI=1;var e=lq(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return d1=n,d1}var u1,_I;function lg(){if(_I)return u1;_I=1;var e=fo(),t=e.Symbol;return u1=t,u1}var m1,NI;
vendor: 8,931 bytes, line 899
899function Ehe(){if(NI)return m1;NI=1;var e=lg(),t=Object.prototype,n=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(o){var l=n.call(o,a),c=o[a];try{o[a]=void 0;var d=!0}catch{}var f=s.call(o);return d&&(l?o[a]=c:delete o[a]),f}return m1=i,m1}var f1,SI;function Ahe(){if(SI)return f1;SI=1;var e=Object.prototype,t=e.toString;function n(s){return t.call(s)}return f1=n,f1}var h1,kI;function nl(){if(kI)return h1;kI=1;var e=lg(),t=Ehe(),n=Ahe(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function o(l){return l==null?l===void 0?a:s:i&&i in Object(l)?t(l):n(l)}return h1=o,h1}var p1,CI;function rl(){if(CI)return p1;CI=1;function e(t){return t!=null&&typeof t=="object"}return p1=e,p1}var g1,EI;function Jm(){if(EI)return g1;EI=1;var e=nl(),t=rl(),n="[object Symbol]";function s(a){return typeof a=="symbol"||t(a)&&e(a)==n}return g1=s,g1}var x1,AI;function $E(){if(AI)return x1;AI=1;var e=aa(),t=Jm(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,o){if(e(i))return!1;var l=typeof i;return l=="number"||l=="symbol"||l=="boolean"||i==null||t(i)?!0:s.test(i)||!n.test(i)||o!=null&&i in Object(o)}return x1=a,x1}var y1,TI;function yc(){if(TI)return y1;TI=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return y1=e,y1}var b1,PI;function BE(){if(PI)return b1;PI=1;var e=nl(),t=yc(),n="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(l){if(!t(l))return!1;var c=e(l);return c==s||c==a||c==n||c==i}return b1=o,b1}var v1,OI;function The(){if(OI)return v1;OI=1;var e=fo(),t=e["__core-js_shared__"];return v1=t,v1}var w1,II;function Phe(){if(II)return w1;II=1;var e=The(),t=(function(){var s=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function n(s){return!!t&&t in s}return w1=n,w1}var j1,RI;function cq(){if(RI)return j1;RI=1;var e=Function.prototype,t=e.toString;function n(s){if(s!=null){try{return t.call(s)}catch{}try{return s+""}catch{}}return""}return j1=n,j1}var _1,MI;function Ohe(){if(MI)return _1;MI=1;var e=BE(),t=Phe(),n=yc(),s=cq(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,l=Object.prototype,c=o.toString,d=l.hasOwnProperty,f=RegExp("^"+c.call(d).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(g){if(!n(g)||t(g))return!1;var x=e(g)?f:i;return x.test(s(g))}return _1=m,_1}var N1,DI;function Ihe(){if(DI)return N1;DI=1;function e(t,n){return t==null?void 0:t[n]}return N1=e,N1}var S1,LI;function Kd(){if(LI)return S1;LI=1;var e=Ohe(),t=Ihe();function n(s,a){var i=t(s,a);return e(i)?i:void 0}return S1=n,S1}var k1,$I;function qb(){if($I)return k1;$I=1;var e=Kd(),t=e(Object,"create");return k1=t,k1}var C1,BI;function Rhe(){if(BI)return C1;BI=1;var e=qb();function t(){this.__data__=e?e(null):{},this.size=0}return C1=t,C1}var E1,FI;function Mhe(){if(FI)return E1;FI=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return E1=e,E1}var A1,zI;function Dhe(){if(zI)return A1;zI=1;var e=qb(),t="__lodash_hash_undefined__",n=Object.prototype,s=n.hasOwnProperty;function a(i){var o=this.__data__;if(e){var l=o[i];return l===t?void 0:l}return s.call(o,i)?o[i]:void 0}return A1=a,A1}var T1,UI;function Lhe(){if(UI)return T1;UI=1;var e=qb(),t=Object.prototype,n=t.hasOwnProperty;function s(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return T1=s,T1}var P1,qI;function $he(){if(qI)return P1;qI=1;var e=qb(),t="__lodash_hash_undefined__";function n(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=e&&a===void 0?t:a,this}return P1=n,P1}var O1,KI;function Bhe(){if(KI)return O1;KI=1;var e=Rhe(),t=Mhe(),n=Dhe(),s=Lhe(),a=$he();function i(o){var l=-1,c=o==null?0:o.length;for(this.clear();++l<c;){var d=o[l];this.set(d[0],d[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,O1=i,O1}var I1,VI;function Fhe(){if(VI)return I1;VI=1;function e(){this.__data__=[],this.size=0}return I1=e,I1}var R1,HI;function FE(){if(HI)return R1;HI=1;function e(t,n){return t===n||t!==t&&n!==n}return R1=e,R1}var M1,WI;function Kb(){if(WI)return M1;WI=1;var e=FE();function t(n,s){for(var a=n.length;a--;)if(e(n[a][0],s))return a;return-1}return M1=t,M1}var D1,GI;function zhe(){if(GI)return D1;GI=1;var e=Kb(),t=Array.prototype,n=t.splice;function s(a){var i=this.__data__,o=e(i,a);if(o<0)return!1;var l=i.length-1;return o==l?i.pop():n.call(i,o,1),--this.size,!0}return D1=s,D1}var L1,YI;function Uhe(){if(YI)return L1;YI=1;var e=Kb();function t(n){var s=this.__data__,a=e(s,n);return a<0?void 0:s[a][1]}return L1=t,L1}var $1,JI;function qhe(){if(JI)return $1;JI=1;var e=Kb();function t(n){return e(this.__data__,n)>-1}return $1=t,$1}var B1,QI;function Khe(){if(QI)return B1;QI=1;var e=Kb();function t(n,s){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,s])):a[i][1]=s,this}return B1=t,B1}var F1,XI;function Vb(){if(XI)return F1;XI=1;var e=Fhe(),t=zhe(),n=Uhe(),s=qhe(),a=Khe();function i(o){var l=-1,c=o==null?0:o.length;for(this.clear();++l<c;){var d=o[l];this.set(d[0],d[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,F1=i,F1}var z1,ZI;function zE(){if(ZI)return z1;ZI=1;var e=Kd(),t=fo(),n=e(t,"Map");return z1=n,z1}var U1,eR;function Vhe(){if(eR)return U1;eR=1;var e=Bhe(),t=Vb(),n=zE();function s(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return U1=s,U1}var q1,tR;function Hhe(){if(tR)return q1;tR=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return q1=e,q1}var K1,nR;function Hb(){if(nR)return K1;nR=1;var e=Hhe();function t(n,s){var a=n.__data__;return e(s)?a[typeof s=="string"?"string":"hash"]:a.map}return K1=t,K1}var V1,rR;function Whe(){if(rR)return V1;rR=1;var e=Hb();function t(n){var s=e(this,n).delete(n);return this.size-=s?1:0,s}return V1=t,V1}var H1,sR;function Ghe(){if(sR)return H1;sR=1;var e=Hb();function t(n){return e(this,n).get(n)}return H1=t,H1}var W1,aR;function Yhe(){if(aR)return W1;aR=1;var e=Hb();function t(n){return e(this,n).has(n)}return W1=t,W1}var G1,iR;function Jhe(){if(iR)return G1;iR=1;var e=Hb();function t(n,s){var a=e(this,n),i=a.size;return a.set(n,s),this.size+=a.size==i?0:1,this}return G1=t,G1}var Y1,oR;function UE(){if(oR)return Y1;oR=1;var e=Vhe(),t=Whe(),n=Ghe(),s=Yhe(),a=Jhe();function i(o){var l=-1,c=o==null?0:o.length;for(this.clear();++l<c;){var d=o[l];this.set(d[0],d[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=s,i.prototype.set=a,Y1=i,Y1}var J1,lR;function dq(){if(lR)return J1;lR=1;var e=UE(),t="Expected a function";function n(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var o=arguments,l=a?a.apply(this,o):o[0],c=i.cache;if(c.has(l))return c.get(l);var d=s.apply(this,o);return i.cache=c.set(l,d)||c,d};return i.cache=new(n.Cache||e),i}return n.Cache=e,J1=n,J1}var Q1,cR;function Qhe(){if(cR)return Q1;cR=1;var e=dq(),t=500;function n(s){var a=e(s,function(o){return i.size===t&&i.clear(),o}),i=a.cache;return a}return Q1=n,Q1}var X1,dR;function Xhe(){if(dR)return X1;dR=1;var e=Qhe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,s=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(o,l,c,d){i.push(c?d.replace(n,"$1"):l||o)}),i});return X1=s,X1}var Z1,uR;function qE(){if(uR)return Z1;uR=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=Array(a);++s<a;)i[s]=n(t[s],s,t);return i}return Z1=e,Z1}var e_,mR;function Zhe(){if(mR)return e_;mR=1;var e=lg(),t=qE(),n=aa(),s=Jm(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function o(l){if(typeof l=="string")return l;if(n(l))return t(l,o)+"";if(s(l))return i?i.call(l):"";var c=l+"";return c=="0"&&1/l==-1/0?"-0":c}return e_=o,e_}var t_,fR;function uq(){if(fR)return t_;fR=1;var e=Zhe();function t(n){return n==null?"":e(n)}return t_=t,t_}var n_,hR;function mq(){if(hR)return n_;hR=1;var e=aa(),t=$E(),n=Xhe(),s=uq();function a(i,o){return e(i)?i:t(i,o)?[i]:n(s(i))}return n_=a,n_}var r_,pR;function Wb(){if(pR)return r_;pR=1;var e=Jm();function t(n){if(typeof n=="string"||e(n))return n;var s=n+"";return s=="0"&&1/n==-1/0?"-0":s}return r_=t,r_}var s_,gR;function KE(){if(gR)return s_;gR=1;var e=mq(),t=Wb();function n(s,a){a=e(a,s);for(var i=0,o=a.length;s!=null&&i<o;)s=s[t(a[i++])];return i&&i==o?s:void 0}return s_=n,s_}var a_,xR;function fq(){if(xR)return a_;xR=1;var e=KE();function t(n,s,a){var i=n==null?void 0:e(n,s);return i===void 0?a:i}return a_=t,a_}var epe=fq();const Ya=Un(epe);var i_,yR;function tpe(){if(yR)return i_;yR=1;function e(t){return t==null}return i_=e,i_}var npe=tpe();const hn=Un(npe);var o_,bR;function rpe(){if(bR)return o_;bR=1;
vendor: 5,700 bytes, lines 899-907
899var e=nl(),t=aa(),n=rl(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==s}return o_=a,o_}var spe=rpe();const Ad=Un(spe);var ape=BE();const gn=Un(ape);var ipe=yc();const Qm=Un(ipe);var l_={exports:{}},Dn={};/**
900 * @license React
901 * react-is.production.min.js
902 *
903 * Copyright (c) Facebook, Inc. and its affiliates.
904 *
905 * This source code is licensed under the MIT license found in the
906 * LICENSE file in the root directory of this source tree.
907 */var vR;function ope(){if(vR)return Dn;vR=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),j;j=Symbol.for("react.module.reference");function b(y){if(typeof y=="object"&&y!==null){var w=y.$$typeof;switch(w){case e:switch(y=y.type,y){case n:case a:case s:case d:case f:return y;default:switch(y=y&&y.$$typeof,y){case l:case o:case c:case g:case m:case i:return y;default:return w}}case t:return w}}}return Dn.ContextConsumer=o,Dn.ContextProvider=i,Dn.Element=e,Dn.ForwardRef=c,Dn.Fragment=n,Dn.Lazy=g,Dn.Memo=m,Dn.Portal=t,Dn.Profiler=a,Dn.StrictMode=s,Dn.Suspense=d,Dn.SuspenseList=f,Dn.isAsyncMode=function(){return!1},Dn.isConcurrentMode=function(){return!1},Dn.isContextConsumer=function(y){return b(y)===o},Dn.isContextProvider=function(y){return b(y)===i},Dn.isElement=function(y){return typeof y=="object"&&y!==null&&y.$$typeof===e},Dn.isForwardRef=function(y){return b(y)===c},Dn.isFragment=function(y){return b(y)===n},Dn.isLazy=function(y){return b(y)===g},Dn.isMemo=function(y){return b(y)===m},Dn.isPortal=function(y){return b(y)===t},Dn.isProfiler=function(y){return b(y)===a},Dn.isStrictMode=function(y){return b(y)===s},Dn.isSuspense=function(y){return b(y)===d},Dn.isSuspenseList=function(y){return b(y)===f},Dn.isValidElementType=function(y){return typeof y=="string"||typeof y=="function"||y===n||y===a||y===s||y===d||y===f||y===x||typeof y=="object"&&y!==null&&(y.$$typeof===g||y.$$typeof===m||y.$$typeof===i||y.$$typeof===o||y.$$typeof===c||y.$$typeof===j||y.getModuleId!==void 0)},Dn.typeOf=b,Dn}var wR;function lpe(){return wR||(wR=1,l_.exports=ope()),l_.exports}var cpe=lpe(),c_,jR;function hq(){if(jR)return c_;jR=1;var e=nl(),t=rl(),n="[object Number]";function s(a){return typeof a=="number"||t(a)&&e(a)==n}return c_=s,c_}var d_,_R;function dpe(){if(_R)return d_;_R=1;var e=hq();function t(n){return e(n)&&n!=+n}return d_=t,d_}var upe=dpe();const cg=Un(upe);var mpe=hq();const fpe=Un(mpe);var Si=function(t){return t===0?0:t>0?1:-1},sd=function(t){return Ad(t)&&t.indexOf("%")===t.length-1},ht=function(t){return fpe(t)&&!cg(t)},hpe=function(t){return hn(t)},Wr=function(t){return ht(t)||Ad(t)},ppe=0,dg=function(t){var n=++ppe;return"".concat(t||"").concat(n)},Td=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ht(t)&&!Ad(t))return s;var i;if(sd(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return cg(i)&&(i=s),a&&i>n&&(i=n),i},Pu=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},gpe=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,s={},a=0;a<n;a++)if(!s[t[a]])s[t[a]]=!0;else return!0;return!1},_i=function(t,n){return ht(t)&&ht(n)?function(s){return t+s*(n-t)}:function(){return n}};function J0(e,t,n){return!e||!e.length?null:e.find(function(s){return s&&(typeof t=="function"?t(s):Ya(s,t))===n})}var xpe=function(t,n){return ht(t)&&ht(n)?t-n:Ad(t)&&Ad(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function zu(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var s in t)if({}.hasOwnProperty.call(t,s)&&!{}.hasOwnProperty.call(e,s))return!1;return!0}function H2(e){"@babel/helpers - typeof";return H2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H2(e)}var ype=["viewBox","children"],bpe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRen
907dering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],NR=["points","pathLength"],u_={svg:ype,polygon:NR,polyline:NR},VE=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDrag
907Capture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Q0=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(h.isValidElement(t)&&(s=t.props),!Qm(s))return null;var a={};return Object.keys(s).forEach(function(i){VE.includes(i)&&(a[i]=n||function(o){return s[i](s,o)})}),a},vpe=function(t,n,s){return function(a){return t(n,s,a),null}},X0=function(t,n,s){if(!Qm(t)||H2(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var o=t[i];VE.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=vpe(o,n,s))}),a},wpe=["children"],jpe=["children"];function SR(e,t){if(e==null)return{};var n=_pe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function _pe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function W2(e){"@babel/helpers - typeof";return W2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W2(e)}var kR={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Fo=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},CR=null,m_=null,HE=function e(t){if(t===CR&&Array.isArray(m_))return m_;var n=[];return h.Children.forEach(t,function(s){hn(s)||(cpe.isFragment(s)?n=n.concat(e(s.props.children)):n.push(s))}),m_=n,CR=t,n};function Ja(e,t){var n=[],s=[];return Array.isArray(t)?s=t.map(function(a){return Fo(a)}):s=[Fo(t)],HE(e).forEach(function(a){var i=Ya(a,"type.displayName")||Ya(a,"type.name");s.indexOf(i)!==-1&&n.push(a)}),n}function ga(e,t){var n=Ja(e,t);return n&&n[0]}var ER=function(t){if(!t||!t.props)return!1;var n=t.props,s=n.width,a=n.height;return!(!ht(s)||s<=0||!ht(a)||a<=0)},Npe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Spe=function(t){return t&&t.type&&Ad(t.type)&&Npe.indexOf(t.type)>=0},kpe=function(t){return t&&W2(t)==="object"&&"clipDot"in t},Cpe=function(t,n,s,a){var i,o=(i=u_==null?void 0:u_[a])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!gn(t)&&(a&&o.includes(n)||bpe.includes(n))||s&&VE.includes(n)},jn=function(t,n,s){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(h.isValidElement(t)&&(a=t.props),!Qm(a))return null;var i={};
vendor: 4,133 bytes, line 907
907return Object.keys(a).forEach(function(o){var l;Cpe((l=a)===null||l===void 0?void 0:l[o],o,n,s)&&(i[o]=a[o])}),i},G2=function e(t,n){if(t===n)return!0;var s=h.Children.count(t);if(s!==h.Children.count(n))return!1;if(s===0)return!0;if(s===1)return AR(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a<s;a++){var i=t[a],o=n[a];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!AR(i,o))return!1}return!0},AR=function(t,n){if(hn(t)&&hn(n))return!0;if(!hn(t)&&!hn(n)){var s=t.props||{},a=s.children,i=SR(s,wpe),o=n.props||{},l=o.children,c=SR(o,jpe);return a&&l?zu(i,c)&&G2(a,l):!a&&!l?zu(i,c):!1}return!1},TR=function(t,n){var s=[],a={};return HE(t).forEach(function(i,o){if(Spe(i))s.push(i);else if(i){var l=Fo(i.type),c=n[l]||{},d=c.handler,f=c.once;if(d&&(!f||!a[l])){var m=d(i,l,o);s.push(m),a[l]=!0}}}),s},Epe=function(t){var n=t&&t.type;return n&&kR[n]?kR[n]:null},Ape=function(t,n){return HE(n).indexOf(t)},Tpe=["children","width","height","viewBox","className","style","title","desc"];function Y2(){return Y2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Y2.apply(this,arguments)}function Ppe(e,t){if(e==null)return{};var n=Ope(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Ope(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function J2(e){var t=e.children,n=e.width,s=e.height,a=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,d=Ppe(e,Tpe),f=a||{width:n,height:s,x:0,y:0},m=wn("recharts-surface",i);return xe.createElement("svg",Y2({},jn(d,!0,"svg"),{className:m,width:n,height:s,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),xe.createElement("title",null,l),xe.createElement("desc",null,c),t)}var Ipe=["children","className"];function Q2(){return Q2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Q2.apply(this,arguments)}function Rpe(e,t){if(e==null)return{};var n=Mpe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Mpe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var Cr=xe.forwardRef(function(e,t){var n=e.children,s=e.className,a=Rpe(e,Ipe),i=wn("recharts-layer",s);return xe.createElement("g",Q2({className:i},jn(a,!0),{ref:t}),n)}),vd=function(t,n){for(var s=arguments.length,a=new Array(s>2?s-2:0),i=2;i<s;i++)a[i-2]=arguments[i]},f_,PR;function Dpe(){if(PR)return f_;PR=1;function e(t,n,s){var a=-1,i=t.length;n<0&&(n=-n>i?0:i+n),s=s>i?i:s,s<0&&(s+=i),i=n>s?0:s-n>>>0,n>>>=0;for(var o=Array(i);++a<i;)o[a]=t[a+n];return o}return f_=e,f_}var h_,OR;function Lpe(){if(OR)return h_;OR=1;var e=Dpe();function t(n,s,a){var i=n.length;return a=a===void 0?i:a,!s&&a>=i?n:e(n,s,a)}return h_=t,h_}var p_,IR;function pq(){if(IR)return p_;IR=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",o="\\u200d",l=RegExp("["+o+e+a+i+"]");function c(d){return l.test(d)}return p_=c,p_}var g_,RR;function $pe(){if(RR)return g_;RR=1;function e(t){return t.split("")}return g_=e,g_}var x_,MR;function Bpe(){if(MR)return x_;MR=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",s="\\u20d0-\\u20ff",a=t+n+s,i="\\ufe0e\\ufe0f",o="["+e+"]",l="["+a+"]",c="\\ud83c[\\udffb-\\udfff]",d="(?:"+l+"|"+c+")",f="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",x="\\u200d",j=d+"?",b="["+i+"]?",y="(?:"+x+"(?:"+[f,m,g].join("|")+")"+b+j+")*",w=b+j+y,_="(?:"+[f+l+"?",l,m,g,o
vendor: 6,100 bytes, line 907
907].join("|")+")",N=RegExp(c+"(?="+c+")|"+_+w,"g");function C(k){return k.match(N)||[]}return x_=C,x_}var y_,DR;function Fpe(){if(DR)return y_;DR=1;var e=$pe(),t=pq(),n=Bpe();function s(a){return t(a)?n(a):e(a)}return y_=s,y_}var b_,LR;function zpe(){if(LR)return b_;LR=1;var e=Lpe(),t=pq(),n=Fpe(),s=uq();function a(i){return function(o){o=s(o);var l=t(o)?n(o):void 0,c=l?l[0]:o.charAt(0),d=l?e(l,1).join(""):o.slice(1);return c[i]()+d}}return b_=a,b_}var v_,$R;function Upe(){if($R)return v_;$R=1;var e=zpe(),t=e("toUpperCase");return v_=t,v_}var qpe=Upe();const Gb=Un(qpe);function tr(e){return function(){return e}}const gq=Math.cos,Z0=Math.sin,Oi=Math.sqrt,ey=Math.PI,Yb=2*ey,X2=Math.PI,Z2=2*X2,Yc=1e-6,Kpe=Z2-Yc;function xq(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Vpe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return xq;const n=10**t;return function(s){this._+=s[0];for(let a=1,i=s.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+s[a]}}class Hpe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?xq:Vpe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,s,a){this._append`Q${+t},${+n},${this._x1=+s},${this._y1=+a}`}bezierCurveTo(t,n,s,a,i,o){this._append`C${+t},${+n},${+s},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,s,a,i){if(t=+t,n=+n,s=+s,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=s-t,d=a-n,f=o-t,m=l-n,g=f*f+m*m;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(g>Yc)if(!(Math.abs(m*c-d*f)>Yc)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let x=s-o,j=a-l,b=c*c+d*d,y=x*x+j*j,w=Math.sqrt(b),_=Math.sqrt(g),N=i*Math.tan((X2-Math.acos((b+g-y)/(2*w*_)))/2),C=N/_,k=N/w;Math.abs(C-1)>Yc&&this._append`L${t+C*f},${n+C*m}`,this._append`A${i},${i},0,0,${+(m*x>f*j)},${this._x1=t+k*c},${this._y1=n+k*d}`}}arc(t,n,s,a,i,o){if(t=+t,n=+n,s=+s,o=!!o,s<0)throw new Error(`negative radius: ${s}`);let l=s*Math.cos(a),c=s*Math.sin(a),d=t+l,f=n+c,m=1^o,g=o?a-i:i-a;this._x1===null?this._append`M${d},${f}`:(Math.abs(this._x1-d)>Yc||Math.abs(this._y1-f)>Yc)&&this._append`L${d},${f}`,s&&(g<0&&(g=g%Z2+Z2),g>Kpe?this._append`A${s},${s},0,1,${m},${t-l},${n-c}A${s},${s},0,1,${m},${this._x1=d},${this._y1=f}`:g>Yc&&this._append`A${s},${s},0,${+(g>=X2)},${m},${this._x1=t+s*Math.cos(i)},${this._y1=n+s*Math.sin(i)}`)}rect(t,n,s,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${s=+s}v${+a}h${-s}Z`}toString(){return this._}}function WE(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const s=Math.floor(n);if(!(s>=0))throw new RangeError(`invalid digits: ${n}`);t=s}return e},()=>new Hpe(t)}function GE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yq(e){this._context=e}yq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Jb(e){return new yq(e)}function bq(e){return e[0]}function vq(e){return e[1]}function wq(e,t){var n=tr(!0),s=null,a=Jb,i=null,o=WE(l);e=typeof e=="function"?e:e===void 0?bq:tr(e),t=typeof t=="function"?t:t===void 0?vq:tr(t);function l(c){var d,f=(c=GE(c)).length,m,g=!1,x;for(s==null&&(i=a(x=o())),d=0;d<=f;++d)!(d<f&&n(m=c[d],d,c))===g&&((g=!g)?i.lineStart():i.lineEnd()),g&&i.point(+e(m,d,c),+t(m,d,c));if(x)return i=null,x+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:tr(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:tr(+c),l):t},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:tr(!!c),l):n},l.curve=function(c){return arguments.length?(a=c,s!=null&&(i=a(s)),l):a},l.context=function(c){return arguments.length?(c==null?s=i=null:i=a(s=c),l):s},l}function $x(e,t,n){var s=null,a=tr(!0),i=null,o=Jb,l=null,c=WE(d);e=typeof e=="function"?e:e===void 0?bq:tr(+e),t=typeof t=="function"?t:tr(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?vq:tr(+n);function d(m){var g,x,j,b=(m=GE(m)).length,y,w=!1,_,N=new Array(b),C=new Array(b);for(i==null&&(l=o(_=c())),g=0;g<=b;++g){if(!(g<b&&a(y=m[g],g,m))===w)if(w=!w)x=g,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),j=g-1;j>=x;--j)l.point(N[j],C[j]);l.lineEnd(),l.areaEnd()}w&&(N[g]=+e(y,g,m),C[g]=+t(y,g,m),l.point(s?+s(y,g,m):N[g],n?+n(y,g,m):C[g]))}if(_)return l=null,_+""||null}function f(){return wq().defined(a).curve(o).context(i)}return d.x=function(m){return arguments.length?(e=typeof m=="function"?m:tr(+m),s=null,d):e},d.x0=function(m){return arguments.length?(e=typeof m=="function"?m:tr(+m),d):e},d.x1=function(m){return arguments.length?(s=m==null?null:typeof m=="function"?m:tr(+m),d):s},d.y=function(m){return arguments.length?(t=typeof m=="function"?m:tr(+m),n=null,d):t},d.y0=function(m){return arguments.length?(t=typeof m=="function"?m:tr(+m),d):t},d.y1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:tr(+m),d):n},d.lineX0=d.lineY0=function(){return f().x(e).y(t)},d.lineY1=function(){return f().x(e).y(n)},d.lineX1=function(){return f().x(s).y(t)},d.defined=function(m){return arguments.length?(a=typeof m=="function"?m:tr(!!m),d):a},d.curve=function(m){return arguments.length?(o=m,i!=null&&(l=o(i)),d):o},d.context=function(m){return arguments.length?(m==null?i=l=null:l=o(i=m),d):i},d}class jq{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}
907point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function Wpe(e){return new jq(e,!0)}function Gpe(e){return new jq(e,!1)}const YE={draw(e,t){const n=Oi(t/ey);e.moveTo(n,0),e.arc(0,0,n,0,Yb)}},Ype={draw(e,t){const n=Oi(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},_q=Oi(1/3),Jpe=_q*2,Qpe={draw(e,t){const n=Oi(t/Jpe),s=n*_q;e.moveTo(0,-n),e.lineTo(s,0),e.lineTo(0,n),e.lineTo(-s,0),e.closePath()}},Xpe={draw(e,t){const n=Oi(t),s=-n/2;e.rect(s,s,n,n)}},Zpe=.8908130915292852,Nq=Z0(ey/10)/Z0(7*ey/10),ege=Z0(Yb/10)*Nq,tge=-gq(Yb/10)*Nq,nge={draw(e,t){const n=Oi(t*Zpe),s=ege*n,a=tge*n;e.moveTo(0,-n),e.lineTo(s,a);for(let i=1;i<5;++i){const o=Yb*i/5,l=gq(o),c=Z0(o);e.lineTo(c*n,-l*n),e.lineTo(l*s-c*a,c*s+l*a)}e.closePath()}},w_=Oi(3),rge={draw(e,t){const n=-Oi(t/(w_*3));e.moveTo(0,n*2),e.lineTo(-w_*n,-n),e.lineTo(w_*n,-n),e.closePath()}},$a=-.5,Ba=Oi(3)/2,eC=1/Oi(12),sge=(eC/2+1)*3,age={draw(e,t){const n=Oi(t/sge),s=n/2,a=n*eC,i=s,o=n*eC+n,l=-i,c=o;e.moveTo(s,a),e.lineTo(i,o),e.lineTo(l,c),e.lineTo($a*s-Ba*a,Ba*s+$a*a),e.lineTo($a*i-Ba*o,Ba*i+$a*o),e.lineTo($a*l-Ba*c,Ba*l+$a*c),e.lineTo($a*s+Ba*a,$a*a-Ba*s),e.lineTo($a*i+Ba*o,$a*o-Ba*i),e.lineTo($a*l+Ba*c,$a*c-Ba*l),e.closePath()}};function ige(e,t){let n=null,s=WE(a);e=typeof e=="function"?e:tr(e||YE),t=typeof t=="function"?t:tr(t===void 0?64:+t);function a(){let i;if(n||(n=i=s()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:tr(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:tr(+i),a):t},a.context=function(i){return arguments.length?(n=i??null,a):n},a}function ty(){}function ny(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Sq(e){this._context=e}Sq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ny(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ny(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oge(e){return new Sq(e)}function kq(e){this._context=e}kq.prototype={areaStart:ty,areaEnd:ty,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:ny(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function lge(e){return new kq(e)}function Cq(e){this._context=e}Cq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,s=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:ny(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function cge(e){return new Cq(e)}function Eq(e){this._context=e}Eq.prototype={areaStart:ty,areaEnd:ty,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function dge(e){return new Eq(e)}function BR(e){return e<0?-1:1}
907function FR(e,t,n){var s=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(s||a<0&&-0),o=(n-e._y1)/(a||s<0&&-0),l=(i*a+o*s)/(s+a);return(BR(i)+BR(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function zR(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function j_(e,t,n){var s=e._x0,a=e._y0,i=e._x1,o=e._y1,l=(i-s)/3;e._context.bezierCurveTo(s+l,a+l*t,i-l,o-l*n,i,o)}function ry(e){this._context=e}ry.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:j_(this,this._t0,zR(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,j_(this,zR(this,n=FR(this,e,t)),n);break;default:j_(this,this._t0,n=FR(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Aq(e){this._context=new Tq(e)}(Aq.prototype=Object.create(ry.prototype)).point=function(e,t){ry.prototype.point.call(this,t,e)};function Tq(e){this._context=e}Tq.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,s,a,i){this._context.bezierCurveTo(t,e,s,n,i,a)}};function uge(e){return new ry(e)}function mge(e){return new Aq(e)}function Pq(e){this._context=e}Pq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var s=UR(e),a=UR(t),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(s[0][i],a[0][i],s[1][i],a[1][i],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function UR(e){var t,n=e.length-1,s,a=new Array(n),i=new Array(n),o=new Array(n);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[n-1]=2,i[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)s=a[t]/i[t-1],i[t]-=s,o[t]-=s*o[t-1];for(a[n-1]=o[n-1]/i[n-1],t=n-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[n-1]=(e[n]+a[n-1])/2,t=0;t<n-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function fge(e){return new Pq(e)}function Qb(e,t){this._context=e,this._t=t}Qb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function hge(e){return new Qb(e,.5)}function pge(e){return new Qb(e,0)}function gge(e){return new Qb(e,1)}function lm(e,t){if((o=e.length)>1)for(var n=1,s,a,i=e[t[0]],o,l=i.length;n<o;++n)for(a=i,i=e[t[n]],s=0;s<l;++s)i[s][1]+=i[s][0]=isNaN(a[s][1])?a[s][0]:a[s][1]}function tC(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function xge(e,t){return e[t]}function yge(e){const t=[];return t.key=e,t}function bge(){var e=tr([]),t=tC,n=lm,s=xge;function a(i){var o=Array.from(e.apply(this,arguments),yge),l,c=o.length,d=-1,f;for(const m of i)for(l=0,++d;l<c;++l)(o[l][d]=[0,+s(m,o[l].key,d,i)]).data=m;for(l=0,f=GE(t(o));l<c;++l)o[f[l]].index=l;return n(o,f),o}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:tr(Array.from(i)),a):e},a.value=function(i){return arguments.length?(s=typeof i=="function"?i:tr(+i),a):s},a.order=function(i){return arguments.length?(t=i==null?tC:typeof i=="function"?i:tr(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(n=i??lm,a):n},a}function vge(e,t){if((s=e.length)>0){for(var n,s,a=0,i=e[0].length,o;a<i;++a){for(o=n=0;n<s;++n)o+=e[n][a][1]||0;if(o)for(n=0;n<s;++n)e[n][a][1]/=o}lm(e,t)}}function wge(e,t){if((a=e.length)>0){for(var n=0,s=e[t[0]],a,i=s.length;n<i;++n){for(var o=0,l=0;o<a;++o)l+=e[o][n][1]||0;s[n][1]+=s[n][0]=-l/2}lm(e,t)}}function jge(e,t){if(!(!((o=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var n=0,s=1,a,i,o;s<i;++s){for(var l=0,c=0,d=0;l<o;++l){for(var f=e[t[l]],m=f[s][1]||0,g=f[s-1][1]||0,x=(m-g)/2,j=0;j<l;++j){var b=e[t[j]],y=b[s][1]||0,w=b[s-1][1]||0;x+=y-w}c+=m,d+=x*m}a[s-1][1]+=a[s-1][0]=n,c&&(n-=d/c)}a[s-1][1]+=a[s-1][0]=n,lm(e,t)}}function Vh(e){"@babel/helpers - typeof";return Vh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vh(e)}var _ge=["type","size","sizeType"];function nC(){return nC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},nC.apply(this,arguments)}function qR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function KR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
vendor: 14,451 bytes, lines 907-910
907t%2?qR(Object(n),!0).forEach(function(s){Nge(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qR(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Nge(e,t,n){return t=Sge(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sge(e){var t=kge(e,"string");return Vh(t)=="symbol"?t:t+""}function kge(e,t){if(Vh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Vh(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Cge(e,t){if(e==null)return{};var n=Ege(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Ege(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var Oq={symbolCircle:YE,symbolCross:Ype,symbolDiamond:Qpe,symbolSquare:Xpe,symbolStar:nge,symbolTriangle:rge,symbolWye:age},Age=Math.PI/180,Tge=function(t){var n="symbol".concat(Gb(t));return Oq[n]||YE},Pge=function(t,n,s){if(n==="area")return t;switch(s){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*Age;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Oge=function(t,n){Oq["symbol".concat(Gb(t))]=n},JE=function(t){var n=t.type,s=n===void 0?"circle":n,a=t.size,i=a===void 0?64:a,o=t.sizeType,l=o===void 0?"area":o,c=Cge(t,_ge),d=KR(KR({},c),{},{type:s,size:i,sizeType:l}),f=function(){var y=Tge(s),w=ige().type(y).size(Pge(i,l,s));return w()},m=d.className,g=d.cx,x=d.cy,j=jn(d,!0);return g===+g&&x===+x&&i===+i?xe.createElement("path",nC({},j,{className:wn("recharts-symbols",m),transform:"translate(".concat(g,", ").concat(x,")"),d:f()})):null};JE.registerSymbol=Oge;function cm(e){"@babel/helpers - typeof";return cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cm(e)}function rC(){return rC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},rC.apply(this,arguments)}function VR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Ige(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VR(Object(n),!0).forEach(function(s){Hh(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VR(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Rge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mge(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Rq(s.key),s)}}function Dge(e,t,n){return t&&Mge(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lge(e,t,n){return t=sy(t),$ge(e,Iq()?Reflect.construct(t,n||[],sy(e).constructor):t.apply(e,n))}function $ge(e,t){if(t&&(cm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bge(e)}function Bge(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Iq(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Iq=function(){return!!e})()}function sy(e){return sy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},sy(e)}function Fge(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&sC(e,t)}function sC(e,t){return sC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},sC(e,t)}function Hh(e,t,n){return t=Rq(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rq(e){var t=zge(e,"string");return cm(t)=="symbol"?t:t+""}function zge(e,t){if(cm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(cm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Fa=32,QE=(function(e){function t(){return Rge(this,t),Lge(this,t,arguments)}return Fge(t,e),Dge(t,[{key:"renderIcon",value:function(s){var a=this.props.inactiveColor,i=Fa/2,o=Fa/6,l=Fa/3,c=s.inactive?a:s.color;if(s.type==="plainline")return xe.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:s.payload.strokeDasharray,x1:0,y1:i,x2:Fa,y2:i,className:"recharts-legend-icon"});if(s.type==="line")return xe.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
908            A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
909            H`).concat(Fa,"M").concat(2*l,",").concat(i,`
910            A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(s.type==="rect")return xe.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Fa/8,"h").concat(Fa,"v").concat(Fa*3/4,"h").concat(-Fa,"z"),className:"recharts-legend-icon"});if(xe.isValidElement(s.legendIcon)){var d=Ige({},s);return delete d.legendIcon,xe.cloneElement(s.legendIcon,d)}return xe.createElement(JE,{fill:c,cx:i,cy:i,size:Fa,sizeType:"diameter",type:s.type})}},{key:"renderItems",value:function(){var s=this,a=this.props,i=a.payload,o=a.iconSize,l=a.layout,c=a.formatter,d=a.inactiveColor,f={x:0,y:0,width:Fa,height:Fa},m={display:l==="horizontal"?"inline-block":"block",marginRight:10},g={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(x,j){var b=x.formatter||c,y=wn(Hh(Hh({"recharts-legend-item":!0},"legend-item-".concat(j),!0),"inactive",x.inactive));if(x.type==="none")return null;var w=gn(x.value)?null:x.value;vd(!gn(x.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var _=x.inactive?d:x.color;return xe.createElement("li",rC({className:y,style:m,key:"legend-item-".concat(j)},X0(s.props,x,j)),xe.createElement(J2,{width:o,height:o,viewBox:f,style:g},s.renderIcon(x)),xe.createElement("span",{className:"recharts-legend-item-text",style:{color:_}},b?b(w,x,j):w))})}},{key:"render",value:function(){var s=this.props,a=s.payload,i=s.layout,o=s.align;if(!a||!a.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return xe.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])})(h.PureComponent);Hh(QE,"displayName","Legend");Hh(QE,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var __,HR;function Uge(){if(HR)return __;HR=1;var e=Vb();function t(){this.__data__=new e,this.size=0}return __=t,__}var N_,WR;function qge(){if(WR)return N_;WR=1;function e(t){var n=this.__data__,s=n.delete(t);return this.size=n.size,s}return N_=e,N_}var S_,GR;function Kge(){if(GR)return S_;GR=1;function e(t){return this.__data__.get(t)}return S_=e,S_}var k_,YR;function Vge(){if(YR)return k_;YR=1;function e(t){return this.__data__.has(t)}return k_=e,k_}var C_,JR;function Hge(){if(JR)return C_;JR=1;var e=Vb(),t=zE(),n=UE(),s=200;function a(i,o){var l=this.__data__;if(l instanceof e){var c=l.__data__;if(!t||c.length<s-1)return c.push([i,o]),this.size=++l.size,this;l=this.__data__=new n(c)}return l.set(i,o),this.size=l.size,this}return C_=a,C_}var E_,QR;function Mq(){if(QR)return E_;QR=1;var e=Vb(),t=Uge(),n=qge(),s=Kge(),a=Vge(),i=Hge();function o(l){var c=this.__data__=new e(l);this.size=c.size}return o.prototype.clear=t,o.prototype.delete=n,o.prototype.get=s,o.prototype.has=a,o.prototype.set=i,E_=o,E_}var A_,XR;function Wge(){if(XR)return A_;XR=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return A_=t,A_}var T_,ZR;function Gge(){if(ZR)return T_;ZR=1;function e(t){return this.__data__.has(t)}return T_=e,T_}var P_,eM;function Dq(){if(eM)return P_;eM=1;var e=UE(),t=Wge(),n=Gge();function s(a){var i=-1,o=a==null?0:a.length;for(this.__data__=new e;++i<o;)this.add(a[i])}return s.prototype.add=s.prototype.push=t,s.prototype.has=n,P_=s,P_}var O_,tM;function Lq(){if(tM)return O_;tM=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a;)if(n(t[s],s,t))return!0;return!1}return O_=e,O_}var I_,nM;function $q(){if(nM)return I_;nM=1;function e(t,n){return t.has(n)}return I_=e,I_}var R_,rM;function Bq(){if(rM)return R_;rM=1;var e=Dq(),t=Lq(),n=$q(),s=1,a=2;function i(o,l,c,d,f,m){var g=c&s,x=o.length,j=l.length;if(x!=j&&!(g&&j>x))return!1;var b=m.get(o),y=m.get(l);if(b&&y)return b==l&&y==o;var w=-1,_=!0,N=c&a?new e:void 0;for(m.set(o,l),m.set(l,o);++w<x;){var C=o[w],k=l[w];if(d)var S=g?d(k,C,w,l,o,m):d(C,k,w,o,l,m);if(S!==void 0){if(S)continue;_=!1;break}if(N){if(!t(l,function(A,T){if(!n(N,T)&&(C===A||f(C,A,c,d,m)))return N.push(T)})){_=!1;break}}else if(!(C===k||f(C,k,c,d,m))){_=!1;break}}return m.delete(o),m.delete(l),_}return R_=i,R_}var M_,sM;function Yge(){if(sM)return M_;sM=1;var e=fo(),t=e.Uint8Array;return M_=t,M_}var D_,aM;function Jge(){if(aM)return D_;aM=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a,i){s[++n]=[i,a]}),s}return D_=e,D_}var L_,iM;function XE(){if(iM)return L_;iM=1;function e(t){var n=-1,s=Array(t.size);return t.forEach(function(a){s[++n]=a}),s}return L_=e,L_}var $_,oM;function Qge(){if(oM)return $_;oM=1;var e=lg(),t=Yge(),n=FE(),s=Bq(),a=Jge(),i=XE(),o=1,l=2,c="[object Boolean]",d="[object Date]",f="[object Error]",m="[object Map]",g="[object Number]",x="[object RegExp]",j="[object Set]",b="[object String]",y="[object Symbol]",w="[object ArrayBuffer]",_="[object DataView]",N=e?e.prototype:void 0,C=N?N.valueOf:void 0;function k(S,A,T,R,B,D,P){switch(T){case _:if(S.byteLength!=A.byteLength||S.byteOffset!=A.byteOffset)return!1;S=S.buffer,A=A.buffer;case w:return!(S.byteLength!=A.byteLength||!D(new t(S),new t(A)));case c:case d:case g:return n(+S,+A);case f:return S.name==A.name&&S.message==A.message;case x:case b:return S==A+"";case m:var I=a;case j:var z=R&o;if(I||(I=i),S.size!=A.size&&!z)return!1;var L=P.get(S);if(L)return L==A;R|=l,P.set(S,A);var H=s(I(S),I(A),R,B,D,P);return P.delete(S),H;case y:if(C)return C.call(S)==C.call(A)}return!1}return $_=k,$_}var B_,lM;function Fq(){if(lM)return B_;lM=1;function e(t,n){for(var s=-1,a=n.length,i=t.length;++s<a;)t[i+s]=n[s];return t}return B_=e,B_}var F_,cM;function Xge(){if(cM)return F_;cM=1;var e=Fq(),t=aa();function n(s,a,i){var o=a(s);return t(s)?o:e(o,i(s))}return F_=n,F_}var z_,dM;function Zge(){if(dM)return z_;dM=1;function e(t,n){for(var s=-1,a=t==null?0:t.length,i=0,o=[];++s<a;){var l=t[s];n(l,s,t)&&(o[i++]=l)}return o}return z_=e,z_}var U_,uM;function exe(){if(uM)return U_;uM=1;function e(){return[]}return U_=e,U_}var q_,mM;function txe(){if(mM)return q_;mM=1;var e=Zge(),t=exe(),n=Object.prototype,s=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(o){return o==null?[]:(o=Object(o),e(a(o),function(l){return s.call(o,l)}))}:t;return q_=i,q_}var K_,fM;function nxe(){if(fM)return K_;fM=1;function e(t,n){for(var s=-1,a=Array(t);++s<t;)a[s]=n(s);return a}return K_=e,K_}var V_,hM;function rxe(){if(hM)return V_;hM=1;var e=nl(),t=rl(),n="[object Arguments]";function s(a){return t(a)&&e(a)==n}return V_=s,V_}var H_,pM;function ZE(){if(pM)return H_;pM=1;var e=rxe(),t=rl(),n=Object.prototype,s=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e((function(){return arguments})())?e:function(o){return t(o)&&s.call(o,"callee")&&!a.call(o,"callee")};return H_=i,H_}var ph={exports:{}},W_,gM;function sxe(){if(gM)return W_;gM=1;function e(){return!1}return W_=e,W_}ph.exports;var xM;function zq(){return xM||(xM=1,(function(e,t){var n=fo(),s=sxe(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o?n.Buffer:void 0,c=l?l.isBuffer:void 0,d=c||s;e.exports=d})(ph,ph.exports)),ph.exports}var G_,yM;function eA(){if(yM)return G_;yM=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(s,a){var i=typeof s;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(s))&&s>-1&&s%1==0&&s<a}return G_=n,G_}var Y_,bM;function tA(){if(bM)return Y_;bM=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Y_=t,Y_}var J_,vM;function axe(){if(vM)return J_;vM=1;var e=nl(),t=tA(),n=rl(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",o="[object Date]",l="[object Error]",c="[object Function]",d="[object Map]",f="[object Number]",m="[object Object]",g="[object RegExp]",x="[object Set]",j="[object String]",b="[object WeakMap]",y="[object ArrayBuffer]",w="[object DataView]",_="[object Float32Array]",N="[object Float64Array]",C="[object Int8Array]",k="[object Int16Array]",S="[object Int32Array]",A="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",B="[object Uint32Array]",D={};D[_]=D[N]=D[C]=D[k]=D[S]=D[A]=D[T]=D[R]=D[B]=!0,D[s]=D[a]=D[y]=D[i]=D[w]=D[o]=D[l]=D[c]=D[d]=D[f]=D[m]=D[g]=D[x]=D[j]=D[b]=!1;function P(I){return n(I)&&t(I.length)&&!!D[e(I)]}return J_=P,J_}var Q_,wM;function Uq(){if(wM)return Q_;wM=1;function e(t){return function(n){return t(n)}}return Q_=e,Q_}var gh={exports:{}};gh.exports;var jM;function ixe(){return jM||(jM=1,(function(e,t){var n=lq(),s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,o=i&&n.process,l=(function(){try{var c=a&&a.require&&a.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=l}
vendor: 3,728 bytes, line 910
910)(gh,gh.exports)),gh.exports}var X_,_M;function qq(){if(_M)return X_;_M=1;var e=axe(),t=Uq(),n=ixe(),s=n&&n.isTypedArray,a=s?t(s):e;return X_=a,X_}var Z_,NM;function oxe(){if(NM)return Z_;NM=1;var e=nxe(),t=ZE(),n=aa(),s=zq(),a=eA(),i=qq(),o=Object.prototype,l=o.hasOwnProperty;function c(d,f){var m=n(d),g=!m&&t(d),x=!m&&!g&&s(d),j=!m&&!g&&!x&&i(d),b=m||g||x||j,y=b?e(d.length,String):[],w=y.length;for(var _ in d)(f||l.call(d,_))&&!(b&&(_=="length"||x&&(_=="offset"||_=="parent")||j&&(_=="buffer"||_=="byteLength"||_=="byteOffset")||a(_,w)))&&y.push(_);return y}return Z_=c,Z_}var eN,SM;function lxe(){if(SM)return eN;SM=1;var e=Object.prototype;function t(n){var s=n&&n.constructor,a=typeof s=="function"&&s.prototype||e;return n===a}return eN=t,eN}var tN,kM;function Kq(){if(kM)return tN;kM=1;function e(t,n){return function(s){return t(n(s))}}return tN=e,tN}var nN,CM;function cxe(){if(CM)return nN;CM=1;var e=Kq(),t=e(Object.keys,Object);return nN=t,nN}var rN,EM;function dxe(){if(EM)return rN;EM=1;var e=lxe(),t=cxe(),n=Object.prototype,s=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var o=[];for(var l in Object(i))s.call(i,l)&&l!="constructor"&&o.push(l);return o}return rN=a,rN}var sN,AM;function ug(){if(AM)return sN;AM=1;var e=BE(),t=tA();function n(s){return s!=null&&t(s.length)&&!e(s)}return sN=n,sN}var aN,TM;function Xb(){if(TM)return aN;TM=1;var e=oxe(),t=dxe(),n=ug();function s(a){return n(a)?e(a):t(a)}return aN=s,aN}var iN,PM;function uxe(){if(PM)return iN;PM=1;var e=Xge(),t=txe(),n=Xb();function s(a){return e(a,n,t)}return iN=s,iN}var oN,OM;function mxe(){if(OM)return oN;OM=1;var e=uxe(),t=1,n=Object.prototype,s=n.hasOwnProperty;function a(i,o,l,c,d,f){var m=l&t,g=e(i),x=g.length,j=e(o),b=j.length;if(x!=b&&!m)return!1;for(var y=x;y--;){var w=g[y];if(!(m?w in o:s.call(o,w)))return!1}var _=f.get(i),N=f.get(o);if(_&&N)return _==o&&N==i;var C=!0;f.set(i,o),f.set(o,i);for(var k=m;++y<x;){w=g[y];var S=i[w],A=o[w];if(c)var T=m?c(A,S,w,o,i,f):c(S,A,w,i,o,f);if(!(T===void 0?S===A||d(S,A,l,c,f):T)){C=!1;break}k||(k=w=="constructor")}if(C&&!k){var R=i.constructor,B=o.constructor;R!=B&&"constructor"in i&&"constructor"in o&&!(typeof R=="function"&&R instanceof R&&typeof B=="function"&&B instanceof B)&&(C=!1)}return f.delete(i),f.delete(o),C}return oN=a,oN}var lN,IM;function fxe(){if(IM)return lN;IM=1;var e=Kd(),t=fo(),n=e(t,"DataView");return lN=n,lN}var cN,RM;function hxe(){if(RM)return cN;RM=1;var e=Kd(),t=fo(),n=e(t,"Promise");return cN=n,cN}var dN,MM;function Vq(){if(MM)return dN;MM=1;var e=Kd(),t=fo(),n=e(t,"Set");return dN=n,dN}var uN,DM;function pxe(){if(DM)return uN;DM=1;var e=Kd(),t=fo(),n=e(t,"WeakMap");return uN=n,uN}var mN,LM;function gxe(){if(LM)return mN;LM=1;var e=fxe(),t=zE(),n=hxe(),s=Vq(),a=pxe(),i=nl(),o=cq(),l="[object Map]",c="[object Object]",d="[object Promise]",f="[object Set]",m="[object WeakMap]",g="[object DataView]",x=o(e),j=o(t),b=o(n),y=o(s),w=o(a),_=i;return(e&&_(new e(new ArrayBuffer(1)))!=g||t&&_(new t)!=l||n&&_(n.resolve())!=d||s&&_(new s)!=f||a&&_(new a)!=m)&&(_=function(N){var C=i(N),k=C==c?N.constructor:void 0,S=k?o(k):"";if(S)switch(S){case x:return g;case j:return l;case b:return d;case y:return f;case w:return m}return C}),mN=_,mN}var fN,$M;function xxe(){if($M)return fN;$M=1;var e=Mq(),t=Bq(),n=Qge(),s=mxe(),a=gxe(),i=aa(),o=zq(),l=qq(),c=1,d="[object Arguments]",f="[object Array]",m="[object Object]",g=Object.prototype,x=g.hasOwnProperty;function j(b,y,w,_,N,C){var k=i(b),S=i(y),A=k?f:a(b),T=S?f:a(y);A=A==d?m:A,T=T==d?m:T;var R=A==m,B=T==m,D=A==T;if(D&&o(b)){if(!o(y))return!1;k=!0,R=!1}if(D&&!R)return C||(C=new e),k||l(b)?t(b,y,w,_,N,C):n(b,y,A,w,_,N,C);if(!(w&c)){var P=R&&x.call(b,"__wrapped__"),I=B&&x.call(y,"__wrapped__");
vendor: 47,918 bytes, lines 910-918
910if(P||I){var z=P?b.value():b,L=I?y.value():y;return C||(C=new e),N(z,L,w,_,C)}}return D?(C||(C=new e),s(b,y,w,_,N,C)):!1}return fN=j,fN}var hN,BM;function nA(){if(BM)return hN;BM=1;var e=xxe(),t=rl();function n(s,a,i,o,l){return s===a?!0:s==null||a==null||!t(s)&&!t(a)?s!==s&&a!==a:e(s,a,i,o,n,l)}return hN=n,hN}var pN,FM;function yxe(){if(FM)return pN;FM=1;var e=Mq(),t=nA(),n=1,s=2;function a(i,o,l,c){var d=l.length,f=d,m=!c;if(i==null)return!f;for(i=Object(i);d--;){var g=l[d];if(m&&g[2]?g[1]!==i[g[0]]:!(g[0]in i))return!1}for(;++d<f;){g=l[d];var x=g[0],j=i[x],b=g[1];if(m&&g[2]){if(j===void 0&&!(x in i))return!1}else{var y=new e;if(c)var w=c(j,b,x,i,o,y);if(!(w===void 0?t(b,j,n|s,c,y):w))return!1}}return!0}return pN=a,pN}var gN,zM;function Hq(){if(zM)return gN;zM=1;var e=yc();function t(n){return n===n&&!e(n)}return gN=t,gN}var xN,UM;function bxe(){if(UM)return xN;UM=1;var e=Hq(),t=Xb();function n(s){for(var a=t(s),i=a.length;i--;){var o=a[i],l=s[o];a[i]=[o,l,e(l)]}return a}return xN=n,xN}var yN,qM;function Wq(){if(qM)return yN;qM=1;function e(t,n){return function(s){return s==null?!1:s[t]===n&&(n!==void 0||t in Object(s))}}return yN=e,yN}var bN,KM;function vxe(){if(KM)return bN;KM=1;var e=yxe(),t=bxe(),n=Wq();function s(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(o){return o===a||e(o,a,i)}}return bN=s,bN}var vN,VM;function wxe(){if(VM)return vN;VM=1;function e(t,n){return t!=null&&n in Object(t)}return vN=e,vN}var wN,HM;function jxe(){if(HM)return wN;HM=1;var e=mq(),t=ZE(),n=aa(),s=eA(),a=tA(),i=Wb();function o(l,c,d){c=e(c,l);for(var f=-1,m=c.length,g=!1;++f<m;){var x=i(c[f]);if(!(g=l!=null&&d(l,x)))break;l=l[x]}return g||++f!=m?g:(m=l==null?0:l.length,!!m&&a(m)&&s(x,m)&&(n(l)||t(l)))}return wN=o,wN}var jN,WM;function _xe(){if(WM)return jN;WM=1;var e=wxe(),t=jxe();function n(s,a){return s!=null&&t(s,a,e)}return jN=n,jN}var _N,GM;function Nxe(){if(GM)return _N;GM=1;var e=nA(),t=fq(),n=_xe(),s=$E(),a=Hq(),i=Wq(),o=Wb(),l=1,c=2;function d(f,m){return s(f)&&a(m)?i(o(f),m):function(g){var x=t(g,f);return x===void 0&&x===m?n(g,f):e(m,x,l|c)}}return _N=d,_N}var NN,YM;function Xm(){if(YM)return NN;YM=1;function e(t){return t}return NN=e,NN}var SN,JM;function Sxe(){if(JM)return SN;JM=1;function e(t){return function(n){return n==null?void 0:n[t]}}return SN=e,SN}var kN,QM;function kxe(){if(QM)return kN;QM=1;var e=KE();function t(n){return function(s){return e(s,n)}}return kN=t,kN}var CN,XM;function Cxe(){if(XM)return CN;XM=1;var e=Sxe(),t=kxe(),n=$E(),s=Wb();function a(i){return n(i)?e(s(i)):t(i)}return CN=a,CN}var EN,ZM;function bc(){if(ZM)return EN;ZM=1;var e=vxe(),t=Nxe(),n=Xm(),s=aa(),a=Cxe();function i(o){return typeof o=="function"?o:o==null?n:typeof o=="object"?s(o)?t(o[0],o[1]):e(o):a(o)}return EN=i,EN}var AN,eD;function Gq(){if(eD)return AN;eD=1;function e(t,n,s,a){for(var i=t.length,o=s+(a?1:-1);a?o--:++o<i;)if(n(t[o],o,t))return o;return-1}return AN=e,AN}var TN,tD;function Exe(){if(tD)return TN;tD=1;function e(t){return t!==t}return TN=e,TN}var PN,nD;function Axe(){if(nD)return PN;nD=1;function e(t,n,s){for(var a=s-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return PN=e,PN}var ON,rD;function Txe(){if(rD)return ON;rD=1;var e=Gq(),t=Exe(),n=Axe();function s(a,i,o){return i===i?n(a,i,o):e(a,t,o)}return ON=s,ON}var IN,sD;function Pxe(){if(sD)return IN;sD=1;var e=Txe();function t(n,s){var a=n==null?0:n.length;return!!a&&e(n,s,0)>-1}return IN=t,IN}var RN,aD;function Oxe(){if(aD)return RN;aD=1;function e(t,n,s){for(var a=-1,i=t==null?0:t.length;++a<i;)if(s(n,t[a]))return!0;return!1}return RN=e,RN}var MN,iD;function Ixe(){if(iD)return MN;iD=1;function e(){}return MN=e,MN}var DN,oD;function Rxe(){if(oD)return DN;oD=1;var e=Vq(),t=Ixe(),n=XE(),s=1/0,a=e&&1/n(new e([,-0]))[1]==s?function(i){return new e(i)}:t;return DN=a,DN}var LN,lD;function Mxe(){if(lD)return LN;lD=1;var e=Dq(),t=Pxe(),n=Oxe(),s=$q(),a=Rxe(),i=XE(),o=200;function l(c,d,f){var m=-1,g=t,x=c.length,j=!0,b=[],y=b;if(f)j=!1,g=n;else if(x>=o){var w=d?null:a(c);if(w)return i(w);j=!1,g=s,y=new e}else y=d?[]:b;e:for(;++m<x;){var _=c[m],N=d?d(_):_;if(_=f||_!==0?_:0,j&&N===N){for(var C=y.length;C--;)if(y[C]===N)continue e;d&&y.push(N),b.push(_)}else g(y,N,f)||(y!==b&&y.push(N),b.push(_))}return b}return LN=l,LN}var $N,cD;function Dxe(){if(cD)return $N;cD=1;var e=bc(),t=Mxe();function n(s,a){return s&&s.length?t(s,e(a,2)):[]}return $N=n,$N}var Lxe=Dxe();const dD=Un(Lxe);function Yq(e,t,n){return t===!0?dD(e,n):gn(t)?dD(e,t):e}function dm(e){"@babel/helpers - typeof";return dm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dm(e)}var $xe=["ref"];function uD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Eo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uD(Object(n),!0).forEach(function(s){Zb(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uD(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Bxe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mD(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Qq(s.key),s)}}function Fxe(e,t,n){return t&&mD(e.prototype,t),n&&mD(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function zxe(e,t,n){return t=ay(t),Uxe(e,Jq()?Reflect.construct(t,n||[],ay(e).constructor):t.apply(e,n))}function Uxe(e,t){if(t&&(dm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qxe(e)}function qxe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Jq(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jq=function(){return!!e})()}function ay(e){return ay=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ay(e)}function Kxe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&aC(e,t)}function aC(e,t){return aC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},aC(e,t)}function Zb(e,t,n){return t=Qq(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qq(e){var t=Vxe(e,"string");return dm(t)=="symbol"?t:t+""}function Vxe(e,t){if(dm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(dm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Hxe(e,t){if(e==null)return{};var n=Wxe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Wxe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function Gxe(e){return e.value}function Yxe(e,t){if(xe.isValidElement(e))return xe.cloneElement(e,t);if(typeof e=="function")return xe.createElement(e,t);t.ref;var n=Hxe(t,$xe);return xe.createElement(QE,n)}var fD=1,Xl=(function(e){function t(){var n;Bxe(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return n=zxe(this,t,[].concat(a)),Zb(n,"lastBoundingBox",{width:-1,height:-1}),n}return Kxe(t,e),Fxe(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var s=this.wrapperNode.getBoundingClientRect();return s.height=this.wrapperNode.offsetHeight,s.width=this.wrapperNode.offsetWidth,s}return null}},{key:"updateBBox",value:function(){var s=this.props.onBBoxUpdate,a=this.getBBox();a?(Math.abs(a.width-this.lastBoundingBox.width)>fD||Math.abs(a.height-this.lastBoundingBox.height)>fD)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,s&&s(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,s&&s(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Eo({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var a=this.props,i=a.layout,o=a.align,l=a.verticalAlign,c=a.margin,d=a.chartWidth,f=a.chartHeight,m,g;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(o==="center"&&i==="vertical"){var x=this.getBBoxSnapshot();m={left:((d||0)-x.width)/2}}else m=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(l==="middle"){var j=this.getBBoxSnapshot();g={top:((f||0)-j.height)/2}}else g=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Eo(Eo({},m),g)}},{key:"render",value:function(){var s=this,a=this.props,i=a.content,o=a.width,l=a.height,c=a.wrapperStyle,d=a.payloadUniqBy,f=a.payload,m=Eo(Eo({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return xe.createElement("div",{className:"recharts-legend-wrapper",style:m,ref:function(x){s.wrapperNode=x}},Yxe(i,Eo(Eo({},this.props),{},{payload:Yq(f,d,Gxe)})))}}],[{key:"getWithHeight",value:function(s,a){var i=Eo(Eo({},this.defaultProps),s.props),o=i.layout;return o==="vertical"&&ht(s.props.height)?{height:s.props.height}:o==="horizontal"?{width:s.props.width||a}:null}}])})(h.PureComponent);Zb(Xl,"displayName","Legend");Zb(Xl,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var BN,hD;function Jxe(){if(hD)return BN;hD=1;var e=lg(),t=ZE(),n=aa(),s=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(s&&i&&i[s])}return BN=a,BN}var FN,pD;function Xq(){if(pD)return FN;pD=1;var e=Fq(),t=Jxe();function n(s,a,i,o,l){var c=-1,d=s.length;for(i||(i=t),l||(l=[]);++c<d;){var f=s[c];a>0&&i(f)?a>1?n(f,a-1,i,o,l):e(l,f):o||(l[l.length]=f)}return l}return FN=n,FN}var zN,gD;function Qxe(){if(gD)return zN;gD=1;function e(t){return function(n,s,a){for(var i=-1,o=Object(n),l=a(n),c=l.length;c--;){var d=l[t?c:++i];if(s(o[d],d,o)===!1)break}return n}}return zN=e,zN}var UN,xD;function Xxe(){if(xD)return UN;xD=1;var e=Qxe(),t=e();return UN=t,UN}var qN,yD;function Zq(){if(yD)return qN;yD=1;var e=Xxe(),t=Xb();function n(s,a){return s&&e(s,a,t)}return qN=n,qN}var KN,bD;function Zxe(){if(bD)return KN;bD=1;var e=ug();function t(n,s){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var o=a.length,l=s?o:-1,c=Object(a);(s?l--:++l<o)&&i(c[l],l,c)!==!1;);return a}}return KN=t,KN}var VN,vD;function rA(){if(vD)return VN;vD=1;var e=Zq(),t=Zxe(),n=t(e);return VN=n,VN}var HN,wD;function eK(){if(wD)return HN;wD=1;var e=rA(),t=ug();function n(s,a){var i=-1,o=t(s)?Array(s.length):[];return e(s,function(l,c,d){o[++i]=a(l,c,d)}),o}return HN=n,HN}var WN,jD;function e0e(){if(jD)return WN;jD=1;function e(t,n){var s=t.length;for(t.sort(n);s--;)t[s]=t[s].value;return t}return WN=e,WN}var GN,_D;function t0e(){if(_D)return GN;_D=1;var e=Jm();function t(n,s){if(n!==s){var a=n!==void 0,i=n===null,o=n===n,l=e(n),c=s!==void 0,d=s===null,f=s===s,m=e(s);if(!d&&!m&&!l&&n>s||l&&c&&f&&!d&&!m||i&&c&&f||!a&&f||!o)return 1;if(!i&&!l&&!m&&n<s||m&&a&&o&&!i&&!l||d&&a&&o||!c&&o||!f)return-1}return 0}return GN=t,GN}var YN,ND;function n0e(){if(ND)return YN;ND=1;var e=t0e();function t(n,s,a){for(var i=-1,o=n.criteria,l=s.criteria,c=o.length,d=a.length;++i<c;){var f=e(o[i],l[i]);if(f){if(i>=d)return f;var m=a[i];return f*(m=="desc"?-1:1)}}return n.index-s.index}return YN=t,YN}var JN,SD;function r0e(){if(SD)return JN;SD=1;var e=qE(),t=KE(),n=bc(),s=eK(),a=e0e(),i=Uq(),o=n0e(),l=Xm(),c=aa();function d(f,m,g){m.length?m=e(m,function(b){return c(b)?function(y){return t(y,b.length===1?b[0]:b)}:b}):m=[l];var x=-1;m=e(m,i(n));var j=s(f,function(b,y,w){var _=e(m,function(N){return N(b)});return{criteria:_,index:++x,value:b}});return a(j,function(b,y){return o(b,y,g)})}return JN=d,JN}var QN,kD;function s0e(){if(kD)return QN;kD=1;function e(t,n,s){switch(s.length){case 0:return t.call(n);case 1:return t.call(n,s[0]);case 2:return t.call(n,s[0],s[1]);case 3:return t.call(n,s[0],s[1],s[2])}return t.apply(n,s)}return QN=e,QN}var XN,CD;function a0e(){if(CD)return XN;CD=1;var e=s0e(),t=Math.max;function n(s,a,i){return a=t(a===void 0?s.length-1:a,0),function(){for(var o=arguments,l=-1,c=t(o.length-a,0),d=Array(c);++l<c;)d[l]=o[a+l];l=-1;for(var f=Array(a+1);++l<a;)f[l]=o[l];return f[a]=i(d),e(s,this,f)}}return XN=n,XN}var ZN,ED;function i0e(){if(ED)return ZN;ED=1;function e(t){return function(){return t}}return ZN=e,ZN}var eS,AD;function tK(){if(AD)return eS;AD=1;var e=Kd(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return eS=t,eS}var tS,TD;function o0e(){if(TD)return tS;TD=1;var e=i0e(),t=tK(),n=Xm(),s=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return tS=s,tS}var nS,PD;function l0e(){if(PD)return nS;PD=1;var e=800,t=16,n=Date.now;function s(a){var i=0,o=0;return function(){var l=n(),c=t-(l-o);if(o=l,c>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return nS=s,nS}var rS,OD;function c0e(){if(OD)return rS;OD=1;var e=o0e(),t=l0e(),n=t(e);return rS=n,rS}var sS,ID;function d0e(){if(ID)return sS;ID=1;var e=Xm(),t=a0e(),n=c0e();function s(a,i){return n(t(a,i,e),a+"")}return sS=s,sS}var aS,RD;function ev(){if(RD)return aS;RD=1;var e=FE(),t=ug(),n=eA(),s=yc();function a(i,o,l){if(!s(l))return!1;var c=typeof o;return(c=="number"?t(l)&&n(o,l.length):c=="string"&&o in l)?e(l[o],i):!1}return aS=a,aS}var iS,MD;function u0e(){if(MD)return iS;MD=1;var e=Xq(),t=r0e(),n=d0e(),s=ev(),a=n(function(i,o){if(i==null)return[];var l=o.length;return l>1&&s(i,o[0],o[1])?o=[]:l>2&&s(o[0],o[1],o[2])&&(o=[o[0]]),t(i,e(o,1),[])});return iS=a,iS}var m0e=u0e();const sA=Un(m0e);function Wh(e){"@babel/helpers - typeof";return Wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wh(e)}function iC(){return iC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},iC.apply(this,arguments)}function f0e(e,t){return x0e(e)||g0e(e,t)||p0e(e,t)||h0e()}function h0e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
911In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function p0e(e,t){if(e){if(typeof e=="string")return DD(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 DD(e,t)}}function DD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function g0e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function x0e(e){if(Array.isArray(e))return e}function LD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function oS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LD(Object(n),!0).forEach(function(s){y0e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LD(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function y0e(e,t,n){return t=b0e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b0e(e){var t=v0e(e,"string");return Wh(t)=="symbol"?t:t+""}function v0e(e,t){if(Wh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Wh(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function w0e(e){return Array.isArray(e)&&Wr(e[0])&&Wr(e[1])?e.join(" ~ "):e}var j0e=function(t){var n=t.separator,s=n===void 0?" : ":n,a=t.contentStyle,i=a===void 0?{}:a,o=t.itemStyle,l=o===void 0?{}:o,c=t.labelStyle,d=c===void 0?{}:c,f=t.payload,m=t.formatter,g=t.itemSorter,x=t.wrapperClassName,j=t.labelClassName,b=t.label,y=t.labelFormatter,w=t.accessibilityLayer,_=w===void 0?!1:w,N=function(){if(f&&f.length){var P={padding:0,margin:0},I=(g?sA(f,g):f).map(function(z,L){if(z.type==="none")return null;var H=oS({display:"block",paddingTop:4,paddingBottom:4,color:z.color||"#000"},l),W=z.formatter||m||w0e,V=z.value,K=z.name,M=V,G=K;if(W&&M!=null&&G!=null){var q=W(V,K,z,L,f);if(Array.isArray(q)){var F=f0e(q,2);M=F[0],G=F[1]}else M=q}return xe.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(L),style:H},Wr(G)?xe.createElement("span",{className:"recharts-tooltip-item-name"},G):null,Wr(G)?xe.createElement("span",{className:"recharts-tooltip-item-separator"},s):null,xe.createElement("span",{className:"recharts-tooltip-item-value"},M),xe.createElement("span",{className:"recharts-tooltip-item-unit"},z.unit||""))});return xe.createElement("ul",{className:"recharts-tooltip-item-list",style:P},I)}return null},C=oS({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),k=oS({margin:0},d),S=!hn(b),A=S?b:"",T=wn("recharts-default-tooltip",x),R=wn("recharts-tooltip-label",j);S&&y&&f!==void 0&&f!==null&&(A=y(b,f));var B=_?{role:"status","aria-live":"assertive"}:{};return xe.createElement("div",iC({className:T,style:C},B),xe.createElement("p",{className:R,style:k},xe.isValidElement(A)?A:"".concat(A)),N())};function Gh(e){"@babel/helpers - typeof";return Gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gh(e)}function Bx(e,t,n){return t=_0e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _0e(e){var t=N0e(e,"string");return Gh(t)=="symbol"?t:t+""}function N0e(e,t){if(Gh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Gh(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gf="recharts-tooltip-wrapper",S0e={visibility:"hidden"};function k0e(e){var t=e.coordinate,n=e.translateX,s=e.translateY;return wn(Gf,Bx(Bx(Bx(Bx({},"".concat(Gf,"-right"),ht(n)&&t&&ht(t.x)&&n>=t.x),"".concat(Gf,"-left"),ht(n)&&t&&ht(t.x)&&n<t.x),"".concat(Gf,"-bottom"),ht(s)&&t&&ht(t.y)&&s>=t.y),"".concat(Gf,"-top"),ht(s)&&t&&ht(t.y)&&s<t.y))}function $D(e){var t=e.allowEscapeViewBox,n=e.coordinate,s=e.key,a=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,d=e.viewBoxDimension;if(i&&ht(i[s]))return i[s];var f=n[s]-l-a,m=n[s]+a;if(t[s])return o[s]?f:m;if(o[s]){var g=f,x=c[s];return g<x?Math.max(m,c[s]):Math.max(f,c[s])}var j=m+l,b=c[s]+d;return j>b?Math.max(f,c[s]):Math.max(m,c[s])}function C0e(e){var t=e.translateX,n=e.translateY,s=e.useTranslate3d;return{transform:s?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function E0e(e){var t=e.allowEscapeViewBox,n=e.coordinate,s=e.offsetTopLeft,a=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,d,f,m;return o.height>0&&o.width>0&&n?(f=$D({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:s,position:a,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),m=$D({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:s,position:a,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=C0e({translateX:f,translateY:m,useTranslate3d:l})):d=S0e,{cssProperties:d,cssClasses:k0e({translateX:f,translateY:m,coordinate:n})}}function um(e){"@babel/helpers - typeof";return um=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},um(e)}function BD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function FD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?BD(Object(n),!0).forEach(function(s){lC(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BD(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function A0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T0e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,rK(s.key),s)}}function P0e(e,t,n){return t&&T0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function O0e(e,t,n){return t=iy(t),I0e(e,nK()?Reflect.construct(t,n||[],iy(e).constructor):t.apply(e,n))}function I0e(e,t){if(t&&(um(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return R0e(e)}function R0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nK(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nK=function(){return!!e})()}function iy(e){return iy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},iy(e)}function M0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oC(e,t)}function oC(e,t){return oC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},oC(e,t)}function lC(e,t,n){return t=rK(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rK(e){var t=D0e(e,"string");return um(t)=="symbol"?t:t+""}function D0e(e,t){if(um(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(um(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var zD=1,L0e=(function(e){function t(){var n;A0e(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return n=O0e(this,t,[].concat(a)),lC(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),lC(n,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,d,f;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=n.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(d=(f=n.props.coordinate)===null||f===void 0?void 0:f.y)!==null&&d!==void 0?d:0}})}}),n}return M0e(t,e),P0e(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var s=this.wrapperNode.getBoundingClientRect();(Math.abs(s.width-this.state.lastBoundingBox.width)>zD||Math.abs(s.height-this.state.lastBoundingBox.height)>zD)&&this.setState({lastBoundingBox:{width:s.width,height:s.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var s,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,d=a.children,f=a.coordinate,m=a.hasPayload,g=a.isAnimationActive,x=a.offset,j=a.position,b=a.reverseDirection,y=a.useTranslate3d,w=a.viewBox,_=a.wrapperStyle,N=E0e({allowEscapeViewBox:o,coordinate:f,offsetTopLeft:x,position:j,reverseDirection:b,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:w}),C=N.cssClasses,k=N.cssProperties,S=FD(FD({transition:g&&i?"transform ".concat(l,"ms ").concat(c):void 0},k),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&m?"visible":"hidden",position:"absolute",top:0,left:0},_);return xe.createElement("div",{tabIndex:-1,className:C,style:S,ref:function(T){s.wrapperNode=T}},d)}}])})(h.PureComponent),$0e=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Zm={isSsr:$0e()};function mm(e){"@babel/helpers - typeof";return mm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mm(e)}function UD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function qD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?UD(Object(n),!0).forEach(function(s){aA(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UD(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function B0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F0e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,aK(s.key),s)}}function z0e(e,t,n){return t&&F0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function U0e(e,t,n){return t=oy(t),q0e(e,sK()?Reflect.construct(t,n||[],oy(e).constructor):t.apply(e,n))}function q0e(e,t){if(t&&(mm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return K0e(e)}function K0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sK(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sK=function(){return!!e})()}function oy(e){return oy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},oy(e)}function V0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&cC(e,t)}function cC(e,t){return cC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},cC(e,t)}function aA(e,t,n){return t=aK(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aK(e){var t=H0e(e,"string");return mm(t)=="symbol"?t:t+""}function H0e(e,t){if(mm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(mm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function W0e(e){return e.dataKey}function G0e(e,t){return xe.isValidElement(e)?xe.cloneElement(e,t):typeof e=="function"?xe.createElement(e,t):xe.createElement(j0e,t)}var us=(function(e){function t(){return B0e(this,t),U0e(this,t,arguments)}return V0e(t,e),z0e(t,[{key:"render",value:function(){var s=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,d=a.content,f=a.coordinate,m=a.filterNull,g=a.isAnimationActive,x=a.offset,j=a.payload,b=a.payloadUniqBy,y=a.position,w=a.reverseDirection,_=a.useTranslate3d,N=a.viewBox,C=a.wrapperStyle,k=j??[];m&&k.length&&(k=Yq(j.filter(function(A){return A.value!=null&&(A.hide!==!0||s.props.includeHidden)}),b,W0e));var S=k.length>0;return xe.createElement(L0e,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:g,active:i,coordinate:f,hasPayload:S,offset:x,position:y,reverseDirection:w,useTranslate3d:_,viewBox:N,wrapperStyle:C},G0e(d,qD(qD({},this.props),{},{payload:k})))}}])})(h.PureComponent);aA(us,"displayName","Tooltip");aA(us,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Zm.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var lS,KD;function Y0e(){if(KD)return lS;KD=1;var e=fo(),t=function(){return e.Date.now()};return lS=t,lS}var cS,VD;function J0e(){if(VD)return cS;VD=1;var e=/\s/;function t(n){for(var s=n.length;s--&&e.test(n.charAt(s)););return s}return cS=t,cS}var dS,HD;function Q0e(){if(HD)return dS;HD=1;var e=J0e(),t=/^\s+/;function n(s){return s&&s.slice(0,e(s)+1).replace(t,"")}return dS=n,dS}var uS,WD;function iK(){if(WD)return uS;WD=1;var e=Q0e(),t=yc(),n=Jm(),s=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,l=parseInt;function c(d){if(typeof d=="number")return d;if(n(d))return s;if(t(d)){var f=typeof d.valueOf=="function"?d.valueOf():d;d=t(f)?f+"":f}if(typeof d!="string")return d===0?d:+d;d=e(d);var m=i.test(d);return m||o.test(d)?l(d.slice(2),m?2:8):a.test(d)?s:+d}return uS=c,uS}var mS,GD;function X0e(){if(GD)return mS;GD=1;var e=yc(),t=Y0e(),n=iK(),s="Expected a function",a=Math.max,i=Math.min;function o(l,c,d){var f,m,g,x,j,b,y=0,w=!1,_=!1,N=!0;if(typeof l!="function")throw new TypeError(s);c=n(c)||0,e(d)&&(w=!!d.leading,_="maxWait"in d,g=_?a(n(d.maxWait)||0,c):g,N="trailing"in d?!!d.trailing:N);function C(I){var z=f,L=m;return f=m=void 0,y=I,x=l.apply(L,z),x}function k(I){return y=I,j=setTimeout(T,c),w?C(I):x}function S(I){var z=I-b,L=I-y,H=c-z;return _?i(H,g-L):H}function A(I){var z=I-b,L=I-y;return b===void 0||z>=c||z<0||_&&L>=g}function T(){var I=t();if(A(I))return R(I);j=setTimeout(T,S(I))}function R(I){return j=void 0,N&&f?C(I):(f=m=void 0,x)}function B(){j!==void 0&&clearTimeout(j),y=0,f=b=m=j=void 0}function D(){return j===void 0?x:R(t())}function P(){var I=t(),z=A(I);if(f=arguments,m=this,b=I,z){if(j===void 0)return k(b);if(_)return clearTimeout(j),j=setTimeout(T,c),C(b)}return j===void 0&&(j=setTimeout(T,c)),x}return P.cancel=B,P.flush=D,P}return mS=o,mS}var fS,YD;function Z0e(){if(YD)return fS;YD=1;var e=X0e(),t=yc(),n="Expected a function";function s(a,i,o){var l=!0,c=!0;if(typeof a!="function")throw new TypeError(n);return t(o)&&(l="leading"in o?!!o.leading:l,c="trailing"in o?!!o.trailing:c),e(a,i,{leading:l,maxWait:i,trailing:c})}return fS=s,fS}var eye=Z0e();const oK=Un(eye);function Yh(e){"@babel/helpers - typeof";return Yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yh(e)}function JD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Fx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?JD(Object(n),!0).forEach(function(s){tye(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JD(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function tye(e,t,n){return t=nye(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nye(e){var t=rye(e,"string");return Yh(t)=="symbol"?t:t+""}function rye(e,t){if(Yh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Yh(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sye(e,t){return lye(e)||oye(e,t)||iye(e,t)||aye()}function aye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
912In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iye(e,t){if(e){if(typeof e=="string")return QD(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 QD(e,t)}}function QD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function oye(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function lye(e){if(Array.isArray(e))return e}var Zl=h.forwardRef(function(e,t){var n=e.aspect,s=e.initialDimension,a=s===void 0?{width:-1,height:-1}:s,i=e.width,o=i===void 0?"100%":i,l=e.height,c=l===void 0?"100%":l,d=e.minWidth,f=d===void 0?0:d,m=e.minHeight,g=e.maxHeight,x=e.children,j=e.debounce,b=j===void 0?0:j,y=e.id,w=e.className,_=e.onResize,N=e.style,C=N===void 0?{}:N,k=h.useRef(null),S=h.useRef();S.current=_,h.useImperativeHandle(t,function(){return Object.defineProperty(k.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),k.current},configurable:!0})});var A=h.useState({containerWidth:a.width,containerHeight:a.height}),T=sye(A,2),R=T[0],B=T[1],D=h.useCallback(function(I,z){B(function(L){var H=Math.round(I),W=Math.round(z);return L.containerWidth===H&&L.containerHeight===W?L:{containerWidth:H,containerHeight:W}})},[]);h.useEffect(function(){var I=function(K){var M,G=K[0].contentRect,q=G.width,F=G.height;D(q,F),(M=S.current)===null||M===void 0||M.call(S,q,F)};b>0&&(I=oK(I,b,{trailing:!0,leading:!1}));var z=new ResizeObserver(I),L=k.current.getBoundingClientRect(),H=L.width,W=L.height;return D(H,W),z.observe(k.current),function(){z.disconnect()}},[D,b]);var P=h.useMemo(function(){var I=R.containerWidth,z=R.containerHeight;if(I<0||z<0)return null;vd(sd(o)||sd(c),`The width(%s) and height(%s) are both fixed numbers,
913       maybe you don't need to use a ResponsiveContainer.`,o,c),vd(!n||n>0,"The aspect(%s) must be greater than zero.",n);var L=sd(o)?I:o,H=sd(c)?z:c;n&&n>0&&(L?H=L/n:H&&(L=H*n),g&&H>g&&(H=g)),vd(L>0||H>0,`The width(%s) and height(%s) of chart should be greater than 0,
914       please check the style of container, or the props width(%s) and height(%s),
915       or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
916       height and width.`,L,H,o,c,f,m,n);var W=!Array.isArray(x)&&Fo(x.type).endsWith("Chart");return xe.Children.map(x,function(V){return xe.isValidElement(V)?h.cloneElement(V,Fx({width:L,height:H},W?{style:Fx({height:"100%",width:"100%",maxHeight:H,maxWidth:L},V.props.style)}:{})):V})},[n,x,c,g,m,f,R,o]);return xe.createElement("div",{id:y?"".concat(y):void 0,className:wn("recharts-responsive-container",w),style:Fx(Fx({},C),{},{width:o,height:c,minWidth:f,minHeight:m,maxHeight:g}),ref:k},P)}),mg=function(t){return null};mg.displayName="Cell";function Jh(e){"@babel/helpers - typeof";return Jh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jh(e)}function XD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function dC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XD(Object(n),!0).forEach(function(s){cye(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XD(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function cye(e,t,n){return t=dye(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dye(e){var t=uye(e,"string");return Jh(t)=="symbol"?t:t+""}function uye(e,t){if(Jh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Jh(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vu={widthCache:{},cacheCount:0},mye=2e3,fye={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},ZD="recharts_measurement_span";function hye(e){var t=dC({},e);return Object.keys(t).forEach(function(n){t[n]||delete t[n]}),t}var kh=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Zm.isSsr)return{width:0,height:0};var s=hye(n),a=JSON.stringify({text:t,copyStyle:s});if(vu.widthCache[a])return vu.widthCache[a];try{var i=document.getElementById(ZD);i||(i=document.createElement("span"),i.setAttribute("id",ZD),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=dC(dC({},fye),s);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return vu.widthCache[a]=c,++vu.cacheCount>mye&&(vu.cacheCount=0,vu.widthCache={}),c}catch{return{width:0,height:0}}},pye=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Qh(e){"@babel/helpers - typeof";return Qh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qh(e)}function ly(e,t){return bye(e)||yye(e,t)||xye(e,t)||gye()}function gye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
917In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xye(e,t){if(e){if(typeof e=="string")return eL(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 eL(e,t)}}function eL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function yye(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function bye(e){if(Array.isArray(e))return e}function vye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tL(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,jye(s.key),s)}}function wye(e,t,n){return t&&tL(e.prototype,t),n&&tL(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function jye(e){var t=_ye(e,"string");return Qh(t)=="symbol"?t:t+""}function _ye(e,t){if(Qh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Qh(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var nL=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,rL=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Nye=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Sye=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,lK={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},kye=Object.keys(lK),Mu="NaN";function Cye(e,t){return e*lK[t]}var zx=(function(){function e(t,n){vye(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!Nye.test(n)&&(this.num=NaN,this.unit=""),kye.includes(n)&&(this.num=Cye(t,n),this.unit="px")}return wye(e,[{key:"add",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var s,a=(s=Sye.exec(n))!==null&&s!==void 0?s:[],i=ly(a,3),o=i[1],l=i[2];return new e(parseFloat(o),l??"")}}])})();function cK(e){if(e.includes(Mu))return Mu;for(var t=e;t.includes("*")||t.includes("/");){var n,s=(n=nL.exec(t))!==null&&n!==void 0?n:[],a=ly(s,4),i=a[1],o=a[2],l=a[3],c=zx.parse(i??""),d=zx.parse(l??""),f=o==="*"?c.multiply(d):c.divide(d);if(f.isNaN())return Mu;t=t.replace(nL,f.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var m,g=(m=rL.exec(t))!==null&&m!==void 0?m:[],x=ly(g,4),j=x[1],b=x[2],y=x[3],w=zx.parse(j??""),_=zx.parse(y??""),N=b==="+"?w.add(_):w.subtract(_);if(N.isNaN())return Mu;t=t.replace(rL,N.toString())}return t}var sL=/\(([^()]*)\)/;function Eye(e){for(var t=e;t.includes("(");){var n=sL.exec(t),s=ly(n,2),a=s[1];t=t.replace(sL,cK(a))}return t}function Aye(e){var t=e.replace(/\s+/g,"");return t=Eye(t),t=cK(t),t}function Tye(e){try{return Aye(e)}catch{return Mu}}function hS(e){var t=Tye(e.slice(5,-1));return t===Mu?"":t}var Pye=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],Oye=["dx","dy","angle","className","breakAll"];function uC(){return uC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},uC.apply(this,arguments)}function aL(e,t){if(e==null)return{};var n=Iye(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Iye(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function iL(e,t){return Lye(e)||Dye(e,t)||Mye(e,t)||Rye()}function Rye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
918In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mye(e,t){if(e){if(typeof e=="string")return oL(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 oL(e,t)}}function oL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function Dye(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function Lye(e){if(Array.isArray(e))return e}var dK=/[ \f\n\r\t\v\u2028\u2029]+/,uK=function(t){var n=t.children,s=t.breakAll,a=t.style;try{var i=[];hn(n)||(s?i=n.toString().split(""):i=n.toString().split(dK));var o=i.map(function(c){return{word:c,width:kh(c,a).width}}),l=s?0:kh(" ",a).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},$ye=function(t,n,s,a,i){var o=t.maxLines,l=t.children,c=t.style,d=t.breakAll,f=ht(o),m=l,g=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return L.reduce(function(H,W){var V=W.word,K=W.width,M=H[H.length-1];if(M&&(a==null||i||M.width+K+s<Number(a)))M.words.push(V),M.width+=K+s;else{var G={words:[V],width:K};H.push(G)}return H},[])},x=g(n),j=function(L){return L.reduce(function(H,W){return H.width>W.width?H:W})};if(!f)return x;for(var b="…",y=function(L){var H=m.slice(0,L),W=uK({breakAll:d,style:c,children:H+b}).wordsWithComputedWidth,V=g(W),K=V.length>o||j(V).width>Number(a);return[K,V]},w=0,_=m.length-1,N=0,C;w<=_&&N<=m.length-1;){var k=Math.floor((w+_)/2),S=k-1,A=y(S),T=iL(A,2),R=T[0],B=T[1],D=y(k),P=iL(D,1),I=P[0];if(!R&&!I&&(w=k+1),R&&I&&(_=k-1),!R&&I){C=B;break}N++}return C||x},lL=function(t){var n=hn(t)?[]:t.toString().split(dK);return[{words:n}]},Bye=function(t){var n=t.width,s=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((n||s)&&!Zm.isSsr){var c,d,f=uK({breakAll:o,children:a,style:i});if(f){var m=f.wordsWithComputedWidth,g=f.spaceWidth;c=m,d=g}else return lL(a);return $ye({breakAll:o,children:a,maxLines:l,style:i},c,d,n,s)}return lL(a)},cL="#808080",cy=function(t){var n=t.x,s=n===void 0?0:n,a=t.y,i=a===void 0?0:a,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,d=c===void 0?"0.71em":c,f=t.scaleToFit,m=f===void 0?!1:f,g=t.textAnchor,x=g===void 0?"start":g,j=t.verticalAnchor,b=j===void 0?"end":j,y=t.fill,w=y===void 0?cL:y,_=aL(t,Pye),N=h.useMemo(function(){return Bye({breakAll:_.breakAll,children:_.children,maxLines:_.maxLines,scaleToFit:m,style:_.style,width:_.width})},[_.breakAll,_.children,_.maxLines,m,_.style,_.width]),C=_.dx,k=_.dy,S=_.angle,A=_.className,T=_.breakAll,R=aL(_,Oye);
918if(!Wr(s)||!Wr(i))return null;var B=s+(ht(C)?C:0),D=i+(ht(k)?k:0),P;switch(b){case"start":P=hS("calc(".concat(d,")"));break;case"middle":P=hS("calc(".concat((N.length-1)/2," * -").concat(l," + (").concat(d," / 2))"));break;default:P=hS("calc(".concat(N.length-1," * -").concat(l,")"));break}var I=[];if(m){var z=N[0].width,L=_.width;I.push("scale(".concat((ht(L)?L/z:1)/z,")"))}return S&&I.push("rotate(".concat(S,", ").concat(B,", ").concat(D,")")),I.length&&(R.transform=I.join(" ")),xe.createElement("text",uC({},jn(R,!0),{x:B,y:D,className:wn("recharts-text",A),textAnchor:x,fill:w.includes("url")?cL:w}),N.map(function(H,W){var V=H.words.join(T?"":" ");return xe.createElement("tspan",{x:B,dy:W===0?P:l,key:"".concat(V,"-").concat(W)},V)}))};function ec(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Fye(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function iA(e){let t,n,s;e.length!==2?(t=ec,n=(l,c)=>ec(e(l),c),s=(l,c)=>e(l)-c):(t=e===ec||e===Fye?e:zye,n=e,s=e);function a(l,c,d=0,f=l.length){if(d<f){if(t(c,c)!==0)return f;do{const m=d+f>>>1;n(l[m],c)<0?d=m+1:f=m}while(d<f)}return d}function i(l,c,d=0,f=l.length){if(d<f){if(t(c,c)!==0)return f;do{const m=d+f>>>1;n(l[m],c)<=0?d=m+1:f=m}while(d<f)}return d}function o(l,c,d=0,f=l.length){const m=a(l,c,d,f-1);return m>d&&s(l[m-1],c)>-s(l[m],c)?m-1:m}return{left:a,center:o,right:i}}function zye(){return 0}function mK(e){return e===null?NaN:+e}function*Uye(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const qye=iA(ec),fg=qye.right;iA(mK).center;class dL extends Map{constructor(t,n=Hye){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[s,a]of t)this.set(s,a)}get(t){return super.get(uL(this,t))}has(t){return super.has(uL(this,t))}set(t,n){return super.set(Kye(this,t),n)}delete(t){return super.delete(Vye(this,t))}}function uL({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):n}function Kye({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):(e.set(s,n),n)}function Vye({_intern:e,_key:t},n){const s=t(n);return e.has(s)&&(n=e.get(s),e.delete(s)),n}function Hye(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Wye(e=ec){if(e===ec)return fK;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const s=e(t,n);return s||s===0?s:(e(n,n)===0)-(e(t,t)===0)}}function fK(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Gye=Math.sqrt(50),Yye=Math.sqrt(10),Jye=Math.sqrt(2);function dy(e,t,n){const s=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(s)),i=s/Math.pow(10,a),o=i>=Gye?10:i>=Yye?5:i>=Jye?2:1;let l,c,d;return a<0?(d=Math.pow(10,-a)/o,l=Math.round(e*d),c=Math.round(t*d),l/d<e&&++l,c/d>t&&--c,d=-d):(d=Math.pow(10,a)*o,l=Math.round(e/d),c=Math.round(t/d),l*d<e&&++l,c*d>t&&--c),c<l&&.5<=n&&n<2?dy(e,t,n*2):[l,c,d]}function mC(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const s=t<e,[a,i,o]=s?dy(t,e,n):dy(e,t,n);if(!(i>=a))return[];const l=i-a+1,c=new Array(l);if(s)if(o<0)for(let d=0;d<l;++d)c[d]=(i-d)/-o;else for(let d=0;d<l;++d)c[d]=(i-d)*o;else if(o<0)for(let d=0;d<l;++d)c[d]=(a+d)/-o;else for(let d=0;d<l;++d)c[d]=(a+d)*o;return c}function fC(e,t,n){return t=+t,e=+e,n=+n,dy(e,t,n)[2]}function hC(e,t,n){t=+t,e=+e,n=+n;const s=t<e,a=s?fC(t,e,n):fC(e,t,n);return(s?-1:1)*(a<0?1/-a:a)}function mL(e,t){let n;for(const s of e)s!=null&&(n<s||n===void 0&&s>=s)&&(n=s);return n}function fL(e,t){let n;for(const s of e)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function hK(e,t,n=0,s=1/0,a){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),s=Math.floor(Math.min(e.length-1,s)),!(n<=t&&t<=s))return e;for(a=a===void 0?fK:Wye(a);s>n;){if(s-n>600){const c=s-n+1,d=t-n+1,f=Math.log(c),m=.5*Math.exp(2*f/3),g=.5*Math.sqrt(f*m*(c-m)/c)*(d-c/2<0?-1:1),x=Math.max(n,Math.floor(t-d*m/c+g)),j=Math.min(s,Math.floor(t+(c-d)*m/c+g));hK(e,t,x,j,a)}const i=e[t];let o=n,l=s;for(Yf(e,n,t),a(e[s],i)>0&&Yf(e,n,s);o<l;){for(Yf(e,o,l),++o,--l;a(e[o],i)<0;)++o;for(;a(e[l],i)>0;)--l}a(e[n],i)===0?Yf(e,n,l):(++l,Yf(e,l,s)),l<=t&&(n=l+1),t<=l&&(s=l-1)}return e}function Yf(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function Qye(e,t,n){if(e=Float64Array.from(Uye(e)),!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return fL(e);if(t>=1)return mL(e);var s,a=(s-1)*t,i=Math.floor(a),o=mL(hK(e,i).subarray(0,i+1)),l=fL(e.subarray(i+1));return o+(l-o)*(a-i)}}function Xye(e,t,n=mK){if(!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return+n(e[0],0,e);if(t>=1)return+n(e[s-1],s-1,e);var s,a=(s-1)*t,i=Math.floor(a),o=+n(e[i],i,e),l=+n(e[i+1],i+1,e);return o+(l-o)*(a-i)}}function Zye(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var s=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(a);++s<a;)i[s]=e+s*n;return i}function oi(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function sl(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}
vendor: 9,556 bytes, line 918
918const pC=Symbol("implicit");function oA(){var e=new dL,t=[],n=[],s=pC;function a(i){let o=e.get(i);if(o===void 0){if(s!==pC)return s;e.set(i,o=t.push(i)-1)}return n[o%n.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new dL;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(i){return arguments.length?(n=Array.from(i),a):n.slice()},a.unknown=function(i){return arguments.length?(s=i,a):s},a.copy=function(){return oA(t,n).unknown(s)},oi.apply(a,arguments),a}function Xh(){var e=oA().unknown(void 0),t=e.domain,n=e.range,s=0,a=1,i,o,l=!1,c=0,d=0,f=.5;delete e.unknown;function m(){var g=t().length,x=a<s,j=x?a:s,b=x?s:a;i=(b-j)/Math.max(1,g-c+d*2),l&&(i=Math.floor(i)),j+=(b-j-i*(g-c))*f,o=i*(1-c),l&&(j=Math.round(j),o=Math.round(o));var y=Zye(g).map(function(w){return j+i*w});return n(x?y.reverse():y)}return e.domain=function(g){return arguments.length?(t(g),m()):t()},e.range=function(g){return arguments.length?([s,a]=g,s=+s,a=+a,m()):[s,a]},e.rangeRound=function(g){return[s,a]=g,s=+s,a=+a,l=!0,m()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(g){return arguments.length?(l=!!g,m()):l},e.padding=function(g){return arguments.length?(c=Math.min(1,d=+g),m()):c},e.paddingInner=function(g){return arguments.length?(c=Math.min(1,g),m()):c},e.paddingOuter=function(g){return arguments.length?(d=+g,m()):d},e.align=function(g){return arguments.length?(f=Math.max(0,Math.min(1,g)),m()):f},e.copy=function(){return Xh(t(),[s,a]).round(l).paddingInner(c).paddingOuter(d).align(f)},oi.apply(m(),arguments)}function pK(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return pK(t())},e}function Ch(){return pK(Xh.apply(null,arguments).paddingInner(1))}function lA(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function gK(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function hg(){}var Zh=.7,uy=1/Zh,Uu="\\s*([+-]?\\d+)\\s*",ep="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",eo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ebe=/^#([0-9a-f]{3,8})$/,tbe=new RegExp(`^rgb\\(${Uu},${Uu},${Uu}\\)$`),nbe=new RegExp(`^rgb\\(${eo},${eo},${eo}\\)$`),rbe=new RegExp(`^rgba\\(${Uu},${Uu},${Uu},${ep}\\)$`),sbe=new RegExp(`^rgba\\(${eo},${eo},${eo},${ep}\\)$`),abe=new RegExp(`^hsl\\(${ep},${eo},${eo}\\)$`),ibe=new RegExp(`^hsla\\(${ep},${eo},${eo},${ep}\\)$`),hL={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};lA(hg,tp,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:pL,formatHex:pL,formatHex8:obe,formatHsl:lbe,formatRgb:gL,toString:gL});function pL(){return this.rgb().formatHex()}function obe(){return this.rgb().formatHex8()}function lbe(){return xK(this).formatHsl()}function gL(){return this.rgb().formatRgb()}function tp(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ebe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xL(t):n===3?new ea(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ux(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ux(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=tbe.exec(e))?new ea(t[1],t[2],t[3],1):(t=nbe.exec(e))?new ea(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=rbe.exec(e))?Ux(t[1],t[2],t[3],t[4]):(t=sbe.exec(e))?Ux(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=abe.exec(e))?vL(t[1],t[2]/100,t[3]/100,1):(t=ibe.exec(e))?vL(t[1],t[2]/100,t[3]/100,t[4]):hL.hasOwnProperty(e)?xL(hL[e]):e==="transparent"?new ea(NaN,NaN,NaN,0):null}function xL(e){return new ea(e>>16&255,e>>8&255,e&255,1)}function Ux(e,t,n,s){return s<=0&&(e=t=n=NaN),new ea(e,t,n,s)}function cbe(e){return e instanceof hg||(e=tp(e)),e?(e=e.rgb(),new ea(e.r,e.g,e.b,e.opacity)):new ea}function gC(e,t,n,s){return arguments.length===1?cbe(e):new ea(e,t,n,s??1)}function ea(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}lA(ea,gC,gK(hg,{brighter(e){return e=e==null?uy:Math.pow(uy,e),new ea(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zh:Math.pow(Zh,e),new ea(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ea(wd(this.r),wd(this.g),wd(this.b),my(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:yL,formatHex:yL,formatHex8:dbe,formatRgb:bL,toString:bL}));function yL(){return`#${ad(this.r)}${ad(this.g)}${ad(this.b)}`}function dbe(){return`#${ad(this.r)}${ad(this.g)}${ad(this.b)}${ad((isNaN(this.opacity)?1:this.opacity)*255)}`}function bL(){const e=my(this.opacity);return`${e===1?"rgb(":"rgba("}${wd(this.r)}, ${wd(this.g)}, ${wd(this.b)}${e===1?")":`, ${e})`}`}function my(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ad(e){return e=wd(e),(e<16?"0":"")+e.toString(16)}function vL(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ni(e,t,n,s)}function xK(e){if(e instanceof Ni)return new Ni(e.h,e.s,e.l,e.opacity);if(e instanceof hg||(e=tp(e)),!e)return new Ni;if(e instanceof Ni)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),i=Math.max(t,n,s),o=NaN,l=i-a,c=(i+a)/2;return l?(t===i?o=(n-s)/l+(n<s)*6:n===i?o=(s-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+a:2-i-a,o*=60):l=c>0&&c<1?0:o,new Ni(o,l,c,e.opacity)}function ube(e,t,n,s){return arguments.length===1?xK(e):new Ni(e,t,n,s??1)}function Ni(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}lA(Ni,ube,gK(hg,{brighter(e){return e=e==null?uy:Math.pow(uy,e),new Ni(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zh:Math.pow(Zh,e),new Ni(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,a=2*n-s;return new ea(pS(e>=240?e-240:e+120,a,s),pS(e,a,s),pS(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new Ni(wL(this.h),qx(this.s),qx(this.l),my(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=my(this.opacity);return`${e===1?"hsl(":"hsla("}${wL(this.h)}, ${qx(this.s)*100}%, ${qx(this.l)*100}%${e===1?")":`, ${e})`}`}}));function wL(e){return e=(e||0)%360,e<0?e+360:e}function qx(e){return Math.max(0,Math.min(1,e||0))}function pS(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const cA=e=>()=>e;function mbe(e,t){return function(n){return e+n*t}}function fbe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function hbe(e){return(e=+e)==1?yK:function(t,n){return n-t?fbe(t,n,e):cA(isNaN(t)?n:t)}}function yK(e,t){var n=t-e;return n?mbe(e,n):cA(isNaN(e)?t:e)}const jL=(function e(t){var n=hbe(t);function s(a,i){var o=n((a=gC(a)).r,(i=gC(i)).r),l=n(a.g,i.g),c=n(a.b,i.b),d=yK(a.opacity,i.opacity);
vendor: 6,007 bytes, line 918
918return function(f){return a.r=o(f),a.g=l(f),a.b=c(f),a.opacity=d(f),a+""}}return s.gamma=e,s})(1);function pbe(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),a;return function(i){for(a=0;a<n;++a)s[a]=e[a]*(1-i)+t[a]*i;return s}}function gbe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xbe(e,t){var n=t?t.length:0,s=e?Math.min(n,e.length):0,a=new Array(s),i=new Array(n),o;for(o=0;o<s;++o)a[o]=ef(e[o],t[o]);for(;o<n;++o)i[o]=t[o];return function(l){for(o=0;o<s;++o)i[o]=a[o](l);return i}}function ybe(e,t){var n=new Date;return e=+e,t=+t,function(s){return n.setTime(e*(1-s)+t*s),n}}function fy(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function bbe(e,t){var n={},s={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=ef(e[a],t[a]):s[a]=t[a];return function(i){for(a in n)s[a]=n[a](i);return s}}var xC=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gS=new RegExp(xC.source,"g");function vbe(e){return function(){return e}}function wbe(e){return function(t){return e(t)+""}}function jbe(e,t){var n=xC.lastIndex=gS.lastIndex=0,s,a,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(s=xC.exec(e))&&(a=gS.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(s=s[0])===(a=a[0])?l[o]?l[o]+=a:l[++o]=a:(l[++o]=null,c.push({i:o,x:fy(s,a)})),n=gS.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?wbe(c[0].x):vbe(t):(t=c.length,function(d){for(var f=0,m;f<t;++f)l[(m=c[f]).i]=m.x(d);return l.join("")})}function ef(e,t){var n=typeof t,s;return t==null||n==="boolean"?cA(t):(n==="number"?fy:n==="string"?(s=tp(t))?(t=s,jL):jbe:t instanceof tp?jL:t instanceof Date?ybe:gbe(t)?pbe:Array.isArray(t)?xbe:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?bbe:fy)(e,t)}function dA(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function _be(e,t){t===void 0&&(t=e,e=ef);for(var n=0,s=t.length-1,a=t[0],i=new Array(s<0?0:s);n<s;)i[n]=e(a,a=t[++n]);return function(o){var l=Math.max(0,Math.min(s-1,Math.floor(o*=s)));return i[l](o-l)}}function Nbe(e){return function(){return e}}function hy(e){return+e}var _L=[0,1];function Bs(e){return e}function yC(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Nbe(isNaN(t)?NaN:.5)}function Sbe(e,t){var n;return e>t&&(n=e,e=t,t=n),function(s){return Math.max(e,Math.min(t,s))}}function kbe(e,t,n){var s=e[0],a=e[1],i=t[0],o=t[1];return a<s?(s=yC(a,s),i=n(o,i)):(s=yC(s,a),i=n(i,o)),function(l){return i(s(l))}}function Cbe(e,t,n){var s=Math.min(e.length,t.length)-1,a=new Array(s),i=new Array(s),o=-1;for(e[s]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<s;)a[o]=yC(e[o],e[o+1]),i[o]=n(t[o],t[o+1]);return function(l){var c=fg(e,l,1,s)-1;return i[c](a[c](l))}}function pg(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function tv(){var e=_L,t=_L,n=ef,s,a,i,o=Bs,l,c,d;function f(){var g=Math.min(e.length,t.length);return o!==Bs&&(o=Sbe(e[0],e[g-1])),l=g>2?Cbe:kbe,c=d=null,m}function m(g){return g==null||isNaN(g=+g)?i:(c||(c=l(e.map(s),t,n)))(s(o(g)))}return m.invert=function(g){return o(a((d||(d=l(t,e.map(s),fy)))(g)))},m.domain=function(g){return arguments.length?(e=Array.from(g,hy),f()):e.slice()},m.range=function(g){return arguments.length?(t=Array.from(g),f()):t.slice()},m.rangeRound=function(g){return t=Array.from(g),n=dA,f()},m.clamp=function(g){return arguments.length?(o=g?!0:Bs,f()):o!==Bs},m.interpolate=function(g){return arguments.length?(n=g,f()):n},m.unknown=function(g){return arguments.length?(i=g,m):i},function(g,x){return s=g,a=x,f()}}function uA(){return tv()(Bs,Bs)}function Ebe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function py(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),s=e.slice(0,n);return[s.length>1?s[0]+s.slice(2):s,+e.slice(n+1)]}function fm(e){return e=py(Math.abs(e)),e?e[1]:NaN}function Abe(e,t){return function(n,s){for(var a=n.length,i=[],o=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>s&&(l=Math.max(1,s-c)),i.push(n.substring(a-=l,a+l)),!((c+=l+1)>s));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function Tbe(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Pbe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function np(e){if(!(t=Pbe.exec(e)))throw new Error("invalid format: "+e);var t;return new mA({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}np.prototype=mA.prototype;function mA(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}mA.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Obe(e){e:for(var t=e.length,n=1,s=-1,a;n<t;++n)switch(e[n]){case".":s=a=n;break;case"0":s===0&&(s=n),a=n;break;default:if(!+e[n])break e;s>0&&(s=0);break}return s>0?e.slice(0,s)+e.slice(a+1):e}var gy;function Ibe(e,t){var n=py(e,t);if(!n)return gy=void 0,e.toPrecision(t);var s=n[0],a=n[1],i=a-(gy=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=s.length;return i===o?s:i>o?s+new Array(i-o+1).join("0"):i>0?s.slice(0,i)+"."+s.slice(i):"0."+new Array(1-i).join("0")+py(e,Math.max(0,t+i-1))[0]}function NL(e,t){var n=py(e,t);if(!n)return e+"";var s=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+s:s.length>a+1?s.slice(0,a+1)+"."+s.slice(a+1):s+new Array(a-s.length+2).join("0")}const SL={"%":(e,t)=>
vendor: 5,713 bytes, line 918
918(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ebe,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>NL(e*100,t),r:NL,s:Ibe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function kL(e){return e}var CL=Array.prototype.map,EL=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Rbe(e){var t=e.grouping===void 0||e.thousands===void 0?kL:Abe(CL.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",s=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?kL:Tbe(CL.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function d(m,g){m=np(m);var x=m.fill,j=m.align,b=m.sign,y=m.symbol,w=m.zero,_=m.width,N=m.comma,C=m.precision,k=m.trim,S=m.type;S==="n"?(N=!0,S="g"):SL[S]||(C===void 0&&(C=12),k=!0,S="g"),(w||x==="0"&&j==="=")&&(w=!0,x="0",j="=");var A=(g&&g.prefix!==void 0?g.prefix:"")+(y==="$"?n:y==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():""),T=(y==="$"?s:/[%p]/.test(S)?o:"")+(g&&g.suffix!==void 0?g.suffix:""),R=SL[S],B=/[defgprs%]/.test(S);C=C===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function D(P){var I=A,z=T,L,H,W;if(S==="c")z=R(P)+z,P="";else{P=+P;var V=P<0||1/P<0;if(P=isNaN(P)?c:R(Math.abs(P),C),k&&(P=Obe(P)),V&&+P==0&&b!=="+"&&(V=!1),I=(V?b==="("?b:l:b==="-"||b==="("?"":b)+I,z=(S==="s"&&!isNaN(P)&&gy!==void 0?EL[8+gy/3]:"")+z+(V&&b==="("?")":""),B){for(L=-1,H=P.length;++L<H;)if(W=P.charCodeAt(L),48>W||W>57){z=(W===46?a+P.slice(L+1):P.slice(L))+z,P=P.slice(0,L);break}}}N&&!w&&(P=t(P,1/0));var K=I.length+P.length+z.length,M=K<_?new Array(_-K+1).join(x):"";switch(N&&w&&(P=t(M+P,M.length?_-z.length:1/0),M=""),j){case"<":P=I+P+z+M;break;case"=":P=I+M+P+z;break;case"^":P=M.slice(0,K=M.length>>1)+I+P+z+M.slice(K);break;default:P=M+I+P+z;break}return i(P)}return D.toString=function(){return m+""},D}function f(m,g){var x=Math.max(-8,Math.min(8,Math.floor(fm(g)/3)))*3,j=Math.pow(10,-x),b=d((m=np(m),m.type="f",m),{suffix:EL[8+x/3]});return function(y){return b(j*y)}}return{format:d,formatPrefix:f}}var Kx,fA,bK;Mbe({thousands:",",grouping:[3],currency:["$",""]});function Mbe(e){return Kx=Rbe(e),fA=Kx.format,bK=Kx.formatPrefix,Kx}function Dbe(e){return Math.max(0,-fm(Math.abs(e)))}function Lbe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(fm(t)/3)))*3-fm(Math.abs(e)))}function $be(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,fm(t)-fm(e))+1}function vK(e,t,n,s){var a=hC(e,t,n),i;switch(s=np(s??",f"),s.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return s.precision==null&&!isNaN(i=Lbe(a,o))&&(s.precision=i),bK(s,o)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(i=$be(a,Math.max(Math.abs(e),Math.abs(t))))&&(s.precision=i-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(i=Dbe(a))&&(s.precision=i-(s.type==="%")*2);break}}return fA(s)}function vc(e){var t=e.domain;return e.ticks=function(n){var s=t();return mC(s[0],s[s.length-1],n??10)},e.tickFormat=function(n,s){var a=t();return vK(a[0],a[a.length-1],n??10,s)},e.nice=function(n){n==null&&(n=10);var s=t(),a=0,i=s.length-1,o=s[a],l=s[i],c,d,f=10;for(l<o&&(d=o,o=l,l=d,d=a,a=i,i=d);f-- >0;){if(d=fC(o,l,n),d===c)return s[a]=o,s[i]=l,t(s);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return e},e}function xy(){var e=uA();return e.copy=function(){return pg(e,xy())},oi.apply(e,arguments),vc(e)}function wK(e){var t;function n(s){return s==null||isNaN(s=+s)?t:s}return n.invert=n,n.domain=n.range=function(s){return arguments.length?(e=Array.from(s,hy),n):e.slice()},n.unknown=function(s){return arguments.length?(t=s,n):t},n.copy=function(){return wK(e).unknown(t)},e=arguments.length?Array.from(e,hy):[0,1],vc(n)}function jK(e,t){e=e.slice();var n=0,s=e.length-1,a=e[n],i=e[s],o;return i<a&&(o=n,n=s,s=o,o=a,a=i,i=o),e[n]=t.floor(a),e[s]=t.ceil(i),e}function AL(e){return Math.log(e)}function TL(e){return Math.exp(e)}function Bbe(e){return-Math.log(-e)}function Fbe(e){return-Math.exp(-e)}function zbe(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Ube(e){return e===10?zbe:e===Math.E?Math.exp:t=>Math.pow(e,t)}function qbe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function PL(e){return(t,n)=>-e(-t,n)}function hA(e){const t=e(AL,TL),n=t.domain;let s=10,a,i;function o(){return a=qbe(s),i=Ube(s),n()[0]<0?(a=PL(a),i=PL(i),e(Bbe,Fbe)):e(AL,TL),t}return t.base=function(l){return arguments.length?(s=+l,o()):s},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let d=c[0],f=c[c.length-1];const m=f<d;m&&([d,f]=[f,d]);let g=a(d),x=a(f),j,b;const y=l==null?10:+l;let w=[];if(!(s%1)&&x-g<y){if(g=Math.floor(g),x=Math.ceil(x),d>0){for(;g<=x;++g)for(j=1;j<s;++j)if(b=g<0?j/i(-g):j*i(g),!(b<d)){if(b>f)break;w.push(b)}}else for(;g<=x;++g)for(j=s-1;j>=1;--j)if(b=g>0?j/i(-g):j*i(g),!(b<d)){if(b>f)break;w.push(b)}w.length*2<y&&(w=mC(d,f,y))}else w=mC(g,x,Math.min(x-g,y)).map(i);return m?w.reverse():w},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=s===10?"s":","),typeof c!="function"&&(!(s%1)&&(c=np(c)).precision==null&&(c.trim=!0),c=fA(c)),l===1/0)return c;const d=Math.max(1,s*l/t.ticks().length);return f=>{let m=f/i(Math.round(a(f)));return m*s<s-.5&&(m*=s),m<=d?c(f):""}},t.nice=()=>n(jK(n(),{floor:l=>i(Math.floor(a(l))),ceil:l=>i(Math.ceil(a(l)))})),t}function _K(){const e=hA(tv()).domain([1,10]);return e.copy=()=>pg(e,_K()).base(e.base()),oi.apply(e,arguments),e}
918function OL(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function IL(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function pA(e){var t=1,n=e(OL(t),IL(t));return n.constant=function(s){return arguments.length?e(OL(t=+s),IL(t)):t},vc(n)}function NK(){var e=pA(tv());return e.copy=function(){return pg(e,NK()).constant(e.constant())},oi.apply(e,arguments)}function RL(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Kbe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Vbe(e){return e<0?-e*e:e*e}function gA(e){var t=e(Bs,Bs),n=1;function s(){return n===1?e(Bs,Bs):n===.5?e(Kbe,Vbe):e(RL(n),RL(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,s()):n},vc(t)}function xA(){var e=gA(tv());return e.copy=function(){return pg(e,xA()).exponent(e.exponent())},oi.apply(e,arguments),e}function Hbe(){return xA.apply(null,arguments).exponent(.5)}function ML(e){return Math.sign(e)*e*e}function Wbe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function SK(){var e=uA(),t=[0,1],n=!1,s;function a(i){var o=Wbe(e(i));return isNaN(o)?s:n?Math.round(o):o}return a.invert=function(i){return e.invert(ML(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,hy)).map(ML)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(n=!!i,a):n},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(s=i,a):s},a.copy=function(){return SK(e.domain(),t).round(n).clamp(e.clamp()).unknown(s)},oi.apply(a,arguments),vc(a)}function kK(){var e=[],t=[],n=[],s;function a(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o<l;)n[o-1]=Xye(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?s:t[fg(n,o)]}return i.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:e[0],l<n.length?n[l]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(ec),a()},i.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},i.unknown=function(o){return arguments.length?(s=o,i):s},i.quantiles=function(){return n.slice()},i.copy=function(){return kK().domain(e).range(t).unknown(s)},oi.apply(i,arguments)}function CK(){var e=0,t=1,n=1,s=[.5],a=[0,1],i;function o(c){return c!=null&&c<=c?a[fg(s,c,0,n)]:i}function l(){var c=-1;for(s=new Array(n);++c<n;)s[c]=((c+1)*t-(c-n)*e)/(n+1);return o}return o.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},o.range=function(c){return arguments.length?(n=(a=Array.from(c)).length-1,l()):a.slice()},o.invertExtent=function(c){var d=a.indexOf(c);return d<0?[NaN,NaN]:d<1?[e,s[0]]:d>=n?[s[n-1],t]:[s[d-1],s[d]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return s.slice()},o.copy=function(){return CK().domain([e,t]).range(a).unknown(i)},oi.apply(vc(o),arguments)}function EK(){var e=[.5],t=[0,1],n,s=1;function a(i){return i!=null&&i<=i?t[fg(e,i,0,s)]:n}return a.domain=function(i){return arguments.length?(e=Array.from(i),s=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),s=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return EK().domain(e).range(t).unknown(n)},oi.apply(a,arguments)}const xS=new Date,yS=new Date;function Yr(e,t,n,s){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const o=a(i),l=a.ceil(i);return i-o<l-i?o:l},a.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,l)=>{const c=[];if(i=a.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let d;do c.push(d=new Date(+i)),t(i,l),e(i);while(d<i&&i<o);return c},a.filter=i=>Yr(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),n&&(a.count=(i,o)=>(xS.setTime(+i),yS.setTime(+o),e(xS),e(yS),Math.floor(n(xS,yS))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(s?o=>s(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const yy=Yr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);yy.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Yr(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):yy);yy.range;const Lo=1e3,Wa=Lo*60,$o=Wa*60,Ko=$o*24,yA=Ko*7,DL=Ko*30,bS=Ko*365,id=Yr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Lo)},(e,t)=>(t-e)/Lo,e=>e.getUTCSeconds());id.range;const bA=Yr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Lo)},(e,t)=>{e.setTime(+e+t*Wa)},(e,t)=>(t-e)/Wa,e=>e.getMinutes());bA.range;const vA=Yr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Wa)},(e,t)=>(t-e)/Wa,e=>e.getUTCMinutes());vA.range;const wA=Yr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Lo-e.getMinutes()*Wa)},(e,t)=>{e.setTime(+e+t*$o)},(e,t)=>(t-e)/$o,e=>e.getHours());wA.range;const jA=Yr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*$o)},(e,t)=>(t-e)/$o,e=>e.getUTCHours());jA.range;const gg=Yr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Wa)/Ko,e=>e.getDate()-1);gg.range;const nv=Yr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ko,e=>e.getUTCDate()-1);nv.range;const AK=Yr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ko,e=>Math.floor(e/Ko));AK.range;function Vd(e){return Yr(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Wa)/yA)}const rv=Vd(0),by=Vd(1),Gbe=Vd(2),Ybe=Vd(3),hm=Vd(4),Jbe=Vd(5),Qbe=Vd(6);rv.range;by.range;Gbe.range;Ybe.range;hm.range;Jbe.range;Qbe.range;function Hd(e){return Yr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/yA)}
vendor: 10,931 bytes, line 918
918const sv=Hd(0),vy=Hd(1),Xbe=Hd(2),Zbe=Hd(3),pm=Hd(4),eve=Hd(5),tve=Hd(6);sv.range;vy.range;Xbe.range;Zbe.range;pm.range;eve.range;tve.range;const _A=Yr(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());_A.range;const NA=Yr(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());NA.range;const Vo=Yr(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Vo.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Yr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Vo.range;const Ho=Yr(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ho.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Yr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Ho.range;function TK(e,t,n,s,a,i){const o=[[id,1,Lo],[id,5,5*Lo],[id,15,15*Lo],[id,30,30*Lo],[i,1,Wa],[i,5,5*Wa],[i,15,15*Wa],[i,30,30*Wa],[a,1,$o],[a,3,3*$o],[a,6,6*$o],[a,12,12*$o],[s,1,Ko],[s,2,2*Ko],[n,1,yA],[t,1,DL],[t,3,3*DL],[e,1,bS]];function l(d,f,m){const g=f<d;g&&([d,f]=[f,d]);const x=m&&typeof m.range=="function"?m:c(d,f,m),j=x?x.range(d,+f+1):[];return g?j.reverse():j}function c(d,f,m){const g=Math.abs(f-d)/m,x=iA(([,,y])=>y).right(o,g);if(x===o.length)return e.every(hC(d/bS,f/bS,m));if(x===0)return yy.every(Math.max(hC(d,f,m),1));const[j,b]=o[g/o[x-1][2]<o[x][2]/g?x-1:x];return j.every(b)}return[l,c]}const[nve,rve]=TK(Ho,NA,sv,AK,jA,vA),[sve,ave]=TK(Vo,_A,rv,gg,wA,bA);function vS(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function wS(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Jf(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function ive(e){var t=e.dateTime,n=e.date,s=e.time,a=e.periods,i=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,d=Qf(a),f=Xf(a),m=Qf(i),g=Xf(i),x=Qf(o),j=Xf(o),b=Qf(l),y=Xf(l),w=Qf(c),_=Xf(c),N={a:W,A:V,b:K,B:M,c:null,d:UL,e:UL,f:Ave,g:Bve,G:zve,H:kve,I:Cve,j:Eve,L:PK,m:Tve,M:Pve,p:G,q,Q:VL,s:HL,S:Ove,u:Ive,U:Rve,V:Mve,w:Dve,W:Lve,x:null,X:null,y:$ve,Y:Fve,Z:Uve,"%":KL},C={a:F,A:U,b:ee,B:ne,c:null,d:qL,e:qL,f:Hve,g:nwe,G:swe,H:qve,I:Kve,j:Vve,L:IK,m:Wve,M:Gve,p:X,q:ie,Q:VL,s:HL,S:Yve,u:Jve,U:Qve,V:Xve,w:Zve,W:ewe,x:null,X:null,y:twe,Y:rwe,Z:awe,"%":KL},k={a:B,A:D,b:P,B:I,c:z,d:FL,e:FL,f:jve,g:BL,G:$L,H:zL,I:zL,j:yve,L:wve,m:xve,M:bve,p:R,q:gve,Q:Nve,s:Sve,S:vve,u:uve,U:mve,V:fve,w:dve,W:hve,x:L,X:H,y:BL,Y:$L,Z:pve,"%":_ve};N.x=S(n,N),N.X=S(s,N),N.c=S(t,N),C.x=S(n,C),C.X=S(s,C),C.c=S(t,C);function S(Z,ce){return function(le){var re=[],Ue=-1,Ne=0,Oe=Z.length,Me,ue,Ve;for(le instanceof Date||(le=new Date(+le));++Ue<Oe;)Z.charCodeAt(Ue)===37&&(re.push(Z.slice(Ne,Ue)),(ue=LL[Me=Z.charAt(++Ue)])!=null?Me=Z.charAt(++Ue):ue=Me==="e"?" ":"0",(Ve=ce[Me])&&(Me=Ve(le,ue)),re.push(Me),Ne=Ue+1);return re.push(Z.slice(Ne,Ue)),re.join("")}}function A(Z,ce){return function(le){var re=Jf(1900,void 0,1),Ue=T(re,Z,le+="",0),Ne,Oe;if(Ue!=le.length)return null;if("Q"in re)return new Date(re.Q);if("s"in re)return new Date(re.s*1e3+("L"in re?re.L:0));if(ce&&!("Z"in re)&&(re.Z=0),"p"in re&&(re.H=re.H%12+re.p*12),re.m===void 0&&(re.m="q"in re?re.q:0),"V"in re){if(re.V<1||re.V>53)return null;"w"in re||(re.w=1),"Z"in re?(Ne=wS(Jf(re.y,0,1)),Oe=Ne.getUTCDay(),Ne=Oe>4||Oe===0?vy.ceil(Ne):vy(Ne),Ne=nv.offset(Ne,(re.V-1)*7),re.y=Ne.getUTCFullYear(),re.m=Ne.getUTCMonth(),re.d=Ne.getUTCDate()+(re.w+6)%7):(Ne=vS(Jf(re.y,0,1)),Oe=Ne.getDay(),Ne=Oe>4||Oe===0?by.ceil(Ne):by(Ne),Ne=gg.offset(Ne,(re.V-1)*7),re.y=Ne.getFullYear(),re.m=Ne.getMonth(),re.d=Ne.getDate()+(re.w+6)%7)}else("W"in re||"U"in re)&&("w"in re||(re.w="u"in re?re.u%7:"W"in re?1:0),Oe="Z"in re?wS(Jf(re.y,0,1)).getUTCDay():vS(Jf(re.y,0,1)).getDay(),re.m=0,re.d="W"in re?(re.w+6)%7+re.W*7-(Oe+5)%7:re.w+re.U*7-(Oe+6)%7);return"Z"in re?(re.H+=re.Z/100|0,re.M+=re.Z%100,wS(re)):vS(re)}}function T(Z,ce,le,re){for(var Ue=0,Ne=ce.length,Oe=le.length,Me,ue;Ue<Ne;){if(re>=Oe)return-1;if(Me=ce.charCodeAt(Ue++),Me===37){if(Me=ce.charAt(Ue++),ue=k[Me in LL?ce.charAt(Ue++):Me],!ue||(re=ue(Z,le,re))<0)return-1}else if(Me!=le.charCodeAt(re++))return-1}return re}function R(Z,ce,le){var re=d.exec(ce.slice(le));return re?(Z.p=f.get(re[0].toLowerCase()),le+re[0].length):-1}function B(Z,ce,le){var re=x.exec(ce.slice(le));return re?(Z.w=j.get(re[0].toLowerCase()),le+re[0].length):-1}function D(Z,ce,le){var re=m.exec(ce.slice(le));return re?(Z.w=g.get(re[0].toLowerCase()),le+re[0].length):-1}function P(Z,ce,le){var re=w.exec(ce.slice(le));return re?(Z.m=_.get(re[0].toLowerCase()),le+re[0].length):-1}function I(Z,ce,le){var re=b.exec(ce.slice(le));return re?(Z.m=y.get(re[0].toLowerCase()),le+re[0].length):-1}function z(Z,ce,le){return T(Z,t,ce,le)}function L(Z,ce,le){return T(Z,n,ce,le)}function H(Z,ce,le){return T(Z,s,ce,le)}function W(Z){return o[Z.getDay()]}function V(Z){return i[Z.getDay()]}function K(Z){return c[Z.getMonth()]}function M(Z){return l[Z.getMonth()]}function G(Z){return a[+(Z.getHours()>=12)]}function q(Z){return 1+~~(Z.getMonth()/3)}function F(Z){return o[Z.getUTCDay()]}function U(Z){return i[Z.getUTCDay()]}function ee(Z){return c[Z.getUTCMonth()]}function ne(Z){return l[Z.getUTCMonth()]}function X(Z){return a[+(Z.getUTCHours()>=12)]}function ie(Z){return 1+~~(Z.getUTCMonth()/3)}return{format:function(Z){var ce=S(Z+="",N);return ce.toString=function(){return Z},ce},parse:function(Z){var ce=A(Z+="",!1);return ce.toString=function(){return Z},ce},utcFormat:function(Z){var ce=S(Z+="",C);return ce.toString=function(){return Z},ce},utcParse:function(Z){var ce=A(Z+="",!0);return ce.toString=function(){return Z},ce}}}var LL={"-":"",_:" ",0:"0"},ss=/^\s*\d+/,ove=/^%/,lve=/[\\^$*+?|[\]().{}]/g;function Pn(e,t,n){var s=e<0?"-":"",a=(s?-e:e)+"",i=a.length;return s+(i<n?new Array(n-i+1).join(t)+a:a)}function cve(e){return e.replace(lve,"\\$&")}function Qf(e){return new RegExp("^(?:"+e.map(cve).join("|")+")","i")}function Xf(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function dve(e,t,n){var s=ss.exec(t.slice(n,n+1));return s?(e.w=+s[0],n+s[0].length):-1}function uve(e,t,n){var s=ss.exec(t.slice(n,n+1));return s?(e.u=+s[0],n+s[0].length):-1}function mve(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.U=+s[0],n+s[0].length):-1}function fve(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.V=+s[0],n+s[0].length):-1}function hve(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.W=+s[0],n+s[0].length):-1}function $L(e,t,n){var s=ss.exec(t.slice(n,n+4));return s?(e.y=+s[0],n+s[0].length):-1}function BL(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function pve(e,t,n){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return s?(e.Z=s[1]?0:-(s[2]+(s[3]||"00")),n+s[0].length):-1}function gve(e,t,n){var s=ss.exec(t.slice(n,n+1));return s?(e.q=s[0]*3-3,n+s[0].length):-1}function xve(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.m=s[0]-1,n+s[0].length):-1}function FL(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.d=+s[0],n+s[0].length):-1}function yve(e,t,n){var s=ss.exec(t.slice(n,n+3));return s?(e.m=0,e.d=+s[0],n+s[0].length):-1}function zL(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.H=+s[0],n+s[0].length):-1}function bve(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.M=+s[0],n+s[0].length):-1}function vve(e,t,n){var s=ss.exec(t.slice(n,n+2));return s?(e.S=+s[0],n+s[0].length):-1}function wve(e,t,n){var s=ss.exec(t.slice(n,n+3));return s?(e.L=+s[0],n+s[0].length):-1}function jve(e,t,n){var s=ss.exec(t.slice(n,n+6));return s?(e.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function _ve(e,t,n){var s=ove.exec(t.slice(n,n+1));return s?n+s[0].length:-1}function Nve(e,t,n){var s=ss.exec(t.slice(n));return s?(e.Q=+s[0],n+s[0].length):-1}function Sve(e,t,n){var s=ss.exec(t.slice(n));return s?(e.s=+s[0],n+s[0].length):-1}function UL(e,t){return Pn(e.getDate(),t,2)}function kve(e,t){return Pn(e.getHours(),t,2)}function Cve(e,t){return Pn(e.getHours()%12||12,t,2)}function Eve(e,t){return Pn(1+gg.count(Vo(e),e),t,3)}function PK(e,t){return Pn(e.getMilliseconds(),t,3)}function Ave(e,t){return PK(e,t)+"000"}function Tve(e,t){return Pn(e.getMonth()+1,t,2)}function Pve(e,t){return Pn(e.getMinutes(),t,2)}function Ove(e,t){return Pn(e.getSeconds(),t,2)}function Ive(e){var t=e.getDay();return t===0?7:t}function Rve(e,t){return Pn(rv.count(Vo(e)-1,e),t,2)}function OK(e){var t=e.getDay();return t>=4||t===0?hm(e):hm.ceil(e)}function Mve(e,t){return e=OK(e),Pn(hm.count(Vo(e),e)+(Vo(e).getDay()===4),t,2)}function Dve(e){return e.getDay()}function Lve(e,t){return Pn(by.count(Vo(e)-1,e),t,2)}function $ve(e,t){return Pn(e.getFullYear()%100,t,2)}function Bve(e,t){return e=OK(e),Pn(e.getFullYear()%100,t,2)}function Fve(e,t){return Pn(e.getFullYear()%1e4,t,4)}function zve(e,t){var n=e.getDay();return e=n>=4||n===0?hm(e):hm.ceil(e),Pn(e.getFullYear()%1e4,t,4)}function Uve(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Pn(t/60|0,"0",2)+Pn(t%60,"0",2)}function qL(e,t){return Pn(e.getUTCDate(),t,2)}function qve(e,t){return Pn(e.getUTCHours(),t,2)}function Kve(e,t){return Pn(e.getUTCHours()%12||12,t,2)}function Vve(e,t){return Pn(1+nv.count(Ho(e),e),t,3)}function IK(e,t){return Pn(e.getUTCMilliseconds(),t,3)}function Hve(e,t){return IK(e,t)+"000"}function Wve(e,t){return Pn(e.getUTCMonth()+1,t,2)}function Gve(e,t){return Pn(e.getUTCMinutes(),t,2)}function Yve(e,t){return Pn(e.getUTCSeconds(),t,2)}function Jve(e){var t=e.getUTCDay();return t===0?7:t}function Qve(e,t){return Pn(sv.count(Ho(e)-1,e),t,2)}function RK(e){var t=e.getUTCDay();return t>=4||t===0?pm(e):pm.ceil(e)}function Xve(e,t){return e=RK(e),Pn(pm.count(Ho(e),e)+(Ho(e).getUTCDay()===4),t,2)}function Zve(e){return e.getUTCDay()}function ewe(e,t){return Pn(vy.count(Ho(e)-1,e),t,2)}function twe(e,t){return Pn(e.getUTCFullYear()%100,t,2)}function nwe(e,t){return e=RK(e),Pn(e.getUTCFullYear()%100,t,2)}function rwe(e,t){return Pn(e.getUTCFullYear()%1e4,t,4)}function swe(e,t){var n=e.getUTCDay();return e=n>=4||n===0?pm(e):pm.ceil(e),Pn(e.getUTCFullYear()%1e4,t,4)}function awe(){return"+0000"}function KL(){return"%"}function VL(e){return+e}function HL(e){return Math.floor(+e/1e3)}var wu,MK,DK;iwe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
918ay","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function iwe(e){return wu=ive(e),MK=wu.format,wu.parse,DK=wu.utcFormat,wu.utcParse,wu}function owe(e){return new Date(e)}function lwe(e){return e instanceof Date?+e:+new Date(+e)}function SA(e,t,n,s,a,i,o,l,c,d){var f=uA(),m=f.invert,g=f.domain,x=d(".%L"),j=d(":%S"),b=d("%I:%M"),y=d("%I %p"),w=d("%a %d"),_=d("%b %d"),N=d("%B"),C=d("%Y");function k(S){return(c(S)<S?x:l(S)<S?j:o(S)<S?b:i(S)<S?y:s(S)<S?a(S)<S?w:_:n(S)<S?N:C)(S)}return f.invert=function(S){return new Date(m(S))},f.domain=function(S){return arguments.length?g(Array.from(S,lwe)):g().map(owe)},f.ticks=function(S){var A=g();return e(A[0],A[A.length-1],S??10)},f.tickFormat=function(S,A){return A==null?k:d(A)},f.nice=function(S){var A=g();return(!S||typeof S.range!="function")&&(S=t(A[0],A[A.length-1],S??10)),S?g(jK(A,S)):f},f.copy=function(){return pg(f,SA(e,t,n,s,a,i,o,l,c,d))},f}function cwe(){return oi.apply(SA(sve,ave,Vo,_A,rv,gg,wA,bA,id,MK).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function dwe(){return oi.apply(SA(nve,rve,Ho,NA,sv,nv,jA,vA,id,DK).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function av(){var e=0,t=1,n,s,a,i,o=Bs,l=!1,c;function d(m){return m==null||isNaN(m=+m)?c:o(a===0?.5:(m=(i(m)-n)*a,l?Math.max(0,Math.min(1,m)):m))}d.domain=function(m){return arguments.length?([e,t]=m,n=i(e=+e),s=i(t=+t),a=n===s?0:1/(s-n),d):[e,t]},d.clamp=function(m){return arguments.length?(l=!!m,d):l},d.interpolator=function(m){return arguments.length?(o=m,d):o};function f(m){return function(g){var x,j;return arguments.length?([x,j]=g,o=m(x,j),d):[o(0),o(1)]}}return d.range=f(ef),d.rangeRound=f(dA),d.unknown=function(m){return arguments.length?(c=m,d):c},function(m){return i=m,n=m(e),s=m(t),a=n===s?0:1/(s-n),d}}function wc(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function LK(){var e=vc(av()(Bs));return e.copy=function(){return wc(e,LK())},sl.apply(e,arguments)}function $K(){var e=hA(av()).domain([1,10]);return e.copy=function(){return wc(e,$K()).base(e.base())},sl.apply(e,arguments)}function BK(){var e=pA(av());return e.copy=function(){return wc(e,BK()).constant(e.constant())},sl.apply(e,arguments)}function kA(){var e=gA(av());return e.copy=function(){return wc(e,kA()).exponent(e.exponent())},sl.apply(e,arguments)}function uwe(){return kA.apply(null,arguments).exponent(.5)}function FK(){var e=[],t=Bs;function n(s){if(s!=null&&!isNaN(s=+s))return t((fg(e,s,1)-1)/(e.length-1))}return n.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(ec),n},n.interpolator=function(s){return arguments.length?(t=s,n):t},n.range=function(){return e.map((s,a)=>t(a/(e.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(a,i)=>Qye(e,i/s))},n.copy=function(){return FK(t).domain(e)},sl.apply(n,arguments)}function iv(){var e=0,t=.5,n=1,s=1,a,i,o,l,c,d=Bs,f,m=!1,g;function x(b){return isNaN(b=+b)?g:(b=.5+((b=+f(b))-i)*(s*b<s*i?l:c),d(m?Math.max(0,Math.min(1,b)):b))}x.domain=function(b){return arguments.length?([e,t,n]=b,a=f(e=+e),i=f(t=+t),o=f(n=+n),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),s=i<a?-1:1,x):[e,t,n]},x.clamp=function(b){return arguments.length?(m=!!b,x):m},x.interpolator=function(b){return arguments.length?(d=b,x):d};function j(b){return function(y){var w,_,N;return arguments.length?([w,_,N]=y,d=_be(b,[w,_,N]),x):[d(0),d(.5),d(1)]}}return x.range=j(ef),x.rangeRound=j(dA),x.unknown=function(b){return arguments.length?(g=b,x):g},function(b){return f=b,a=b(e),i=b(t),o=b(n),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),s=i<a?-1:1,x}}function zK(){var e=vc(iv()(Bs));return e.copy=function(){return wc(e,zK())},sl.apply(e,arguments)}function UK(){var e=hA(iv()).domain([.1,1,10]);return e.copy=function(){return wc(e,UK()).base(e.base())},sl.apply(e,arguments)}function qK(){var e=pA(iv());return e.copy=function(){return wc(e,qK()).constant(e.constant())},sl.apply(e,arguments)}function CA(){var e=gA(iv());return e.copy=function(){return wc(e,CA()).exponent(e.exponent())},sl.apply(e,arguments)}function mwe(){return CA.apply(null,arguments).exponent(.5)}const WL=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Xh,scaleDiverging:zK,scaleDivergingLog:UK,scaleDivergingPow:CA,scaleDivergingSqrt:mwe,scaleDivergingSymlog:qK,scaleIdentity:wK,scaleImplicit:pC,scaleLinear:xy,scaleLog:_K,scaleOrdinal:oA,scalePoint:Ch,scalePow:xA,scaleQuantile:kK,scaleQuantize:CK,scaleRadial:SK,scaleSequential:LK,scaleSequentialLog:$K,scaleSequentialPow:kA,scaleSequentialQuantile:FK,scaleSequentialSqrt:uwe,scaleSequentialSymlog:BK,scaleSqrt:Hbe,scaleSymlog:NK,scaleThreshold:EK,scaleTime:cwe,scaleUtc:dwe,tickFormat:vK},Symbol.toStringTag,{value:"Module"}));var jS,GL;function KK(){if(GL)return jS;GL=1;var e=Jm();function t(n,s,a){for(var i=-1,o=n.length;++i<o;){var l=n[i],c=s(l);if(c!=null&&(d===void 0?c===c&&!e(c):a(c,d)))var d=c,f=l}return f}return jS=t,jS}var _S,YL;function fwe(){if(YL)return _S;YL=1;function e(t,n){return t>n}return _S=e,_S}var NS,JL;function hwe(){if(JL)return NS;JL=1;var e=KK(),t=fwe(),n=Xm();function s(a){return a&&a.length?e(a,n,t):void 0}return NS=s,NS}var pwe=hwe();const ov=Un(pwe);var SS,QL;function gwe(){if(QL)return SS;QL=1;function e(t,n){return t<n}return SS=e,SS}var kS,XL;function xwe(){if(XL)return kS;XL=1;var e=KK(),t=gwe(),n=Xm();function s(a){return a&&a.length?e(a,n,t):void 0}return kS=s,kS}var ywe=xwe();const lv=Un(ywe);var CS,ZL;function bwe(){if(ZL)return CS;ZL=1;var e=qE(),t=bc(),n=eK(),s=aa();function a(i,o){var l=s(i)?e:n;return l(i,t(o,3))}return CS=a,CS}var ES,e$;
vendor: 224,511 bytes, lines 918-967
918function vwe(){if(e$)return ES;e$=1;var e=Xq(),t=bwe();function n(s,a){return e(t(s,a),1)}return ES=n,ES}var wwe=vwe();const jwe=Un(wwe);var AS,t$;function _we(){if(t$)return AS;t$=1;var e=nA();function t(n,s){return e(n,s)}return AS=t,AS}var Nwe=_we();const cv=Un(Nwe);var tf=1e9,Swe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},AA,cr=!0,ai="[DecimalError] ",jd=ai+"Invalid argument: ",EA=ai+"Exponent out of range: ",nf=Math.floor,Jc=Math.pow,kwe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ya,es=1e7,ir=7,VK=9007199254740991,wy=nf(VK/ir),St={};St.absoluteValue=St.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};St.comparedTo=St.cmp=function(e){var t,n,s,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(s=i.d.length,a=e.d.length,t=0,n=s<a?s:a;t<n;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return s===a?0:s>a^i.s<0?1:-1};St.decimalPlaces=St.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*ir;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};St.dividedBy=St.div=function(e){return zo(this,new this.constructor(e))};St.dividedToIntegerBy=St.idiv=function(e){var t=this,n=t.constructor;return Qn(zo(t,new n(e),0,1),n.precision)};St.equals=St.eq=function(e){return!this.cmp(e)};St.exponent=function(){return $r(this)};St.greaterThan=St.gt=function(e){return this.cmp(e)>0};St.greaterThanOrEqualTo=St.gte=function(e){return this.cmp(e)>=0};St.isInteger=St.isint=function(){return this.e>this.d.length-2};St.isNegative=St.isneg=function(){return this.s<0};St.isPositive=St.ispos=function(){return this.s>0};St.isZero=function(){return this.s===0};St.lessThan=St.lt=function(e){return this.cmp(e)<0};St.lessThanOrEqualTo=St.lte=function(e){return this.cmp(e)<1};St.logarithm=St.log=function(e){var t,n=this,s=n.constructor,a=s.precision,i=a+5;if(e===void 0)e=new s(10);else if(e=new s(e),e.s<1||e.eq(ya))throw Error(ai+"NaN");if(n.s<1)throw Error(ai+(n.s?"NaN":"-Infinity"));return n.eq(ya)?new s(0):(cr=!1,t=zo(rp(n,i),rp(e,i),i),cr=!0,Qn(t,a))};St.minus=St.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?GK(t,e):HK(t,(e.s=-e.s,e))};St.modulo=St.mod=function(e){var t,n=this,s=n.constructor,a=s.precision;if(e=new s(e),!e.s)throw Error(ai+"NaN");return n.s?(cr=!1,t=zo(n,e,0,1).times(e),cr=!0,n.minus(t)):Qn(new s(n),a)};St.naturalExponential=St.exp=function(){return WK(this)};St.naturalLogarithm=St.ln=function(){return rp(this)};St.negated=St.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};St.plus=St.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?HK(t,e):GK(t,(e.s=-e.s,e))};St.precision=St.sd=function(e){var t,n,s,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(jd+e);if(t=$r(a)+1,s=a.d.length-1,n=s*ir+1,s=a.d[s],s){for(;s%10==0;s/=10)n--;for(s=a.d[0];s>=10;s/=10)n++}return e&&t>n?t:n};St.squareRoot=St.sqrt=function(){var e,t,n,s,a,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(ai+"NaN")}for(e=$r(l),cr=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=Ji(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=nf((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),s=new c(t)):s=new c(a.toString()),n=c.precision,a=o=n+3;;)if(i=s,s=i.plus(zo(l,i,o+2)).times(.5),Ji(i.d).slice(0,o)===(t=Ji(s.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(Qn(i,n+1,0),i.times(i).eq(l)){s=i;break}}else if(t!="9999")break;o+=4}return cr=!0,Qn(s,n)};St.times=St.mul=function(e){var t,n,s,a,i,o,l,c,d,f=this,m=f.constructor,g=f.d,x=(e=new m(e)).d;if(!f.s||!e.s)return new m(0);for(e.s*=f.s,n=f.e+e.e,c=g.length,d=x.length,c<d&&(i=g,g=x,x=i,o=c,c=d,d=o),i=[],o=c+d,s=o;s--;)i.push(0);for(s=d;--s>=0;){for(t=0,a=c+s;a>s;)l=i[a]+x[s]*g[a-s-1]+t,i[a--]=l%es|0,t=l/es|0;i[a]=(i[a]+t)%es|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,cr?Qn(e,m.precision):e};St.toDecimalPlaces=St.todp=function(e,t){var n=this,s=n.constructor;return n=new s(n),e===void 0?n:(lo(e,0,tf),t===void 0?t=s.rounding:lo(t,0,8),Qn(n,e+$r(n)+1,t))};St.toExponential=function(e,t){var n,s=this,a=s.constructor;return e===void 0?n=Pd(s,!0):(lo(e,0,tf),t===void 0?t=a.rounding:lo(t,0,8),s=Qn(new a(s),e+1,t),n=Pd(s,!0,e+1)),n};St.toFixed=function(e,t){var n,s,a=this,i=a.constructor;return e===void 0?Pd(a):(lo(e,0,tf),t===void 0?t=i.rounding:lo(t,0,8),s=Qn(new i(a),e+$r(a)+1,t),n=Pd(s.abs(),!1,e+$r(s)+1),a.isneg()&&!a.isZero()?"-"+n:n)};St.toInteger=St.toint=function(){var e=this,t=e.constructor;return Qn(new t(e),$r(e)+1,t.rounding)};St.toNumber=function(){return+this};St.toPower=St.pow=function(e){var t,n,s,a,i,o,l=this,c=l.constructor,d=12,f=+(e=new c(e));if(!e.s)return new c(ya);if(l=new c(l),!l.s){if(e.s<1)throw Error(ai+"Infinity");return l}if(l.eq(ya))return l;if(s=c.precision,e.eq(ya))return Qn(l,s);if(t=e.e,n=e.d.length-1,o=t>=n,i=l.s,o){if((n=f<0?-f:f)<=VK){for(a=new c(ya),t=Math.ceil(s/ir+4),cr=!1;n%2&&(a=a.times(l),r$(a.d,t)),n=nf(n/2),n!==0;)l=l.times(l),r$(l.d,t);return cr=!0,e.s<0?new c(ya).div(a):Qn(a,s)}}else if(i<0)throw Error(ai+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,cr=!1,a=e.times(rp(l,s+d)),cr=!0,a=WK(a),a.s=i,a};St.toPrecision=function(e,t){var n,s,a=this,i=a.constructor;return e===void 0?(n=$r(a),s=Pd(a,n<=i.toExpNeg||n>=i.toExpPos)):(lo(e,1,tf),t===void 0?t=i.rounding:lo(t,0,8),a=Qn(new i(a),e,t),n=$r(a),s=Pd(a,e<=n||n<=i.toExpNeg,e)),s};St.toSignificantDigits=St.tosd=function(e,t){var n=this,s=n.constructor;return e===void 0?(e=s.precision,t=s.rounding):(lo(e,1,tf),t===void 0?t=s.rounding:lo(t,0,8)),Qn(new s(n),e,t)};St.toString=St.valueOf=St.val=St.toJSON=St[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=$r(e),n=e.constructor;return Pd(e,t<=n.toExpNeg||t>=n.toExpPos)};function HK(e,t){var n,s,a,i,o,l,c,d,f=e.constructor,m=f.precision;if(!e.s||!t.s)return t.s||(t=new f(e)),cr?Qn(t,m):t;if(c=e.d,d=t.d,o=e.e,a=t.e,c=c.slice(),i=o-a,i){for(i<0?(s=c,i=-i,l=d.length):(s=d,a=o,l=c.length),o=Math.ceil(m/ir),l=o>l?o+1:l+1,i>l&&(i=l,s.length=1),s.reverse();i--;)s.push(0);s.reverse()}for(l=c.length,i=d.length,l-i<0&&(i=l,s=d,d=c,c=s),n=0;i;)n=(c[--i]=c[i]+d[i]+n)/es|0,c[i]%=es;for(n&&(c.unshift(n),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,cr?Qn(t,m):t}function lo(e,t,n){if(e!==~~e||e<t||e>n)throw Error(jd+e)}function Ji(e){var t,n,s,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)s=e[t]+"",n=ir-s.length,n&&(i+=Il(n)),i+=s;o=e[t],s=o+"",n=ir-s.length,n&&(i+=Il(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var zo=(function(){function e(s,a){var i,o=0,l=s.length;for(s=s.slice();l--;)i=s[l]*a+o,s[l]=i%es|0,o=i/es|0;return o&&s.unshift(o),s}function t(s,a,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(s[l]!=a[l]){c=s[l]>a[l]?1:-1;break}return c}function n(s,a,i){for(var o=0;i--;)s[i]-=o,o=s[i]<a[i]?1:0,s[i]=o*es+s[i]-a[i];for(;!s[0]&&s.length>1;)s.shift()}return function(s,a,i,o){var l,c,d,f,m,g,x,j,b,y,w,_,N,C,k,S,A,T,R=s.constructor,B=s.s==a.s?1:-1,D=s.d,P=a.d;if(!s.s)return new R(s);if(!a.s)throw Error(ai+"Division by zero");for(c=s.e-a.e,A=P.length,k=D.length,x=new R(B),j=x.d=[],d=0;P[d]==(D[d]||0);)++d;if(P[d]>(D[d]||0)&&--c,i==null?_=i=R.precision:o?_=i+($r(s)-$r(a))+1:_=i,_<0)return new R(0);if(_=_/ir+2|0,d=0,A==1)for(f=0,P=P[0],_++;(d<k||f)&&_--;d++)N=f*es+(D[d]||0),j[d]=N/P|0,f=N%P|0;else{for(f=es/(P[0]+1)|0,f>1&&(P=e(P,f),D=e(D,f),A=P.length,k=D.length),C=A,b=D.slice(0,A),y=b.length;y<A;)b[y++]=0;T=P.slice(),T.unshift(0),S=P[0],P[1]>=es/2&&++S;do f=0,l=t(P,b,A,y),l<0?(w=b[0],A!=y&&(w=w*es+(b[1]||0)),f=w/S|0,f>1?(f>=es&&(f=es-1),m=e(P,f),g=m.length,y=b.length,l=t(m,b,g,y),l==1&&(f--,n(m,A<g?T:P,g))):(f==0&&(l=f=1),m=P.slice()),g=m.length,g<y&&m.unshift(0),n(b,m,y),l==-1&&(y=b.length,l=t(P,b,A,y),l<1&&(f++,n(b,A<y?T:P,y))),y=b.length):l===0&&(f++,b=[0]),j[d++]=f,l&&b[0]?b[y++]=D[C]||0:(b=[D[C]],y=1);while((C++<k||b[0]!==void 0)&&_--)}return j[0]||j.shift(),x.e=c,Qn(x,o?i+$r(x)+1:i)}})();function WK(e,t){var n,s,a,i,o,l,c=0,d=0,f=e.constructor,m=f.precision;if($r(e)>16)throw Error(EA+$r(e));if(!e.s)return new f(ya);for(cr=!1,l=m,o=new f(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(s=Math.log(Jc(2,d))/Math.LN10*2+5|0,l+=s,n=a=i=new f(ya),f.precision=l;;){if(a=Qn(a.times(e),l),n=n.times(++c),o=i.plus(zo(a,n,l)),Ji(o.d).slice(0,l)===Ji(i.d).slice(0,l)){for(;d--;)i=Qn(i.times(i),l);return f.precision=m,t==null?(cr=!0,Qn(i,m)):i}i=o}}function $r(e){for(var t=e.e*ir,n=e.d[0];n>=10;n/=10)t++;return t}function TS(e,t,n){if(t>e.LN10.sd())throw cr=!0,n&&(e.precision=n),Error(ai+"LN10 precision limit exceeded");return Qn(new e(e.LN10),t)}function Il(e){for(var t="";e--;)t+="0";return t}function rp(e,t){var n,s,a,i,o,l,c,d,f,m=1,g=10,x=e,j=x.d,b=x.constructor,y=b.precision;if(x.s<1)throw Error(ai+(x.s?"NaN":"-Infinity"));if(x.eq(ya))return new b(0);if(t==null?(cr=!1,d=y):d=t,x.eq(10))return t==null&&(cr=!0),TS(b,d);if(d+=g,b.precision=d,n=Ji(j),s=n.charAt(0),i=$r(x),Math.abs(i)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)x=x.times(e),n=Ji(x.d),s=n.charAt(0),m++;i=$r(x),s>1?(x=new b("0."+n),i++):x=new b(s+"."+n.slice(1))}else return c=TS(b,d+2,y).times(i+""),x=rp(new b(s+"."+n.slice(1)),d-g).plus(c),b.precision=y,t==null?(cr=!0,Qn(x,y)):x;for(l=o=x=zo(x.minus(ya),x.plus(ya),d),f=Qn(x.times(x),d),a=3;;){if(o=Qn(o.times(f),d),c=l.plus(zo(o,new b(a),d)),Ji(c.d).slice(0,d)===Ji(l.d).slice(0,d))return l=l.times(2),i!==0&&(l=l.plus(TS(b,d+2,y).times(i+""))),l=zo(l,new b(m),d),b.precision=y,t==null?(cr=!0,Qn(l,y)):l;l=c,a+=2}}function n$(e,t){var n,s,a;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(s=t.search(/e/i))>0?(n<0&&(n=s),n+=+t.slice(s+1),t=t.substring(0,s)):n<0&&(n=t.length),s=0;t.charCodeAt(s)===48;)++s;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(s,a),t){if(a-=s,n=n-s-1,e.e=nf(n/ir),e.d=[],s=(n+1)%ir,n<0&&(s+=ir),s<a){for(s&&e.d.push(+t.slice(0,s)),a-=ir;s<a;)e.d.push(+t.slice(s,s+=ir));t=t.slice(s),s=ir-t.length}else s-=a;for(;s--;)t+="0";if(e.d.push(+t),cr&&(e.e>wy||e.e<-wy))throw Error(EA+n)}else e.s=0,e.e=0,e.d=[0];return e}function Qn(e,t,n){var s,a,i,o,l,c,d,f,m=e.d;for(o=1,i=m[0];i>=10;i/=10)o++;if(s=t-o,s<0)s+=ir,a=t,d=m[f=0];else{if(f=Math.ceil((s+1)/ir),i=m.length,f>=i)return e;for(d=i=m[f],o=1;i>=10;i/=10)o++;s%=ir,a=s-ir+o}if(n!==void 0&&(i=Jc(10,o-a-1),l=d/i%10|0,c=t<0||m[f+1]!==void 0||d%i,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(s>0?a>0?d/Jc(10,o-a):0:m[f-1])%10&1||n==(e.s<0?8:7))),t<1||!m[0])return c?(i=$r(e),m.length=1,t=t-i-1,m[0]=Jc(10,(ir-t%ir)%ir),e.e=nf(-t/ir)||0):(m.length=1,m[0]=e.e=e.s=0),e;if(s==0?(m.length=f,i=1,f--):(m.length=f+1,i=Jc(10,ir-s),m[f]=a>0?(d/Jc(10,o-a)%Jc(10,a)|0)*i:0),c)for(;;)if(f==0){(m[0]+=i)==es&&(m[0]=1,++e.e);break}else{if(m[f]+=i,m[f]!=es)break;m[f--]=0,i=1}for(s=m.length;m[--s]===0;)m.pop();if(cr&&(e.e>wy||e.e<-wy))throw Error(EA+$r(e));return e}function GK(e,t){var n,s,a,i,o,l,c,d,f,m,g=e.constructor,x=g.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new g(e),cr?Qn(t,x):t;if(c=e.d,m=t.d,s=t.e,d=e.e,c=c.slice(),o=d-s,o){for(f=o<0,f?(n=c,o=-o,l=m.length):(n=m,s=d,l=c.length),a=Math.max(Math.ceil(x/ir),l)+2,o>a&&(o=a,n.length=1),n.reverse(),a=o;a--;)n.push(0);n.reverse()}else{for(a=c.length,l=m.length,f=a<l,f&&(l=a),a=0;a<l;a++)if(c[a]!=m[a]){f=c[a]<m[a];break}o=0}for(f&&(n=c,c=m,m=n,t.s=-t.s),l=c.length,a=m.length-l;a>0;--a)c[l++]=0;for(a=m.length;a>o;){if(c[--a]<m[a]){for(i=a;i&&c[--i]===0;)c[i]=es-1;--c[i],c[a]+=es}c[a]-=m[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--s;return c[0]?(t.d=c,t.e=s,cr?Qn(t,x):t):new g(0)}function Pd(e,t,n){var s,a=$r(e),i=Ji(e.d),o=i.length;return t?(n&&(s=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+Il(s):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+Il(-a-1)+i,n&&(s=n-o)>0&&(i+=Il(s))):a>=o?(i+=Il(a+1-o),n&&(s=n-a-1)>0&&(i=i+"."+Il(s))):((s=a+1)<o&&(i=i.slice(0,s)+"."+i.slice(s)),n&&(s=n-o)>0&&(a+1===o&&(i+="."),i+=Il(s))),e.s<0?"-"+i:i}function r$(e,t){if(e.length>t)return e.length=t,!0}function YK(e){var t,n,s;function a(i){var o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,i instanceof a){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(jd+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return n$(o,i.toString())}else if(typeof i!="string")throw Error(jd+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,kwe.test(i))n$(o,i);else throw Error(jd+i)}if(a.prototype=St,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=YK,a.config=a.set=Cwe,e===void 0&&(e={}),e)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<s.length;)e.hasOwnProperty(n=s[t++])||(e[n]=this[n]);return a.config(e),a}function Cwe(e){if(!e||typeof e!="object")throw Error(ai+"Object expected");var t,n,s,a=["precision",1,tf,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((s=e[n=a[t]])!==void 0)if(nf(s)===s&&s>=a[t+1]&&s<=a[t+2])this[n]=s;else throw Error(jd+n+": "+s);if((s=e[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(jd+n+": "+s);return this}var AA=YK(Swe);ya=new AA(1);const Gn=AA;function Ewe(e){return Owe(e)||Pwe(e)||Twe(e)||Awe()}function Awe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
919In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Twe(e,t){if(e){if(typeof e=="string")return bC(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 bC(e,t)}}function Pwe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Owe(e){if(Array.isArray(e))return bC(e)}function bC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var Iwe=function(t){return t},JK={},QK=function(t){return t===JK},s$=function(t){return function n(){return arguments.length===0||arguments.length===1&&QK(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},Rwe=function e(t,n){return t===1?n:s$(function(){for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];var o=a.filter(function(l){return l!==JK}).length;return o>=t?n.apply(void 0,a):e(t-o,s$(function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var f=a.map(function(m){return QK(m)?c.shift():m});return n.apply(void 0,Ewe(f).concat(c))}))})},dv=function(t){return Rwe(t.length,t)},vC=function(t,n){for(var s=[],a=t;a<n;++a)s[a-t]=a;return s},Mwe=dv(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),Dwe=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];if(!n.length)return Iwe;var a=n.reverse(),i=a[0],o=a.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},wC=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},XK=function(t){var n=null,s=null;return function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return n&&i.every(function(l,c){return l===n[c]})||(n=i,s=t.apply(void 0,i)),s}};function Lwe(e){var t;return e===0?t=1:t=Math.floor(new Gn(e).abs().log(10).toNumber())+1,t}function $we(e,t,n){for(var s=new Gn(e),a=0,i=[];s.lt(t)&&a<1e5;)i.push(s.toNumber()),s=s.add(n),a++;return i}var Bwe=dv(function(e,t,n){var s=+e,a=+t;return s+n*(a-s)}),Fwe=dv(function(e,t,n){var s=t-+e;return s=s||1/0,(n-e)/s}),zwe=dv(function(e,t,n){var s=t-+e;return s=s||1/0,Math.max(0,Math.min(1,(n-e)/s))});const uv={rangeStep:$we,getDigitCount:Lwe,interpolateNumber:Bwe,uninterpolateNumber:Fwe,uninterpolateTruncation:zwe};function jC(e){return Kwe(e)||qwe(e)||ZK(e)||Uwe()}function Uwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
920In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qwe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Kwe(e){if(Array.isArray(e))return _C(e)}function sp(e,t){return Wwe(e)||Hwe(e,t)||ZK(e,t)||Vwe()}function Vwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
921In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZK(e,t){if(e){if(typeof e=="string")return _C(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 _C(e,t)}}function _C(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function Hwe(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,a=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(s=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));s=!0);}catch(c){a=!0,i=c}finally{try{!s&&o.return!=null&&o.return()}finally{if(a)throw i}}return n}}function Wwe(e){if(Array.isArray(e))return e}function e9(e){var t=sp(e,2),n=t[0],s=t[1],a=n,i=s;return n>s&&(a=s,i=n),[a,i]}function t9(e,t,n){if(e.lte(0))return new Gn(0);var s=uv.getDigitCount(e.toNumber()),a=new Gn(10).pow(s),i=e.div(a),o=s!==1?.05:.1,l=new Gn(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(a);return t?c:new Gn(Math.ceil(c))}function Gwe(e,t,n){var s=1,a=new Gn(e);if(!a.isint()&&n){var i=Math.abs(e);i<1?(s=new Gn(10).pow(uv.getDigitCount(e)-1),a=new Gn(Math.floor(a.div(s).toNumber())).mul(s)):i>1&&(a=new Gn(Math.floor(e)))}else e===0?a=new Gn(Math.floor((t-1)/2)):n||(a=new Gn(Math.floor(e)));var o=Math.floor((t-1)/2),l=Dwe(Mwe(function(c){return a.add(new Gn(c-o).mul(s)).toNumber()}),vC);return l(0,t)}function n9(e,t,n,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Gn(0),tickMin:new Gn(0),tickMax:new Gn(0)};var i=t9(new Gn(t).sub(e).div(n-1),s,a),o;e<=0&&t>=0?o=new Gn(0):(o=new Gn(e).add(t).div(2),o=o.sub(new Gn(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new Gn(t).sub(o).div(i).toNumber()),d=l+c+1;return d>n?n9(e,t,n,s,a+1):(d<n&&(c=t>0?c+(n-d):c,l=t>0?l:l+(n-d)),{step:i,tickMin:o.sub(new Gn(l).mul(i)),tickMax:o.add(new Gn(c).mul(i))})}function Ywe(e){var t=sp(e,2),n=t[0],s=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(a,2),l=e9([n,s]),c=sp(l,2),d=c[0],f=c[1];if(d===-1/0||f===1/0){var m=f===1/0?[d].concat(jC(vC(0,a-1).map(function(){return 1/0}))):[].concat(jC(vC(0,a-1).map(function(){return-1/0})),[f]);return n>s?wC(m):m}if(d===f)return Gwe(d,a,i);var g=n9(d,f,o,i),x=g.step,j=g.tickMin,b=g.tickMax,y=uv.rangeStep(j,b.add(new Gn(.1).mul(x)),x);return n>s?wC(y):y}function Jwe(e,t){var n=sp(e,2),s=n[0],a=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=e9([s,a]),l=sp(o,2),c=l[0],d=l[1];if(c===-1/0||d===1/0)return[s,a];if(c===d)return[c];var f=Math.max(t,2),m=t9(new Gn(d).sub(c).div(f-1),i,0),g=[].concat(jC(uv.rangeStep(new Gn(c),new Gn(d).sub(new Gn(.99).mul(m)),m)),[d]);return s>a?wC(g):g}var Qwe=XK(Ywe),Xwe=XK(Jwe),Zwe="Invariant failed";function ic(e,t){throw new Error(Zwe)}var eje=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function gm(e){"@babel/helpers - typeof";return gm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gm(e)}function jy(){return jy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},jy.apply(this,arguments)}function tje(e,t){return aje(e)||sje(e,t)||rje(e,t)||nje()}function nje(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
922In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rje(e,t){if(e){if(typeof e=="string")return a$(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 a$(e,t)}}function a$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function sje(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function aje(e){if(Array.isArray(e))return e}function ije(e,t){if(e==null)return{};var n=oje(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function oje(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function lje(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cje(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,a9(s.key),s)}}function dje(e,t,n){return t&&cje(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function uje(e,t,n){return t=_y(t),mje(e,r9()?Reflect.construct(t,n||[],_y(e).constructor):t.apply(e,n))}function mje(e,t){if(t&&(gm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fje(e)}function fje(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(r9=function(){return!!e})()}function _y(e){return _y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_y(e)}function hje(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&NC(e,t)}function NC(e,t){return NC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},NC(e,t)}function s9(e,t,n){return t=a9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a9(e){var t=pje(e,"string");return gm(t)=="symbol"?t:t+""}function pje(e,t){if(gm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(gm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var xg=(function(e){function t(){return lje(this,t),uje(this,t,arguments)}return hje(t,e),dje(t,[{key:"render",value:function(){var s=this.props,a=s.offset,i=s.layout,o=s.width,l=s.dataKey,c=s.data,d=s.dataPointFormatter,f=s.xAxis,m=s.yAxis,g=ije(s,eje),x=jn(g,!1);this.props.direction==="x"&&f.type!=="number"&&ic();var j=c.map(function(b){var y=d(b,l),w=y.x,_=y.y,N=y.value,C=y.errorVal;if(!C)return null;var k=[],S,A;if(Array.isArray(C)){var T=tje(C,2);S=T[0],A=T[1]}else S=A=C;if(i==="vertical"){var R=f.scale,B=_+a,D=B+o,P=B-o,I=R(N-S),z=R(N+A);k.push({x1:z,y1:D,x2:z,y2:P}),k.push({x1:I,y1:B,x2:z,y2:B}),k.push({x1:I,y1:D,x2:I,y2:P})}else if(i==="horizontal"){var L=m.scale,H=w+a,W=H-o,V=H+o,K=L(N-S),M=L(N+A);k.push({x1:W,y1:M,x2:V,y2:M}),k.push({x1:H,y1:K,x2:H,y2:M}),k.push({x1:W,y1:K,x2:V,y2:K})}return xe.createElement(Cr,jy({className:"recharts-errorBar",key:"bar-".concat(k.map(function(G){return"".concat(G.x1,"-").concat(G.x2,"-").concat(G.y1,"-").concat(G.y2)}))},x),k.map(function(G){return xe.createElement("line",jy({},G,{key:"line-".concat(G.x1,"-").concat(G.x2,"-").concat(G.y1,"-").concat(G.y2)}))}))});return xe.createElement(Cr,{className:"recharts-errorBars"},j)}}])})(xe.Component);s9(xg,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});s9(xg,"displayName","ErrorBar");function ap(e){"@babel/helpers - typeof";return ap=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ap(e)}function i$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Kc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?i$(Object(n),!0).forEach(function(s){gje(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function gje(e,t,n){return t=xje(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xje(e){var t=yje(e,"string");return ap(t)=="symbol"?t:t+""}function yje(e,t){if(ap(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(ap(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var i9=function(t){var n=t.children,s=t.formattedGraphicalItems,a=t.legendWidth,i=t.legendContent,o=ga(n,Xl);if(!o)return null;var l=Xl.defaultProps,c=l!==void 0?Kc(Kc({},l),o.props):{},d;return o.props&&o.props.payload?d=o.props&&o.props.payload:i==="children"?d=(s||[]).reduce(function(f,m){var g=m.item,x=m.props,j=x.sectors||x.data||[];return f.concat(j.map(function(b){return{type:o.props.iconType||g.props.legendType,value:b.name,color:b.fill,payload:b}}))},[]):d=(s||[]).map(function(f){var m=f.item,g=m.type.defaultProps,x=g!==void 0?Kc(Kc({},g),m.props):{},j=x.dataKey,b=x.name,y=x.legendType,w=x.hide;return{inactive:w,dataKey:j,type:c.iconType||y||"square",color:TA(m),value:b||j,payload:x}}),Kc(Kc(Kc({},c),Xl.getWithHeight(o,a)),{},{payload:d,item:o})};function ip(e){"@babel/helpers - typeof";return ip=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ip(e)}function o$(e){return jje(e)||wje(e)||vje(e)||bje()}function bje(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
923In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vje(e,t){if(e){if(typeof e=="string")return SC(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 SC(e,t)}}function wje(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function jje(e){if(Array.isArray(e))return SC(e)}function SC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function l$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function jr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?l$(Object(n),!0).forEach(function(s){qu(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function qu(e,t,n){return t=_je(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _je(e){var t=Nje(e,"string");return ip(t)=="symbol"?t:t+""}function Nje(e,t){if(ip(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(ip(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ka(e,t,n){return hn(e)||hn(t)?n:Wr(t)?Ya(e,t,n):gn(t)?t(e):n}function Eh(e,t,n,s){var a=jwe(e,function(l){return ka(l,t)});if(n==="number"){var i=a.filter(function(l){return ht(l)||parseFloat(l)});return i.length?[lv(i),ov(i)]:[1/0,-1/0]}var o=s?a.filter(function(l){return!hn(l)}):a;return o.map(function(l){return Wr(l)||l instanceof Date?l:""})}var Sje=function(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,d=0;d<l;d++){var f=d>0?a[d-1].coordinate:a[l-1].coordinate,m=a[d].coordinate,g=d>=l-1?a[0].coordinate:a[d+1].coordinate,x=void 0;if(Si(m-f)!==Si(g-m)){var j=[];if(Si(g-m)===Si(c[1]-c[0])){x=g;var b=m+c[1]-c[0];j[0]=Math.min(b,(b+f)/2),j[1]=Math.max(b,(b+f)/2)}else{x=f;var y=g+c[1]-c[0];j[0]=Math.min(m,(y+m)/2),j[1]=Math.max(m,(y+m)/2)}var w=[Math.min(m,(x+m)/2),Math.max(m,(x+m)/2)];if(t>w[0]&&t<=w[1]||t>=j[0]&&t<=j[1]){o=a[d].index;break}}else{var _=Math.min(f,g),N=Math.max(f,g);if(t>(_+m)/2&&t<=(N+m)/2){o=a[d].index;break}}}else for(var C=0;C<l;C++)if(C===0&&t<=(s[C].coordinate+s[C+1].coordinate)/2||C>0&&C<l-1&&t>(s[C].coordinate+s[C-1].coordinate)/2&&t<=(s[C].coordinate+s[C+1].coordinate)/2||C===l-1&&t>(s[C].coordinate+s[C-1].coordinate)/2){o=s[C].index;break}return o},TA=function(t){var n,s=t,a=s.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?jr(jr({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(a){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},kje=function(t){var n=t.barSize,s=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var o={},l=Object.keys(i),c=0,d=l.length;c<d;c++)for(var f=i[l[c]].stackGroups,m=Object.keys(f),g=0,x=m.length;g<x;g++){var j=f[m[g]],b=j.items,y=j.cateAxisId,w=b.filter(function(A){return Fo(A.type).indexOf("Bar")>=0});if(w&&w.length){var _=w[0].type.defaultProps,N=_!==void 0?jr(jr({},_),w[0].props):w[0].props,C=N.barSize,k=N[y];o[k]||(o[k]=[]);var S=hn(C)?n:C;o[k].push({item:w[0],stackList:w.slice(1),barSize:hn(S)?void 0:Td(S,s,0)})}}return o},Cje=function(t){var n=t.barGap,s=t.barCategoryGap,a=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var d=Td(n,a,0,!0),f,m=[];if(o[0].barSize===+o[0].barSize){var g=!1,x=a/c,j=o.reduce(function(C,k){return C+k.barSize||0},0);j+=(c-1)*d,j>=a&&(j-=(c-1)*d,d=0),j>=a&&x>0&&(g=!0,x*=.9,j=c*x);var b=(a-j)/2>>0,y={offset:b-d,size:0};f=o.reduce(function(C,k){var S={item:k.item,position:{offset:y.offset+y.size+d,size:g?x:k.barSize}},A=[].concat(o$(C),[S]);return y=A[A.length-1].position,k.stackList&&k.stackList.length&&k.stackList.forEach(function(T){A.push({item:T,position:y})}),A},m)}else{var w=Td(s,a,0,!0);a-2*w-(c-1)*d<=0&&(d=0);var _=(a-2*w-(c-1)*d)/c;_>1&&(_>>=0);var N=l===+l?Math.min(_,l):_;f=o.reduce(function(C,k,S){var A=[].concat(o$(C),[{item:k.item,position:{offset:w+(_+d)*S+(_-N)/2,size:N}}]);return k.stackList&&k.stackList.length&&k.stackList.forEach(function(T){A.push({item:T,position:A[A.length-1].position})}),A},m)}return f},Eje=function(t,n,s,a){var i=s.children,o=s.width,l=s.margin,c=o-(l.left||0)-(l.right||0),d=i9({children:i,legendWidth:c});if(d){var f=a||{},m=f.width,g=f.height,x=d.align,j=d.verticalAlign,b=d.layout;if((b==="vertical"||b==="horizontal"&&j==="middle")&&x!=="center"&&ht(t[x]))return jr(jr({},t),{},qu({},x,t[x]+(m||0)));if((b==="horizontal"||b==="vertical"&&x==="center")&&j!=="middle"&&ht(t[j]))return jr(jr({},t),{},qu({},j,t[j]+(g||0)))}return t},Aje=function(t,n,s){return hn(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},o9=function(t,n,s,a,i){var o=n.props.children,l=Ja(o,xg).filter(function(d){return Aje(a,i,d.props.direction)});if(l&&l.length){var c=l.map(function(d){return d.props.dataKey});return t.reduce(function(d,f){var m=ka(f,s);if(hn(m))return d;var g=Array.isArray(m)?[lv(m),ov(m)]:[m,m],x=c.reduce(function(j,b){var y=ka(f,b,0),w=g[0]-Math.abs(Array.isArray(y)?y[0]:y),_=g[1]+Math.abs(Array.isArray(y)?y[1]:y);return[Math.min(w,j[0]),Math.max(_,j[1])]},[1/0,-1/0]);return[Math.min(x[0],d[0]),Math.max(x[1],d[1])]},[1/0,-1/0])}return null},Tje=function(t,n,s,a,i){var o=n.map(function(l){return o9(t,l,s,i,a)}).filter(function(l){return!hn(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},l9=function(t,n,s,a,i){var o=n.map(function(c){var d=c.props.dataKey;return s==="number"&&d&&o9(t,c,d,a)||Eh(t,d,s,i)});if(s==="number")return o.reduce(function(c,d){return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,d){for(var f=0,m=d.length;f<m;f++)l[d[f]]||(l[d[f]]=!0,c.push(d[f]));return c},[])},c9=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},od=function(t,n,s){if(!t)return null;var a=t.scale,i=t.duplicateDomain,o=t.type,l=t.range,c=t.realScaleType==="scaleBand"?a.bandwidth()/2:2,d=(n||s)&&o==="category"&&a.bandwidth?a.bandwidth()/c:0;if(d=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?Si(l[0]-l[1])*2*d:d,n&&(t.ticks||t.niceTicks)){var f=(t.ticks||t.niceTicks).map(function(m){var g=i?i.indexOf(m):m;return{coordinate:a(g)+d,value:m,offset:d}});return f.filter(function(m){return!cg(m.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(m,g){return{coordinate:a(m)+d,value:m,index:g,offset:d}}):a.ticks&&!s?a.ticks(t.tickCount).map(function(m){return{coordinate:a(m)+d,value:m,offset:d}}):a.domain().map(function(m,g){return{coordinate:a(m)+d,value:i?i[m]:m,index:g,offset:d}})},PS=new WeakMap,Vx=function(t,n){if(typeof n!="function")return t;PS.has(t)||PS.set(t,new WeakMap);var s=PS.get(t);if(s.has(n))return s.get(n);var a=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,a),a},Pje=function(t,n,s){var a=t.scale,i=t.type,o=t.layout,l=t.axisType;if(a==="auto")return o==="radial"&&l==="radiusAxis"?{scale:Xh(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:xy(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:Ch(),realScaleType:"point"}:i==="category"?{scale:Xh(),realScaleType:"band"}:{scale:xy(),realScaleType:"linear"};if(Ad(a)){var c="scale".concat(Gb(a));return{scale:(WL[c]||Ch)(),realScaleType:WL[c]?c:"point"}}return gn(a)?{scale:a}:{scale:Ch(),realScaleType:"point"}},c$=1e-4,Oje=function(t){var n=t.domain();if(!(!n||n.length<=2)){var s=n.length,a=t.range(),i=Math.min(a[0],a[1])-c$,o=Math.max(a[0],a[1])+c$,l=t(n[0]),c=t(n[s-1]);(l<i||l>o||c<i||c>o)&&t.domain([n[0],n[s-1]])}},Ije=function(t,n){if(!t)return null;for(var s=0,a=t.length;s<a;s++)if(t[s].item===n)return t[s].position;return null},Rje=function(t,n){if(!n||n.length!==2||!ht(n[0])||!ht(n[1]))return t;var s=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]),i=[t[0],t[1]];return(!ht(t[0])||t[0]<s)&&(i[0]=s),(!ht(t[1])||t[1]>a)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]<s&&(i[1]=s),i},Mje=function(t){var n=t.length;if(!(n<=0))for(var s=0,a=t[0].length;s<a;++s)for(var i=0,o=0,l=0;l<n;++l){var c=cg(t[l][s][1])?t[l][s][0]:t[l][s][1];c>=0?(t[l][s][0]=i,t[l][s][1]=i+c,i=t[l][s][1]):(t[l][s][0]=o,t[l][s][1]=o+c,o=t[l][s][1])}},Dje=function(t){var n=t.length;if(!(n<=0))for(var s=0,a=t[0].length;s<a;++s)for(var i=0,o=0;o<n;++o){var l=cg(t[o][s][1])?t[o][s][0]:t[o][s][1];l>=0?(t[o][s][0]=i,t[o][s][1]=i+l,i=t[o][s][1]):(t[o][s][0]=0,t[o][s][1]=0)}},Lje={sign:Mje,expand:vge,none:lm,silhouette:wge,wiggle:jge,positive:Dje},$je=function(t,n,s){var a=n.map(function(l){return l.props.dataKey}),i=Lje[s],o=bge().keys(a).value(function(l,c){return+ka(l,c,0)}).order(tC).offset(i);return o(t)},Bje=function(t,n,s,a,i,o){if(!t)return null;var l=o?n.reverse():n,c={},d=l.reduce(function(m,g){var x,j=(x=g.type)!==null&&x!==void 0&&x.defaultProps?jr(jr({},g.type.defaultProps),g.props):g.props,b=j.stackId,y=j.hide;if(y)return m;var w=j[s],_=m[w]||{hasStack:!1,stackGroups:{}};if(Wr(b)){var N=_.stackGroups[b]||{numericAxisId:s,cateAxisId:a,items:[]};N.items.push(g),_.hasStack=!0,_.stackGroups[b]=N}else _.stackGroups[dg("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[g]};return jr(jr({},m),{},qu({},w,_))},c),f={};return Object.keys(d).reduce(function(m,g){var x=d[g];if(x.hasStack){var j={};x.stackGroups=Object.keys(x.stackGroups).reduce(function(b,y){var w=x.stackGroups[y];return jr(jr({},b),{},qu({},y,{numericAxisId:s,cateAxisId:a,items:w.items,stackedData:$je(t,w.items,i)}))},j)}return jr(jr({},m),{},qu({},g,x))},f)},Fje=function(t,n){var s=n.realScaleType,a=n.type,i=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=s||n.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&a==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var d=t.domain();if(!d.length)return null;var f=Qwe(d,i,l);return t.domain([lv(f),ov(f)]),{niceTicks:f}}if(i&&a==="number"){var m=t.domain(),g=Xwe(m,i,l);return{niceTicks:g}}return null};function d$(e){var t=e.axis,n=e.ticks,s=e.bandSize,a=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!hn(a[t.dataKey])){var l=J0(n,"value",a[t.dataKey]);if(l)return l.coordinate+s/2}return n[i]?n[i].coordinate+s/2:null}var c=ka(a,hn(o)?t.dataKey:o);return hn(c)?null:t.scale(c)}var u$=function(t){var n=t.axis,s=t.ticks,a=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return s[l]?s[l].coordinate+a:null;var c=ka(o,n.dataKey,n.domain[l]);return hn(c)?null:n.scale(c)-i/2+a},zje=function(t){var n=t.numericAxis,s=n.scale.domain();if(n.type==="number"){var a=Math.min(s[0],s[1]),i=Math.max(s[0],s[1]);return a<=0&&i>=0?0:i<0?i:a}return s[0]},Uje=function(t,n){var s,a=(s=t.type)!==null&&s!==void 0&&s.defaultProps?jr(jr({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(Wr(i)){var o=n[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},qje=function(t){return t.reduce(function(n,s){return[lv(s.concat([n[0]]).filter(ht)),ov(s.concat([n[1]]).filter(ht))]},[1/0,-1/0])},d9=function(t,n,s){return Object.keys(t).reduce(function(a,i){var o=t[i],l=o.stackedData,c=l.reduce(function(d,f){var m=qje(f.slice(n,s+1));return[Math.min(d[0],m[0]),Math.max(d[1],m[1])]},[1/0,-1/0]);return[Math.min(c[0],a[0]),Math.max(c[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},m$=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,f$=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,kC=function(t,n,s){if(gn(t))return t(n,s);if(!Array.isArray(t))return n;var a=[];if(ht(t[0]))a[0]=s?t[0]:Math.min(t[0],n[0]);else if(m$.test(t[0])){var i=+m$.exec(t[0])[1];a[0]=n[0]-i}else gn(t[0])?a[0]=t[0](n[0]):a[0]=n[0];if(ht(t[1]))a[1]=s?t[1]:Math.max(t[1],n[1]);else if(f$.test(t[1])){var o=+f$.exec(t[1])[1];a[1]=n[1]+o}else gn(t[1])?a[1]=t[1](n[1]):a[1]=n[1];return a},Ny=function(t,n,s){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!s||a>0)return a}if(t&&n&&n.length>=2){for(var i=sA(n,function(m){return m.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var d=i[l],f=i[l-1];o=Math.min((d.coordinate||0)-(f.coordinate||0),o)}return o===1/0?0:o}return s?void 0:0},h$=function(t,n,s){return!t||!t.length||cv(t,Ya(s,"type.defaultProps.domain"))?n:t},u9=function(t,n){var s=t.type.defaultProps?jr(jr({},t.type.defaultProps),t.props):t.props,a=s.dataKey,i=s.name,o=s.unit,l=s.formatter,c=s.tooltipType,d=s.chartType,f=s.hide;return jr(jr({},jn(t,!1)),{},{dataKey:a,unit:o,formatter:l,name:i||a,color:TA(t),value:ka(n,a),type:c,payload:n,chartType:d,hide:f})};function op(e){"@babel/helpers - typeof";return op=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},op(e)}function p$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function g$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p$(Object(n),!0).forEach(function(s){Kje(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Kje(e,t,n){return t=Vje(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vje(e){var t=Hje(e,"string");return op(t)=="symbol"?t:t+""}function Hje(e,t){if(op(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(op(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Sy=Math.PI/180,Wje=function(t){return t*180/Math.PI},hs=function(t,n,s,a){return{x:t+Math.cos(-Sy*a)*s,y:n+Math.sin(-Sy*a)*s}},Gje=function(t,n){var s=t.x,a=t.y,i=n.x,o=n.y;return Math.sqrt(Math.pow(s-i,2)+Math.pow(a-o,2))},Yje=function(t,n){var s=t.x,a=t.y,i=n.cx,o=n.cy,l=Gje({x:s,y:a},{x:i,y:o});if(l<=0)return{radius:l};var c=(s-i)/l,d=Math.acos(c);return a>o&&(d=2*Math.PI-d),{radius:l,angle:Wje(d),angleInRadian:d}},Jje=function(t){var n=t.startAngle,s=t.endAngle,a=Math.floor(n/360),i=Math.floor(s/360),o=Math.min(a,i);return{startAngle:n-o*360,endAngle:s-o*360}},Qje=function(t,n){var s=n.startAngle,a=n.endAngle,i=Math.floor(s/360),o=Math.floor(a/360),l=Math.min(i,o);return t+l*360},x$=function(t,n){var s=t.x,a=t.y,i=Yje({x:s,y:a},n),o=i.radius,l=i.angle,c=n.innerRadius,d=n.outerRadius;if(o<c||o>d)return!1;if(o===0)return!0;var f=Jje(n),m=f.startAngle,g=f.endAngle,x=l,j;if(m<=g){for(;x>g;)x-=360;for(;x<m;)x+=360;j=x>=m&&x<=g}else{for(;x>m;)x-=360;for(;x<g;)x+=360;j=x>=g&&x<=m}return j?g$(g$({},n),{},{radius:o,angle:Qje(x,n)}):null};function lp(e){"@babel/helpers - typeof";return lp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lp(e)}var Xje=["offset"];function Zje(e){return r1e(e)||n1e(e)||t1e(e)||e1e()}function e1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
924In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t1e(e,t){if(e){if(typeof e=="string")return CC(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 CC(e,t)}}function n1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function r1e(e){if(Array.isArray(e))return CC(e)}function CC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function s1e(e,t){if(e==null)return{};var n=a1e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function a1e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function y$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Hr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?y$(Object(n),!0).forEach(function(s){i1e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function i1e(e,t,n){return t=o1e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o1e(e){var t=l1e(e,"string");return lp(t)=="symbol"?t:t+""}function l1e(e,t){if(lp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(lp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cp(){return cp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},cp.apply(this,arguments)}var c1e=function(t){var n=t.value,s=t.formatter,a=hn(t.children)?n:t.children;return gn(s)?s(a):a},d1e=function(t,n){var s=Si(n-t),a=Math.min(Math.abs(n-t),360);return s*a},u1e=function(t,n,s){var a=t.position,i=t.viewBox,o=t.offset,l=t.className,c=i,d=c.cx,f=c.cy,m=c.innerRadius,g=c.outerRadius,x=c.startAngle,j=c.endAngle,b=c.clockWise,y=(m+g)/2,w=d1e(x,j),_=w>=0?1:-1,N,C;a==="insideStart"?(N=x+_*o,C=b):a==="insideEnd"?(N=j-_*o,C=!b):a==="end"&&(N=j+_*o,C=b),C=w<=0?C:!C;var k=hs(d,f,y,N),S=hs(d,f,y,N+(C?1:-1)*359),A="M".concat(k.x,",").concat(k.y,`
925    A`).concat(y,",").concat(y,",0,1,").concat(C?0:1,`,
926    `).concat(S.x,",").concat(S.y),T=hn(t.id)?dg("recharts-radial-line-"):t.id;return xe.createElement("text",cp({},s,{dominantBaseline:"central",className:wn("recharts-radial-bar-label",l)}),xe.createElement("defs",null,xe.createElement("path",{id:T,d:A})),xe.createElement("textPath",{xlinkHref:"#".concat(T)},n))},m1e=function(t){var n=t.viewBox,s=t.offset,a=t.position,i=n,o=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,m=i.endAngle,g=(f+m)/2;if(a==="outside"){var x=hs(o,l,d+s,g),j=x.x,b=x.y;return{x:j,y:b,textAnchor:j>=o?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var y=(c+d)/2,w=hs(o,l,y,g),_=w.x,N=w.y;return{x:_,y:N,textAnchor:"middle",verticalAnchor:"middle"}},f1e=function(t){var n=t.viewBox,s=t.parentViewBox,a=t.offset,i=t.position,o=n,l=o.x,c=o.y,d=o.width,f=o.height,m=f>=0?1:-1,g=m*a,x=m>0?"end":"start",j=m>0?"start":"end",b=d>=0?1:-1,y=b*a,w=b>0?"end":"start",_=b>0?"start":"end";if(i==="top"){var N={x:l+d/2,y:c-m*a,textAnchor:"middle",verticalAnchor:x};return Hr(Hr({},N),s?{height:Math.max(c-s.y,0),width:d}:{})}if(i==="bottom"){var C={x:l+d/2,y:c+f+g,textAnchor:"middle",verticalAnchor:j};return Hr(Hr({},C),s?{height:Math.max(s.y+s.height-(c+f),0),width:d}:{})}if(i==="left"){var k={x:l-y,y:c+f/2,textAnchor:w,verticalAnchor:"middle"};return Hr(Hr({},k),s?{width:Math.max(k.x-s.x,0),height:f}:{})}if(i==="right"){var S={x:l+d+y,y:c+f/2,textAnchor:_,verticalAnchor:"middle"};return Hr(Hr({},S),s?{width:Math.max(s.x+s.width-S.x,0),height:f}:{})}var A=s?{width:d,height:f}:{};return i==="insideLeft"?Hr({x:l+y,y:c+f/2,textAnchor:_,verticalAnchor:"middle"},A):i==="insideRight"?Hr({x:l+d-y,y:c+f/2,textAnchor:w,verticalAnchor:"middle"},A):i==="insideTop"?Hr({x:l+d/2,y:c+g,textAnchor:"middle",verticalAnchor:j},A):i==="insideBottom"?Hr({x:l+d/2,y:c+f-g,textAnchor:"middle",verticalAnchor:x},A):i==="insideTopLeft"?Hr({x:l+y,y:c+g,textAnchor:_,verticalAnchor:j},A):i==="insideTopRight"?Hr({x:l+d-y,y:c+g,textAnchor:w,verticalAnchor:j},A):i==="insideBottomLeft"?Hr({x:l+y,y:c+f-g,textAnchor:_,verticalAnchor:x},A):i==="insideBottomRight"?Hr({x:l+d-y,y:c+f-g,textAnchor:w,verticalAnchor:x},A):Qm(i)&&(ht(i.x)||sd(i.x))&&(ht(i.y)||sd(i.y))?Hr({x:l+Td(i.x,d),y:c+Td(i.y,f),textAnchor:"end",verticalAnchor:"end"},A):Hr({x:l+d/2,y:c+f/2,textAnchor:"middle",verticalAnchor:"middle"},A)},h1e=function(t){return"cx"in t&&ht(t.cx)};function ks(e){var t=e.offset,n=t===void 0?5:t,s=s1e(e,Xje),a=Hr({offset:n},s),i=a.viewBox,o=a.position,l=a.value,c=a.children,d=a.content,f=a.className,m=f===void 0?"":f,g=a.textBreakAll;if(!i||hn(l)&&hn(c)&&!h.isValidElement(d)&&!gn(d))return null;if(h.isValidElement(d))return h.cloneElement(d,a);var x;if(gn(d)){if(x=h.createElement(d,a),h.isValidElement(x))return x}else x=c1e(a);var j=h1e(i),b=jn(a,!0);if(j&&(o==="insideStart"||o==="insideEnd"||o==="end"))return u1e(a,x,b);var y=j?m1e(a):f1e(a);return xe.createElement(cy,cp({className:wn("recharts-label",m)},b,y,{breakAll:g}),x)}ks.displayName="Label";var m9=function(t){var n=t.cx,s=t.cy,a=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,d=t.innerRadius,f=t.outerRadius,m=t.x,g=t.y,x=t.top,j=t.left,b=t.width,y=t.height,w=t.clockWise,_=t.labelViewBox;if(_)return _;if(ht(b)&&ht(y)){if(ht(m)&&ht(g))return{x:m,y:g,width:b,height:y};if(ht(x)&&ht(j))return{x,y:j,width:b,height:y}}return ht(m)&&ht(g)?{x:m,y:g,width:0,height:0}:ht(n)&&ht(s)?{cx:n,cy:s,startAngle:i||a||0,endAngle:o||a||0,innerRadius:d||0,outerRadius:f||c||l||0,clockWise:w}:t.viewBox?t.viewBox:{}},p1e=function(t,n){return t?t===!0?xe.createElement(ks,{key:"label-implicit",viewBox:n}):Wr(t)?xe.createElement(ks,{key:"label-implicit",viewBox:n,value:t}):h.isValidElement(t)?t.type===ks?h.cloneElement(t,{key:"label-implicit",viewBox:n}):xe.createElement(ks,{key:"label-implicit",content:t,viewBox:n}):gn(t)?xe.createElement(ks,{key:"label-implicit",content:t,viewBox:n}):Qm(t)?xe.createElement(ks,cp({viewBox:n},t,{key:"label-implicit"})):null:null},g1e=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&s&&!t.label)return null;var a=t.children,i=m9(t),o=Ja(a,ks).map(function(c,d){return h.cloneElement(c,{viewBox:n||i,key:"label-".concat(d)})});if(!s)return o;var l=p1e(t.label,n||i);return[l].concat(Zje(o))};ks.parseViewBox=m9;ks.renderCallByParent=g1e;var OS,b$;function x1e(){if(b$)return OS;b$=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return OS=e,OS}var y1e=x1e();const b1e=Un(y1e);function dp(e){"@babel/helpers - typeof";return dp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dp(e)}var v1e=["valueAccessor"],w1e=["data","dataKey","clockWise","id","textBreakAll"];function j1e(e){return k1e(e)||S1e(e)||N1e(e)||_1e()}function _1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
927In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N1e(e,t){if(e){if(typeof e=="string")return EC(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 EC(e,t)}}function S1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function k1e(e){if(Array.isArray(e))return EC(e)}function EC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function ky(){return ky=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ky.apply(this,arguments)}function v$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function w$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?v$(Object(n),!0).forEach(function(s){C1e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function C1e(e,t,n){return t=E1e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E1e(e){var t=A1e(e,"string");return dp(t)=="symbol"?t:t+""}function A1e(e,t){if(dp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(dp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function j$(e,t){if(e==null)return{};var n=T1e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function T1e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var P1e=function(t){return Array.isArray(t.value)?b1e(t.value):t.value};function Uo(e){var t=e.valueAccessor,n=t===void 0?P1e:t,s=j$(e,v1e),a=s.data,i=s.dataKey,o=s.clockWise,l=s.id,c=s.textBreakAll,d=j$(s,w1e);return!a||!a.length?null:xe.createElement(Cr,{className:"recharts-label-list"},a.map(function(f,m){var g=hn(i)?n(f,m):ka(f&&f.payload,i),x=hn(l)?{}:{id:"".concat(l,"-").concat(m)};return xe.createElement(ks,ky({},jn(f,!0),d,x,{parentViewBox:f.parentViewBox,value:g,textBreakAll:c,viewBox:ks.parseViewBox(hn(o)?f:w$(w$({},f),{},{clockWise:o})),key:"label-".concat(m),index:m}))}))}Uo.displayName="LabelList";function O1e(e,t){return e?e===!0?xe.createElement(Uo,{key:"labelList-implicit",data:t}):xe.isValidElement(e)||gn(e)?xe.createElement(Uo,{key:"labelList-implicit",data:t,content:e}):Qm(e)?xe.createElement(Uo,ky({data:t},e,{key:"labelList-implicit"})):null:null}function I1e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var s=e.children,a=Ja(s,Uo).map(function(o,l){return h.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return a;var i=O1e(e.label,t);return[i].concat(j1e(a))}Uo.renderCallByParent=I1e;function up(e){"@babel/helpers - typeof";return up=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},up(e)}function AC(){return AC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},AC.apply(this,arguments)}function _$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function N$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_$(Object(n),!0).forEach(function(s){R1e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function R1e(e,t,n){return t=M1e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M1e(e){var t=D1e(e,"string");return up(t)=="symbol"?t:t+""}function D1e(e,t){if(up(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(up(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var L1e=function(t,n){var s=Si(n-t),a=Math.min(Math.abs(n-t),359.999);return s*a},Hx=function(t){var n=t.cx,s=t.cy,a=t.radius,i=t.angle,o=t.sign,l=t.isExternal,c=t.cornerRadius,d=t.cornerIsExternal,f=c*(l?1:-1)+a,m=Math.asin(c/f)/Sy,g=d?i:i+o*m,x=hs(n,s,f,g),j=hs(n,s,a,g),b=d?i-o*m:i,y=hs(n,s,f*Math.cos(m*Sy),b);return{center:x,circleTangency:j,lineTangency:y,theta:m}},f9=function(t){var n=t.cx,s=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.startAngle,l=t.endAngle,c=L1e(o,l),d=o+c,f=hs(n,s,i,o),m=hs(n,s,i,d),g="M ".concat(f.x,",").concat(f.y,`
928    A `).concat(i,",").concat(i,`,0,
929    `).concat(+(Math.abs(c)>180),",").concat(+(o>d),`,
930    `).concat(m.x,",").concat(m.y,`
931  `);if(a>0){var x=hs(n,s,a,o),j=hs(n,s,a,d);g+="L ".concat(j.x,",").concat(j.y,`
932            A `).concat(a,",").concat(a,`,0,
933            `).concat(+(Math.abs(c)>180),",").concat(+(o<=d),`,
934            `).concat(x.x,",").concat(x.y," Z")}else g+="L ".concat(n,",").concat(s," Z");return g},$1e=function(t){var n=t.cx,s=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,d=t.startAngle,f=t.endAngle,m=Si(f-d),g=Hx({cx:n,cy:s,radius:i,angle:d,sign:m,cornerRadius:o,cornerIsExternal:c}),x=g.circleTangency,j=g.lineTangency,b=g.theta,y=Hx({cx:n,cy:s,radius:i,angle:f,sign:-m,cornerRadius:o,cornerIsExternal:c}),w=y.circleTangency,_=y.lineTangency,N=y.theta,C=c?Math.abs(d-f):Math.abs(d-f)-b-N;if(C<0)return l?"M ".concat(j.x,",").concat(j.y,`
935        a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
936        a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
937      `):f9({cx:n,cy:s,innerRadius:a,outerRadius:i,startAngle:d,endAngle:f});var k="M ".concat(j.x,",").concat(j.y,`
938    A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(x.x,",").concat(x.y,`
939    A`).concat(i,",").concat(i,",0,").concat(+(C>180),",").concat(+(m<0),",").concat(w.x,",").concat(w.y,`
940    A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(_.x,",").concat(_.y,`
941  `);if(a>0){var S=Hx({cx:n,cy:s,radius:a,angle:d,sign:m,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),A=S.circleTangency,T=S.lineTangency,R=S.theta,B=Hx({cx:n,cy:s,radius:a,angle:f,sign:-m,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),D=B.circleTangency,P=B.lineTangency,I=B.theta,z=c?Math.abs(d-f):Math.abs(d-f)-R-I;if(z<0&&o===0)return"".concat(k,"L").concat(n,",").concat(s,"Z");k+="L".concat(P.x,",").concat(P.y,`
942      A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(D.x,",").concat(D.y,`
943      A`).concat(a,",").concat(a,",0,").concat(+(z>180),",").concat(+(m>0),",").concat(A.x,",").concat(A.y,`
944      A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(T.x,",").concat(T.y,"Z")}else k+="L".concat(n,",").concat(s,"Z");return k},B1e={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},h9=function(t){var n=N$(N$({},B1e),t),s=n.cx,a=n.cy,i=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,d=n.cornerIsExternal,f=n.startAngle,m=n.endAngle,g=n.className;if(o<i||f===m)return null;var x=wn("recharts-sector",g),j=o-i,b=Td(l,j,0,!0),y;return b>0&&Math.abs(f-m)<360?y=$1e({cx:s,cy:a,innerRadius:i,outerRadius:o,cornerRadius:Math.min(b,j/2),forceCornerRadius:c,cornerIsExternal:d,startAngle:f,endAngle:m}):y=f9({cx:s,cy:a,innerRadius:i,outerRadius:o,startAngle:f,endAngle:m}),xe.createElement("path",AC({},jn(n,!0),{className:x,d:y,role:"img"}))};function mp(e){"@babel/helpers - typeof";return mp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mp(e)}function TC(){return TC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},TC.apply(this,arguments)}function S$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function k$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?S$(Object(n),!0).forEach(function(s){F1e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function F1e(e,t,n){return t=z1e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z1e(e){var t=U1e(e,"string");return mp(t)=="symbol"?t:t+""}function U1e(e,t){if(mp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(mp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var C$={curveBasisClosed:lge,curveBasisOpen:cge,curveBasis:oge,curveBumpX:Wpe,curveBumpY:Gpe,curveLinearClosed:dge,curveLinear:Jb,curveMonotoneX:uge,curveMonotoneY:mge,curveNatural:fge,curveStep:hge,curveStepAfter:gge,curveStepBefore:pge},Wx=function(t){return t.x===+t.x&&t.y===+t.y},Zf=function(t){return t.x},eh=function(t){return t.y},q1e=function(t,n){if(gn(t))return t;var s="curve".concat(Gb(t));return(s==="curveMonotone"||s==="curveBump")&&n?C$["".concat(s).concat(n==="vertical"?"Y":"X")]:C$[s]||Jb},K1e=function(t){var n=t.type,s=n===void 0?"linear":n,a=t.points,i=a===void 0?[]:a,o=t.baseLine,l=t.layout,c=t.connectNulls,d=c===void 0?!1:c,f=q1e(s,l),m=d?i.filter(function(b){return Wx(b)}):i,g;if(Array.isArray(o)){var x=d?o.filter(function(b){return Wx(b)}):o,j=m.map(function(b,y){return k$(k$({},b),{},{base:x[y]})});return l==="vertical"?g=$x().y(eh).x1(Zf).x0(function(b){return b.base.x}):g=$x().x(Zf).y1(eh).y0(function(b){return b.base.y}),g.defined(Wx).curve(f),g(j)}return l==="vertical"&&ht(o)?g=$x().y(eh).x1(Zf).x0(o):ht(o)?g=$x().x(Zf).y1(eh).y0(o):g=wq().x(Zf).y(eh),g.defined(Wx).curve(f),g(m)},PC=function(t){var n=t.className,s=t.points,a=t.path,i=t.pathRef;if((!s||!s.length)&&!a)return null;var o=s&&s.length?K1e(t):a;return h.createElement("path",TC({},jn(t,!1),Q0(t),{className:wn("recharts-curve",n),d:o,ref:i}))},IS={exports:{}},RS,E$;function V1e(){if(E$)return RS;E$=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return RS=e,RS}var MS,A$;function H1e(){if(A$)return MS;A$=1;var e=V1e();function t(){}function n(){}return n.resetWarningCache=t,MS=function(){function s(o,l,c,d,f,m){if(m!==e){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}s.isRequired=s;function a(){return s}var i={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:a,element:s,elementType:s,instanceOf:a,node:s,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},MS}var T$;function W1e(){return T$||(T$=1,IS.exports=H1e()()),IS.exports}var G1e=W1e();const Ln=Un(G1e),{getOwnPropertyNames:Y1e,getOwnPropertySymbols:J1e}=Object,{hasOwnProperty:Q1e}=Object.prototype;function DS(e,t){return function(s,a,i){return e(s,a,i)&&t(s,a,i)}}function Gx(e){return function(n,s,a){if(!n||!s||typeof n!="object"||typeof s!="object")return e(n,s,a);const{cache:i}=a,o=i.get(n),l=i.get(s);if(o&&l)return o===s&&l===n;i.set(n,s),i.set(s,n);const c=e(n,s,a);return i.delete(n),i.delete(s),c}}function X1e(e){return e!=null?e[Symbol.toStringTag]:void 0}function P$(e){return Y1e(e).concat(J1e(e))}const Z1e=Object.hasOwn||((e,t)=>Q1e.call(e,t));function Wd(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const e_e="__v",t_e="__o",n_e="_owner",{getOwnPropertyDescriptor:O$,keys:I$}=Object;function r_e(e,t){return e.byteLength===t.byteLength&&Cy(new Uint8Array(e),new Uint8Array(t))}function s_e(e,t,n){let s=e.length;if(t.length!==s)return!1;for(;s-- >0;)if(!n.equals(e[s],t[s],s,s,e,t,n))return!1;return!0}function a_e(e,t){return e.byteLength===t.byteLength&&Cy(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function i_e(e,t){return Wd(e.getTime(),t.getTime())}function o_e(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function l_e(e,t){return e===t}function R$(e,t,n){const s=e.size;if(s!==t.size)return!1;if(!s)return!0;const a=new Array(s),i=e.entries();let o,l,c=0;for(;(o=i.next())&&!o.done;){const d=t.entries();let f=!1,m=0;for(;(l=d.next())&&!l.done;){if(a[m]){m++;continue}const g=o.value,x=l.value;if(n.equals(g[0],x[0],c,m,e,t,n)&&n.equals(g[1],x[1],g[0],x[0],e,t,n)){f=a[m]=!0;break}m++}if(!f)return!1;c++}return!0}const c_e=Wd;function d_e(e,t,n){const s=I$(e);let a=s.length;if(I$(t).length!==a)return!1;for(;a-- >0;)if(!p9(e,t,n,s[a]))return!1;return!0}function th(e,t,n){const s=P$(e);let a=s.length;if(P$(t).length!==a)return!1;let i,o,l;for(;a-- >0;)if(i=s[a],!p9(e,t,n,i)||(o=O$(e,i),l=O$(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function u_e(e,t){return Wd(e.valueOf(),t.valueOf())}function m_e(e,t){return e.source===t.source&&e.flags===t.flags}function M$(e,t,n){const s=e.size;if(s!==t.size)return!1;if(!s)return!0;const a=new Array(s),i=e.values();let o,l;for(;(o=i.next())&&!o.done;){const c=t.values();let d=!1,f=0;for(;(l=c.next())&&!l.done;){if(!a[f]&&n.equals(o.value,l.value,o.value,l.value,e,t,n)){d=a[f]=!0;break}f++}if(!d)return!1}return!0}function Cy(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function f_e(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function p9(e,t,n,s){return(s===n_e||s===t_e||s===e_e)&&(e.$$typeof||t.$$typeof)?!0:Z1e(t,s)&&n.equals(e[s],t[s],s,s,e,t,n)}const h_e="[object ArrayBuffer]",p_e="[object Arguments]",g_e="[object Boolean]",x_e="[object DataView]",y_e="[object Date]",b_e="[object Error]",v_e="[object Map]",w_e="[object Number]",j_e="[object Object]",__e="[object RegExp]",N_e="[object Set]",S_e="[object String]",k_e={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},C_e="[object URL]",E_e=Object.prototype.toString;function A_e({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:s,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:d,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:x,unknownTagComparators:j}){return function(y,w,_){if(y===w)return!0;if(y==null||w==null)return!1;const N=typeof y;if(N!==typeof w)return!1;if(N!=="object")return N==="number"?l(y,w,_):N==="function"?i(y,w,_):!1;const C=y.constructor;if(C!==w.constructor)return!1;if(C===Object)return c(y,w,_);if(Array.isArray(y))return t(y,w,_);if(C===Date)return s(y,w,_);if(C===RegExp)return f(y,w,_);if(C===Map)return o(y,w,_);if(C===Set)return m(y,w,_);const k=E_e.call(y);if(k===y_e)return s(y,w,_);if(k===__e)return f(y,w,_);if(k===v_e)return o(y,w,_);if(k===N_e)return m(y,w,_);if(k===j_e)return typeof y.then!="function"&&typeof w.then!="function"&&c(y,w,_);if(k===C_e)return x(y,w,_);if(k===b_e)return a(y,w,_);if(k===p_e)return c(y,w,_);if(k_e[k])return g(y,w,_);if(k===h_e)return e(y,w,_);if(k===x_e)return n(y,w,_);if(k===g_e||k===w_e||k===S_e)return d(y,w,_);if(j){let S=j[k];if(!S){const A=X1e(y);A&&(S=j[A])}if(S)return S(y,w,_)}return!1}}function T_e({circular:e,createCustomConfig:t,strict:n}){let s={areArrayBuffersEqual:r_e,areArraysEqual:n?th:s_e,areDataViewsEqual:a_e,areDatesEqual:i_e,areErrorsEqual:o_e,areFunctionsEqual:l_e,areMapsEqual:n?DS(R$,th):R$,areNumbersEqual:c_e,areObjectsEqual:n?th:d_e,arePrimitiveWrappersEqual:u_e,areRegExpsEqual:m_e,areSetsEqual:n?DS(M$,th):M$,areTypedArraysEqual:n?DS(Cy,th):Cy,areUrlsEqual:f_e,unknownTagComparators:void 0};if(t&&(s=Object.assign({},s,t(s))),e){const a=Gx(s.areArraysEqual),i=Gx(s.areMapsEqual),o=Gx(s.areObjectsEqual),l=Gx(s.areSetsEqual);s=Object.assign({},s,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return s}function P_e(e){return function(t,n,s,a,i,o,l){return e(t,n,l)}}function O_e({circular:e,comparator:t,createState:n,equals:s,strict:a}){if(n)return function(l,c){const{cache:d=e?new WeakMap:void 0,meta:f}=n();return t(l,c,{cache:d,equals:s,meta:f,strict:a})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:s,meta:void 0,strict:a})};const i={cache:void 0,equals:s,meta:void 0,strict:a};return function(l,c){return t(l,c,i)}}const I_e=jc();jc({strict:!0});jc({circular:!0});jc({circular:!0,strict:!0});jc({createInternalComparator:()=>Wd});jc({strict:!0,createInternalComparator:()=>Wd});jc({circular:!0,createInternalComparator:()=>Wd});jc({circular:!0,createInternalComparator:()=>Wd,strict:!0});function jc(e={}){const{circular:t=!1,createInternalComparator:n,createState:s,strict:a=!1}=e,i=T_e(e),o=A_e(i),l=n?n(o):P_e(o);return O_e({circular:t,comparator:o,createState:s,equals:l,strict:a})}function R_e(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function D$(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function a(i){n<0&&(n=i),i-n>t?(e(i),n=-1):R_e(a)};requestAnimationFrame(s)}function OC(e){"@babel/helpers - typeof";return OC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},OC(e)}function M_e(e){return B_e(e)||$_e(e)||L_e(e)||D_e()}function D_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
945In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L_e(e,t){if(e){if(typeof e=="string")return L$(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 L$(e,t)}}function L$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function $_e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function B_e(e){if(Array.isArray(e))return e}function F_e(){var e={},t=function(){return null},n=!1,s=function a(i){if(!n){if(Array.isArray(i)){if(!i.length)return;var o=i,l=M_e(o),c=l[0],d=l.slice(1);if(typeof c=="number"){D$(a.bind(null,d),c);return}a(c),D$(a.bind(null,d));return}OC(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){n=!0},start:function(i){n=!1,s(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function fp(e){"@babel/helpers - typeof";return fp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fp(e)}function $$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function B$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$$(Object(n),!0).forEach(function(s){g9(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function g9(e,t,n){return t=z_e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z_e(e){var t=U_e(e,"string");return fp(t)==="symbol"?t:String(t)}function U_e(e,t){if(fp(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(fp(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var q_e=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(s,a){return s.filter(function(i){return a.includes(i)})})},K_e=function(t){return t},V_e=function(t){return t.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},Ah=function(t,n){return Object.keys(n).reduce(function(s,a){return B$(B$({},s),{},g9({},a,t(a,n[a])))},{})},F$=function(t,n,s){return t.map(function(a){return"".concat(V_e(a)," ").concat(n,"ms ").concat(s)}).join(",")};function H_e(e,t){return Y_e(e)||G_e(e,t)||x9(e,t)||W_e()}function W_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
946In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G_e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function Y_e(e){if(Array.isArray(e))return e}function J_e(e){return Z_e(e)||X_e(e)||x9(e)||Q_e()}function Q_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
947In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x9(e,t){if(e){if(typeof e=="string")return IC(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 IC(e,t)}}function X_e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Z_e(e){if(Array.isArray(e))return IC(e)}function IC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var Ey=1e-4,y9=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},b9=function(t,n){return t.map(function(s,a){return s*Math.pow(n,a)}).reduce(function(s,a){return s+a})},z$=function(t,n){return function(s){var a=y9(t,n);return b9(a,s)}},eNe=function(t,n){return function(s){var a=y9(t,n),i=[].concat(J_e(a.map(function(o,l){return o*l}).slice(1)),[0]);return b9(i,s)}},U$=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];var a=n[0],i=n[1],o=n[2],l=n[3];if(n.length===1)switch(n[0]){case"linear":a=0,i=0,o=1,l=1;break;case"ease":a=.25,i=.1,o=.25,l=1;break;case"ease-in":a=.42,i=0,o=1,l=1;break;case"ease-out":a=.42,i=0,o=.58,l=1;break;case"ease-in-out":a=0,i=0,o=.58,l=1;break;default:{var c=n[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var d=c[1].split(")")[0].split(",").map(function(y){return parseFloat(y)}),f=H_e(d,4);a=f[0],i=f[1],o=f[2],l=f[3]}}}var m=z$(a,o),g=z$(i,l),x=eNe(a,o),j=function(w){return w>1?1:w<0?0:w},b=function(w){for(var _=w>1?1:w,N=_,C=0;C<8;++C){var k=m(N)-_,S=x(N);if(Math.abs(k-_)<Ey||S<Ey)return g(N);N=j(N-k/S)}return g(N)};return b.isStepper=!1,b},tNe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,s=n===void 0?100:n,a=t.damping,i=a===void 0?8:a,o=t.dt,l=o===void 0?17:o,c=function(f,m,g){var x=-(f-m)*s,j=g*i,b=g+(x-j)*l/1e3,y=g*l/1e3+f;return Math.abs(y-m)<Ey&&Math.abs(b)<Ey?[m,0]:[y,b]};return c.isStepper=!0,c.dt=l,c},nNe=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];var a=n[0];if(typeof a=="string")switch(a){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return U$(a);case"spring":return tNe();default:if(a.split("(")[0]==="cubic-bezier")return U$(a)}return typeof a=="function"?a:null};function hp(e){"@babel/helpers - typeof";return hp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hp(e)}function q$(e){return aNe(e)||sNe(e)||v9(e)||rNe()}function rNe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
948In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sNe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function aNe(e){if(Array.isArray(e))return MC(e)}function K$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function ds(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?K$(Object(n),!0).forEach(function(s){RC(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function RC(e,t,n){return t=iNe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iNe(e){var t=oNe(e,"string");return hp(t)==="symbol"?t:String(t)}function oNe(e,t){if(hp(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(hp(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lNe(e,t){return uNe(e)||dNe(e,t)||v9(e,t)||cNe()}function cNe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
949In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v9(e,t){if(e){if(typeof e=="string")return MC(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 MC(e,t)}}function MC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function dNe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function uNe(e){if(Array.isArray(e))return e}var Ay=function(t,n,s){return t+(n-t)*s},DC=function(t){var n=t.from,s=t.to;return n!==s},mNe=function e(t,n,s){var a=Ah(function(i,o){if(DC(o)){var l=t(o.from,o.to,o.velocity),c=lNe(l,2),d=c[0],f=c[1];return ds(ds({},o),{},{from:d,velocity:f})}return o},n);return s<1?Ah(function(i,o){return DC(o)?ds(ds({},o),{},{velocity:Ay(o.velocity,a[i].velocity,s),from:Ay(o.from,a[i].from,s)}):o},n):e(t,a,s-1)};const fNe=(function(e,t,n,s,a){var i=q_e(e,t),o=i.reduce(function(y,w){return ds(ds({},y),{},RC({},w,[e[w],t[w]]))},{}),l=i.reduce(function(y,w){return ds(ds({},y),{},RC({},w,{from:e[w],velocity:0,to:t[w]}))},{}),c=-1,d,f,m=function(){return null},g=function(){return Ah(function(w,_){return _.from},l)},x=function(){return!Object.values(l).filter(DC).length},j=function(w){d||(d=w);var _=w-d,N=_/n.dt;l=mNe(n,l,N),a(ds(ds(ds({},e),t),g())),d=w,x()||(c=requestAnimationFrame(m))},b=function(w){f||(f=w);var _=(w-f)/s,N=Ah(function(k,S){return Ay.apply(void 0,q$(S).concat([n(_)]))},o);if(a(ds(ds(ds({},e),t),N)),_<1)c=requestAnimationFrame(m);else{var C=Ah(function(k,S){return Ay.apply(void 0,q$(S).concat([n(1)]))},o);a(ds(ds(ds({},e),t),C))}};return m=n.isStepper?j:b,function(){return requestAnimationFrame(m),function(){cancelAnimationFrame(c)}}});function xm(e){"@babel/helpers - typeof";return xm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xm(e)}var hNe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function pNe(e,t){if(e==null)return{};var n=gNe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function gNe(e,t){if(e==null)return{};var n={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function LS(e){return vNe(e)||bNe(e)||yNe(e)||xNe()}function xNe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
950In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yNe(e,t){if(e){if(typeof e=="string")return LC(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 LC(e,t)}}function bNe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vNe(e){if(Array.isArray(e))return LC(e)}function LC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function V$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function pi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?V$(Object(n),!0).forEach(function(s){xh(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function xh(e,t,n){return t=w9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wNe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jNe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,w9(s.key),s)}}function _Ne(e,t,n){return t&&jNe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function w9(e){var t=NNe(e,"string");return xm(t)==="symbol"?t:String(t)}function NNe(e,t){if(xm(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(xm(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function SNe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$C(e,t)}function $C(e,t){return $C=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},$C(e,t)}function kNe(e){var t=CNe();return function(){var s=Ty(e),a;if(t){var i=Ty(this).constructor;a=Reflect.construct(s,arguments,i)}else a=s.apply(this,arguments);return BC(this,a)}}function BC(e,t){if(t&&(xm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return FC(e)}function FC(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function CNe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ty(e){return Ty=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ty(e)}var Wo=(function(e){SNe(n,e);var t=kNe(n);function n(s,a){var i;wNe(this,n),i=t.call(this,s,a);var o=i.props,l=o.isActive,c=o.attributeName,d=o.from,f=o.to,m=o.steps,g=o.children,x=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(FC(i)),i.changeStyle=i.changeStyle.bind(FC(i)),!l||x<=0)return i.state={style:{}},typeof g=="function"&&(i.state={style:f}),BC(i);if(m&&m.length)i.state={style:m[0].style};else if(d){if(typeof g=="function")return i.state={style:d},BC(i);i.state={style:c?xh({},c,d):d}}else i.state={style:{}};return i}return _Ne(n,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,o=a.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,d=i.shouldReAnimate,f=i.to,m=i.from,g=this.state.style;if(l){if(!o){var x={style:c?xh({},c,f):f};this.state&&g&&(c&&g[c]!==f||!c&&g!==f)&&this.setState(x);return}if(!(I_e(a.to,f)&&a.canBegin&&a.isActive)){var j=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var b=j||d?m:a.to;if(this.state&&g){var y={style:c?xh({},c,b):b};(c&&g[c]!==b||!c&&g!==b)&&this.setState(y)}this.runAnimation(pi(pi({},this.props),{},{from:b,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,o=a.from,l=a.to,c=a.duration,d=a.easing,f=a.begin,m=a.onAnimationEnd,g=a.onAnimationStart,x=fNe(o,l,nNe(d),c,this.changeStyle),j=function(){i.stopJSAnimation=x()};this.manager.start([g,f,j,c,m])}},{key:"runStepAnimation",value:function(a){var i=this,o=a.steps,l=a.begin,c=a.onAnimationStart,d=o[0],f=d.style,m=d.duration,g=m===void 0?0:m,x=function(b,y,w){if(w===0)return b;var _=y.duration,N=y.easing,C=N===void 0?"ease":N,k=y.style,S=y.properties,A=y.onAnimationEnd,T=w>0?o[w-1]:y,R=S||Object.keys(k);if(typeof C=="function"||C==="spring")return[].concat(LS(b),[i.runJSAnimation.bind(i,{from:T.style,to:k,duration:_,easing:C}),_]);var B=F$(R,_,C),D=pi(pi(pi({},T.style),k),{},{transition:B});return[].concat(LS(b),[D,_,A]).filter(K_e)};return this.manager.start([c].concat(LS(o.reduce(x,[f,Math.max(g,l)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=F_e());var i=a.begin,o=a.duration,l=a.attributeName,c=a.to,d=a.easing,f=a.onAnimationStart,m=a.onAnimationEnd,g=a.steps,x=a.children,j=this.manager;if(this.unSubscribe=j.subscribe(this.handleStyleChange),typeof d=="function"||typeof x=="function"||d==="spring"){this.runJSAnimation(a);return}if(g.length>1){this.runStepAnimation(a);return}var b=l?xh({},l,c):c,y=F$(Object.keys(b),o,d);j.start([f,i,pi(pi({},b),{},{transition:y}),o,m])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var o=a.duration;a.attributeName,a.easing;var l=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var c=pNe(a,hNe),d=h.Children.count(i),f=this.state.style;if(typeof i=="function")return i(f);if(!l||d===0||o<=0)return i;var m=function(x){var j=x.props,b=j.style,y=b===void 0?{}:b,w=j.className,_=h.cloneElement(x,pi(pi({},c),{},{style:pi(pi({},y),f),className:w}));return _};return d===1?m(h.Children.only(i)):xe.createElement("div",null,h.Children.map(i,function(g){return m(g)}))}}]),n})(h.PureComponent);Wo.displayName="Animate";Wo.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Wo.propTypes={from:Ln.oneOfType([Ln.object,Ln.string]),to:Ln.oneOfType([Ln.object,Ln.string]),attributeName:Ln.string,duration:Ln.number,begin:Ln.number,easing:Ln.oneOfType([Ln.string,Ln.func]),steps:Ln.arrayOf(Ln.shape({duration:Ln.number.isRequired,style:Ln.object.isRequired,easing:Ln.oneOfType([Ln.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Ln.func]),properties:Ln.arrayOf("string"),onAnimationEnd:Ln.func})),children:Ln.oneOfType([Ln.node,Ln.func]),isActive:Ln.bool,canBegin:Ln.bool,onAnimationEnd:Ln.func,shouldReAnimate:Ln.bool,onAnimationStart:Ln.func,onAnimationReStart:Ln.func};function Py(){return Py=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Py.apply(null,arguments)}function pp(e){"@babel/helpers - typeof";return pp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pp(e)}function Oy(){return Oy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Oy.apply(this,arguments)}function ENe(e,t){return ONe(e)||PNe(e,t)||TNe(e,t)||ANe()}function ANe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
951In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TNe(e,t){if(e){if(typeof e=="string")return H$(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 H$(e,t)}}function H$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function PNe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function ONe(e){if(Array.isArray(e))return e}function W$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function G$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?W$(Object(n),!0).forEach(function(s){INe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function INe(e,t,n){return t=RNe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RNe(e){var t=MNe(e,"string");return pp(t)=="symbol"?t:t+""}function MNe(e,t){if(pp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(pp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Y$=function(t,n,s,a,i){var o=Math.min(Math.abs(s)/2,Math.abs(a)/2),l=a>=0?1:-1,c=s>=0?1:-1,d=a>=0&&s>=0||a<0&&s<0?1:0,f;if(o>0&&i instanceof Array){for(var m=[0,0,0,0],g=0,x=4;g<x;g++)m[g]=i[g]>o?o:i[g];f="M".concat(t,",").concat(n+l*m[0]),m[0]>0&&(f+="A ".concat(m[0],",").concat(m[0],",0,0,").concat(d,",").concat(t+c*m[0],",").concat(n)),f+="L ".concat(t+s-c*m[1],",").concat(n),m[1]>0&&(f+="A ".concat(m[1],",").concat(m[1],",0,0,").concat(d,`,
952        `).concat(t+s,",").concat(n+l*m[1])),f+="L ".concat(t+s,",").concat(n+a-l*m[2]),m[2]>0&&(f+="A ".concat(m[2],",").concat(m[2],",0,0,").concat(d,`,
953        `).concat(t+s-c*m[2],",").concat(n+a)),f+="L ".concat(t+c*m[3],",").concat(n+a),m[3]>0&&(f+="A ".concat(m[3],",").concat(m[3],",0,0,").concat(d,`,
954        `).concat(t,",").concat(n+a-l*m[3])),f+="Z"}else if(o>0&&i===+i&&i>0){var j=Math.min(o,i);f="M ".concat(t,",").concat(n+l*j,`
955            A `).concat(j,",").concat(j,",0,0,").concat(d,",").concat(t+c*j,",").concat(n,`
956            L `).concat(t+s-c*j,",").concat(n,`
957            A `).concat(j,",").concat(j,",0,0,").concat(d,",").concat(t+s,",").concat(n+l*j,`
958            L `).concat(t+s,",").concat(n+a-l*j,`
959            A `).concat(j,",").concat(j,",0,0,").concat(d,",").concat(t+s-c*j,",").concat(n+a,`
960            L `).concat(t+c*j,",").concat(n+a,`
961            A `).concat(j,",").concat(j,",0,0,").concat(d,",").concat(t,",").concat(n+a-l*j," Z")}else f="M ".concat(t,",").concat(n," h ").concat(s," v ").concat(a," h ").concat(-s," Z");return f},DNe=function(t,n){if(!t||!n)return!1;var s=t.x,a=t.y,i=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var d=Math.min(i,i+l),f=Math.max(i,i+l),m=Math.min(o,o+c),g=Math.max(o,o+c);return s>=d&&s<=f&&a>=m&&a<=g}return!1},LNe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},PA=function(t){var n=G$(G$({},LNe),t),s=h.useRef(),a=h.useState(-1),i=ENe(a,2),o=i[0],l=i[1];h.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var C=s.current.getTotalLength();C&&l(C)}catch{}},[]);var c=n.x,d=n.y,f=n.width,m=n.height,g=n.radius,x=n.className,j=n.animationEasing,b=n.animationDuration,y=n.animationBegin,w=n.isAnimationActive,_=n.isUpdateAnimationActive;if(c!==+c||d!==+d||f!==+f||m!==+m||f===0||m===0)return null;var N=wn("recharts-rectangle",x);return _?xe.createElement(Wo,{canBegin:o>0,from:{width:f,height:m,x:c,y:d},to:{width:f,height:m,x:c,y:d},duration:b,animationEasing:j,isActive:_},function(C){var k=C.width,S=C.height,A=C.x,T=C.y;return xe.createElement(Wo,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:b,isActive:w,easing:j},xe.createElement("path",Oy({},jn(n,!0),{className:N,d:Y$(A,T,k,S,g),ref:s})))}):xe.createElement("path",Oy({},jn(n,!0),{className:N,d:Y$(c,d,f,m,g)}))};function zC(){return zC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},zC.apply(this,arguments)}var OA=function(t){var n=t.cx,s=t.cy,a=t.r,i=t.className,o=wn("recharts-dot",i);return n===+n&&s===+s&&a===+a?h.createElement("circle",zC({},jn(t,!1),Q0(t),{className:o,cx:n,cy:s,r:a})):null};function gp(e){"@babel/helpers - typeof";return gp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gp(e)}var $Ne=["x","y","top","left","width","height","className"];function UC(){return UC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},UC.apply(this,arguments)}function J$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function BNe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?J$(Object(n),!0).forEach(function(s){FNe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function FNe(e,t,n){return t=zNe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zNe(e){var t=UNe(e,"string");return gp(t)=="symbol"?t:t+""}function UNe(e,t){if(gp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(gp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qNe(e,t){if(e==null)return{};var n=KNe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function KNe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var VNe=function(t,n,s,a,i,o){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(o,",").concat(n,"h").concat(s)},HNe=function(t){var n=t.x,s=n===void 0?0:n,a=t.y,i=a===void 0?0:a,o=t.top,l=o===void 0?0:o,c=t.left,d=c===void 0?0:c,f=t.width,m=f===void 0?0:f,g=t.height,x=g===void 0?0:g,j=t.className,b=qNe(t,$Ne),y=BNe({x:s,y:i,top:l,left:d,width:m,height:x},b);return!ht(s)||!ht(i)||!ht(m)||!ht(x)||!ht(l)||!ht(d)?null:xe.createElement("path",UC({},jn(y,!0),{className:wn("recharts-cross",j),d:VNe(s,i,m,x,l,d)}))},$S,Q$;function WNe(){if(Q$)return $S;Q$=1;var e=Kq(),t=e(Object.getPrototypeOf,Object);return $S=t,$S}var BS,X$;function GNe(){if(X$)return BS;X$=1;var e=nl(),t=WNe(),n=rl(),s="[object Object]",a=Function.prototype,i=Object.prototype,o=a.toString,l=i.hasOwnProperty,c=o.call(Object);function d(f){if(!n(f)||e(f)!=s)return!1;var m=t(f);if(m===null)return!0;var g=l.call(m,"constructor")&&m.constructor;return typeof g=="function"&&g instanceof g&&o.call(g)==c}return BS=d,BS}var YNe=GNe();const JNe=Un(YNe);var FS,Z$;function QNe(){if(Z$)return FS;Z$=1;var e=nl(),t=rl(),n="[object Boolean]";function s(a){return a===!0||a===!1||t(a)&&e(a)==n}return FS=s,FS}var XNe=QNe();const ZNe=Un(XNe);function xp(e){"@babel/helpers - typeof";return xp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xp(e)}function Iy(){return Iy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Iy.apply(this,arguments)}function eSe(e,t){return sSe(e)||rSe(e,t)||nSe(e,t)||tSe()}function tSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
962In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nSe(e,t){if(e){if(typeof e=="string")return e6(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 e6(e,t)}}function e6(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function rSe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function sSe(e){if(Array.isArray(e))return e}function t6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function n6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?t6(Object(n),!0).forEach(function(s){aSe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function aSe(e,t,n){return t=iSe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iSe(e){var t=oSe(e,"string");return xp(t)=="symbol"?t:t+""}function oSe(e,t){if(xp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(xp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var r6=function(t,n,s,a,i){var o=s-a,l;return l="M ".concat(t,",").concat(n),l+="L ".concat(t+s,",").concat(n),l+="L ".concat(t+s-o/2,",").concat(n+i),l+="L ".concat(t+s-o/2-a,",").concat(n+i),l+="L ".concat(t,",").concat(n," Z"),l},lSe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},cSe=function(t){var n=n6(n6({},lSe),t),s=h.useRef(),a=h.useState(-1),i=eSe(a,2),o=i[0],l=i[1];h.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var N=s.current.getTotalLength();N&&l(N)}catch{}},[]);var c=n.x,d=n.y,f=n.upperWidth,m=n.lowerWidth,g=n.height,x=n.className,j=n.animationEasing,b=n.animationDuration,y=n.animationBegin,w=n.isUpdateAnimationActive;if(c!==+c||d!==+d||f!==+f||m!==+m||g!==+g||f===0&&m===0||g===0)return null;var _=wn("recharts-trapezoid",x);return w?xe.createElement(Wo,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:g,x:c,y:d},to:{upperWidth:f,lowerWidth:m,height:g,x:c,y:d},duration:b,animationEasing:j,isActive:w},function(N){var C=N.upperWidth,k=N.lowerWidth,S=N.height,A=N.x,T=N.y;return xe.createElement(Wo,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:b,easing:j},xe.createElement("path",Iy({},jn(n,!0),{className:_,d:r6(A,T,C,k,S),ref:s})))}):xe.createElement("g",null,xe.createElement("path",Iy({},jn(n,!0),{className:_,d:r6(c,d,f,m,g)})))},dSe=["option","shapeType","propTransformer","activeClassName","isActive"];function yp(e){"@babel/helpers - typeof";return yp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yp(e)}function uSe(e,t){if(e==null)return{};var n=mSe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function mSe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function s6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Ry(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?s6(Object(n),!0).forEach(function(s){fSe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function fSe(e,t,n){return t=hSe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hSe(e){var t=pSe(e,"string");return yp(t)=="symbol"?t:t+""}function pSe(e,t){if(yp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(yp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gSe(e,t){return Ry(Ry({},t),e)}function xSe(e,t){return e==="symbols"}function a6(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return xe.createElement(PA,n);case"trapezoid":return xe.createElement(cSe,n);case"sector":return xe.createElement(h9,n);case"symbols":if(xSe(t))return xe.createElement(JE,n);break;default:return null}}function ySe(e){return h.isValidElement(e)?e.props:e}function bSe(e){var t=e.option,n=e.shapeType,s=e.propTransformer,a=s===void 0?gSe:s,i=e.activeClassName,o=i===void 0?"recharts-active-shape":i,l=e.isActive,c=uSe(e,dSe),d;if(h.isValidElement(t))d=h.cloneElement(t,Ry(Ry({},c),ySe(t)));else if(gn(t))d=t(c);else if(JNe(t)&&!ZNe(t)){var f=a(t,c);d=xe.createElement(a6,{shapeType:n,elementProps:f})}else{var m=c;d=xe.createElement(a6,{shapeType:n,elementProps:m})}return l?xe.createElement(Cr,{className:o},d):d}function mv(e,t){return t!=null&&"trapezoids"in e.props}function fv(e,t){return t!=null&&"sectors"in e.props}function bp(e,t){return t!=null&&"points"in e.props}function vSe(e,t){var n,s,a=e.x===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.x)||e.x===t.x,i=e.y===(t==null||(s=t.labelViewBox)===null||s===void 0?void 0:s.y)||e.y===t.y;return a&&i}function wSe(e,t){var n=e.endAngle===t.endAngle,s=e.startAngle===t.startAngle;return n&&s}function jSe(e,t){var n=e.x===t.x,s=e.y===t.y,a=e.z===t.z;return n&&s&&a}function _Se(e,t){var n;return mv(e,t)?n=vSe:fv(e,t)?n=wSe:bp(e,t)&&(n=jSe),n}function NSe(e,t){var n;return mv(e,t)?n="trapezoids":fv(e,t)?n="sectors":bp(e,t)&&(n="points"),n}function SSe(e,t){if(mv(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if(fv(e,t)){var s;return(s=t.tooltipPayload)===null||s===void 0||(s=s[0])===null||s===void 0||(s=s.payload)===null||s===void 0?void 0:s.payload}return bp(e,t)?t.payload:{}}function kSe(e){var t=e.activeTooltipItem,n=e.graphicalItem,s=e.itemData,a=NSe(n,t),i=SSe(n,t),o=s.filter(function(c,d){var f=cv(i,c),m=n.props[a].filter(function(j){var b=_Se(n,t);return b(j,t)}),g=n.props[a].indexOf(m[m.length-1]),x=d===g;return f&&x}),l=s.indexOf(o[o.length-1]);return l}var zS,i6;function CSe(){if(i6)return zS;i6=1;var e=Math.ceil,t=Math.max;function n(s,a,i,o){for(var l=-1,c=t(e((a-s)/(i||1)),0),d=Array(c);c--;)d[o?c:++l]=s,s+=i;return d}return zS=n,zS}var US,o6;function j9(){if(o6)return US;o6=1;var e=iK(),t=1/0,n=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return US=s,US}var qS,l6;function ESe(){if(l6)return qS;l6=1;var e=CSe(),t=ev(),n=j9();function s(a){return function(i,o,l){return l&&typeof l!="number"&&t(i,o,l)&&(o=l=void 0),i=n(i),o===void 0?(o=i,i=0):o=n(o),l=l===void 0?i<o?1:-1:n(l),e(i,o,l,a)}}return qS=s,qS}var KS,c6;function ASe(){if(c6)return KS;c6=1;var e=ESe(),t=e();return KS=t,KS}var TSe=ASe();const My=Un(TSe);function vp(e){"@babel/helpers - typeof";return vp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vp(e)}function d6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function u6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?d6(Object(n),!0).forEach(function(s){_9(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function _9(e,t,n){return t=PSe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PSe(e){var t=OSe(e,"string");return vp(t)=="symbol"?t:t+""}function OSe(e,t){if(vp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(vp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ISe=["Webkit","Moz","O","ms"],RSe=function(t,n){var s=t.replace(/(\w)/,function(i){return i.toUpperCase()}),a=ISe.reduce(function(i,o){return u6(u6({},i),{},_9({},o+s,n))},{});return a[t]=n,a};function ym(e){"@babel/helpers - typeof";return ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ym(e)}function Dy(){return Dy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Dy.apply(this,arguments)}function m6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function VS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?m6(Object(n),!0).forEach(function(s){pa(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function MSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f6(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,S9(s.key),s)}}function DSe(e,t,n){return t&&f6(e.prototype,t),n&&f6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function LSe(e,t,n){return t=Ly(t),$Se(e,N9()?Reflect.construct(t,n||[],Ly(e).constructor):t.apply(e,n))}function $Se(e,t){if(t&&(ym(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BSe(e)}function BSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(N9=function(){return!!e})()}function Ly(e){return Ly=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ly(e)}function FSe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qC(e,t)}function qC(e,t){return qC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},qC(e,t)}function pa(e,t,n){return t=S9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S9(e){var t=zSe(e,"string");return ym(t)=="symbol"?t:t+""}function zSe(e,t){if(ym(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(ym(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var USe=function(t){var n=t.data,s=t.startIndex,a=t.endIndex,i=t.x,o=t.width,l=t.travellerWidth;if(!n||!n.length)return{};var c=n.length,d=Ch().domain(My(0,c)).range([i,i+o-l]),f=d.domain().map(function(m){return d(m)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:d(s),endX:d(a),scale:d,scaleValues:f}},h6=function(t){return t.changedTouches&&!!t.changedTouches.length},bm=(function(e){function t(n){var s;return MSe(this,t),s=LSe(this,t,[n]),pa(s,"handleDrag",function(a){s.leaveTimer&&(clearTimeout(s.leaveTimer),s.leaveTimer=null),s.state.isTravellerMoving?s.handleTravellerMove(a):s.state.isSlideMoving&&s.handleSlideDrag(a)}),pa(s,"handleTouchMove",function(a){a.changedTouches!=null&&a.changedTouches.length>0&&s.handleDrag(a.changedTouches[0])}),pa(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=s.props,i=a.endIndex,o=a.onDragEnd,l=a.startIndex;o==null||o({endIndex:i,startIndex:l})}),s.detachDragEndListener()}),pa(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),pa(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),pa(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),pa(s,"handleSlideDragStart",function(a){var i=h6(a)?a.changedTouches[0]:a;s.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),s.attachDragEndListener()}),s.travellerDragStartHandlers={startX:s.handleTravellerDragStart.bind(s,"startX"),endX:s.handleTravellerDragStart.bind(s,"endX")},s.state={},s}return FSe(t,e),DSe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var a=s.startX,i=s.endX,o=this.state.scaleValues,l=this.props,c=l.gap,d=l.data,f=d.length-1,m=Math.min(a,i),g=Math.max(a,i),x=t.getIndexInRange(o,m),j=t.getIndexInRange(o,g);return{startIndex:x-x%c,endIndex:j===f?f:j-j%c}}},{key:"getTextOfTick",value:function(s){var a=this.props,i=a.data,o=a.tickFormatter,l=a.dataKey,c=ka(i[s],l,s);return gn(o)?o(c,s):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(s){var a=this.state,i=a.slideMoveStartX,o=a.startX,l=a.endX,c=this.props,d=c.x,f=c.width,m=c.travellerWidth,g=c.startIndex,x=c.endIndex,j=c.onChange,b=s.pageX-i;b>0?b=Math.min(b,d+f-m-l,d+f-m-o):b<0&&(b=Math.max(b,d-o,d-l));var y=this.getIndex({startX:o+b,endX:l+b});(y.startIndex!==g||y.endIndex!==x)&&j&&j(y),this.setState({startX:o+b,endX:l+b,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,a){var i=h6(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var a=this.state,i=a.brushMoveStartX,o=a.movingTravellerId,l=a.endX,c=a.startX,d=this.state[o],f=this.props,m=f.x,g=f.width,x=f.travellerWidth,j=f.onChange,b=f.gap,y=f.data,w={startX:this.state.startX,endX:this.state.endX},_=s.pageX-i;_>0?_=Math.min(_,m+g-x-d):_<0&&(_=Math.max(_,m-d)),w[o]=d+_;var N=this.getIndex(w),C=N.startIndex,k=N.endIndex,S=function(){var T=y.length-1;return o==="startX"&&(l>c?C%b===0:k%b===0)||l<c&&k===T||o==="endX"&&(l>c?k%b===0:C%b===0)||l>c&&k===T};this.setState(pa(pa({},o,d+_),"brushMoveStartX",s.pageX),function(){j&&S()&&j(N)})}},{key:"handleTravellerMoveKeyboard",value:function(s,a){var i=this,o=this.state,l=o.scaleValues,c=o.startX,d=o.endX,f=this.state[a],m=l.indexOf(f);if(m!==-1){var g=m+s;if(!(g===-1||g>=l.length)){var x=l[g];a==="startX"&&x>=d||a==="endX"&&x<=c||this.setState(pa({},a,x),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.fill,d=s.stroke;return xe.createElement("rect",{stroke:d,fill:c,x:a,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.data,d=s.children,f=s.padding,m=h.Children.only(d);return m?xe.cloneElement(m,{x:a,y:i,width:o,height:l,margin:f,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(s,a){var i,o,l=this,c=this.props,d=c.y,f=c.travellerWidth,m=c.height,g=c.traveller,x=c.ariaLabel,j=c.data,b=c.startIndex,y=c.endIndex,w=Math.max(s,this.props.x),_=VS(VS({},jn(this.props,!1)),{},{x:w,y:d,width:f,height:m}),N=x||"Min value: ".concat((i=j[b])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=j[y])===null||o===void 0?void 0:o.name);return xe.createElement(Cr,{tabIndex:0,role:"slider","aria-label":N,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(k){["ArrowLeft","ArrowRight"].includes(k.key)&&(k.preventDefault(),k.stopPropagation(),l.handleTravellerMoveKeyboard(k.key==="ArrowRight"?1:-1,a))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(g,_))}},{key:"renderSlide",value:function(s,a){var i=this.props,o=i.y,l=i.height,c=i.stroke,d=i.travellerWidth,f=Math.min(s,a)+d,m=Math.max(Math.abs(a-s)-d,0);return xe.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:f,y:o,width:m,height:l})}},{key:"renderText",value:function(){var s=this.props,a=s.startIndex,i=s.endIndex,o=s.y,l=s.height,c=s.travellerWidth,d=s.stroke,f=this.state,m=f.startX,g=f.endX,x=5,j={pointerEvents:"none",fill:d};return xe.createElement(Cr,{className:"recharts-brush-texts"},xe.createElement(cy,Dy({textAnchor:"end",verticalAnchor:"middle",x:Math.min(m,g)-x,y:o+l/2},j),this.getTextOfTick(a)),xe.createElement(cy,Dy({textAnchor:"start",verticalAnchor:"middle",x:Math.max(m,g)+c+x,y:o+l/2},j),this.getTextOfTick(i)))}},{key:"render",value:function(){var s=this.props,a=s.data,i=s.className,o=s.children,l=s.x,c=s.y,d=s.width,f=s.height,m=s.alwaysShowText,g=this.state,x=g.startX,j=g.endX,b=g.isTextActive,y=g.isSlideMoving,w=g.isTravellerMoving,_=g.isTravellerFocused;if(!a||!a.length||!ht(l)||!ht(c)||!ht(d)||!ht(f)||d<=0||f<=0)return null;var N=wn("recharts-brush",i),C=xe.Children.count(o)===1,k=RSe("userSelect","none");return xe.createElement(Cr,{className:N,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:k},this.renderBackground(),C&&this.renderPanorama(),this.renderSlide(x,j),this.renderTravellerLayer(x,"startX"),this.renderTravellerLayer(j,"endX"),(b||y||w||_||m)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var a=s.x,i=s.y,o=s.width,l=s.height,c=s.stroke,d=Math.floor(i+l/2)-1;return xe.createElement(xe.Fragment,null,xe.createElement("rect",{x:a,y:i,width:o,height:l,fill:c,stroke:"none"}),xe.createElement("line",{x1:a+1,y1:d,x2:a+o-1,y2:d,fill:"none",stroke:"#fff"}),xe.createElement("line",{x1:a+1,y1:d+2,x2:a+o-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,a){var i;return xe.isValidElement(s)?i=xe.cloneElement(s,a):gn(s)?i=s(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(s,a){var i=s.data,o=s.width,l=s.x,c=s.travellerWidth,d=s.updateId,f=s.startIndex,m=s.endIndex;if(i!==a.prevData||d!==a.prevUpdateId)return VS({prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o},i&&i.length?USe({data:i,width:o,x:l,travellerWidth:c,startIndex:f,endIndex:m}):{scale:null,scaleValues:null});if(a.scale&&(o!==a.prevWidth||l!==a.prevX||c!==a.prevTravellerWidth)){a.scale.range([l,l+o-c]);var g=a.scale.domain().map(function(x){return a.scale(x)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o,startX:a.scale(s.startIndex),endX:a.scale(s.endIndex),scaleValues:g}}return null}},{key:"getIndexInRange",value:function(s,a){for(var i=s.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);s[c]>a?l=c:o=c}return a>=s[l]?l:o}}])})(h.PureComponent);pa(bm,"displayName","Brush");pa(bm,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var HS,p6;function qSe(){if(p6)return HS;p6=1;var e=rA();function t(n,s){var a;return e(n,function(i,o,l){return a=s(i,o,l),!a}),!!a}return HS=t,HS}var WS,g6;function KSe(){if(g6)return WS;g6=1;var e=Lq(),t=bc(),n=qSe(),s=aa(),a=ev();function i(o,l,c){var d=s(o)?e:n;return c&&a(o,l,c)&&(l=void 0),d(o,t(l,3))}return WS=i,WS}var VSe=KSe();const HSe=Un(VSe);var to=function(t,n){var s=t.alwaysShow,a=t.ifOverflow;return s&&(a="extendDomain"),a===n},GS,x6;function WSe(){if(x6)return GS;x6=1;var e=tK();function t(n,s,a){s=="__proto__"&&e?e(n,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[s]=a}return GS=t,GS}var YS,y6;function GSe(){if(y6)return YS;y6=1;var e=WSe(),t=Zq(),n=bc();function s(a,i){var o={};return i=n(i,3),t(a,function(l,c,d){e(o,c,i(l,c,d))}),o}return YS=s,YS}var YSe=GSe();const JSe=Un(YSe);var JS,b6;function QSe(){if(b6)return JS;b6=1;function e(t,n){for(var s=-1,a=t==null?0:t.length;++s<a;)if(!n(t[s],s,t))return!1;return!0}return JS=e,JS}var QS,v6;function XSe(){if(v6)return QS;v6=1;var e=rA();function t(n,s){var a=!0;return e(n,function(i,o,l){return a=!!s(i,o,l),a}),a}return QS=t,QS}var XS,w6;function ZSe(){if(w6)return XS;w6=1;var e=QSe(),t=XSe(),n=bc(),s=aa(),a=ev();function i(o,l,c){var d=s(o)?e:t;return c&&a(o,l,c)&&(l=void 0),d(o,n(l,3))}return XS=i,XS}var eke=ZSe();const tke=Un(eke);var nke=["x","y"];function wp(e){"@babel/helpers - typeof";return wp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wp(e)}function KC(){return KC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},KC.apply(this,arguments)}function j6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function nh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?j6(Object(n),!0).forEach(function(s){rke(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function rke(e,t,n){return t=ske(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ske(e){var t=ake(e,"string");return wp(t)=="symbol"?t:t+""}function ake(e,t){if(wp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(wp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ike(e,t){if(e==null)return{};var n=oke(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function oke(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function lke(e,t){var n=e.x,s=e.y,a=ike(e,nke),i="".concat(n),o=parseInt(i,10),l="".concat(s),c=parseInt(l,10),d="".concat(t.height||a.height),f=parseInt(d,10),m="".concat(t.width||a.width),g=parseInt(m,10);return nh(nh(nh(nh(nh({},t),a),o?{x:o}:{}),c?{y:c}:{}),{},{height:f,width:g,name:t.name,radius:t.radius})}function _6(e){return xe.createElement(bSe,KC({shapeType:"rectangle",propTransformer:lke,activeClassName:"recharts-active-bar"},e))}var cke=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,a){if(typeof t=="number")return t;var i=ht(s)||hpe(s);return i?t(s,a):(i||ic(),n)}},dke=["value","background"],k9;function vm(e){"@babel/helpers - typeof";return vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vm(e)}function uke(e,t){if(e==null)return{};var n=mke(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function mke(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function $y(){return $y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},$y.apply(this,arguments)}function N6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Rr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?N6(Object(n),!0).forEach(function(s){Vl(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function fke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S6(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,E9(s.key),s)}}function hke(e,t,n){return t&&S6(e.prototype,t),n&&S6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pke(e,t,n){return t=By(t),gke(e,C9()?Reflect.construct(t,n||[],By(e).constructor):t.apply(e,n))}function gke(e,t){if(t&&(vm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xke(e)}function xke(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(C9=function(){return!!e})()}function By(e){return By=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},By(e)}function yke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&VC(e,t)}function VC(e,t){return VC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},VC(e,t)}function Vl(e,t,n){return t=E9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E9(e){var t=bke(e,"string");return vm(t)=="symbol"?t:t+""}function bke(e,t){if(vm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(vm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Cs=(function(e){function t(){var n;fke(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return n=pke(this,t,[].concat(a)),Vl(n,"state",{isAnimationFinished:!1}),Vl(n,"id",dg("recharts-bar-")),Vl(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),Vl(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return yke(t,e),hke(t,[{key:"renderRectanglesStatically",value:function(s){var a=this,i=this.props,o=i.shape,l=i.dataKey,c=i.activeIndex,d=i.activeBar,f=jn(this.props,!1);return s&&s.map(function(m,g){var x=g===c,j=x?d:o,b=Rr(Rr(Rr({},f),m),{},{isActive:x,option:j,index:g,dataKey:l,onAnimationStart:a.handleAnimationStart,onAnimationEnd:a.handleAnimationEnd});return xe.createElement(Cr,$y({className:"recharts-bar-rectangle"},X0(a.props,m,g),{key:"rectangle-".concat(m==null?void 0:m.x,"-").concat(m==null?void 0:m.y,"-").concat(m==null?void 0:m.value,"-").concat(g)}),xe.createElement(_6,b))})}},{key:"renderRectanglesWithAnimation",value:function(){var s=this,a=this.props,i=a.data,o=a.layout,l=a.isAnimationActive,c=a.animationBegin,d=a.animationDuration,f=a.animationEasing,m=a.animationId,g=this.state.prevData;return xe.createElement(Wo,{begin:c,duration:d,isActive:l,easing:f,from:{t:0},to:{t:1},key:"bar-".concat(m),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(x){var j=x.t,b=i.map(function(y,w){var _=g&&g[w];if(_){var N=_i(_.x,y.x),C=_i(_.y,y.y),k=_i(_.width,y.width),S=_i(_.height,y.height);return Rr(Rr({},y),{},{x:N(j),y:C(j),width:k(j),height:S(j)})}if(o==="horizontal"){var A=_i(0,y.height),T=A(j);return Rr(Rr({},y),{},{y:y.y+y.height-T,height:T})}var R=_i(0,y.width),B=R(j);return Rr(Rr({},y),{},{width:B})});return xe.createElement(Cr,null,s.renderRectanglesStatically(b))})}},{key:"renderRectangles",value:function(){var s=this.props,a=s.data,i=s.isAnimationActive,o=this.state.prevData;return i&&a&&a.length&&(!o||!cv(o,a))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(a)}},{key:"renderBackground",value:function(){var s=this,a=this.props,i=a.data,o=a.dataKey,l=a.activeIndex,c=jn(this.props.background,!1);return i.map(function(d,f){d.value;var m=d.background,g=uke(d,dke);if(!m)return null;var x=Rr(Rr(Rr(Rr(Rr({},g),{},{fill:"#eee"},m),c),X0(s.props,d,f)),{},{onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd,dataKey:o,index:f,className:"recharts-bar-background-rectangle"});return xe.createElement(_6,$y({key:"background-bar-".concat(f),option:s.props.background,isActive:f===l},x))})}},{key:"renderErrorBar",value:function(s,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.data,l=i.xAxis,c=i.yAxis,d=i.layout,f=i.children,m=Ja(f,xg);if(!m)return null;var g=d==="vertical"?o[0].height/2:o[0].width/2,x=function(y,w){var _=Array.isArray(y.value)?y.value[1]:y.value;return{x:y.x,y:y.y,value:_,errorVal:ka(y,w)}},j={clipPath:s?"url(#clipPath-".concat(a,")"):null};return xe.createElement(Cr,j,m.map(function(b){return xe.cloneElement(b,{key:"error-bar-".concat(a,"-").concat(b.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,offset:g,dataPointFormatter:x})}))}},{key:"render",value:function(){var s=this.props,a=s.hide,i=s.data,o=s.className,l=s.xAxis,c=s.yAxis,d=s.left,f=s.top,m=s.width,g=s.height,x=s.isAnimationActive,j=s.background,b=s.id;if(a||!i||!i.length)return null;var y=this.state.isAnimationFinished,w=wn("recharts-bar",o),_=l&&l.allowDataOverflow,N=c&&c.allowDataOverflow,C=_||N,k=hn(b)?this.id:b;return xe.createElement(Cr,{className:w},_||N?xe.createElement("defs",null,xe.createElement("clipPath",{id:"clipPath-".concat(k)},xe.createElement("rect",{x:_?d:d-m/2,y:N?f:f-g/2,width:_?m:m*2,height:N?g:g*2}))):null,xe.createElement(Cr,{className:"recharts-bar-rectangles",clipPath:C?"url(#clipPath-".concat(k,")"):null},j?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(C,k),(!x||y)&&Uo.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curData:s.data,prevData:a.curData}:s.data!==a.curData?{curData:s.data}:null}}])})(h.PureComponent);k9=Cs;Vl(Cs,"displayName","Bar");Vl(Cs,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Zm.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Vl(Cs,"getComposedData",function(e){var t=e.props,n=e.item,s=e.barPosition,a=e.bandSize,i=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,d=e.stackedData,f=e.dataStartIndex,m=e.displayedData,g=e.offset,x=Ije(s,n);if(!x)return null;var j=t.layout,b=n.type.defaultProps,y=b!==void 0?Rr(Rr({},b),n.props):n.props,w=y.dataKey,_=y.children,N=y.minPointSize,C=j==="horizontal"?o:i,k=d?C.scale.domain():null,S=zje({numericAxis:C}),A=Ja(_,mg),T=m.map(function(R,B){var D,P,I,z,L,H;d?D=Rje(d[f+B],k):(D=ka(R,w),Array.isArray(D)||(D=[S,D]));var W=cke(N,k9.defaultProps.minPointSize)(D[1],B);if(j==="horizontal"){var V,K=[o.scale(D[0]),o.scale(D[1])],M=K[0],G=K[1];P=u$({axis:i,ticks:l,bandSize:a,offset:x.offset,entry:R,index:B}),I=(V=G??M)!==null&&V!==void 0?V:void 0,z=x.size;var q=M-G;if(L=Number.isNaN(q)?0:q,H={x:P,y:o.y,width:z,height:o.height},Math.abs(W)>0&&Math.abs(L)<Math.abs(W)){var F=Si(L||W)*(Math.abs(W)-Math.abs(L));I-=F,L+=F}}else{var U=[i.scale(D[0]),i.scale(D[1])],ee=U[0],ne=U[1];if(P=ee,I=u$({axis:o,ticks:c,bandSize:a,offset:x.offset,entry:R,index:B}),z=ne-ee,L=x.size,H={x:i.x,y:I,width:i.width,height:L},Math.abs(W)>0&&Math.abs(z)<Math.abs(W)){var X=Si(z||W)*(Math.abs(W)-Math.abs(z));z+=X}}return Rr(Rr(Rr({},R),{},{x:P,y:I,width:z,height:L,value:d?D:D[1],payload:R,background:H},A&&A[B]&&A[B].props),{},{tooltipPayload:[u9(n,R)],tooltipPosition:{x:P+z/2,y:I+L/2}})});return Rr({data:T,layout:j},g)});function jp(e){"@babel/helpers - typeof";return jp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jp(e)}function vke(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<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,A9(s.key),s)}}function wke(e,t,n){return t&&k6(e.prototype,t),n&&k6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function C6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function wi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?C6(Object(n),!0).forEach(function(s){hv(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function hv(e,t,n){return t=A9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A9(e){var t=jke(e,"string");return jp(t)=="symbol"?t:t+""}function jke(e,t){if(jp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(jp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var T9=function(t,n,s,a,i){var o=t.width,l=t.height,c=t.layout,d=t.children,f=Object.keys(n),m={left:s.left,leftMirror:s.left,right:o-s.right,rightMirror:o-s.right,top:s.top,topMirror:s.top,bottom:l-s.bottom,bottomMirror:l-s.bottom},g=!!ga(d,Cs);return f.reduce(function(x,j){var b=n[j],y=b.orientation,w=b.domain,_=b.padding,N=_===void 0?{}:_,C=b.mirror,k=b.reversed,S="".concat(y).concat(C?"Mirror":""),A,T,R,B,D;if(b.type==="number"&&(b.padding==="gap"||b.padding==="no-gap")){var P=w[1]-w[0],I=1/0,z=b.categoricalDomain.sort(xpe);if(z.forEach(function(U,ee){ee>0&&(I=Math.min((U||0)-(z[ee-1]||0),I))}),Number.isFinite(I)){var L=I/P,H=b.layout==="vertical"?s.height:s.width;if(b.padding==="gap"&&(A=L*H/2),b.padding==="no-gap"){var W=Td(t.barCategoryGap,L*H),V=L*H/2;A=V-W-(V-W)/H*W}}}a==="xAxis"?T=[s.left+(N.left||0)+(A||0),s.left+s.width-(N.right||0)-(A||0)]:a==="yAxis"?T=c==="horizontal"?[s.top+s.height-(N.bottom||0),s.top+(N.top||0)]:[s.top+(N.top||0)+(A||0),s.top+s.height-(N.bottom||0)-(A||0)]:T=b.range,k&&(T=[T[1],T[0]]);var K=Pje(b,i,g),M=K.scale,G=K.realScaleType;M.domain(w).range(T),Oje(M);var q=Fje(M,wi(wi({},b),{},{realScaleType:G}));a==="xAxis"?(D=y==="top"&&!C||y==="bottom"&&C,R=s.left,B=m[S]-D*b.height):a==="yAxis"&&(D=y==="left"&&!C||y==="right"&&C,R=m[S]-D*b.width,B=s.top);var F=wi(wi(wi({},b),q),{},{realScaleType:G,x:R,y:B,scale:M,width:a==="xAxis"?s.width:b.width,height:a==="yAxis"?s.height:b.height});return F.bandSize=Ny(F,q),!b.hide&&a==="xAxis"?m[S]+=(D?-1:1)*F.height:b.hide||(m[S]+=(D?-1:1)*F.width),wi(wi({},x),{},hv({},j,F))},{})},P9=function(t,n){var s=t.x,a=t.y,i=n.x,o=n.y;return{x:Math.min(s,i),y:Math.min(a,o),width:Math.abs(i-s),height:Math.abs(o-a)}},_ke=function(t){var n=t.x1,s=t.y1,a=t.x2,i=t.y2;return P9({x:n,y:s},{x:a,y:i})},O9=(function(){function e(t){vke(this,e),this.scale=t}return wke(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.bandAware,i=s.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(a){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),a=s[0],i=s[s.length-1];return a<=i?n>=a&&n<=i:n>=i&&n<=a}}],[{key:"create",value:function(n){return new e(n)}}])})();hv(O9,"EPS",1e-4);var IA=function(t){var n=Object.keys(t).reduce(function(s,a){return wi(wi({},s),{},hv({},a,O9.create(t[a])))},{});return wi(wi({},n),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return JSe(a,function(c,d){return n[d].apply(c,{bandAware:o,position:l})})},isInRange:function(a){return tke(a,function(i,o){return n[o].isInRange(i)})}})};function Nke(e){return(e%180+180)%180}var Ske=function(t){var n=t.width,s=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=Nke(a),o=i*Math.PI/180,l=Math.atan(s/n),c=o>l&&o<Math.PI-l?s/Math.sin(o):n/Math.cos(o);return Math.abs(c)},ZS,E6;function kke(){if(E6)return ZS;E6=1;var e=bc(),t=ug(),n=Xb();function s(a){return function(i,o,l){var c=Object(i);if(!t(i)){var d=e(o,3);i=n(i),o=function(m){return d(c[m],m,c)}}var f=a(i,o,l);return f>-1?c[d?i[f]:f]:void 0}}return ZS=s,ZS}var ek,A6;function Cke(){if(A6)return ek;A6=1;var e=j9();function t(n){var s=e(n),a=s%1;return s===s?a?s-a:s:0}return ek=t,ek}var tk,T6;function Eke(){if(T6)return tk;T6=1;var e=Gq(),t=bc(),n=Cke(),s=Math.max;function a(i,o,l){var c=i==null?0:i.length;if(!c)return-1;var d=l==null?0:n(l);return d<0&&(d=s(c+d,0)),e(i,t(o,3),d)}return tk=a,tk}var nk,P6;function Ake(){if(P6)return nk;P6=1;var e=kke(),t=Eke(),n=e(t);return nk=n,nk}Ake();var Tke=dq();const Pke=Un(Tke);var Oke=Pke(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),I9=h.createContext(void 0),R9=h.createContext(void 0),M9=h.createContext(void 0),Ike=h.createContext({}),D9=h.createContext(void 0),L9=h.createContext(0),$9=h.createContext(0),O6=function(t){var n=t.state,s=n.xAxisMap,a=n.yAxisMap,i=n.offset,o=t.clipPathId,l=t.children,c=t.width,d=t.height,f=Oke(i);return xe.createElement(I9.Provider,{value:s},xe.createElement(R9.Provider,{value:a},xe.createElement(Ike.Provider,{value:i},xe.createElement(M9.Provider,{value:f},xe.createElement(D9.Provider,{value:o},xe.createElement(L9.Provider,{value:d},xe.createElement($9.Provider,{value:c},l)))))))},Rke=function(){return h.useContext(D9)},B9=function(t){var n=h.useContext(I9);n==null&&ic();var s=n[t];return s==null&&ic(),s},F9=function(t){var n=h.useContext(R9);n==null&&ic();var s=n[t];return s==null&&ic(),s},Mke=function(){var t=h.useContext(M9);return t},z9=function(){return h.useContext($9)},U9=function(){return h.useContext(L9)};function wm(e){"@babel/helpers - typeof";return wm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wm(e)}function Dke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lke(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,K9(s.key),s)}}function $ke(e,t,n){return t&&Lke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Bke(e,t,n){return t=Fy(t),Fke(e,q9()?Reflect.construct(t,n||[],Fy(e).constructor):t.apply(e,n))}function Fke(e,t){if(t&&(wm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zke(e)}function zke(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(q9=function(){return!!e})()}function Fy(e){return Fy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Fy(e)}function Uke(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&HC(e,t)}function HC(e,t){return HC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},HC(e,t)}function I6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function R6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?I6(Object(n),!0).forEach(function(s){RA(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function RA(e,t,n){return t=K9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K9(e){var t=qke(e,"string");return wm(t)=="symbol"?t:t+""}function qke(e,t){if(wm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(wm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Kke(e,t){return Gke(e)||Wke(e,t)||Hke(e,t)||Vke()}function Vke(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
963In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hke(e,t){if(e){if(typeof e=="string")return M6(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 M6(e,t)}}function M6(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function Wke(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function Gke(e){if(Array.isArray(e))return e}function WC(){return WC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},WC.apply(this,arguments)}var Yke=function(t,n){var s;return xe.isValidElement(t)?s=xe.cloneElement(t,n):gn(t)?s=t(n):s=xe.createElement("line",WC({},n,{className:"recharts-reference-line-line"})),s},Jke=function(t,n,s,a,i,o,l,c,d){var f=i.x,m=i.y,g=i.width,x=i.height;if(s){var j=d.y,b=t.y.apply(j,{position:o});if(to(d,"discard")&&!t.y.isInRange(b))return null;var y=[{x:f+g,y:b},{x:f,y:b}];return c==="left"?y.reverse():y}if(n){var w=d.x,_=t.x.apply(w,{position:o});if(to(d,"discard")&&!t.x.isInRange(_))return null;var N=[{x:_,y:m+x},{x:_,y:m}];return l==="top"?N.reverse():N}if(a){var C=d.segment,k=C.map(function(S){return t.apply(S,{position:o})});return to(d,"discard")&&HSe(k,function(S){return!t.isInRange(S)})?null:k}return null};function Qke(e){var t=e.x,n=e.y,s=e.segment,a=e.xAxisId,i=e.yAxisId,o=e.shape,l=e.className,c=e.alwaysShow,d=Rke(),f=B9(a),m=F9(i),g=Mke();if(!d||!g)return null;vd(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var x=IA({x:f.scale,y:m.scale}),j=Wr(t),b=Wr(n),y=s&&s.length===2,w=Jke(x,j,b,y,g,e.position,f.orientation,m.orientation,e);if(!w)return null;var _=Kke(w,2),N=_[0],C=N.x,k=N.y,S=_[1],A=S.x,T=S.y,R=to(e,"hidden")?"url(#".concat(d,")"):void 0,B=R6(R6({clipPath:R},jn(e,!0)),{},{x1:C,y1:k,x2:A,y2:T});return xe.createElement(Cr,{className:wn("recharts-reference-line",l)},Yke(o,B),ks.renderCallByParent(e,_ke({x1:C,y1:k,x2:A,y2:T})))}var MA=(function(e){function t(){return Dke(this,t),Bke(this,t,arguments)}return Uke(t,e),$ke(t,[{key:"render",value:function(){return xe.createElement(Qke,this.props)}}])})(xe.Component);RA(MA,"displayName","ReferenceLine");RA(MA,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function GC(){return GC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},GC.apply(this,arguments)}function jm(e){"@babel/helpers - typeof";return jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jm(e)}function D6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function L6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?D6(Object(n),!0).forEach(function(s){pv(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Xke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zke(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,H9(s.key),s)}}function e2e(e,t,n){return t&&Zke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function t2e(e,t,n){return t=zy(t),n2e(e,V9()?Reflect.construct(t,n||[],zy(e).constructor):t.apply(e,n))}function n2e(e,t){if(t&&(jm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return r2e(e)}function r2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(V9=function(){return!!e})()}function zy(e){return zy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},zy(e)}function s2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&YC(e,t)}function YC(e,t){return YC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},YC(e,t)}function pv(e,t,n){return t=H9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H9(e){var t=a2e(e,"string");return jm(t)=="symbol"?t:t+""}function a2e(e,t){if(jm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(jm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var i2e=function(t){var n=t.x,s=t.y,a=t.xAxis,i=t.yAxis,o=IA({x:a.scale,y:i.scale}),l=o.apply({x:n,y:s},{bandAware:!0});return to(t,"discard")&&!o.isInRange(l)?null:l},gv=(function(e){function t(){return Xke(this,t),t2e(this,t,arguments)}return s2e(t,e),e2e(t,[{key:"render",value:function(){var s=this.props,a=s.x,i=s.y,o=s.r,l=s.alwaysShow,c=s.clipPathId,d=Wr(a),f=Wr(i);if(vd(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!d||!f)return null;var m=i2e(this.props);if(!m)return null;var g=m.x,x=m.y,j=this.props,b=j.shape,y=j.className,w=to(this.props,"hidden")?"url(#".concat(c,")"):void 0,_=L6(L6({clipPath:w},jn(this.props,!0)),{},{cx:g,cy:x});return xe.createElement(Cr,{className:wn("recharts-reference-dot",y)},t.renderDot(b,_),ks.renderCallByParent(this.props,{x:g-o,y:x-o,width:2*o,height:2*o}))}}])})(xe.Component);pv(gv,"displayName","ReferenceDot");pv(gv,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});pv(gv,"renderDot",function(e,t){var n;return xe.isValidElement(e)?n=xe.cloneElement(e,t):gn(e)?n=e(t):n=xe.createElement(OA,GC({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function JC(){return JC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},JC.apply(this,arguments)}function _m(e){"@babel/helpers - typeof";return _m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_m(e)}function $6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function B6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$6(Object(n),!0).forEach(function(s){xv(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function o2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l2e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,G9(s.key),s)}}function c2e(e,t,n){return t&&l2e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function d2e(e,t,n){return t=Uy(t),u2e(e,W9()?Reflect.construct(t,n||[],Uy(e).constructor):t.apply(e,n))}function u2e(e,t){if(t&&(_m(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m2e(e)}function m2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(W9=function(){return!!e})()}function Uy(e){return Uy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Uy(e)}function f2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&QC(e,t)}function QC(e,t){return QC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},QC(e,t)}function xv(e,t,n){return t=G9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function G9(e){var t=h2e(e,"string");return _m(t)=="symbol"?t:t+""}function h2e(e,t){if(_m(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(_m(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var p2e=function(t,n,s,a,i){var o=i.x1,l=i.x2,c=i.y1,d=i.y2,f=i.xAxis,m=i.yAxis;if(!f||!m)return null;var g=IA({x:f.scale,y:m.scale}),x={x:t?g.x.apply(o,{position:"start"}):g.x.rangeMin,y:s?g.y.apply(c,{position:"start"}):g.y.rangeMin},j={x:n?g.x.apply(l,{position:"end"}):g.x.rangeMax,y:a?g.y.apply(d,{position:"end"}):g.y.rangeMax};return to(i,"discard")&&(!g.isInRange(x)||!g.isInRange(j))?null:P9(x,j)},yv=(function(e){function t(){return o2e(this,t),d2e(this,t,arguments)}return f2e(t,e),c2e(t,[{key:"render",value:function(){var s=this.props,a=s.x1,i=s.x2,o=s.y1,l=s.y2,c=s.className,d=s.alwaysShow,f=s.clipPathId;vd(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var m=Wr(a),g=Wr(i),x=Wr(o),j=Wr(l),b=this.props.shape;if(!m&&!g&&!x&&!j&&!b)return null;var y=p2e(m,g,x,j,this.props);if(!y&&!b)return null;var w=to(this.props,"hidden")?"url(#".concat(f,")"):void 0;return xe.createElement(Cr,{className:wn("recharts-reference-area",c)},t.renderRect(b,B6(B6({clipPath:w},jn(this.props,!0)),y)),ks.renderCallByParent(this.props,y))}}])})(xe.Component);xv(yv,"displayName","ReferenceArea");xv(yv,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});xv(yv,"renderRect",function(e,t){var n;return xe.isValidElement(e)?n=xe.cloneElement(e,t):gn(e)?n=e(t):n=xe.createElement(PA,JC({},t,{className:"recharts-reference-area-rect"})),n});function Y9(e,t,n){if(t<1)return[];if(t===1&&n===void 0)return e;for(var s=[],a=0;a<e.length;a+=t)s.push(e[a]);return s}function g2e(e,t,n){var s={width:e.width+t.width,height:e.height+t.height};return Ske(s,n)}function x2e(e,t,n){var s=n==="width",a=e.x,i=e.y,o=e.width,l=e.height;return t===1?{start:s?a:i,end:s?a+o:i+l}:{start:s?a+o:i+l,end:s?a:i}}function qy(e,t,n,s,a){if(e*t<e*s||e*t>e*a)return!1;var i=n();return e*(t-e*i/2-s)>=0&&e*(t+e*i/2-a)<=0}function y2e(e,t){return Y9(e,t+1)}function b2e(e,t,n,s,a){for(var i=(s||[]).slice(),o=t.start,l=t.end,c=0,d=1,f=o,m=function(){var j=s==null?void 0:s[c];if(j===void 0)return{v:Y9(s,d)};var b=c,y,w=function(){return y===void 0&&(y=n(j,b)),y},_=j.coordinate,N=c===0||qy(e,_,w,f,l);N||(c=0,f=o,d+=1),N&&(f=_+e*(w()/2+a),c+=d)},g;d<=i.length;)if(g=m(),g)return g.v;return[]}function _p(e){"@babel/helpers - typeof";return _p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_p(e)}function F6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Ss(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?F6(Object(n),!0).forEach(function(s){v2e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function v2e(e,t,n){return t=w2e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w2e(e){var t=j2e(e,"string");return _p(t)=="symbol"?t:t+""}function j2e(e,t){if(_p(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(_p(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _2e(e,t,n,s,a){for(var i=(s||[]).slice(),o=i.length,l=t.start,c=t.end,d=function(g){var x=i[g],j,b=function(){return j===void 0&&(j=n(x,g)),j};if(g===o-1){var y=e*(x.coordinate+e*b()/2-c);i[g]=x=Ss(Ss({},x),{},{tickCoord:y>0?x.coordinate-y*e:x.coordinate})}else i[g]=x=Ss(Ss({},x),{},{tickCoord:x.coordinate});var w=qy(e,x.tickCoord,b,l,c);w&&(c=x.tickCoord-e*(b()/2+a),i[g]=Ss(Ss({},x),{},{isShow:!0}))},f=o-1;f>=0;f--)d(f);return i}function N2e(e,t,n,s,a,i){var o=(s||[]).slice(),l=o.length,c=t.start,d=t.end;if(i){var f=s[l-1],m=n(f,l-1),g=e*(f.coordinate+e*m/2-d);o[l-1]=f=Ss(Ss({},f),{},{tickCoord:g>0?f.coordinate-g*e:f.coordinate});var x=qy(e,f.tickCoord,function(){return m},c,d);x&&(d=f.tickCoord-e*(m/2+a),o[l-1]=Ss(Ss({},f),{},{isShow:!0}))}for(var j=i?l-1:l,b=function(_){var N=o[_],C,k=function(){return C===void 0&&(C=n(N,_)),C};if(_===0){var S=e*(N.coordinate-e*k()/2-c);o[_]=N=Ss(Ss({},N),{},{tickCoord:S<0?N.coordinate-S*e:N.coordinate})}else o[_]=N=Ss(Ss({},N),{},{tickCoord:N.coordinate});var A=qy(e,N.tickCoord,k,c,d);A&&(c=N.tickCoord+e*(k()/2+a),o[_]=Ss(Ss({},N),{},{isShow:!0}))},y=0;y<j;y++)b(y);return o}function S2e(e,t,n){var s=e.tick,a=e.ticks,i=e.viewBox,o=e.minTickGap,l=e.orientation,c=e.interval,d=e.tickFormatter,f=e.unit,m=e.angle;if(!a||!a.length||!s)return[];if(ht(c)||Zm.isSsr)return y2e(a,typeof c=="number"&&ht(c)?c:0);var g=[],x=l==="top"||l==="bottom"?"width":"height",j=f&&x==="width"?kh(f,{fontSize:t,letterSpacing:n}):{width:0,height:0},b=function(N,C){var k=gn(d)?d(N.value,C):N.value;return x==="width"?g2e(kh(k,{fontSize:t,letterSpacing:n}),j,m):kh(k,{fontSize:t,letterSpacing:n})[x]},y=a.length>=2?Si(a[1].coordinate-a[0].coordinate):1,w=x2e(i,y,x);return c==="equidistantPreserveStart"?b2e(y,w,b,a,o):(c==="preserveStart"||c==="preserveStartEnd"?g=N2e(y,w,b,a,o,c==="preserveStartEnd"):g=_2e(y,w,b,a,o),g.filter(function(_){return _.isShow}))}var k2e=["viewBox"],C2e=["viewBox"],E2e=["ticks"];function Nm(e){"@babel/helpers - typeof";return Nm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nm(e)}function Du(){return Du=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Du.apply(this,arguments)}function z6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Vr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?z6(Object(n),!0).forEach(function(s){DA(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function rk(e,t){if(e==null)return{};var n=A2e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function A2e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function T2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U6(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Q9(s.key),s)}}function P2e(e,t,n){return t&&U6(e.prototype,t),n&&U6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function O2e(e,t,n){return t=Ky(t),I2e(e,J9()?Reflect.construct(t,n||[],Ky(e).constructor):t.apply(e,n))}function I2e(e,t){if(t&&(Nm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return R2e(e)}function R2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function J9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(J9=function(){return!!e})()}function Ky(e){return Ky=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ky(e)}function M2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&XC(e,t)}function XC(e,t){return XC=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},XC(e,t)}function DA(e,t,n){return t=Q9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q9(e){var t=D2e(e,"string");return Nm(t)=="symbol"?t:t+""}function D2e(e,t){if(Nm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Nm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var bv=(function(e){function t(n){var s;return T2e(this,t),s=O2e(this,t,[n]),s.state={fontSize:"",letterSpacing:""},s}return M2e(t,e),P2e(t,[{key:"shouldComponentUpdate",value:function(s,a){var i=s.viewBox,o=rk(s,k2e),l=this.props,c=l.viewBox,d=rk(l,C2e);return!zu(i,c)||!zu(o,d)||!zu(a,this.state)}},{key:"componentDidMount",value:function(){var s=this.layerReference;if(s){var a=s.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];a&&this.setState({fontSize:window.getComputedStyle(a).fontSize,letterSpacing:window.getComputedStyle(a).letterSpacing})}}},{key:"getTickLineCoord",value:function(s){var a=this.props,i=a.x,o=a.y,l=a.width,c=a.height,d=a.orientation,f=a.tickSize,m=a.mirror,g=a.tickMargin,x,j,b,y,w,_,N=m?-1:1,C=s.tickSize||f,k=ht(s.tickCoord)?s.tickCoord:s.coordinate;switch(d){case"top":x=j=s.coordinate,y=o+ +!m*c,b=y-N*C,_=b-N*g,w=k;break;case"left":b=y=s.coordinate,j=i+ +!m*l,x=j-N*C,w=x-N*g,_=k;break;case"right":b=y=s.coordinate,j=i+ +m*l,x=j+N*C,w=x+N*g,_=k;break;default:x=j=s.coordinate,y=o+ +m*c,b=y+N*C,_=b+N*g,w=k;break}return{line:{x1:x,y1:b,x2:j,y2:y},tick:{x:w,y:_}}}},{key:"getTickTextAnchor",value:function(){var s=this.props,a=s.orientation,i=s.mirror,o;switch(a){case"left":o=i?"start":"end";break;case"right":o=i?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var s=this.props,a=s.orientation,i=s.mirror,o="end";switch(a){case"left":case"right":o="middle";break;case"top":o=i?"start":"end";break;default:o=i?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.orientation,d=s.mirror,f=s.axisLine,m=Vr(Vr(Vr({},jn(this.props,!1)),jn(f,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var g=+(c==="top"&&!d||c==="bottom"&&d);m=Vr(Vr({},m),{},{x1:a,y1:i+g*l,x2:a+o,y2:i+g*l})}else{var x=+(c==="left"&&!d||c==="right"&&d);m=Vr(Vr({},m),{},{x1:a+x*o,y1:i,x2:a+x*o,y2:i+l})}return xe.createElement("line",Du({},m,{className:wn("recharts-cartesian-axis-line",Ya(f,"className"))}))}},{key:"renderTicks",value:function(s,a,i){var o=this,l=this.props,c=l.tickLine,d=l.stroke,f=l.tick,m=l.tickFormatter,g=l.unit,x=S2e(Vr(Vr({},this.props),{},{ticks:s}),a,i),j=this.getTickTextAnchor(),b=this.getTickVerticalAnchor(),y=jn(this.props,!1),w=jn(f,!1),_=Vr(Vr({},y),{},{fill:"none"},jn(c,!1)),N=x.map(function(C,k){var S=o.getTickLineCoord(C),A=S.line,T=S.tick,R=Vr(Vr(Vr(Vr({textAnchor:j,verticalAnchor:b},y),{},{stroke:"none",fill:d},w),T),{},{index:k,payload:C,visibleTicksCount:x.length,tickFormatter:m});return xe.createElement(Cr,Du({className:"recharts-cartesian-axis-tick",key:"tick-".concat(C.value,"-").concat(C.coordinate,"-").concat(C.tickCoord)},X0(o.props,C,k)),c&&xe.createElement("line",Du({},_,A,{className:wn("recharts-cartesian-axis-tick-line",Ya(c,"className"))})),f&&t.renderTickItem(f,R,"".concat(gn(m)?m(C.value,k):C.value).concat(g||"")))});return xe.createElement("g",{className:"recharts-cartesian-axis-ticks"},N)}},{key:"render",value:function(){var s=this,a=this.props,i=a.axisLine,o=a.width,l=a.height,c=a.ticksGenerator,d=a.className,f=a.hide;if(f)return null;var m=this.props,g=m.ticks,x=rk(m,E2e),j=g;return gn(c)&&(j=g&&g.length>0?c(this.props):c(x)),o<=0||l<=0||!j||!j.length?null:xe.createElement(Cr,{className:wn("recharts-cartesian-axis",d),ref:function(y){s.layerReference=y}},i&&this.renderAxisLine(),this.renderTicks(j,this.state.fontSize,this.state.letterSpacing),ks.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,i){var o,l=wn(a.className,"recharts-cartesian-axis-tick-value");return xe.isValidElement(s)?o=xe.cloneElement(s,Vr(Vr({},a),{},{className:l})):gn(s)?o=s(Vr(Vr({},a),{},{className:l})):o=xe.createElement(cy,Du({},a,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])})(h.Component);DA(bv,"displayName","CartesianAxis");DA(bv,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var L2e=["type","layout","connectNulls","ref"],$2e=["key"];function Sm(e){"@babel/helpers - typeof";return Sm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sm(e)}function q6(e,t){if(e==null)return{};var n=B2e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function B2e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function Th(){return Th=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Th.apply(this,arguments)}function K6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function ha(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?K6(Object(n),!0).forEach(function(s){ji(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function ju(e){return q2e(e)||U2e(e)||z2e(e)||F2e()}function F2e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
964In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z2e(e,t){if(e){if(typeof e=="string")return ZC(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 ZC(e,t)}}function U2e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function q2e(e){if(Array.isArray(e))return ZC(e)}function ZC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function K2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V6(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Z9(s.key),s)}}function V2e(e,t,n){return t&&V6(e.prototype,t),n&&V6(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function H2e(e,t,n){return t=Vy(t),W2e(e,X9()?Reflect.construct(t,n||[],Vy(e).constructor):t.apply(e,n))}function W2e(e,t){if(t&&(Sm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return G2e(e)}function G2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function X9(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(X9=function(){return!!e})()}function Vy(e){return Vy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Vy(e)}function Y2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&e5(e,t)}function e5(e,t){return e5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},e5(e,t)}function ji(e,t,n){return t=Z9(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z9(e){var t=J2e(e,"string");return Sm(t)=="symbol"?t:t+""}function J2e(e,t){if(Sm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Sm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var km=(function(e){function t(){var n;K2e(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return n=H2e(this,t,[].concat(a)),ji(n,"state",{isAnimationFinished:!0,totalLength:0}),ji(n,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),ji(n,"getStrokeDasharray",function(o,l,c){var d=c.reduce(function(w,_){return w+_});if(!d)return n.generateSimpleStrokeDasharray(l,o);for(var f=Math.floor(o/d),m=o%d,g=l-o,x=[],j=0,b=0;j<c.length;b+=c[j],++j)if(b+c[j]>m){x=[].concat(ju(c.slice(0,j)),[m-b]);break}var y=x.length%2===0?[0,g]:[g];return[].concat(ju(t.repeat(c,f)),ju(x),y).map(function(w){return"".concat(w,"px")}).join(", ")}),ji(n,"id",dg("recharts-line-")),ji(n,"pathRef",function(o){n.mainCurve=o}),ji(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),ji(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return Y2e(t,e),V2e(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var s=this.getTotalLength();this.setState({totalLength:s})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var s=this.getTotalLength();s!==this.state.totalLength&&this.setState({totalLength:s})}}},{key:"getTotalLength",value:function(){var s=this.mainCurve;try{return s&&s.getTotalLength&&s.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(s,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,d=i.layout,f=i.children,m=Ja(f,xg);if(!m)return null;var g=function(b,y){return{x:b.x,y:b.y,value:b.value,errorVal:ka(b.payload,y)}},x={clipPath:s?"url(#clipPath-".concat(a,")"):null};return xe.createElement(Cr,x,m.map(function(j){return xe.cloneElement(j,{key:"bar-".concat(j.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,dataPointFormatter:g})}))}},{key:"renderDots",value:function(s,a,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,d=l.points,f=l.dataKey,m=jn(this.props,!1),g=jn(c,!0),x=d.map(function(b,y){var w=ha(ha(ha({key:"dot-".concat(y),r:3},m),g),{},{index:y,cx:b.x,cy:b.y,value:b.value,dataKey:f,payload:b.payload,points:d});return t.renderDotItem(c,w)}),j={clipPath:s?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return xe.createElement(Cr,Th({className:"recharts-line-dots",key:"dots"},j),x)}},{key:"renderCurveStatically",value:function(s,a,i,o){var l=this.props,c=l.type,d=l.layout,f=l.connectNulls;l.ref;var m=q6(l,L2e),g=ha(ha(ha({},jn(m,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:s},o),{},{type:c,layout:d,connectNulls:f});return xe.createElement(PC,Th({},g,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(s,a){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,d=o.isAnimationActive,f=o.animationBegin,m=o.animationDuration,g=o.animationEasing,x=o.animationId,j=o.animateNewValues,b=o.width,y=o.height,w=this.state,_=w.prevPoints,N=w.totalLength;return xe.createElement(Wo,{begin:f,duration:m,isActive:d,easing:g,from:{t:0},to:{t:1},key:"line-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(C){var k=C.t;if(_){var S=_.length/l.length,A=l.map(function(P,I){var z=Math.floor(I*S);if(_[z]){var L=_[z],H=_i(L.x,P.x),W=_i(L.y,P.y);return ha(ha({},P),{},{x:H(k),y:W(k)})}if(j){var V=_i(b*2,P.x),K=_i(y/2,P.y);return ha(ha({},P),{},{x:V(k),y:K(k)})}return ha(ha({},P),{},{x:P.x,y:P.y})});return i.renderCurveStatically(A,s,a)}var T=_i(0,N),R=T(k),B;if(c){var D="".concat(c).split(/[,\s]+/gim).map(function(P){return parseFloat(P)});B=i.getStrokeDasharray(R,N,D)}else B=i.generateSimpleStrokeDasharray(N,R);return i.renderCurveStatically(l,s,a,{strokeDasharray:B})})}},{key:"renderCurve",value:function(s,a){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,d=c.prevPoints,f=c.totalLength;return l&&o&&o.length&&(!d&&f>0||!cv(d,o))?this.renderCurveWithAnimation(s,a):this.renderCurveStatically(o,s,a)}},{key:"render",value:function(){var s,a=this.props,i=a.hide,o=a.dot,l=a.points,c=a.className,d=a.xAxis,f=a.yAxis,m=a.top,g=a.left,x=a.width,j=a.height,b=a.isAnimationActive,y=a.id;if(i||!l||!l.length)return null;var w=this.state.isAnimationFinished,_=l.length===1,N=wn("recharts-line",c),C=d&&d.allowDataOverflow,k=f&&f.allowDataOverflow,S=C||k,A=hn(y)?this.id:y,T=(s=jn(o,!1))!==null&&s!==void 0?s:{r:3,strokeWidth:2},R=T.r,B=R===void 0?3:R,D=T.strokeWidth,P=D===void 0?2:D,I=kpe(o)?o:{},z=I.clipDot,L=z===void 0?!0:z,H=B*2+P;return xe.createElement(Cr,{className:N},C||k?xe.createElement("defs",null,xe.createElement("clipPath",{id:"clipPath-".concat(A)},xe.createElement("rect",{x:C?g:g-x/2,y:k?m:m-j/2,width:C?x:x*2,height:k?j:j*2})),!L&&xe.createElement("clipPath",{id:"clipPath-dots-".concat(A)},xe.createElement("rect",{x:g-H/2,y:m-H/2,width:x+H,height:j+H}))):null,!_&&this.renderCurve(S,A),this.renderErrorBar(S,A),(_||o)&&this.renderDots(S,L,A),(!b||w)&&Uo.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curPoints:s.points,prevPoints:a.curPoints}:s.points!==a.curPoints?{curPoints:s.points}:null}},{key:"repeat",value:function(s,a){for(var i=s.length%2!==0?[].concat(ju(s),[0]):s,o=[],l=0;l<a;++l)o=[].concat(ju(o),ju(i));return o}},{key:"renderDotItem",value:function(s,a){var i;if(xe.isValidElement(s))i=xe.cloneElement(s,a);else if(gn(s))i=s(a);else{var o=a.key,l=q6(a,$2e),c=wn("recharts-line-dot",typeof s!="boolean"?s.className:"");i=xe.createElement(OA,Th({key:o},l,{className:c}))}return i}}])})(h.PureComponent);ji(km,"displayName","Line");ji(km,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Zm.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});ji(km,"getComposedData",function(e){var t=e.props,n=e.xAxis,s=e.yAxis,a=e.xAxisTicks,i=e.yAxisTicks,o=e.dataKey,l=e.bandSize,c=e.displayedData,d=e.offset,f=t.layout,m=c.map(function(g,x){var j=ka(g,o);return f==="horizontal"?{x:d$({axis:n,ticks:a,bandSize:l,entry:g,index:x}),y:hn(j)?null:s.scale(j),value:j,payload:g}:{x:hn(j)?null:n.scale(j),y:d$({axis:s,ticks:i,bandSize:l,entry:g,index:x}),value:j,payload:g}});return ha({points:m,layout:f},d)});function Cm(e){"@babel/helpers - typeof";return Cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cm(e)}function Q2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X2e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,nV(s.key),s)}}function Z2e(e,t,n){return t&&X2e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function eCe(e,t,n){return t=Hy(t),tCe(e,eV()?Reflect.construct(t,n||[],Hy(e).constructor):t.apply(e,n))}function tCe(e,t){if(t&&(Cm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nCe(e)}function nCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eV(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eV=function(){return!!e})()}function Hy(e){return Hy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Hy(e)}function rCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&t5(e,t)}function t5(e,t){return t5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},t5(e,t)}function tV(e,t,n){return t=nV(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nV(e){var t=sCe(e,"string");return Cm(t)=="symbol"?t:t+""}function sCe(e,t){if(Cm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Cm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function n5(){return n5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},n5.apply(this,arguments)}function aCe(e){var t=e.xAxisId,n=z9(),s=U9(),a=B9(t);return a==null?null:h.createElement(bv,n5({},a,{className:wn("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:s},ticksGenerator:function(o){return od(o,!0)}}))}var Qa=(function(e){function t(){return Q2e(this,t),eCe(this,t,arguments)}return rCe(t,e),Z2e(t,[{key:"render",value:function(){return h.createElement(aCe,this.props)}}])})(h.Component);tV(Qa,"displayName","XAxis");tV(Qa,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function Em(e){"@babel/helpers - typeof";return Em=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Em(e)}function iCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oCe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,aV(s.key),s)}}function lCe(e,t,n){return t&&oCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function cCe(e,t,n){return t=Wy(t),dCe(e,rV()?Reflect.construct(t,n||[],Wy(e).constructor):t.apply(e,n))}function dCe(e,t){if(t&&(Em(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uCe(e)}function uCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rV(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rV=function(){return!!e})()}function Wy(e){return Wy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Wy(e)}function mCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r5(e,t)}function r5(e,t){return r5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},r5(e,t)}function sV(e,t,n){return t=aV(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aV(e){var t=fCe(e,"string");return Em(t)=="symbol"?t:t+""}function fCe(e,t){if(Em(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Em(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function s5(){return s5=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},s5.apply(this,arguments)}var hCe=function(t){var n=t.yAxisId,s=z9(),a=U9(),i=F9(n);return i==null?null:h.createElement(bv,s5({},i,{className:wn("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:s,height:a},ticksGenerator:function(l){return od(l,!0)}}))},Xa=(function(e){function t(){return iCe(this,t),cCe(this,t,arguments)}return mCe(t,e),lCe(t,[{key:"render",value:function(){return h.createElement(hCe,this.props)}}])})(h.Component);sV(Xa,"displayName","YAxis");sV(Xa,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function H6(e){return yCe(e)||xCe(e)||gCe(e)||pCe()}function pCe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
965In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gCe(e,t){if(e){if(typeof e=="string")return a5(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 a5(e,t)}}function xCe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function yCe(e){if(Array.isArray(e))return a5(e)}function a5(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var i5=function(t,n,s,a,i){var o=Ja(t,MA),l=Ja(t,gv),c=[].concat(H6(o),H6(l)),d=Ja(t,yv),f="".concat(a,"Id"),m=a[0],g=n;if(c.length&&(g=c.reduce(function(b,y){if(y.props[f]===s&&to(y.props,"extendDomain")&&ht(y.props[m])){var w=y.props[m];return[Math.min(b[0],w),Math.max(b[1],w)]}return b},g)),d.length){var x="".concat(m,"1"),j="".concat(m,"2");g=d.reduce(function(b,y){if(y.props[f]===s&&to(y.props,"extendDomain")&&ht(y.props[x])&&ht(y.props[j])){var w=y.props[x],_=y.props[j];return[Math.min(b[0],w,_),Math.max(b[1],w,_)]}return b},g)}return i&&i.length&&(g=i.reduce(function(b,y){return ht(y)?[Math.min(b[0],y),Math.max(b[1],y)]:b},g)),g},sk={exports:{}},W6;function bCe(){return W6||(W6=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function a(c,d,f){this.fn=c,this.context=d,this.once=f||!1}function i(c,d,f,m,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var x=new a(f,m||c,g),j=n?n+d:d;return c._events[j]?c._events[j].fn?c._events[j]=[c._events[j],x]:c._events[j].push(x):(c._events[j]=x,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new s:delete c._events[d]}function l(){this._events=new s,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,m;if(this._eventsCount===0)return d;for(m in f=this._events)t.call(f,m)&&d.push(n?m.slice(1):m);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=n?n+d:d,m=this._events[f];if(!m)return[];if(m.fn)return[m.fn];for(var g=0,x=m.length,j=new Array(x);g<x;g++)j[g]=m[g].fn;return j},l.prototype.listenerCount=function(d){var f=n?n+d:d,m=this._events[f];return m?m.fn?1:m.length:0},l.prototype.emit=function(d,f,m,g,x,j){var b=n?n+d:d;if(!this._events[b])return!1;var y=this._events[b],w=arguments.length,_,N;if(y.fn){switch(y.once&&this.removeListener(d,y.fn,void 0,!0),w){case 1:return y.fn.call(y.context),!0;case 2:return y.fn.call(y.context,f),!0;case 3:return y.fn.call(y.context,f,m),!0;case 4:return y.fn.call(y.context,f,m,g),!0;case 5:return y.fn.call(y.context,f,m,g,x),!0;case 6:return y.fn.call(y.context,f,m,g,x,j),!0}for(N=1,_=new Array(w-1);N<w;N++)_[N-1]=arguments[N];y.fn.apply(y.context,_)}else{var C=y.length,k;for(N=0;N<C;N++)switch(y[N].once&&this.removeListener(d,y[N].fn,void 0,!0),w){case 1:y[N].fn.call(y[N].context);break;case 2:y[N].fn.call(y[N].context,f);break;case 3:y[N].fn.call(y[N].context,f,m);break;case 4:y[N].fn.call(y[N].context,f,m,g);break;default:if(!_)for(k=1,_=new Array(w-1);k<w;k++)_[k-1]=arguments[k];y[N].fn.apply(y[N].context,_)}}return!0},l.prototype.on=function(d,f,m){return i(this,d,f,m,!1)},l.prototype.once=function(d,f,m){return i(this,d,f,m,!0)},l.prototype.removeListener=function(d,f,m,g){var x=n?n+d:d;if(!this._events[x])return this;if(!f)return o(this,x),this;var j=this._events[x];if(j.fn)j.fn===f&&(!g||j.once)&&(!m||j.context===m)&&o(this,x);else{for(var b=0,y=[],w=j.length;b<w;b++)(j[b].fn!==f||g&&!j[b].once||m&&j[b].context!==m)&&y.push(j[b]);y.length?this._events[x]=y.length===1?y[0]:y:o(this,x)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=n?n+d:d,this._events[f]&&o(this,f)):(this._events=new s,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l})(sk)),sk.exports}var vCe=bCe();const wCe=Un(vCe);var ak=new wCe,ik="recharts.syncMouseEvents";function Np(e){"@babel/helpers - typeof";return Np=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Np(e)}function jCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _Ce(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,iV(s.key),s)}}function NCe(e,t,n){return t&&_Ce(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ok(e,t,n){return t=iV(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iV(e){var t=SCe(e,"string");return Np(t)=="symbol"?t:t+""}function SCe(e,t){if(Np(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Np(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var kCe=(function(){function e(){jCe(this,e),ok(this,"activeIndex",0),ok(this,"coordinateList",[]),ok(this,"layout","horizontal")}return NCe(e,[{key:"setDetails",value:function(n){var s,a=n.coordinateList,i=a===void 0?null:a,o=n.container,l=o===void 0?null:o,c=n.layout,d=c===void 0?null:c,f=n.offset,m=f===void 0?null:f,g=n.mouseHandlerCallback,x=g===void 0?null:g;this.coordinateList=(s=i??this.coordinateList)!==null&&s!==void 0?s:[],this.container=l??this.container,this.layout=d??this.layout,this.offset=m??this.offset,this.mouseHandlerCallback=x??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,s;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var a=this.container.getBoundingClientRect(),i=a.x,o=a.y,l=a.height,c=this.coordinateList[this.activeIndex].coordinate,d=((n=window)===null||n===void 0?void 0:n.scrollX)||0,f=((s=window)===null||s===void 0?void 0:s.scrollY)||0,m=i+c+d,g=o+this.offset.top+l/2+f;this.mouseHandlerCallback({pageX:m,pageY:g})}}}])})();function CCe(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var s=e==null?void 0:e[0],a=e==null?void 0:e[1];if(s&&a&&ht(s)&&ht(a))return!0}return!1}function ECe(e,t,n,s){var a=s/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-a,width:e==="horizontal"?s:n.width-1,height:e==="horizontal"?n.height-1:s}}function oV(e){var t=e.cx,n=e.cy,s=e.radius,a=e.startAngle,i=e.endAngle,o=hs(t,n,s,a),l=hs(t,n,s,i);return{points:[o,l],cx:t,cy:n,radius:s,startAngle:a,endAngle:i}}function ACe(e,t,n){var s,a,i,o;if(e==="horizontal")s=t.x,i=s,a=n.top,o=n.top+n.height;else if(e==="vertical")a=t.y,o=a,s=n.left,i=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,d=t.innerRadius,f=t.outerRadius,m=t.angle,g=hs(l,c,d,m),x=hs(l,c,f,m);s=g.x,a=g.y,i=x.x,o=x.y}else return oV(t);return[{x:s,y:a},{x:i,y:o}]}function Sp(e){"@babel/helpers - typeof";return Sp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sp(e)}function G6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Yx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?G6(Object(n),!0).forEach(function(s){TCe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):G6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function TCe(e,t,n){return t=PCe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PCe(e){var t=OCe(e,"string");return Sp(t)=="symbol"?t:t+""}function OCe(e,t){if(Sp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Sp(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ICe(e){var t,n,s=e.element,a=e.tooltipEventType,i=e.isActive,o=e.activeCoordinate,l=e.activePayload,c=e.offset,d=e.activeTooltipIndex,f=e.tooltipAxisBandSize,m=e.layout,g=e.chartName,x=(t=s.props.cursor)!==null&&t!==void 0?t:(n=s.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!s||!x||!i||!o||g!=="ScatterChart"&&a!=="axis")return null;var j,b=PC;if(g==="ScatterChart")j=o,b=HNe;else if(g==="BarChart")j=ECe(m,o,c,f),b=PA;else if(m==="radial"){var y=oV(o),w=y.cx,_=y.cy,N=y.radius,C=y.startAngle,k=y.endAngle;j={cx:w,cy:_,startAngle:C,endAngle:k,innerRadius:N,outerRadius:N},b=h9}else j={points:ACe(m,o,c)},b=PC;var S=Yx(Yx(Yx(Yx({stroke:"#ccc",pointerEvents:"none"},c),j),jn(x,!1)),{},{payload:l,payloadIndex:d,className:wn("recharts-tooltip-cursor",x.className)});return h.isValidElement(x)?h.cloneElement(x,S):h.createElement(b,S)}var RCe=["item"],MCe=["children","className","width","height","style","compact","title","desc"];function Am(e){"@babel/helpers - typeof";return Am=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Am(e)}function Lu(){return Lu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Lu.apply(this,arguments)}function Y6(e,t){return $Ce(e)||LCe(e,t)||cV(e,t)||DCe()}function DCe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
966In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LCe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(f){d=!0,a=f}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function $Ce(e){if(Array.isArray(e))return e}function J6(e,t){if(e==null)return{};var n=BCe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function BCe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function FCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zCe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,dV(s.key),s)}}function UCe(e,t,n){return t&&zCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function qCe(e,t,n){return t=Gy(t),KCe(e,lV()?Reflect.construct(t,n||[],Gy(e).constructor):t.apply(e,n))}function KCe(e,t){if(t&&(Am(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return VCe(e)}function VCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lV(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lV=function(){return!!e})()}function Gy(e){return Gy=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Gy(e)}function HCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o5(e,t)}function o5(e,t){return o5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},o5(e,t)}function Tm(e){return YCe(e)||GCe(e)||cV(e)||WCe()}function WCe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
967In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cV(e,t){if(e){if(typeof e=="string")return l5(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 l5(e,t)}}function GCe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function YCe(e){if(Array.isArray(e))return l5(e)}function l5(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function Q6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Q6(Object(n),!0).forEach(function(s){Ht(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q6(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Ht(e,t,n){return t=dV(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dV(e){var t=JCe(e,"string");return Am(t)=="symbol"?t:t+""}function JCe(e,t){if(Am(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Am(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var QCe={xAxis:["bottom","top"],yAxis:["left","right"]},XCe={width:"100%",height:"100%"},uV={x:0,y:0};function Jx(e){return e}var ZCe=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},e5e=function(t,n,s,a){var i=n.find(function(f){return f&&f.index===s});if(i){if(t==="horizontal")return{x:i.coordinate,y:a.y};if(t==="vertical")return{x:a.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,l=a.radius;return Fe(Fe(Fe({},a),hs(a.cx,a.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,d=a.angle;return Fe(Fe(Fe({},a),hs(a.cx,a.cy,c,d)),{},{angle:d,radius:c})}return uV},vv=function(t,n){var s=n.graphicalItems,a=n.dataStartIndex,i=n.dataEndIndex,o=(s??[]).reduce(function(l,c){var d=c.props.data;return d&&d.length?[].concat(Tm(l),Tm(d)):l},[]);return o.length>0?o:t&&t.length&&ht(a)&&ht(i)?t.slice(a,i+1):[]};function mV(e){return e==="number"?[0,"auto"]:void 0}var c5=function(t,n,s,a){var i=t.graphicalItems,o=t.tooltipAxis,l=vv(n,t);return s<0||!i||!i.length||s>=l.length?null:i.reduce(function(c,d){var f,m=(f=d.props.data)!==null&&f!==void 0?f:n;m&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=s&&(m=m.slice(t.dataStartIndex,t.dataEndIndex+1));var g;if(o.dataKey&&!o.allowDuplicatedCategory){var x=m===void 0?l:m;g=J0(x,o.dataKey,a)}else g=m&&m[s]||l[s];return g?[].concat(Tm(c),[u9(d,g)]):c},[])},X6=function(t,n,s,a){var i=a||{x:t.chartX,y:t.chartY},o=ZCe(i,s),l=t.orderedTooltipTicks,c=t.tooltipAxis,d=t.tooltipTicks,f=Sje(o,l,d,c);if(f>=0&&d){var m=d[f]&&d[f].value,g=c5(t,n,f,m),x=e5e(s,l,f,i);return{activeTooltipIndex:f,activeLabel:m,activePayload:g,activeCoordinate:x}}return null},t5e=function(t,n){var s=n.axes,a=n.graphicalItems,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,f=t.layout,m=t.children,g=t.stackOffset,x=c9(f,i);return s.reduce(function(j,b){var y,w=b.type.defaultProps!==void 0?Fe(Fe({},b.type.defaultProps),b.props):b.props,_=w.type,N=w.dataKey,C=w.allowDataOverflow,k=w.allowDuplicatedCategory,S=w.scale,A=w.ticks,T=w.includeHidden,R=w[o];if(j[R])return j;var B=vv(t.data,{graphicalItems:a.filter(function(q){var F,U=o in q.props?q.props[o]:(F=q.type.defaultProps)===null||F===void 0?void 0:F[o];return U===R}),dataStartIndex:c,dataEndIndex:d}),D=B.length,P,I,z;CCe(w.domain,C,_)&&(P=kC(w.domain,null,C),x&&(_==="number"||S!=="auto")&&(z=Eh(B,N,"category")));var L=mV(_);if(!P||P.length===0){var H,W=(H=w.domain)!==null&&H!==void 0?H:L;if(N){if(P=Eh(B,N,_),_==="category"&&x){var V=gpe(P);k&&V?(I=P,P=My(0,D)):k||(P=h$(W,P,b).reduce(function(q,F){return q.indexOf(F)>=0?q:[].concat(Tm(q),[F])},[]))}else if(_==="category")k?P=P.filter(function(q){return q!==""&&!hn(q)}):P=h$(W,P,b).reduce(function(q,F){return q.indexOf(F)>=0||F===""||hn(F)?q:[].concat(Tm(q),[F])},[]);else if(_==="number"){var K=Tje(B,a.filter(function(q){var F,U,ee=o in q.props?q.props[o]:(F=q.type.defaultProps)===null||F===void 0?void 0:F[o],ne="hide"in q.props?q.props.hide:(U=q.type.defaultProps)===null||U===void 0?void 0:U.hide;return ee===R&&(T||!ne)}),N,i,f);K&&(P=K)}x&&(_==="number"||S!=="auto")&&(z=Eh(B,N,"category"))}else x?P=My(0,D):l&&l[R]&&l[R].hasStack&&_==="number"?P=g==="expand"?[0,1]:d9(l[R].stackGroups,c,d):P=l9(B,a.filter(function(q){var F=o in q.props?q.props[o]:q.type.defaultProps[o],U="hide"in q.props?q.props.hide:q.type.defaultProps.hide;return F===R&&(T||!U)}),_,f,!0);if(_==="number")P=i5(m,P,R,i,A),W&&(P=kC(W,P,C));else if(_==="category"&&W){var M=W,G=P.every(function(q){return M.indexOf(q)>=0});G&&(P=M)}}return Fe(Fe({},j),{},Ht({},R,Fe(Fe({},w),{},{axisType:i,domain:P,categoricalDomain:z,duplicateDomain:I,originalDomain:(y=w.domain)!==null&&y!==void 0?y:L,isCategorical:x,layout:f})))},{})},n5e=function(t,n){var s=n.graphicalItems,a=n.Axis,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,f=t.layout,m=t.children,g=vv(t.data,{graphicalItems:s,dataStartIndex:c,dataEndIndex:d}),x=g.length,j=c9(f,i),b=-1;return s.reduce(function(y,w){var _=w.type.defaultProps!==void 0?Fe(Fe({},w.type.defaultProps),w.props):w.props,N=_[o],C=mV("number");if(!y[N]){b++;var k;return j?k=My(0,x):l&&l[N]&&l[N].hasStack?(k=d9(l[N].stackGroups,c,d),k=i5(m,k,N,i)):(k=kC(C,l9(g,s.filter(function(S){var A,T,R=o in S.props?S.props[o]:(A=S.type.defaultProps)===null||A===void 0?void 0:A[o],B="hide"in S.props?S.props.hide:(T=S.type.defaultProps)===null||T===void 0?void 0:T.hide;return R===N&&!B}),"number",f),a.defaultProps.allowDataOverflow),k=i5(m,k,N,i)),Fe(Fe({},y),{},Ht({},N,Fe(Fe({axisType:i},a.defaultProps),{},{hide:!0,orientation:Ya(QCe,"".concat(i,".").concat(b%2),null),domain:k,originalDomain:C,isCategorical:j,layout:f})))}return y},{})},r5e=function(t,n){var s=n.axisType,a=s===void 0?"xAxis":s,i=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,f=t.children,m="".concat(a,"Id"),g=Ja(f,i),x={};return g&&g.length?x=t5e(t,{axes:g,graphicalItems:o,axisType:a,axisIdKey:m,stackGroups:l,dataStartIndex:c,dataEndIndex:d}):o&&o.length&&(x=n5e(t,{Axis:i,graphicalItems:o,axisType:a,axisIdKey:m,stackGroups:l,dataStartIndex:c,dataEndIndex:d})),x},s5e=function(t){var n=Pu(t),s=od(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:sA(s,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Ny(n,s)}},Z6=function(t){var n=t.children,s=t.defaultShowTooltip,a=ga(n,bm),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(o=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!s}},a5e=function(t){return!t||!t.length?!1:t.some(function(n){var s=Fo(n&&n.type);return s&&s.indexOf("Bar")>=0})},eB=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},i5e=function(t,n){var s=t.props,a=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,d=s.width,f=s.height,m=s.children,g=s.margin||{},x=ga(m,bm),j=ga(m,Xl),b=Object.keys(c).reduce(function(k,S){var A=c[S],T=A.orientation;return!A.mirror&&!A.hide?Fe(Fe({},k),{},Ht({},T,k[T]+A.width)):k},{left:g.left||0,right:g.right||0}),y=Object.keys(o).reduce(function(k,S){var A=o[S],T=A.orientation;return!A.mirror&&!A.hide?Fe(Fe({},k),{},Ht({},T,Ya(k,"".concat(T))+A.height)):k},{top:g.top||0,bottom:g.bottom||0}),w=Fe(Fe({},y),b),_=w.bottom;x&&(w.bottom+=x.props.height||bm.defaultProps.height),j&&n&&(w=Eje(w,a,s,n));var N=d-w.left-w.right,C=f-w.top-w.bottom;return Fe(Fe({brushBottom:_},w),{},{width:Math.max(N,0),height:Math.max(C,0)})},o5e=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},fV=function(t){var n=t.chartName,s=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,d=t.legendContent,f=t.formatAxisMap,m=t.defaultProps,g=function(w,_){var N=_.graphicalItems,C=_.stackGroups,k=_.offset,S=_.updateId,A=_.dataStartIndex,T=_.dataEndIndex,R=w.barSize,B=w.layout,D=w.barGap,P=w.barCategoryGap,I=w.maxBarSize,z=eB(B),L=z.numericAxisName,H=z.cateAxisName,W=a5e(N),V=[];return N.forEach(function(K,M){var G=vv(w.data,{graphicalItems:[K],dataStartIndex:A,dataEndIndex:T}),q=K.type.defaultProps!==void 0?Fe(Fe({},K.type.defaultProps),K.props):K.props,F=q.dataKey,U=q.maxBarSize,ee=q["".concat(L,"Id")],ne=q["".concat(H,"Id")],X={},ie=c.reduce(function(De,_e){var We=_["".concat(_e.axisType,"Map")],tt=q["".concat(_e.axisType,"Id")];We&&We[tt]||_e.axisType==="zAxis"||ic();var me=We[tt];return Fe(Fe({},De),{},Ht(Ht({},_e.axisType,me),"".concat(_e.axisType,"Ticks"),od(me)))},X),Z=ie[H],ce=ie["".concat(H,"Ticks")],le=C&&C[ee]&&C[ee].hasStack&&Uje(K,C[ee].stackGroups),re=Fo(K.type).indexOf("Bar")>=0,Ue=Ny(Z,ce),Ne=[],Oe=W&&kje({barSize:R,stackGroups:C,totalSize:o5e(ie,H)});if(re){var Me,ue,Ve=hn(U)?I:U,Xe=(Me=(ue=Ny(Z,ce,!0))!==null&&ue!==void 0?ue:Ve)!==null&&Me!==void 0?Me:0;Ne=Cje({barGap:D,barCategoryGap:P,bandSize:Xe!==Ue?Xe:Ue,sizeList:Oe[ne],maxBarSize:Ve}),Xe!==Ue&&(Ne=Ne.map(function(De){return Fe(Fe({},De),{},{position:Fe(Fe({},De.position),{},{offset:De.position.offset-Xe/2})})}))}var te=K&&K.type&&K.type.getComposedData;te&&V.push({props:Fe(Fe({},te(Fe(Fe({},ie),{},{displayedData:G,props:w,dataKey:F,item:K,bandSize:Ue,barPosition:Ne,offset:k,stackedData:le,layout:B,dataStartIndex:A,dataEndIndex:T}))),{},Ht(Ht(Ht({key:K.key||"item-".concat(M)},L,ie[L]),H,ie[H]),"animationId",S)),childIndex:Ape(K,w.children),item:K})}),V},x=function(w,_){var N=w.props,C=w.dataStartIndex,k=w.dataEndIndex,S=w.updateId;if(!ER({props:N}))return null;var A=N.children,T=N.layout,R=N.stackOffset,B=N.data,D=N.reverseStackOrder,P=eB(T),I=P.numericAxisName,z=P.cateAxisName,L=Ja(A,s),H=Bje(B,L,"".concat(I,"Id"),"".concat(z,"Id"),R,D),W=c.reduce(function(q,F){var U="".concat(F.axisType,"Map");return Fe(Fe({},q),{},Ht({},U,r5e(N,Fe(Fe({},F),{},{graphicalItems:L,stackGroups:F.axisType===I&&H,dataStartIndex:C,dataEndIndex:k}))))},{}),V=i5e(Fe(Fe({},W),{},{props:N,graphicalItems:L}),_==null?void 0:_.legendBBox);Object.keys(W).forEach(function(q){W[q]=f(N,W[q],V,q.replace("Map",""),n)});var K=W["".concat(z,"Map")],M=s5e(K),G=g(N,Fe(Fe({},W),{},{dataStartIndex:C,dataEndIndex:k,updateId:S,graphicalItems:L,stackGroups:H,offset:V}));return Fe(Fe({formattedGraphicalItems:G,graphicalItems:L,offset:V,stackGroups:H},M),W)},j=(function(y){function w(_){var N,C,k;return FCe(this,w),k=qCe(this,w,[_]),Ht(k,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ht(k,"accessibilityManager",new kCe),Ht(k,"handleLegendBBoxUpdate",function(S){if(S){var A=k.state,T=A.dataStartIndex,R=A.dataEndIndex,B=A.updateId;k.setState(Fe({legendBBox:S},x({props:k.props,dataStartIndex:T,dataEndIndex:R,updateId:B},Fe(Fe({},k.state),{},{legendBBox:S}))))}}),Ht(k,"handleReceiveSyncEvent",function(S,A,T){if(k.props.syncId===S){if(T===k.eventEmitterSymbol&&typeof k.props.syncMethod!="function")return;k.applySyncEvent(A)}}),Ht(k,"handleBrushChange",function(S){var A=S.startIndex,T=S.endIndex;if(A!==k.state.dataStartIndex||T!==k.state.dataEndIndex){var R=k.state.updateId;k.setState(function(){return Fe({dataStartIndex:A,dataEndIndex:T},x({props:k.props,dataStartIndex:A,dataEndIndex:T,updateId:R},k.state))}),k.triggerSyncEvent({dataStartIndex:A,dataEndIndex:T})}}),Ht(k,"handleMouseEnter",function(S){var A=k.getMouseInfo(S);if(A){var T=Fe(Fe({},A),{},{isTooltipActive:!0});k.setState(T),k.triggerSyncEvent(T);var R=k.props.onMouseEnter;gn(R)&&R(T,S)}}),Ht(k,"triggeredAfterMouseMove",function(S){var A=k.getMouseInfo(S),T=A?Fe(Fe({},A),{},{isTooltipActive:!0}):{isTooltipActive:!1};k.setState(T),k.triggerSyncEvent(T);var R=k.props.onMouseMove;gn(R)&&R(T,S)}),Ht(k,"handleItemMouseEnter",function(S){k.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),Ht(k,"handleItemMouseLeave",function(){k.setState(function(){return{isTooltipActive:!1}})}),Ht(k,"handleMouseMove",function(S){S.persist(),k.throttleTriggeredAfterMouseMove(S)}),Ht(k,"handleMouseLeave",function(S){k.throttleTriggeredAfterMouseMove.cancel();var A={isTooltipActive:!1};k.setState(A),k.triggerSyncEvent(A);var T=k.props.onMouseLeave;gn(T)&&T(A,S)}),Ht(k,"handleOuterEvent",function(S){var A=Epe(S),T=Ya(k.props,"".concat(A));if(A&&gn(T)){var R,B;/.*touch.*/i.test(A)?B=k.getMouseInfo(S.changedTouches[0]):B=k.getMouseInfo(S),T((R=B)!==null&&R!==void 0?R:{},S)}}),Ht(k,"handleClick",function(S){var A=k.getMouseInfo(S);if(A){var T=Fe(Fe({},A),{},{isTooltipActive:!0});k.setState(T),k.triggerSyncEvent(T);var R=k.props.onClick;gn(R)&&R(T,S)}}),Ht(k,"handleMouseDown",function(S){var A=k.props.onMouseDown;if(gn(A)){var T=k.getMouseInfo(S);A(T,S)}}),Ht(k,"handleMouseUp",function(S){var A=k.props.onMouseUp;if(gn(A)){var T=k.getMouseInfo(S);A(T,S)}}),Ht(k,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&k.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),Ht(k,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&k.handleMouseDown(S.changedTouches[0])}),Ht(k,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&k.handleMouseUp(S.changedTouches[0])}),Ht(k,"handleDoubleClick",function(S){var A=k.props.onDoubleClick;if(gn(A)){var T=k.getMouseInfo(S);A(T,S)}}),Ht(k,"handleContextMenu",function(S){var A=k.props.onContextMenu;if(gn(A)){var T=k.getMouseInfo(S);A(T,S)}}),Ht(k,"triggerSyncEvent",function(S){k.props.syncId!==void 0&&ak.emit(ik,k.props.syncId,S,k.eventEmitterSymbol)}),Ht(k,"applySyncEvent",function(S){var A=k.props,T=A.layout,R=A.syncMethod,B=k.state.updateId,D=S.dataStartIndex,P=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)k.setState(Fe({dataStartIndex:D,dataEndIndex:P},x({props:k.props,dataStartIndex:D,dataEndIndex:P,updateId:B},k.state)));else if(S.activeTooltipIndex!==void 0){var I=S.chartX,z=S.chartY,L=S.activeTooltipIndex,H=k.state,W=H.offset,V=H.tooltipTicks;if(!W)return;if(typeof R=="function")L=R(V,S);else if(R==="value"){L=-1;for(var K=0;K<V.length;K++)if(V[K].value===S.activeLabel){L=K;break}}var M=Fe(Fe({},W),{},{x:W.left,y:W.top}),G=Math.min(I,M.x+M.width),q=Math.min(z,M.y+M.height),F=V[L]&&V[L].value,U=c5(k.state,k.props.data,L),ee=V[L]?{x:T==="horizontal"?V[L].coordinate:G,y:T==="horizontal"?q:V[L].coordinate}:uV;k.setState(Fe(Fe({},S),{},{activeLabel:F,activeCoordinate:ee,activePayload:U,activeTooltipIndex:L}))}else k.setState(S)}),Ht(k,"renderCursor",function(S){var A,T=k.state,R=T.isTooltipActive,B=T.activeCoordinate,D=T.activePayload,P=T.offset,I=T.activeTooltipIndex,z=T.tooltipAxisBandSize,L=k.getTooltipEventType(),H=(A=S.props.active)!==null&&A!==void 0?A:R,W=k.props.layout,V=S.key||"_recharts-cursor";return xe.createElement(ICe,{key:V,activeCoordinate:B,activePayload:D,activeTooltipIndex:I,chartName:n,element:S,isActive:H,layout:W,offset:P,tooltipAxisBandSize:z,tooltipEventType:L})}),Ht(k,"renderPolarAxis",function(S,A,T){var R=Ya(S,"type.axisType"),B=Ya(k.state,"".concat(R,"Map")),D=S.type.defaultProps,P=D!==void 0?Fe(Fe({},D),S.props):S.props,I=B&&B[P["".concat(R,"Id")]];return h.cloneElement(S,Fe(Fe({},I),{},{className:wn(R,I.className),key:S.key||"".concat(A,"-").concat(T),ticks:od(I,!0)}))}),Ht(k,"renderPolarGrid",function(S){var A=S.props,T=A.radialLines,R=A.polarAngles,B=A.polarRadius,D=k.state,P=D.radiusAxisMap,I=D.angleAxisMap,z=Pu(P),L=Pu(I),H=L.cx,W=L.cy,V=L.innerRadius,K=L.outerRadius;return h.cloneElement(S,{polarAngles:Array.isArray(R)?R:od(L,!0).map(function(M){return M.coordinate}),polarRadius:Array.isArray(B)?B:od(z,!0).map(function(M){return M.coordinate}),cx:H,cy:W,innerRadius:V,outerRadius:K,key:S.key||"polar-grid",radialLines:T})}),Ht(k,"renderLegend",function(){var S=k.state.formattedGraphicalItems,A=k.props,T=A.children,R=A.width,B=A.height,D=k.props.margin||{},P=R-(D.left||0)-(D.right||0),I=i9({children:T,formattedGraphicalItems:S,legendWidth:P,legendContent:d});if(!I)return null;var z=I.item,L=J6(I,RCe);return h.cloneElement(z,Fe(Fe({},L),{},{chartWidth:R,chartHeight:B,margin:D,onBBoxUpdate:k.handleLegendBBoxUpdate}))}),Ht(k,"renderTooltip",function(){var S,A=k.props,T=A.children,R=A.accessibilityLayer,B=ga(T,us);if(!B)return null;var D=k.state,P=D.isTooltipActive,I=D.activeCoordinate,z=D.activePayload,L=D.activeLabel,H=D.offset,W=(S=B.props.active)!==null&&S!==void 0?S:P;return h.cloneElement(B,{viewBox:Fe(Fe({},H),{},{x:H.left,y:H.top}),active:W,label:L,payload:W?z:[],coordinate:I,accessibilityLayer:R})}),Ht(k,"renderBrush",function(S){var A=k.props,T=A.margin,R=A.data,B=k.state,D=B.offset,P=B.dataStartIndex,I=B.dataEndIndex,z=B.updateId;return h.cloneElement(S,{key:S.key||"_recharts-brush",onChange:Vx(k.handleBrushChange,S.props.onChange),data:R,x:ht(S.props.x)?S.props.x:D.left,y:ht(S.props.y)?S.props.y:D.top+D.height+D.brushBottom-(T.bottom||0),width:ht(S.props.width)?S.props.width:D.width,startIndex:P,endIndex:I,updateId:"brush-".concat(z)})}),Ht(k,"renderReferenceElement",function(S,A,T){if(!S)return null;var R=k,B=R.clipPathId,D=k.state,P=D.xAxisMap,I=D.yAxisMap,z=D.offset,L=S.type.defaultProps||{},H=S.props,W=H.xAxisId,V=W===void 0?L.xAxisId:W,K=H.yAxisId,M=K===void 0?L.yAxisId:K;return h.cloneElement(S,{key:S.key||"".concat(A,"-").concat(T),xAxis:P[V],yAxis:I[M],viewBox:{x:z.left,y:z.top,width:z.width,height:z.height},clipPathId:B})}),Ht(k,"renderActivePoints",function(S){var A=S.item,T=S.activePoint,R=S.basePoint,B=S.childIndex,D=S.isRange,P=[],I=A.props.key,z=A.item.type.defaultProps!==void 0?Fe(Fe({},A.item.type.defaultProps),A.item.props):A.item.props,L=z.activeDot,H=z.dataKey,W=Fe(Fe({index:B,dataKey:H,cx:T.x,cy:T.y,r:4,fill:TA(A.item),strokeWidth:2,stroke:"#fff",payload:T.payload,value:T.value},jn(L,!1)),Q0(L));return P.push(w.renderActiveDot(L,W,"".concat(I,"-activePoint-").concat(B))),R?P.push(w.renderActiveDot(L,Fe(Fe({},W),{},{cx:R.x,cy:R.y}),"".concat(I,"-basePoint-").concat(B))):D&&P.push(null),P}),Ht(k,"renderGraphicChild",function(S,A,T){var R=k.filterFormatItem(S,A,T);if(!R)return null;var B=k.getTooltipEventType(),D=k.state,P=D.isTooltipActive,I=D.tooltipAxis,z=D.activeTooltipIndex,L=D.activeLabel,H=k.props.children,W=ga(H,us),V=R.props,K=V.points,M=V.isRange,G=V.baseLine,q=R.item.type.defaultProps!==void 0?Fe(Fe({},R.item.type.defaultProps),R.item.props):R.item.props,F=q.activeDot,U=q.hide,ee=q.activeBar,ne=q.activeShape,X=!!(!U&&P&&W&&(F||ee||ne)),ie={};B!=="axis"&&W&&W.props.trigger==="click"?ie={onClick:Vx(k.handleItemMouseEnter,S.props.onClick)}:B!=="axis"&&(ie={onMouseLeave:Vx(k.handleItemMouseLeave,S.props.onMouseLeave),onMouseEnter:Vx(k.handleItemMouseEnter,S.props.onMouseEnter)});var Z=h.cloneElement(S,Fe(Fe({},R.props),ie));function ce(_e){return typeof I.dataKey=="function"?I.dataKey(_e.payload):null}if(X)if(z>=0){var le,re;if(I.dataKey&&!I.allowDuplicatedCategory){var Ue=typeof I.dataKey=="function"?ce:"payload.".concat(I.dataKey.toString());le=J0(K,Ue,L),re=M&&G&&J0(G,Ue,L)}else le=K==null?void 0:K[z],re=M&&G&&G[z];if(ne||ee){var Ne=S.props.activeIndex!==void 0?S.props.activeIndex:z;return[h.cloneElement(S,Fe(Fe(Fe({},R.props),ie),{},{activeIndex:Ne})),null,null]}if(!hn(le))return[Z].concat(Tm(k.renderActivePoints({item:R,activePoint:le,basePoint:re,childIndex:z,isRange:M})))}else{var Oe,Me=(Oe=k.getItemByXY(k.state.activeCoordinate))!==null&&Oe!==void 0?Oe:{graphicalItem:Z},ue=Me.graphicalItem,Ve=ue.item,Xe=Ve===void 0?S:Ve,te=ue.childIndex,De=Fe(Fe(Fe({},R.props),ie),{},{activeIndex:te});return[h.cloneElement(Xe,De),null,null]}return M?[Z,null,null]:[Z,null]}),Ht(k,"renderCustomized",function(S,A,T){return h.cloneElement(S,Fe(Fe({key:"recharts-customized-".concat(T)},k.props),k.state))}),Ht(k,"renderMap",{CartesianGrid:{handler:Jx,once:!0},ReferenceArea:{handler:k.renderReferenceElement},ReferenceLine:{handler:Jx},ReferenceDot:{handler:k.renderReferenceElement},XAxis:{handler:Jx},YAxis:{handler:Jx},Brush:{handler:k.renderBrush,once:!0},Bar:{handler:k.renderGraphicChild},Line:{handler:k.renderGraphicChild},Area:{handler:k.renderGraphicChild},Radar:{handler:k.renderGraphicChild},RadialBar:{handler:k.renderGraphicChild},Scatter:{handler:k.renderGraphicChild},Pie:{handler:k.renderGraphicChild},Funnel:{handler:k.renderGraphicChild},Tooltip:{handler:k.renderCursor,once:!0},PolarGrid:{handler:k.renderPolarGrid,once:!0},PolarAngleAxis:{handler:k.renderPolarAxis},PolarRadiusAxis:{handler:k.renderPolarAxis},Customized:{handler:k.renderCustomized}}),k.clipPathId="".concat((N=_.id)!==null&&N!==void 0?N:dg("recharts"),"-clip"),k.throttleTriggeredAfterMouseMove=oK(k.triggeredAfterMouseMove,(C=_.throttleDelay)!==null&&C!==void 0?C:1e3/60),k.state={},k}return HCe(w,y),UCe(w,[{key:"componentDidMount",value:function(){var N,C;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(N=this.props.margin.left)!==null&&N!==void 0?N:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var N=this.props,C=N.children,k=N.data,S=N.height,A=N.layout,T=ga(C,us);if(T){var R=T.props.defaultIndex;if(!(typeof R!="number"||R<0||R>this.state.tooltipTicks.length-1)){var B=this.state.tooltipTicks[R]&&this.state.tooltipTicks[R].value,D=c5(this.state,k,R,B),P=this.state.tooltipTicks[R].coordinate,I=(this.state.offset.top+S)/2,z=A==="horizontal",L=z?{x:P,y:I}:{y:P,x:I},H=this.state.formattedGraphicalItems.find(function(V){var K=V.item;return K.type.name==="Scatter"});H&&(L=Fe(Fe({},L),H.props.points[R].tooltipPosition),D=H.props.points[R].tooltipPayload);var W={activeTooltipIndex:R,isTooltipActive:!0,activeLabel:B,activePayload:D,activeCoordinate:L};this.setState(W),this.renderCursor(T),this.accessibilityManager.setIndex(R)}}}},{key:"getSnapshotBeforeUpdate",value:function(N,C){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==C.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==N.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==N.margin){var k,S;this.accessibilityManager.setDetails({offset:{left:(k=this.props.margin.left)!==null&&k!==void 0?k:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(N){G2([ga(N.children,us)],[ga(this.props.children,us)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var N=ga(this.props.children,us);if(N&&typeof N.props.shared=="boolean"){var C=N.props.shared?"axis":"item";return l.indexOf(C)>=0?C:i}return i}},{key:"getMouseInfo",value:function(N){if(!this.container)return null;var C=this.container,k=C.getBoundingClientRect(),S=pye(k),A={chartX:Math.round(N.pageX-S.left),chartY:Math.round(N.pageY-S.top)},T=k.width/C.offsetWidth||1,R=this.inRange(A.chartX,A.chartY,T);if(!R)return null;var B=this.state,D=B.xAxisMap,P=B.yAxisMap,I=this.getTooltipEventType(),z=X6(this.state,this.props.data,this.props.layout,R);if(I!=="axis"&&D&&P){var L=Pu(D).scale,H=Pu(P).scale,W=L&&L.invert?L.invert(A.chartX):null,V=H&&H.invert?H.invert(A.chartY):null;return Fe(Fe({},A),{},{xValue:W,yValue:V},z)}return z?Fe(Fe({},A),z):null}},{key:"inRange",value:function(N,C){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,A=N/k,T=C/k;if(S==="horizontal"||S==="vertical"){var R=this.state.offset,B=A>=R.left&&A<=R.left+R.width&&T>=R.top&&T<=R.top+R.height;return B?{x:A,y:T}:null}var D=this.state,P=D.angleAxisMap,I=D.radiusAxisMap;if(P&&I){var z=Pu(P);return x$({x:A,y:T},z)}return null}},{key:"parseEventsOfWrapper",value:function(){var N=this.props.children,C=this.getTooltipEventType(),k=ga(N,us),S={};k&&C==="axis"&&(k.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var A=Q0(this.props,this.handleOuterEvent);return Fe(Fe({},A),S)}},{key:"addListener",value:function(){ak.on(ik,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){ak.removeListener(ik,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(N,C,k){for(var S=this.state.formattedGraphicalItems,A=0,T=S.length;A<T;A++){var R=S[A];if(R.item===N||R.props.key===N.key||C===Fo(R.item.type)&&k===R.childIndex)return R}return null}},{key:"renderClipPath",value:function(){var N=this.clipPathId,C=this.state.offset,k=C.left,S=C.top,A=C.height,T=C.width;return xe.createElement("defs",null,xe.createElement("clipPath",{id:N},xe.createElement("rect",{x:k,y:S,height:A,width:T})))}},{key:"getXScales",value:function(){var N=this.state.xAxisMap;return N?Object.entries(N).reduce(function(C,k){var S=Y6(k,2),A=S[0],T=S[1];return Fe(Fe({},C),{},Ht({},A,T.scale))},{}):null}},{key:"getYScales",value:function(){var N=this.state.yAxisMap;return N?Object.entries(N).reduce(function(C,k){var S=Y6(k,2),A=S[0],T=S[1];return Fe(Fe({},C),{},Ht({},A,T.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(N){var C;return(C=this.state.xAxisMap)===null||C===void 0||(C=C[N])===null||C===void 0?void 0:C.scale}},{key:"getYScaleByAxisId",value:function(N){var C;return(C=this.state.yAxisMap)===null||C===void 0||(C=C[N])===null||C===void 0?void 0:C.scale}},{key:"getItemByXY",value:function(N){var C=this.state,k=C.formattedGraphicalItems,S=C.activeItem;if(k&&k.length)for(var A=0,T=k.length;A<T;A++){var R=k[A],B=R.props,D=R.item,P=D.type.defaultProps!==void 0?Fe(Fe({},D.type.defaultProps),D.props):D.props,I=Fo(D.type);if(I==="Bar"){var z=(B.data||[]).find(function(V){return DNe(N,V)});if(z)return{graphicalItem:R,payload:z}}else if(I==="RadialBar"){var L=(B.data||[]).find(function(V){return x$(N,V)});if(L)return{graphicalItem:R,payload:L}}else if(mv(R,S)||fv(R,S)||bp(R,S)){var H=kSe({graphicalItem:R,activeTooltipItem:S,itemData:P.data}),W=P.activeIndex===void 0?H:P.activeIndex;return{graphicalItem:Fe(Fe({},R),{},{childIndex:W}),payload:bp(R,S)?P.data[H]:R.props.data[H]}}}return null}},{key:"render",value:function(){var N=this;if(!ER(this))return null;var C=this.props,k=C.children,S=C.className,A=C.width,T=C.height,R=C.style,B=C.compact,D=C.title,P=C.desc,I=J6(C,MCe),z=jn(I,!1);
967if(B)return xe.createElement(O6,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},xe.createElement(J2,Lu({},z,{width:A,height:T,title:D,desc:P}),this.renderClipPath(),TR(k,this.renderMap)));if(this.props.accessibilityLayer){var L,H;z.tabIndex=(L=this.props.tabIndex)!==null&&L!==void 0?L:0,z.role=(H=this.props.role)!==null&&H!==void 0?H:"application",z.onKeyDown=function(V){N.accessibilityManager.keyboardEvent(V)},z.onFocus=function(){N.accessibilityManager.focus()}}var W=this.parseEventsOfWrapper();return xe.createElement(O6,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},xe.createElement("div",Lu({className:wn("recharts-wrapper",S),style:Fe({position:"relative",cursor:"default",width:A,height:T},R)},W,{ref:function(K){N.container=K}}),xe.createElement(J2,Lu({},z,{width:A,height:T,title:D,desc:P,style:XCe}),this.renderClipPath(),TR(k,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(h.Component);Ht(j,"displayName",n),Ht(j,"defaultProps",Fe({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},m)),Ht(j,"getDerivedStateFromProps",function(y,w){var _=y.dataKey,N=y.data,C=y.children,k=y.width,S=y.height,A=y.layout,T=y.stackOffset,R=y.margin,B=w.dataStartIndex,D=w.dataEndIndex;if(w.updateId===void 0){var P=Z6(y);return Fe(Fe(Fe({},P),{},{updateId:0},x(Fe(Fe({props:y},P),{},{updateId:0}),w)),{},{prevDataKey:_,prevData:N,prevWidth:k,prevHeight:S,prevLayout:A,prevStackOffset:T,prevMargin:R,prevChildren:C})}if(_!==w.prevDataKey||N!==w.prevData||k!==w.prevWidth||S!==w.prevHeight||A!==w.prevLayout||T!==w.prevStackOffset||!zu(R,w.prevMargin)){var I=Z6(y),z={chartX:w.chartX,chartY:w.chartY,isTooltipActive:w.isTooltipActive},L=Fe(Fe({},X6(w,N,A)),{},{updateId:w.updateId+1}),H=Fe(Fe(Fe({},I),z),L);return Fe(Fe(Fe({},H),x(Fe({props:y},H),w)),{},{prevDataKey:_,prevData:N,prevWidth:k,prevHeight:S,prevLayout:A,prevStackOffset:T,prevMargin:R,prevChildren:C})}if(!G2(C,w.prevChildren)){var W,V,K,M,G=ga(C,bm),q=G&&(W=(V=G.props)===null||V===void 0?void 0:V.startIndex)!==null&&W!==void 0?W:B,F=G&&(K=(M=G.props)===null||M===void 0?void 0:M.endIndex)!==null&&K!==void 0?K:D,U=q!==B||F!==D,ee=!hn(N),ne=ee&&!U?w.updateId:w.updateId+1;return Fe(Fe({updateId:ne},x(Fe(Fe({props:y},w),{},{updateId:ne,dataStartIndex:q,dataEndIndex:F}),w)),{},{prevChildren:C,dataStartIndex:q,dataEndIndex:F})}return null}),Ht(j,"renderActiveDot",function(y,w,_){var N;return h.isValidElement(y)?N=h.cloneElement(y,w):gn(y)?N=y(w):N=xe.createElement(OA,w),xe.createElement(Cr,{className:"recharts-active-dot",key:_},N)});var b=h.forwardRef(function(w,_){return xe.createElement(j,Lu({},w,{ref:_}))});return b.displayName=j.displayName,b},l5e=fV({chartName:"LineChart",GraphicalChild:km,axisComponents:[{axisType:"xAxis",AxisComp:Qa},{axisType:"yAxis",AxisComp:Xa}],formatAxisMap:T9}),Od=fV({chartName:"BarChart",GraphicalChild:Cs,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Qa},{axisType:"yAxis",AxisComp:Xa}],formatAxisMap:T9});function ia(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function co(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function c5e(e,t){const n=ia(e);return isNaN(t)?co(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function d5e(e,t){const n=ia(e);if(isNaN(t))return co(e,NaN);const s=n.getDate(),a=co(e,n.getTime());a.setMonth(n.getMonth()+t+1,0);const i=a.getDate();return s>=i?a:(n.setFullYear(a.getFullYear(),a.getMonth(),s),n)}const hV=6048e5,u5e=864e5,pV=6e4,gV=36e5;let m5e={};function wv(){return m5e}function kp(e,t){var l,c,d,f;const n=wv(),s=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.weekStartsOn)??0,a=ia(e),i=a.getDay(),o=(i<s?7:0)+i-s;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function Yy(e){return kp(e,{weekStartsOn:1}
vendor: 19,275 bytes, line 967
967)}function xV(e){const t=ia(e),n=t.getFullYear(),s=co(e,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const a=Yy(s),i=co(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=Yy(i);return t.getTime()>=a.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function uo(e){const t=ia(e);return t.setHours(0,0,0,0),t}function tB(e){const t=ia(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function f5e(e,t){const n=uo(e),s=uo(t),a=+n-tB(n),i=+s-tB(s);return Math.round((a-i)/u5e)}function h5e(e){const t=xV(e),n=co(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Yy(n)}function p5e(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function g5e(e){if(!p5e(e)&&typeof e!="number")return!1;const t=ia(e);return!isNaN(Number(t))}function LA(e){const t=ia(e);return t.setHours(23,59,59,999),t}function x5e(e){const t=ia(e),n=co(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}const y5e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},b5e=(e,t,n)=>{let s;const a=y5e[e];return typeof a=="string"?s=a:t===1?s=a.one:s=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function lk(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const v5e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},w5e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},j5e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_5e={date:lk({formats:v5e,defaultWidth:"full"}),time:lk({formats:w5e,defaultWidth:"full"}),dateTime:lk({formats:j5e,defaultWidth:"full"})},N5e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},S5e=(e,t,n,s)=>N5e[e];function rh(e){return(t,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let a;if(s==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;a=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const k5e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},C5e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},E5e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},A5e={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},T5e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},P5e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},O5e=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},I5e={ordinalNumber:O5e,era:rh({values:k5e,defaultWidth:"wide"}),quarter:rh({values:C5e,defaultWidth:"wide",argumentCallback:e=>e-1}),month:rh({values:E5e,defaultWidth:"wide"}),day:rh({values:A5e,defaultWidth:"wide"}),dayPeriod:rh({values:T5e,defaultWidth:"wide",formattingValues:P5e,defaultFormattingWidth:"wide"})};function sh(e){return(t,n={})=>{const s=n.width,a=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],l=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?M5e(l,m=>m.test(o)):R5e(l,m=>m.test(o));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const f=t.slice(o.length);return{value:d,rest:f}}}function R5e(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function M5e(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function D5e(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const a=s[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(a.length);return{value:o,rest:l}}}const L5e=/^(\d+)(th|st|nd|rd)?/i,$5e=/\d+/i,B5e={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},F5e={any:[/^b/i,/^(a|c)/i]},z5e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},U5e={any:[/1/i,/2/i,/3/i,/4/i]},q5e={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},K5e={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},V5e={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},H5e={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},W5e={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},G5e={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Y5e={ordinalNumber:D5e({matchPattern:L5e,parsePattern:$5e,valueCallback:e=>parseInt(e,10)}),era:sh({matchPatterns:B5e,defaultMatchWidth:"wide",parsePatterns:F5e,defaultParseWidth:"any"}),quarter:sh({matchPatterns:z5e,defaultMatchWidth:"wide",parsePatterns:U5e,defaultParseWidth:"any",valueCallback:e=>e+1}),month:sh({matchPatterns:q5e,defaultMatchWidth:"wide",parsePatterns:K5e,defaultParseWidth:"any"}),day:sh({matchPatterns:V5e,defaultMatchWidth:"wide",parsePatterns:H5e,defaultParseWidth:"any"}),dayPeriod:sh({matchPatterns:W5e,defaultMatchWidth:"any",parsePatterns:G5e,defaultParseWidth:"any"})},J5e={code:"en-US",formatDistance:b5e,formatLong:_5e,formatRelative:S5e,localize:I5e,match:Y5e,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Q5e(e){const t=ia(e);return f5e(t,x5e(t))+1}function X5e(e){const t=ia(e),n=+Yy(t)-+h5e(t);return Math.round(n/hV)+1}function yV(e,t){var f,m,g,x;const n=ia(e),s=n.getFullYear(),a=wv(),i=(t==null?void 0:t.firstWeekContainsDate)??((m=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((x=(g=a.locale)==null?void 0:g.options)==null?void 0:x.firstWeekContainsDate)??1,o=co(e,0);o.setFullYear(s+1,0,i),o.setHours(0,0,0,0);const l=kp(o,t),c=co(e,0);c.setFullYear(s,0,i),c.setHours(0,0,0,0);const d=kp(c,t);return n.getTime()>=l.getTime()?s+1:n.getTime()>=d.getTime()?s:s-1}function Z5e(e,t){var l,c,d,f;const n=wv(),s=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,a=yV(e,t),i=co(e,0);return i.setFullYear(a,0,s),i.setHours(0,0,0,0),kp(i,t)}function eEe(e,t){const n=ia(e),s=+kp(n,t)-+Z5e(n,t);return Math.round(s/hV)+1}function qn(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const El={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return qn(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):qn(n+1,2)},d(e,t){return qn(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return qn(e.getHours()%12||12,t.length)},H(e,t){return qn(e.getHours(),t.length)},m(e,t){return qn(e.getMinutes(),t.length)},s(e,t){return qn(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return qn(a,t.length)}},_u={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},nB={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),a=s>0?s:1-s;return n.ordinalNumber(a,{unit:"year"})}return El.y(e,t)},Y:function(e,t,n,s){const a=yV(e,s),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return qn(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):qn(i,t.length)},R:function(e,t){const n=xV(e);return qn(n,t.length)},u:function(e,t){const n=e.getFullYear();return qn(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return qn(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return qn(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return El.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return qn(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const a=eEe(e,s);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):qn(a,t.length)},I:function(e,t,n){const s=X5e(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):qn(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):El.d(e,t)},D:function(e,t,n){const s=Q5e(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):qn(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const a=e.getDay(),i=(a-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return qn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const a=e.getDay(),i=(a-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return qn(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),a=s===0?7:s;switch(t){case"i":return String(a);case"ii":return qn(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let a;switch(s===12?a=_u.noon:s===0?a=_u.midnight:a=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let a;switch(s>=17?a=_u.evening:s>=12?a=_u.afternoon:s>=4?a=_u.morning:a=_u.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return El.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):El.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):qn(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):qn(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):El.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):El.s(e,t)},S:function(e,t){return El.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return sB(s);case"XXXX":case"XX":return Qc(s);case"XXXXX":case"XXX":default:return Qc(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return sB(s);case"xxxx":case"xx":return Qc(s);case"xxxxx":case"xxx":default:return Qc(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+rB(s,":");case"OOOO":default:return"GMT"+Qc(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+rB(s,":");case"zzzz":default:return"GMT"+Qc(s,":")}},t:function(e,t,n){const s=Math.trunc(e.getTime()/1e3);return qn(s,t.length)},T:function(e,t,n){const s=e.getTime();return qn(s,t.length)}};function rB(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=Math.trunc(s/60),i=s%60;return i===0?n+String(a):n+String(a)+t+qn(i,2)}function sB(e,t){return e%60===0?(e>0?"-":"+")+qn(Math.abs(e)/60,2):Qc(e,t)}function Qc(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=qn(Math.trunc(s/60),2),i=qn(s%60,2);return n+a+t+i}const aB=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},bV=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},tEe=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return aB(e,t);let i;switch(s){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",aB(s,t)).replace("{{time}}",bV(a,t))},nEe={p:bV,P:tEe},rEe=/^D+$/,sEe=/^Y+$/,aEe=["D","DD","YY","YYYY"];function iEe(e){return rEe.test(e)}function oEe(e){return sEe.test(e)}function lEe(e,t,n){const s=cEe(e,t,n);if(console.warn(s),aEe.includes(e))throw new RangeError(s)}function cEe(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const dEe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,uEe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,mEe=/^'([^]*?)'?$/,fEe=/''/g,hEe=/[a-zA-Z]/;function gs(e,t,n){var f,m,g,x;const s=wv(),a=s.locale??J5e,i=s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=s.weekStartsOn??((x=(g=s.locale)==null?void 0:g.options)==null?void 0:x.weekStartsOn)??0,l=ia(e);if(!g5e(l))throw new RangeError("Invalid time value");let c=t.match(uEe).map(j=>{const b=j[0];if(b==="p"||b==="P"){const y=nEe[b];return y(j,a.formatLong)}return j}).join("").match(dEe).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const b=j[0];if(b==="'")return{isToken:!1,value:pEe(j)};if(nB[b])return{isToken:!0,value:j};
967if(b.match(hEe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:j}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(j=>{if(!j.isToken)return j.value;const b=j.value;(oEe(b)||iEe(b))&&lEe(b,t,String(e));const y=nB[b[0]];return y(l,b,a.localize,d)}).join("")}function pEe(e){const t=e.match(mEe);return t?t[1].replace(fEe,"'"):e}function Mr(e,t){return c5e(e,-t)}function Jy(e,t){const s=bEe(e);let a;if(s.date){const c=vEe(s.date,2);a=wEe(c.restDateString,c.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);const i=a.getTime();let o=0,l;if(s.time&&(o=jEe(s.time),isNaN(o)))return new Date(NaN);if(s.timezone){if(l=_Ee(s.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(i+o),d=new Date(0);return d.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),d.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),d}return new Date(i+o+l)}const Qx={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},gEe=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,xEe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,yEe=/^([+-])(\d{2})(?::?(\d{2}))?$/;function bEe(e){const t={},n=e.split(Qx.dateTimeDelimiter);let s;if(n.length>2)return t;if(/:/.test(n[0])?s=n[0]:(t.date=n[0],s=n[1],Qx.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Qx.timeZoneDelimiter)[0],s=e.substr(t.date.length,e.length))),s){const a=Qx.timezone.exec(s);a?(t.time=s.replace(a[1],""),t.timezone=a[1]):t.time=s}return t}function vEe(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),s=e.match(n);if(!s)return{year:NaN,restDateString:""};const a=s[1]?parseInt(s[1]):null,i=s[2]?parseInt(s[2]):null;return{year:i===null?a:i*100,restDateString:e.slice((s[1]||s[2]).length)}}function wEe(e,t){if(t===null)return new Date(NaN);const n=e.match(gEe);if(!n)return new Date(NaN);const s=!!n[4],a=ah(n[1]),i=ah(n[2])-1,o=ah(n[3]),l=ah(n[4]),c=ah(n[5])-1;if(s)return EEe(t,l,c)?NEe(t,l,c):new Date(NaN);{const d=new Date(0);return!kEe(t,i,o)||!CEe(t,a)?new Date(NaN):(d.setUTCFullYear(t,i,Math.max(a,o)),d)}}function ah(e){return e?parseInt(e):1}function jEe(e){const t=e.match(xEe);if(!t)return NaN;const n=ck(t[1]),s=ck(t[2]),a=ck(t[3]);return AEe(n,s,a)?n*gV+s*pV+a*1e3:NaN}function ck(e){return e&&parseFloat(e.replace(",","."))||0}function _Ee(e){if(e==="Z")return 0;const t=e.match(yEe);if(!t)return 0;const n=t[1]==="+"?-1:1,s=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return TEe(s,a)?n*(s*gV+a*pV):NaN}function NEe(e,t,n){const s=new Date(0);s.setUTCFullYear(e,0,4);const a=s.getUTCDay()||7,i=(t-1)*7+n+1-a;return s.setUTCDate(s.getUTCDate()+i),s}const SEe=[31,null,31,30,31,30,31,31,30,31,30,31];function vV(e){return e%400===0||e%4===0&&e%100!==0}function kEe(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(SEe[t]||(vV(e)?29:28))}function CEe(e,t){return t>=1&&t<=(vV(e)?366:365)}function EEe(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function AEe(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function TEe(e,t){return t>=0&&t<=59}function PEe(e,t){return d5e(e,-6)}const wV="pv_ignored_ips",d5="pv_ignored_ips_changed";function Xx(){try{return new Set(JSON.parse(localStorage.getItem(wV)||"[]"))}catch{return new Set}}function dk(e){localStorage.setItem(wV,JSON.stringify([...e])),window.dispatchEvent(new Event(d5))}function jv(){const[e,t]=h.useState(Xx);h.useEffect(()=>{function i(){t(Xx())}return window.addEventListener(d5,i),()=>window.removeEventListener(d5,i)},[]);const n=h.useCallback(i=>{if(!i)return;const o=Xx();o.add(i),dk(o),t(new Set(o))},[]),s=h.useCallback(i=>{const o=Xx();o.delete(i),dk(o),t(new Set(o))},[]),a=h.useCallback(()=>{dk(new Set),t(new Set)},[]);return{ignoredIps:e,addIp:n,removeIp:s,clearAll:a}}function $A({ip:e,ignoredIps:t,addIp:n,removeIp:s,size:a="sm"}){if(!e)return null;const i=t.has(e);return r.jsx("button",{onClick:()=>i?s(e):n(e),title:i?"Remove from ignore list":"Add to ignore list",className:`flex items-center gap-0.5 transition-colors ${i?"text-orange-500 hover:text-orange-700":"text-gray-300 hover:text-orange-500"}`,children:r.jsx($h,{className:a==="sm"?"w-3 h-3":"w-3.5 h-3.5"})})}function jV({onClose:e,excludedIps:t,onClearExcluded:n,onToggleExcluded:s}){const{ignoredIps:a,removeIp:i,clearAll:o}=jv(),l=[...a].sort(),c=t?[...t].sort():[];return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-sm mx-4 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b",children:[r.jsx($h,{className:"w-4 h-4 text-orange-500"}),r.jsx("span",{className:"font-semibold text-gray-800",children:"IP Filters"}),r.jsx("button",{onClick:e,className:"ml-auto text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto max-h-80 px-4 py-3 space-y-3",children:[c.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[r.jsxs("span",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:["Chart-excluded (",c.length,")"]}),n&&r.jsx("button",{onClick:n,className:"text-[10px] text-red-400 hover:text-red-600 hover:underline",children:"Clear all"})]}),r.jsx("div",{className:"space-y-1",children:c.map(d=>r.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 py-1 rounded-lg bg-gray-50 border border-gray-100",children:[r.jsx("span",{className:"font-mono text-xs text-gray-700",children:d}),s&&r.jsx("button",{onClick:()=>s(d),className:"text-gray-400 hover:text-red-500 transition-colors",title:"Restore",children:r.jsx(jt,{className:"w-3.5 h-3.5"})})]},d))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[r.jsxs("span",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:["Global ignore list (",l.length,")"]}),l.length>0&&r.jsx("button",{onClick:o,className:"text-[10px] text-red-400 hover:text-red-600 hover:underline",children:"Clear all"})]}),l.length===0?r.jsx("p",{className:"text-xs text-gray-400 text-center py-2",children:"No IPs ignored yet."}):r.jsx("div",{className:"space-y-1",children:l.map(d=>r.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 py-1 rounded-lg bg-orange-50 border border-orange-100",children:[r.jsx("span",{className:"font-mono text-xs text-gray-700",children:d}),r.jsx("button",{onClick:()=>i(d),className:"text-gray-400 hover:text-red-500 transition-colors",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]},d))})]})]})]})})}function OEe(e,t){const n=new Blob([t],{type:"text/plain;charset=utf-8"}),s=URL.createObjectURL(n),a=document.createElement("a");a.href=s,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(s),1e3)}async function IEe(e){try{return await navigator.clipboard.writeText(e),!0}catch{try{const t=document.createElement("textarea");return t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),!0}catch{return!1}}}function Qy(){const e=new Date,t=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}_${t(e.getHours())}${t(e.getMinutes())}`}function BA({open:e,onClose:t,title:n,filename:s,text:a,loading:i}){const[o,l]=h.useState(!1);if(h.useEffect(()=>{e||l(!1)},[e]),h.useEffect(()=>{if(!e)return;function d(f){f.key==="Escape"&&t()}return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;async function c(){await IEe(a)&&(l(!0),setTimeout(()=>l(!1),2e3))}return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40",onClick:t,children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-3xl max-h-[85vh] flex flex-col",onClick:d=>d.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center gap-2 px-5 py-3 border-b",children:[r.jsx(ns,{className:"w-4 h-4 text-indigo-600"}),r.jsx("h3",{className:"font-semibold text-sm text-gray-800 flex-1",children:n}),r.jsxs("button",{disabled:i||!a,onClick:()=>OEe(s,a),className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-lg border border-indigo-200 text-indigo-700 bg-indigo-50 hover:bg-indigo-100 disabled:opacity-50 transition-colors",children:[r.jsx(Yz,{className:"w-3.5 h-3.5"})," Download"]}),r.jsxs("button",{disabled:i||!a,onClick:c,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-lg border border-gray-200 text-gray-700 bg-white hover:bg-gray-50 disabled:opacity-50 transition-colors",children:[o?r.jsx(Tn,{className:"w-3.5 h-3.5 text-emerald-600"}):r.jsx(ri,{className:"w-3.5 h-3.5"}),o?"Copied":"Copy"]}),r.jsx("button",{onClick:t,className:"p-1.5 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg transition-colors",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"flex-1 overflow-auto p-4",children:i?r.jsx("div",{className:"text-sm text-gray-400 py-10 text-center",children:"Generating report…"}):r.jsx("pre",{className:"text-xs text-gray-700 whitespace-pre-wrap font-mono leading-relaxed bg-gray-50 rounded-xl p-4 border border-gray-100",children:a})})]})})}const _V={today:"Today",yesterday:"Yesterday","7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",alltime:"All time",custom:"Custom range"};function REe(e,t,n){var c,d;const s=gs(new Date,"MMM d, yyyy HH:mm"),a=t||{},i=a.total_count||0,o=[];o.push("PAGE VIEWS — SUMMARY REPORT"),o.push(`Generated: ${s}`),o.push(""),o.push("=== FILTERS APPLIED ==="),o.push(`Assistant: ${(e==null?void 0:e.name)||"(unknown)"}`),e!=null&&e.assistant_key&&o.push(`Assistant key: ${e.assistant_key}`);const l=_V[n.preset]||n.preset;if(o.push(`Date range: ${l}`),n.preset==="custom"&&(n.customFrom||n.customTo)&&(o.push(`  from: ${n.customFrom||"(start)"}`),o.push(`  to: ${n.customTo||"(now)"}`)),n.excludedIps&&n.excludedIps.size>0?o.push(`Excluded IPs (${n.excludedIps.size}): ${[...n.excludedIps].join(", ")}`):o.push("Excluded IPs: none"),o.push(`Top IPs shown: ${n.ipTopN??10}`),o.push(""),o.push("=== OVERVIEW ==="),o.push(`Page loads (in range): ${i}`),o.push(`Unique visitors (in range): ${a.unique_users||0}`),o.push(`Total all-time: ${a.alltime_count||0}`),o.push(""),i>0){const f=(m,g)=>{g!=null&&g.length&&(o.push(`=== ${m.toUpperCase()} ===`),g.forEach(x=>{const j=Math.round(x.count/i*100);o.push(`  ${x.label||x.country||"(unknown)"}: ${x.count} (${j}%)`)}),o.push(""))};f("Top Countries",a.top_countries),f("Top Browsers",a.top_browsers),f("Top OS",a.top_os),f("Top Devices",a.top_devices),f("Top Referrers (caller pages)",a.top_referrers),(c=a.top_ips)!=null&&c.length&&(o.push("=== TOP IPS ==="),a.top_ips.forEach(m=>
967{const g=[m.city,m.country].filter(Boolean).join(", ");o.push(`  ${m.ip||m.label}: ${m.count} — ${m.org||""} ${g?"· "+g:""}`.trim())}),o.push("")),(d=a.by_day)!=null&&d.length&&(o.push("=== DAILY PAGE LOADS ==="),a.by_day.forEach(m=>o.push(`  ${m.date}: ${m.count}`)),o.push(""))}return o.join(`
968`)}function MEe(e,t,n){var c;const s=gs(new Date,"MMM d, yyyy HH:mm"),a=t||{},i=a.total_count||0,o=[];o.push("PAGE VIEWS — COMBINED SUMMARY REPORT"),o.push(`Generated: ${s}`),o.push(""),o.push("=== FILTERS APPLIED ==="),o.push(`Assistants (${e.length}):`),e.forEach(d=>{o.push(`  - ${(d==null?void 0:d.name)||"(unknown)"}${d!=null&&d.assistant_key?` [${d.assistant_key}]`:""}`)});const l=_V[n.preset]||n.preset;if(o.push(`Date range: ${l}`),n.preset==="custom"&&(n.customFrom||n.customTo)&&(o.push(`  from: ${n.customFrom||"(start)"}`),o.push(`  to: ${n.customTo||"(now)"}`)),o.push(""),o.push("=== OVERVIEW (AGGREGATED) ==="),o.push(`Page loads (in range): ${i}`),o.push(`Unique visitors (in range): ${a.unique_users||0}`),o.push(`Total all-time: ${a.alltime_count||0}`),o.push(""),i>0){const d=(f,m)=>{m!=null&&m.length&&(o.push(`=== ${f.toUpperCase()} ===`),m.forEach(g=>{const x=Math.round(g.count/i*100);o.push(`  ${g.label||g.country||"(unknown)"}: ${g.count} (${x}%)`)}),o.push(""))};d("Top Countries",a.top_countries),d("Top Browsers",a.top_browsers),d("Top OS",a.top_os),d("Top Devices",a.top_devices),(c=a.by_day)!=null&&c.length&&(o.push("=== DAILY PAGE LOADS ==="),a.by_day.forEach(f=>o.push(`  ${f.date}: ${f.count}`)),o.push(""))}return o.join(`
969`)}function NV(e){var n;return{"United States":"us",Brazil:"br","United Kingdom":"gb",Canada:"ca",Australia:"au",Germany:"de",France:"fr",Spain:"es",Italy:"it",Netherlands:"nl",Portugal:"pt",Mexico:"mx",Argentina:"ar",Chile:"cl",Colombia:"co",India:"in",Japan:"jp",China:"cn","South Korea":"kr",Singapore:"sg",Israel:"il","South Africa":"za",Nigeria:"ng",Kenya:"ke",Egypt:"eg",Turkey:"tr",Russia:"ru",Poland:"pl",Sweden:"se",Norway:"no",Denmark:"dk",Finland:"fi",Switzerland:"ch",Austr
969ia:"at",Belgium:"be",Ireland:"ie","New Zealand":"nz",UAE:"ae","Saudi Arabia":"sa",Pakistan:"pk",Bangladesh:"bd",Indonesia:"id",Malaysia:"my",Thailand:"th",Vietnam:"vn",Philippines:"ph"}[e]||((n=e==null?void 0:e.slice(0,2))==null?void 0:n.toLowerCase())||"xx"}const DEe=[{label:"Today",key:"today"},{label:"Yesterday",key:"yesterday"},{label:"7d",key:"7d"},{label:"30d",key:"30d"},{label:"90d",key:"90d"},{label:"All time",key:"alltime"},{label:"Custom",key:"custom"}],LEe=[{key:"daily",label:"Daily"},{key:"intraday",label:"Intraday"},{key:"heatmap",label:"Hour × Day"}],$Ee=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],BEe=e=>`pv_ip_filters_${e}`,FEe=e=>`pv_ip_topn_${e}`;function Zx({title:e,rows:t,total:n,renderLabel:s,mono:a}){return t!=null&&t.length?r.jsxs("div",{className:"bg-gray-50 rounded-xl p-2 space-y-1",children:[r.jsx("div",{className:"text-[9px] font-semibold text-gray-400 uppercase tracking-wide",children:e}),t.map(({label:i,count:o})=>{const l=Math.round(o/n*100);return r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("div",{className:"flex-1 h-1 rounded-full bg-gray-200 overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-indigo-400",style:{width:`${l}%`}})})}),r.jsx("div",{className:`text-[10px] text-gray-600 truncate max-w-[80px] ${a?"font-mono":""}`,children:s?s(i):i}),r.jsxs("span",{className:"text-[9px] text-gray-400 whitespace-nowrap shrink-0",children:[o," · ",l,"%"]})]},i)})]}):null}function zEe({topIps:e,total:t,excludedIps:n,onExclude:s,topN:a,onTopNChange:i,ignoredIps:o,onIgnore:l,onShowIgnoreModal:c,allExcludedIps:d}){const[f,m]=h.useState(!1),[g,x]=h.useState(String(a));h.useEffect(()=>{x(String(a))},[a]);function j(){const _=parseInt(g);_>0&&_<=100&&i(_),m(!1)}const b=e.map(_=>({ip:_.label,count:_.count,country:_.country||null,org:_.org||null,city:_.city||null})),y=({active:_,payload:N})=>{if(!_||!(N!=null&&N.length))return null;const C=N[0].payload;return r.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-lg p-3 text-xs max-w-[280px]",children:[r.jsx("div",{className:"font-mono font-bold text-gray-800 mb-1",children:C.ip}),r.jsxs("div",{className:"text-gray-500 mb-1",children:[C.count," view",C.count!==1?"s":""," · ",Math.round(C.count/t*100),"%"]}),C.org?r.jsx("div",{className:"text-indigo-600 truncate mb-0.5",children:C.org}):r.jsx("div",{className:"text-gray-300 text-[10px]",children:"org not enriched"}),C.city||C.country?r.jsxs("div",{className:"text-gray-400 flex items-center gap-1 mt-0.5",children:[C.country&&r.jsx("img",{src:`https://flagcdn.com/16x12/${NV(C.country)}.png`,alt:"",className:"inline-block",onError:k=>{k.target.style.display="none"}}),[C.city,C.country].filter(Boolean).join(", ")]}):r.jsx("div",{className:"text-gray-300 text-[10px]",children:"location not enriched"})]})},w=({x:_,y:N,width:C,index:k})=>{const S=b[k],A=[S.city,S.country].filter(Boolean).join(", "),T=S.org?A?`${S.org} · ${A}`:S.org:A||null,R=o==null?void 0:o.has(S.ip);return r.jsxs("g",{children:[r.jsx("text",{x:_+C+6,y:N+7,fill:R?"#f97316":"#374151",fontSize:10,fontWeight:"600",dominantBaseline:"middle",children:S.count}),T&&r.jsxs("text",{x:_+C+28,y:N+7,fill:R?"#f97316":"#9ca3af",fontSize:9,dominantBaseline:"middle",children:[T,R?" ⛔":""]}),!T&&R&&r.jsx("text",{x:_+C+28,y:N+7,fill:"#f97316",fontSize:9,dominantBaseline:"middle",children:"⛔"})]})};return r.jsxs("div",{className:"bg-white border border-gray-100 rounded-2xl p-4 shadow-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-700",children:"Top IPs"}),r.jsxs("button",{onClick:c,className:"flex items-center gap-1 px-2 py-0.5 text-xs text-orange-600 border border-orange-200 rounded-lg hover:bg-orange-50 transition-colors ml-2",children:[r.jsx($h,{className:"w-3 h-3"}),"IP Filters",((o==null?void 0:o.size)>0||(n==null?void 0:n.size)>0)&&r.jsx("span",{className:"bg-orange-100 rounded-full px-1.5 text-[10px] font-bold",children:((o==null?void 0:o.size)||0)+((n==null?void 0:n.size)||0)})]}),r.jsx("div",{className:"flex items-center gap-1 ml-auto",children:f?r.jsx("div",{className:"flex items-center gap-1",children:r.jsx("input",{type:"number",min:"1",max:"100",value:g,onChange:_=>x(_.target.value),onKeyDown:_=>{_.key==="Enter"&&j(),_.key==="Escape"&&m(!1)},onBlur:j,className:"w-16 border rounded-lg px-2 py-0.5 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400",autoFocus:!0})}):r.jsxs("button",{onClick:()=>{x(String(a)),m(!0)},className:"flex items-center gap-1 px-2 py-0.5 text-xs text-gray-500 border rounded-lg hover:border-indigo-300 hover:text-indigo-600 transition-colors",children:[r.jsx(H5,{className:"w-3 h-3"}),"Top ",a]})})]}),b.length===0?r.jsx("div",{className:"text-xs text-gray-400 py-6 text-center",children:"No IP data available."}
969):r.jsx(Zl,{width:"100%",height:Math.max(120,b.length*28+20),children:r.jsxs(Od,{data:b,layout:"vertical",margin:{top:2,right:200,left:4,bottom:2},children:[r.jsx(Qa,{type:"number",tick:{fontSize:9},tickLine:!1,axisLine:!1,allowDecimals:!1}),r.jsx(Xa,{type:"category",dataKey:"ip",tick:!1,axisLine:!1,tickLine:!1,width:0}),r.jsx(us,{content:r.jsx(y,{})}),r.jsx(Cs,{dataKey:"count",radius:[0,4,4,0],label:r.jsx(w,{}),cursor:"pointer",onClick:_=>s(_.ip),children:b.map(_=>r.jsx(mg,{fill:n.has(_.ip)?"#e5e7eb":"#6366f1"},_.ip))})]})}),b.length>0&&r.jsx("div",{className:"mt-3 pt-3 border-t space-y-1",children:b.map(_=>r.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[r.jsx("span",{className:"font-mono text-gray-600 w-28 truncate shrink-0",children:_.ip}),r.jsxs("button",{onClick:()=>s(_.ip),title:n.has(_.ip)?"Restore to stats":"Exclude from stats",className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded border transition-colors ${n.has(_.ip)?"bg-orange-50 border-orange-200 text-orange-600":"border-gray-200 text-gray-400 hover:text-orange-500 hover:border-orange-200"}`,children:[r.jsx(jt,{className:"w-2.5 h-2.5"}),n.has(_.ip)?"excluded":"exclude"]}),r.jsx($A,{ip:_.ip,ignoredIps:o,addIp:N=>l(N,!0),removeIp:N=>l(N,!1),size:"sm"}),r.jsx("span",{className:`text-[9px] ${o!=null&&o.has(_.ip)?"text-orange-400":"text-gray-300"}`,children:o!=null&&o.has(_.ip)?"on ignore list":"add to ignore list"})]},_.ip))})]})}function UEe({topReferrers:e,total:t}){if(!(e!=null&&e.length))return null;const n=({active:a,payload:i})=>{if(!a||!(i!=null&&i.length))return null;const o=i[0].payload;return r.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-lg p-3 text-xs",children:[r.jsx("div",{className:"font-medium text-gray-800 mb-1",children:o.label||"(direct)"}),r.jsxs("div",{className:"text-gray-500",children:[o.count," view",o.count!==1?"s":""," · ",Math.round(o.count/t*100),"%"]})]})},s=e.map(a=>({...a}));return r.jsxs("div",{className:"bg-white border border-gray-100 rounded-2xl p-4 shadow-sm",children:[r.jsx("div",{className:"text-xs font-semibold text-gray-700 mb-3",children:"Caller Pages (where the assistant is embedded)"}),r.jsx(Zl,{width:"100%",height:Math.max(120,s.length*28+20),children:r.jsxs(Od,{data:s,layout:"vertical",margin:{top:2,right:60,left:4,bottom:2},children:[r.jsx(Qa,{type:"number",tick:{fontSize:9},tickLine:!1,axisLine:!1,allowDecimals:!1}),r.jsx(Xa,{type:"category",dataKey:"label",tick:{fontSize:9},axisLine:!1,tickLine:!1,width:130}),r.jsx(us,{content:r.jsx(n,{})}),r.jsx(Cs,{dataKey:"count",fill:"#8b5cf6",radius:[0,4,4,0]})]})})]})}function SV({assistant:e}){var F;const t=BEe((e==null?void 0:e.assistant_key)||"x"),n=FEe((e==null?void 0:e.assistant_key)||"x"),[s,a]=h.useState(null),[i,o]=h.useState(!0),[l,c]=h.useState("30d"),[d,f]=h.useState(""),[m,g]=h.useState(""),[x,j]=h.useState("daily"),[b,y]=h.useState(!1),[w,_]=h.useState({open:!1,text:"",loading:!1}),{ignoredIps:N,addIp:C,removeIp:k}=jv(),[S,A]=h.useState(()=>{try{return new Set(JSON.parse(localStorage.getItem(t)||"[]"))}catch{return new Set}}),[T,R]=h.useState(()=>{try{return parseInt(localStorage.getItem(n)||"10")}catch{return 10}}),B=h.useRef(S),D=h.useRef(T);h.useEffect(()=>{B.current=S,localStorage.setItem(t,JSON.stringify([...S]))},[S,t]),h.useEffect(()=>{D.current=T,localStorage.setItem(n,String(T))},[T,n]);const P=h.useCallback((U,ee,ne)=>{const X=new Date;return U==="today"?{date_from:uo(X).toISOString(),date_to:null}:U==="yesterday"?{date_from:uo(Mr(X,1)).toISOString(),date_to:LA(Mr(X,1)).toISOString()}:U==="7d"?{date_from:Mr(X,7).toISOString(),date_to:null}:U==="30d"?{date_from:Mr(X,30).toISOString(),date_to:null}:U==="90d"?{date_from:Mr(X,90).toISOString(),date_to:null}:U==="alltime"?{date_from:null,date_to:null}:U==="custom"?{date_from:ee?new Date(ee).toISOString():null,date_to:ne?new Date(ne).toISOString():null}:{date_from:Mr(X,30).toISOString(),date_to:null}},[]),I=h.useRef(N);h.useEffect(()=>{I.current=N},[N]);const z=h.useCallback((U,ee)=>{if(!(e!=null&&e.id)){o(!1);return}o(!0);const ne=U!==void 0?U:B.current,X=new Set([...ne,...I.current]),ie=ee!==void 0?ee:D.current,{date_from:Z,date_to:ce}=P(l,d,m);Y.functions.invoke("getPageViewStats",{assistant_id:e.id,date_from:Z,date_to:ce,logs_limit:1,logs_offset:0,ip_top_n:ie,excluded_ips:[...X]}).then(le=>{a(le.data),o(!1)}).catch(()=>o(!1))},[e==null?void 0:e.id,P,l,d,m]),L=[...S].sort().join(","),H=[...N].sort().join(",");h.useEffect(()=>{z()},[e==null?void 0:e.id,l,d,m,T,L,H]);function W(U){A(ee=>{const ne=new Set(ee);return ne.has(U)?ne.delete(U):ne.add(U),ne})}const V=h.useMemo(()=>s!=null&&s.by_day?s.by_day.map(U=>({date:gs(Jy(U.date),"MMM d"),count:U.count})):[],[s]),K=h.useMemo(()=>s!=null&&s.by_hour?s.by_hour.map(({h:U,count:ee})=>({hour:`${String(U).padStart(2,"00")}h`,count:ee,h:U})):[],[s]),M=h.useMemo(()=>
969{if(!(s!=null&&s.by_dow_hour))return{grid:Array.from({length:7},()=>Array(24).fill(0)),maxVal:1};const U=s.by_dow_hour,ee=Math.max(1,...U.flat());return{grid:U,maxVal:ee}},[s]);if(i&&!s)return r.jsx("div",{className:"text-xs text-gray-400 py-4 text-center",children:"Loading stats…"});const G=s||{},q=G.total_count||0;return r.jsxs("div",{className:`space-y-4 relative transition-opacity ${i?"opacity-50 pointer-events-none":""}`,children:[i&&s&&r.jsxs("div",{className:"absolute top-0 right-0 z-10 flex items-center gap-1.5 bg-white border border-indigo-200 rounded-lg px-2.5 py-1 shadow-sm",children:[r.jsx("div",{className:"w-3 h-3 border-2 border-indigo-200 border-t-indigo-600 rounded-full animate-spin"}),r.jsx("span",{className:"text-[11px] text-indigo-600 font-medium",children:"Updating…"})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(Lm,{className:"w-3.5 h-3.5 text-gray-400"}),DEe.map(U=>r.jsx("button",{onClick:()=>c(U.key),className:`px-2.5 py-1 text-xs font-medium rounded-lg border transition-colors ${l===U.key?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300"}`,children:U.label},U.key)),l==="custom"&&r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("input",{type:"date",value:d,onChange:U=>f(U.target.value),className:"border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("span",{className:"text-gray-400",children:"→"}),r.jsx("input",{type:"date",value:m,onChange:U=>g(U.target.value),className:"border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400"})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[r.jsxs("button",{onClick:()=>{_({open:!0,text:"",loading:!0}),setTimeout(()=>{const U=REe(e,s,{preset:l,customFrom:d,customTo:m,excludedIps:S,ipTopN:T});_(ee=>({...ee,text:U,loading:!1}))},30)},className:"flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-lg border bg-white text-gray-700 border-gray-200 hover:bg-gray-50 transition-colors",children:[r.jsx(K5,{className:"w-3 h-3"}),"Export Report"]}),r.jsx(wt,{to:yt("PageViewLogs"),children:r.jsxs("button",{className:"flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-lg border bg-white text-indigo-600 border-indigo-200 hover:bg-indigo-50 transition-colors",children:[r.jsx(Bm,{className:"w-3 h-3"}),"View Logs (",G.logs_total??"…",")",r.jsx(yr,{className:"w-3 h-3"})]})})]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"bg-indigo-50 rounded-xl p-3 text-center",children:[r.jsx("div",{className:"text-xl font-bold text-indigo-700",children:q}),r.jsx("div",{className:"text-[10px] text-indigo-500 font-medium uppercase tracking-wide",children:"Page Loads"})]}),r.jsxs("div",{className:"bg-violet-50 rounded-xl p-3 text-center",children:[r.jsx("div",{className:"text-xl font-bold text-violet-700",children:G.unique_users||0}),r.jsx("div",{className:"text-[10px] text-violet-500 font-medium uppercase tracking-wide",children:"Unique Visitors"})]}),r.jsxs("div",{className:"bg-emerald-50 rounded-xl p-3 text-center",children:[r.jsx("div",{className:"text-xl font-bold text-emerald-700",children:G.alltime_count||0}),r.jsx("div",{className:"text-[10px] text-emerald-500 font-medium uppercase tracking-wide",children:"Total All-time"})]})]}),q>0&&r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(Zx,{title:"Location",rows:G.top_countries,total:q,renderLabel:U=>r.jsxs("span",{className:"flex items-center gap-1",children:[U!=="Unknown"&&r.jsx("img",{src:`https://flagcdn.com/16x12/${NV(U)}.png`,alt:U,className:"inline-block",onError:ee=>{ee.target.style.display="none"}}),r.jsx("span",{children:U})]})}),r.jsx(Zx,{title:"Browser",rows:G.top_browsers,total:q}),r.jsx(Zx,{title:"OS",rows:G.top_os,total:q}),r.jsx(Zx,{title:"Device",rows:G.top_devices,total:q,renderLabel:U=>r.jsx("span",{className:"capitalize",children:U})})]}),q>0&&r.jsx(zEe,{topIps:G.top_ips||[],total:q,excludedIps:S,onExclude:W,topN:T,onTopNChange:R,ignoredIps:N,onIgnore:(U,ee)=>ee?C(U):k(U),onShowIgnoreModal:()=>y(!0)}),b&&r.jsx(jV,{onClose:()=>y(!1),excludedIps:S,onToggleExcluded:W,onClearExcluded:()=>A(new Set)}),q>0&&((F=G.top_referrers)==null?void 0:F.length)>0&&r.jsx(UEe,{topReferrers:G.top_referrers,total:q}),r.jsx("div",{className:"flex gap-1",children:LEe.map(U=>r.jsx("button",{onClick:()=>j(U.key),className:`px-2.5 py-1 text-xs font-medium rounded-lg border transition-colors ${x===U.key?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300"}`,children:U.label},U.key))}),q===0?r.jsx("p",{className:"text-xs text-gray-400 py-4 text-center",children:"No page views in this period."}):x==="daily"?r.jsx(Zl,{width:"100%",height:140,children:r.jsxs(Od,{data:V,margin:{top:2,right:4,left:-24,bottom:0},children:[r.jsx(Qa,{dataKey:"date",tick:{fontSize:9}
969,tickLine:!1,axisLine:!1}),r.jsx(Xa,{tick:{fontSize:9},tickLine:!1,axisLine:!1,allowDecimals:!1}),r.jsx(us,{contentStyle:{fontSize:11,borderRadius:8},formatter:U=>[U,"Loads"]}),r.jsx(Cs,{dataKey:"count",fill:"#6366f1",radius:[3,3,0,0],name:"Loads"})]})}):x==="intraday"?r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] text-gray-400 mb-1",children:"Views by hour of day (server time)"}),r.jsx(Zl,{width:"100%",height:140,children:r.jsxs(Od,{data:K,margin:{top:2,right:4,left:-24,bottom:0},children:[r.jsx(Qa,{dataKey:"hour",tick:{fontSize:8},tickLine:!1,axisLine:!1,interval:1}),r.jsx(Xa,{tick:{fontSize:9},tickLine:!1,axisLine:!1,allowDecimals:!1}),r.jsx(us,{contentStyle:{fontSize:11,borderRadius:8},formatter:U=>[U,"Loads"]}),r.jsx(Cs,{dataKey:"count",radius:[3,3,0,0],name:"Loads",children:K.map(U=>r.jsx(mg,{fill:U.h>=6&&U.h<20?"#6366f1":"#a5b4fc"},U.h))})]})})]}):r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] text-gray-400 mb-2",children:"Views by hour × day of week (server time)"}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"text-[9px] border-separate border-spacing-0.5",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-gray-400 font-normal w-7 text-right pr-1"}),Array.from({length:24},(U,ee)=>r.jsx("th",{className:"text-gray-400 font-normal w-5 text-center",children:ee%3===0?String(ee).padStart(2,"0"):""},ee))]})}),r.jsx("tbody",{children:$Ee.map((U,ee)=>r.jsxs("tr",{children:[r.jsx("td",{className:"text-gray-400 text-right pr-1 font-medium",children:U}),M.grid[ee].map((ne,X)=>{const ie=ne/M.maxVal,Z=ne===0?"bg-gray-100":ie<.25?"bg-indigo-100":ie<.5?"bg-indigo-300":ie<.75?"bg-indigo-500":"bg-indigo-700";return r.jsx("td",{title:`${U} ${String(X).padStart(2,"00")}:00 — ${ne} loads`,className:`w-5 h-4 rounded-sm ${Z} cursor-default`},X)})]},ee))})]})})]}),r.jsx(BA,{open:w.open,onClose:()=>_(U=>({...U,open:!1})),title:"Page Views Report",filename:`pageviews_${(e==null?void 0:e.assistant_key)||"assistant"}_${Qy()}.txt`,text:w.text,loading:w.loading})]})}const qEe={Test:"bg-amber-50 text-amber-700 border-amber-200",Investigation:"bg-violet-50 text-violet-700 border-violet-200",Knowledge:"bg-indigo-50 text-indigo-700 border-indigo-200","Learning Assistant":"bg-emerald-50 text-emerald-700 border-emerald-200"};function KEe({a:e,linkedKbs:t,libraryName:n,onDelete:s,onClone:a,onMove:i,onCopyLink:o}){const[l,c]=h.useState(!1),[d,f]=h.useState(!1);return r.jsxs("div",{className:"border rounded-2xl bg-white hover:shadow-lg hover:border-indigo-200 transition-all group overflow-hidden flex flex-col",children:[r.jsxs("div",{className:"flex items-start gap-4 px-5 pt-5 pb-4",children:[e.icon_url?r.jsx("img",{src:e.icon_url,alt:"",className:"w-12 h-12 rounded-xl object-contain shrink-0 border bg-gray-50 shadow-sm"}):r.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shrink-0 border bg-indigo-50 border-indigo-100",children:r.jsx(Vn,{className:"w-5 h-5 text-indigo-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-bold text-base text-gray-900 group-hover:text-indigo-700 transition-colors truncate",children:e.name}),e.status==="inactive"&&r.jsx("span",{className:"text-[10px] bg-gray-100 text-gray-400 border border-gray-200 px-1.5 py-0.5 rounded-full shrink-0",children:"inactive"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap mt-1",children:[e.type&&r.jsx("span",{className:`text-[10px] border px-2 py-0.5 rounded-full font-medium ${qEe[e.type]||"bg-gray-50 text-gray-500 border-gray-200"}`,children:e.type}),n&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] border border-violet-200 bg-violet-50 text-violet-700 px-2 py-0.5 rounded-full font-medium",children:[r.jsx(wh,{className:"w-2.5 h-2.5"})," ",n]})]}),e.description&&r.jsx("p",{className:"text-xs text-gray-500 mt-1.5 line-clamp-2",children:e.description}),e.assistant_key&&r.jsxs("div",{className:"flex items-center gap-1.5 mt-2",children:[r.jsxs("a",{href:`${window.location.origin}/assistant/${e.assistant_key}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-indigo-600 hover:underline flex items-center gap-1",children:[r.jsx(Qp,{className:"w-3 h-3"})," Open landing"]}),r.jsx("button",{onClick:m=>o(e,m),className:"text-gray-400 hover:text-indigo-600 transition-colors",title:"Copy link",children:r.jsx(ri,{className:"w-3 h-3"})})]})]})]}),r.jsx("div",{className:"px-5 pb-3 min-h-[28px]",children:t.length>0?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>f(m=>!m),className:"flex items-center gap-1.5 text-[11px] font-medium text-gray-500 hover:text-indigo-600 transition-colors",children:[r.jsx(_n,{className:"w-3 h-3"}),t.length," knowledge base",t.length===1?"":"s",d?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]}),d&&r.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:t.map(m=>r.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] bg-indigo-50 text-indigo-600 border border-indigo-100 rounded-full px-2 py-0.5",children:[r.jsx(_n,{className:"w-2.5 h-2.5"})," ",m.name]},m.id))})]}):r.jsx("span",{className:"text-[10px] text-gray-300 italic",children:"No knowledge base linked"})}),r.jsxs("div",{className:"px-5 pb-4 flex items-center gap-3 text-[10px] text-gray-400 flex-wrap",children:[r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx(Lte,{className:"w-3 h-3"}),"temp ",e.temperature??.3]}),r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx(ys,{className:"w-3 h-3"}),e.max_context_items??10," ctx"]}),r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx(V5,{className:"w-3 h-3"}),e.response_language||"auto"]}),e.use_internet&&r.jsxs("span",{className:"flex items-center gap-0.5 text-emerald-500",children:[r.jsx(Na,{className:"w-3 h-3"}),"internet"]})]}),e.assistant_key&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>c(m=>!m),className:`mx-5 mb-3 flex items-center justify-between gap-1.5 text-xs font-medium px-3 py-2 rounded-xl border transition-colors ${l?"bg-indigo-50 border-indigo-200 text-indigo-700":"bg-gray-50 border-gray-200 text-gray-500 hover:bg-indigo-50 hover:text-indigo-600 hover:border-indigo-200"}`,children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Ts,{className:"w-3.5 h-3.5"})," Page View Stats"]}),l?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})]}),l&&r.jsx("div",{className:"px-5 pb-4",children:r.jsx(SV,{assistant:e})})]}),r.jsxs("div",{className:"border-t px-4 py-3 flex items-center justify-between bg-gray-50 mt-auto",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(wt,{to:yt(`Chat?assistant_id=${e.id}`),children:r.jsxs(de,{size:"sm",className:"gap-1 h-7 text-xs px-2.5",children:[r.jsx(Br,{className:"w-3 h-3"})," Chat"]})}),r.jsx(wt,{to:yt(`AssistantSessions?assistant_id=${e.id}`),children:r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1 h-7 text-xs px-2.5",children:[r.jsx(Qz,{className:"w-3 h-3"})," Sessions"]})}),r.jsx(wt,{to:yt(`AssistantForm?id=${e.id}`),children:r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1 h-7 text-xs px-2.5",children:[r.jsx(Zp,{className:"w-3 h-3"})," Edit"]})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:i,className:"text-gray-400 hover:text-violet-600 transition-colors",title:"Move to library",children:r.jsx(Jp,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:m=>a(e,m),className:"text-gray-400 hover:text-indigo-600 transition-colors",children:r.jsx(ri,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:m=>s(e,m),className:"text-gray-300 hover:text-red-500 transition-colors",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]})]})]})}function VEe(){var S;const{toast:e}=bb(),[t,n]=h.useState([]),[s,a]=h.useState([]),[i,o]=h.useState([]),[l,c]=h.useState(!0),[d,f]=h.useState(()=>localStorage.getItem("libsel_assistants")||"all");function m(A){f(A),localStorage.setItem("libsel_assistants",A)}const[g,x]=h.useState(null);h.useEffect(()=>{j()},[]);async function j(){c(!0);const[A,T]=await Promise.all([Y.entities.Assistant.list("-created_date"),Y.entities.Library.list("name")]);n(A),o(T),c(!1),Y.entities.KnowledgeBase.list().then(a).catch(()=>{})}async function b(A,T){T.stopPropagation(),confirm(`Delete "${A.name}"?`)&&(await Y.entities.Assistant.delete(A.id),n(R=>
969R.filter(B=>B.id!==A.id)))}async function y(A,T){T.stopPropagation();const R=prompt("Name for cloned assistant:",`${A.name} (copy)`);if(!R)return;const{id:B,created_date:D,updated_date:P,created_by:I,...z}=A,L=(z.assistant_key||"").replace(/-copy(-\d+)?$/,""),H=new Set(t.map(K=>K.assistant_key).filter(Boolean));let W=L?`${L}-copy`:"";if(W&&H.has(W)){let K=2;for(;H.has(`${L}-copy-${K}`);)K++;W=`${L}-copy-${K}`}const V=await Y.entities.Assistant.create({...z,name:R,assistant_key:W});n(K=>[V,...K])}async function w(A){const T=g,R=i.find(B=>B.id===A);try{await Y.entities.Assistant.update(T.id,{library_id:A}),n(B=>B.map(D=>D.id===T.id?{...D,library_id:A}:D)),e({title:R?`Moved "${T.name}" to ${R.name}`:`Moved "${T.name}" to Uncategorized`})}catch{e({title:`Could not move "${T.name}"`,description:"Please try again.",variant:"destructive"})}x(null)}function _(A,T){T.stopPropagation();const B=`${window.location.origin}/assistant/${A.assistant_key}`;navigator.clipboard.writeText(B),e({title:"Link copied to clipboard"})}const N=Object.fromEntries(s.map(A=>[A.id,A])),C=d==="all"?t:d==="none"?t.filter(A=>!A.library_id):t.filter(A=>A.library_id===d),k={__all__:t.length,__none__:t.filter(A=>!A.library_id).length,...Object.fromEntries(i.map(A=>[A.id,t.filter(T=>T.library_id===A.id).length]))};return r.jsxs("div",{className:"flex h-full min-h-0",children:[r.jsx(zb,{libraries:i,selected:d,onSelect:m,counts:k,onLibrariesChange:o,storageKey:"assistants",onItemsUnassigned:A=>{n(T=>T.map(R=>R.library_id===A?{...R,library_id:""}:R)),d===A&&m("all")}}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs("div",{className:"p-6 md:p-8",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:d==="all"?"AI Assistants":d==="none"?"Uncategorized Assistants":((S=i.find(A=>A.id===d))==null?void 0:S.name)||"AI Assistants"}),r.jsx("p",{className:"text-gray-500 text-base mt-1",children:"Configure assistants with custom prompts and knowledge bases"})]}),r.jsx(wt,{to:yt("AssistantForm"),children:r.jsxs(de,{size:"lg",className:"gap-2",children:[r.jsx(ln,{className:"w-5 h-5"})," New Assistant"]})})]}),l?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(A=>r.jsx("div",{className:"h-56 bg-gray-100 animate-pulse rounded-2xl"},A))}):C.length===0?r.jsxs("div",{className:"text-center py-24 border-2 border-dashed border-gray-200 rounded-2xl",children:[r.jsx(Vn,{className:"w-12 h-12 mx-auto mb-3 text-gray-300"}),r.jsx("h3",{className:"text-gray-700 font-medium mb-1",children:"No assistants here"}),r.jsx("p",{className:"text-gray-400 text-sm mb-4",children:d==="all"?"Create an assistant and link it to your knowledge bases.":"Move assistants to this library from the main list."}),d==="all"&&r.jsx(wt,{to:yt("AssistantForm"),children:r.jsxs(de,{className:"gap-2",children:[r.jsx(ln,{className:"w-4 h-4"})," Create your first one"]})})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:C.map(A=>{var R;const T=(A.knowledge_base_ids||[]).map(B=>N[B]).filter(Boolean);return r.jsx(KEe,{a:A,linkedKbs:T,libraryName:((R=i.find(B=>B.id===A.library_id))==null?void 0:R.name)||"",onDelete:b,onClone:y,onMove:()=>x(A),onCopyLink:_},A.id)})})]})}),g&&r.jsx(Ub,{itemName:g.name,libraries:i,currentLibraryId:g.library_id||"",onMove:w,onClose:()=>x(null)})]})}function HEe({source:e}){const[t,n]=h.useState(!1);return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>n(!t),className:"flex items-center gap-1 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-600 border border-indigo-100 rounded-full px-2 py-0.5 transition-colors",children:[r.jsx(ao,{className:"w-3 h-3"}),e.item_title||e.kb_name]}),t&&r.jsxs("div",{className:"absolute bottom-full mb-2 left-0 w-64 bg-white border rounded-xl shadow-lg p-3 z-10 text-xs",children:[r.jsx("div",{className:"font-semibold text-gray-700 mb-1",children:e.item_title}),e.kb_name&&r.jsxs("div",{className:"text-gray-400 mb-2",children:["from: ",e.kb_name]}),e.excerpt&&r.jsxs("p",{className:"text-gray-600 italic line-clamp-4",children:['"',e.excerpt,'"']})]})]})}function WEe(){var K;const e=new URLSearchParams(window.location.search),t=e.get("assistant_id"),n=e.get("
969chat_id"),[s,a]=h.useState(null),[i,o]=h.useState([]),[l,c]=h.useState([]),[d,f]=h.useState(n||null),[m,g]=h.useState([]),[x,j]=h.useState(""),[b,y]=h.useState(!1),[w,_]=h.useState(!0),[N,C]=h.useState(!1),[k,S]=h.useState({}),[A,T]=h.useState(!1),[R,B]=h.useState(null),D=h.useRef(null),P=h.useRef(null);h.useEffect(()=>{t&&I()},[t]),h.useEffect(()=>{var M;(M=D.current)==null||M.scrollIntoView({behavior:"smooth"})},[m,b]);async function I(){_(!0);const[M,G,q]=await Promise.all([Y.entities.Assistant.filter({id:t}),Y.entities.KnowledgeBase.list(),Y.auth.me()]),F=M[0];a(F),B(q),o(G.filter(ee=>((F==null?void 0:F.knowledge_base_ids)||[]).includes(ee.id)));const U=await Y.entities.Chat.filter({assistant_id:t},"-started_at",20);if(c(U),n){const ee=U.find(ne=>ne.id===n);ee&&await z(ee.id)}_(!1)}async function z(M){f(M);const G=await Y.entities.Message.filter({chat_id:M});G.sort((q,F)=>q.sent_at>F.sent_at?1:-1),g(G.map(q=>({role:q.role,content:q.content,timestamp:q.sent_at}))),T(!1)}async function L(){f(null),g([])}async function H(){if(!x.trim()||b||!R)return;const M=x.trim();g(U=>[...U,{role:"user",content:M,timestamp:new Date().toISOString()}]),j(""),y(!0);const G=await Y.functions.invoke("invokeAssistant",{assistant_id:t,message:M,user_id:R.id,...d?{chat_id:d}:{}}),{answer:q,chat_id:F}=G.data||{};if(F&&!d){f(F);const U=await Y.entities.Chat.filter({assistant_id:t},"-started_at",20);c(U)}g(U=>[...U,{role:"assistant",content:q||"I could not generate a response.",timestamp:new Date().toISOString()}]),y(!1),setTimeout(()=>{var U;return(U=P.current)==null?void 0:U.focus()},100)}const W=((K=s==null?void 0:s.suggested_prompts)==null?void 0:K.length)>0?s.suggested_prompts:["What topics does the knowledge base cover?","Give me a summary of the available content.","What can you help me with?"],V=(s==null?void 0:s.greeting_message)||`Chat with ${s==null?void 0:s.name}`;return w?r.jsx("div",{className:"flex items-center justify-center h-full py-32",children:r.jsx(Pe,{className:"w-6 h-6 animate-spin text-indigo-500"})}):s?r.jsxs("div",{className:"flex h-full overflow-hidden",children:[r.jsxs("div",{className:"w-64 border-r bg-white flex flex-col shrink-0 hidden md:flex",children:[r.jsxs("div",{className:"p-4 border-b space-y-2",children:[r.jsx(wt,{to:yt("Assistants"),children:r.jsxs(de,{variant:"ghost",size:"sm",className:"gap-1 w-full justify-start",children:[r.jsx(or,{className:"w-4 h-4"})," All Assistants"]})}),r.jsxs(de,{size:"sm",variant:"outline",className:"w-full gap-1",onClick:L,children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," New Chat"]})]}),r.jsxs("div",{className:"p-4 flex-1 overflow-y-auto space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg bg-violet-100 flex items-center justify-center",children:r.jsx(Vn,{className:"w-4 h-4 text-violet-600"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-semibold text-sm text-gray-900",children:s.name}),r.jsx("div",{className:"text-xs text-gray-400",children:"AI Assistant"})]})]}),s.description&&r.jsx("p",{className:"text-xs text-gray-500 leading-relaxed",children:s.description}),r.jsxs("div",{children:[r.jsxs("button",{className:"flex items-center gap-1 text-xs font-semibold text-gray-400 uppercase tracking-wide mb-2 hover:text-gray-600 w-full",onClick:()=>T(!A),children:[r.jsx(Qz,{className:"w-3 h-3"})," Recent Chats",A?r.jsx(gt,{className:"w-3 h-3 ml-auto"}):r.jsx(en,{className:"w-3 h-3 ml-auto"})]}),A&&r.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:l.length===0?r.jsx("p",{className:"text-xs text-gray-300 italic px-1",children:"No saved chats yet"}):l.map(M=>r.jsx("button",{onClick:()=>z(M.id),className:`w-full text-left text-xs rounded-lg px-2 py-1.5 truncate transition-colors ${d===M.id?"bg-indigo-100 text-indigo-700":"hover:bg-gray-100 text-gray-600"}`,children:M.title||"Untitled"},M.id))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide mb-2 flex items-center gap-1",children:[r.jsx(_n,{className:"w-3 h-3"})," Knowledge Bases"]}),i.length===0?r.jsx("p",{className:"text-xs text-gray-300 italic",children:"None linked"}):i.map(M=>r.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 rounded-lg px-3 py-2 mb-1",children:M.name},M.id))]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide mb-2",children:"Session"}),r.jsx("div",{className:"text-xs text-gray-500 space-y-1",children:r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Messages"}),r.jsx("span",{className:"font-medium",children:m.length})]})})]}),r.jsx("div",{className:"pt-2 border-t",children:r.jsxs("button",{onClick:()=>C(!N),className:`flex items-center gap-2 text-xs px-3 py-2 rounded-lg w-full transition-colors ${N?"bg-amber-100 text-amber-700":"text-gray-400 hover:bg-gray-100"}`,children:[r.jsx(Mh,{className:"w-3.5 h-3.5"}),N?"Debug ON":"Debug Mode"]})})]})]}),r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"md:hidden border-b bg-white px-4 py-3 flex items-center gap-3 shrink-0",children:[r.jsx(wt,{to:yt("Assistants"),children:r.jsx(de,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(or,{className:"w-4 h-4"})})}),r.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg bg-violet-100 flex items-center justify-center",children:r.jsx(Vn,{className:"w-3.5 h-3.5 text-violet-600"})}),r.jsx("span",{className:"font-semibold text-sm",children:s.name})]}),r.jsx("button",{onClick:()=>C(!N),className:`p-1.5 rounded-lg transition-colors ${N?"bg-amber-100 text-amber-700":"text-gray-300 hover:text-gray-500"}`,children:r.jsx(Mh,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-6 space-y-5 bg-gray-50",children:[m.length===0&&r.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-center",children:[r.jsx("div",{className:"w-14 h-14 roun
969ded-2xl bg-indigo-100 flex items-center justify-center mb-4",children:r.jsx(Yn,{className:"w-6 h-6 text-indigo-600"})}),r.jsx("h2",{className:"text-lg font-semibold text-gray-800 mb-1",children:V}),r.jsx("p",{className:"text-sm text-gray-400 max-w-sm mb-6",children:i.length>0?`Ready to answer using ${i.length} knowledge base${i.length!==1?"s":""}.`:"No knowledge base linked. I'll answer using my general knowledge."}),r.jsx("div",{className:"space-y-2 w-full max-w-md",children:W.map((M,G)=>r.jsx("button",{onClick:()=>{var q;j(M),(q=P.current)==null||q.focus()},className:"w-full text-left text-sm border rounded-lg px-4 py-3 bg-white hover:bg-indigo-50 hover:border-indigo-200 transition-all text-gray-600",children:M},G))})]}),m.map((M,G)=>r.jsxs("div",{className:`flex gap-3 ${M.role==="user"?"justify-end":"justify-start"}`,children:[M.role==="assistant"&&r.jsx("div",{className:"w-8 h-8 rounded-lg bg-violet-100 flex items-center justify-center shrink-0 mt-1",children:r.jsx(Vn,{className:"w-4 h-4 text-violet-600"})}),r.jsxs("div",{className:"max-w-[80%]",children:[r.jsx("div",{className:`rounded-2xl px-4 py-3 text-sm leading-relaxed ${M.role==="user"?"bg-indigo-600 text-white rounded-tr-sm":"bg-white border shadow-sm text-gray-800 rounded-tl-sm"}`,children:M.role==="assistant"?r.jsx(Ym,{className:"prose prose-sm max-w-none prose-p:my-1 prose-headings:my-2",components:{p:({children:q})=>r.jsx("p",{className:"my-1",children:q})},children:M.content}):M.content}),M.sources&&M.sources.length>0&&r.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:M.sources.map((q,F)=>r.jsx(HEe,{source:q},F))})]}),M.role==="user"&&r.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-100 flex items-center justify-center shrink-0 mt-1",children:r.jsx(Ci,{className:"w-4 h-4 text-indigo-600"})})]},G)),b&&r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg bg-violet-100 flex items-center justify-center shrink-0",children:r.jsx(Vn,{className:"w-4 h-4 text-violet-600"})}),r.jsx("div",{className:"bg-white border shadow-sm rounded-2xl rounded-tl-sm px-4 py-3",children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"w-2 h-2 bg-gray-300 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),r.jsx("div",{className:"w-2 h-2 bg-gray-300 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),r.jsx("div",{className:"w-2 h-2 bg-gray-300 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})]}),r.jsx("div",{ref:D})]}),r.jsx("div",{className:"border-t bg-white px-4 py-4 shrink-0",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex gap-3 items-end border rounded-xl px-4 py-3 bg-white shadow-sm focus-within:border-indigo-400 focus-within:ring-1 focus-within:ring-indigo-100 transition-all",children:[r.jsx("textarea",{ref:P,value:x,onChange:M=>j(M.target.value),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),H())},placeholder:`Message ${s.name}…`,className:"flex-1 resize-none text-sm outline-none bg-transparent min-h-[24px] max-h-32 leading-relaxed placeholder:text-gray-400",rows:1,onInput:M=>{M.target.style.height="auto",M.target.style.height=M.target.scrollHeight+"px"}}),r.jsx(de,{onClick:H,disabled:b||!x.trim(),size:"icon",className:"h-9 w-9 shrink-0 rounded-lg",children:b?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Fd,{className:"w-4 h-4"})})]}),r.jsx("p",{className:"text-xs text-gray-300 text-center mt-2",children:"Enter to send · Shift+Enter for new line"})]})})]})]}):r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Assistant not found."})}function GEe(){const t=new URLSearchParams(window.location.search).get("id"),[n,s]=h.useState(null),[a,i]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState(!0);h.useEffect(()=>{t&&f()},[t]);async function f(){d(!0);const x=(await Y.entities.Chat.filter({id:t}))[0];if(s(x),x!=null&&x.assistant_id){const j=await Y.entities.Assistant.filter({id:x.assistant_id});i(j[0])}if(x){const j=await Y.entities.Message.filter({chat_id:x.id});j.sort((b,y)=>b.sent_at>y.sent_at?1:-1),l(j)}d(!1)}
969function m(g){return g?new Date(g).toLocaleString("pt-BR",{dateStyle:"medium",timeStyle:"short"}):""}return c?r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading..."}):n?r.jsxs("div",{className:"p-6 max-w-3xl mx-auto pb-12",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx(wt,{to:yt(`AssistantSessions?assistant_id=${n.assistant_id}`),children:r.jsxs(de,{variant:"ghost",size:"sm",className:"gap-1",children:[r.jsx(or,{className:"w-4 h-4"})," Sessions"]})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h1",{className:"text-lg font-bold text-gray-900 truncate",children:n.title||"Untitled"}),r.jsxs("p",{className:"text-xs text-gray-400",children:[a==null?void 0:a.name," · ",m(n.started_at)," · ",o.length," messages"]})]}),n.assistant_id&&r.jsx(wt,{to:yt(`Chat?assistant_id=${n.assistant_id}&chat_id=${n.id}`),children:r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 shrink-0",children:[r.jsx(Vn,{className:"w-3.5 h-3.5"})," Continue Chat"]})})]}),o.length===0?r.jsx("div",{className:"text-center py-16 text-gray-400",children:"No messages in this chat."}):r.jsx("div",{className:"space-y-5",children:o.map((g,x)=>r.jsxs("div",{className:`flex gap-3 ${g.role==="user"?"justify-end":"justify-start"}`,children:[g.role==="assistant"&&r.jsx("div",{className:"w-8 h-8 rounded-lg bg-violet-100 flex items-center justify-center shrink-0 mt-1",children:r.jsx(Vn,{className:"w-4 h-4 text-violet-600"})}),r.jsxs("div",{className:"max-w-[85%]",children:[r.jsx("div",{className:`rounded-2xl px-4 py-3 text-sm leading-relaxed ${g.role==="user"?"bg-indigo-600 text-white rounded-tr-sm":"bg-white border shadow-sm text-gray-800 rounded-tl-sm"}`,children:g.role==="assistant"?r.jsx(Ym,{className:"prose prose-sm max-w-none prose-p:my-1 prose-headings:my-2",components:{p:({children:j})=>r.jsx("p",{className:"my-1",children:j})},children:g.content}):g.content}),g.sent_at&&r.jsx("div",{className:`text-xs text-gray-300 mt-1 ${g.role==="user"?"text-right":"text-left"}`,children:m(g.sent_at)})]}),g.role==="user"&&r.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-100 flex items-center justify-center shrink-0 mt-1",children:r.jsx(Ci,{className:"w-4 h-4 text-indigo-600"})})]},x))})]}):r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Chat not found."})}const iB=["bg-indigo-100 text-indigo-700 border-indigo-200","bg-emerald-100 text-emerald-700 border-emerald-200","bg-amber-100 text-amber-700 border-amber-200","bg-vi
969olet-100 text-violet-700 border-violet-200","bg-rose-100 text-rose-700 border-rose-200","bg-cyan-100 text-cyan-700 border-cyan-200","bg-orange-100 text-orange-700 border-orange-200","bg-teal-100 text-teal-700 border-teal-200"];function u5(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return iB[Math.abs(t)%iB.length]}function YEe({chat:e,onTagsChange:t,allTags:n=[]}){const[s,a]=h.useState(e.tags||[]),[i,o]=h.useState(""),[l,c]=h.useState(!1),[d,f]=h.useState(!1),m=h.useRef(null),g=h.useRef(null),x=h.useRef(s);x.current=s;const j=h.useRef(Promise.resolve());h.useEffect(()=>{a(e.tags||[])},[e.tags]),h.useEffect(()=>{if(!l)return;function N(C){g.current&&!g.current.contains(C.target)&&c(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]);function b(N){x.current=N,a(N),f(!0);const C=j.current.catch(()=>{}).then(()=>Y.entities.Chat.update(e.id,{tags:N})).then(()=>t(e.id,N)).catch(k=>{x.current=e.tags||[],a(e.tags||[]),t(e.id,e.tags||[]),console.error("ChatTagEditor save failed",k)}).finally(()=>f(!1));return j.current=C,C}function y(N){const C=N.trim().toLowerCase();if(!C||x.current.includes(C)){o("");return}b([...x.current,C]),o("")}function w(N){b(x.current.filter(C=>C!==N))}const _=n.filter(N=>!s.includes(N)&&N.toLowerCase().includes(i.toLowerCase())).slice(0,8);return r.jsxs("div",{ref:g,className:"relative",children:[r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[s.map(N=>r.jsxs("span",{className:`inline-flex items-center gap-0.5 text-[10px] font-medium px-1.5 py-0.5 rounded-full border ${u5(N)}`,children:[r.jsx(ac,{className:"w-2.5 h-2.5"}),N,r.jsx("button",{onClick:()=>w(N),className:"ml-0.5 hover:opacity-70",children:r.jsx(jt,{className:"w-2.5 h-2.5"})})]},N)),r.jsxs("button",{onClick:()=>{c(N=>!N),setTimeout(()=>{var N;return(N=m.current)==null?void 0:N.focus()},50)},className:"inline-flex items-center gap-0.5 text-[10px] text-gray-400 hover:text-indigo-600 px-1.5 py-0.5 rounded-full border border-dashed border-gray-300 hover:border-indigo-400 transition-colors",children:[r.jsx(ln,{className:"w-2.5 h-2.5"})," tag"]})]}),l&&r.jsxs("div",{className:"absolute top-full left-0 mt-1 z-50 bg-white border border-gray-200 rounded-xl shadow-lg p-2 min-w-[200px]",children:[r.jsx("input",{ref:m,value:i,onChange:N=>o(N.target.value),onKeyDown:N=>{N.key==="Enter"&&(N.preventDefault(),y(i)),N.key==="Escape"&&c(!1)},placeholder:"Type and press Enter…",className:"w-full text-xs border rounded-lg px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-indigo-400 mb-2"}),_.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:_.map(N=>r.jsx("button",{onClick:()=>y(N),className:`text-[10px] font-medium px-2 py-0.5 rounded-full border ${u5(N)} hover:opacity-80`,children:N},N))})]})]})}const JEe=[{label:"Today",key:"today"},{label:"7d",key:"7d"},{label:"30d",key:"30d"},{label:"90d",key:"90d"},{label:"6mo",key:"6mo"},{label:"All",key:"all"},{label:"Custom",key:"custom"}];function QEe(e){const t=new Date;if(e==="today"){const n=new Date;return n.setHours(0,0,0,0),n}return e==="7d"?Mr(t,7):e==="30d"?Mr(t,30):e==="90d"?Mr(t,90):e==="6mo"?PEe(t):null}function Nu({icon:e,value:t,label:n,color:s}){return r.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm px-3 py-3 flex flex-col items-center gap-1.5 text-center",children:[r.jsx("div",{className:`w-8 h-8 rounded-xl flex items-center justify-center shrink-0 ${s}`,children:r.jsx(e,{className:"w-4 h-4"})}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 leading-none",children:t}),r.jsx("div",{className:"text-[10px] text-gray-400 font-medium uppercase tracking-wide leading-tight",children:n})]})}const oB=({active:e,payload:t,label:n})=>!e||!(t!=null&&t.length)?null:r.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-lg px-3 py-2 text-xs",children:[r.jsx("p",{className:"font-semibold text-gray-700 mb-1",children:n}),t.map((s,a)=>r.jsxs("p",{style:{color:s.color},children:[s.name,": ",r.jsx("span",{className:"font-bold",children:s.value})]},a))]});function XEe({chats:e,messages:t,issues:n,allTags:s,activeTab:a,filterTags:i}){const[o,l]=h.useState("30d"),[c,d]=h.useState(""),[f,m]=h.useState(""),[g,x]=h.useState(a??"all"),j=h.useMemo(()=>o==="custom"?c?uo(new Date(c)):null:QEe(o),[o,c]),b=h.useMemo(()=>o==="custom"&&f?uo(new Date(f+"T23:59:59")):null,[o,f]),y=h.useMemo(()=>e.filter(T=>{if(!T.started_at)return!0;const R=new Date(T.started_at);if(j&&R<j||b&&R>b||g!=="all"&&(T.review_status||"no_review")!==g)return!1;if(i&&i.length>0){const B=i.includes("__untagged__"),D=i.filter(L=>L!=="__untagged__"),P=T.tags||[],I=D.length>0&&D.some(L=>P.includes(L)),z=P.length===0;if(!(I||B&&z))return!1}return!0}),[e,j,b,g,i]),w=h.useMemo(()=>new Set(y.map(T=>T.id)),[y]),_=h.useMemo(()=>t.filter(T=>{if(!T.sent_at)return!1;const R=new Date(T.sent_at);return!(j&&R<j||b&&R>b||!w.has(T.chat_id))}),[t,j,b,w]),N=h.useMemo(()=>n.filter(T=>{if(!T.reported_at)return!1;const R=new Date(T.reported_at);return!(j&&R<j||b&&R>b||T.chat_id&&!w.has(T.chat_id))}),[n,j,b,w]),C=h.useMemo(()=>{const T=_.filter(P=>P.feedback==="up").length,R=_.filter(P=>P.feedback==="down").length,B=N.filter(P=>P.issue_type!=="content_suggestion").length,D=N.filter(P=>P.issue_type==="content_suggestion").length;return{chats:y.length,messages:_.length,up:T,down:R,reports:B,suggestions:D}},[y,_,N]),k=h.useMemo(()=>{const T={};
969return y.forEach(R=>(R.tags||[]).forEach(B=>{T[B]=(T[B]||0)+1})),Object.entries(T).sort((R,B)=>B[1]-R[1]).slice(0,15).map(([R,B])=>({tag:R,count:B}))},[y]),S=h.useMemo(()=>{const T={};return y.forEach(R=>{if(!R.started_at)return;const B=R.started_at.slice(0,10);T[B]||(T[B]={date:B,chats:0,messages:0}),T[B].chats++}),_.forEach(R=>{if(!R.sent_at)return;const B=R.sent_at.slice(0,10);T[B]||(T[B]={date:B,chats:0,messages:0}),T[B].messages++}),Object.values(T).sort((R,B)=>R.date.localeCompare(B.date)).map(R=>({...R,date:gs(Jy(R.date),"MMM d")}))},[y,_]),A=h.useMemo(()=>{const T={};return _.forEach(R=>{if(!R.sent_at)return;const B=R.sent_at.slice(0,10);T[B]||(T[B]={date:B,thumbsUp:0,thumbsDown:0,reports:0,suggestions:0}),R.feedback==="up"&&T[B].thumbsUp++,R.feedback==="down"&&T[B].thumbsDown++}),N.forEach(R=>{if(!R.reported_at)return;const B=R.reported_at.slice(0,10);T[B]||(T[B]={date:B,thumbsUp:0,thumbsDown:0,reports:0,suggestions:0}),R.issue_type==="content_suggestion"?T[B].suggestions++:T[B].reports++}),Object.values(T).sort((R,B)=>R.date.localeCompare(B.date)).map(R=>({...R,date:gs(Jy(R.date),"MMM d")}))},[_,N]);return e.length===0?r.jsx("div",{className:"text-center py-10 text-gray-400 text-sm",children:"No conversation data loaded yet."}):r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsx(Lm,{className:"w-4 h-4 text-gray-400 shrink-0"}),r.jsx("div",{className:"flex gap-1 flex-wrap",children:JEe.map(T=>r.jsx("button",{onClick:()=>l(T.key),className:`px-3 py-1 text-xs font-medium rounded-lg border transition-colors ${o===T.key?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300 hover:text-indigo-600"}`,children:T.label},T.key))}),o==="custom"&&r.jsxs("div",{className:"flex items-center gap-2 ml-2",children:[r.jsx("input",{type:"date",value:c,onChange:T=>d(T.target.value),className:"border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("span",{className:"text-xs text-gray-400",children:"to"}),r.jsx("input",{type:"date",value:f,onChange:T=>m(T.target.value),className:"border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400"})]}),r.jsx("div",{className:"flex gap-1 ml-auto",children:[{key:"all",label:"All"},{key:"no_review",label:"No Review"},{key:"under_review",label:"Under Review"},{key:"archived",label:"Archived"}].map(T=>r.jsx("button",{onClick:()=>x(T.key),className:`px-3 py-1 text-xs font-medium rounded-lg border transition-colors ${g===T.key?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300 hover:text-indigo-600"}`,children:T.label},T.key))})]}),r.jsxs("div",{className:"grid grid-cols-3 md:grid-cols-6 gap-3",children:[r.jsx(Nu,{icon:Br,value:C.chats,label:"Conversations",color:"bg-indigo-50 text-indigo-600"}),r.jsx(Nu,{icon:Br,value:C.messages,label:"Messages",color:"bg-blue-50 text-blue-600"}),r.jsx(Nu,{icon:qo,value:C.up,label:"Thumbs Up",color:"bg-emerald-50 text-emerald-600"}),r.jsx(Nu,{icon:hc,value:C.down,label:"Thumbs Down",color:"bg-red-50 text-red-500"}),r.jsx(Nu,{icon:Nr,value:C.reports,label:"Reports",color:"bg-amber-50 text-amber-600"}),r.jsx(Nu,{icon:Zo,value:C.suggestions,label:"Suggestions",color:"bg-violet-50 text-violet-600"})]}),k.length>0&&r.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-5",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(ac,{className:"w-4 h-4 text-indigo-600"}),r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:"Conversations by Tag"})]}),r.jsx(Zl,{width:"100%",height:160,children:r.jsxs(Od,{data:k,layout:"vertical",margin:{top:0,right:36,left:0,bottom:0},children:[r.jsx(Qa,{type:"number",tick:{fontSize:10},tickLine:!1,axisLine:!1,allowDecimals:!1}),r.jsx(Xa,{type:"category",dataKey:"tag",tick:{fontSize:11},tickLine:!1,axisLine:!1,width:90}),r.jsx(us,{contentStyle:{fontSize:11,borderRadius:8},formatter:T=>[T,"Conversations"]}),r.jsxs(Cs,{dataKey:"count",radius:[0,3,3,0],name:"Conversations",children:[r.jsx(Uo,{dataKey:"count",position:"right",style:{fontSize:10,fill:"#6b7280",fontWeight:600}}),k.map(T=>{const R=u5(T.tag),B={"text-indigo-700":"#6366f1","text-emerald-700":"#10b981","text-amber-700":"#f59e0b","text-violet-700":"#8b5cf6","text-rose-700":"#f43f5e","text-cyan-700":"#06b6d4","text-orange-700":"#f97316","text-teal-700":"#14b8a6"},D=R.split(" ").find(P=>P.startsWith("text-"));return r.jsx(mg,{fill:B[D]||"#6366f1"},T.tag)})]})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-5",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(o7,{className:"w-4 h-4 text-indigo-600"}),r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:"Activity Over Time"})]}),S.length===0?r.jsx("p",{className:"text-xs text-gray-400 py-8 text-center",children:"No data"}):r.jsx(Zl,{width:"100%",height:200,children:r.jsxs(l5e,{data:S,margin:{top:2,right:10,left:-20,bottom:0},children:[r.jsx(Qa,{dataKey:"date",tick:{fontSize:10}
969,tickLine:!1,axisLine:!1}),r.jsx(Xa,{tick:{fontSize:10},tickLine:!1,axisLine:!1}),r.jsx(us,{content:r.jsx(oB,{})}),r.jsx(Xl,{iconSize:8,wrapperStyle:{fontSize:10}}),r.jsx(km,{type:"monotone",dataKey:"chats",stroke:"#6366f1",strokeWidth:2,dot:!1,name:"Chats"}),r.jsx(km,{type:"monotone",dataKey:"messages",stroke:"#06b6d4",strokeWidth:2,dot:!1,name:"Messages"})]})})]}),r.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-5",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(qo,{className:"w-4 h-4 text-emerald-600"}),r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:"Feedback & Reports Over Time"})]}),A.length===0?r.jsx("p",{className:"text-xs text-gray-400 py-8 text-center",children:"No data"}):r.jsx(Zl,{width:"100%",height:200,children:r.jsxs(Od,{data:A,margin:{top:2,right:10,left:-20,bottom:0},children:[r.jsx(Qa,{dataKey:"date",tick:{fontSize:10},tickLine:!1,axisLine:!1}),r.jsx(Xa,{tick:{fontSize:10},tickLine:!1,axisLine:!1}),r.jsx(us,{content:r.jsx(oB,{})}),r.jsx(Xl,{iconSize:8,wrapperStyle:{fontSize:10}}),r.jsx(Cs,{dataKey:"thumbsUp",fill:"#10b981",name:"👍 Up",radius:[2,2,0,0]}),r.jsx(Cs,{dataKey:"thumbsDown",fill:"#ef4444",name:"👎 Down",radius:[2,2,0,0]}),r.jsx(Cs,{dataKey:"reports",fill:"#f59e0b",name:"⚠ Reports",radius:[2,2,0,0]}),r.jsx(Cs,{dataKey:"suggestions",fill:"#8b5cf6",name:"💡 Suggestions",radius:[2,2,0,0]})]})})]})]})]})}const ZEe="conversations_analyst";function eAe({filterAssistantIds:e,assistants:t,filterTags:n,activeTab:s,search:a,limit:i,filtered:o}){const l=[];return l.push("[CURRENT PAGE CONTEXT]"),l.push("Filters:"),e.length===0?l.push("- Assistants: All"):l.push(`- Assistants: ${e.map(c=>{var d;return((d=t.find(f=>f.id===c))==null?void 0:d.name)||c}).join(", ")}`),!n||n.length===0?l.push("- Tag filter: All tags"):l.push(`- Tag filter: ${n.map(c=>c==="__untagged__"?"Untagged":c).join(", ")}`),l.push(`- Review status tab: ${s}`),a&&l.push(`- Search: "${a}"`),l.push(`- Loaded limit: ${i}`),l.push(`- Conversations currently shown: ${o.length}`),l.push(""),l.push("Visible conversations (title | assistant | tags | review | started):"),o.slice(0,60).forEach((c,d)=>{var x;const f=((x=t.find(j=>j.id===c.assistant_id))==null?void 0:x.name)||"",m=(c.tags||[]).join(",")||"-",g=c.started_at?gs(new Date(c.started_at),"MMM d yyyy"):"";l.push(`${d+1}. ${c.title||"(Untitled)"} | ${f} | tags:${m} | ${c.review_status||"no_review"} | ${g} | id:${c.id}`)}),o.length>60&&l.push(`... and ${o.length-60} more (use the Chat entity read tool with these ids to inspect them).`),l.join(`
970`)}function tAe({message:e}){var n;const t=e.role==="user";return r.jsxs("div",{className:`flex gap-2 ${t?"flex-row-reverse":"flex-row"}`,children:[r.jsx("div",{className:`w-7 h-7 rounded-lg flex items-center justify-center shrink-0 ${t?"bg-indigo-100 text-indigo-600":"bg-emerald-100 text-emerald-600"}`,children:t?r.jsx(Ci,{className:"w-3.5 h-3.5"}):r.jsx(Vn,{className:"w-3.5 h-3.5"})}),r.jsxs("div",{className:`max-w-[85%] rounded-2xl px-3 py-2 text-sm ${t?"bg-indigo-600 text-white":"bg-gray-100 text-gray-800"}`,children:[t?r.jsx("p",{className:"whitespace-pre-wrap",children:e.content}):r.jsx(Ym,{className:"prose prose-sm max-w-none",children:e.content||""}),(n=e.tool_calls)==null?void 0:n.map((s,a)=>r.jsxs("div",{className:"mt-1.5 text-[10px] flex items-center gap-1 opacity-70",children:[r.jsxs("span",{className:"font-mono",children:["🔧 ",s.name]}),r.jsx("span",{children:s.status})]},a))]})]})}function nAe({open:e,onClose:t,contextState:n}){const[s,a]=h.useState(null),[i,o]=h.useState([]),[l,c]=h.useState(""),[d,f]=h.useState(!1),[m,g]=h.useState(!1),x=h.useRef(null),j=h.useRef(n);j.current=n,h.useEffect(()=>{!e||s||(g(!0),Y.agents.createConversation({agent_name:ZEe,metadata:{name:"Conversations Analysis"}}).then(w=>{a(w),o(w.messages||[])}).catch(()=>{}).finally(()=>g(!1)))},[e,s]),h.useEffect(()=>{if(!(s!=null&&s.id))return;const w=Y.agents.subscribeToConversation(s.id,_=>{o(_.messages||[])});return()=>w()},[s==null?void 0:s.id]),h.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i]);const b=h.useCallback(async()=>
970{if(!l.trim()||!s||d)return;const w=l.trim(),N=`${eAe(j.current)}
971
972[USER REQUEST]
973${w}`;c(""),f(!0);try{await Y.agents.addMessage(s,{role:"user",content:N})}catch{}finally{f(!1)}},[l,s,d]);function y(){a(null),o([])}return e?r.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/30",onClick:t,children:r.jsxs("div",{className:"bg-white w-full max-w-md h-full flex flex-col shadow-2xl",onClick:w=>w.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b bg-gradient-to-r from-indigo-50 to-emerald-50",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-indigo-600 flex items-center justify-center",children:r.jsx(Yn,{className:"w-4 h-4 text-white"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-sm text-gray-800",children:"Conversations Analyst"}),r.jsx("p",{className:"text-[10px] text-gray-500",children:"Aware of current filters · can tag & summarize"})]}),r.jsx("button",{onClick:y,title:"New conversation",className:"p-1.5 text-gray-400 hover:text-indigo-600 hover:bg-white rounded-lg transition-colors",children:r.jsx(Rn,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:t,className:"p-1.5 text-gray-400 hover:text-gray-600 hover:bg-white rounded-lg transition-colors",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{ref:x,className:"flex-1 overflow-y-auto p-3 space-y-3 bg-gray-50",children:[m&&r.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-gray-400 text-sm",children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," Starting conversation…"]}),!m&&i.length===0&&r.jsxs("div",{className:"text-center py-8 px-4",children:[r.jsx(Br,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),r.jsx("p",{className:"text-sm text-gray-500 mb-2",children:"Ask the analyst to organize, tag, or summarize the conversations currently shown."}),r.jsx("div",{className:"flex flex-col gap-1.5 mt-3",children:["Summarize the main themes across these conversations","Suggest a tagging strategy and propose tags","Which conversations need review first?"].map(w=>r.jsx("button",{onClick:()=>c(w),className:"text-xs text-left px-3 py-2 rounded-lg border border-gray-200 bg-white hover:border-indigo-300 hover:text-indigo-600 transition-colors",children:w},w))})]}),i.map((w,_)=>r.jsx(tAe,{message:w},_)),d&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 pl-9",children:[r.jsx(Pe,{className:"w-3 h-3 animate-spin"})," Analyst is thinking…"]})]}),r.jsx("div",{className:"border-t p-3 bg-white",children:r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsx("textarea",{value:l,onChange:w=>c(w.target.value),onKeyDown:w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),b())},rows:2,placeholder:"Ask the analyst…",className:"flex-1 border rounded-xl px-3 py-2 text-sm resize-none focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("button",{onClick:b,disabled:!l.trim()||d||!s,className:"w-9 h-9 rounded-xl bg-indigo-600 text-white flex items-center justify-center hover:bg-indigo-700 disabled:opacity-50 transition-colors shrink-0",children:d?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Fd,{className:"w-4 h-4"})})]})})]})}):null}function Xy(e,t){const n=e.find(s=>s.id===t);return n?n.name:t?"(unknown assistant)":"(no assistant)"}function kV({filterAssistantIds:e,assistants:t,filterTags:n,activeTab:s,search:a,limit:i,allTags:o}){const l=[];if(l.push("=== FILTERS APPLIED ==="),e.length===0?l.push("Assistants: All"):l.push(`Assistants (${e.length}): ${e.map(c=>Xy(t,c)).join(", ")}`),!n||n.length===0)l.push("Tag filter: All tags");else{const c=n.map(d=>d==="__untagged__"?"Untagged":d);l.push(`Tag filter (${n.length}): ${c.join(", ")}`)}return l.push(`Review status tab: ${s}`),a&&l.push(`Search query: "${a}"`),l.push(`Loaded limit: ${i} chats`),l.join(`
974`)}function rAe({chats:e,filtered:t,assistants:n,filterAssistantIds:s,filterTags:a,activeTab:i,search:o,limit:l,allTags:c,messages:d,issues:f}){const m=gs(new Date,"MMM d, yyyy HH:mm"),g=[];g.push("CONVERSATIONS — SUMMARY REPORT"),g.push(`Generated: ${m}`),g.push(""),g.push(kV({filterAssistantIds:s,assistants:n,filterTags:a,activeTab:i,search:o,limit:l,allTags:c})),g.push(""),g.push("=== OVERVIEW ==="),g.push(`Total loaded: ${e.length}`),g.push(`Currently shown (after filters + tab): ${t.length}`),g.push(""),g.push("=== BY REVIEW STATUS ==="),["no_review","under_review","archived"].forEach(_=>{const N=e.filter(C=>(C.review_status||"no_review")===_).length;g.push(`  ${_}: ${N}`)}),g.push(""),g.push("=== BY ASSISTANT ===");const j={};e.forEach(_=>{const N=Xy(n,_.assistant_id);j[N]=(j[N]||0)+1}
974),Object.entries(j).sort((_,N)=>N[1]-_[1]).forEach(([_,N])=>g.push(`  ${_}: ${N}`)),g.push(""),g.push("=== BY TAG ===");const b={};let y=0;if(e.forEach(_=>{if(!_.tags||_.tags.length===0){y++;return}_.tags.forEach(N=>{b[N]=(b[N]||0)+1})}),Object.entries(b).sort((_,N)=>N[1]-_[1]).forEach(([_,N])=>g.push(`  ${_}: ${N}`)),y>0&&g.push(`  (untagged): ${y}`),g.push(""),d&&d.length){const _=new Set(e.map(S=>S.id)),N=d.filter(S=>_.has(S.chat_id)),C=N.filter(S=>S.feedback==="up").length,k=N.filter(S=>S.feedback==="down").length;g.push("=== MESSAGE ACTIVITY (loaded chats) ==="),g.push(`Messages: ${N.length}`),g.push(`Thumbs up: ${C}`),g.push(`Thumbs down: ${k}`),g.push("")}if(f&&f.length){const _=new Set(e.map(S=>S.id)),N=f.filter(S=>_.has(S.chat_id)),C=N.filter(S=>S.issue_type!=="content_suggestion").length,k=N.filter(S=>S.issue_type==="content_suggestion").length;g.push("=== ISSUE REPORTS (loaded chats) ==="),g.push(`Answer-quality reports: ${C}`),g.push(`Content suggestions: ${k}`),g.push("")}const w=e.map(_=>_.started_at).filter(Boolean).sort();return w.length&&(g.push("=== DATE RANGE ==="),g.push(`Earliest: ${gs(new Date(w[0]),"MMM d, yyyy HH:mm")}`),g.push(`Latest: ${gs(new Date(w[w.length-1]),"MMM d, yyyy HH:mm")}`),g.push("")),g.push("=== SHOWN CONVERSATIONS (titles) ==="),t.forEach((_,N)=>{g.push(`${N+1}. ${_.title||"Untitled"} — ${Xy(n,_.assistant_id)} — ${(_.tags||[]).join(", ")||"(no tags)"}`)}),g.join(`
975`)}function sAe({chats:e,filtered:t,assistants:n,shells:s,filterAssistantIds:a,filterTags:i,activeTab:o,search:l,limit:c,allTags:d,messages:f,issues:m}){const g=gs(new Date,"MMM d, yyyy HH:mm"),x=[];x.push("CONVERSATIONS — FULL DATA EXPORT"),x.push(`Generated: ${g}`),x.push(""),x.push(kV({filterAssistantIds:a,assistants:n,filterTags:i,activeTab:o,search:l,limit:c,allTags:d})),x.push(""),x.push(`=== ${t.length} CONVERSATIONS ===`),x.push("");const j={};f&&f.length&&f.forEach(y=>{var w;y.chat_id&&(j[w=y.chat_id]||(j[w]=[])).push(y)});const b={};return m&&m.length&&m.forEach(y=>{var w;y.chat_id&&(b[w=y.chat_id]||(b[w]=[])).push(y)}),t.forEach((y,w)=>{x.push(`--- #${w+1} ---`),x.push(`Title: ${y.title||"(Untitled)"}`),x.push(`ID: ${y.id}`),x.push(`Assistant: ${Xy(n,y.assistant_id)}`);const _=s.find(k=>k.id===y.root_shell_id);_&&x.push(`Root shell: ${_.name}`),x.push(`Type: ${y.conversation_type||""}`),x.push(`Started: ${y.started_at?gs(new Date(y.started_at),"MMM d, yyyy HH:mm"):""}`),x.push(`User email: ${y.user_email||""}`),x.push(`Review status: ${y.review_status||"no_review"}`),y.review_notes&&x.push(`Review notes: ${y.review_notes}`),x.push(`Tags: ${(y.tags||[]).join(", ")||"(none)"}`),x.push(`IP: ${y.ip_address||""}
975`),x.push(`Location: ${[y.city,y.region,y.country].filter(Boolean).join(", ")||""}`),y.org&&x.push(`Org: ${y.org}`),x.push(`Browser/OS: ${[y.browser,y.os].filter(Boolean).join(" / ")}`),y.device&&x.push(`Device: ${y.device}`),y.language&&x.push(`Language: ${y.language}`),y.page_url&&x.push(`Page URL: ${y.page_url}`),y.referrer_url&&x.push(`Referrer URL: ${y.referrer_url}`),y.gated_cookie&&x.push(`Gated cookie: ${y.gated_cookie}`),y.guide_cookie&&x.push(`Guide cookie: ${y.guide_cookie}`),y.wp_user_id&&x.push(`WP user ID: ${y.wp_user_id}`),y.wp_user_email&&x.push(`WP user email: ${y.wp_user_email}`),y.link_clicks&&Object.keys(y.link_clicks).length&&(x.push("Link clicks:"),Object.entries(y.link_clicks).forEach(([k,S])=>x.push(`  - ${k}: ${S}`)));const N=j[y.id]||[];N.length&&(x.push(`Messages (${N.length}):`),N.forEach((k,S)=>{const A=k.role||"?",T=k.feedback?` [${k.feedback}]`:"",R=k.sent_at?gs(new Date(k.sent_at),"MMM d HH:mm"):"",B=(k.content||"").replace(/\n/g,`
976    `);x.push(`  ${S+1}. [${A}] ${R}${T}`),x.push(`     ${B}`)}));const C=b[y.id]||[];C.length&&(x.push(`Issue reports (${C.length}):`),C.forEach((k,S)=>{x.push(`  ${S+1}. [${k.issue_type||"answer_quality"}] ${k.reporter_name||""}`),k.query&&x.push(`     Query: ${k.query}`),k.comments&&x.push(`     Comments: ${k.comments}`),k.expected_answer&&x.push(`     Expected: ${k.expected_answer}`)})),x.push("")}),x.join(`
977`)}const CV="conv_explorer_filter",aAe={Test:"bg-amber-50 text-amber-700 border-amber-200",Investigation:"bg-violet-50 text-violet-700 border-violet-200",Knowledge:"bg-indigo-50 text-indigo-700 border-indigo-200","Learning Assistant":"bg-emerald-50 text-emerald-700 border-emerald-200"},Cp=[{key:"no_review",label:"No Review",icon:ns,color:"text-gray-500",bg:"bg-gray-100"},{key:"under_review",label:"Under Review",icon:Ts,color:"text-amber-600",bg:"bg-amber-50"},{key:"archived",label:"Archived",icon:Ih,color:"text-slate-500",bg:"bg-slate-100"}];function iAe({status:e}){const t=Cp.find(s=>s.key===e)||Cp[0],n=t.icon;return r.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] font-medium px-2 py-0.5 rounded-full ${t.bg} ${t.color}`,children:[r.jsx(n,{className:"w-3 h-3"}),t.label]})}function oAe({chat:e,assistants:t,shells:n,onDelete:s,onRename:a,onStatusChange:i,onNotesChange:o,onTagsChange:l,selected:c,onSelect:d,reporterName:f,allTags:m,ignoredIps:g,addIp:x,removeIp:j}){const[b,y]=h.useState(!1),[w,_]=h.useState(e.title||""),[N,C]=h.useState(!1),[k,S]=h.useState(null),[A,T]=h.useState(!1),[R,B]=h.useState(e.review_notes||""),[D,P]=h.useState(!1),I=h.useRef(!1),z=h.useRef(null),L=t.find(q=>q.id===e.assistant_id),H=n.find(q=>q.id===e.root_shell_id),W=e.review_status||"no_review";h.useEffect(()=>{const q=z.current;if(!q)return;const F=new IntersectionObserver(([U])=>{!U.isIntersecting||I.current||(I.current=!0,F.disconnect(),Promise.all([Y.entities.Message.filter({chat_id:e.id}),Y.entities.IssueReport.filter({chat_id:e.id})]).then(([ee,ne])=>{S({msgCount:ee.length,issueCount:ne.length,thumbsUp:ee.filter(X=>X.feedback==="up").length,thumbsDown:ee.filter(X=>X.feedback==="down").length})}).catch(()=>S({msgCount:0,issueCount:0,thumbsUp:0,thumbsDown:0})))},{threshold:.1});return F.observe(q),()=>F.disconnect()},[e.id]);async function V(q){q.stopPropagation(),w.trim()&&(await Y.entities.Chat.update(e.id,{title:w.trim()}),a(e.id,w.trim()),y(!1))}async function K(q){if(q.stopPropagation(),!confirm(`Delete "${e.title||"Untitled"}" and all its messages?`))return;C(!0);const F=await Y.entities.Message.filter({chat_id:e.id});for(let U=0;U<F.length;U+=5)await Promise.all(F.slice(U,U+5).map(ee=>Y.entities.Message.delete(ee.id)));await Y.entities.Chat.delete(e.id),s(e.id)}async function M(q){await Y.entities.Chat.update(e.id,{review_status:q}),i(e.id,q)}async function G(){P(!0),await Y.entities.Chat.update(e.id,{review_notes:R}),o(e.id,R),P(!1),T(!1)}return r.jsx("div",{ref:z,className:`border rounded-2xl bg-white mb-3 shadow-sm hover:shadow-md transition-all ${c?"ring-2 ring-indigo-400 border-indigo-300":""}`,children:r.jsxs("div",{className:"w-full flex items-start gap-3 px-5 py-4",children:[r.jsx("input",{type:"checkbox",checked:c,onChange:q=>d(e.id,q.target.checked),className:"mt-1.5 shrink-0 accent-indigo-600 w-4 h-4 cursor-pointer",onClick:q=>q.stopPropagation()}),r.jsx("div",{className:"w-11 h-11 rounded-xl bg-indigo-50 border border-indigo-100 flex items-center justify-center shrink-0 overflow-hidden mt-0.5",children:L!=null&&L.icon_url?r.jsx("img",{src:L.icon_url,alt:"",className:"w-full h-full object-contain"}):H?r.jsx(Sa,{className:"w-5 h-5 text-indigo-400"}):r.jsx(Vn,{className:"w-5 h-5 text-indigo-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[b?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("input",{autoFocus:!0,value:w,onChange:q=>_(q.target.value),onKeyDown:q=>{q.key==="Enter"&&V(q),q.key==="Escape"&&y(!1)},className:"border rounded px-2 py-0.5 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("button",{onClick:V,className:"p-1 text-emerald-600 hover:text-emerald-800",children:r.jsx(Tn,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:q=>{q.stopPropagation(),y(!1)},className:"p-1 text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-3.5 h-3.5"})})]}):r.jsx("span",{className:"font-semibold text-sm text-gray-900 truncate",children:e.title||"Untitled"}),H&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] bg-indigo-50 text-indigo-700 border border-indigo-100 rounded-full px-2 py-0.5 
977shrink-0",children:[r.jsx(Sa,{className:"w-3 h-3"}),H.name]}),L&&r.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] border rounded-full px-2 py-0.5 shrink-0 ${aAe[L.type]||"bg-gray-50 text-gray-600 border-gray-200"}`,children:[r.jsx(Vn,{className:"w-3 h-3"}),L.name]}),r.jsx(iAe,{status:W})]}),r.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-gray-400 mb-1.5",children:[(f||e.user_email)&&r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(Ci,{className:"w-3 h-3"}),f||e.user_email]}),e.started_at&&r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(ni,{className:"w-3 h-3"}),gs(new Date(e.started_at),"MMM d, yyyy HH:mm")]}),e.conversation_type&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-gray-400",children:[r.jsx(Yp,{className:"w-3 h-3"}),e.conversation_type]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-[11px] text-gray-400 mb-2",children:[r.jsx("span",{className:"inline-flex items-center gap-1 font-mono bg-gray-50 border border-gray-100 rounded px-1.5 py-0.5",children:e.ip_address?r.jsxs(r.Fragment,{children:[e.ip_address,r.jsx($A,{ip:e.ip_address,ignoredIps:g,addIp:x,removeIp:j})]}):r.jsx("span",{className:"italic text-gray-300",children:"unknown IP"})}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(Na,{className:"w-3 h-3"}),e.city||e.country?[e.city,e.country].filter(Boolean).join(", "):r.jsx("span",{className:"italic text-gray-300",children:"unknown location"})]}),e.org?r.jsx("span",{className:"inline-flex items-center gap-1 truncate max-w-[180px]",title:e.org,children:e.org}):null,r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(Gee,{className:"w-3 h-3"}),e.browser||e.os?[e.browser,e.os].filter(Boolean).join(" / "):r.jsx("span",{className:"italic text-gray-300",children:"unknown browser"})]}),e.device&&r.jsx("span",{className:"capitalize",children:e.device}),e.language&&r.jsx("span",{children:e.language})]}),r.jsxs("div",{className:"flex items-center gap-3 flex-wrap text-[11px] text-gray-400 mb-1.5",children:[e.wp_user_email?r.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-700",children:["👤 ",e.wp_user_email]}):e.wp_user_id?r.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-600 font-mono",children:["👤 ID: ",e.wp_user_id]}):r.jsx("span",{className:"inline-flex items-center gap-1 italic text-gray-300",children:"not identified"}),r.jsx("span",{className:"text-gray-200",children:"·"}),e.page_url?r.jsx("a",{href:e.page_url,target:"_blank",rel:"noopener noreferrer",title:e.page_url,className:"inline-flex items-center gap-1 text-indigo-500 hover:underline truncate max-w-[200px]",children:(()=>{try{return new URL(e.page_url).pathname}catch{return e.page_url}})()}):r.jsx("span",{className:"italic text-gray-300",children:"no page_url"}),r.jsx("span",{className:"text-gray-200",children:"·"}),e.gated_cookie?r.jsxs("span",{className:"text-purple-600",children:["🔒 ",e.gated_cookie]}):r.jsx("span",{className:"italic text-gray-300",children:"no gated cookie"}),r.jsx("span",{className:"text-gray-200",children:"·"}),e.guide_cookie?r.jsxs("span",{className:"text-blue-600",children:["📘 ",e.guide_cookie]}):r.jsx("span",{className:"italic text-gray-300",children:"no guide cookie"}),e.referrer_url&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-gray-200",children:"·"}),r.jsx("span",{className:"italic text-gray-400",children:"ref:"}),r.jsx("a",{href:e.referrer_url,target:"_blank",rel:"noopener noreferrer",title:e.referrer_url,className:"inline-flex items-center gap-1 text-gray-400 hover:underline truncate max-w-[200px]",children:(()=>{try{const q=new URL(e.referrer_url);return q.hostname+q.pathname}catch{return e.referrer_url}})()})]})]}),r.jsx("div",{className:"flex items-center gap-2 flex-wrap min-h-[28px]",children:k===null?r.jsxs("span",{className:"text-[11px] text-gray-300 flex items-center gap-1",children:[r.jsx(Pe,{className:"w-3 h-3 animate-spin"})," loading stats…"]}):r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"inline-flex items-center gap-1 bg-indigo-50 text-indigo-600 border border-indigo-100 rounded-lg px-2.5 py-1 text-[12px] font-medium",children:[r.jsx(Br,{className:"w-3.5 h-3.5"})," ",k.msgCount," messages"]}
977),k.issueCount>0&&r.jsxs("span",{className:"inline-flex items-center gap-1 bg-amber-50 text-amber-700 border border-amber-200 rounded-lg px-2.5 py-1 text-[12px] font-medium",children:[r.jsx(Nr,{className:"w-3.5 h-3.5"})," ",k.issueCount," issue",k.issueCount>1?"s":""]}),k.thumbsUp>0&&r.jsxs("span",{className:"inline-flex items-center gap-1 bg-emerald-50 text-emerald-700 border border-emerald-100 rounded-lg px-2.5 py-1 text-[12px] font-medium",children:[r.jsx(qo,{className:"w-3.5 h-3.5"})," ",k.thumbsUp]}),k.thumbsDown>0&&r.jsxs("span",{className:"inline-flex items-center gap-1 bg-red-50 text-red-600 border border-red-100 rounded-lg px-2.5 py-1 text-[12px] font-medium",children:[r.jsx(hc,{className:"w-3.5 h-3.5"})," ",k.thumbsDown]})]})}),r.jsx("div",{className:"mt-2",children:r.jsx(YEe,{chat:e,onTagsChange:l,allTags:m})}),e.link_clicks&&Object.keys(e.link_clicks).length>0&&r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:Object.entries(e.link_clicks).map(([q,F])=>{let U=q;try{U=new URL(q).pathname||q}catch{}return r.jsxs("a",{href:q,target:"_blank",rel:"noopener noreferrer",title:q,className:"inline-flex items-center gap-1 text-[10px] font-medium px-2 py-0.5 rounded-full bg-sky-50 text-sky-700 border border-sky-200 hover:bg-sky-100 transition-colors",children:[r.jsx(yr,{className:"w-2.5 h-2.5"}),r.jsx("span",{className:"max-w-[140px] truncate",children:U}),r.jsx("span",{className:"bg-sky-200 text-sky-800 rounded-full px-1 font-bold",children:F})]},q)})}),e.review_notes&&!A&&r.jsxs("div",{className:"mt-2 text-[11px] text-amber-700 bg-amber-50 border border-amber-100 rounded-lg px-3 py-1.5 flex items-start gap-1.5",children:[r.jsx(ns,{className:"w-3 h-3 mt-0.5 shrink-0"}),r.jsx("span",{className:"line-clamp-2",children:e.review_notes})]}),A&&r.jsxs("div",{className:"mt-2 flex flex-col gap-1.5",children:[r.jsx("textarea",{autoFocus:!0,value:R,onChange:q=>B(q.target.value),rows:3,className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-none",placeholder:"Add review notes…"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:G,disabled:D,className:"flex items-center gap-1 text-xs bg-indigo-600 text-white px-3 py-1 rounded-lg hover:bg-indigo-700 disabled:opacity-60",children:[D?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Tn,{className:"w-3 h-3"})," Save"]}),r.jsx("button",{onClick:()=>{T(!1),B(e.review_notes||"")},className:"text-xs text-gray-500 px-3 py-1 rounded-lg hover:bg-gray-100",children:"Cancel"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0 ml-1",children:[r.jsx(wt,{to:yt(`ChatMessages?id=${e.id}`),children:r.jsxs("button",{className:"flex items-center gap-1.5 text-[12px] font-medium text-indigo-600 hover:text-indigo-800 border border-indigo-200 hover:border-indigo-400 bg-indigo-50 hover:bg-indigo-100 rounded-lg px-3 py-2 transition-colors",children:[r.jsx(yr,{className:"w-3.5 h-3.5"})," View"]})}),r.jsx("select",{value:W,onChange:q=>M(q.target.value),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 cursor-pointer text-gray-600",children:Cp.map(q=>r.jsx("option",{value:q.key,children:q.label},q.key))}),r.jsx("button",{onClick:()=>{B(e.review_notes||""),T(q=>!q)},className:`p-2 rounded-lg transition-colors ${e.review_notes?"text-amber-500 hover:text-amber-700 hover:bg-amber-50":"text-gray-400 hover:text-indigo-600 hover:bg-indigo-50"}`,title:"Review notes",children:r.jsx(ns,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:q=>{q.stopPropagation(),_(e.title||""),y(!0)},className:"p-2 text-gray-400 hover:text-indigo-600 rounded-lg hover:bg-indigo-50 transition-colors",title:"Rename",children:r.jsx(ra,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:K,disabled:N,className:"p-2 text-gray-400 hover:text-red-600 rounded-lg hover:bg-red-50 transition-colors",title:"Delete",children:N?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(un,{className:"w-3.5 h-3.5"})})]})]})})}function lB(){try{return JSON.parse(localStorage.getItem(CV)||"{}")}catch{return{}}}function lAe(){var sn;const e=lB(),[t,n]=h.useState([]),[s,a]=h.useState([]),[i,o]=h.useState([]),[l,c]=h.useState([]),[d,f]=h.useState([]),[m,g]=h.useState(e.search??""),[x,j]=h.useState(e.filterAssistantIds??[]),[b,y]=h.useState(!1),w=h.useRef(null),[_,N]=h.useState(e.limit??200),[C,k]=h.useState(e.activeTab??"no_review"),[S,A]=h.useState(e.showDashboard??!0),[T,R]=h.useState(e.filterTags??(e.filterTag?[e.filterTag]:[])),[B,D]=h.useState(!1),P=h.useRef(null),[I,z]=h.useState(!1),[L,H]=h.useState(!1),[W,V]=h.useState(!1),[K,M]=h.useState(!1),[G,q]=h.useState(new Set),[F,U]=h.useState(!1),[ee,ne]=h.useState({}),{ignoredIps:X,addIp:ie,removeIp:Z}=jv(),[ce,le]=h.useState({open:!1,text:"",title:"",filename:"",loading:!1}),[re,Ue]=h.useState(!1);function Ne(){le({open:!0,text:"",title:"Summary Report",filename:`conversations_summary_${Qy()}.txt`,loading:!0}),setTimeout(()=>{const we=rAe({chats:t,filtered:Le,assistants:s,filterAssistantIds:x,filterTags:T,activeTab:C,search:m,limit:_,allTags:me,messages:l,issues:d});le(Qe=>({...Qe,text:we,loading:!1}))},30)}function Oe(){le({open:!0,text:"",title:"Full Data Export",filename:`conversations_data_${Qy()}.txt`,loading:!0}),setTimeout(()=>{const we=sAe({chats:t,filtered:Le,assistants:s,shells:i,filterAssistantIds:x,filterTags:T,activeTab:C,search:m,limit:_,allTags:me,messages:l,issues:d});le(Qe=>({...Qe,text:we,loading:!1}))},30)}h.useEffect(()=>{function we(Qe){w.current&&!w.current.contains(Qe.target)&&y(!1),P.current&&!P.current.contains(Qe.target)&&D(!1)}return document.addEventListener("mousedown",we),()=>document.removeEventListener("mousedown",we)},[]),h.useEffect(()=>{localStorage.setItem(CV,JSON.stringify({filterAssistantIds:x,limit:_,activeTab:C,showDashboard:S,search:m,filterTags:T}))},[x,_,C,S,m,T]);const Me=h.useCallback(async(we,Qe)=>{const it=Qe??_;z(!0),n([]),c([]),f([]),q(new Set),M(!1);const Gt=(await Y.entities.Chat.filter({},"-started_at",it)).filter(Cn=>Cn.review_status!=="archived");n(Gt),H(!0),z(!1)},[_]),ue=h.useCallback(async()=>{const[we,Qe]=await Promise.all([Y.entities.Message.list("-created_date",2e3),Y.entities.IssueReport.list("-created_date",1e3)]);c(we),f(Qe);const it={};Qe.forEach(at=>{at.reporter_name&&at.chat_id&&!it[at.chat_id]&&(it[at.chat_id]=at.reporter_name)}),ne(it)},[]);h.useEffect(()=>{const Qe=lB().limit??200;Promise.all([Y.entities.Assistant.list(),Y.entities.Shell.list()]).then(([it,at])=>{a(it),o(at),Me(void 0,Qe)})},[]),h.useEffect(()=>{S&&L&&ue()},[S,L]);async function Ve(){V(!0);const we=await Y.entities.Chat.filter({review_status:"archived"},"-started_at",500);n(Qe=>{const it=new Set(Qe.map(at=>at.id));return[...Qe,...we.filter(at=>!it.has(at.id))]}),M(!0),V(!1)}function Xe(we){n(Qe=>Qe.filter(it=>it.id!==we)),q(Qe=>{const it=new Set(Qe);return it.delete(we),it})}function te(we,Qe){n(it=>it.map(at=>at.id===we?{...at,title:Qe}:at))}function De(we,Qe){n(it=>it.map(at=>at.id===we?{...at,review_status:Qe}:at))}function _e(we,Qe){n(it=>it.map(at=>at.id===we?{...at,review_notes:Qe}:at))}function We(we,Qe){q(it=>{const at=new Set(it);return Qe?at.add(we):at.delete(we),at})}function tt(we,Qe){n(it=>it.map(at=>at.id===we?{...at,tags:Qe}:at))}const me=h.useMemo(()=>{const we=new Set;return t.forEach(Qe=>
977(Qe.tags||[]).forEach(it=>we.add(it))),[...we].sort()},[t]),ae=t.filter(we=>{var Qe,it;if(x.length>0&&!x.includes(we.assistant_id))return!1;if(m){const at=m.toLowerCase();if(!((Qe=we.title)!=null&&Qe.toLowerCase().includes(at))&&!((it=we.user_email)!=null&&it.toLowerCase().includes(at)))return!1}if(T.length>0){const at=T.includes("__untagged__"),Gt=T.filter(tn=>tn!=="__untagged__"),Cn=we.tags||[],Jn=Gt.length>0&&Gt.some(tn=>Cn.includes(tn)),Hn=Cn.length===0;if(!(Jn||at&&Hn))return!1}return!0}),Se={no_review:ae.filter(we=>!we.review_status||we.review_status==="no_review").length,under_review:ae.filter(we=>we.review_status==="under_review").length,archived:ae.filter(we=>we.review_status==="archived").length},Le=ae.filter(we=>(we.review_status||"no_review")===C),He=Le.filter(we=>G.has(we.id)),ut=Le.length>0&&He.length===Le.length;function ze(){q(ut?we=>{const Qe=new Set(we);return Le.forEach(it=>Qe.delete(it.id)),Qe}:we=>{const Qe=new Set(we);return Le.forEach(it=>Qe.add(it.id)),Qe})}async function fe(we){U(!0),await Promise.all([...G].map(Qe=>Y.entities.Chat.update(Qe,{review_status:we}))),n(Qe=>Qe.map(it=>G.has(it.id)?{...it,review_status:we}:it)),q(new Set),U(!1)}async function dt(){if(confirm(`Delete ${G.size} chat(s) and all their messages?`)){U(!0);for(const we of G){const Qe=await Y.entities.Message.filter({chat_id:we});for(let it=0;it<Qe.length;it+=5)await Promise.all(Qe.slice(it,it+5).map(at=>Y.entities.Message.delete(at.id)));await Y.entities.Chat.delete(we)}n(we=>we.filter(Qe=>!G.has(Qe.id))),q(new Set),U(!1)}}const ct=new Set(t.map(we=>we.id)),Wt=l.filter(we=>ct.has(we.chat_id)),bt=d.filter(we=>ct.has(we.chat_id));return r.jsxs("div",{className:"p-6 w-full max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-50 flex items-center justify-center",children:r.jsx(Br,{className:"w-5 h-5 text-indigo-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Conversations"}),L&&r.jsxs("p",{className:"text-sm text-gray-500",children:[t.length," loaded · ",Le.length," shown"]})]})]}),r.jsxs("div",{className:"flex gap-2 mb-5 flex-wrap items-center bg-white border border-gray-100 rounded-2xl px-4 py-3 shadow-sm",children:[r.jsx(Yp,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsxs("div",{className:"relative",ref:w,children:[r.jsxs("button",{onClick:()=>y(we=>!we),className:"flex items-center gap-1.5 border rounded-lg px-2 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 min-w-[150px] max-w-[280px]",children:[r.jsx(Vn,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsx("span",{className:"flex-1 text-left truncate",children:x.length===0?"All assistants":x.length===1?((sn=s.find(we=>we.id===x[0]))==null?void 0:sn.name)||"1 assistant":`${x.length} assistants`}),r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"})]}),b&&r.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-200 rounded-xl shadow-lg z-50 py-1 min-w-[220px] max-h-72 overflow-y-auto",children:[r.jsxs("button",{onClick:()=>j([]),className:`w-full text-left px-3 py-2 text-sm flex items-center gap-2 hover:bg-gray-50 transition-colors ${x.length===0?"text-indigo-700 font-medium":"text-gray-600"}`,children:[r.jsx("span",{className:`w-4 h-4 rounded border flex items-center justify-center shrink-0 ${x.length===0?"bg-indigo-600 border-indigo-600":"border-gray-300"}`,children:x.length===0&&r.jsx(Tn,{className:"w-3 h-3 text-white"})}),"All assistants"]}),r.jsx("div",{className:"border-t my-1"}),s.map(we=>{const Qe=x.includes(we.id);return r.jsxs("button",{onClick:()=>j(it=>Qe?it.filter(at=>at!==we.id):[...it,we.id]),className:"w-full text-left px-3 py-2 text-sm flex items-center gap-2 hover:bg-gray-50 transition-colors",children:[r.jsx("span",{className:`w-4 h-4 rounded border flex items-center justify-center shrink-0 ${Qe?"bg-indigo-600 border-indigo-600":"border-gray-300"}`,children:Qe&&r.jsx(Tn,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"truncate",children:we.name})]},we.id)})]})]}
977),r.jsxs("select",{value:_,onChange:we=>N(Number(we.target.value)),className:"border rounded-lg px-2 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:50,children:"50 chats"}),r.jsx("option",{value:100,children:"100 chats"}),r.jsx("option",{value:200,children:"200 chats"}),r.jsx("option",{value:500,children:"500 chats"})]}),r.jsxs("button",{onClick:()=>Me(x,_),disabled:I,className:"flex items-center gap-1.5 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-60 text-white text-sm font-medium px-4 py-1.5 rounded-lg transition-colors",children:[I?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Rn,{className:"w-4 h-4"}),L?"Reload":"Load"]}),L&&r.jsxs("div",{className:"relative flex-1 min-w-[180px]",children:[r.jsx(ur,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),r.jsx(It,{value:m,onChange:we=>g(we.target.value),placeholder:"Search title or user...",className:"pl-9"})]}),L&&r.jsxs("div",{className:"relative",ref:P,children:[r.jsxs("button",{onClick:()=>D(we=>!we),className:"flex items-center gap-1.5 border rounded-lg px-2 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 min-w-[140px] max-w-[240px]",children:[r.jsx(ac,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsx("span",{className:"flex-1 text-left truncate",children:T.length===0?"All tags":T.length===1?T[0]==="__untagged__"?"Untagged":T[0]:`${T.length} tags`}),r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"})]}),B&&r.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-200 rounded-xl shadow-lg z-50 py-1 min-w-[200px] max-h-72 overflow-y-auto",children:[r.jsxs("button",{onClick:()=>R([]),className:`w-full text-left px-3 py-2 text-sm flex items-center gap-2 hover:bg-gray-50 transition-colors ${T.length===0?"text-indigo-700 font-medium":"text-gray-600"}`,children:[r.jsx("span",{className:`w-4 h-4 rounded border flex items-center justify-center shrink-0 ${T.length===0?"bg-indigo-600 border-indigo-600":"border-gray-300"}`,children:T.length===0&&r.jsx(Tn,{className:"w-3 h-3 text-white"})}),"All tags"]}),r.jsx("div",{className:"border-t my-1"}),r.jsx("button",{onClick:()=>R(we=>we.includes("__untagged__")?we.filter(Qe=>Qe!=="__untagged__"):[...we,"__untagged__"]),className:`w-full text-left px-3 py-2 text-sm flex items-center gap-2 hover:bg-gray-50 transition-colors ${T.includes("__untagged__")?"text-indigo-700 font-medium":"text-gray-600"}`,children:(()=>{const we=T.includes("__untagged__");return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:`w-4 h-4 rounded border flex items-center justify-center shrink-0 ${we?"bg-indigo-600 border-indigo-600":"border-gray-300"}`,children:we&&r.jsx(Tn,{className:"w-3 h-3 text-white"})}),"Untagged"]})})()}),me.length>0&&r.jsx("div",{className:"border-t my-1"}),me.map(we=>{const Qe=T.includes(we);return r.jsxs("button",{onClick:()=>R(it=>Qe?it.filter(at=>at!==we):[...it,we]),className:"w-full text-left px-3 py-2 text-sm flex items-center gap-2 hover:bg-gray-50 transition-colors",children:[r.jsx("span",{className:`w-4 h-4 rounded border flex items-center justify-center shrink-0 ${Qe?"bg-indigo-600 border-indigo-600":"border-gray-300"}`,children:Qe&&r.jsx(Tn,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"truncate",children:we})]},we)})]})]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[L&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:Ne,className:"flex items-center gap-1.5 text-sm font-medium px-3 py-1.5 rounded-lg border transition-colors bg-white text-gray-700 border-gray-200 hover:bg-gray-50 hover:border-gray-300",children:[r.jsx(K5,{className:"w-4 h-4"}),"Export Report"]}),r.jsxs("button",{onClick:Oe,className:"flex items-center gap-1.5 text-sm font-medium px-3 py-1.5 rounded-lg border transition-colors bg-white text-gray-700 border-gray-200 hover:bg-gray-50 hover:border-gray-300",children:[r.jsx(Yz,{className:"w-4 h-4"}),"Export Data"]}),r.jsxs("button",{onClick:()=>Ue(!0),className:"flex items-center gap-1.5 text-sm font-medium px-3 py-1.5 rounded-lg border transition-colors bg-white text-emerald-700 border-emerald-200 hover:bg-emerald-50",children:[r.jsx(Yn,{className:"w-4 h-4"}),"Analyst"]})]}),r.jsx(wt,{to:yt("PageViews"),children:r.jsxs("button",{className:"flex items-center gap-1.5 text-sm font-medium px-3 py-1.5 rounded-lg border transition-colors bg-white text-indigo-700 border-indigo-200 hover:bg-indigo-50",children:[r.jsx(Ts,{className:"w-4 h-4"}),"Page Views"]})}),r.jsxs("button",{onClick:()=>A(we=>!we),className:`flex items-center gap-1.5 text-sm font-medium px-3 py-1.5 rounded-lg border transition-colors ${S?"bg-indigo-600 text-white border-indigo-600":"bg-white text-indigo-700 border-indigo-200 hover:bg-indigo-50"}`,children:[r.jsx(Wp,{className:"w-4 h-4"}),S?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"}),"Dashboard"]})]})]}),S&&r.jsx("div",{className:"mb-5",children:I?r.jsxs("div",{className:"flex items-center justify-center gap-2 py-10 text-gray-400 text-sm",children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," Loading dashboard…"]}):r.jsx(XEe,{chats:ae,messages:Wt,issues:bt,assistants:s,allTags:me,activeTab:C,filterTags:T})}),L&&!I&&r.jsx("div",{className:"flex gap-1 mb-0 border-b",children:Cp.map(we=>{const Qe=we.icon;return r.jsxs("button",{onClick:()=>
977{k(we.key),q(new Set)},className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium border-b-2 transition-colors -mb-px ${C===we.key?"border-indigo-600 text-indigo-700":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[r.jsx(Qe,{className:`w-3.5 h-3.5 ${C===we.key?"text-indigo-600":we.color}`}),we.label,r.jsx("span",{className:`text-[11px] font-semibold rounded-full px-1.5 py-0.5 min-w-[18px] text-center ${C===we.key?"bg-indigo-100 text-indigo-700":"bg-gray-100 text-gray-500"}`,children:Se[we.key]})]},we.key)})}),L&&!I&&Le.length>0&&r.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-1 mb-3 border-b bg-white sticky top-0 z-10",children:[r.jsx("input",{type:"checkbox",checked:ut,onChange:ze,className:"accent-indigo-600 w-4 h-4 cursor-pointer"}),r.jsx("span",{className:"text-xs text-gray-500",children:He.length>0?`${He.length} selected`:"Select all"}),He.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-gray-200 mx-1",children:"|"}),r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Move to:"}),Cp.filter(we=>we.key!==C).map(we=>{const Qe=we.icon;return r.jsxs("button",{onClick:()=>fe(we.key),disabled:F,className:`flex items-center gap-1 text-xs font-medium px-3 py-1 rounded-lg border transition-colors disabled:opacity-60 ${we.bg} ${we.color} border-current`,children:[F?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Qe,{className:"w-3 h-3"}),we.label]},we.key)}),r.jsxs("button",{onClick:dt,disabled:F,className:"flex items-center gap-1 text-xs font-medium px-3 py-1 rounded-lg border border-red-200 bg-red-50 text-red-600 hover:bg-red-100 disabled:opacity-60 ml-auto",children:[F?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(un,{className:"w-3 h-3"})," Delete"]})]})]}),I&&r.jsxs("div",{className:"text-center py-16 text-gray-400 flex items-center justify-center gap-2",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin"})," Loading conversations…"]}),L&&!I&&C==="archived"&&!K&&r.jsxs("div",{className:"text-center py-16 text-gray-400",children:[r.jsx(Ih,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{className:"mb-4 text-sm",children:"Archived chats are not loaded by default."}),r.jsxs("button",{onClick:Ve,disabled:W,className:"flex items-center gap-2 mx-auto bg-slate-600 hover:bg-slate-700 disabled:opacity-60 text-white text-sm font-medium px-5 py-2 rounded-lg transition-colors",children:[W?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Ih,{className:"w-4 h-4"}),"Load Archived"]})]}),L&&!I&&Le.length===0&&!(C==="archived"&&!K)&&r.jsxs("div",{className:"text-center py-16 text-gray-400",children:[r.jsx(Br,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No chats in this category."})]}),L&&!I&&Le.map(we=>r.jsx(oAe,{chat:we,assistants:s,shells:i,onDelete:Xe,onRename:te,onStatusChange:De,onNotesChange:_e,onTagsChange:tt,selected:G.has(we.id),onSelect:We,reporterName:ee[we.id]||null,allTags:me,ignoredIps:X,addIp:ie,removeIp:Z},we.id)),r.jsx(BA,{open:ce.open,onClose:()=>le(we=>({...we,open:!1})),title:ce.title,filename:ce.filename,text:ce.text,loading:ce.loading}),r.jsx(nAe,{open:re,onClose:()=>Ue(!1),contextState:{filterAssistantIds:x,assistants:s,filterTags:T,activeTab:C,search:m,limit:_,filtered:Le}})]})}const cAe=[{id:"general",label:"General",icon:Vn},{id:"schema",label:"Data Schema",icon:_n}];function dAe(){Ca();const e=new URLSearchParams(window.location.search),[t,n]=h.useState(e.get("id")),[s,a]=h.useState({name:"",investigationKey:"",type:"profile",status:"active",description:"",data:{},icon_url:"",library_id:""}),[i,o]=h.useState([]),[l,c]=h.useState(!!t),[d,f]=h.useState(!1),[m,g]=h.useState("general"),[x,j]=h.useState(!1),[b,y]=h.useState(null),[w,_]=h.useState(""),[N,C]=h.useState(null);h.useEffect(()=>{Y.entities.AppConfig.filter({key:"global"}).then(P=>C(P[0]||null)).catch(()=>{}),Y.entities.Library.list("name").then(o).catch(()=>{}),t&&Y.entities.Investigation.filter({id:t}).then(P=>{P[0]&&a(P[0]),c(!1)})},[t]);const[k,S]=h.useState(!1),[A,T]=h.useState("");async function R(){if(T(""),s.investigationKey){const I=(await Y.entities.Investigation.filter({investigationKey:s.investigationKey})).find(z=>z.id!==t);if(I){T(`Key "${s.investigationKey}" is already used by "${I.name}". Please choose a unique key.`);return}}if(f(!0),t){const{id:P,created_date:I,updated_date:z,created_by:L,...H}=s;await Y.entities.Investigation.update(t,H)}else{const P=await Y.entities.Investigation.create(s);window.history.replaceState({},"",`?id=${P.id}`),n(P.id)}f(!1),S(!0),setTimeout(()=>S(!1),2e3)}function B(P){_(""),y(P)}async function D(){const P=b;if(y(null),P==="description"){j(!0);const I=await Y.integrations.Core.InvokeLLM({prompt:`You are helping write a clear and concise description for an investigation object.
978Name: ${s.name}
979Type: ${s.type}
980Current description: ${s.description||"(empty)"}
981Current JSON data: ${JSON.stringify(s.data)}
982User instructions: ${w}
983
984Write an improved, informative description (2-4 sentences). Return only the description text, no preamble.`});a(z=>({...z,description:I})),j(!1)}}return l?r.jsxs("div",{className:"p-8 text-center text-gray-400",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading..."]}):r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:yt("Investigations"),children:r.jsxs(de,{variant:"ghost",size:"sm",className:"gap-1",children:[r.jsx(or,{className:"w-4 h-4"})," Back"]})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:t?"Edit Investigation":"New Investigation"}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Configure investigation details and data schema"})]})]}),r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(wt,{to:yt("Investigations"),children:r.jsx(de,{variant:"outline",children:"Cancel"})}),r.jsxs(de,{onClick:R,disabled:!s.name.trim()||d,className:"gap-2",children:[d?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Ar,{className:"w-4 h-4"}),k?"Saved!":"Save"]})]})]}),r.jsx("div",{className:"border-b bg-white px-6 shrink-0",children:r.jsx("div",{className:"flex",children:cAe.map(P=>r.jsxs("button",{onClick:()=>g(P.id),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 transition-colors
985                ${m===P.id?"border-indigo-500 text-indigo-700":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[r.jsx(P.icon,{className:"w-4 h-4"}),P.label]},P.id))})}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsxs("div",{className:"w-full space-y-5",children:[m==="general"&&r.jsx(r.Fragment,{children:r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-5",children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Basic Info"}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Icon"}),r.jsx(Pb,{value:s.icon_url||"",onChange:P=>a(I=>({...I,icon_url:P}))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Name *"}),r.jsx(It,{value:s.name,onChange:P=>a(I=>({...I,name:P.target.value})),placeholder:"Investigation name",autoFocus:!t})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Investigation Key"}),r.jsx(It,{value:s.investigationKey||"",onChange:P=>a(I=>({...I,investigationKey:P.target.value.toLowerCase().replace(/\s+/g,"_")})),placeholder:"e.g. tech_skills (auto-slug, unique per investigation)"}),A&&r.jsx("p",{className:"text-xs text-red-500 mt-0.5",children:A}),!A&&r.jsx("p",{className:"text-[10px] text-gray-400 mt-0.5",children:"Used to match user records. Lowercase, underscores only. Must be unique."})]}),i.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Library"}),r.jsxs("select",{value:s.library_id||"",onChange:P=>a(I=>({...I,library_id:P.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:"— No library —"}),i.map(P=>r.jsx("option",{value:P.id,children:P.name},P.id))]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Type"}
985),r.jsxs("select",{value:s.type,onChange:P=>a(I=>({...I,type:P.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"profile",children:"Profile"}),r.jsx("option",{value:"interest",children:"Interest"}),r.jsx("option",{value:"knowledge",children:"Knowledge"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Status"}),r.jsxs("select",{value:s.status||"active",onChange:P=>a(I=>({...I,status:P.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"inactive",children:"Inactive"})]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-xs font-medium text-gray-500",children:"Description"}),r.jsxs("button",{onClick:()=>B("description"),disabled:x||!s.name,className:"flex items-center gap-1 text-xs text-indigo-600 hover:text-indigo-800 disabled:opacity-40",children:[x?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Yn,{className:"w-3 h-3"}),"AI improve"]})]}),r.jsx(rr,{value:s.description||"",onChange:P=>a(I=>({...I,description:P.target.value})),placeholder:"Describe this investigation...",className:"min-h-[160px]"})]})]})}),m==="schema"&&r.jsx(Ed,{title:"Data Schema",description:"Define the fields this investigation collects from users",value:s.data||{},onChange:P=>a(I=>({...I,data:P})),objectType:"investigationDataScheme",aiPrompt:N==null?void 0:N.json_object_prompt})]})}),b&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md p-5 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yn,{className:"w-4 h-4 text-indigo-500"}),r.jsx("h3",{className:"font-semibold text-sm text-gray-900",children:b==="description"?"AI Improve Description":"AI Generate JSON Data"})]}),r.jsxs("p",{className:"text-xs text-gray-500",children:["Add instructions for the AI. The current ",b==="description"?"description":"JSON data"," and all form content will also be sent."]}),r.jsx(rr,{autoFocus:!0,value:w,onChange:P=>_(P.target.value),placeholder:"e.g. Focus on technical skills, use a formal tone, add more detail...",className:"min-h-[90px] text-sm"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(de,{variant:"outline",size:"sm",onClick:()=>y(null),children:"Cancel"}),r.jsxs(de,{size:"sm",onClick:D,className:"gap-1.5",children:[r.jsx(Yn,{className:"w-3.5 h-3.5"})," Generate"]})]})]})})]})}function uAe({assistant:e,investigations:t,userProfile:n,userId:s,userEmail:a,onProfileChange:i}){const[o,l]=h.useState([]),[c,d]=h.useState(!1),[f,m]=h.useState(null),[g,x]=h.useState(null);function j(S){const A=(t||[]).filter(T=>((e==null?void 0:e.investigation_ids)||[]).includes(T.id)).map(T=>({id:T.id,name:T.name,type:T.type,description:T.description,data:T.data}));return(S||"").replace(/\{\{investigations_list\}\}/g,JSON.stringify(A,null,2)).replace(/\{\{user_profile\}\}/g,JSON.stringify(n||{},null,2)).replace(/\{\{user_interests\}\}/g,JSON.stringify((n==null?void 0:n.interests)||{},null,2)).replace(/\{\{user_knowledges\}\}/g,JSON.stringify((n==null?void 0:n.knowledges)||{},null,2)).replace(/\{\{user_name\}\}/g,(n==null?void 0:n.user_email)||a||"").replace(/\{\{user_email\}\}/g,a||(n==null?void 0:n.user_email)||"").replace(/\{\{user_id\}\}/g,s||"").replace(/\{\{date\}\}/g,new Date().toLocaleDateString())}function b(){return j((e==null?void 0:e.prompt_instructions)||"")}function y(S){if(!S)return[];const A=e==null?void 0:e.investigation_data_node,T=A&&S[A]!==void 0?S[A]:S,R=(t||[]).filter(D=>((e==null?void 0:e.investigation_ids)||[]).includes(D.id));if(Array.isArray(T))return T;if(R.length===1)return[{investigation_key:R[0].investigationKey||R[0].name,data:T}];const B=[];for(const D of R){const P=D.investigationKey||D.name,I=T[P]||T;B.push({investigation_key:P,data:I})}return B}async function w(S){if(!(e!=null&&e.agent_name)||!S.length)return null;const A=[];A.push("[SYSTEM CONTEXT]"),A.push(`user_email: ${a||""}`),A.push("[END SYSTEM CONTEXT]"),A.push(""),A.push("[INVESTIGATION DATA]"),A.push(JSON.stringify(S,null,2)),A.push("[END INVESTIGATION DATA]");const T=A.join(`
986`),R=await Y.agents.createConversation({agent_name:e.agent_name});return await new Promise(D=>{const P=setTimeout(()=>{I(),D({message_sent:T,response:"(no response within 30s)"})},3e4),I=Y.agents.subscribeToConversation(R.id,z=>{const L=(z.messages||[]).find(H=>H.role==="assistant");L!=null&&L.content&&(clearTimeout(P),I(),D({message_sent:T,response:L.content}))});Y.agents.addMessage(R,{role:"user",content:T})})}async function _(S){if(!e)return;l(K=>[...K,{role:"user",content:S}]),d(!0);const A=e.investigation_data_node;let T=null;g&&(T=A&&g[A]!==void 0?g[A]:g);const R=Date.now(),B=await Y.functions.invoke("invokeAssistant",{assistant_id:e.id,message:S,user_id:s,...f?{chat_id:f}:{},...T?{investigation_data:T}:{}}),D=Date.now()-R,{answer:P,chat_id:I,data:z,debug_info:L}=B.data||{};I&&m(I),z&&x(z);let H=null,W=null,V=[];if(e.agent_name&&z){V=y(z);const K=await w(V);H=(K==null?void 0:K.message_sent)||null,W=(K==null?void 0:K.response)||null}l(K=>[...K,{role:"assistant",content:P||"",response_time_ms:D,prompt_sent:(L==null?void 0:L.full_prompt)||void 0,raw:JSON.stringify({answer:P,data:z,chat_id:I,debug_info:L},null,2),agent_data_sent:H||void 0,agent_response:W,search_info:(L==null?void 0:L.search)||void 0,full_llm_response:L!=null&&L.full_llm_response?JSON.stringify(L.full_llm_response,null,2):void 0}]),d(!1),i&&setTimeout(i,4e3)}function N(S){l([]),m(null),x(null),S!=null&&S.greeting_message&&l([{role:"assistant",content:S.greeting_message}])}async function C(S){l([]),x(null),m(S.id);const A=await Y.entities.Message.filter({chat_id:S.id});A.sort((T,R)=>T.sent_at>R.sent_at?1:-1),l(A.map(T=>({role:T.role,content:T.content})))}function k(){const S=(e==null?void 0:e.response_object)||(e==null?void 0:e.prompt_data_object)||{};if(!(Object.keys(S).length>0))return"(No data object defined — agent will not be called automatically)";const T=e==null?void 0:e.investigation_data_node;return["INVESTIGATION FLOW (via invokeAssistant → assistantPromptBuilder):","• invokeAssistant builds the full prompt using assistantPromptBuilder (KB search, var resolution, investigation data injection)","• LLM extracts structured data matching the Data Object schema",T?`• Agent receives the "${T}" node, mapped to an array of { investigation_key, data }`:"• Agent receives the full extracted data, mapped to an array of { investigation_key, data }","• Agent upserts each investigation row for the user (no duplicates)","","Data Object Schema (extraction template):",JSON.stringify(S,null,2)].join(`
987`)}return{messages:o,loading:c,chatId:f,sendMessage:_,clearMessages:()=>l([]),initGreeting:N,loadConversation:C,buildSystemPrompt:b,buildAgentPrefix:k,setMessages:l}}function mAe(e){return e==null?null:Array.isArray(e)?e.length===0?"[]":e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function fAe(e,t){return e==null||Array.isArray(e)&&e.length===0?"text-red-500 
987italic":t?"text-amber-500 font-semibold":"text-emerald-600 font-semibold"}function hAe({arr:e,prevArr:t,hasPrev:n,depth:s}){if(e.length===0)return r.jsx("span",{className:"text-red-500 italic text-xs",children:"[]"});if(e.every(i=>i===null||typeof i!="object")){const i=n&&JSON.stringify(e)!==JSON.stringify(t);return r.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:e.map((o,l)=>r.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full border ${i?"bg-amber-50 border-amber-200 text-amber-700":"bg-emerald-50 border-emerald-100 text-emerald-700"}`,children:String(o??"null")},l))})}return r.jsx("div",{className:"pl-3 border-l-2 border-gray-100 space-y-2 mt-1",children:e.map((i,o)=>i!==null&&typeof i=="object"&&!Array.isArray(i)?r.jsxs("div",{children:[r.jsxs("p",{className:"text-[9px] font-semibold text-gray-400 mb-0.5",children:["[",o,"]"]}),r.jsx(FA,{obj:i,prev:t==null?void 0:t[o],hasPrev:n,depth:s+1})]},o):r.jsx("p",{className:"text-xs text-emerald-600 font-semibold",children:String(i??"null")},o))})}function FA({obj:e,prev:t,hasPrev:n,depth:s=0}){return!e||typeof e!="object"||Array.isArray(e)?null:r.jsx("div",{className:s>0?"pl-3 border-l-2 border-gray-100 space-y-1.5":"space-y-2",children:Object.entries(e).map(([a,i])=>{const o=Array.isArray(i);if(i!=null&&typeof i=="object"&&!o)return r.jsxs("div",{children:[r.jsx("p",{className:`font-bold uppercase tracking-wide text-gray-500 ${s===0?"text-[10px] mb-1":"text-[9px] mb-0.5"}`,children:a}),r.jsx(FA,{obj:i,prev:t==null?void 0:t[a],hasPrev:n,depth:s+1})]},a);if(o){const f=n&&JSON.stringify(i)!==JSON.stringify(t==null?void 0:t[a]);return r.jsxs("div",{className:"min-w-0",children:[r.jsxs("p",{className:"text-[10px] font-medium text-gray-500 truncate flex items-center gap-1",children:[a,r.jsx("span",{className:`text-[9px] px-1 rounded ${f?"bg-amber-100 text-amber-600":"bg-gray-100 text-gray-400"}`,children:i.length})]}),r.jsx(hAe,{arr:i,prevArr:t==null?void 0:t[a],hasPrev:n,depth:s})]},a)}const c=t==null?void 0:t[a],d=n&&JSON.stringify(i)!==JSON.stringify(c);return r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"text-[10px] font-medium text-gray-500 truncate",children:a}),r.jsx("p",{className:`text-xs truncate ${fAe(i,d)}`,children:i==null?"null":mAe(i)})]},a)})})}function pAe({inv:e,prevSnapshot:t}){const[n,s]=h.useState(!1),[a,i]=h.useState(!0),o=!!t,l=t||{},c=Object.keys(e.investigationObject||{}),d={profile:"bg-indigo-50 text-indigo-700",interest:"bg-emerald-50 text-emerald-700",knowledge:"bg-violet-50 text-violet-700"}[e.type]||"bg-gray-100 text-gray-600";return r.jsxs("div",{className:"bg-white border rounded-xl overflow-hidden shadow-sm",children:[r.jsxs("button",{onClick:()=>i(f=>!f),className:"w-full flex items-center gap-2 px-4 py-3 border-b bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:e.investigationName||e.investigationKey}),r.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-full font-medium ${d}`,children:e.type}),r.jsx("span",{className:"text-[10px] font-mono bg-white border text-gray-400 px-1.5 py-0.5 rounded",children:e.investigationKey})]}),e.lastUpdate&&r.jsxs("p",{className:"text-[10px] text-gray-400 mt-0.5",children:["Updated ",new Date(e.lastUpdate).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",onClick:f=>f.stopPropagation(),children:[e.completion!=null&&r.jsxs("div",{className:"flex flex-col items-end gap-1",children:[r.jsxs("span",{className:"text-xs font-semibold text-gray-600",children:[e.completion,"%"]}),r.jsx("div",{className:"w-16 h-1.5 bg-gray-200 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-amber-400 rounded-full",style:{width:`${Math.min(100,e.completion)}%`}})})]}),!a&&r.jsx("button",{onClick:()=>s(f=>!f),title:n?"Structured view":"Raw JSON",className:`p-1 rounded transition-colors ${n?"bg-gray-800 text-green-400":"text-gray-400 hover:text-gray-700 hover:bg-gray-100"}`,children:r.jsx(dr,{className:"w-3.5 h-3.5"})})]})]}),!a&&(c.length===0?r.jsx("p",{className:"text-xs text-gray-400 italic px-4 py-3",children:"No data fields collected."}):n?r.jsx("pre",{className:"px-4 py-3 text-[11px] font-mono text-green-400 bg-gray-950 overflow-auto max-h-64 whitespace-pre-wrap",children:JSON.stringify(e.investigationObject,null,2)}):r.jsx("div",{className:"px-4 py-3",children:r.jsx(FA,{obj:e.investigationObject,prev:l,hasPrev:o,depth:0})}))]})}function gAe({title:e,headerClass:t,content:n,onClose:s}){return r.jsxs("div",{className:"fixed inset-0 z-50 bg-black/80 flex flex-col",children:[r.jsxs("div",{className:`flex items-center justify-between px-4 py-2.5 shrink-0 ${t}`,children:[r.jsx("span",{className:"font-semibold text-xs tracking-wide",children:e}),r.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-black/20 transition-colors",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsx("pre",{className:"flex-1 bg-gray-950 text-green-300 p-4 overflow-auto font-mono text-xs whitespace-pre-wrap",children:n})]})}function e0({borderClass:e,headerClass:t,label:n,content:s,preClass:a}){const[i,o]=h.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:`border rounded-lg overflow-hidden ${e}`,children:[r.jsxs("div",{className:`px-2 py-1 flex items-center justify-between ${t}`,children:[r.jsx("span",{className:"font-semibold text-[10px]",children:n}),r.jsx("button",{onClick:()=>o(!0),title:"Expand fullscreen",className:"p-0.5 rounded hover:bg-black/10 transition-colors opacity-70 hover:opacity-100",children:r.jsx(Nd,{className:"w-3 h-3"})})]}),r.jsx("pre",{className:`p-2 overflow-auto max-h-40 font-mono text-[12px] whitespace-pre-wrap ${a}`,children:s})]}),i&&r.jsx(gAe,{title:n,headerClass:t,content:s,onClose:()=>o(!1)})]})}function xAe({msg:e}){const[t,n]=h.useState(!1);return e.prompt_sent||e.raw||e.full_llm_response||e.search_info||e.agent_data_sent?r.jsxs("div",{className:"mt-2",children:[r.jsxs("button",{onClick:()=>n(a=>!a),className:"flex items-center gap-1 text-xs text-gray-400 hover:text-indigo-600 transition-colors",children:[r.jsx(dr,{className:"w-3.5 h-3.5"}),t?"Hide":"Show"," debug",t?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})]}),t&&r.jsxs("div",{className:"mt-2 space-y-2 text-xs",children:[e.prompt_sent&&r.jsx(e0,{borderClass:"border-blue-200",headerClass:"bg-blue-100 text-blue-700",label:"FULL PROMPT SENT",content:e.prompt_sent,preClass:"bg-gray-900 text-green-400"}),e.raw&&r.jsx(e0,{borderClass:"border-green-200",headerClass:"bg-green-100 text-green-700",label:"RAW RESPONSE (invokeAssistant)",content:e.raw,preClass:"bg-gray-900 text-green-300"}),e.search_info&&r.jsx(e0,{borderClass:"border-purple-200",headerClass:"bg-purple-100 text-purple-700",label:"KNOWLEDGE BASE",content:[`KB Items: ${e.search_info.kb_items_used||0}`,e.search_info.top_result?`Top: ${e.search_info.top_result}`:null,e.search_info.latency_ms?`Latency: ${e.search_info.latency_ms}
987ms`:null].filter(Boolean).join(`
988`),preClass:"bg-gray-900 text-purple-300"}),e.agent_data_sent&&r.jsx(e0,{borderClass:"border-amber-200",headerClass:"bg-amber-100 text-amber-700",label:"INVESTIGATION DATA (sent to agent)",content:e.agent_data_sent,preClass:"bg-gray-900 text-amber-300"})]})]}):null}function yAe({msg:e}){const t=e.role==="user";return r.jsx("div",{className:`flex gap-2 ${t?"justify-end":"justify-start"}`,children:r.jsxs("div",{className:`max-w-[80%] ${t?"order-2":""}`,children:[r.jsx("div",{className:`rounded-2xl px-4 py-2.5 text-sm leading-relaxed ${t?"bg-indigo-600 text-white":"bg-white border border-gray-200 text-gray-800"}`,children:t?e.content:r.jsx(Ym,{className:"prose prose-sm max-w-none [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e.content})}),!t&&r.jsxs("div",{className:"mt-1 flex items-center gap-3 flex-wrap",children:[e.response_time_ms!=null&&r.jsxs("span",{className:"text-[10px] text-gray-400 flex items-center gap-1",children:["⏱ ",e.response_time_ms<1e3?`${e.response_time_ms}ms`:`${(e.response_time_ms/1e3).toFixed(1)}s`]}),e.agent_data_sent&&r.jsxs("span",{className:"text-xs text-amber-500 flex items-center gap-1",children:[r.jsx(zn,{className:"w-3 h-3"})," data sent to agent"]})]}),!t&&r.jsx(xAe,{msg:e})]})})}function bAe(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState([]),[o,l]=h.useState(null),[c,d]=h.useState(""),[f,m]=h.useState(""),[g,x]=h.useState(""),[j,b]=h.useState(null),[y,w]=h.useState([]),[_,N]=h.useState(""),[C,k]=h.useState(!0),[S,A]=h.useState("profile"),[T,R]=h.useState(!1),[B,D]=h.useState(""),[P,I]=h.useState([]),[z,L]=h.useState("new"),H=h.useRef(null),W=h.useRef({}),[V,K]=h.useState(50),[M,G]=h.useState(!1),[q,F]=h.useState(!1),[U,ee]=h.useState(null),ne=h.useRef(null),X=h.useRef(!1),ie=h.useCallback(me=>{me.preventDefault(),X.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);h.useEffect(()=>{const me=Se=>{if(!X.current||!ne.current)return;const Le=ne.current.getBoundingClientRect(),He=(Se.clientX-Le.left)/Le.width*100;K(Math.min(90,Math.max(10,He)))},ae=()=>{X.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return window.addEventListener("mousemove",me),window.addEventListener("mouseup",ae),()=>{window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",ae)}},[]);const{messages:Z,loading:ce,chatId:le,sendMessage:re,initGreeting:Ue,loadConversation:Ne}=uAe({assistant:o,investigations:n,userProfile:j,userEmail:c,userId:f,onProfileChange:Ve});h.useEffect(()=>{async function me(){const[ae,Se,Le]=await Promise.all([Y.entities.Assistant.filter({type:"Investigation"}),Y.entities.Investigation.list(),Y.entities.User.list()]);t(ae),s(Se),i(Le);try{const He=await Y.auth.me();x(He.email),d(He.email),m(He.id);const ut=await Y.entities.UserProfile.filter({user_email:He.email});b(ut[0]||null)}catch{}k(!1)}me()},[]),h.useEffect(()=>{o&&(Ue(o),Oe(c,o.id))},[o==null?void 0:o.id]),h.useEffect(()=>{var me;(me=H.current)==null||me.scrollIntoView({behavior:"smooth"})},[Z]),h.useEffect(()=>{le&&z==="new"&&L(le)},[le]),h.useEffect(()=>{async function me(){var ae;if(!(!o||!f))try{const Se=await Y.functions.invoke("assistantPromptBuilder",{assistant_id:o.id,message:"[test message]",user_id:f,conversation_history:[]});D(((ae=Se.data)==null?void 0:ae.full_prompt)||"")}catch{D("")}}me()},[o==null?void 0:o.id,j,n,f]);async function Oe(me,ae){if(!me||!ae){I([]);return}const Se=await Y.entities.Chat.filter({user_email:me,assistant_id:ae});Se.sort((Le,He)=>Le.started_at>He.started_at?-1:1),I(Se)}function Me(){L("new"),Ue(o)}async function ue(me){const[ae,Se]=await Promise.all([Y.entities.UserProfile.filter({user_email:me}),Y.entities.UserInvestigation.filter({user_email:me})]);b(ae[0]||null),w(Se)}async function Ve(){R(!0),w(me=>(me.forEach(ae=>{W.current[ae.id]=JSON.parse(JSON.stringify(ae.investigationObject||{}))}),me)),await ue(c),R(!1)}
988async function Xe(){if(!_.trim()||ce)return;const me=_.trim();N("");const ae=z==="new";await re(me),ae&&await Oe(c,o==null?void 0:o.id)}function te(me){const ae=e.find(Se=>Se.id===me)||null;l(ae),L("new"),Oe(c,me)}async function De(me){const ae=a.find(Se=>Se.email===me);d(me),m((ae==null?void 0:ae.id)||""),L("new"),await Promise.all([ue(me),Oe(me,o==null?void 0:o.id)])}async function _e(me){if(L(me),me==="new")Ue(o);else{const ae=P.find(Se=>Se.id===me);ae&&await Ne(ae)}}if(C)return r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading..."});const We=r.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b bg-gray-50 shrink-0",children:[r.jsxs("span",{className:"text-xs font-semibold text-gray-500 flex items-center gap-1.5",children:[r.jsx(Ci,{className:"w-3.5 h-3.5"})," Chat"]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>ee(U==="chat"?null:"chat"),className:"p-1 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-700 transition-colors",title:U==="chat"?"Exit fullscreen":"Fullscreen",children:U==="chat"?r.jsx(Lh,{className:"w-3.5 h-3.5"}):r.jsx(Nd,{className:"w-3.5 h-3.5"})}),U!=="chat"&&r.jsx("button",{onClick:()=>{G(me=>!me),q&&F(!1)},className:"p-1 rounded hover:bg-gray-200 text-gray-400 hover:text-gray-700 transition-colors",title:M?"Show chat":"Collapse chat",children:M?r.jsx(t2,{className:"w-3.5 h-3.5"}):r.jsx(t7,{className:"w-3.5 h-3.5"})})]})]}),!M&&r.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[r.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-h-0",children:[Z.length===0&&r.jsxs("div",{className:"text-center text-gray-400 text-sm mt-8",children:[r.jsxs("p",{children:["Start a conversation with ",r.jsx("strong",{children:o==null?void 0:o.name})]}),((o==null?void 0:o.suggested_prompts)||[]).length>0&&r.jsx("div",{className:"flex flex-wrap justify-center gap-2 mt-4",children:o.suggested_prompts.map((me,ae)=>r.jsx("button",{onClick:()=>N(me),className:"text-xs px-3 py-1.5 rounded-full border border-amber-200 text-amber-700 hover:bg-amber-50 transition-colors",children:me},ae))})]}),Z.map((me,ae)=>r.jsx(yAe,{msg:me},ae)),ce&&r.jsx("div",{className:"flex gap-2 justify-start",children:r.jsx("div",{className:"bg-white border rounded-2xl px-4 py-2.5",children:r.jsx("div",{className:"flex gap-1",children:[0,1,2].map(me=>r.jsx("div",{className:"w-1.5 h-1.5 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:`${me*.15}s`}},me))})})}),r.jsx("div",{ref:H})]}),r.jsxs("div",{className:"border-t bg-white p-3 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5 mb-2 text-[10px] text-gray-400",children:[r.jsx(Ci,{className:"w-3 h-3"}),"Chatting as: ",r.jsx("span",{className:"font-semibold text-gray-600",children:c})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{value:_,onChange:me=>N(me.target.value),onKeyDown:me=>me.key==="Enter"&&!me.shiftKey&&Xe(),placeholder:"Type a message...",disabled:ce,className:"flex-1"}),r.jsx(de,{onClick:Xe,disabled:!_.trim()||ce,size:"sm",className:"gap-1.5 bg-amber-500 hover:bg-amber-600 text-white",children:r.jsx(Fd,{className:"w-4 h-4"})})]})]})]})]}),tt=r.jsxs("div",{className:"flex flex-col h-full min-h-0 bg-gray-50",children:[r.jsxs("div",{className:"flex items-center border-b bg-white shrink-0",children:[r.jsxs("span",{className:"flex items-center gap-1.5 px-3 py-2.5 text-xs font-medium text-amber-700 border-b-2 border-amber-500",children:[r.jsx(Ci,{className:"w-3.5 h-3.5"})," Profile"]}),r.jsxs("div",{className:"flex items-center gap-1 px-2 border-l ml-auto shrink-0",children:[r.jsx("button",{onClick:()=>ee(U==="debug"?null:"debug"),className:"p-1 rounded hover:bg-gray-100 text-gray-400 hover:text-gray-700 transition-colors",title:U==="debug"?"Exit fullscreen":"Fullscreen",children:U==="debug"?r.jsx(Lh,{className:"w-3.5 h-3.5"}):r.jsx(Nd,{className:"w-3.5 h-3.5"})}),U!=="debug"&&r.jsx("button",{onClick:()=>{F(me=>!me),M&&G(!1)},className:"p-1 rounded hover:bg-gray-100 text-gray-400 hover:text-gray-700 transition-colors",title:q?"Show debug":"Collapse debug",children:q?r.jsx(n2,{className:"w-3.5 h-3.5"}):r.jsx(n7,{className:"w-3.5 h-3.5"})})]})]}),!q&&r.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-gray-700",children:c}),r.jsxs("p",{className:"text-[10px] text-gray-400",children:[y.length," investigation record",y.length!==1?"s":""]})]}),r.jsxs("button",{onClick:Ve,disabled:T,className:"text-xs text-amber-600 hover:underline flex items-center gap-1 disabled:opacity-50",children:[r.jsx(Rn,{className:`w-3 h-3 ${T?"animate-spin":""}`})," Refresh"]})]}),y.length===0?r.jsxs("div",{className:"text-center py-10 text-gray-400",children:[r.jsx(ur,{className:"w-8 h-8 mx-auto mb-2 opacity-20"}),r.jsx("p",{className:"text-sm",children:"No investigation data yet."}),r.jsx("p",{className:"text-xs mt-1",children:"Start a conversation to collect data."})]}):r.jsx("div",{className:"space-y-3",children:y.map(me=>r.jsx(pAe,{inv:me,prevSnapshot:W.current[me.id]||null},me.id))})]})})]});return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-4 py-3 flex items-center gap-3 shrink-0 flex-wrap gap-y-2",children:[r.jsx(wt,{to:yt("QualityAssurance"),children:r.jsxs(de,{variant:"ghost",size:"sm",className:"gap-1",children:[r.jsx(or,{className:"w-4 h-4"})," Back"]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ur,{className:"w-5 h-5 text-amber-500"}),r.jsx("h1",{className:"text-lg font-bold text-gray-900",children:"Investigation Test"}
988),(o==null?void 0:o.agent_name)&&r.jsxs(Gr,{className:"bg-amber-100 text-amber-700 border-0 text-[10px] gap-1 flex items-center",children:[r.jsx(zn,{className:"w-3 h-3"})," Agent: ",o.agent_name]})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(eg,{className:"w-3.5 h-3.5 text-gray-400"}),r.jsx("select",{value:c,onChange:me=>De(me.target.value),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-amber-400 min-w-[160px]",children:a.map(me=>r.jsxs("option",{value:me.email,children:[me.full_name||me.email,me.email===g?" (me)":""]},me.id))})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-xs text-gray-500 hidden sm:block",children:"Assistant:"}),r.jsxs("select",{value:(o==null?void 0:o.id)||"",onChange:me=>te(me.target.value),className:"border rounded-lg px-3 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-amber-400 min-w-[180px]",children:[r.jsx("option",{value:"",children:"— Select an assistant —"}),e.map(me=>r.jsx("option",{value:me.id,children:me.name},me.id))]})]}),o&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Br,{className:"w-3.5 h-3.5 text-gray-400"}),r.jsxs("select",{value:z,onChange:me=>_e(me.target.value),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-amber-400 min-w-[160px]",children:[r.jsx("option",{value:"new",children:"+ New conversation"}),P.map(me=>r.jsx("option",{value:me.id,children:me.title||new Date(me.started_at).toLocaleString()},me.id))]})]}),o&&r.jsx("button",{onClick:Me,title:"New conversation",className:"p-1.5 rounded-lg hover:bg-red-50 transition-colors text-gray-400 hover:text-red-500",children:r.jsx(ln,{className:"w-4 h-4"})}),o&&r.jsx("button",{onClick:Ve,title:"Refresh user profile",className:"p-1.5 rounded-lg hover:bg-gray-100 transition-colors text-gray-400 hover:text-gray-600",children:r.jsx(Rn,{className:"w-4 h-4"})})]})]}),o?U?r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:U==="chat"?We:tt}):r.jsxs("div",{ref:ne,className:"flex-1 flex min-h-0 overflow-hidden relative",children:[!M&&r.jsx("div",{className:"flex flex-col min-h-0 border-r border-gray-200 overflow-hidden",style:{width:q?"100%":`${V}%`},children:We}),!M&&!q&&r.jsx("div",{onMouseDown:ie,className:"w-1.5 bg-gray-200 hover:bg-amber-400 cursor-col-resize shrink-0 transition-colors active:bg-amber-500 z-10",title:"Drag to resize"}),M&&r.jsxs("button",{onClick:()=>G(!1),className:"flex flex-col items-center justify-center gap-2 w-8 border-r border-gray-200 bg-gray-50 hover:bg-amber-50 text-gray-400 hover:text-amber-600 transition-colors shrink-0",title:"Show chat",children:[r.jsx(t2,{className:"w-4 h-4"}),r.jsx("span",{className:"text-[9px] font-semibold rotate-90 tracking-wider uppercase",children:"Chat"})]}),!q&&r.jsx("div",{className:"flex flex-col min-h-0 overflow-hidden",style:{width:M?"100%":`${100-V}%`},children:tt}),q&&r.jsxs("button",{onClick:()=>F(!1),className:"flex flex-col items-center justify-center gap-2 w-8 border-l border-gray-200 bg-gray-50 hover:bg-amber-50 text-gray-400 hover:text-amber-600 transition-colors shrink-0",title:"Show debug",children:[r.jsx(n2,{className:"w-4 h-4"}),r.jsx("span",{className:"text-[9px] font-semibold rotate-90 tracking-wider uppercase",children:"Debug"})]})]}):r.jsx("div",{className:"flex-1 flex items-center justify-center text-center text-gray-400 p-8",children:r.jsxs("div",{children:[r.jsx(ur,{className:"w-12 h-12 text-amber-200 mx-auto mb-4"}),r.jsx("p",{className:"font-medium text-gray-600",children:"Select an Investigation assistant to begin"}),r.jsx("p",{className:"text-sm mt-1",children:'Only assistants of type "Investigation" are shown.'}),e.length===0&&r.jsxs("p",{className:"text-sm mt-2 text-amber-600",children:["No investigation assistants found. Create one in ",r.jsx(wt,{to:yt("Assistants"),className:"underline",children:"Assistants"}),"."]})]})})]})}const cB={profile:"bg-indigo-50 text-indigo-700 border-indigo-200",interest:"bg-emerald-50 text-emerald-700 border-emerald-200",knowledge:"bg-violet-50 text-violet-700 border-violet-200"};function vAe({inv:e,onDelete:t,onToggleStatus:n,onMoveClick:s}){var f;const[a,i]=h.useState(!1),o=e.status!=="inactive",l=e.data&&Object.keys(e.data).length>0,c=l?Object.keys(e.data).length:0;async function d(m){m.preventDefault(),i(!0),await n(e),i(!1)}return r.jsxs("div",{className:"bg-white border rounded-xl overflow-hidden shadow-sm hover:shadow-md transition-all flex flex-col",children:[r.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-start gap-3",children:[e.icon_url?r.jsx("img",{src:e.icon_url,alt:"",className:"w-10 h-10 rounded-xl object-contain border bg-gray-50 shrink-0 shadow-sm"}):r.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center shrink-0 ${((f=cB[e.type])==null?void 0:f.split(" ")[0])||"bg-gray-100"}`,children:r.jsx(si,{className:"w-5 h-5 opacity-60"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r.jsx("span",{className:"font-semibold text-sm text-gray-900 truncate",children:e.name}),!o&&r.jsx("span",{className:"text-[10px] bg-gray-100 text-gray-400 border border-gray-200 px-1.5 py-0.5 rounded-full",children:"inactive"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 flex-wrap",children:[e.investigationKey&&r.jsx("span",{className:"text-[10px] font-mono bg-gray-100 text-gray-500 px-1.5 py-0.5 rounded",children:e.investigationKey}),r.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border font-medium ${cB[e.type]||"bg-gray-50 text-gray-500"}`,children:e.type})]}),e.description&&r.jsx("p",{className:"text-xs text-gray-500 mt-1 line-clamp-2",children:e.description})]})]}),r.jsxs("div",{className:"px-4 pb-3 mt-auto flex items-center justify-between gap-2 border-t pt-2.5",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400",children:[l&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ys,{className:"w-3 h-3"}),c," field",c!==1?"s":""]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Lm,{className:"w-3 h-3"}),new Date(e.created_date).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>s(e),title:"Move to library",className:"text-gray-300 hover:text-violet-500 p-1.5 rounded-lg hover:bg-violet-50 transition-colors",children:r.jsx(Jp,{className:"w-4 h-4"})}),r.jsx("button",{onClick:d,disabled:a,title:o?"Set inactive":"Set active",className:`transition-colors p-1.5 rounded-lg ${o?"text-emerald-500 hover:bg-emerald-50":"text-gray-300 hover:bg-gray-100 hover:text-gray-500"}`,children:a?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):o?r.jsx(i7,{className:"w-5 h-5"}):r.jsx(a7,{className:"w-5 h-5"})}),r.jsx(wt,{to:yt(`InvestigationEdit?id=${e.id}`),children:r.jsx("button",{className:"text-gray-300 hover:text-indigo-500 p-1.5 rounded-lg hover:bg-indigo-50 transition-colors",children:r.jsx(ra,{className:"w-4 h-4"})})}),r.jsx("button",{onClick:()=>t(e),className:"text-gray-300 hover:text-red-500 p-1.5 rounded-lg hover:bg-red-50 transition-colors",children:r.jsx(un,{className:"w-4 h-4"})})]})]})]})}function wAe(){var k;const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState(!0),[o,l]=h.useState(!1),[c,d]=h.useState(()=>localStorage.getItem("libsel_investigations")||"all");function f(S){d(S),localStorage.setItem("libsel_investigations",S)}const[m,g]=h.useState(null);h.useEffect(()=>{x()},[]);async function x(){const[S,A]=await Promise.all([Y.entities.Investigation.list("-created_date"),Y.entities.Library.list("name")]);t(S),s(A),i(!1)}async function j(S){confirm(`Delete "${S.name}"?`)&&(await Y.entities.Investigation.delete(S.id),t(A=>A.filter(T=>T.id!==S.id)))}async function b(S){const A=S.status==="active"?"inactive":"active";await Y.entities.Investigation.update(S.id,{status:A}),t(T=>T.map(R=>R.id===S.id?{...R,status:A}:R))}async function y(S){await Y.entities.Investigation.update(m.id,{library_id:S}),t(A=>A.map(T=>T.id===m.id?{...T,library_id:S}:T)),g(null)}const w=o?e:e.filter(S=>S.status!=="inactive"),_=c==="all"?w:c==="none"?w.filter(S=>!S.library_id):w.filter(S=>S.library_id===c),N=e.filter(S=>S.status==="inactive").length,C={__all__:w.length,__none__:w.filter(S=>!S.library_id).length,...Object.fromEntries(n.map(S=>[S.id,w.filter(A=>A.library_id===S.id).length]))};return a?r.jsxs("div",{className:"p-8 text-center text-gray-400",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading..."]}):r.jsxs("div",{className:"flex h-full min-h-0",children:[r.jsx(zb,{libraries:n,selected:c,onSelect:f,counts:C,onLibrariesChange:s,storageKey:"investigations",onItemsUnassigned:S=>{t(A=>A.map(T=>T.library_id===S?{...T,library_id:""}:T)),c===S&&f("all")}}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs("div",{className:"p-6 max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx("div",{className:"w-11 h-11 rounded-xl bg-violet-50 flex items-center justify-center shadow-sm",children:r.jsx(si,{className:"w-6 h-6 text-violet-600"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:c==="all"?"All Investigations":c==="none"?"Uncategorized":((k=n.find(S=>S.id===c))==null?void 0:k.name)||"Investigations"}),r.jsxs("p",{className:"text-sm text-gray-500",children:[_.length," showing"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[N>0&&r.jsxs("button",{onClick:()=>l(S=>!S),className:`flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-lg border transition-colors
989                    ${o?"bg-gray-200 text-gray-700 border-gray-300":"bg-white text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:[o?r.jsx($m,{className:"w-3.5 h-3.5"}):r.jsx(Ts,{className:"w-3.5 h-3.5"}),o?"Hide":"Show"," inactive (",N,")"]}),r.jsx(wt,{to:yt("InvestigationEdit"),children:r.jsxs(de,{className:"gap-2",children:[r.jsx(ln,{className:"w-4 h-4"})," New"]})})]})]}),_.length===0?r.jsxs("div",{className:"text-center py-16 text-gray-400 border-2 border-dashed rounded-2xl",children:[r.jsx(si,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No investigations here."})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:_.map(S=>r.jsx(vAe,{inv:S,onDelete:j,onToggleStatus:b,onMoveClick:g},S.id))})]})}),m&&r.jsx(Ub,{itemName:m.name,libraries:n,currentLibraryId:m.library_id||"",onMove:y,onClose:()=>g(null)})]})}function jAe(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Array(12).fill(0);let m5=1;class _Ae{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>
vendor: 3,675 bytes, line 989
989{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:s,...a}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:m5++,o=this.toasts.find(c=>c.id===i),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:s}),{...c,...t,id:i,dismissible:l,title:s}):c):this.addToast({title:s,...a,dismissible:l,id:i}),i},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let i=s!==void 0,o;const l=a.then(async d=>{if(o=["resolve",d],xe.isValidElement(d))i=!1,this.create({id:s,type:"default",message:d});else if(SAe(d)&&!d.ok){i=!1;const m=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,g=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,j=typeof m=="object"&&!xe.isValidElement(m)?m:{message:m};this.create({id:s,type:"error",description:g,...j})}else if(d instanceof Error){i=!1;const m=typeof n.error=="function"?await n.error(d):n.error,g=typeof n.description=="function"?await n.description(d):n.description,j=typeof m=="object"&&!xe.isValidElement(m)?m:{message:m};this.create({id:s,type:"error",description:g,...j})}else if(n.success!==void 0){i=!1;const m=typeof n.success=="function"?await n.success(d):n.success,g=typeof n.description=="function"?await n.description(d):n.description,j=typeof m=="object"&&!xe.isValidElement(m)?m:{message:m};this.create({id:s,type:"success",description:g,...j})}}).catch(async d=>{if(o=["reject",d],n.error!==void 0){i=!1;const f=typeof n.error=="function"?await n.error(d):n.error,m=typeof n.description=="function"?await n.description(d):n.description,x=typeof f=="object"&&!xe.isValidElement(f)?f:{message:f};this.create({id:s,type:"error",description:m,...x})}}).finally(()=>{i&&(this.dismiss(s),s=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((d,f)=>l.then(()=>o[0]==="reject"?f(o[1]):d(o[1])).catch(f));return typeof s!="string"&&typeof s!="number"?{unwrap:c}:Object.assign(s,{unwrap:c})},this.custom=(t,n)=>{const s=(n==null?void 0:n.id)||m5++;return this.create({jsx:t(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Ua=new _Ae,NAe=(e,t)=>{const n=(t==null?void 0:t.id)||m5++;return Ua.addToast({title:e,...t,id:n}),n},SAe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",kAe=NAe,CAe=()=>Ua.toasts,EAe=()=>Ua.getActiveToasts(),Js=Object.assign(kAe,{success:Ua.success,info:Ua.info,warning:Ua.warning,error:Ua.error,custom:Ua.custom,message:Ua.message,promise:Ua.promise,dismiss:Ua.dismiss,loading:Ua.loading},{getHistory:CAe,getToasts:EAe});jA
vendor: 4,788 bytes, line 989
989e("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;
vendor: 10,077 bytes, line 989
989left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
989const AAe={text:ns,html:O0,pdf:ZZ,url:Qp,url_with_video:$0,url_with_podcast:$0},dB={text:"bg-blue-50 text-blue-600 border-blue-100",html:"bg-orange-50 text-orange-600 border-orange-100",pdf:"bg-red-50 text-red-600 border-red-100",url:"bg-green-50 text-green-600 border-green-100",url_with_video:"bg-purple-50 text-purple-600 border-purple-100",url_with_podcast:"bg-amber-50 text-amber-600 border-amber-100"},uB={youtube:"bg-red-50 text-red-600 border-red-200",vimeo:"bg-sky-50 text-sky-600 border-sky-200",wistia:"bg-blue-50 text-blue-600 border-blue-200",spotify:"bg-green-50 text-green-600 border-green-200",soundcloud:"bg-orange-50 text-orange-600 border-orange-200",buzzsprout:"bg-yellow-50 text-yellow-700 border-yellow-200",mp3:"bg-gray-50 text-gray-600 border-gray-200",other:"bg-gray-50 text-gray-600 border-gray-200"};function Al({done:e,loading:t,onClick:n,icon:s,label:a,doneLabel:i,disabled:o,color:l="indigo",title:c}){const d={indigo:{done:"bg-indigo-600 text-white border-indigo-600 hover:bg-indigo-700",pending:"bg-white text-indigo-700 border-indigo-200 hover:bg-indigo-50"},emerald:{done:"bg-emerald-600 text-white border-emerald-600 hover:bg-emerald-700",pending:"bg-white text-emerald-700 border-emerald-200 hover:bg-emerald-50"},blue:{done:"bg-blue-600 text-white border-blue-600 hover:bg-blue-700",pending:"bg-white text-blue-700 border-blue-200 hover:bg-blue-50"},violet:{done:"bg-violet-600 text-white border-violet-600 hover:bg-violet-700",pending:"bg-white text-violet-700 border-violet-200 hover:bg-violet-50"},teal:{done:"bg-teal-600 text-white border-teal-600 hover:bg-teal-700",pending:"bg-white text-teal-700 border-teal-200 hover:bg-teal-50"},cyan:{done:"bg-cyan-600 text-white border-cyan-600 hover:bg-cyan-700",pending:"bg-white text-cyan-700 border-cyan-200 hover:bg-cyan-50"},orange:{done:"bg-orange-500 text-white border-orange-500 hover:bg-orange-600",pending:"bg-white text-orange-700 border-orange-200 hover:bg-orange-50"},gray:{done:"bg-gray-600 text-white border-gray-600 hover:bg-gray-700",pending:"bg-white text-gray-600 border-gray-200 hover:bg-gray-100"}},f=e?d[l].done:d[l].pending;return r.jsxs("button",{onClick:n,disabled:o||t,title:c||(e?i||`Re-${a}`:a),className:`flex items-center gap-1 px-2.5 py-1.5 rounded border text-xs font-medium transition-colors disabled:opacity-50 ${f}`,children:[t?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):e?r.jsx(Bd,{className:"w-3 h-3"}):r.jsx(s,{className:"w-3 h-3"}),e&&i||a]})}function t0({onClick:e,icon:t,label:n,color:s="gray",title:a}){const i={gray:"text-gray-600 border-gray-200 hover:bg-gray-100",indigo:"text-indigo-600 border-indigo-200 hover:bg-indigo-50",red:"text-red-600 border-red-200 hover:bg-red-50"};return r.jsxs("button",{onClick:e,title:a||n,className:`flex items-center gap-1 px-2.5 py-1.5 rounded border text-xs font-medium bg-white transition-colors ${i[s]}`,children:[r.jsx(t,{className:"w-3 h-3"}),n]})}function TAe({item:e,kbId:t,kb:n,chunkCounts:s,localVecCounts:a,rechunkingItem:i,summarizingItem:o,extractingCC:l,summarizingCC:c,embeddingItem:d,vectorizingItem:f,onEdit:m,onDelete:g,onViewChunks:x,onChunk:j,onSummarize:b,onExtractCC:y,onSummarizeCC:w,onReextract:_,onReextractTitle:N,onVectorize:C,onLocalEmbed:k,onViewSupabaseDocs:S,onMove:A,onReprocess:T,reprocessingItem:R}){const B=AAe[e.source_type]||ns,D=s[e.id]||0,P=a[e.id]||0,I=e.supabase_doc_count||0,z=e.content||"",L=!z&&e.char_count===0,H=e.source_type==="url"||e.source_type==="url_with_video"||e.source_type==="url_with_podcast",W=e.media_links&&e.media_links.length>0,V=!!e.cc_file_url,K=!!e.human_summary,M=D>0,G=P>0,q=I>0,F=I>0&&D>0&&I<D;return r.jsxs("div",{className:"border rounded-xl bg-white overflow-hidden hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:`px-5 py-3 border-b flex items-center gap-3 ${L?"bg-yellow-50 border-yellow-100":"bg-gray-50 border-gray-200"}`,children:[r.jsx("div",{className:`p-2.5 rounded-lg shrink-0 ${dB[e.source_type]||dB.text}`,children:r.jsx(B,{className:"w-4 h-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-semibold text-gray-900 truncate",children:e.title}),r.jsxs("div",{className:"flex gap-1.5 flex-wrap items-center mt-1",children:[L?r.jsx("span",{className:"text-[10px] font-semibold bg-amber-100 text-amber-700 border border-amber-200 rounded px-1.5 py-0.5",children:"Empty"}):r.jsxs("span",{className:"text-[10px] font-medium bg-gray-100 text-gray-500 border border-gray-200 rounded px-1.5 py-0.5",children:[(e.char_count||0).toLocaleStr
989ing()," chars"]}),W&&(V?r.jsxs("span",{className:"text-[10px] font-semibold bg-teal-100 text-teal-700 border border-teal-200 rounded px-1.5 py-0.5",children:["✓ CC ",(e.cc_char_count||0).toLocaleString()," chars"]}):r.jsx("span",{className:"text-[10px] font-medium bg-gray-100 text-gray-500 border border-gray-200 rounded px-1.5 py-0.5",children:"no CC"})),K?r.jsx("span",{className:"text-[10px] font-semibold bg-blue-100 text-blue-700 border border-blue-200 rounded px-1.5 py-0.5",children:"✓ summarized"}):r.jsx("span",{className:"text-[10px] font-medium bg-amber-100 text-amber-700 border border-amber-200 rounded px-1.5 py-0.5",children:"not summarized"}),M?r.jsxs("span",{className:"text-[10px] font-semibold bg-indigo-100 text-indigo-700 border border-indigo-200 rounded px-1.5 py-0.5",children:["✓ ",D," chunks"]}):r.jsx("span",{className:"text-[10px] font-semibold bg-amber-100 text-amber-700 border border-amber-200 rounded px-1.5 py-0.5",children:"unchunked"}),G&&r.jsxs("span",{className:`text-[10px] font-semibold border rounded px-1.5 py-0.5 ${P===D&&D>0?"bg-emerald-100 text-emerald-700 border-emerald-200":"bg-amber-100 text-amber-700 border-amber-200"}`,children:["✓ ",P,"/",D," emb"]}),q?r.jsx("span",{className:`text-[10px] font-semibold border rounded px-1.5 py-0.5 ${F?"bg-red-100 text-red-700 border-red-200":"bg-orange-100 text-orange-700 border-orange-200"}`,children:F?`⚠ ${I}/${D} vecs`:`✓ ${I} vecs`}):r.jsx("span",{className:"text-[10px] font-medium bg-gray-100 text-gray-400 border border-gray-200 rounded px-1.5 py-0.5",children:"no vecs"}),e.status==="processing"&&r.jsx(Pe,{className:"w-3 h-3 animate-spin text-amber-500"}),e.status==="error"&&r.jsx(fr,{className:"w-3.5 h-3.5 text-red-500"}),e.status==="ready"&&!L&&r.jsx(Bd,{className:"w-3.5 h-3.5 text-emerald-500"})]})]})]}),r.jsxs("div",{className:"px-5 py-3 space-y-2.5",children:[e.url&&r.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-500 hover:underline truncate block",children:e.url}),z&&r.jsx("div",{className:"bg-gray-50 rounded-lg p-2.5 text-xs text-gray-600 font-mono line-clamp-2",children:z.slice(0,250)}),(e.human_summary||e.semantic_summary)&&r.jsxs("div",{className:"space-y-1",children:[e.human_summary&&r.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded-lg p-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[r.jsx("p",{className:"text-[10px] font-semibold text-blue-500",children:"Human Summary"}),r.jsxs("span",{className:"text-[10px] text-blue-400 font-mono",children:[e.human_summary.length.toLocaleString()," chars"]})]}),r.jsx("p",{className:"text-xs text-blue-800 line-clamp-2",children:e.human_summary})]}),e.semantic_summary&&r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-lg p-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[r.jsx("p",{className:"text-[10px] font-semibold text-violet-500",children:"Semantic Summary"}),r.jsxs("span",{className:"text-[10px] text-violet-400 font-mono",children:[e.semantic_summary.length.toLocaleString()," chars"]})]}),r.jsx("p",{className:"text-xs text-violet-800 line-clamp-2",children:e.semantic_summary})]})]}),W&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-purple-500 flex items-center gap-1",children:[r.jsx($0,{className:"w-3 h-3"})," ",e.media_links.length," Media Link",e.media_links.length!==1?"s":""]}),e.media_links.map((U,ee)=>r.jsxs("div",{className:`border rounded-lg px-3 py-1.5 flex items-center gap-2 flex-wrap ${U.media_type==="audio"?"bg-amber-50 border-amber-100":"bg-purple-50 border-purple-100"}`,children:[r.jsx("span",{className:`text-[10px] font-bold border px-1.5 py-0.5 rounded uppercase tracking-wide ${uB[U.platform]||uB.other}`,children:U.platform}),U.media_id&&r.jsx("span",{className:"text-[10px] font-mono text-gray-500",children:U.media_id}),U.channel&&r.jsx("span",{className:"text-[10px] text-gray-600",children:U.channel}),U.has_closed_captions?r.jsx("span",{className:"text-[10px] font-semibold text-emerald-700 bg-emerald-50 border border-emerald-200 rounded px-1.5 py-0.5",children:"CC ✓"}):r.jsx("span",{className:"text-[10px] text-gray-400 bg-gray-50 border border-gray-200 rounded px-1.5 py-0.5",children:"No CC"}),r.jsx("a",{href:U.url,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-purple-600 hover:underline ml-auto truncate max-w-[180px]",children:U.url})]},ee))]}),(e.cc_human_summary||e.cc_semantic_summary)&&r.jsx("div",{className:"space-y-1",children:e.cc_human_summary&&r.jsxs("div",{className:"bg-cyan-50 border border-cyan-100 rounded-lg p-2.5",children:[r.jsx("p",{className:"text-[10px] font-semibold text-cyan-600 mb-0.5",children:"CC Human Summary"}),r.jsx("p",{className:"text-xs text-cyan-800 line-clamp-2",children:e.cc_human_summary})]})}),e.statistics&&Object.keys(e.statistics).length>0&&r.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg px-3 py-2",children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide mb-1",children:"Statistics"}),r.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-0.5",children:Object.entries(e.statistics).map(([U,ee])=>r.jsxs("span",{className:"text-[11px] text-gray-600",children:[r.jsxs("span",{className:"text-gray-400 font-medium",children:[U,":"]})," ",r.jsx("span",{className:"font-mono font-semibold",children:typeof ee=="number"?ee.toLocaleStr
989ing():String(ee)})]},U))})]}),r.jsxs("div",{className:"text-[11px] text-gray-400",children:["Created ",new Date(e.created_date).toLocaleString(),e.updated_date&&e.updated_date!==e.created_date&&r.jsxs(r.Fragment,{children:[" • Updated ",new Date(e.updated_date).toLocaleString()]})]})]}),r.jsx("div",{className:"px-5 py-3 bg-gray-50 border-t",children:r.jsxs("div",{className:"flex gap-2 items-stretch",children:[r.jsxs("button",{onClick:()=>m(e),className:"flex flex-col items-center justify-center gap-1 px-5 rounded border text-sm font-semibold bg-white text-gray-700 border-gray-300 hover:bg-gray-100 transition-colors shrink-0",children:[r.jsx(ra,{className:"w-4 h-4"}),"Edit"]}),r.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex gap-1.5 flex-wrap items-center",children:[H&&r.jsxs(r.Fragment,{children:[r.jsx(Al,{done:!L,color:"blue",icon:Rn,label:"Extract",doneLabel:"Re-extract",onClick:()=>_(e),title:"Re-extract content from URL"}),r.jsx(Al,{done:!!e.title,color:"blue",icon:Rn,label:"Extract Title",doneLabel:"Re-extract Title",onClick:()=>N(e),title:"Re-extract page title"})]}),W&&r.jsx(Al,{done:V,color:"teal",icon:Rn,label:"Extract CC",doneLabel:"Re-extract CC",loading:l===e.id,onClick:()=>y(e),title:V?"Re-extract closed captions":"Extract closed captions from media"}),V&&r.jsx(Al,{done:!!e.cc_human_summary,color:"cyan",icon:Yn,label:"Summarize CC",doneLabel:"Re-summarize CC",loading:c===e.id,onClick:()=>w(e)}),r.jsx(Al,{done:K,color:"violet",icon:Yn,label:"Summarize",doneLabel:"Re-summarize",loading:o===e.id,onClick:()=>b(e)}),r.jsx(Al,{done:M,color:"indigo",icon:Nb,label:"Chunk",doneLabel:"Re-chunk",loading:i===e.id,onClick:()=>j(e)}),r.jsx(Al,{done:G,color:"emerald",icon:zn,label:"Embed",doneLabel:"Re-embed",loading:d===e.id,onClick:()=>k(e),title:G?`Re-embed locally (${P}/${D} done)`:"Queue local embedding"}),r.jsx(Al,{done:q,color:"orange",icon:zn,label:"Vectorize",doneLabel:"Re-vectorize",loading:f===e.id,onClick:()=>C(e),title:q?`Re-vectorize (${I} stored)`:"Queue vectorization to Supabase"})]}),r.jsx("div",{className:"flex gap-1.5 items-center",children:r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx(t0,{icon:Ts,label:"View Chunks",onClick:()=>x(e),title:"View chunks"}),r.jsx(t0,{icon:_n,label:"Supabase",onClick:()=>S(e),title:"View Supabase docs"}),r.jsxs("button",{onClick:()=>T(e),disabled:R===e.id,title:"Re-process all steps for this item",className:`flex items-center gap-1 px-2.5 py-1.5 rounded border text-xs font-medium bg-white transition-colors ${R===e.id?"text-gray-400 border-gray-200 opacity-60 cursor-wait":"text-indigo-600 border-indigo-200 hover:bg-indigo-50"}`,children:[R===e.id?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Dr,{className:"w-3 h-3"}),"Re-process"]})]})})]}),r.jsxs("div",{className:"flex flex-col gap-1.5 justify-center shrink-0",children:[r.jsx(t0,{icon:e7,label:"Move",onClick:()=>A(e),color:"indigo"}),r.jsx(t0,{icon:un,label:"Delete",onClick:()=>g(e),color:"red"})]})]})})]})}var PAe=yb[" useId ".trim().toString()]||(()=>{}),OAe=0;function Fs(e){const[t,n]=h.useState(PAe());return xs(()=>{n(s=>s??String(OAe++))},[e]),t?`radix-${t}`:""}var uk="rovingFocusGroup.onEntryFocus",IAe={bubbles:!1,cancelable:!0},yg="RovingFocusGroup",[f5,EV,RAe]=vb(yg),[MAe,AV]=Ti(yg,[RAe]),[DAe,LAe]=MAe(yg),TV=h.forwardRef((e,t)=>r.jsx(f5.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(f5.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx($Ae,{...e,ref:t})})}));TV.displayName=yg;var $Ae=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...m}=e,g=h.useRef(null),x=xn(t,g),j=Mb(i),[b,y]=so({prop:o,defaultProp:l??null,onChange:c,caller:yg}),[w,_]=h.useState(!1),N=ti(d),C=EV(n),k=h.useRef(!1),[S,A]=h.useState(0);return h.useEffect(()=>{const T=g.current;if(T)return T.addEventListener(uk,N),()=>T.removeEventListener(uk,N)},[N]),r.jsx(DAe,{scope:n,orientation:s,dir:j,loop:a,currentTabStopId:b,onItemFocus:h.useCallback(T=>y(T),[y]),onItemShiftTab:h.useCallback(()=>_(!0),[]),onFocusableItemAdd:h.useCallback(()=>A(T=>T+1),[]),onFocusableItemRemove:h.useCallback(()=>A(T=>T-1),[]),children:r.jsx(Mt.div,{tabIndex:w||S===0?-1:0,"data-orientation":s,...m,ref:x,style:{outline:"none",...e.style},onMouseDown:Rt(e.onMouseDown,()=>{k.current=!0}),onFocus:Rt(e.onFocus,T=>{const R=!k.current;if(T.target===T.currentTarget&&R&&!w){const B=new CustomEvent(uk,IAe);if(T.currentTarget.dispatchEvent(B),!B.defaultPrevented){const D=C().filter(H=>H.focusable),P=D.find(H=>H.active),I=D.find(H=>
vendor: 4,748 bytes, line 989
989H.id===b),L=[P,I,...D].filter(Boolean).map(H=>H.ref.current);IV(L,f)}}k.current=!1}),onBlur:Rt(e.onBlur,()=>_(!1))})})}),PV="RovingFocusGroupItem",OV=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:i,children:o,...l}=e,c=Fs(),d=i||c,f=LAe(PV,n),m=f.currentTabStopId===d,g=EV(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:b}=f;return h.useEffect(()=>{if(s)return x(),()=>j()},[s,x,j]),r.jsx(f5.ItemSlot,{scope:n,id:d,focusable:s,active:a,children:r.jsx(Mt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Rt(e.onMouseDown,y=>{s?f.onItemFocus(d):y.preventDefault()}),onFocus:Rt(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Rt(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const w=zAe(y,f.orientation,f.dir);if(w!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let N=g().filter(C=>C.focusable).map(C=>C.ref.current);if(w==="last")N.reverse();else if(w==="prev"||w==="next"){w==="prev"&&N.reverse();const C=N.indexOf(y.currentTarget);N=f.loop?UAe(N,C+1):N.slice(C+1)}setTimeout(()=>IV(N))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:b!=null}):o})})});OV.displayName=PV;var BAe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function FAe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zAe(e,t,n){const s=FAe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return BAe[s]}function IV(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function UAe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var qAe=TV,KAe=OV,_v="Tabs",[VAe]=Ti(_v,[AV]),RV=AV(),[HAe,zA]=VAe(_v),MV=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...d}=e,f=Mb(l),[m,g]=so({prop:s,onChange:a,defaultProp:i??"",caller:_v});return r.jsx(HAe,{scope:n,baseId:Fs(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:c,children:r.jsx(Mt.div,{dir:f,"data-orientation":o,...d,ref:t})})});MV.displayName=_v;var DV="TabsList",LV=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,i=zA(DV,n),o=RV(n);return r.jsx(qAe,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:r.jsx(Mt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});LV.displayName=DV;var $V="TabsTrigger",BV=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...i}=e,o=zA($V,n),l=RV(n),c=UV(o.baseId,s),d=qV(o.baseId,s),f=s===o.value;return r.jsx(KAe,{asChild:!0,...l,focusable:!a,active:f,children:r.jsx(Mt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:t,onMouseDown:Rt(e.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(s):m.preventDefault()}),onKeyDown:Rt(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(s)}),onFocus:Rt(e.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(s)})})})});BV.displayName=$V;var FV="TabsContent",zV=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:i,...o}=e,l=zA(FV,n),c=UV(l.baseId,s),d=qV(l.baseId,s),f=s===l.value,m=h.useRef(f);return h.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),r.jsx(Xo,{present:a||f,children:({present:g})=>r.jsx(Mt.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});zV.displayName=FV;function UV(e,t){return`${e}-trigger-${t}`}function qV(e,t){return`${e}-content-${t}`}var WAe=MV,KV=LV,VV=BV,HV=zV;const WV=WAe,UA=h.forwardRef(({className:e,...t},n)=>r.jsx(KV,{ref:n,className:rn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));UA.displayName=KV.displayName;const Hl=h.forwardRef(({className:e,...t},n)=>r.jsx(VV,{ref:n,className:rn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 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",e),...t}));Hl.displayName=VV.displayName;
989const k0=h.forwardRef(({className:e,...t},n)=>r.jsx(HV,{ref:n,className:rn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));k0.displayName=HV.displayName;function GAe({kbId:e,onSave:t,onCancel:n}){const[s,a]=h.useState("text"),[i,o]=h.useState(""),[l,c]=h.useState(""),[d,f]=h.useState(""),[m,g]=h.useState(null),[x,j]=h.useState(!1),[b,y]=h.useState(!1),[w,_]=h.useState(""),[N,C]=h.useState(!1),[k,S]=h.useState(!1),[A,T]=h.useState(""),[R,B]=h.useState(null);async function D(){y(!0);let L=`${w.trim()||"Improve and clean up this content for use in a knowledge base. Fix grammar, improve clarity, and structure it well."}
990
991`;i.trim()&&(L+=`Title: ${i.trim()}
992
993`),l.trim()&&(L+=`Current content:
994${l.trim()}
995
996`),L+="IMPORTANT: Return only plain text with no markdown, no formatting, no bold, no italic, no code blocks. Just clean prose.";const H=await Y.integrations.Core.InvokeLLM({prompt:L});c(H||l),y(!1),C(!1),_("")}async function P(){var H;if(!d.trim())return;S(!0);const z=await Y.functions.invoke("scrapeUrl",{url:d}),L=((H=z==null?void 0:z.data)==null?void 0:H.text)||"";T(L),B(new Date),S(!1)}async function I(){var W;if(!i.trim())return;j(!0);let z=null,L="",H=0;if(s==="pdf"&&m){const{file_url:V}=await Y.integrations.Core.UploadFile({file:m});z=V;const K=await Y.integrations.Core.ExtractDataFromUploadedFile({file_url:V,json_schema:{type:"object",properties:{full_text:{type:"string",description:"All text content from the document"}}}});L=((W=K==null?void 0:K.output)==null?void 0:W.full_text)||"",H=L.length}else if(s==="url"&&d){L=A,H=L.length;const V=new Blob([L],{type:"text/plain"}),K=new File([V],"extracted.txt",{type:"text/plain"}),{file_url:M}=await Y.integrations.Core.UploadFile({file:K});z=M,L=""}else if(L=l,H=l.length,L.length>5e4){const V=new Blob([L],{type:"text/plain"}),K=new File([V],"content.txt",{type:"text/plain"}),{file_url:M}=await Y.integrations.Core.UploadFile({file:K});z=M,L=""}await Y.entities.KnowledgeItem.create({knowledge_base_id:e,title:i.trim(),source_type:s,content:s==="text"?l:"",file_url:z,url:s==="url"?d:"",extracted_text:L,char_count:H,status:"ready"}),j(!1),t()}return r.jsxs("div",{className:"flex flex-col h-full bg-gray-50",children:[r.jsxs("div",{className:"bg-white border-b px-6 py-3 flex items-center gap-3 shrink-0",children:[r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-700 transition-colors",children:r.jsx(or,{className:"w-5 h-5"})}),r.jsx("h2",{className:"font-semibold text-lg text-gray-900",children:"Add Knowledge Item"}),r.jsxs("div",{className:"ml-auto flex gap-2",children:[r.jsx(de,{variant:"ghost",onClick:n,disabled:x,children:"Cancel"}),r.jsx(de,{onClick:I,disabled:x||!i.trim()||s==="url"&&!A,children:x?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin mr-2"}),"Processing..."]}):"Save Item"})]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 max-w-3xl mx-auto w-full space-y-5",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(ot,{children:"Title"}),r.jsx(It,{value:i,onChange:z=>o(z.target.value),placeholder:"Item title",className:"text-base"})]}),r.jsxs(WV,{value:s,onValueChange:a,children:[r.jsxs(UA,{className:"grid grid-cols-3 w-full",children:[r.jsx(Hl,{value:"text",children:"Text"}),r.jsx(Hl,{value:"pdf",children:"PDF"}),r.jsx(Hl,{value:"url",children:"URL"})]}),r.jsxs(k0,{value:"text",className:"mt-4 space-y-3",children:[r.jsx(rr,{value:l,onChange:z=>c(z.target.value),rows:16,placeholder:"Paste or type your text content here...",className:"font-mono text-sm resize-none"}),r.jsxs("div",{className:"border rounded-xl overflow-hidden bg-white shadow-sm",children:[r.jsxs("button",{type:"button",onClick:()=>C(z=>!z),className:"w-full flex items-center gap-2 px-4 py-3 text-sm font-medium text-indigo-700 bg-indigo-50 hover:bg-indigo-100 transition-colors",children:[r.jsx(yd,{className:"w-4 h-4"}),l.trim()?"AI Improve / Edit Content":"AI Generate Content",N&&r.jsx(jt,{className:"w-3.5 h-3.5 ml-auto"})]}),N&&r.jsxs("div",{className:"p-4 space-y-3 bg-white border-t",children:[r.jsx(It,{value:w,onChange:z=>_(z.target.value),placeholder:l.trim()?'e.g. "Fix grammar and improve clarity" or "Summarize this"':'e.g. "Write a guide about cardiac ultrasound for beginners"',className:"text-sm"}),r.jsx(de,{onClick:D,disabled:b,className:"gap-1.5 w-full",children:b?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(yd,{className:"w-4 h-4"})," ",l.trim()?"Apply":"Generate"]})})]})]})]}),r.jsx(k0,{value:"pdf",className:"mt-4",children:r.jsxs("div",{className:"border-2 border-dashed rounded-xl p-10 text-center bg-white",children:[m?r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-base text-emerald-600 font-semibold",children:m.name}),r.jsxs("p",{className:"text-sm text-gray-400",children:[(m.size/1024).toFixed(0)," KB"]}
996)]}):r.jsxs(r.Fragment,{children:[r.jsx(G5,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),r.jsx("p",{className:"text-gray-500",children:"Click to upload a PDF file"})]}),r.jsx("input",{type:"file",accept:".pdf",onChange:z=>g(z.target.files[0]),style:{position:"relative",marginTop:"12px",display:"block",margin:"12px auto 0"}})]})}),r.jsxs(k0,{value:"url",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{value:d,onChange:z=>{f(z.target.value),T(""),B(null)},placeholder:"https://example.com/docs",className:"text-base flex-1"}),r.jsxs(de,{onClick:P,disabled:!d.trim()||k,variant:"outline",className:"gap-2 shrink-0",children:[k?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Rn,{className:"w-4 h-4"}),k?"Extracting...":"Extract"]})]}),R&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-emerald-600",children:[r.jsx(Bd,{className:"w-3.5 h-3.5"}),"Extracted at ",R.toLocaleTimeString()," — ",A.length.toLocaleString()," chars"]}),A&&r.jsxs("div",{className:"border rounded-xl bg-gray-50 p-3 max-h-48 overflow-y-auto",children:[r.jsx("p",{className:"text-xs font-medium text-gray-500 mb-2",children:"Preview"}),r.jsx("p",{className:"text-xs text-gray-600 whitespace-pre-wrap font-mono",children:A})]}),!A&&!k&&r.jsx("p",{className:"text-sm text-amber-600",children:"You must click Extract before saving."})]})]})]})]})}const YAe=[{label:"Clean & Remove Noise",prompt:"Clean this extracted text for use in a RAG knowledge base. Remove navigation menus, ads, cookie notices, footers, headers, repeated boilerplate, and any irrelevant page furniture. Preserve ALL meaningful content in high fidelity — do not summarize, paraphrase, or omit any substantive information. Keep the original wording, structure, and factual details intact.",use_internet:!1,sort_order:0},{label:"Remove Duplicates",prompt:"Remove duplicate or near-duplicate paragraphs and sentences from this text, keeping the first occurrence. Do not change or summarize any content — only remove repeated sections. Preserve the original wording of everything that is kept.",use_internet:!1,sort_order:1},{label:"Fix Structure",prompt:"Fix the paragraph and line-break structure of this extracted text. Merge broken sentences that were split across lines due to PDF or HTML extraction artifacts. Do not change the wording or remove any content. Preserve all original information faithfully.",use_internet:!1,sort_order:2},{label:"Fix Tables (AI + Live Page)",prompt:"You are an expert at converting HTML tables into clean Markdown tables for RAG knowledge bases. I will provide you with an extracted Markdown text that may have broken or missing tables, and the original source URL so you can cross-reference the live page. Your task: 1) Identify all table sections in the extracted text that are malformed, incomplete, or rendered as confusing flat text. 2) Using the live page as the source of truth, reconstruct each table into a clean, properly-formatted Markdown table with correct headers and all rows/columns intact. 3) Replace the broken table sections in the extracted text with the corrected Markdown tables. 4) Do NOT change any non-table content. 5) Return the full corrected text.",use_internet:!0,sort_order:3}];function JAe({text:e,onApply:t,sourceUrl:n}){const[s,a]=h.useState(!1),[i,o]=h.useState([]),[l,c]=h.useState(!1),[d,f]=h.useState(null),[m,g]=h.useState(""),[x,j]=h.useState(!1),[b,y]=h.useState(null),[w,_]=h.useState(null),[N,C]=h.useState(""),[k,S]=h.useState(""),[A,T]=h.useState(!1),[R,B]=h.useState(""),[D,P]=h.useState("");async function I(){c(!0);const U=await Y.entities.AiCleaningPrompt.list("sort_order",100);if(U.length===0){const ee=await Y.entities.AiCleaningPrompt.bulkCreate(YAe);o(ee)}else o(U);c(!1)}h.useEffect(()=>{s&&I()},[s]);const z=i.find(U=>U.id===d),L=z?z.prompt:m,H=(z==null?void 0:z.use_internet)===!0;async function W(){if(!L.trim()||!e.trim())return;j(!0),y(null);const U=H&&n?`
997Source URL (cross-reference the live page for table data): ${n}
998`:"",ee=H?"- For tables: output valid Markdown tables (| col | col | rows). Preserve all numeric and factual data exactly.":"- Return ONLY the cleaned/fixed plain text. No markdown, no formatting symbols, no code blocks.",ne=`${L.trim()}
999${U}
1000Original extracted text:
1001${e.trim()}
1002
1003IMPORTANT RULES:
1004${ee}
1005- Do NOT summarize or paraphrase — preserve original wording and factual content in full.
1006- Do NOT add explanations, preambles, or commentary.`,X=await Y.integrations.Core.InvokeLLM({prompt:ne,add_context_from_internet:H,model:H?"gemini_3_flash":void 0});y(X||e),j(!1)}function V(){t(b),y(null),a(!1)}function K(){y(null)}function M(U){_(U.id),C(U.label),S(U.prompt)}async function G(){await Y.entities.AiCleaningPrompt.update(w,{label:N,prompt:k}),o(U=>U.map(ee=>ee.id===w?{...ee,label:N,prompt:k}:ee)),_(null)}async function q(U){await Y.entities.AiCleaningPrompt.delete(U),o(ee=>ee.filter(ne=>ne.id!==U)),d===U&&f(null)}async function F(){if(!R.trim()||!D.trim())return;const U=await Y.entities.AiCleaningPrompt.create({label:R.trim(),prompt:D.trim(),use_internet:!1,sort_order:i.length});o(ee=>[...ee,U]),f(U.id),T(!1),B(""),P("")}return r.jsxs("div",{className:"border rounded-xl overflow-hidden bg-white shadow-sm",children:[r.jsxs("button",{type:"button",onClick:()=>{a(U=>!U),y(null)},className:"w-full flex items-center gap-2 px-4 py-3 text-sm font-medium text-indigo-700 bg-indigo-50 hover:bg-indigo-100 transition-colors",children:[r.jsx(yd,{className:"w-4 h-4"}),"AI Text Cleaning Assistant",s?r.jsx(jt,{className:"w-3.5 h-3.5 ml-auto"}):r.jsx(en,{className:"w-3.5 h-3.5 ml-auto"})]}),s&&r.jsxs("div",{className:"p-4 space-y-4 border-t",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Saved Prompts"}),r.jsxs("button",{onClick:()=>{T(!0),f(null),g("")},className:"flex items-center gap-1 text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:[r.jsx(ln,{className:"w-3 h-3"})," Add prompt"]})]}),l?r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 py-3",children:[r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"})," Loading prompts…"]}):r.jsxs("div",{className:"space-y-1.5",children:[i.map(U=>r.jsxs("div",{className:`rounded-lg border transition-colors ${d===U.id?"border-indigo-400 bg-indigo-50":"border-gray-200 bg-gray-50 hover:border-gray-300"}`,children:[w===U.id?r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsx("input",{value:N,onChange:ee=>C(ee.target.value),className:"w-full border rounded px-2 py-1 text-sm font-semibold focus:outline-none focus:ring-1 focus:ring-indigo-400",placeholder:"Prompt label"}),r.jsx(rr,{value:k,onChange:ee=>S(ee.target.value),rows:4,className:"text-xs resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:G,className:"flex items-center gap-1 text-xs bg-indigo-600 text-white px-3 py-1 rounded-lg hover:bg-indigo-700",children:[r.jsx(Tn,{className:"w-3 h-3"})," Save"]}),r.jsx("button",{onClick:()=>_(null),className:"text-xs text-gray-500 px-3 py-1 rounded-lg hover:bg-gray-100",children:"Cancel"})]})]}):r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer",onClick:()=>{f(U.id),g(""),y(null)},children:[r.jsx("span",{className:`w-3.5 h-3.5 rounded-full border-2 shrink-0 ${d===U.id?"border-indigo-600 bg-indigo-600":"border-gray-300"}`}),r.jsx("span",{className:"flex-1 text-sm font-medium text-gray-700",children:U.label}),U.use_internet&&r.jsx("span",{className:"text-[9px] font-bold text-sky-700 bg-sky-100 border border-sky-200 rounded px-1.5 py-0.5 uppercase tracking-wide shrink-0",children:"🌐 Internet"}),r.jsx("button",{onClick:ee=>{ee.stopPropagation(),M(U)},className:"p-1 text-gray-300 hover:text-indigo-600 transition-colors",children:r.jsx(yd,{className:"w-3 h-3"})}),r.jsx("button",{onClick:ee=>{ee.stopPropagation(),q(U.id)},className:"p-1 text-gray-300 hover:text-red-500 transition-colors",children:r.jsx(un,{className:"w-3 h-3"})})]}),d===U.id&&w!==U.id&&r.jsx("div",{className:"px-3 pb-3",children:r.jsx("p",{className:"text-[11px] text-indigo-600 leading-relaxed whitespace-pre-wrap",children:U.prompt})})]},U.id)),A&&r.jsxs("div",{className:"border border-dashed border-indigo-300 rounded-lg p-3 space-y-2 bg-indigo-50/50",children:[r.jsx("input",{autoFocus:!0,value:R,onChange:U=>B(U.target.value),className:"w-full border rounded px-2 py-1 text-sm font-semibold focus:outline-none focus:ring-1 focus:ring-indigo-400",placeholder:"Prompt name (e.g. 'Remove headers')"}),r.jsx(rr,{value:D,onChange:U=>P(U.target.value),rows:4,className:"text-xs resize-none",placeholder:"Describe exactly how the AI should transform the text..."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:F,disabled:!R.trim()||!D.trim(),className:"flex items-center gap-1 text-xs bg-indigo-600 text-white px-3 py-1 rounded-lg hover:bg-indigo-700 disabled:opacity-50",children:[r.jsx(Tn,{className:"w-3 h-3"})," Save prompt"]}),r.jsx("button",{onClick:()=>{T(!1),B(""),P("")},className:"text-xs text-gray-500 px-3 py-1 rounded-lg hover:bg-gray-100",children:"Cancel"})]})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Or type a custom instruction"}),r.jsx(rr,{value:m,onChange:U=>{g(U.target.value),U.target.value&&f(null)},rows:3,className:"text-sm resize-none",placeholder:'e.g. "Remove all table of contents entries and page numbers"'})]}),r.jsx(de,{onClick:W,disabled:x||!L.trim()||!e.trim(),className:"w-full gap-2",children:x?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," Processing…"]}):r.jsxs(r.Fragment,{children:[r.jsx(yd,{className:"w-4 h-4"})," Run on Extracted Text"]})}),b!==null&&r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-emerald-700 uppercase tracking-wide",children:"AI Result Preview"}),r.jsxs("span",{className:"text-[10px] text-gray-400 font-mono",children:[b.length.toLocaleStr
vendor: 4,453 bytes, line 1006
1006ing()," chars (was ",e.length.toLocaleString(),")"]})]}),r.jsx("div",{className:"max-h-72 overflow-y-auto border border-emerald-200 rounded-lg p-3 bg-emerald-50 text-xs text-gray-800 whitespace-pre-wrap font-mono leading-relaxed",children:b}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(de,{onClick:V,className:"flex-1 gap-1.5 bg-emerald-600 hover:bg-emerald-700",children:[r.jsx(Tn,{className:"w-4 h-4"})," Accept & Replace Text"]}),r.jsxs(de,{onClick:K,variant:"outline",className:"gap-1.5 text-gray-600",children:[r.jsx(jt,{className:"w-4 h-4"})," Discard"]})]})]})]})]})}var mk=0;function qA(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??mB()),document.body.insertAdjacentElement("beforeend",e[1]??mB()),mk++,()=>{mk===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mk--}},[])}function mB(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var fk="focusScope.autoFocusOnMount",hk="focusScope.autoFocusOnUnmount",fB={bubbles:!1,cancelable:!0},QAe="FocusScope",Nv=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,c]=h.useState(null),d=ti(a),f=ti(i),m=h.useRef(null),g=xn(t,b=>c(b)),x=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(s){let b=function(N){if(x.paused||!l)return;const C=N.target;l.contains(C)?m.current=C:Ol(m.current,{select:!0})},y=function(N){if(x.paused||!l)return;const C=N.relatedTarget;C!==null&&(l.contains(C)||Ol(m.current,{select:!0}))},w=function(N){if(document.activeElement===document.body)for(const k of N)k.removedNodes.length>0&&Ol(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",y);const _=new MutationObserver(w);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",y),_.disconnect()}}},[s,l,x.paused]),h.useEffect(()=>{if(l){pB.add(x);const b=document.activeElement;if(!l.contains(b)){const w=new CustomEvent(fk,fB);l.addEventListener(fk,d),l.dispatchEvent(w),w.defaultPrevented||(XAe(r3e(GV(l)),{select:!0}),document.activeElement===b&&Ol(l))}return()=>{l.removeEventListener(fk,d),setTimeout(()=>{const w=new CustomEvent(hk,fB);l.addEventListener(hk,f),l.dispatchEvent(w),w.defaultPrevented||Ol(b??document.body,{select:!0}),l.removeEventListener(hk,f),pB.remove(x)},0)}}},[l,d,f,x]);const j=h.useCallback(b=>{if(!n&&!s||x.paused)return;const y=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,w=document.activeElement;if(y&&w){const _=b.currentTarget,[N,C]=ZAe(_);N&&C?!b.shiftKey&&w===C?(b.preventDefault(),n&&Ol(N,{select:!0})):b.shiftKey&&w===N&&(b.preventDefault(),n&&Ol(C,{select:!0})):w===_&&b.preventDefault()}},[n,s,x.paused]);return r.jsx(Mt.div,{tabIndex:-1,...o,ref:g,onKeyDown:j})});Nv.displayName=QAe;function XAe(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Ol(s,{select:t}),document.activeElement!==n)return}function ZAe(e){const t=GV(e),n=hB(t,e),s=hB(t.reverse(),e);return[n,s]}function GV(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hB(e,t){for(const n of e)if(!e3e(n,{upTo:t}))return n}function e3e(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 t3e(e){return e instanceof HTMLInputElement&&"select"in e}function Ol(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&t3e(e)&&t&&e.select()}}var pB=n3e();function n3e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=gB(e,t),e.unshift(t)},remove(t){var n;e=gB(e,t),(n=e[0])==null||n.resume()}}}function gB(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function r3e(e){return e.filter(t=>t.tagName!=="A")}const s3e=["top","right","bottom","left"],oc=Math.min,xa=Math.max,Zy=Math.round,n0=Math.floor,no=e=>({x:e,y:e}
vendor: 11,963 bytes, line 1006
1006),a3e={left:"right",right:"left",bottom:"top",top:"bottom"},i3e={start:"end",end:"start"};function h5(e,t,n){return xa(e,oc(t,n))}function Go(e,t){return typeof e=="function"?e(t):e}function Yo(e){return e.split("-")[0]}function rf(e){return e.split("-")[1]}function KA(e){return e==="x"?"y":"x"}function VA(e){return e==="y"?"height":"width"}const o3e=new Set(["top","bottom"]);function Qi(e){return o3e.has(Yo(e))?"y":"x"}function HA(e){return KA(Qi(e))}function l3e(e,t,n){n===void 0&&(n=!1);const s=rf(e),a=HA(e),i=VA(a);let o=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=eb(o)),[o,eb(o)]}function c3e(e){const t=eb(e);return[p5(e),t,p5(t)]}function p5(e){return e.replace(/start|end/g,t=>i3e[t])}const xB=["left","right"],yB=["right","left"],d3e=["top","bottom"],u3e=["bottom","top"];function m3e(e,t,n){switch(e){case"top":case"bottom":return n?t?yB:xB:t?xB:yB;case"left":case"right":return t?d3e:u3e;default:return[]}}function f3e(e,t,n,s){const a=rf(e);let i=m3e(Yo(e),n==="start",s);return a&&(i=i.map(o=>o+"-"+a),t&&(i=i.concat(i.map(p5)))),i}function eb(e){return e.replace(/left|right|bottom|top/g,t=>a3e[t])}function h3e(e){return{top:0,right:0,bottom:0,left:0,...e}}function YV(e){return typeof e!="number"?h3e(e):{top:e,right:e,bottom:e,left:e}}function tb(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function bB(e,t,n){let{reference:s,floating:a}=e;const i=Qi(t),o=HA(t),l=VA(o),c=Yo(t),d=i==="y",f=s.x+s.width/2-a.width/2,m=s.y+s.height/2-a.height/2,g=s[l]/2-a[l]/2;let x;switch(c){case"top":x={x:f,y:s.y-a.height};break;case"bottom":x={x:f,y:s.y+s.height};break;case"right":x={x:s.x+s.width,y:m};break;case"left":x={x:s.x-a.width,y:m};break;default:x={x:s.x,y:s.y}}switch(rf(t)){case"start":x[o]-=g*(n&&d?-1:1);break;case"end":x[o]+=g*(n&&d?-1:1);break}return x}async function p3e(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:x=0}=Go(t,e),j=YV(x),y=l[g?m==="floating"?"reference":"floating":m],w=tb(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),_=m==="floating"?{x:s,y:a,width:o.floating.width,height:o.floating.height}:o.reference,N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(N))?await(i.getScale==null?void 0:i.getScale(N))||{x:1,y:1}:{x:1,y:1},k=tb(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:N,strategy:c}):_);return{top:(w.top-k.top+j.top)/C.y,bottom:(k.bottom-w.bottom+j.bottom)/C.y,left:(w.left-k.left+j.left)/C.x,right:(k.right-w.right+j.right)/C.x}}const g3e=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:f,y:m}=bB(d,s,c),g=s,x={},j=0;for(let y=0;y<l.length;y++){var b;const{name:w,fn:_}=l[y],{x:N,y:C,data:k,reset:S}=await _({x:f,y:m,initialPlacement:s,placement:g,strategy:a,middlewareData:x,rects:d,platform:{...o,detectOverflow:(b=o.detectOverflow)!=null?b:p3e},elements:{reference:e,floating:t}});f=N??f,m=C??m,x={...x,[w]:{...x[w],...k}},S&&j<=50&&(j++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(d=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:a}):S.rects),{x:f,y:m}=bB(d,g,c)),y=-1)}return{x:f,y:m,placement:g,strategy:a,middlewareData:x}},x3e=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Go(e,t)||{};if(d==null)return{};const m=YV(f),g={x:n,y:s},x=HA(a),j=VA(x),b=await o.getDimensions(d),y=x==="y",w=y?"top":"left",_=y?"bottom":"right",N=y?"clientHeight":"clientWidth",C=i.reference[j]+i.reference[x]-g[x]-i.floating[j],k=g[x]-i.reference[x],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let A=S?S[N]:0;(!A||!await(o.isElement==null?void 0:o.isElement(S)))&&(A=l.floating[N]||i.floating[j]);const T=C/2-k/2,R=A/2-b[j]/2-1,B=oc(m[w],R),D=oc(m[_],R),P=B,I=A-b[j]-D,z=A/2-b[j]/2+T,L=h5(P,z,I),H=!c.arrow&&rf(a)!=null&&z!==L&&i.reference[j]/2-(z<P?B:D)-b[j]/2<0,W=H?z<P?z-P:z-I:0;return{[x]:g[x]+W,data:{[x]:L,centerOffset:z-L-W,...H&&{alignmentOffset:W}},reset:H}}}),y3e=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:b=!0,...y}=Go(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Yo(a),_=Qi(l),N=Yo(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(d.floating)),k=g||(N||!b?[eb(l)]:c3e(l)),S=j!=="none";!g&&S&&k.push(...f3e(l,b,j,C));const A=[l,...k],T=await c.detectOverflow(t,y),R=[];let B=((s=i.flip)==null?void 0:s.overflows)||[];if(f&&R.push(T[w]),m){const z=l3e(a,o,C);R.push(T[z[0]],T[z[1]])}if(B=[...B,{placement:a,overflows:R}],!R.every(z=>z<=0)){var D,P;const z=(((D=i.flip)==null?void 0:D.index)||0)+1,L=A[z];if(L&&(!(m==="alignment"?_!==Qi(L):!1)||B.every(V=>Qi(V.placement)===_?V.overflows[0]>0:!0)))return{data:{index:z,overflows:B},reset:{placement:L}};let H=(P=B.filter(W=>W.overflows[0]<=0).sort((W,V)=>W.overflows[1]-V.overflows[1])[0])==null?void 0:P.placement;if(!H)switch(x){case"bestFit":{var I;const W=(I=B.filter(V=>{if(S){const K=Qi(V.placement);return K===_||K==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(K=>K>0).reduce((K,M)=>K+M,0)]).sort((V,K)=>V[1]-K[1])[0])==null?void 0:I[0];W&&(H=W);break}case"initialPlacement":H=l;break}if(a!==H)return{reset:{placement:H}}}return{}}}};function vB(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function wB(e){return s3e.some(t=>e[t]>=0)}const b3e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...i}=Go(e,t);switch(a){case"referenceHidden":{const o=await s.detectOverflow(t,{...i,elementContext:"reference"}),l=vB(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:wB(l)}}}case"escaped":{const o=await s.detectOverflow(t,{...i,altBoundary:!0}),l=vB(o,n.floating);return{data:{escapedOffsets:l,escaped:wB(l)}}}default:return{}}}}},JV=new Set(["left","top"]);async function v3e(e,t){const{placement:n,platform:s,elements:a}=e,i=await(s.isRTL==null?void 0:s.isRTL(a.floating)),o=Yo(n),l=rf(n),c=Qi(n)==="y",d=JV.has(o)?-1:1,f=i&&c?-1:1,m=Go(t,e);let{mainAxis:g,crossAxis:x,alignmentAxis:j}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof j=="number"&&(x=l==="end"?j*-1:j),c?{x:x*f,y:g*d}:{x:g*d,y:x*f}}const w3e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:i,placement:o,middlewareData:l}=t,c=await v3e(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:a+c.x,y:i+c.y,data:{...c,placement:o}}}}},j3e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a,platform:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:w=>{let{x:_,y:N}=w;return{x:_,y:N}}},...d}=Go(e,t),f={x:n,y:s},m=await i.detectOverflow(t,d),g=Qi(Yo(a)),x=KA(g);let j=f[x],b=f[g];if(o){const w=x==="y"?"top":"left",_=x==="y"?"bottom":"right",N=j+m[w],C=j-m[_];j=h5(N,j,C)}if(l){const w=g==="y"?"top":"left",_=g==="y"?"bottom":"right",N=b+m[w],C=b-m[_];b=h5(N,b,C)}const y=c.fn({...t,[x]:j,[g]:b});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[x]:o,[g]:l}}}}}},_3e=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Go(e,t),f={x:n,y:s},m=Qi(a),g=KA(m);let x=f[g],j=f[m];const b=Go(l,t),y=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const N=g==="y"?"height":"width",C=i.reference[g]-i.floating[N]+y.mainAxis,k=i.reference[g]+i.reference[N]-y.mainAxis;x<C?x=C:x>k&&(x=k)}if(d){var w,_;const N=g==="y"?"width":"height",C=JV.has(Yo(a)),k=i.reference[m]-i.floating[N]+(C&&((w=o.offset)==null?void 0:w[m])||0)+(C?0:y.crossAxis),S=i.reference[m]+i.reference[N]+(C?0:((_=o.offset)==null?void 0:_[m])||0)-(C?y.crossAxis:0);j<k?j=k:j>S&&(j=S)}return{[g]:x,[m]:j}}}},N3e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...d}=Go(e,t),f=await o.detectOverflow(t,d),m=Yo(a),g=rf(a),x=Qi(a)==="y",{width:j,height:b}=i.floating;let y,w;m==="top"||m==="bottom"?(y=m,w=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(w=m,y=g==="end"?"top":"bottom");const _=b-f.top-f.bottom,N=j-f.left-f.right,C=oc(b-f[y],_),k=oc(j-f[w],N),S=!t.middlewareData.shift;let A=C,T=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(A=_),S&&!g){const B=xa(f.left,0),D=xa(f.right,0),P=xa(f.top,0),I=xa(f.bottom,0);x?T=j-2*(B!==0||D!==0?B+D:xa(f.left,f.right)):A=b-2*(P!==0||I!==0?P+I:xa(f.top,f.bottom))}await c({...t,availableWidth:T,availableHeight:A});const R=await o.getDimensions(l.floating);return j!==R.width||b!==R.height?{reset:{rects:!0}}:{}}}};function Sv(){return typeof window<"u"}function sf(e){return QV(e)?(e.nodeName||"").toLowerCase():"#document"}function wa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ho(e){var t;return(t=(QV(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function QV(e){return Sv()?e instanceof Node||e instanceof wa(e).Node:!1}function Ei(e){return Sv()?e instanceof Element||e instanceof wa(e).Element:!1}function mo(e){return Sv()?e instanceof HTMLElement||e instanceof wa(e).HTMLElement:!1}function jB(e){return!Sv()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wa(e).ShadowRoot}const S3e=new Set(["inline","contents"]);function bg(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=Ai(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!S3e.has(a)}const k3e=new Set(["table","td","th"]);function C3e(e){return k3e.has(sf(e))}const E3e=[":popover-open",":modal"];function kv(e){return E3e.some(t=>{try{return e.matches(t)}catch{return!1}})}const A3e=["transform","translate","scale","rotate","perspective"],T3e=["transform","translate","scale","rotate","perspective","filter"],P3e=["paint","layout","strict","content"];function WA(e){const t=GA(),n=Ei(e)?Ai(e):e;return A3e.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||T3e.some(s=>(n.willChange||"").includes(s))||P3e.some(s=>(n.contain||"").includes(s))}function O3e(e){let t=lc(e);for(;mo(t)&&!Pm(t);){if(WA(t))return t;if(kv(t))return null;t=lc(t)}return null}function GA(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const I3e=new Set(["html","body","#document"]);function Pm(e){return I3e.has(sf(e))}function Ai(e){return wa(e).getComputedStyle(e)}function Cv(e){return Ei(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lc(e){if(sf(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jB(e)&&e.host||ho(e);return jB(t)?t.host:t}function XV(e){const t=lc(e);return Pm(t)?e.ownerDocument?e.ownerDocument.body:e.body:mo(t)&&bg(t)?t:XV(t)}
vendor: 20,808 bytes, line 1006
1006function Ep(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=XV(e),i=a===((s=e.ownerDocument)==null?void 0:s.body),o=wa(a);if(i){const l=g5(o);return t.concat(o,o.visualViewport||[],bg(a)?a:[],l&&n?Ep(l):[])}return t.concat(a,Ep(a,[],n))}function g5(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ZV(e){const t=Ai(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=mo(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:s,l=Zy(n)!==i||Zy(s)!==o;return l&&(n=i,s=o),{width:n,height:s,$:l}}function YA(e){return Ei(e)?e:e.contextElement}function Ku(e){const t=YA(e);if(!mo(t))return no(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:i}=ZV(t);let o=(i?Zy(n.width):n.width)/s,l=(i?Zy(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const R3e=no(0);function eH(e){const t=wa(e);return!GA()||!t.visualViewport?R3e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function M3e(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wa(e)?!1:t}function Id(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=YA(e);let o=no(1);t&&(s?Ei(s)&&(o=Ku(s)):o=Ku(e));const l=M3e(i,n,s)?eH(i):no(0);let c=(a.left+l.x)/o.x,d=(a.top+l.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=wa(i),x=s&&Ei(s)?wa(s):s;let j=g,b=g5(j);for(;b&&s&&x!==j;){const y=Ku(b),w=b.getBoundingClientRect(),_=Ai(b),N=w.left+(b.clientLeft+parseFloat(_.paddingLeft))*y.x,C=w.top+(b.clientTop+parseFloat(_.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,m*=y.y,c+=N,d+=C,j=wa(b),b=g5(j)}}return tb({width:f,height:m,x:c,y:d})}function Ev(e,t){const n=Cv(e).scrollLeft;return t?t.left+n:Id(ho(e)).left+n}function tH(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Ev(e,n),a=n.top+t.scrollTop;return{x:s,y:a}}function D3e(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const i=a==="fixed",o=ho(s),l=t?kv(t.floating):!1;if(s===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=no(1);const f=no(0),m=mo(s);if((m||!m&&!i)&&((sf(s)!=="body"||bg(o))&&(c=Cv(s)),mo(s))){const x=Id(s);d=Ku(s),f.x=x.x+s.clientLeft,f.y=x.y+s.clientTop}const g=o&&!m&&!i?tH(o,c):no(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-c.scrollTop*d.y+f.y+g.y}}function L3e(e){return Array.from(e.getClientRects())}function $3e(e){const t=ho(e),n=Cv(e),s=e.ownerDocument.body,a=xa(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=xa(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-n.scrollLeft+Ev(e);const l=-n.scrollTop;return Ai(s).direction==="rtl"&&(o+=xa(t.clientWidth,s.clientWidth)-a),{width:a,height:i,x:o,y:l}}const _B=25;function B3e(e,t){const n=wa(e),s=ho(e),a=n.visualViewport;let i=s.clientWidth,o=s.clientHeight,l=0,c=0;if(a){i=a.width,o=a.height;const f=GA();(!f||f&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const d=Ev(s);if(d<=0){const f=s.ownerDocument,m=f.body,g=getComputedStyle(m),x=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,j=Math.abs(s.clientWidth-m.clientWidth-x);j<=_B&&(i-=j)}else d<=_B&&(i+=d);return{width:i,height:o,x:l,y:c}}const F3e=new Set(["absolute","fixed"]);function z3e(e,t){const n=Id(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,i=mo(e)?Ku(e):no(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=a*i.x,d=s*i.y;return{width:o,height:l,x:c,y:d}}function NB(e,t,n){let s;if(t==="viewport")s=B3e(e,n);else if(t==="document")s=$3e(ho(e));else if(Ei(t))s=z3e(t,n);else{const a=eH(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return tb(s)}function nH(e,t){const n=lc(e);return n===t||!Ei(n)||Pm(n)?!1:Ai(n).position==="fixed"||nH(n,t)}function U3e(e,t){const n=t.get(e);if(n)return n;let s=Ep(e,[],!1).filter(l=>Ei(l)&&sf(l)!=="body"),a=null;const i=Ai(e).position==="fixed";let o=i?lc(e):e;for(;Ei(o)&&!Pm(o);){const l=Ai(o),c=WA(o);!c&&l.position==="fixed"&&(a=null),(i?!c&&!a:!c&&l.position==="static"&&!!a&&F3e.has(a.position)||bg(o)&&!c&&nH(e,o))?s=s.filter(f=>f!==o):a=l,o=lc(o)}return t.set(e,s),s}function q3e(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const o=[...n==="clippingAncestors"?kv(t)?[]:U3e(t,this._c):[].concat(n),s],l=o[0],c=o.reduce((d,f)=>{const m=NB(t,f,a);return d.top=xa(m.top,d.top),d.right=oc(m.right,d.right),d.bottom=oc(m.bottom,d.bottom),d.left=xa(m.left,d.left),d},NB(t,l,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function K3e(e){const{width:t,height:n}=ZV(e);return{width:t,height:n}}function V3e(e,t,n){const s=mo(t),a=ho(t),i=n==="fixed",o=Id(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=no(0);function d(){c.x=Ev(a)}if(s||!s&&!i)if((sf(t)!=="body"||bg(a))&&(l=Cv(t)),s){const x=Id(t,!0,i,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else a&&d();i&&!s&&a&&d();const f=a&&!s&&!i?tH(a,l):no(0),m=o.left+l.scrollLeft-c.x-f.x,g=o.top+l.scrollTop-c.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function pk(e){return Ai(e).position==="static"}function SB(e,t){if(!mo(e)||Ai(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ho(e)===n&&(n=n.ownerDocument.body),n}function rH(e,t){const n=wa(e);if(kv(e))return n;if(!mo(e)){let a=lc(e);for(;a&&!Pm(a);){if(Ei(a)&&!pk(a))return a;a=lc(a)}return n}let s=SB(e,t);for(;s&&C3e(s)&&pk(s);)s=SB(s,t);return s&&Pm(s)&&pk(s)&&!WA(s)?n:s||O3e(e)||n}const H3e=async function(e){const t=this.getOffsetParent||rH,n=this.getDimensions,s=await n(e.floating);return{reference:V3e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function W3e(e){return Ai(e).direction==="rtl"}const G3e={convertOffsetParentRelativeRectToViewportRelativeRect:D3e,getDocumentElement:ho,getClippingRect:q3e,getOffsetParent:rH,getElementRects:H3e,getClientRects:L3e,getDimensions:K3e,getScale:Ku,isElement:Ei,isRTL:W3e};function sH(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Y3e(e,t){let n=null,s;const a=ho(e);function i(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:f,top:m,width:g,height:x}=d;if(l||t(),!g||!x)return;const j=n0(m),b=n0(a.clientWidth-(f+g)),y=n0(a.clientHeight-(m+x)),w=n0(f),N={rootMargin:-j+"px "+-b+"px "+-y+"px "+-w+"px",threshold:xa(0,oc(1,c))||1};let C=!0;function k(S){const A=S[0].intersectionRatio;if(A!==c){if(!C)return o();A?o(!1,A):s=setTimeout(()=>{o(!1,1e-7)},1e3)}A===1&&!sH(d,e.getBoundingClientRect())&&o(),C=!1}try{n=new IntersectionObserver(k,{...N,root:a.ownerDocument})}catch{n=new IntersectionObserver(k,N)}n.observe(e)}return o(!0),i}function J3e(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,d=YA(e),f=a||i?[...d?Ep(d):[],...Ep(t)]:[];f.forEach(w=>{a&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const m=d&&l?Y3e(d,n):null;let g=-1,x=null;o&&(x=new ResizeObserver(w=>{let[_]=w;_&&_.target===d&&x&&(x.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var N;(N=x)==null||N.observe(t)})),n()}),d&&!c&&x.observe(d),x.observe(t));let j,b=c?Id(e):null;c&&y();function y(){const w=Id(e);b&&!sH(b,w)&&n(),b=w,j=requestAnimationFrame(y)}return n(),()=>{var w;f.forEach(_=>{a&&_.removeEventListener("scroll",n),i&&_.removeEventListener("resize",n)}),m==null||m(),(w=x)==null||w.disconnect(),x=null,c&&cancelAnimationFrame(j)}}const Q3e=w3e,X3e=j3e,Z3e=y3e,eTe=N3e,tTe=b3e,kB=x3e,nTe=_3e,rTe=(e,t,n)=>{const s=new Map,a={platform:G3e,...n},i={...a.platform,_c:s};return g3e(e,t,{...a,platform:i})};var sTe=typeof document<"u",aTe=function(){},C0=sTe?h.useLayoutEffect:aTe;function nb(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,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!nb(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const i=a[s];if(!(i==="_owner"&&e.$$typeof)&&!nb(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function aH(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function CB(e,t){const n=aH(e);return Math.round(t*n)/n}function gk(e){const t=h.useRef(e);return C0(()=>{t.current=e}),t}function iTe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,m]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,x]=h.useState(s);nb(g,s)||x(s);const[j,b]=h.useState(null),[y,w]=h.useState(null),_=h.useCallback(V=>{V!==S.current&&(S.current=V,b(V))},[]),N=h.useCallback(V=>{V!==A.current&&(A.current=V,w(V))},[]),C=i||j,k=o||y,S=h.useRef(null),A=h.useRef(null),T=h.useRef(f),R=c!=null,B=gk(c),D=gk(a),P=gk(d),I=h.useCallback(()=>{if(!S.current||!A.current)return;const V={placement:t,strategy:n,middleware:g};D.current&&(V.platform=D.current),rTe(S.current,A.current,V).then(K=>{const M={...K,isPositioned:P.current!==!1};z.current&&!nb(T.current,M)&&(T.current=M,fc.flushSync(()=>{m(M)}))})},[g,t,n,D,P]);C0(()=>{d===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[d]);const z=h.useRef(!1);C0(()=>(z.current=!0,()=>{z.current=!1}),[]),C0(()=>{if(C&&(S.current=C),k&&(A.current=k),C&&k){if(B.current)return B.current(C,k,I);I()}},[C,k,I,B,R]);const L=h.useMemo(()=>({reference:S,floating:A,setReference:_,setFloating:N}),[_,N]),H=h.useMemo(()=>({reference:C,floating:k}),[C,k]),W=h.useMemo(()=>{const V={position:n,left:0,top:0};if(!H.floating)return V;const K=CB(H.floating,f.x),M=CB(H.floating,f.y);return l?{...V,transform:"translate("+K+"px, "+M+"px)",...aH(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:M}},[n,l,H.floating,f.x,f.y]);return h.useMemo(()=>({...f,update:I,refs:L,elements:H,floatingStyles:W}),[f,I,L,H,W])}const oTe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:a}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?kB({element:s.current,padding:a}).fn(n):{}:s?kB({element:s,padding:a}).fn(n):{}}}},lTe=(e,t)=>({...Q3e(e),options:[e,t]}),cTe=(e,t)=>({...X3e(e),options:[e,t]}),dTe=(e,t)=>({...nTe(e),options:[e,t]}),uTe=(e,t)=>({...Z3e(e),options:[e,t]}),mTe=(e,t)=>({...eTe(e),options:[e,t]}),fTe=(e,t)=>({...tTe(e),options:[e,t]}),hTe=(e,t)=>({...oTe(e),options:[e,t]});var pTe="Arrow",iH=h.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...i}=e;return r.jsx(Mt.svg,{...i,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});iH.displayName=pTe;var gTe=iH,JA="Popper",[oH,Av]=Ti(JA),[xTe,lH]=oH(JA),cH=e=>{const{__scopePopper:t,children:n}=e,[s,a]=h.useState(null);return r.jsx(xTe,{scope:t,anchor:s,onAnchorChange:a,children:n})};cH.displayName=JA;var dH="PopperAnchor",uH=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,i=lH(dH,n),o=h.useRef(null),l=xn(t,o),c=h.useRef(null);return h.useEffect(()=>{const d=c.current;c.current=(s==null?void 0:s.current)||o.current,d!==c.current&&i.onAnchorChange(c.current)}),s?null:r.jsx(Mt.div,{...a,ref:l})});uH.displayName=dH;var QA="PopperContent",[yTe,bTe]=oH(QA),mH=h.forwardRef((e,t)=>{var X,ie,Z,ce,le,re;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:x="optimized",onPlaced:j,...b}=e,y=lH(QA,n),[w,_]=h.useState(null),N=xn(t,Ue=>_(Ue)),[C,k]=h.useState(null),S=Ib(C),A=(S==null?void 0:S.width)??0,T=(S==null?void 0:S.height)??0,R=s+(i!=="center"?"-"+i:""),B=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},D=Array.isArray(d)?d:[d],P=D.length>0,I={padding:B,boundary:D.filter(wTe),altBoundary:P},{refs:z,floatingStyles:L,placement:H,isPositioned:W,middlewareData:V}=iTe({strategy:"fixed",placement:R,whileElementsMounted:(...Ue)=>J3e(...Ue,{animationFrame:x==="always"}),elements:{reference:y.anchor},middleware:[lTe({mainAxis:a+T,alignmentAxis:o}),c&&cTe({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?dTe():void 0,...I}),c&&uTe({...I}),mTe({...I,apply:({elements:Ue,rects:Ne,availableWidth:Oe,availableHeight:Me})=>{const{width:ue,height:Ve}=Ne.reference,Xe=Ue.floating.style;Xe.setProperty("--radix-popper-available-width",`${Oe}px`),Xe.setProperty("--radix-popper-available-height",`${Me}px`),Xe.setProperty("--radix-popper-anchor-width",`${ue}px`),Xe.setProperty("--radix-popper-anchor-height",`${Ve}px`)}}),C&&hTe({element:C,padding:l}),jTe({arrowWidth:A,arrowHeight:T}),g&&fTe({strategy:"referenceHidden",...I})]}),[K,M]=pH(H),G=ti(j);xs(()=>{W&&(G==null||G())},[W,G]);const q=(X=V.arrow)==null?void 0:X.x,F=(ie=V.arrow)==null?void 0:ie.y,U=((Z=V.arrow)==null?void 0:Z.centerOffset)!==0,[ee,ne]=h.useState();return xs(()=>{w&&ne(window.getComputedStyle(w).zIndex)},[w]),r.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:W?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(ce=V.transformOrigin)==null?void 0:ce.x,(le=V.transformOrigin)==null?void 0:le.y].join(" "),...((re=V.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(yTe,{scope:n,placedSide:K,onArrowChange:k,arrowX:q,arrowY:F,shouldHideArrow:U,children:r.jsx(Mt.div,{"data-side":K,"data-align":M,...b,ref:N,style:{...b.style,animation:W?void 0:"none"}})})})});mH.displayName=QA;var fH="PopperArrow",vTe={top:"bottom",right:"left",bottom:"top",left:"right"},hH=h.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,i=bTe(fH,s),o=vTe[i.placedSide];return r.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:r.jsx(gTe,{...a,ref:n,style:{...a.style,display:"block"}})})});hH.displayName=fH;function wTe(e){return e!==null}var jTe=e=>({name:"transformOrigin",options:e,fn(t){var y,w,_;const{placement:n,rects:s,middlewareData:a}=t,o=((y=a.arrow)==null?void 0:y.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,f]=pH(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((w=a.arrow)==null?void 0:w.x)??0)+l/2,x=(((_=a.arrow)==null?void 0:_.y)??0)+c/2;let j="",b="";return d==="bottom"?(j=o?m:`${g}px`,b=`${-c}px`):d==="top"?(j=o?m:`${g}px`,b=`${s.floating.height+c}px`):d==="right"?(j=`${-c}px`,b=o?m:`${x}px`):d==="left"&&(j=`${s.floating.width+c}px`,b=o?m:`${x}px`),{data:{x:j,y:b}}}});function pH(e){const[t,n="center"]=e.split("-");return[t,n]}var gH=cH,XA=uH,xH=mH,yH=hH;function _Te(e){const t=NTe(e),n=h.forwardRef((s,a)=>{const{children:i,...o}=s,l=h.Children.toArray(i),c=l.find(kTe);if(c){const d=c.props.children,f=l.map(m=>m===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:m);return r.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,f):null})}return r.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function NTe(e){const t=h.forwardRef((n,s)=>{const{children:a,...i}=n;if(h.isValidElement(a)){const o=ETe(a),l=CTe(i,a.props);return a.type!==h.Fragment&&(l.ref=s?ei(s,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var STe=Symbol("radix.slottable");function kTe(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===STe}function CTe(e,t){const n={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function ETe(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ATe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Su=new WeakMap,r0=new WeakMap,s0={},xk=0,bH=function(e){return e&&(e.host||bH(e.parentNode))},TTe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=bH(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},PTe=function(e,t,n,s){var a=TTe(t,Array.isArray(e)?e:[e]);s0[n]||(s0[n]=new WeakMap);var i=s0[n],o=[],l=new Set,c=new Set(a),d=function(m){!m||l.has(m)||(l.add(m),d(m.parentNode))};a.forEach(d);var f=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(g){if(l.has(g))f(g);else try{var x=g.getAttribute(s),j=x!==null&&x!=="false",b=(Su.get(g)||0)+1,y=(i.get(g)||0)+1;Su.set(g,b),i.set(g,y),o.push(g),b===1&&j&&r0.set(g,!0),y===1&&g.setAttribute(n,"true"),j||g.setAttribute(s,"true")}catch(w){console.error("aria-hidden: cannot operate on ",g,w)}})};return f(t),l.clear(),xk++,function(){o.forEach(function(m){var g=Su.get(m)-1,x=i.get(m)-1;Su.set(m,g),i.set(m,x),g||(r0.has(m)||m.removeAttribute(s),r0.delete(m)),x||m.removeAttribute(n)}),xk--,xk||(Su=new WeakMap,Su=new WeakMap,r0=new WeakMap,s0={})}},ZA=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=ATe(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),PTe(s,a,n,"aria-hidden")):function(){return null}},Yi=function(){return Yi=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Yi.apply(this,arguments)};function vH(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n}function OTe(e,t,n){if(n||arguments.length===2)for(var s=0,a=t.length,i;s<a;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var E0="right-scroll-bar-position",A0="width-before-scroll-bar",ITe="with-scroll-bars-hidden",RTe="--removed-body-scroll-bar-size";function yk(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function MTe(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var a=n.value;a!==s&&(n.value=s,n.callback(s,a))}}}})[0];return n.callback=t,n.facade}var DTe=typeof window<"u"?h.useLayoutEffect:h.useEffect,EB=new WeakMap;function LTe(e,t){var n=MTe(null,function(s){return e.forEach(function(a){return yk(a,s)})});return DTe(function(){var s=EB.get(n);if(s){var a=new Set(s),i=new Set(e),o=n.current;a.forEach(function(l){i.has(l)||yk(l,null)}),i.forEach(function(l){a.has(l)||yk(l,o)})}EB.set(n,e)},[e]),n}function $Te(e){return e}function BTe(e,t){t===void 0&&(t=$Te);var n=[],s=!1,a={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,s);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var f=o;o=[],f.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){o.push(f),d()},filter:function(f){return o=o.filter(f),n}}}};return a}function FTe(e){e===void 0&&(e={});var t=BTe(null);return t.options=Yi({async:!0,ssr:!1},e),t}var wH=function(e){var t=e.sideCar,n=vH(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return h.createElement(s,Yi({},n))};
vendor: 10,278 bytes, lines 1006-1046
1006wH.isSideCarExport=!0;function zTe(e,t){return e.useMedium(t),wH}var jH=FTe(),bk=function(){},Tv=h.forwardRef(function(e,t){var n=h.useRef(null),s=h.useState({onScrollCapture:bk,onWheelCapture:bk,onTouchMoveCapture:bk}),a=s[0],i=s[1],o=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,m=e.shards,g=e.sideCar,x=e.noRelative,j=e.noIsolation,b=e.inert,y=e.allowPinchZoom,w=e.as,_=w===void 0?"div":w,N=e.gapMode,C=vH(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=g,S=LTe([n,t]),A=Yi(Yi({},C),a);return h.createElement(h.Fragment,null,f&&h.createElement(k,{sideCar:jH,removeScrollBar:d,shards:m,noRelative:x,noIsolation:j,inert:b,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:N}),o?h.cloneElement(h.Children.only(l),Yi(Yi({},A),{ref:S})):h.createElement(_,Yi({},A,{className:c,ref:S}),l))});Tv.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Tv.classNames={fullWidth:A0,zeroRight:E0};var UTe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qTe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=UTe();return t&&e.setAttribute("nonce",t),e}function KTe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function VTe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var HTe=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qTe())&&(KTe(t,n),VTe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},WTe=function(){var e=HTe();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_H=function(){var e=WTe(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},GTe={left:0,top:0,right:0,gap:0},vk=function(e){return parseInt(e||"",10)||0},YTe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[vk(n),vk(s),vk(a)]},JTe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return GTe;var t=YTe(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},QTe=_H(),Vu="data-scroll-locked",XTe=function(e,t,n,s){var a=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),`
1007  .`.concat(ITe,` {
1008   overflow: hidden `).concat(s,`;
1009   padding-right: `).concat(l,"px ").concat(s,`;
1010  }
1011  body[`).concat(Vu,`] {
1012    overflow: hidden `).concat(s,`;
1013    overscroll-behavior: contain;
1014    `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
1015    padding-left: `.concat(a,`px;
1016    padding-top: `).concat(i,`px;
1017    padding-right: `).concat(o,`px;
1018    margin-left:0;
1019    margin-top:0;
1020    margin-right: `).concat(l,"px ").concat(s,`;
1021    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(s,";")].filter(Boolean).join(""),`
1022  }
1023  
1024  .`).concat(E0,` {
1025    right: `).concat(l,"px ").concat(s,`;
1026  }
1027  
1028  .`).concat(A0,` {
1029    margin-right: `).concat(l,"px ").concat(s,`;
1030  }
1031  
1032  .`).concat(E0," .").concat(E0,` {
1033    right: 0 `).concat(s,`;
1034  }
1035  
1036  .`).concat(A0," .").concat(A0,` {
1037    margin-right: 0 `).concat(s,`;
1038  }
1039  
1040  body[`).concat(Vu,`] {
1041    `).concat(RTe,": ").concat(l,`px;
1042  }
1043`)},AB=function(){var e=parseInt(document.body.getAttribute(Vu)||"0",10);return isFinite(e)?e:0},ZTe=function(){h.useEffect(function(){return document.body.setAttribute(Vu,(AB()+1).toString()),function(){var e=AB()-1;e<=0?document.body.removeAttribute(Vu):document.body.setAttribute(Vu,e.toString())}},[])},ePe=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;ZTe();var i=h.useMemo(function(){return JTe(a)},[a]);return h.createElement(QTe,{styles:XTe(i,!t,a,n?"":"!important")})},x5=!1;if(typeof window<"u")try{var a0=Object.defineProperty({},"passive",{get:function(){return x5=!0,!0}});window.addEventListener("test",a0,a0),window.removeEventListener("test",a0,a0)}catch{x5=!1}var ku=x5?{passive:!1}:!1,tPe=function(e){return e.tagName==="TEXTAREA"},NH=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!tPe(e)&&n[t]==="visible")},nPe=function(e){return NH(e,"overflowY")},rPe=function(e){return NH(e,"overflowX")},TB=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=SH(e,s);if(a){var i=kH(e,s),o=i[1],l=i[2];if(o>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},sPe=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},aPe=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},SH=function(e,t){return e==="v"?nPe(t):rPe(t)},kH=function(e,t){return e==="v"?sPe(t):aPe(t)},iPe=function(e,t){return e==="h"&&t==="rtl"?-1:1},oPe=function(e,t,n,s,a){var i=iPe(e,window.getComputedStyle(t).direction),o=i*s,l=n.target,c=t.contains(l),d=!1,f=o>0,m=0,g=0;do{if(!l)break;var x=kH(e,l),j=x[0],b=x[1],y=x[2],w=b-y-i*j;(j||w)&&SH(e,l)&&(m+=w,g+=j);var _=l.parentNode;l=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(d=!0),d},i0=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},PB=function(e){return[e.deltaX,e.deltaY]},OB=function(e){return e&&"current"in e?e.current:e},lPe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},cPe=function(e){return`
1044  .block-interactivity-`.concat(e,` {pointer-events: none;}
1045  .allow-interactivity-`).concat(e,` {pointer-events: all;}
1046`)},dPe=0,Cu=[];function uPe(e){var t=h.useRef([]),n=h.useRef([0,0]),s=h.useRef(),a=h.useState(dPe++)[0],i=h.useState(_H)[0],o=h.useRef(e);h.useEffect(function(){o.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var b=OTe([e.lockRef.current],(e.shards||[]).map(OB),!0).filter(Boolean);return b.forEach(function(y){return y.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),b.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(b,y){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var w=i0(b),_=n.current,N="deltaX"in b?b.deltaX:_[0]-w[0],C="deltaY"in b?b.deltaY:_[1]-w[1],k,S=b.target,A=Math.abs(N)>Math.abs(C)?"h":"v";if("touches"in b&&A==="h"&&S.type==="range")return!1;var T=window.getSelection(),R=T&&T.anchorNode,B=R?R===S||R.contains(S):!1;if(B)return!1;var D=TB(A,S);if(!D)return!0;if(D?k=A:(k=A==="v"?"h":"v",D=TB(A,S)),!D)return!1;if(!s.current&&"changedTouches"in b&&(N||C)&&(s.current=k),!k)return!0;var P=s.current||k;return oPe(P,y,b,P==="h"?N:C)},[]),c=h.useCallback(function(b){var y=b;if(!(!Cu.length||Cu[Cu.length-1]!==i)){var w="deltaY"in y?PB(y):i0(y),_=t.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&lPe(k.delta,w)})[0];if(_&&_.should){y.cancelable&&y.preventDefault();return}if(!_){var N=(o.current.shards||[]).map(OB).filter(Boolean).filter(function(k){return k.contains(y.target)}),C=N.length>0?l(y,N[0]):!o.current.noIsolation;C&&y.cancelable&&y.preventDefault()}}},[]),d=h.useCallback(function(b,y,w,_){var N={name:b,delta:y,target:w,should:_,shadowParent:mPe(w)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(C){return C!==N})},1)},[]),f=h.useCallback(function(b){n.current=i0(b),s.current=void 0},[]),m=h.useCallback(function(b){d(b.type,PB(b),b.target,l(b,e.lockRef.current))},[]),g=h.useCallback(function(b){d(b.type,i0(b),b.target,l(b,e.lockRef.current))},[]);h.useEffect(function(){return Cu.push(i),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",c,ku),document.addEventListener("touchmove",c,ku),document.addEventListener("touchstart",f,ku),function(){Cu=Cu.filter(function(b){return b!==i}),document.removeEventListener("wheel",c,ku),document.removeEventListener("touchmove",c,ku),document.removeEventListener("touchstart",f,ku)}},[]);var x=e.removeScrollBar,j=e.inert;return h.createElement(h.Fragment,null,j?h.createElement(i,{styles:cPe(a)}):null,x?h.createElement(ePe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function mPe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const fPe=zTe(jH,uPe);var Pv=h.forwardRef(function(e,t){return h.createElement(Tv,Yi({},e,{ref:t,sideCar:fPe}))});Pv.classNames=Tv.classNames;var hPe=[" ","Enter","ArrowUp","ArrowDown"],pPe=[" ","Enter"],Rd="Select",[Ov,Iv,gPe]=vb(Rd),[af]=Ti(Rd,[gPe,Av]),Rv=Av(),[xPe,_c]=af(Rd),[yPe,bPe]=af(Rd),CH=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:a,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:m,disabled:g,required:x,form:j}=e,b=Rv(t),[y,w]=h.useState(null),[_,N]=h.useState(null),[C,k]=h.useState(!1),S=Mb(d),[A,T]=so({prop:s,defaultProp:a??!1,onChange:i,caller:Rd}),[R,B]=so({prop:o,defaultProp:l,onChange:c,caller:Rd}),D=h.useRef(null),P=y?j||!!y.closest("form"):!0,[I,z]=h.useState(new Set),L=Array.from(I).map(H=>H.props.value).join(";");return r.jsx(gH,{...b,children:r.jsxs(xPe,{required:x,scope:t,trigger:y,onTriggerChange:w,valueNode:_,onValueNodeChange:N,valueNodeHasChildren:C,onValueNodeHasChildrenChange:k,contentId:Fs(),value:R,onValueChange:B,open:A,onOpenChange:T,dir:S,triggerPointerDownPosRef:D,disabled:g,children:[r.jsx(Ov.Provider,{scope:t,children:r.jsx(yPe,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(H=>{z(W=>new Set(W).add(H))},[]),onNativeOptionRemove:h.useCallback(H=>{z(W=>{const V=new Set(W);return V.delete(H),V})},[]),children:n})}),P?r.jsxs(QH,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:m,value:R,onChange:H=>B(H.target.value),disabled:g,form:j,children:[R===void 0?r.jsx("option",{value:""}):null,Array.from(I)]},L):null]})})};CH.displayName=Rd;var EH="SelectTrigger",AH=h.forwardRef((e,t)=>
vendor: 18,131 bytes, line 1046
1046{const{__scopeSelect:n,disabled:s=!1,...a}=e,i=Rv(n),o=_c(EH,n),l=o.disabled||s,c=xn(t,o.onTriggerChange),d=Iv(n),f=h.useRef("touch"),[m,g,x]=ZH(b=>{const y=d().filter(N=>!N.disabled),w=y.find(N=>N.value===o.value),_=eW(y,b,w);_!==void 0&&o.onValueChange(_.value)}),j=b=>{l||(o.onOpenChange(!0),x()),b&&(o.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return r.jsx(XA,{asChild:!0,...i,children:r.jsx(Mt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":XH(o.value)?"":void 0,...a,ref:c,onClick:Rt(a.onClick,b=>{b.currentTarget.focus(),f.current!=="mouse"&&j(b)}),onPointerDown:Rt(a.onPointerDown,b=>{f.current=b.pointerType;const y=b.target;y.hasPointerCapture(b.pointerId)&&y.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(j(b),b.preventDefault())}),onKeyDown:Rt(a.onKeyDown,b=>{const y=m.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&g(b.key),!(y&&b.key===" ")&&hPe.includes(b.key)&&(j(),b.preventDefault())})})})});AH.displayName=EH;var TH="SelectValue",PH=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,children:i,placeholder:o="",...l}=e,c=_c(TH,n),{onValueNodeHasChildrenChange:d}=c,f=i!==void 0,m=xn(t,c.onValueNodeChange);return xs(()=>{d(f)},[d,f]),r.jsx(Mt.span,{...l,ref:m,style:{pointerEvents:"none"},children:XH(c.value)?r.jsx(r.Fragment,{children:o}):i})});PH.displayName=TH;var vPe="SelectIcon",OH=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...a}=e;return r.jsx(Mt.span,{"aria-hidden":!0,...a,ref:t,children:s||"▼"})});OH.displayName=vPe;var wPe="SelectPortal",IH=e=>r.jsx(Vp,{asChild:!0,...e});IH.displayName=wPe;var Md="SelectContent",RH=h.forwardRef((e,t)=>{const n=_c(Md,e.__scopeSelect),[s,a]=h.useState();if(xs(()=>{a(new DocumentFragment)},[]),!n.open){const i=s;return i?fc.createPortal(r.jsx(MH,{scope:e.__scopeSelect,children:r.jsx(Ov.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),i):null}return r.jsx(DH,{...e,ref:t})});RH.displayName=Md;var xi=10,[MH,Nc]=af(Md),jPe="SelectContentImpl",_Pe=_Te("SelectContent.RemoveScroll"),DH=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:x,sticky:j,hideWhenDetached:b,avoidCollisions:y,...w}=e,_=_c(Md,n),[N,C]=h.useState(null),[k,S]=h.useState(null),A=xn(t,X=>C(X)),[T,R]=h.useState(null),[B,D]=h.useState(null),P=Iv(n),[I,z]=h.useState(!1),L=h.useRef(!1);h.useEffect(()=>{if(N)return ZA(N)},[N]),qA();const H=h.useCallback(X=>{const[ie,...Z]=P().map(re=>re.ref.current),[ce]=Z.slice(-1),le=document.activeElement;for(const re of X)if(re===le||(re==null||re.scrollIntoView({block:"nearest"}),re===ie&&k&&(k.scrollTop=0),re===ce&&k&&(k.scrollTop=k.scrollHeight),re==null||re.focus(),document.activeElement!==le))return},[P,k]),W=h.useCallback(()=>H([T,N]),[H,T,N]);h.useEffect(()=>{I&&W()},[I,W]);const{onOpenChange:V,triggerPointerDownPosRef:K}=_;h.useEffect(()=>{if(N){let X={x:0,y:0};const ie=ce=>{var le,re;X={x:Math.abs(Math.round(ce.pageX)-(((le=K.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((re=K.current)==null?void 0:re.y)??0))}},Z=ce=>{X.x<=10&&X.y<=10?ce.preventDefault():N.contains(ce.target)||V(!1),document.removeEventListener("pointermove",ie),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",Z,{capture:!0})}}},[N,V,K]),h.useEffect(()=>{const X=()=>V(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[V]);const[M,G]=ZH(X=>{const ie=P().filter(le=>!le.disabled),Z=ie.find(le=>le.ref.current===document.activeElement),ce=eW(ie,X,Z);ce&&setTimeout(()=>ce.ref.current.focus())}),q=h.useCallback((X,ie,Z)=>{const ce=!L.current&&!Z;(_.value!==void 0&&_.value===ie||ce)&&(R(X),ce&&(L.current=!0))},[_.value]),F=h.useCallback(()=>N==null?void 0:N.focus(),[N]),U=h.useCallback((X,ie,Z)=>{const ce=!L.current&&!Z;(_.value!==void 0&&_.value===ie||ce)&&D(X)},[_.value]),ee=s==="popper"?y5:LH,ne=ee===y5?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:x,sticky:j,hideWhenDetached:b,avoidCollisions:y}:{};return r.jsx(MH,{scope:n,content:N,viewport:k,onViewportChange:S,itemRefCallback:q,selectedItem:T,onItemLeave:F,itemTextRefCallback:U,focusSelectedItem:W,selectedItemText:B,position:s,isPositioned:I,searchRef:M,children:r.jsx(Pv,{as:_Pe,allowPinchZoom:!0,children:r.jsx(Nv,{asChild:!0,trapped:_.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:Rt(a,X=>{var ie;(ie=_.trigger)==null||ie.focus({preventScroll:!0}),X.preventDefault()}),children:r.jsx(Kp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:r.jsx(ee,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:X=>X.preventDefault(),...w,...ne,onPlaced:()=>z(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Rt(w.onKeyDown,X=>{const ie=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ie&&X.key.length===1&&G(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let ce=P().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(X.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const le=X.target,re=ce.indexOf(le);ce=ce.slice(re+1)}setTimeout(()=>H(ce)),X.preventDefault()}})})})})})})});DH.displayName=jPe;var NPe="SelectItemAlignedPosition",LH=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...a}=e,i=_c(Md,n),o=Nc(Md,n),[l,c]=h.useState(null),[d,f]=h.useState(null),m=xn(t,A=>f(A)),g=Iv(n),x=h.useRef(!1),j=h.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:w,focusSelectedItem:_}=o,N=h.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&b&&y&&w){const A=i.trigger.getBoundingClientRect(),T=d.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),B=w.getBoundingClientRect();if(i.dir!=="rtl"){const le=B.left-T.left,re=R.left-le,Ue=A.left-re,Ne=A.width+Ue,Oe=Math.max(Ne,T.width),Me=window.innerWidth-xi,ue=W0(re,[xi,Math.max(xi,Me-Oe)]);l.style.minWidth=Ne+"px",l.style.left=ue+"px"}else{const le=T.right-B.right,re=window.innerWidth-R.right-le,Ue=window.innerWidth-A.right-re,Ne=A.width+Ue,Oe=Math.max(Ne,T.width),Me=window.innerWidth-xi,ue=W0(re,[xi,Math.max(xi,Me-Oe)]);l.style.minWidth=Ne+"px",l.style.right=ue+"px"}const D=g(),P=window.innerHeight-xi*2,I=b.scrollHeight,z=window.getComputedStyle(d),L=parseInt(z.borderTopWidth,10),H=parseInt(z.paddingTop,10),W=parseInt(z.borderBottomWidth,10),V=parseInt(z.paddingBottom,10),K=L+H+I+V+W,M=Math.min(y.offsetHeight*5,K),G=window.getComputedStyle(b),q=parseInt(G.paddingTop,10),F=parseInt(G.paddingBottom,10),U=A.top+A.height/2-xi,ee=P-U,ne=y.offsetHeight/2,X=y.offsetTop+ne,ie=L+H+X,Z=K-ie;if(ie<=U){const le=D.length>0&&y===D[D.length-1].ref.current;l.style.bottom="0px";const re=d.clientHeight-b.offsetTop-b.offsetHeight,Ue=Math.max(ee,ne+(le?F:0)+re+W),Ne=ie+Ue;l.style.height=Ne+"px"}else{const le=D.length>0&&y===D[0].ref.current;l.style.top="0px";const Ue=Math.max(U,L+b.offsetTop+(le?q:0)+ne)+Z;l.style.height=Ue+"px",b.scrollTop=ie-U+b.offsetTop}l.style.margin=`${xi}px 0`,l.style.minHeight=M+"px",l.style.maxHeight=P+"px",s==null||s(),requestAnimationFrame(()=>x.current=!0)}},[g,i.trigger,i.valueNode,l,d,b,y,w,i.dir,s]);xs(()=>N(),[N]);const[C,k]=h.useState();xs(()=>{d&&k(window.getComputedStyle(d).zIndex)},[d]);const S=h.useCallback(A=>{A&&j.current===!0&&(N(),_==null||_(),j.current=!1)},[N,_]);return r.jsx(kPe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:x,onScrollButtonChange:S,children:r.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:r.jsx(Mt.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});LH.displayName=NPe;var SPe="SelectPopperPosition",y5=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=xi,...i}=e,o=Rv(n);return r.jsx(xH,{...o,...i,ref:t,align:s,collisionPadding:a,style:{boxSizing:"border-box",...i.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)"}})});y5.displayName=SPe;var[kPe,e3]=af(Md,{}),b5="SelectViewport",$H=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...a}=e,i=Nc(b5,n),o=e3(b5,n),l=xn(t,i.onViewportChange),c=h.useRef(0);return r.jsxs(r.Fragment,{children:[r.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:s}),r.jsx(Ov.Slot,{scope:n,children:r.jsx(Mt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Rt(a.onScroll,d=>{const f=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const x=Math.abs(c.current-f.scrollTop);if(x>0){const j=window.innerHeight-xi*2,b=parseFloat(m.style.minHeight),y=parseFloat(m.style.height),w=Math.max(b,y);if(w<j){const _=w+x,N=Math.min(j,_),C=_-N;m.style.height=N+"px",m.style.bottom==="0px"&&(f.scrollTop=C>0?C:0,m.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});$H.displayName=b5;var BH="SelectGroup",[CPe,EPe]=af(BH),APe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=Fs();return r.jsx(CPe,{scope:n,id:a,children:r.jsx(Mt.div,{role:"group","aria-labelledby":a,...s,ref:t})})});APe.displayName=BH;var FH="SelectLabel",zH=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=EPe(FH,n);return r.jsx(Mt.div,{id:a.id,...s,ref:t})});zH.displayName=FH;var rb="SelectItem",[TPe,UH]=af(rb),qH=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:i,...o}=e,l=_c(rb,n),c=Nc(rb,n),d=l.value===s,[f,m]=h.useState(i??""),[g,x]=h.useState(!1),j=xn(t,_=>{var N;return(N=c.itemRefCallback)==null?void 0:N.call(c,_,s,a)}),b=Fs(),y=h.useRef("touch"),w=()=>{a||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> 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 r.jsx(TPe,{scope:n,value:s,disabled:a,textId:b,isSelected:d,onItemTextChange:h.useCallback(_=>{m(N=>N||((_==null?void 0:_.textContent)??"").trim())},[]),children:r.jsx(Ov.ItemSlot,{scope:n,value:s,disabled:a,textValue:f,children:r.jsx(Mt.div,{role:"option","aria-labelledby":b,"data-highlighted":g?"":void 0,"aria-selected":d&&g,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:j,onFocus:Rt(o.onFocus,()=>x(!0)),onBlur:Rt(o.onBlur,()=>x(!1)),onClick:Rt(o.onClick,()=>{y.current!=="mouse"&&w()}),onPointerUp:Rt(o.onPointerUp,()=>{y.current==="mouse"&&w()}),onPointerDown:Rt(o.onPointerDown,_=>{y.current=_.pointerType}),onPointerMove:Rt(o.onPointerMove,_=>{var N;y.current=_.pointerType,a?(N=c.onItemLeave)==null||N.call(c):y.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Rt(o.onPointerLeave,_=>{var N;_.currentTarget===document.activeElement&&((N=c.onItemLeave)==null||N.call(c))}),onKeyDown:Rt(o.onKeyDown,_=>{var C;((C=c.searchRef)==null?void 0:C.current)!==""&&_.key===" "||(pPe.includes(_.key)&&w(),_.key===" "&&_.preventDefault())})})})})});qH.displayName=rb;var yh="SelectItemText",KH=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,...i}=e,o=_c(yh,n),l=Nc(yh,n),c=UH(yh,n),d=bPe(yh,n),[f,m]=h.useState(null),g=xn(t,w=>m(w),c.onItemTextChange,w=>{var _;return(_=l.itemTextRefCallback)==null?void 0:_.call(l,w,c.value,c.disabled)}),x=f==null?void 0:f.textContent,j=h.useMemo(()=>r.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:b,onNativeOptionRemove:y}=d;return xs(()=>(b(j),()=>y(j)),[b,y,j]),r.jsxs(r.Fragment,{children:[r.jsx(Mt.span,{id:c.textId,...i,ref:g}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?fc.createPortal(i.children,o.valueNode):null]})});KH.displayName=yh;var VH="SelectItemIndicator",HH=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return UH(VH,n).isSelected?r.jsx(Mt.span,{"aria-hidden":!0,...s,ref:t}):null});HH.displayName=VH;var v5="SelectScrollUpButton",WH=h.forwardRef((e,t)=>{const n=Nc(v5,e.__scopeSelect),s=e3(v5,e.__scopeSelect),[a,i]=h.useState(!1),o=xn(t,s.onScrollButtonChange);return xs(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?r.jsx(YH,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});WH.displayName=v5;var w5="SelectScrollDownButton",GH=h.forwardRef((e,t)=>{const n=Nc(w5,e.__scopeSelect),s=e3(w5,e.__scopeSelect),[a,i]=h.useState(!1),o=xn(t,s.onScrollButtonChange);return xs(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;i(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?r.jsx(YH,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});GH.displayName=w5;var YH=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=e,i=Nc("SelectScrollButton",n),o=h.useRef(null),l=Iv(n),c=h.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),xs(()=>{var f;const d=l().find(m=>m.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),r.jsx(Mt.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Rt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:Rt(a.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:Rt(a.onPointerLeave,()=>{c()})})}),PPe="SelectSeparator",JH=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Mt.div,{"aria-hidden":!0,...s,ref:t})});JH.displayName=PPe;var j5="SelectArrow",OPe=h.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=Rv(n),i=_c(j5,n),o=Nc(j5,n);return i.open&&o.position==="popper"?r.jsx(yH,{...a,...s,ref:t}):null});OPe.displayName=j5;var IPe="SelectBubbleInput",QH=h.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const a=h.useRef(null),i=xn(s,a),o=Ob(t);return h.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&f){const m=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(m)}},[o,t]),r.jsx(Mt.select,{...n,style:{...Nz,...n.style},ref:i,defaultValue:t})});QH.displayName=IPe;function XH(e){return e===""||e===void 0}function ZH(e){const t=ti(e),n=h.useRef(""),s=h.useRef(0),a=h.useCallback(o=>{const l=n.current+o;t(l),(function c(d){n.current=d,window.clearTimeout(s.current),d!==""&&(s.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),i=h.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,a,i]}function eW(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=RPe(e,Math.max(i,0));a.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function RPe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var MPe=CH,tW=AH,DPe=PH,LPe=OH,$Pe=IH,nW=RH,BPe=$H,rW=zH,sW=qH,FPe=KH,zPe=HH,aW=WH,iW=GH,oW=JH;const cc=MPe,dc=DPe,Jo=h.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(tW,{ref:s,className:rn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(LPe,{asChild:!0,children:r.jsx(gt,{className:"h-4 w-4 opacity-50"})})]}));Jo.displayName=tW.displayName;const lW=h.forwardRef(({className:e,...t},n)=>r.jsx(aW,{ref:n,className:rn("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Mn,{className:"h-4 w-4"})}));lW.displayName=aW.displayName;const cW=h.forwardRef(({className:e,...t},n)=>r.jsx(iW,{ref:n,className:rn("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(gt,{className:"h-4 w-4"})}));cW.displayName=iW.displayName;const Qo=h.forwardRef(({className:e,children:t,position:n="popper",...s},a)=>r.jsx($Pe,{children:r.jsxs(nW,{ref:a,className:rn("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]:sli
1046de-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,...s,children:[r.jsx(lW,{}),r.jsx(BPe,{className:rn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(cW,{})]})}));Qo.displayName=nW.displayName;const UPe=h.forwardRef(({className:e,...t},n)=>r.jsx(rW,{ref:n,className:rn("px-2 py-1.5 text-sm font-semibold",e),...t}));UPe.displayName=rW.displayName;const Kn=h.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(sW,{ref:s,className:rn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(zPe,{children:r.jsx(Tn,{className:"h-4 w-4"})})}),r.jsx(FPe,{children:t})]}));Kn.displayName=sW.displayName;const qPe=h.forwardRef(({className:e,...t},n)=>r.jsx(oW,{ref:n,className:rn("-mx-1 my-1 h-px bg-muted",e),...t}));qPe.displayName=oW.displayName;function KPe({ml:e,idx:t,onChange:n,onRemove:s}){const[a,i]=h.useState(!1);function o(l,c){n({...e,[l]:c})}return r.jsxs("div",{className:"border rounded-xl overflow-hidden bg-white",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-gray-50 cursor-pointer",onClick:()=>i(l=>!l),children:[r.jsx("span",{className:`p-1 rounded ${e.media_type==="audio"?"bg-amber-100 text-amber-600":"bg-purple-100 text-purple-600"}`,children:e.media_type==="audio"?r.jsx(Qee,{className:"w-3 h-3"}):r.jsx($0,{className:"w-3 h-3"})}),r.jsx("span",{className:"text-xs font-semibold text-gray-600 uppercase tracking-wide",children:e.platform||"media"}),e.url&&r.jsx("span",{className:"text-xs text-gray-400 truncate flex-1",children:e.url}),e.has_closed_captions&&r.jsx("span",{className:"text-[10px] font-semibold text-emerald-700 bg-emerald-50 border border-emerald-200 rounded px-1.5 py-0.5",children:"CC"}),r.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),s()},className:"text-gray-300 hover:text-red-500 transition-colors ml-1",children:r.jsx(un,{className:"w-3.5 h-3.5"})}),a?r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400"}):r.jsx(en,{className:"w-3.5 h-3.5 text-gray-400"})]}),a&&r.jsxs("div",{className:"p-3 space-y-3 border-t",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"Media Type"}),r.jsxs(cc,{value:e.media_type||"video",onValueChange:l=>o("media_type",l),children:[r.jsx(Jo,{className:"h-8 text-xs",children:r.jsx(dc,{})}),r.jsxs(Qo,{children:[r.jsx(Kn,{value:"video",children:"video"}),r.jsx(Kn,{value:"audio",children:"audio"})]})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"Platform"}),r.jsxs(cc,{value:e.platform||"other",onValueChange:l=>o("platform",l),children:[r.jsx(Jo,{className:"h-8 text-xs",children:r.jsx(dc,{})}),r.jsxs(Qo,{children:[r.jsx(Kn,{value:"youtube",children:"YouTube"}),r.jsx(Kn,{value:"vimeo",children:"Vimeo"}),r.jsx(Kn,{value:"wistia",children:"Wistia"}),r.jsx(Kn,{value:"spotify",children:"Spotify"}),r.jsx(Kn,{value:"soundcloud",children:"SoundCloud"}),r.jsx(Kn,{value:"buzzsprout",children:"Buzzsprout"}),r.jsx(Kn,{value:"mp3",children:"MP3"}),r.jsx(Kn,{value:"html5",children:"HTML5"}),r.jsx(Kn,{value:"other",children:"Other"})]})]})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"URL"}),r.jsx(It,{className:"h-8 text-xs",value:e.url||"",onChange:l=>o("url",l.target.value),placeholder:"https://..."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"Media ID"}),r.jsx(It,{className:"h-8 text-xs",value:e.media_id||"",onChange:l=>o("media_id",l.target.value),placeholder:"e.g. dQw4w9WgXcQ"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"Channel"}),r.jsx(It,{className:"h-8 text-xs",value:e.channel||"",onChange:l=>o("channel",l.target.value),placeholder:"Channel / author"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"Caption Track URL"}),r.jsx(It,{className:"h-8 text-xs",value:e.caption_track_url||"",onChange:l=>o("caption_track_url",l.target.value),placeholder:"https://..."})]}),r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[r.jsx("input",{type:"checkbox",checked:!!e.has_closed_captions,onChange:l=>o("has_closed_captions",l.target.checked),className:"w-3.5 h-3.5 accent-indigo-600"}),r.jsx("span",{className:"text-xs text-gray-700",children:"Has closed captions / transcript"})]})]})]})}function VPe({item:e,onSave:t,onCancel:n}){const[s,a]=h.useState(e.title||""),[i,o]=h.useState(e.content||""),[l,c]=h.useState(e.source_type!=="text"&&e.content||""),[d]=h.useState(e.file_url||""),[f,m]=h.useState(""),[g,x]=h.useState(!1),[j,b]=h.useState(!1),[y,w]=h.useState(!1),[_,N]=h.useState(e.content_injection||""),[C,k]=h.useState(e.url||""),[S,A]=h.useState(e.source_type||"text"),[T,R]=h.useState(e.content_source||"content_text"),[B,D]=h.useState(e.media_links||[]),[P,I]=h.useState(!1),[z,L]=h.useState(!1),[H,W]=h.useState(!1),[V,K]=h.useState(!1),[M,G]=h.useState(!1),[q,F]=h.useState(!1),[U,ee]=h.useState(!0),ne=S==="text",X=S==="url"||S==="url_with_video"||S==="url_with_podcast",ie=S==="pdf",Z=ne?i:l,ce=ne?o:c;async function le(){if(!e.cc_file_url||j)return;x(!0);const De=await(await fetch(e.cc_file_url)).text();m(De),b(!0),x(!1)}async function re(){if(!d)return;w(!0);const De=await(await fetch(d)).text();c(De),w(!1)}h.useEffect(()=>{d&&!ne&&!e.content&&!y&&re()},[]);async function Ue(){var De;if(!C.trim())return;W(!0);const te=await Y.functions.invoke("scrapeUrl",{url:C});c(((De=te==null?void 0:te.data)==null?void 0:De.text)||""),W(!1)}async function Ne(){if(!C.trim())return;K(!0);const _e=(await(await fetch(C)).text()).match(/<title[^>]*>([^<]+)<\/title>/i);if(_e){let We=_e[1].trim();Object.entries({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&mdash;":"—","&ndash;":"–","&nbsp;":" "}
1046).forEach(([me,ae])=>{We=We.replace(new RegExp(me,"g"),ae)}),We=We.replace(/&#(\d+);/g,(me,ae)=>String.fromCharCode(parseInt(ae))),a(We)}K(!1)}async function Oe(){confirm("Clear extracted CC / transcript for this item?")&&(L(!0),await Y.entities.KnowledgeItem.update(e.id,{cc_file_url:"",cc_char_count:0}),L(!1),t())}async function Me(){I(!0);const te={title:s.trim(),source_type:S,content_source:T,media_links:B,content_injection:_};if(ne)te.content=i,te.char_count=i.length;else if(X)if(te.url=C,te.char_count=l.length,l.length>5e4){const De=new Blob([l],{type:"text/plain"}),{file_url:_e}=await Y.integrations.Core.UploadFile({file:new File([De],"extracted.txt",{type:"text/plain"})});te.file_url=_e,te.content=""}else te.content=l;else if(te.char_count=l.length,l.length>5e4){const De=new Blob([l],{type:"text/plain"}),{file_url:_e}=await Y.integrations.Core.UploadFile({file:new File([De],"extracted.txt",{type:"text/plain"})});te.file_url=_e,te.content=""}else te.content=l;await Y.entities.KnowledgeItem.update(e.id,te),I(!1),t()}function ue(te,De){D(_e=>_e.map((We,tt)=>tt===te?De:We))}function Ve(te){D(De=>De.filter((_e,We)=>We!==te))}function Xe(){D(te=>[...te,{url:"",embed_url:"",media_id:"",media_type:"video",platform:"youtube",channel:"",title:"",has_closed_captions:!1,caption_track_url:""}])}return r.jsxs("div",{className:"flex flex-col h-full bg-gray-50",children:[r.jsxs("div",{className:"bg-white border-b px-6 py-3 flex items-center gap-3 shrink-0",children:[r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-700 transition-colors",children:r.jsx(or,{className:"w-5 h-5"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-lg text-gray-900",children:"Edit Knowledge Item"}),r.jsx("p",{className:"text-xs text-gray-400 uppercase tracking-wide font-medium",children:S})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>ee(te=>!te),className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors",title:U?"Collapse to centered":"Expand to full width",children:U?r.jsx(Lh,{className:"w-4 h-4"}):r.jsx(Nd,{className:"w-4 h-4"})}),r.jsx(de,{variant:"ghost",onClick:n,disabled:P,children:"Cancel"}),r.jsx(de,{onClick:Me,disabled:P||!s.trim(),children:P?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin mr-2"}),"Saving..."]}):"Save Changes"})]})]}),r.jsxs("div",{className:`flex-1 overflow-y-auto p-6 w-full space-y-5 ${U?"":"max-w-3xl mx-auto"}`,children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ot,{children:"Title"}),X&&r.jsxs("button",{type:"button",onClick:Ne,disabled:!C.trim()||V,className:"text-xs font-medium text-indigo-600 hover:text-indigo-700 disabled:text-gray-300 flex items-center gap-1",children:[V?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Rn,{className:"w-3 h-3"}),V?"Extracting...":"Re-extract title"]})]}),r.jsx(It,{value:s,onChange:te=>a(te.target.value),placeholder:"Item title",className:"text-base"})]}),X&&r.jsxs("div",{className:"space-y-1",children:[r.jsx(ot,{children:"URL"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qp,{className:"w-4 h-4 text-gray-400 shrink-0"}),r.jsx(It,{value:C,onChange:te=>k(te.target.value),placeholder:"https://example.com",className:"flex-1"}),r.jsxs(de,{onClick:Ue,disabled:!C.trim()||H,variant:"outline",className:"gap-1.5 shrink-0",children:[H?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Rn,{className:"w-4 h-4"}),H?"Extracting...":"Re-extract"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(ot,{children:"Source Type"}),r.jsxs(cc,{value:S,onValueChange:A,children:[r.jsx(Jo,{children:r.jsx(dc,{})}),r.jsxs(Qo,{children:[r.jsx(Kn,{value:"text",children:"text"}),r.jsx(Kn,{value:"html",children:"html"}),r.jsx(Kn,{value:"pdf",children:"pdf"}),r.jsx(Kn,{value:"url",children:"url"}),r.jsx(Kn,{value:"url_with_video",children:"url_with_video"}),r.jsx(Kn,{value:"url_with_podcast",children:"url_with_podcast"})]})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(ot,{children:"Content Source"}),r.jsxs(cc,{value:T,onValueChange:R,children:[r.jsx(Jo,{children:r.jsx(dc,{})}),r.jsxs(Qo,{children:[r.jsx(Kn,{value:"content_text",children:"content_text"}),r.jsx(Kn,{value:"file",children:"file"})]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(ot,{children:["Media Links",B.length>0&&r.jsx("span",{className:"ml-1.5 text-xs font-normal text-gray-400 bg-gray-100 rounded-full px-2 py-0.5",children:B.length})]}),r.jsxs("button",{type:"button",onClick:Xe,className:"flex items-center gap-1 text-xs text-indigo-600 hover:text-indigo-700 font-medium",children:[r.jsx(ln,{className:"w-3 h-3"})," Add"]})]}),B.length===0?r.jsx("p",{className:"text-xs text-gray-400 italic",children:"No media links."}):B.map((te,De)=>
1046r.jsx(KPe,{ml:te,idx:De,onChange:_e=>ue(De,_e),onRemove:()=>Ve(De)},De))]}),e.file_url&&r.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 border rounded-xl text-sm ${ie?"bg-red-50 border-red-100":"bg-sky-50 border-sky-100"}`,children:[r.jsx(ns,{className:`w-5 h-5 shrink-0 ${ie?"text-red-500":"text-sky-500"}`}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("span",{className:"text-gray-700 font-medium",children:ie?"PDF file attached":"Content stored as file"}),!ie&&r.jsx("p",{className:"text-xs text-gray-400 mt-0.5 truncate",children:e.file_url})]}),r.jsx("a",{href:e.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-600 hover:underline text-xs font-medium shrink-0",children:ie?"View PDF ↗":"Open file ↗"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ot,{children:"Content Injection"}),r.jsx("span",{className:"text-[10px] font-semibold text-amber-700 bg-amber-50 border border-amber-200 rounded px-1.5 py-0.5 uppercase tracking-wide",children:"prepended to content"})]}),r.jsx(rr,{value:_,onChange:te=>N(te.target.value),rows:4,className:"text-sm resize-none",placeholder:"Text injected at the beginning of the content before summarization and chunking…"}),r.jsx("p",{className:"text-xs text-gray-400",children:"This text will be prepended to the extracted content when summarizing and chunking."})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ot,{children:ne?"Content":"Extracted Text (used for RAG / chunking)"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>F(te=>!te),title:"Toggle special character display",className:`text-xs px-2 py-0.5 rounded border transition-colors font-mono ${q?"bg-indigo-50 border-indigo-300 text-indigo-700":"border-gray-200 text-gray-400 hover:text-gray-600"}`,children:"¶"}),!ne&&d&&!e.content&&!l&&r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5",onClick:re,disabled:y,children:[y?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Rn,{className:"w-3 h-3"}),y?"Loading...":"Load from file"]})]})]}),!ne&&!l&&!y&&d&&!e.content&&r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-50 border border-amber-200 rounded-lg text-xs text-amber-700",children:[r.jsx(Rn,{className:"w-3.5 h-3.5 shrink-0"}),"Text is stored in a file. Click ",r.jsx("strong",{className:"mx-0.5",children:'"Load from file"'})," above to view and edit it here."]}),q?r.jsx("div",{className:"w-full border rounded-lg px-3 py-2 font-mono text-sm bg-gray-50 min-h-[18rem] max-h-[28rem] overflow-y-auto whitespace-pre-wrap break-all leading-relaxed text-gray-700",style:{tabSize:2},children:Z.replace(/ /g,"·").replace(/\t/g,"→	").split(`
1047`).map((te,De,_e)=>r.jsxs("span",{children:[te,r.jsx("span",{className:"text-indigo-400 select-none",children:"↵"}),De<_e.length-1&&`
1048`]},De))}):r.jsx(rr,{value:Z,onChange:te=>ce(te.target.value),rows:18,className:"font-mono text-sm resize-none",placeholder:ne?"Content...":"Extracted text used for RAG & chunking. Edit to improve search quality."}),!ne&&l&&r.jsx("p",{className:"text-xs text-gray-400",children:"⚠️ This is the text fed into RAG and chunking — editing here changes what the AI sees. Save to persist."}),r.jsx(JAe,{text:Z,onApply:ce,sourceUrl:e.url})]}),e.cc_file_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide flex items-center gap-1.5",children:[r.jsx("span",{className:"font-bold text-[10px] bg-emerald-100 text-emerald-700 border border-emerald-200 rounded px-1.5 py-0.5",children:"CC"}),"Closed Captions / Transcript",e.cc_char_count>0&&r.jsxs("span",{className:"font-mono font-normal text-gray-400",children:[e.cc_char_count.toLocaleString()," chars"]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[!j&&r.jsxs("button",{type:"button",onClick:le,disabled:g,className:"text-xs font-medium text-emerald-600 hover:text-emerald-700 disabled:text-gray-300 flex items-center gap-1",children:[g?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):null,g?"Loading...":"Load CC text"]}),r.jsxs("button",{type:"button",onClick:Oe,disabled:z,className:"text-xs font-medium text-red-500 hover:text-red-700 disabled:text-gray-300 flex items-center gap-1",children:[z?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(sc,{className:"w-3 h-3"}),"Clear CC"]})]})]}),j?r.jsx(rr,{value:f,readOnly:!0,rows:10,className:"font-mono text-xs resize-none bg-emerald-50 border-emerald-200 text-emerald-900"}):r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 bg-emerald-50 border border-emerald-200 rounded-lg text-xs text-emerald-700",children:["CC text is stored in a file. Click ",r.jsx("strong",{className:"mx-0.5",children:'"L
1048oad CC text"'})," above to preview it here."]})]}),(e.human_summary||e.semantic_summary)&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Summaries (read-only)"}),e.human_summary&&r.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded-xl p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("p",{className:"text-xs font-semibold text-blue-600",children:"Human Summary"}),r.jsxs("span",{className:"text-[10px] text-blue-400 font-mono",children:[e.human_summary.length.toLocaleString()," chars"]})]}),r.jsx("p",{className:"text-xs text-blue-800 leading-relaxed whitespace-pre-wrap",children:e.human_summary})]}),e.semantic_summary&&r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-xl p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("p",{className:"text-xs font-semibold text-violet-600",children:"Semantic Summary"}),r.jsxs("span",{className:"text-[10px] text-violet-400 font-mono",children:[e.semantic_summary.length.toLocaleString()," chars"]})]}),r.jsx("p",{className:"text-xs text-violet-800 leading-relaxed whitespace-pre-wrap",children:e.semantic_summary})]})]}),r.jsxs("div",{className:"border rounded-xl overflow-hidden bg-white",children:[r.jsxs("button",{onClick:()=>G(te=>!te),className:"w-full flex items-center justify-between px-4 py-3 text-sm font-medium text-gray-500 bg-gray-50 hover:bg-gray-100 transition-colors",children:[r.jsx("span",{children:"Item Metadata"}),M?r.jsx(gt,{className:"w-4 h-4"}):r.jsx(en,{className:"w-4 h-4"})]}),M&&r.jsxs("div",{className:"p-4 grid grid-cols-2 gap-3 text-xs border-t",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-400 font-semibold uppercase tracking-wide",children:"ID"}),r.jsx("p",{className:"font-mono text-gray-700 mt-0.5 break-all",children:e.id})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-400 font-semibold uppercase tracking-wide",children:"Status"}),r.jsx("p",{className:"text-gray-700 mt-0.5 capitalize",children:e.status||"—"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-400 font-semibold uppercase tracking-wide",children:"Char Count"}),r.jsx("p",{className:"text-gray-700 mt-0.5",children:(e.char_count||0).toLocaleString()})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-400 font-semibold uppercase tracking-wide",children:"KB ID"}),r.jsx("p",{className:"font-mono text-gray-700 mt-0.5 break-all",children:e.knowledge_base_id})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-400 font-semibold uppercase tracking-wide",children:"Created"}),r.jsx("p",{className:"text-gray-700 mt-0.5",children:e.created_date?new Date(e.created_date).toLocaleString():"—"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-400 font-semibold uppercase tracking-wide",children:"Updated"}),r.jsx("p",{className:"text-gray-700 mt-0.5",children:e.updated_date?new Date(e.updated_date).toLocaleString():"—"})]}),e.file_url&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-gray-400 font-semibold uppercase tracking-wide",children:"File URL"}),r.jsx("p",{className:"font-mono text-gray-700 mt-0.5 break-all",children:e.file_url})]}),e.created_by&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-gray-400 font-semibold uppercase tracking-wide",children:"Created By"}),r.jsx("p",{className:"text-gray-700 mt-0.5",children:e.created_by})]})]})]})]})]})}function _5(e){return e.replace(/\n/g,"\\n").replace(/\t/g,"\\t")}
1048function HPe(e){return e.replace(/\\n/g,`
1049`).replace(/\\t/g,"	")}const WPe=[{label:"\\n\\n",value:`
1050
1051`},{label:"\\n",value:`
1052`},{label:". ",value:". "},{label:"! ",value:"! "},{label:"? ",value:"? "},{label:" ",value:" "}];function Mv({value:e=[],onChange:t,ignoreBetweenNumbers:n=[],onIgnoreBetweenNumbersChange:s}){const[a,i]=h.useState(""),o=!!s;function l(g){if(g==="")return;const x=HPe(g);if(x.length!==0){if(e.includes(x)){i("");return}t([...e,x]),i("")}}function c(g){const x=e[g];t(e.filter((j,b)=>b!==g)),o&&n.includes(x)&&s(n.filter(j=>j!==x))}function d(g){o&&(n.includes(g)?s(n.filter(x=>x!==g)):s([...n,g]))}function f(g){g.key==="Enter"&&(g.preventDefault(),l(a))}const m=WPe.filter(g=>!e.includes(g.value));return r.jsxs("div",{className:"space-y-2",children:[o&&e.length>0&&r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-gray-400 px-1",children:[r.jsx("span",{className:"flex-1",children:"Separator"}),r.jsx("span",{className:"w-28 text-center",children:"Ignore between digits"}),r.jsx("span",{className:"w-5"})]}),r.jsxs("div",{className:"min-h-[38px] flex flex-col gap-1 p-2 border rounded-lg bg-gray-50",children:[e.length===0&&r.jsx("span",{className:"text-xs text-gray-400 italic self-center ml-1 py-1",children:"No separators"}),e.map((g,x)=>{const j=_5(g),b=g.includes(`
1053`),y=g.trim()===""&&g.length>0,w=!b&&!y&&g.includes(" "),_=n.includes(g);function N(){if(y)return r.jsxs("span",{className:"flex items-center gap-0.5",children:[[...g].map((k,S)=>r.jsx("span",{className:"inline-block w-3 h-4 rounded bg-indigo-200 border border-indigo-400",title:"space"},S)),r.jsx("em",{className:"text-indigo-500 not-italic text-[10px] ml-1",children:"(space)"})]});if(w){const k=j.split(/([ ]+)/);return r.jsx("span",{className:"flex items-center gap-0.5 flex-wrap",children:k.map((S,A)=>S===""?null:/^ +$/.test(S)?r.jsx("span",{className:"flex items-center gap-0.5",children:[...S].map((T,R)=>r.jsx("span",{className:"inline-block w-3 h-4 rounded bg-indigo-200 border border-indigo-400",title:"space"},R))},A):r.jsx("span",{children:S},A))})}return r.jsx("span",{className:"truncate",children:j})}const C=g.includes("\\n")&&!g.includes(`
1054`);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:`inline-flex items-center gap-1 text-xs font-mono px-2 py-1 rounded border flex-1 min-w-0
1055                  ${C?"bg-red-50 text-red-700 border-red-300":b||y||w?"bg-indigo-50 text-indigo-700 border-indigo-200":"bg-white text-gray-700 border-gray-300"}`,title:`Bytes: ${[...g].map(k=>k===`
1056`?"\\n":k==="	"?"\\t":k===" "?"SP":k).join("|")} · len=${g.length}`,children:[N(),C&&r.jsx("span",{className:"text-red-500 text-[9px] font-bold ml-1",title:"This separator contains literal \\\\ and n characters — not a real newline. It will never match text with actual line breaks!",children:"⚠ escaped!"})]}),o&&r.jsx("button",{onClick:()=>d(g),title:"Ignore this separator when it appears between two digit characters (e.g. '.' in '3.14')",className:`w-28 flex items-center justify-center gap-1 text-[10px] font-medium px-2 py-1 rounded border transition-colors
1057                    ${_?"bg-amber-50 border-amber-300 text-amber-700":"bg-white border-gray-200 text-gray-400 hover:border-amber-300 hover:text-amber-600"}`,children:_?"✓ ignore":"ignore"}),r.jsx("button",{onClick:()=>c(x),className:"text-gray-400 hover:text-red-500 transition-colors shrink-0",children:r.jsx(jt,{className:"w-3.5 h-3.5"})})]},x)})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",value:a,onChange:g=>i(g.target.value),onKeyDown:f,placeholder:"Type separator, use \\n for newline…",className:"flex-1 border rounded-lg px-3 py-1.5 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("button",{onClick:()=>l(a),disabled:a==="",className:"flex items-center gap-1 px-3 py-1.5 bg-indigo-600 text-white rounded-lg text-sm hover:bg-indigo-700 disabled:opacity-40 transition-colors",children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," Add"]})]}),m.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-1 items-center",children:[r.jsx("span",{className:"text-[11px] text-gray-400",children:"Qu
1057ick add:"}),m.map(g=>r.jsx("button",{onClick:()=>t([...e,g.value]),className:"text-[11px] font-mono px-2 py-0.5 rounded border border-dashed border-gray-300 text-gray-500 hover:border-indigo-400 hover:text-indigo-600 transition-colors",children:g.label},g.label))]}),r.jsxs("p",{className:"text-[11px] text-gray-400",children:["Use ",r.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"\\n"})," for newline. Separators are tried top-to-bottom (highest priority first).",o&&r.jsxs(r.Fragment,{children:[" Toggle ",r.jsx("strong",{className:"text-amber-600",children:"ignore"})," on a separator to skip it when it appears between two digit characters (e.g. avoid splitting ",r.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"3.14"}),")."]})]})]})}const Ao={chunk_size:1e3,chunk_overlap:150,min_chunk_size:0,min_chunk_size_action:"discard",chunk_separators:[`
1058
1059`,`
1060`,". ","! ","? "," "],chunk_separators_ignore_between_numbers:[],chunk_mode:"both_last",delay_ms:0};function Ap({title:e,onConfirm:t,onCancel:n,kb:s}){const[a,i]=h.useState(Ao),[o,l]=h.useState(!0);return h.useEffect(()=>{Y.entities.AppConfig.filter({key:"global"}).then(c=>{var g,x;const d=c==null?void 0:c[0],f={chunk_size:(d==null?void 0:d.chunk_size)??Ao.chunk_size,chunk_overlap:(d==null?void 0:d.chunk_overlap)??Ao.chunk_overlap,min_chunk_size:(d==null?void 0:d.min_chunk_size)??Ao.min_chunk_size,chunk_separators:(d==null?void 0:d.chunk_separators)??Ao.chunk_separators,chunk_separators_ignore_between_numbers:(d==null?void 0:d.chunk_separators_ignore_between_numbers)??Ao.chunk_separators_ignore_between_numbers,chunk_mode:(d==null?void 0:d.chunk_mode)??Ao.chunk_mode,min_chunk_size_action:(d==null?void 0:d.min_chunk_size_action)??Ao.min_chunk_size_action,delay_ms:Ao.delay_ms},m={chunk_size:(s==null?void 0:s.chunk_size)??f.chunk_size,chunk_overlap:(s==null?void 0:s.chunk_overlap)??f.chunk_overlap,min_chunk_size:(s==null?void 0:s.min_chunk_size)??f.min_chunk_size,chunk_separators:(((g=s==null?void 0:s.chunk_separators)==null?void 0:g.length)>0?s.chunk_separators:null)??f.chunk_separators,chunk_separators_ignore_between_numbers:(((x=s==null?void 0:s.chunk_separators_ignore_between_numbers)==null?void 0:x.length)>0?s.chunk_separators_ignore_between_numbers:null)??f.chunk_separators_ignore_between_numbers,chunk_mode:(s==null?void 0:s.chunk_mode)??f.chunk_mode,min_chunk_size_action:(s==null?void 0:s.min_chunk_size_action)??f.min_chunk_size_action,delay_ms:0};i(m),l(!1)})},[]),r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-2xl flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Nb,{className:"w-4 h-4 text-indigo-600"}),r.jsx("h2",{className:"font-semibold text-gray-900",children:e})]}),r.jsx("button",{onClick:n,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100",children:r.jsx(jt,{className:"w-4 h-4"})})]}),o?r.jsx("div",{className:"p-6 text-center text-sm text-gray-400",children:"Loading config…"}):r.jsxs("div",{className:"p-5 space-y-4",children:[s&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-lg px-3 py-2 text-xs text-indigo-700",children:['Defaults from KB "',r.jsx("strong",{children:s.name}),'" (falls back to global if blank).']}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:["Chunk Size ",r.jsx("span",{className:"text-gray-400",children:"(chars)"})]}),r.jsx("input",{type:"number",min:0,max:1e4,value:a.chunk_size,onChange:c=>i(d=>({...d,chunk_size:Math.max(0,parseInt(c.target.value)||0)})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:["Chunk Overlap ",r.jsx("span",{className:"text-gray-400",children:"(chars)"})]}),r.jsx("input",{type:"number",min:0,max:1e3,value:a.chunk_overlap,onChange:c=>i(d=>({...d,chunk_overlap:Math.max(0,parseInt(c.target.value)||0)})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:["Min Chunk Size ",r.jsx("span",{className:"text-gray-400",children:"(0 = disabled)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"number",min:0,value:a.min_chunk_size,onChange:c=>i(d=>({...d,min_chunk_size:Math.max(0,parseInt(c.target.value)||0)})),className:"flex-1 border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300"}),r.jsxs("select",{value:a.min_chunk_size_action,onChange:c=>i(d=>({...d,min_chunk_size_action:c.target.value})),className:"border rounded-lg px-2 py-2 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300",children:[r.jsx("option",{value:"discard",children:"Discard"}),r.jsx("option",{value:"append",children:"Append"})]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"Chunking Mode"}
1060),r.jsxs("select",{value:a.chunk_mode,onChange:c=>i(d=>({...d,chunk_mode:c.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-2 focus:ring-indigo-300",children:[r.jsx("option",{value:"size",children:"Size only"}),r.jsx("option",{value:"separators",children:"Separators only"}),r.jsx("option",{value:"both_first",children:"Size + Separators (first)"}),r.jsx("option",{value:"both_last",children:"Size + Separators (last)"})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-2",children:"Separator Characters"}),r.jsx(Mv,{value:a.chunk_separators||[],onChange:c=>i(d=>({...d,chunk_separators:c})),ignoreBetweenNumbers:a.chunk_separators_ignore_between_numbers||[],onIgnoreBetweenNumbersChange:c=>i(d=>({...d,chunk_separators_ignore_between_numbers:c}))})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:["Delay Between Items ",r.jsx("span",{className:"text-gray-400",children:"(ms)"})]}),r.jsx("input",{type:"number",min:0,step:50,value:a.delay_ms,onChange:c=>i(d=>({...d,delay_ms:parseInt(c.target.value)||0})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300"})]})]}),r.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[r.jsx(de,{variant:"outline",className:"flex-1",onClick:n,children:"Cancel"}),r.jsx(de,{className:"flex-1 bg-indigo-600 hover:bg-indigo-700",onClick:()=>t(a),children:"Run Chunking"})]})]})]})})}function GPe({chunk:e,index:t,total:n,onEmbedded:s}){var j;const[a,i]=h.useState(e),[o,l]=h.useState(!1),[c,d]=h.useState(null),[f,m]=h.useState(!1);async function g(){var y;l(!0),d(null);const b=await Y.functions.invoke("localChunkEmbedding",{knowledge_item_id:a.knowledge_item_id,chunk_id:a.id});if((y=b.data)!=null&&y.error)d(b.data.error);else{const w=await Y.entities.KnowledgeChunk.filter({id:a.id});w[0]&&(i(w[0]),s==null||s())}l(!1)}const x=a.vector&&a.vector.length>0;return r.jsxs("div",{className:"border rounded-xl p-4 bg-gray-50 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-xs font-semibold text-indigo-600 bg-indigo-50 border border-indigo-100 rounded-full px-2 py-0.5",children:["Chunk ",t+1," / ",n]}),x&&r.jsxs("span",{className:"flex items-center gap-1 text-[11px] font-medium text-emerald-700 bg-emerald-50 border border-emerald-200 rounded-full px-2 py-0.5",children:[r.jsx(mr,{className:"w-3 h-3"})," local vec · ",a.vector.length," dims"]}),a.vector_db_id&&r.jsxs("span",{className:"flex items-center gap-1 text-[11px] font-medium text-orange-700 bg-orange-50 border border-orange-200 rounded-full px-2 py-0.5",children:[r.jsx(_n,{className:"w-3 h-3"})," DB synced"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-xs text-gray-400",children:[((j=a.char_count)==null?void 0:j.toLocaleString())??a.content.length," chars"]}),r.jsxs(de,{size:"sm",variant:"outline",className:"h-6 px-2 text-[11px] gap-1 text-emerald-700 border-emerald-200 hover:bg-emerald-50",onClick:g,disabled:o,children:[o?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(_n,{className:"w-3 h-3"}),o?"Saving…":x?"Re-embed Local":"Embed Local"]})]})]}),r.jsx("p",{className:"text-xs text-gray-700 font-mono whitespace-pre-wrap leading-relaxed",children:a.content}),x&&r.jsxs("div",{className:"border border-emerald-200 rounded-lg bg-white p-3 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_n,{className:"w-3.5 h-3.5 text-emerald-600"}),r.jsx("span",{className:"text-xs font-semibold text-emerald-700",children:"Local Vector"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[a.vector_model&&r.jsxs("span",{className:"text-[11px] text-gray-400",children:["model: ",r.jsx("code",{className:"font-mono",children:a.vector_model})]}),r.jsxs("span",{className:"text-[11px] bg-emerald-50 border border-emerald-200 text-emerald-700 rounded-full px-2 py-0.5 font-semibold",children:[a.vector.length," dims"]}),r.jsx("button",{onClick:()=>m(b=>!b),className:"text-gray-400 hover:text-gray-600 transition-colors",children:f?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("div",{className:"font-mono text-[11px] text-gray-600 bg-gray-50 rounded-lg p-2 overflow-x-auto whitespace-nowrap",children:["[",a.vector.slice(0,16).map(b=>b.toFixed(6)).join(", "),a.vector.length>16?", …":"","]"]}),f&&r.jsx("div",{className:"font-mono text-[10px] text-gray-500 bg-gray-50 rounded-lg p-2 max-h-40 overflow-y-auto whitespace-pre-wrap break-all",children:JSON.stringify(a.vector)}
1060),a.vector_db_id&&r.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400 flex-wrap",children:[r.jsxs("span",{children:["DB ID: ",r.jsx("code",{className:"font-mono text-gray-600",children:a.vector_db_id})]}),a.vector_db_timestamp&&r.jsxs("span",{children:["Synced: ",r.jsx("code",{className:"font-mono",children:new Date(a.vector_db_timestamp).toLocaleString()})]})]})]}),c&&r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-2 text-xs text-red-700",children:c})]})}function YPe({item:e,kb:t,onClose:n,onRechunked:s}){const[a,i]=h.useState([]),[o,l]=h.useState(!0),[c,d]=h.useState(!1),[f,m]=h.useState(!1),[g,x]=h.useState(!1),[j,b]=h.useState(0),[y,w]=h.useState(!1),[_,N]=h.useState(null);h.useEffect(()=>{C()},[e.id]);async function C(){l(!0);const T=await Y.entities.KnowledgeChunk.filter({knowledge_item_id:e.id},"chunk_index");i(T),l(!1)}async function k(){if(!confirm(`Delete all ${a.length} chunks for "${e.title}"?`))return;x(!0),b(0);const T=5;let R=0;for(let B=0;B<a.length;B+=T){const D=a.slice(B,B+T);await Promise.all(D.map(P=>Y.entities.KnowledgeChunk.delete(P.id).catch(()=>{}))),R+=D.length,b(R),B+T<a.length&&await new Promise(P=>setTimeout(P,300))}i([]),x(!1),b(0),s==null||s()}async function S(T){m(!1),d(!0),await Y.functions.invoke("chunkItem",{item_id:e.id,...T}),await C(),d(!1),s==null||s()}async function A(){w(!0),N(null);const T=await Y.functions.invoke("localChunkEmbedding",{knowledge_item_id:e.id});N(T.data),await C(),w(!1)}return r.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[f&&r.jsx(Ap,{title:`Re-chunk: ${e.title}`,onConfirm:S,onCancel:()=>m(!1),kb:t}),r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-2xl max-h-[85vh] flex flex-col",children:[r.jsxs("div",{className:"flex items-start justify-between p-5 border-b shrink-0 gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"font-semibold text-gray-900 truncate",children:e.title}),r.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[o?"Loading…":`${a.length} chunk${a.length!==1?"s":""}`,e.char_count>0&&` · ${e.char_count.toLocaleString()} chars total`]}),!o&&a.length>0&&(()=>{const T=a.filter(D=>D.vector&&D.vector.length>0).length,R=a.filter(D=>D.vector_db_id).length,B=[...new Set(a.filter(D=>D.vector_model).map(D=>D.vector_model))];return r.jsxs("div",{className:"flex items-center gap-2 mt-1.5 flex-wrap",children:[r.jsxs("span",{className:`text-[11px] font-medium px-2 py-0.5 rounded-full border ${T===a.length?"bg-emerald-50 text-emerald-700 border-emerald-200":T>0?"bg-amber-50 text-amber-700 border-amber-200":"bg-gray-100 text-gray-500 border-gray-200"}`,children:[r.jsx(mr,{className:"w-3 h-3 inline mr-0.5"}),T,"/",a.length," local vecs"]}),R>0&&r.jsxs("span",{className:"text-[11px] font-medium px-2 py-0.5 rounded-full border bg-orange-50 text-orange-700 border-orange-200",children:[r.jsx(_n,{className:"w-3 h-3 inline mr-0.5"}),R," DB synced"]}),B.map(D=>r.jsx("span",{className:"text-[11px] font-mono text-gray-400",children:D},D)),_&&r.jsx("span",{className:`text-[11px] px-2 py-0.5 rounded-full border ${_.error?"bg-red-50 text-red-600 border-red-200":"bg-emerald-50 text-emerald-700 border-emerald-200"}`,children:_.error?`Error: ${_.error}`:`✓ ${_.success}/${_.total} embedded`})]})})()]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0 flex-wrap justify-end",children:[a.length>0&&r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50",onClick:A,disabled:y||c||g,children:[y?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(_n,{className:"w-3.5 h-3.5"}),y?"Embedding…":"Embed All Locally"]}),a.length>0&&r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 border-red-200 text-red-600 hover:bg-red-50",onClick:k,disabled:g||c,children:[g?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(un,{className:"w-3.5 h-3.5"}),g?`${j}/${a.length}`:"Clear"]}),r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5",onClick:()=>m(!0),disabled:c||g,children:[c?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Nb,{className:"w-3.5 h-3.5"}),"Re-chunk"]}),r.jsx("button",{onClick:n,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors",children:r.jsx(jt,{className:"w-4 h-4"})})]})]}),r.jsx("div",{className:"overflow-y-auto flex-1 p-5 space-y-3",children:o?r.jsx("div",{className:"text-center py-10 text-gray-400",children:r.jsx(Pe,{className:"w-6 h-6 animate-spin mx-auto"})}):a.length===0?r.jsx("div",{className:"text-center py-10 text-gray-400 text-sm",children:'No chunks found. Click "Re-chunk" to split this item.'}):a.map((T,R)=>r.jsx(GPe,{chunk:T,index:R,total:a.length,onEmbedded:C},T.id))})]})]})}const JPe={pending:null,extracting:r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin text-indigo-500"}),done:r.jsx(Bd,{className:"w-3.5 h-3.5 text-emerald-500"}),error:r.jsx(fr,{className:"w-3.5 h-3.5 text-red-500"})};function QPe({kbId:e,onDone:t,onCancel:n}){var V;const[s,a]=h.useState(""),[i,o]=h.useState([]),[l,c]=h.useState(!1),[d,f]=h.useState(""),[m,g]=h.useState(new Set),[x,j]=h.useState("input"),[b,y]=h.useState([]),[w,_]=h.useState(""),[N,C]=h.useState(!0),[k,S]=h.useState(null),[A,T]=h.useState("");async function R(){var G;if(!s.trim())return;c(!0),f(""),o([]),g(new Set);const K=await Y.functions.invoke("scrapeLinks",{url:s.trim()}),M=((G=K==null?void 0:K.data)==null?void 0:G.links)||[];
1060if(M.length===0)f("No internal links found on this page.");else{const q=[{url:s.trim(),label:"— Root page —"},...M];o(q),j("select")}c(!1)}async function B(){var G;if(!k||!s.trim())return;c(!0),f(""),o([]),g(new Set);const K=await Y.functions.invoke("scrapeLinksFromHtml",{html:await k.text(),base_url:s.trim()}),M=((G=K==null?void 0:K.data)==null?void 0:G.links)||[];if(M.length===0)f("No internal links found in the uploaded HTML.");else{const q=[{url:s.trim(),label:"— Root page —"},...M];o(q),j("select")}c(!1)}function D(K){try{const M=new URL(K);return M.origin+M.pathname.replace(/\/?$/,"/")}catch{return null}}const P=D(s),I=i.filter(K=>N&&P?K.url.startsWith(P):!0);function z(){m.size===I.length&&I.every(K=>m.has(K.url))?g(new Set):g(new Set(I.map(K=>K.url)))}function L(K){g(M=>{const G=new Set(M);return G.has(K)?G.delete(K):G.add(K),G})}async function H(){const K=i.filter(G=>m.has(G.url));if(K.length===0)return;j("processing");const M=await Promise.all(K.map(G=>Y.entities.KnowledgeItem.create({knowledge_base_id:e,title:G.url,source_type:"url",url:G.url,content:"",extracted_text:"",status:"processing"}).then(q=>({id:q.id,url:G.url,label:G.url,status:"pending"}))));y(M);for(const G of M){y(q=>q.map(F=>F.id===G.id?{...F,status:"extracting"}:F));try{await Y.functions.invoke("extractAndSaveUrl",{item_id:G.id}),y(q=>q.map(F=>F.id===G.id?{...F,status:"done"}:F))}catch{y(q=>q.map(F=>F.id===G.id?{...F,status:"error"}:F))}}}const W=b.length>0&&b.every(K=>K.status==="done"||K.status==="error");return r.jsxs("div",{className:"flex flex-col h-full bg-gray-50",children:[r.jsxs("div",{className:"bg-white border-b px-6 py-3 flex items-center gap-3 shrink-0",children:[r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-700 transition-colors",children:r.jsx(or,{className:"w-5 h-5"})}),r.jsx("h2",{className:"font-semibold text-lg text-gray-900",children:"Bulk URL Import"}),x==="select"&&r.jsxs("div",{className:"ml-auto flex gap-2",children:[r.jsx(de,{variant:"ghost",onClick:n,children:"Cancel"}),r.jsxs(de,{onClick:H,disabled:m.size===0,children:["Import ",m.size," page",m.size!==1?"s":""]})]}),W&&r.jsx(de,{className:"ml-auto",onClick:t,children:"Done"})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 max-w-3xl mx-auto w-full space-y-5",children:[x==="input"&&r.jsxs("div",{className:"space-y-5",children:[r.jsx("p",{className:"text-sm text-gray-500",children:"Enter a URL to crawl its internal links, or upload a saved HTML file for pages with dynamic content."}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Option A — Crawl URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{value:s,onChange:K=>a(K.target.value),placeholder:"https://example.com/docs",className:"flex-1 text-base",onKeyDown:K=>K.key==="Enter"&&R()}),r.jsxs(de,{onClick:R,disabled:!s.trim()||l,className:"gap-2 shrink-0",children:[l?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(ur,{className:"w-4 h-4"}),l?"Crawling...":"Crawl"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-400",children:[r.jsx("div",{className:"flex-1 border-t"})," OR ",r.jsx("div",{className:"flex-1 border-t"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Option B — Upload saved HTML"}),r.jsx("p",{className:"text-xs text-gray-400",children:'Use "Save Page As..." in your browser after the page has fully loaded, then upload it here.'}),r.jsx(It,{value:s,onChange:K=>a(K.target.value),placeholder:"Base URL (e.g. https://example.com/docs) — used to resolve links",className:"text-sm"}),r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsxs("label",{className:`flex items-center gap-2 px-4 py-2 border rounded-lg cursor-pointer text-sm transition-colors ${k?"bg-emerald-50 border-emerald-200 text-emerald-700":"bg-white text-gray-600 hover:bg-gray-50"}`,children:[r.jsx(G5,{className:"w-4 h-4"}),k?k.name:"Choose HTML file",r.jsx("input",{type:"file",accept:".html,.htm,.mhtml,.mht",className:"hidden",onChange:K=>S(K.target.files[0]||null)})]}),k&&r.jsxs(de,{onClick:B,disabled:!s.trim()||l,className:"gap-2",children:[l?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(ur,{className:"w-4 h-4"}),l?"Crawling...":"Extract Links"]})]})]}),d&&r.jsxs("p",{className:"text-sm text-red-500 flex items-center gap-1.5",children:[r.jsx(fr,{className:"w-4 h-4"})," ",d]})]}),x==="select"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[r.jsxs("p",{className:"text-sm text-gray-500",children:["Found ",r.jsx("strong",{children:I.length}),N&&I.length!==i.length?` of ${i.length}`:""," pages. Select which to import."]}),r.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 cursor-pointer select-none",children:[r.jsx("input",{type:"checkbox",checked:N,onChange:K=>{C(K.target.checked)},className:"w-3.5 h-3.5 accent-indigo-600"}),"Only subpages"]}),r.jsx("button",{onClick:z,className:"text-xs text-indigo-600 hover:underline",children:I.every(K=>m.has(K.url))&&I.length>0?"Deselect all":"Select all"}),r.jsxs("button",{onClick:()=>{j("input"),o([]),g(new Set),_(""),S(null)},className:"text-xs text-gray-400 hover:text-gray-600 flex items-center gap-1",children:[r.jsx(Rn,{className:"w-3 h-3"})," Change URL"]})]})]}),r.jsx(It,{value:w,onChange:K=>_(K.target.value),placeholder:"Filter by URL or title...",className:"text-sm"}),r.jsxs("div",{className:"border rounded-xl bg-white divide-y overflow-hidden",children:[I.filter(K=>!w.trim()||K.url.toLowerCase().includes(w.toLowerCase())||(K.label||"").toLowerCase().includes(w.toLowerCase())).map(K=>r.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 transition-colors hover:bg-gray-50 ${m.has(K.url)?"bg-indigo-50":""}`,children:[r.jsxs("label",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:m.has(K.url),onChange:()=>L(K.url),className:"w-4 h-4 accent-indigo-600 shrink-0"}),r.jsx(Na,{className:"w-4 h-4 text-gray-400 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-gray-800 truncate",children:K.label||K.url}),r.jsx("p",{className:"text-xs text-gray-400 truncate",children:K.url})]})]}),r.jsx("button",{onClick:()=>{o(M=>M.filter(G=>G.url!==K.url)),g(M=>{const G=new Set(M);return G.delete(K.url),G})},className:"shrink-0 text-gray-300 hover:text-red-500 transition-colors",children:r.jsx(jt,{className:"w-4 h-4"})})]},K.url)),w.trim()&&I.filter(K=>K.url.toLowerCase().includes(w.toLowerCase())||(K.label||"").toLowerCase().includes(w.toLowerCase())).length===0&&r.jsx("div",{className:"px-4 py-6 text-center text-sm text-gray-400",children:"No pages match your filter."})]}),r.jsxs("div",{className:"border rounded-xl bg-white p-4 space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Add URLs manually"}),r.jsx("textarea",{value:A,onChange:K=>T(K.target.value),placeholder:`Paste one URL per line...
1061https://example.com/page-1
1062https://example.com/page-2`,rows:4,className:"w-full text-xs font-mono border rounded-lg p-2 resize-none focus:outline-none focus:ring-1 focus:ring-indigo-300 text-gray-700 placeholder:text-gray-300"}),r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5",disabled:!A.trim(),onClick:()=>{const K=A.split(`
1063`).map(q=>q.trim()).filter(q=>q.startsWith("http")),M=new Set(i.map(q=>q.url)),G=K.filter(q=>!M.has(q)).map(q=>({url:q,label:q}));G.length>0&&(o(q=>[...q,...G]),g(q=>{const F=new Set(q);return G.forEach(U=>F.add(U.url)),F})),T("")},children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," Add to list"]})]})]}),x==="processing"&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("p",{className:"text-sm text-gray-500",children:W?`Finished. ${b.filter(K=>K.status==="done").length} extracted, ${b.filter(K=>K.status==="error").length} failed.`:`Extracting ${b.filter(K=>K.status==="extracting").length>0?`"${(V=b.find(K=>K.status==="extracting"))==null?void 0:V.label}"...`:"..."}`}),r.jsx("div",{className:"border rounded-xl bg-white divide-y overflow-hidden",children:b.map(K=>r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[r.jsx(Na,{className:"w-4 h-4 text-gray-400 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-gray-800 truncate",children:K.label}),r.jsx("p",{className:"text-xs text-gray-400 truncate",children:K.url})]}),r.jsx("div",{className:"shrink-0",children:JPe[K.status]||r.jsx("span",{className:"text-xs text-gray-400",children:"Pending"})})]},K.id))})]})]})]})}function XPe(e){navigator.clipboard.writeText(JSON.stringify(e))}function ZPe(e,t){if(!e||!t||e.length!==t.length)return null;let n=0,s=0,a=0;for(let i=0;i<e.length;
1063i++)n+=e[i]*t[i],s+=e[i]*e[i],a+=t[i]*t[i];return s===0||a===0?null:n/(Math.sqrt(s)*Math.sqrt(a))}function sb({embedding:e,label:t="Embedding",compact:n=!1}){const[s,a]=h.useState(!1),[i,o]=h.useState(!1);if(!e||!Array.isArray(e)||e.length===0)return null;const l=d=>{d.stopPropagation(),XPe(e),o(!0),setTimeout(()=>o(!1),1500)},c=e.slice(0,8).map(d=>d.toFixed(4)).join(", ");return n?r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(ys,{className:"w-3 h-3 text-gray-400 shrink-0"}),r.jsxs("span",{className:"text-[10px] text-gray-400 font-mono truncate",children:["[",c,"…] (",e.length,"d)"]}),r.jsx("button",{onClick:l,className:"shrink-0 text-gray-400 hover:text-indigo-600 transition-colors",children:i?r.jsx(Tn,{className:"w-3 h-3 text-emerald-500"}):r.jsx(ri,{className:"w-3 h-3"})})]}):r.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden bg-white mt-2",children:[r.jsxs("button",{onClick:()=>a(d=>!d),className:"w-full flex items-center justify-between px-3 py-2 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(ys,{className:"w-3.5 h-3.5 text-indigo-400 shrink-0"}),r.jsx("span",{className:"text-xs font-semibold text-gray-600",children:t}),r.jsxs("span",{className:"text-[10px] text-gray-400 font-mono truncate",children:["[",c,"…]"]}),r.jsxs("span",{className:"text-[10px] text-gray-400 shrink-0",children:[e.length,"d"]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx("button",{onClick:l,className:"flex items-center gap-1 text-[10px] text-gray-500 hover:text-indigo-600 border border-gray-200 rounded px-2 py-0.5 bg-white transition-colors",children:i?r.jsxs(r.Fragment,{children:[r.jsx(Tn,{className:"w-2.5 h-2.5 text-emerald-500"})," Copied!"]}):r.jsxs(r.Fragment,{children:[r.jsx(ri,{className:"w-2.5 h-2.5"})," Copy JSON"]})}),s?r.jsx(Mn,{className:"w-3.5 h-3.5 text-gray-400"}):r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400"})]})]}),s&&r.jsx("div",{className:"px-3 pb-3 pt-2 bg-gray-50 border-t max-h-48 overflow-y-auto",children:r.jsx("div",{className:"grid grid-cols-4 md:grid-cols-8 gap-1",children:e.map((d,f)=>r.jsx("span",{className:"text-[9px] font-mono text-gray-500 bg-white border border-gray-100 rounded px-1 py-0.5 text-center",title:`[${f}] ${d}`,children:d.toFixed(3)},f))})})]})}function eOe({doc:e,onDelete:t,showEmbeddings:n}){var m;const[s,a]=h.useState(!1),[i,o]=h.useState(!1),l=e.metadata||{},d={chunk:"bg-indigo-50 text-indigo-700 border-indigo-100",human_summary:"bg-blue-50 text-blue-700 border-blue-100",semantic_summary:"bg-violet-50 text-violet-700 border-violet-100",cc_human_summary:"bg-cyan-50 text-cyan-700 border-cyan-100",cc_semantic_summary:"bg-sky-50 text-sky-700 border-sky-100"}[l.content_type]||"bg-gray-50 text-gray-600 border-gray-200",f=e.embedding?typeof e.embedding=="string"?JSON.parse(e.embedding):e.embedding:null;return r.jsxs("div",{className:"border rounded-lg bg-white overflow-hidden text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[r.jsx("span",{className:`border px-1.5 py-0.5 rounded font-medium shrink-0 ${d}`,children:l.content_type||"unknown"}),l.chunk_index!==void 0&&r.jsxs("span",{className:"text-gray-400",children:["chunk #",l.chunk_index]}),n&&f&&r.jsxs("span",{className:"text-[10px] text-indigo-400 font-medium flex items-center gap-0.5",children:[r.jsx(ys,{className:"w-2.5 h-2.5"}),f.length,"d"]}),r.jsxs("span",{className:"text-gray-400 ml-auto shrink-0",children:[((m=e.content)==null?void 0:m.length)||0," chars"]}),r.jsx("button",{onClick:()=>a(g=>!g),className:"p-1 text-gray-400 hover:text-gray-600",children:s?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:async()=>{confirm("Delete this document?")&&(o(!0),await t(e.id),o(!1))},disabled:i,className:"p-1 text-red-400 hover:text-red-600 disabled:opacity-50",children:i?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(un,{className:"w-3.5 h-3.5"})})]}),s&&r.jsxs("div",{className:"px-3 pb-2 border-t bg-gray-50 space-y-2 pt-2",children:[r.jsx("p",{className:"text-gray-600 whitespace-pre-wrap leading-relaxed",children:e.content}),n&&f&&r.jsx(sb,{embedding:f,label:`Vector (${l.content_type||"doc"})`})]})]})}function tOe({item:e,onClose:t}){const[n,s]=h.useState([]),[a,i]=h.useState(!0),[o,l]=h.useState(null),[c,d]=h.useState(!1);h.useEffect(()=>{f(!1)},[]);async function f(x){var b,y;i(!0),l(null);const j=await Y.functions.invoke("listSupabaseDocuments",{knowledge_item_id:e.id,limit:200,include_embedding:x});if((b=j.data)!=null&&b.error){l(j.data.error),i(!1);return}s(((y=j.data)==null?void 0:y.documents)||[]),i(!1)}const m=async()=>{const x=!c;d(x),x&&n.length>0&&!n[0].embedding&&await f(!0)};async function g(x){var b;const j=await Y.functions.invoke("deleteSupabaseDocument",{id:x});if((b=j.data)!=null&&b.error){l(j.data.error);return}s(y=>y.filter(w=>w.id!==x))}return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b shrink-0",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-gray-900 text-sm",children:"Supabase Docs"}),r.jsx("p",{className:"text-xs text-gray-500 truncate max-w-xs",children:e.title})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[!a&&r.jsxs("span",{className:"text-xs text-gray-400",children:[n.length," docs"]}),r.jsxs("button",{onClick:m,className:`flex items-center gap-1 text-xs border rounded px-2 py-1 transition-colors ${c?"bg-indigo-50 text-indigo-700 border-indigo-200":"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:[r.jsx(ys,{className:"w-3 h-3"})," ",c?"Hide Vectors":"Show Vectors"]}),r.jsx(de,{variant:"ghost",size:"icon",onClick:t,children:r.jsx(jt,{className:"w-4 h-4"})})]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-2",children:[a&&r.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-400",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin mr-2"})," Loading…"]}),o&&r.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 border border-red-200 bg-red-50 rounded-xl p-3",children:[r.jsx(fr,{className:"w-4 h-4 mt-0.5 shrink-0"}),o]}),!a&&!o&&n.length===0&&r.jsx("p",{className:"text-center text-sm text-gray-400 py-10",children:"No Supabase documents found for this item."}),n.map(x=>r.jsx(eOe,{doc:x,onDelete:g,showEmbeddings:c},x.id))]})]})})}function nOe({title:e,onConfirm:t,onCancel:n,kb:s}){return r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-sm",children:[r.jsxs("div",{className:"flex items-center justify-between p-5 border-b",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yn,{className:"w-4 h-4 text-violet-600"}),r.jsx("h2",{className:"font-semibold text-gray-900",children:e})]}),r.jsx("button",{onClick:n,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"p-5 space-y-4",children:[s&&r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-lg px-3 py-2 text-xs text-violet-700",children:['Summarizing items in KB "',r.jsx("strong",{children:s.name}),'".']}),r.jsx("p",{className:"text-sm text-gray-600",children:"This will generate human-readable and semantic summaries for the selected item(s) using the configured LLM model and prompt."}),r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsx(de,{variant:"outline",className:"flex-1",onClick:n,children:"Cancel"}),r.jsx(de,{className:"flex-1 bg-violet-600 hover:bg-violet-700",onClick:()=>t({}),children:"Run Summarization"})]})]})]})})}function rOe({item:e,currentKbId:t,onDone:n,onCancel:s}){const[a,i]=h.useState([]),[o,l]=h.useState(""),[c,d]=h.useState(!1);h.useEffect(()=>{Y.entities.KnowledgeBase.list().then(m=>i(m.filter(g=>g.id!==t)))},[t]);async function f(){if(!o)return;d(!0),await Y.entities.KnowledgeItem.update(e.id,{knowledge_base_id:o});const m=await Y.entities.KnowledgeChunk.filter({knowledge_item_id:e.id});await Promise.all(m.map(g=>Y.entities.KnowledgeChunk.update(g.id,{knowledge_base_id:o}))),d(!1),n()}return r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-sm",children:[r.jsxs("div",{className:"flex items-center justify-between p-5 border-b",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(e7,{className:"w-4 h-4 text-indigo-600"}),r.jsx("h2",{className:"font-semibold text-gray-900",children:"Move Item"})]}),r.jsx("button",{onClick:s,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"p-5 space-y-4",children:[r.jsxs("p",{className:"text-sm text-gray-600 truncate",children:["Moving: ",r.jsx("strong",{children:e.title})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-700 block mb-1.5",children:"Target Knowledge Base"}),r.jsxs("select",{value:o,onChange:m=>l(m.target.value),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-300",children:[r.jsx("option",{value:"",children:"Select a knowledge base..."}),a.map(m=>r.jsx("option",{value:m.id,children:m.name},m.id))]})]}),r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsx(de,{variant:"outline",className:"flex-1",onClick:s,children:"Cancel"}),r.jsxs(de,{className:"flex-1 bg-indigo-600 hover:bg-indigo-700",onClick:f,disabled:!o||c,children:[c?r.jsx(Pe,{className:"w-4 h-4 animate-spin mr-2"}):null,"Move"]})]})]})]})})}function sOe(){const t=new URLSearchParams(window.location.search).get("id"),[n,s]=h.useState(null),[a,i]=h.useState([]),[o,l]=h.useState(!1),[c,d]=h.useState(null),[f,m]=h.useState(!0),[g,x]=h.useState({}),[j,b]=h.useState({}),[y,w]=h.useState(!1),[_,N]=h.useState(null),[C,k]=h.useState(null),[S,A]=h.useState(null),[T,R]=h.useState(!1),[B,D]=h.useState(!1),[P,I]=h.useState(!1),[z,L]=h.useState(!1),[H,W]=h.useState(null),[V,K]=h.useState(!1),[M,G]=h.useState(new Set),[q,F]=h.useState(null),[U,ee]=h.useState(!1),[ne,X]=h.useState(null),[ie,Z]=h.useState(!1),[ce,le]=h.useState(null),[re,Ue]=h.useState(null),[Ne,Oe]=h.useState(null),[Me,ue]=h.useState({}),[Ve,Xe]=h.useState(null),[te,De]=h.useState(!1),[_e,We]=h.useState(!1),[tt,me]=h.useState(null),[ae,Se]=h.useState(!1),[Le,He]=h.useState(!1),[ut,ze]=h.useState(!1),[fe,dt]=h.useState(null),[ct,Wt]=h.useState(null),[bt,sn]=h.useState(!1),[we,Qe]=h.useState(null);h.useEffect(()=>{t&&Gt()},[t]);const[it,at]=h.useState(!1);async function Gt(){m(!0);const[ye,qe,nt]=await Promise.all([Y.entities.KnowledgeBase.filter({id:t}),Y.entities.KnowledgeItem.filter({knowledge_base_id:t},"-created_date"),Y.entities.KnowledgeChunk.filter({knowledge_base_id:t})]);s(ye[0]);
1063const ft={},Lt={};nt.forEach(Yt=>{ft[Yt.knowledge_item_id]=(ft[Yt.knowledge_item_id]||0)+1,Yt.vector&&Yt.vector.length>0&&(Lt[Yt.knowledge_item_id]=(Lt[Yt.knowledge_item_id]||0)+1)}),x(ft),b(Lt),i(qe),at(!1),m(!1)}async function Cn(){m(!0),at(!1);const[ye,qe,nt]=await Promise.all([Y.entities.KnowledgeBase.filter({id:t}),Y.entities.KnowledgeItem.filter({knowledge_base_id:t},"-created_date"),Y.entities.KnowledgeChunk.filter({knowledge_base_id:t})]);s(ye[0]);const ft={},Lt={};nt.forEach(Yt=>{ft[Yt.knowledge_item_id]=(ft[Yt.knowledge_item_id]||0)+1,Yt.vector&&Yt.vector.length>0&&(Lt[Yt.knowledge_item_id]=(Lt[Yt.knowledge_item_id]||0)+1)}),x(ft),b(Lt),i(qe),m(!1),Jn(qe)}async function Jn(ye){const qe=ye||a;if(!qe.length)return;at(!1);const nt=await Promise.all(qe.map(Yt=>Y.functions.invoke("listSupabaseDocuments",{knowledge_item_id:Yt.id,limit:1e3}).then(pn=>{var je,Ke,Te;return{id:Yt.id,count:((je=pn==null?void 0:pn.data)==null?void 0:je.total)??((Te=(Ke=pn==null?void 0:pn.data)==null?void 0:Ke.documents)==null?void 0:Te.length)??0}}).catch(()=>({id:Yt.id,count:Yt.supabase_doc_count??0})))),ft={};nt.forEach(Yt=>{ft[Yt.id]=Yt.count}),i(Yt=>Yt.map(pn=>({...pn,supabase_doc_count:ft[pn.id]??pn.supabase_doc_count??0})));const Lt=qe.filter(Yt=>(Yt.supabase_doc_count??0)!==ft[Yt.id]);await Promise.all(Lt.map(Yt=>Y.entities.KnowledgeItem.update(Yt.id,{supabase_doc_count:ft[Yt.id]}).catch(()=>{}))),at(!0)}async function Hn(ye){A(null);const qe=await Y.entities.AppConfig.filter({key:"global"});qe.length>0&&await Y.entities.AppConfig.update(qe[0].id,{chunking_stopped:!1}),w(!0),Y.functions.invoke("chunkKB",{knowledge_base_id:t,...ye}).then(()=>{w(!1)})}async function tn(ye,qe){const[nt,ft]=await Promise.all([Y.entities.KbTasksQueue.filter({knowledge_item_id:ye,task_type:qe,status:"pending"}),Y.entities.KbTasksQueue.filter({knowledge_item_id:ye,task_type:qe,status:"processing"})]);return nt.length>0||ft.length>0}async function On(ye,qe){if(A(null),N(ye.id),await tn(ye.id,"chunk")){Js.info(`Chunk task already queued for "${ye.title}"`),N(null);return}await Y.entities.KbTasksQueue.create({knowledge_base_id:t,knowledge_item_id:ye.id,knowledge_item_name:ye.title,knowledge_base_name:n.name,target:"Item",task_type:"chunk",status:"pending",priority:5,parameters:qe&&Object.keys(qe).length>0?JSON.stringify(qe):void 0}),N(null)}async function as(){R(!0);const ye=await Y.entities.AppConfig.filter({key:"global"});ye.length>0?await Y.entities.AppConfig.update(ye[0].id,{chunking_stopped:!0}):await Y.entities.AppConfig.create({key:"global",chunking_stopped:!0}),R(!1),w(!1),N(null)}async function $e(ye){await Y.functions.invoke("deleteKBItem",{item_id:ye}).catch(()=>{})}async function he(ye){confirm(`Delete "${ye.title}"?`)&&(await $e(ye.id),Gt())}async function Q(){confirm(`Delete all ${a.length} items? This cannot be undone.`)&&(await Promise.all(a.map(ye=>$e(ye.id))),Gt())}async function ke(){if(!confirm(`Re-extract content from all ${a.filter(qe=>qe.source_type==="url").length} URL items?`))return;const ye=a.filter(qe=>qe.source_type==="url");Promise.all(ye.map(qe=>Y.functions.invoke("extractAndSaveUrl",{item_id:qe.id}))).then(()=>Gt())}async function Ee(ye,qe){Wt(null),W(ye.id),await Y.functions.invoke("summarizeItems",{item_ids:[ye.id],...qe});const nt=await Y.entities.KnowledgeItem.filter({id:ye.id});nt[0]&&i(ft=>ft.map(Lt=>Lt.id===ye.id?{...Lt,...nt[0]}:Lt)),W(null)}function Ye(ye){Wt({item:ye,isCC:!1})}async function Tt(ye){Wt(null),I(!0),await Y.functions.invoke("summarizeItems",{item_ids:a.map(qe=>qe.id),...ye}),await Gt(),I(!1)}function Ut(){Wt("all")}async function $t(){L(!0);const ye=await Y.functions.invoke("summarizeKB",{knowledge_base_id:t});ye!=null&&ye.data&&s(qe=>({...qe,human_summary:ye.data.human_summary,semantic_summary:ye.data.semantic_summary})),L(!1)}async function En(ye){var qe,nt,ft,Lt,Yt;F(ye.id);try{const pn=await Y.functions.invoke("extractClosedCaptions",{item_id:ye.id});if((qe=pn==null?void 0:pn.data)!=null&&qe.no_captions)Js.info(`No captions available for "${ye.title}"`);else if((nt=pn==null?void 0:pn.data)!=null&&nt.success){const je=await Y.entities.KnowledgeItem.filter({id:ye.id});je[0]&&i(Ke=>Ke.map(Te=>Te.id===ye.id?{...Te,...je[0]}:Te))}else(ft=pn==null?void 0:pn.data)!=null&&ft.error&&alert(`CC Extraction failed: ${pn.data.error}`)}catch(pn){alert(`CC Extraction failed: ${((Yt=(Lt=pn==null?void 0:pn.response)==null?void 0:Lt.data)==null?void 0:Yt.error)||pn.message}`)}F(null)}async function Pr(){const ye=a.filter(qe=>qe.media_links&&qe.media_links.length>0);confirm(`Extract CC for all ${ye.length} items with media links?`)&&(ee(!0),Promise.all(ye.map(qe=>Y.functions.invoke("extractClosedCaptions",{item_id:qe.id}))).then(()=>{ee(!1)}))}async function zs(ye,qe){Wt(null),X(ye.id),await Y.functions.invoke("summarizeCCItems",{item_ids:[ye.id],...qe});const nt=await Y.entities.KnowledgeItem.filter({id:ye.id});nt[0]&&i(ft=>ft.map(Lt=>Lt.id===ye.id?{...Lt,...nt[0]}:Lt)),X(null)}function oe(ye){Wt({item:ye,isCC:!0})}async function Be(ye){Wt(null);const qe=a.filter(nt=>nt.cc_file_url);Z(!0),Y.functions.invoke("summarizeCCItems",{item_ids:qe.map(nt=>nt.id),...ye}),Z(!1)}function Ze(){Wt("allCC")}async function pt(){var ye,qe;if(confirm(`Locally embed all chunks in this KB (${a.length} items)? This calls embedKB which queues embed tasks via the KB queue.`)){We(!0),me(null);try{const nt=await Y.functions.invoke("embedKB",{knowledge_base_id:t});me(nt==null?void 0:nt.data)}catch(nt){me({error:((qe=(ye=nt==null?void 0:nt.response)==null?void 0:ye.data)==null?void 0:qe.error)||nt.message})}We(!1)}}async function qt(){var ye,qe,nt,ft;if(confirm(`Queue vectorization for all ${a.length} items in this KB?`)){De(!0);try{const Lt=await Y.functions.invoke("vectorizeKB",{knowledge_base_id:t});((ye=Lt==null?void 0:Lt.data)==null?void 0:ye.queued)===0&&alert(((qe=Lt==null?void 0:Lt.data)==null?void 0:qe.message)||"All items are already vectorized.")}catch(Lt){alert(`Failed to queue vectorization: ${((ft=(nt=Lt==null?void 0:Lt.response)==null?void 0:nt.data)==null?void 0:ft.error)||Lt.message}`)}De(!1)}}async function Kt(ye){var ft;if(ye.source_type!=="url")return;const qe=await Y.functions.invoke("extractAndSaveUrl",{item_id:ye.id}),nt=((ft=qe==null?void 0:qe.data)==null?void 0:ft.char_count)||0;i(Lt=>Lt.map(Yt=>Yt.id===ye.id?{...Yt,status:"ready",char_count:nt}:Yt))}async function Xt(ye){var ft,Lt;if(!ye.url)return;le(ye.id);const qe=await Y.functions.invoke("extractAndSaveUrl",{item_id:ye.id}),nt=(Lt=(ft=qe==null?void 0:qe.data)==null?void 0:ft.item)==null?void 0:Lt.title;nt&&i(Yt=>Yt.map(pn=>pn.id===ye.id?{...pn,title:nt}:pn)),le(null)}async function Nn(ye){if(Ue(ye.id),await tn(ye.id,"embed")){Js.info(`Embed task already queued for "${ye.title}"`),Ue(null);return}await Y.entities.KbTasksQueue.create({knowledge_base_id:t,knowledge_item_id:ye.id,knowledge_item_name:ye.title,knowledge_base_name:n.name,target:"Item",task_type:"embed",status:"pending",priority:5}),Js.success(`Embed task queued for "${ye.title}"`),Ue(null)}async function Et(ye){if(Oe(ye.id),await tn(ye.id,"store_vectors")){Js.info(`Vectorize task already queued for "${ye.title}"`),Oe(null);return}await Y.entities.KbTasksQueue.create({knowledge_base_id:t,knowledge_item_id:ye.id,knowledge_item_name:ye.title,knowledge_base_name:n.name,target:"Item",task_type:"store_vectors",status:"pending",priority:5}),Js.success(`Vectorize task queued for "${ye.title}"`),Oe(null)}async function Zt(){var ye,qe;Se(!0);try{const nt=await Y.functions.invoke("syncPocusResources",{knowledge_base_id:t,full_sync:!0}),ft=(nt==null?void 0:nt.data)||{};Js.success(`Sync complete — ${ft.new||0} new, ${ft.changed||0} changed, ${ft.queued_tasks||0} tasks queued${ft.duplicate_tasks_skipped?`, ${ft.duplicate_tasks_skipped} duplicates skipped`:""}${ft.errors?`, ${ft.errors} errors`:""}`),await Gt()}catch(nt){Js.error(`POCUS sync failed: ${((qe=(ye=nt==null?void 0:nt.response)==null?void 0:ye.data)==null?void 0:qe.error)||nt.message}`)}Se(!1)}async function mn(){var ye,qe,nt;if(confirm(`Generate missing processing tasks for all ${a.length} items? This queues tasks only for steps that are missing (summarize, CC, chunk, embed, vectorize).`)){He(!0);
1063try{const ft=await Y.functions.invoke("manageKbProcessing",{mode:"complete",knowledge_base_id:t}),Lt=(ft==null?void 0:ft.data)||{};Js.success(`Complete processing: ${Lt.tasks_created} tasks queued for ${Lt.items_processed} items${(ye=Lt.stats)!=null&&ye.skipped_existing?`, ${Lt.stats.skipped_existing} already queued`:""}`)}catch(ft){Js.error(`Failed: ${((nt=(qe=ft==null?void 0:ft.response)==null?void 0:qe.data)==null?void 0:nt.error)||ft.message}`)}He(!1)}}async function Os(){var ye,qe;if(confirm(`Full re-process ALL steps for all ${a.length} items? This deletes existing pending tasks and re-queues everything (extract, summarize, CC, chunk, embed, vectorize).`)){ze(!0);try{const nt=await Y.functions.invoke("manageKbProcessing",{mode:"full_reprocess",knowledge_base_id:t}),ft=(nt==null?void 0:nt.data)||{};Js.success(`Full re-process: ${ft.tasks_created} tasks queued for ${ft.items_processed} items`)}catch(nt){Js.error(`Failed: ${((qe=(ye=nt==null?void 0:nt.response)==null?void 0:ye.data)==null?void 0:qe.error)||nt.message}`)}ze(!1)}}async function la(ye){var qe,nt;dt(ye.id);try{const ft=await Y.functions.invoke("manageKbProcessing",{mode:"item_reprocess",knowledge_base_id:t,item_id:ye.id}),Lt=(ft==null?void 0:ft.data)||{};Js.success(`Re-processing "${ye.title}": ${Lt.tasks_created} tasks queued`)}catch(ft){Js.error(`Failed: ${((nt=(qe=ft==null?void 0:ft.response)==null?void 0:qe.data)==null?void 0:nt.error)||ft.message}`)}dt(null)}const[Ea,Ri]=h.useState(!0);if(f)return r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading..."});if(!n)return r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Knowledge base not found."});if(B)return r.jsx(QPe,{kbId:t,onDone:()=>{D(!1),Gt()},onCancel:()=>{D(!1),Gt()}});if(o)return r.jsx(GAe,{kbId:t,onSave:()=>{l(!1),Gt()},onCancel:()=>l(!1)});if(c)return r.jsx(VPe,{item:c,onSave:()=>{d(null),Gt()},onCancel:()=>d(null)});const Aa=a.length,po=a.filter(ye=>ye.source_type==="url").length;a.filter(ye=>!ye.content).length;const Mi=a.filter(ye=>g[ye.id]>0).length,Is=Aa-Mi,Us=a.reduce((ye,qe)=>ye+(qe.char_count||0),0),hr=Object.values(g).reduce((ye,qe)=>ye+qe,0),Di=Object.values(j).reduce((ye,qe)=>ye+qe,0),Cc=Object.keys(j).filter(ye=>j[ye]>0).length,qs=a.filter(ye=>ye.human_summary).length,Li=Aa-qs,al=!!(n.human_summary||n.semantic_summary),Fr=a.filter(ye=>ye.cc_file_url).length,Ta=a.filter(ye=>ye.media_links&&ye.media_links.length>0).length,il=a.filter(ye=>ye.cc_file_url&&ye.cc_human_summary).length,Gd=a.reduce((ye,qe)=>ye+(qe.supabase_doc_count||0),0),go=a.filter(ye=>(ye.supabase_doc_count||0)>0).length,Sr=Aa-go,li=a.filter(ye=>{const qe=ye.supabase_doc_count||0,nt=g[ye.id]||0;return qe>0&&nt>0&&qe<nt}).length;function $i(ye){G(qe=>{const nt=new Set(qe);return ye==="chunked"&&nt.delete("not_chunked"),ye==="not_chunked"&&nt.delete("chunked"),ye==="summarized"&&nt.delete("not_summarized"),ye==="not_summarized"&&nt.delete("summarized"),ye==="cc_extracted"&&nt.delete("no_cc"),ye==="no_cc"&&nt.delete("cc_extracted"),ye==="cc_summarized"&&nt.delete("no_cc_summary"),ye==="no_cc_summary"&&nt.delete("cc_summarized"),ye==="vectorized"&&nt.delete("not_vectorized"),ye==="not_vectorized"&&nt.delete("vectorized"),ye==="incomplete_vectorized"&&nt.delete("not_vectorized"),nt.has(ye)?nt.delete(ye):nt.add(ye),nt})}const Ec=a.filter(ye=>{if(M.has("chunked")&&!(g[ye.id]>0)||M.has("not_chunked")&&g[ye.id]>0||M.has("summarized")&&!ye.human_summary||M.has("not_summarized")&&ye.human_summary||M.has("has_media")&&!(ye.media_links&&ye.media_links.length>0)||M.has("cc_extracted")&&!ye.cc_file_url||M.has("no_cc")&&!(ye.media_links&&ye.media_links.length>0&&!ye.cc_file_url)||M.has("cc_summarized")&&!(ye.cc_file_url&&ye.cc_human_summary)||M.has("no_cc_summary")&&!(ye.cc_file_url&&!ye.cc_human_summary)||M.has("vectorized")&&!((ye.supabase_doc_count||0)>0)||M.has("not_vectorized")&&(ye.supabase_doc_count||0)>0)return!1;if(M.has("incomplete_vectorized")){const qe=ye.supabase_doc_count||0,nt=g[ye.id]||0;if(!(qe>0&&nt>0&&qe<nt))return!1}return!0});return r.jsxs("div",{className:`p-6 space-y-6 ${Ea?"w-full":"max-w-6xl mx-auto"}`,children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-start justify-between mb-3",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx(wt,{to:yt("KnowledgeBases"),children:r.jsx(de,{variant:"ghost",size:"sm",className:"gap-1",children:r.jsx(or,{className:"w-4 h-4"})})}),r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:n.name}),r.jsx("button",{onClick:()=>Ri(ye=>!ye),title:Ea?"Collapse to centered layout":"Expand to full width",className:"p-1.5 rounded-lg text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 transition-colors",children:Ea?r.jsx(Lh,{className:"w-4 h-4"}):r.jsx(Nd,{className:"w-4 h-4"})})]}),n.description&&r.jsx("p",{className:"text-sm text-gray-500 ml-11",children:n.description}),r.jsx("div",{className:"ml-11 mt-2",children:al?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>K(ye=>!ye),className:"flex items-center gap-1 text-xs text-indigo-500 hover:text-indigo-700 transition-colors font-medium",children:[V?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"}),"KB Summaries"]}),V&&r.jsxs("div",{className:"mt-2 space-y-2",children:[n.human_summary&&r.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("p",{className:"text-xs font-semibold text-blue-600",children:"Human Summary"}),r.jsxs("span",{className:"text-[10px] text-blue-400 font-mono",children:[n.human_summary.length.toLocaleStr
1063ing()," chars"]})]}),r.jsx("p",{className:"text-xs text-blue-800 leading-relaxed",children:n.human_summary})]}),n.semantic_summary&&r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("p",{className:"text-xs font-semibold text-violet-600",children:"Semantic Summary"}),r.jsxs("span",{className:"text-[10px] text-violet-400 font-mono",children:[n.semantic_summary.length.toLocaleString()," chars"]})]}),r.jsx("p",{className:"text-xs text-violet-800 leading-relaxed",children:n.semantic_summary})]})]})]}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-amber-600 bg-amber-50 border border-amber-200 rounded-full px-2 py-0.5",children:"KB not summarized"})})]})}),r.jsxs("div",{className:"flex flex-col gap-2 ml-11",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(wt,{to:`/KbQueue?kb=${t}&back=KnowledgeBaseDetail`,children:r.jsxs(de,{className:"gap-2 bg-indigo-600 hover:bg-indigo-700 text-white shadow-sm",children:[r.jsx(el,{className:"w-4 h-4"})," KB Queue"]})}),r.jsxs(de,{className:"gap-2 bg-emerald-600 hover:bg-emerald-700 text-white shadow-sm",onClick:()=>l(!0),children:[r.jsx(ln,{className:"w-4 h-4"})," Add Item"]}),r.jsx("div",{className:"h-6 w-px bg-gray-200 mx-1"}),r.jsxs(de,{variant:"outline",className:"gap-2",onClick:Cn,title:"Reload all items",children:[r.jsx(Rn,{className:"w-4 h-4"}),"Refresh"]}),r.jsxs(de,{variant:"outline",className:`gap-2 ${it?"border-emerald-200 text-emerald-700":""}`,onClick:()=>Jn(),title:"Load Supabase vector counts for all items (slow)",children:[it?r.jsx(Bd,{className:"w-4 h-4 text-emerald-500"}):r.jsx(zn,{className:"w-4 h-4 text-orange-500"}),"Load Stats"]}),r.jsxs(de,{variant:"outline",className:"gap-2 border-blue-200 text-blue-700 hover:bg-blue-50",onClick:mn,disabled:Le||a.length===0,title:"Generate tasks for all missing processing steps (summarize, CC, chunk, embed, vectorize)",children:[Le?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(yd,{className:"w-4 h-4"}),"Complete Processing"]}),n.pocus_sync_enabled&&r.jsxs(de,{variant:"outline",className:"gap-2 border-cyan-200 text-cyan-700 hover:bg-cyan-50",onClick:Zt,disabled:ae,children:[ae?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(RZ,{className:"w-4 h-4"}),"Sync POCUS Now"]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y&&r.jsxs(de,{variant:"outline",className:"gap-2 border-red-200 text-red-600 hover:bg-red-50",onClick:as,disabled:T,children:[T?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(CZ,{className:"w-4 h-4"}),"Stop"]}),r.jsxs(de,{variant:"outline",className:"gap-2",onClick:()=>A("all"),disabled:y||a.length===0,children:[y?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Nb,{className:"w-4 h-4"}),"Re-chunk All"]}),r.jsxs(de,{variant:"outline",className:"gap-2",onClick:ke,disabled:a.filter(ye=>ye.source_type==="url").length===0,children:[r.jsx(Rn,{className:"w-4 h-4"})," Re-extract All"]}),r.jsxs(de,{variant:"outline",className:"gap-2 border-emerald-200 text-emerald-700 hover:bg-emerald-50",onClick:pt,disabled:_e||a.length===0,title:"Locally embed all chunks in this KB using embedKB (queues tasks)",children:[_e?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(zn,{className:"w-4 h-4"}),"Local Embed All"]}),tt&&r.jsx("span",{className:`text-xs font-medium px-2 py-1 rounded-full border ${tt.error?"bg-red-50 text-red-600 border-red-200":"bg-emerald-50 text-emerald-700 border-emerald-200"}`,children:tt.error?`Error: ${tt.error}`:`✓ ${tt.queued}/${tt.total} queued`}),r.jsxs(de,{variant:"outline",className:"gap-2",onClick:Ut,disabled:P||a.length===0,children:[P?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Yn,{className:"w-4 h-4"}),"Summarize All Items"]}),r.jsxs(de,{variant:"outline",className:"gap-2",onClick:$t,disabled:z,children:[z?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(ao,{className:"w-4 h-4"}),"Summarize KB"]}),Ta>0&&r.jsxs(de,{variant:"outline",className:"gap-2",onClick:Pr,disabled:U,children:[U?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx("span",{className:"font-bold text-xs",children:"CC"}),"Extract All CC"]}),Fr>0&&r.jsxs(de,{variant:"outline",className:"gap-2",onClick:Ze,disabled:ie,children:[ie?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Yn,{className:"w-4 h-4"}),"Summarize All CC"]}),r.jsxs(de,{variant:"outline",className:"gap-2",onClick:()=>D(!0),children:[r.jsx(Na,{className:"w-4 h-4"})," Bulk URL Import"]}),r.jsxs(de,{variant:"outline",className:"gap-2 border-orange-200 text-orange-700 hover:bg-orange-50",onClick:qt,disabled:te||a.length===0,children:[te?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(zn,{className:"w-4 h-4"}),"Vectorize All"]}),r.jsxs(de,{variant:"outline",className:"gap-2 border-red-200 text-red-600 hover:bg-red-50",onClick:Q,disabled:a.length===0,children:[r.jsx(un,{className:"w-4 h-4"})," Delete All"]}),r.jsxs(de,{variant:"outline",className:"gap-2 border-amber-300 text-amber-700 hover:bg-amber-50",onClick:Os,disabled:ut||a.length===0,title:"Re-process ALL steps for all items (deletes pending tasks and re-queues everything)",children:[ut?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Dr,{className:"w-4 h-4"}),"Full Re-process"]})]})]})]}),Aa>0&&r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[r.jsxs("div",{className:"bg-white border rounded-lg p-4",children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"Total Items"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900",children:Aa})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-4",children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"Chunked / Unchunked"}),r.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[Mi," / ",r.jsx("span",{className:Is>0?"text-amber-500":"",children:Is})]}),r.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:[hr," total chunks"]})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-4",children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"Total Chars"}),r.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[(Us/1e3).toFixed(1),"K"]})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-4",children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"Total Chunks"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900",children:hr})]}),r.jsxs("div",{className:"bg-white border rounded-lg p-4",children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"URLs"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900",children:po})]}),r.jsxs("div",{className:`border rounded-lg p-4 ${Li>0?"bg-amber-50 border-amber-200":"bg-white"}`,children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"Summarized / Unsummarized"}),r.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[qs," / ",r.jsx("span",{className:Li>0?"text-amber-600":"",children:Li})]}),r.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:[Math.round(qs/Aa*100)||0,"% coverage"]})]}),Ta>0&&r.jsxs("div",{className:"bg-white border rounded-lg p-4",children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"CC Extracted / Media Items"}),r.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[Fr," / ",r.jsx("span",{className:Fr<Ta?"text-amber-500":"text-emerald-600",children:Ta})]}),r.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:[Math.round(Fr/Ta*100)||0,"% of media items"]})]}),Fr>0&&r.jsxs("div",{className:`border rounded-lg p-4 ${il<Fr?"bg-amber-50 border-amber-200":"bg-white"}`,children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"CC Summarized"}),r.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[il," / ",r.jsx("span",{className:il<Fr?"text-amber-600":"text-emerald-600",children:Fr})]}),r.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:[Math.round(il/Fr*100)||0,"% of CC items"]})]}),r.jsxs("div",{className:`border rounded-lg p-4 ${it?Sr>0?"bg-orange-50 border-orange-200":"bg-white":"bg-gray-50 border-gray-200"}`,children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"Vectorized / Not Vectorized"}),it?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[go," / ",r.jsx("span",{className:Sr>0?"text-orange-500":"text-emerald-600",children:Sr})]}),r.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:[Gd," total Supabase docs"]})]}):r.jsxs("div",{className:"text-sm text-gray-400 italic mt-1",children:["Click ",r.jsx("strong",{className:"text-orange-600",children:"Load Stats"})," to check"]})]}),it&&li>0&&r.jsxs("div",{className:"border rounded-lg p-4 bg-red-50 border-red-200",children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"Incomplete Vectorization"}),r.jsx("div",{className:"text-2xl font-bold text-red-600",children:li}),r.jsx("div",{className:"text-xs text-red-500 mt-1",children:"Items with failed chunks"})]}),r.jsxs("div",{className:`border rounded-lg p-4 ${Di===0?"bg-white":Di<hr?"bg-amber-50 border-amber-200":"bg-emerald-50 border-emerald-200"}`,children:[r.jsx("div",{className:"text-xs text-gray-500 uppercase tracking-wide font-semibold mb-1",children:"Local Vectors"}),r.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[Di,hr>0&&r.jsxs("span",{className:"text-sm font-normal text-gray-400",children:[" / ",hr]})]}),r.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:[hr>0?`${Math.round(Di/hr*100)}% chunks embedded locally`:"No chunks yet",Cc>0&&` · ${Cc} items`]})]})]}),Aa>0&&r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Filter:"}),[{key:"chunked",label:"Chunked",color:"indigo"},{key:"not_chunked",label:"Not Chunked",color:"amber"},{key:"summarized",label:"Summarized",color:"blue"},{key:"not_summarized",label:"Not Summarized",color:"amber"},{key:"has_media",label:"Has Media",color:"purple"},{key:"cc_extracted",label:"CC Extracted",color:"teal"},{key:"no_cc",label:"No CC",color:"amber"},{key:"cc_summarized",label:"CC Summarized",color:"indigo"},{key:"no_cc_summary",label:"No CC Summary",color:"amber"},{key:"vectorized",label:"Vectorized",color:"orange"},{key:"not_vectorized",label:"Not Vectorized",color:"amber"},{key:"incomplete_vectorized",label:"Incomplete Vecs",color:"red"}].map(({key:ye,label:qe,color:nt})=>
1063{const ft=M.has(ye),Lt="text-xs font-medium px-3 py-1.5 rounded-full border cursor-pointer transition-colors select-none",Yt={indigo:ft?"bg-indigo-600 text-white border-indigo-600":"bg-white text-indigo-700 border-indigo-200 hover:bg-indigo-50",amber:ft?"bg-amber-500 text-white border-amber-500":"bg-white text-amber-700 border-amber-200 hover:bg-amber-50",blue:ft?"bg-blue-600 text-white border-blue-600":"bg-white text-blue-700 border-blue-200 hover:bg-blue-50",purple:ft?"bg-purple-600 text-white border-purple-600":"bg-white text-purple-700 border-purple-200 hover:bg-purple-50",teal:ft?"bg-teal-600 text-white border-teal-600":"bg-white text-teal-700 border-teal-200 hover:bg-teal-50",orange:ft?"bg-orange-500 text-white border-orange-500":"bg-white text-orange-700 border-orange-200 hover:bg-orange-50",red:ft?"bg-red-600 text-white border-red-600":"bg-white text-red-700 border-red-200 hover:bg-red-50"};return r.jsx("button",{className:`${Lt} ${Yt[nt]}`,onClick:()=>$i(ye),children:qe},ye)}),M.size>0&&r.jsx("button",{onClick:()=>G(new Set),className:"text-xs text-gray-400 hover:text-gray-600 underline ml-1",children:"Clear"}),M.size>0&&r.jsxs("span",{className:"text-xs text-gray-400 ml-1",children:[Ec.length," of ",Aa," shown"]})]}),S==="all"&&r.jsx(Ap,{title:`Re-chunk All (${a.length} items)`,onConfirm:Hn,onCancel:()=>A(null),kb:n}),S&&S!=="all"&&r.jsx(Ap,{title:`Re-chunk: ${S.title}`,onConfirm:ye=>On(S,ye),onCancel:()=>A(null),kb:n}),C&&r.jsx(YPe,{item:C,kb:n,onClose:()=>k(null),onRechunked:Gt}),Ve&&r.jsx(tOe,{item:Ve,onClose:()=>Xe(null)}),we&&r.jsx(rOe,{item:we,currentKbId:t,onDone:()=>{Qe(null),Gt()},onCancel:()=>Qe(null)}),ct&&r.jsx(nOe,{title:ct==="all"?`Summarize All Items (${a.length})`:ct==="allCC"?`Summarize All CC (${a.filter(ye=>ye.cc_file_url).length})`:ct.isCC?`Summarize CC: ${ct.item.title}`:`Summarize: ${ct.item.title}`,kb:n,onCancel:()=>Wt(null),onConfirm:ye=>{ct==="all"?Tt(ye):ct==="allCC"?Be(ye):ct.isCC?zs(ct.item,ye):Ee(ct.item,ye)}}),a.length===0?r.jsxs("div",{className:"text-center py-16 text-gray-400",children:[r.jsx(ns,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No items yet. Add text, HTML, PDF or a URL."})]}):Ec.length===0?r.jsxs("div",{className:"text-center py-16 text-gray-400",children:[r.jsx(ns,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No items match the active filters."})]}):r.jsx("div",{className:"grid gap-4",children:Ec.map(ye=>r.jsx(TAe,{item:ye,kbId:t,kb:n,chunkCounts:g,localVecCounts:j,rechunkingItem:_,summarizingItem:H,extractingCC:q,summarizingCC:ne,embeddingItem:re,vectorizingItem:Ne,onEdit:d,onDelete:he,onViewChunks:k,onChunk:A,onSummarize:Ye,onExtractCC:En,onSummarizeCC:oe,onReextract:Kt,onReextractTitle:Xt,onVectorize:Et,onLocalEmbed:Nn,onViewSupabaseDocs:Xe,onMove:Qe,onReprocess:la,reprocessingItem:fe},ye.id))})]})}function aOe({kb:e,result:t}){const n=t||e.pocus_last_sync_result||{},s=t&&!t.dry_run?new Date:e.pocus_last_sync_at?new Date(e.pocus_last_sync_at):null;return r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsx(PZ,{className:"w-4 h-4 text-indigo-500 mb-1"}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"Last sync"}),r.jsx("p",{className:"text-xs font-semibold",children:s?s.toLocaleString():"Never"})]}),r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsx(_n,{className:"w-4 h-4 text-emerald-500 mb-1"}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"Latest changes"}),r.jsxs("p",{className:"text-xs font-semibold",children:[n.new||0," new · ",n.changed||0," changed"]})]}),r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsx(el,{className:"w-4 h-4 text-amber-500 mb-1"}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"Processing"}),r.jsxs("p",{className:"text-xs font-semibold",children:[n.queued_items||0," queued · ",n.inactive||0," inactive"]})]})]})}function iOe({kb:e,form:t,setForm:n}){const[s,a]=h.useState(!0),[i,o]=h.useState(!1),[l,c]=h.useState(null),[d,f]=h.useState([]),m=w=>n(_=>({..._,[w]:!_[w]})),g=d.map(w=>`${w.title||""} ${w.url||""}`).join(" ").toLowerCase().replace(/[^a-z0-9]+/g," "),x=[...new Set([...e.pocus_discovered_to
1063pics||[],...(l==null?void 0:l.discovered_topics)||[]])].filter(w=>{const _=String(w).split(/\s+-\s+/)[0].replace(/\([^)]*\)/g,"").toLowerCase().replace(/[^a-z0-9]+/g," ").trim(),N=_.split(" ").filter(C=>C.length>2);return _&&(g.includes(_)||N.length>0&&N.every(C=>g.includes(C)))}).sort(),j=t.pocus_topic_match.split(",").map(w=>w.trim()).filter(Boolean),b=w=>n(_=>{const N=_.pocus_topic_match.split(",").map(k=>k.trim()).filter(Boolean),C=N.includes(w)?N.filter(k=>k!==w):[...N,w];return{..._,pocus_topic_match:C.join(", ")}});async function y(w=s){o(!0);const[_,N]=await Promise.all([Y.functions.invoke("syncPocusResources",{knowledge_base_id:e.id,dry_run:w,full_sync:!0}),Y.entities.KnowledgeItem.filter({knowledge_base_id:e.id})]);f(N),c(_.data),o(!1)}return r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("div",{className:"px-4 py-3 bg-indigo-50 border-b flex items-center gap-2",children:[r.jsx(tne,{className:"w-4 h-4 text-indigo-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-gray-800",children:"POCUS.org synchronization"}),r.jsx("p",{className:"text-xs text-gray-500",children:"Configure this knowledge base only."})]})]}),r.jsxs("div",{className:"p-4 space-y-4",children:[r.jsx(aOe,{kb:e,result:l}),r.jsxs("label",{className:"flex items-center justify-between gap-3",children:[r.jsxs("span",{children:[r.jsx("span",{className:"block text-sm font-medium",children:"Enable POCUS sync"}),r.jsx("span",{className:"block text-xs text-gray-400",children:"Include this KB in the daily resource sync."})]}),r.jsx("input",{type:"checkbox",checked:t.pocus_sync_enabled,onChange:()=>m("pocus_sync_enabled"),className:"w-4 h-4"})]}),r.jsxs("label",{className:"flex items-center justify-between gap-3",children:[r.jsxs("span",{children:[r.jsx("span",{className:"block text-sm font-medium",children:"Auto-process synced items"}),r.jsx("span",{className:"block text-xs text-gray-400",children:"Drain this KB’s processing queues every 30 minutes."})]}),r.jsx("input",{type:"checkbox",checked:t.pocus_auto_processing_enabled,onChange:()=>m("pocus_auto_processing_enabled"),className:"w-4 h-4"})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"pocus-topic-match",className:"text-xs text-gray-500 mb-1 block",children:"POCUS topics"}),r.jsx("input",{id:"pocus-topic-match",value:t.pocus_topic_match,onChange:w=>n(_=>({..._,pocus_topic_match:w.target.value})),placeholder:"Cardiac, Lung",className:"w-full border rounded-lg px-3 py-2 text-sm"}),r.jsxs("div",{className:"mt-1 flex items-center justify-between gap-3",children:[r.jsx("p",{className:"text-[11px] text-gray-400",children:"Comma-separated topics routed into this KB."}),r.jsx("button",{type:"button",onClick:()=>y(!0),disabled:i,className:"shrink-0 text-xs font-medium text-indigo-600 hover:text-indigo-800 disabled:opacity-50",children:"Find topic suggestions"})]}),x.length>0&&r.jsxs("div",{className:"mt-2",children:[r.jsx("p",{className:"text-[11px] font-medium text-gray-500 mb-1.5",children:"Suggested topics"}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:x.map(w=>r.jsx("button",{type:"button",onClick:()=>b(w),className:`rounded-full border px-2.5 py-1 text-xs transition-colors ${j.includes(w)?"border-indigo-300 bg-indigo-50 text-indigo-700":"border-gray-200 bg-white text-gray-600 hover:border-indigo-200 hover:bg-indigo-50"}`,children:w},w))})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600",children:[r.jsx("input",{type:"checkbox",checked:s,onChange:w=>a(w.target.checked)})," Dry run"]}),r.jsxs(de,{type:"button",onClick:()=>y(),disabled:i||!t.pocus_topic_match.trim(),className:"gap-2",children:[i?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Bo,{className:"w-4 h-4"}),s?"Preview full sync":"Run full sync now"]})]}),l&&r.jsx("pre",{className:"bg-slate-900 text-emerald-300 rounded-lg p-3 text-[11px] overflow-auto max-h-48",children:JSON.stringify(l,null,2)})]})]})}const oOe=["indigo","emerald","violet","amber","rose"],lOe={indigo:"bg-indigo-500",emerald:"bg-emerald-500",violet:"bg-violet-500",amber:"bg-amber-500",rose:"bg-rose-500"},cOe=[{value:"",label:"— Use global default —"},{value:"size",label:"Size only"},{value:"separators",label:"Separators only"},{value:"both_first",label:"Size + Separators (first occurrence)"},{value:"both_last",label:"Size + Separators (last occurrence)"}];function dOe({kb:e,onSave:t,onClose:n}){const[s,a]=h.useState({name:e.name||"",description:e.description||"",type:e.type||"Assistant Knowledge",status:e.status||"active",color:e.color||"indigo",icon_url:e.icon_url||"",pocus_sync_enabled:e.pocus_sync_enabled??!1,pocus_auto_processing_enabled:e.pocus_auto_processing_enabled??!1,pocus_topic_match:e.pocus_topic_match||"",chunk_size:e.chunk_size??"",chunk_overlap:e.chunk_overlap??"",min_chunk_size:e.min_chunk_size??"",chunk_mode:e.chunk_mode??"",chunk_separators:e.chunk_separators??[],chunk_separators_ignore_between_numbers:e.chunk_separators_ignore_between_numbers??[],min_chunk_size_action:e.min_chunk_size_action??""}),[i,o]=h.useState(!1),[l,c]=h.useState(!1);async function d(){c(!0);const f={...s};f.chunk_size===""||f.chunk_size===null?delete f.chunk_size:f.chunk_size=Number(f.chunk_size),f.chunk_overlap===""||f.chunk_overlap===null?delete f.chunk_overlap:f.chunk_overlap=Number(f.chunk_overlap),f.min_chunk_size===""||f.min_chunk_size===null?delete f.min_chunk_size:f.min_chunk_size=Number(f.min_chunk_size),f.chunk_mode||delete f.chunk_mode,f.min_chunk_size_action||delete f.min_chunk_size_action,(!f.chunk_separators||f.chunk_separators.length===0)&&delete f.chunk_separators,(!f.chunk_separators_ignore_between_numbers||f.chunk_separators_ignore_between_numbers.length===0)&&delete f.chunk_separators_ignore_between_numbers,await t(f),c(!1)}return r.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b",children:[r.jsx("h2",{className:"font-semibold text-gray-900",children:"Edit Knowledge Base"}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"p-5 space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Icon"}),r.jsx(Pb,{value:s.icon_url,onChange:f=>a(m=>({...m,icon_url:f}))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Name *"}),r.jsx(It,{value:s.name,onChange:f=>a(m=>({...m,name:f.target.value})),placeholder:"Knowledge base name"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Description"}),r.jsx(rr,{value:s.description,onChange:f=>a(m=>({...m,description:f.target.value})),placeholder:"What this knowledge base contains...",className:"min-h-[80px]"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Type"}
1063),r.jsxs("select",{value:s.type,onChange:f=>a(m=>({...m,type:f.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"QA",children:"QA"}),r.jsx("option",{value:"Assistant Knowledge",children:"Assistant Knowledge"}),r.jsx("option",{value:"Learning Content",children:"Learning Content"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Status"}),r.jsxs("select",{value:s.status,onChange:f=>a(m=>({...m,status:f.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"inactive",children:"Inactive"})]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-2 block",children:"Accent Color"}),r.jsx("div",{className:"flex gap-2",children:oOe.map(f=>r.jsx("button",{onClick:()=>a(m=>({...m,color:f})),className:`w-7 h-7 rounded-full transition-all ${lOe[f]} ${s.color===f?"ring-2 ring-offset-2 ring-gray-400 scale-110":"opacity-60 hover:opacity-100"}`},f))})]}),r.jsx(iOe,{kb:e,form:s,setForm:a}),r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>o(f=>!f),className:"w-full flex items-center justify-between px-4 py-2.5 bg-gray-50 hover:bg-gray-100 transition-colors text-left text-xs font-medium text-gray-600",children:[r.jsxs("span",{children:["Chunking Configuration ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(overrides global defaults)"})]}),r.jsx("span",{className:"text-gray-400",children:i?"▲":"▼"})]}),i&&r.jsxs("div",{className:"p-4 space-y-3 border-t",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"text-xs text-gray-500 mb-1 block",children:["Chunk Size ",r.jsx("span",{className:"text-gray-400",children:"(0–1000, blank = default)"})]}),r.jsx("input",{type:"number",min:0,max:1e3,value:s.chunk_size,onChange:f=>a(m=>({...m,chunk_size:f.target.value})),placeholder:"e.g. 800",className:"w-full border rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"text-xs text-gray-500 mb-1 block",children:["Min Chunk Size ",r.jsx("span",{className:"text-gray-400",children:"(chars, blank = default)"})]}),r.jsx("input",{type:"number",min:0,value:s.min_chunk_size,onChange:f=>a(m=>({...m,min_chunk_size:f.target.value})),placeholder:"e.g. 100",className:"w-full border rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"text-xs text-gray-500 mb-1 block",children:["Min Chunk Action ",r.jsx("span",{className:"text-gray-400",children:"(blank = default)"})]}),r.jsxs("select",{value:s.min_chunk_size_action,onChange:f=>a(m=>({...m,min_chunk_size_action:f.target.value})),className:"w-full border rounded-lg px-3 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:"— Use global default —"}),r.jsx("option",{value:"discard",children:"Discard"}),r.jsx("option",{value:"append",children:"Append to previous"})]})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"text-xs text-gray-500 mb-1 block",children:["Chunk Overlap ",r.jsx("span",{className:"text-gray-400",children:"(0–300, blank = default)"})]}),r.jsx("input",{type:"number",min:0,max:300,value:s.chunk_overlap,onChange:f=>a(m=>({...m,chunk_overlap:f.target.value})),placeholder:"e.g. 100",className:"w-full border rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Chunking Mode"}),r.jsx("select",{value:s.chunk_mode,onChange:f=>a(m=>({...m,chunk_mode:f.target.value})),className:"w-full border rounded-lg px-3 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:cOe.map(f=>r.jsx("option",{value:f.value,children:f.label},f.value))})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"text-xs text-gray-500 mb-1 block",children:["Separators ",r.jsx("span",{className:"text-gray-400",children:"(blank = use global default)"})]}),r.jsx(Mv,{value:s.chunk_separators||[],onChange:f=>a(m=>({...m,chunk_separators:f})),ignoreBetweenNumbers:s.chunk_separators_ignore_between_numbers||[],onIgnoreBetweenNumbersChange:f=>a(m=>({...m,chunk_separators_ignore_between_numbers:f}))})]})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 px-5 py-4 border-t",children:[r.jsx(de,{variant:"outline",onClick:n,children:"Cancel"}),r.jsxs(de,{onClick:d,disabled:l||!s.name,className:"gap-2",children:[l?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Ar,{className:"w-4 h-4"}),"Save"]})]})]})})}const t3={kb_summarized:{label:"KBs without summaries",icon:"📚",color:"amber"},summarized:{label:"Items not summarized",icon:"📝",color:"amber"}
1063,chunked:{label:"Items not chunked",icon:"✂️",color:"amber"},embedded:{label:"Items not embedded",icon:"🔢",color:"blue"},vectorized:{label:"Items not vectorized",icon:"🗄️",color:"orange"},cc_extracted:{label:"Media without CC extracted",icon:"🎬",color:"amber"},cc_summarized:{label:"CC not summarized",icon:"💬",color:"amber"}};function ih(e,t){const n=e._stats||{},s=n.totalItems||0;switch(t){case"kb_summarized":return e.human_summary||e.semantic_summary?0:1;case"summarized":return Math.max(0,s-(n.summarizedCount||0));case"chunked":return Math.max(0,s-(n.chunkedCount||0));case"embedded":return Math.max(0,s-(n.embeddedCount||0));case"vectorized":return Math.max(0,s-(n.vectorizedCount||0));case"cc_extracted":return Math.max(0,(n.mediaCount||0)-(n.ccCount||0));case"cc_summarized":return Math.max(0,(n.ccCount||0)-(n.ccSummarizedCount||0));default:return 0}}function uOe({gapFilter:e,gapCount:t,kbCount:n,onClear:s}){if(!e)return null;const a=t3[e]||{label:e,icon:"⚠️",color:"gray"},i={amber:"bg-amber-50 border-amber-300 text-amber-800",blue:"bg-blue-50 border-blue-300 text-blue-800",orange:"bg-orange-50 border-orange-300 text-orange-800",gray:"bg-gray-50 border-gray-300 text-gray-800"};return r.jsxs("div",{className:`flex items-center gap-2.5 rounded-xl border px-4 py-3 mb-5 ${i[a.color]||i.gray}`,children:[r.jsx(Nr,{className:"w-4 h-4 shrink-0"}),r.jsxs("span",{className:"text-sm font-medium",children:[a.icon," ",a.label,": ",r.jsx("strong",{children:t})," missing across ",r.jsx("strong",{children:n})," KB",n!==1?"s":""]}),r.jsx("span",{className:"text-xs opacity-70 ml-1",children:"— KBs sorted by largest gap"}),r.jsxs("button",{onClick:s,className:"ml-auto flex items-center gap-1 text-xs font-medium hover:opacity-70 transition-opacity",children:[r.jsx(jt,{className:"w-3.5 h-3.5"})," Clear filter"]})]})}const IB="kb_favorites",RB={indigo:"bg-indigo-500",emerald:"bg-emerald-500",violet:"bg-violet-500",amber:"bg-amber-500",rose:"bg-rose-500"},MB={indigo:"bg-indigo-50 border-indigo-100",emerald:"bg-emerald-50 border-emerald-100",violet:"bg-violet-50 border-violet-100",amber:"bg-amber-50 border-amber-100",rose:"bg-rose-50 border-rose-100"},mOe={QA:"bg-amber-50 text-amber-700 border-amber-200","Assistant Knowledge":"bg-indigo-50 text-indigo-700 border-indigo-200","Learning Content":"bg-emerald-50 text-emerald-700 border-emerald-200"};function fOe(){var Ve,Xe;const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState({}),[o,l]=h.useState(!0),[c,d]=h.useState(!1),[f,m]=h.useState(null),[g,x]=h.useState(null),[j,b]=h.useState(()=>localStorage.getItem("libsel_kbs")||"all");function y(te){b(te),localStorage.setItem("libsel_kbs",te)}const[w,_]=h.useState(null),[N,C]=h.useState(null),[k,S]=h.useState({}),[A,T]=h.useState(!1),[R,B]=h.useState(null),[D,P]=h.useState(null),[I,z]=h.useState(()=>{try{const te=JSON.parse(localStorage.getItem(IB)||"[]");return new Set(Array.isArray(te)?te.map(String):[])}catch{return new Set}});function L(te,De){De.preventDefault(),De.stopPropagation(),z(_e=>{const We=new Set(_e);return We.has(String(te))?We.delete(String(te)):We.add(String(te)),localStorage.setItem(IB,JSON.stringify([...We])),We})}h.useEffect(()=>{H()},[]);async function H(){l(!0);try{const[te,De]=await Promise.all([Y.entities.KnowledgeBase.list("-created_date"),Y.entities.Library.list("name")]);t(te),s(De),l(!1),setTimeout(()=>W(te),1500)}catch(te){l(!1),console.warn("Failed to load KBs:",te.message)}}async function W(te){var _e;const De=Array.isArray(te)&&te.length>0?te:ie;if(De.length!==0){d(!0);try{let We=null,tt=null;for(let Se=0;Se<3;Se++)try{We=await Y.functions.invoke("getKbStats",{kb_ids:De.map(Le=>Le.id)}),tt=null;break}catch(Le){tt=Le,Se<2&&await new Promise(He=>setTimeout(He,(Se+1)*3e3))}if(tt)throw tt;const me=((_e=We==null?void 0:We.data)==null?void 0:_e.stats)||{},ae={};for(const[Se,Le]of Object.entries(me))ae[Se]=Le.totalItems;i(ae),t(Se=>Se.map(Le=>({...Le,_stats:me[Le.id]||{}})))}catch(We){console.warn("Failed to load KB stats:",We.message)}finally{d(!1)}}}async function V(te){var De;t(_e=>_e.map(We=>We.id===te?{...We,_statsLoading:!0}:We));try{const _e=await Y.functions.invoke("getKbStats",{kb_ids:[te]}),tt=(((De=_e==null?void 0:_e.data)==null?void 0:De.stats)||{})[te]||{};i(me=>({...me,[te]:tt.totalItems||0})),t(me=>me.map(ae=>ae.id===te?{...ae,_stats:tt,_statsLoading:!1}:ae))}catch{t(We=>We.map(tt=>tt.id===te?{...tt,_statsLoading:!1}:tt))}}async function K(te,De){De.preventDefault(),De.stopPropagation(),confirm(`Delete "${te.name}"? This will also remove all its items.`)&&(await Y.entities.KnowledgeBase.delete(te.id),t(_e=>_e.filter(We=>We.id!==te.id)))}async function M(te,De){De.preventDefault(),De.stopPropagation(),m(te.id);const _e=te.status==="active"?"inactive":"active";await Y.entities.KnowledgeBase.update(te.id,{status:_e}),t(We=>We.map(tt=>tt.id===te.id?{...tt,status:_e}:tt)),m(null)}function G(te,De){De.preventDefault(),De.stopPropagation(),x(te)}async function q(te){await Y.entities.KnowledgeBase.update(g.id,te),t(De=>
1063De.map(_e=>_e.id===g.id?{..._e,...te}:_e)),x(null)}async function F(){if(confirm(`Re-summarize all ${ie.length} knowledge bases? This may take a while.`)){T(!0);for(const te of ie)B(te.id),Y.functions.invoke("summarizeKB",{knowledge_base_id:te.id});B(null),T(!1)}}async function U(te,De){De&&(t(_e=>{const We=_e.find(ae=>ae.id===te),tt=(We==null?void 0:We.tags)||[];if(tt.includes(De))return _e;const me=[...tt,De];return Y.entities.KnowledgeBase.update(te,{tags:me}),_e.map(ae=>ae.id===te?{...ae,tags:me}:ae)}),S(_e=>({..._e,[te]:""})))}async function ee(te,De){t(_e=>{const We=_e.find(me=>me.id===te),tt=((We==null?void 0:We.tags)||[]).filter(me=>me!==De);return Y.entities.KnowledgeBase.update(te,{tags:tt}),_e.map(me=>me.id===te?{...me,tags:tt}:me)})}async function ne(te){await Y.entities.KnowledgeBase.update(w.id,{library_id:te}),t(De=>De.map(_e=>_e.id===w.id?{..._e,library_id:te}:_e)),_(null)}const X=j==="all"?e:j==="none"?e.filter(te=>!te.library_id):e.filter(te=>te.library_id===j),ie=N?X.filter(te=>(te.tags||[]).includes(N)):X,Z={__all__:e.length,__none__:e.filter(te=>!te.library_id).length,...Object.fromEntries(n.map(te=>[te.id,e.filter(De=>De.library_id===te.id).length]))},ce=ie.filter(te=>te.status!=="inactive"),le=D?ce.filter(te=>ih(te,D)>0):ce,re=[...le].sort((te,De)=>{if(D){const tt=ih(te,D),me=ih(De,D);if(me!==tt)return me-tt}const _e=I.has(String(te.id))?0:1,We=I.has(String(De.id))?0:1;return _e-We}),Ue=ie.filter(te=>te.status==="inactive"),Ne=D?le.reduce((te,De)=>te+ih(De,D),0):0,Oe=X.flatMap(te=>te.tags||[]).reduce((te,De)=>(te[De]=(te[De]||0)+1,te),{}),Me=Object.keys(Oe).sort(),ue=ie.reduce((te,De)=>{const _e=De._stats||{};return te.totalItems+=_e.totalItems||a[De.id]||0,te.totalChars+=_e.totalChars||0,te.totalChunks+=_e.totalChunks||0,te.chunkedItems+=_e.chunkedCount||0,te.summarizedItems+=_e.summarizedCount||0,te.mediaItems+=_e.mediaCount||0,te.ccExtracted+=_e.ccCount||0,te.ccSummarized+=_e.ccSummarizedCount||0,te.vectorizedItems+=_e.vectorizedCount||0,te.totalSupabaseDocs+=_e.totalSupabaseDocs||0,te.embeddedItems+=_e.embeddedCount||0,te.embeddedChunks+=_e.embeddedChunks||0,te},{totalItems:0,totalChars:0,totalChunks:0,chunkedItems:0,summarizedItems:0,mediaItems:0,ccExtracted:0,ccSummarized:0,vectorizedItems:0,totalSupabaseDocs:0,embeddedItems:0,embeddedChunks:0});return r.jsxs("div",{className:"flex h-full min-h-0",children:[r.jsx(zb,{libraries:n,selected:j,onSelect:y,counts:Z,onLibrariesChange:s,storageKey:"kbs",onItemsUnassigned:te=>{t(De=>De.map(_e=>_e.library_id===te?{..._e,library_id:""}:_e)),j===te&&y("all")}}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs("div",{className:"p-6 md:p-10 max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-10",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:j==="all"?"Knowledge Bases":j==="none"?"Uncategorized KBs":((Ve=n.find(te=>te.id===j))==null?void 0:Ve.name)||"Knowledge Bases"}),r.jsxs("p",{className:"text-gray-500 text-base mt-1",children:[re.length," active · ",Ue.length," inactive"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(de,{size:"lg",variant:"outline",className:"gap-2",onClick:W,disabled:c||ie.length===0,children:[c?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Wp,{className:"w-4 h-4"}),c?"Loading…":"Load Statistics"]}),r.jsxs(de,{size:"lg",variant:"outline",className:"gap-2",onClick:F,disabled:A||ie.length===0,children:[A?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(ao,{className:"w-4 h-4"}),A?"Summarizing…":"Re-summarize All KBs"]}),r.jsx(wt,{to:yt("VectorHealthDashboard"),children:r.jsxs(de,{size:"lg",variant:"outline",className:"gap-2",children:[r.jsx(_te,{className:"w-4 h-4 text-orange-500"})," Vector Health"]})}),r.jsx(wt,{to:yt("KbQueue"),children:r.jsxs(de,{size:"lg",variant:"outline",className:"gap-2",children:[r.jsx(el,{className:"w-4 h-4 text-indigo-500"})," KB Queue"]})}),r.jsx(wt,{to:yt("NewKnowledgeBase"),children:r.jsxs(de,{size:"lg",className:"gap-2 text-base px-6 py-3 h-auto",children:[r.jsx(ln,{className:"w-5 h-5"})," New Knowledge Base"]})})]})]}),c&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-indigo-600 bg-indigo-50 border border-indigo-100 rounded-xl px-4 py-2.5 mb-4",children:[r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}),"Loading statistics…"]}),r.jsx(uOe,{gapFilter:D,gapCount:Ne,kbCount:le.length,onClear:()=>P(null)}),!o&&ie.length>0&&(()=>{const te=ie.filter(fe=>fe.human_summary||fe.semantic_summary).length,De=ie.length-te,_e=ie.length>0?te===ie.length?100:Math.min(99,Math.floor(te/ie.length*100)):0,We=ue.totalItems>0?ue.summarizedItems===ue.totalItems?100:Math.min(99,Math.floor(ue.summarizedItems/ue.totalItems*100)):0,tt=ue.totalItems>0?ue.vectorizedItems===ue.totalItems?100:Math.min(99,Math.floor(ue.vectorizedItems/ue.totalItems*100)):0,me=ue.totalItems>0?ue.chunkedItems===ue.totalItems?100:Math.min(99,Math.floor(ue.chunkedItems/ue.totalItems*100)):0,ae=te===ie.length,Se=ue.summarizedItems===ue.totalItems&&ue.totalItems>0,Le=ue.chunkedItems===ue.totalItems&&ue.totalItems>0,He=ue.vectorizedItems===ue.totalItems&&ue.totalItems>0,ut=ue.totalItems>0?ue.embeddedItems===ue.totalItems?100:Math.min(99,Math.floor(ue.embeddedItems/ue.totalItems*100)):0,ze=ue.embeddedItems===ue.totalItems&&ue.totalItems>0;return r.jsxs("div",{className:`border rounded-2xl p-5 mb-6 ${!ae||!Se||!Le||!He?"bg-amber-50 border-amber-200":"bg-emerald-50 border-emerald-200"}`,children:[r.jsx("div",{className:"flex items-center justify-between mb-4",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ao,{className:`w-4 h-4 ${!ae||!Se||!Le||!He?"text-amber-600":"text-emerald-600"}`}),r.jsx("span",{className:`text-sm font-semibold ${!ae||!Se||!Le||!He?"text-amber-800":"text-emerald-800"}`,children:"Coverage Overview"}),(!ae||!Se||!Le||!He)&&r.jsx("span",{className:"text-xs bg-amber-100 text-amber-700 border border-amber-300 rounded-full px-2 py-0.5 font-medium",children:"Incomplete"}),ae&&Se&&Le&&He&&r.jsx("span",{className:"text-xs bg-emerald-100 text-emerald-700 border border-emerald-300 rounded-full px-2 py-0.5 font-medium",children:"Complete"}),c&&r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin text-gray-400"})]})}
1063),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-4",children:[r.jsxs("div",{className:`space-y-1.5 cursor-pointer rounded-lg p-1 -m-1 transition-colors ${D==="kb_summarized"?"ring-2 ring-amber-300 bg-amber-50/50":"hover:bg-black/[0.03]"}`,onClick:()=>P(D==="kb_summarized"?null:"kb_summarized"),title:"Click to see KBs missing summaries",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-xs font-medium text-gray-600",children:"KBs Summarized"}),r.jsxs("span",{className:`text-xs font-bold ${ae?"text-emerald-700":"text-amber-700"}`,children:[_e,"%"]})]}),r.jsx("div",{className:"h-2 bg-white rounded-full overflow-hidden border",children:r.jsx("div",{className:`h-full rounded-full transition-all ${ae?"bg-emerald-500":"bg-amber-400"}`,style:{width:`${_e}%`}})}),r.jsxs("div",{className:"text-xs text-gray-500",children:[te," of ",ie.length," KBs ",!ae&&r.jsxs("span",{className:"text-amber-600 font-medium",children:["· ",De," missing"]})]})]}),r.jsxs("div",{className:`space-y-1.5 cursor-pointer rounded-lg p-1 -m-1 transition-colors ${D==="summarized"?"ring-2 ring-amber-300 bg-amber-50/50":"hover:bg-black/[0.03]"}`,onClick:()=>P(D==="summarized"?null:"summarized"),title:"Click to see items missing summaries",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-xs font-medium text-gray-600",children:"Items Summarized"}),r.jsxs("span",{className:`text-xs font-bold ${Se?"text-emerald-700":"text-amber-700"}`,children:[We,"%"]})]}),r.jsx("div",{className:"h-2 bg-white rounded-full overflow-hidden border",children:r.jsx("div",{className:`h-full rounded-full transition-all ${Se?"bg-emerald-500":"bg-amber-400"}`,style:{width:`${We}%`}})}),r.jsxs("div",{className:"text-xs text-gray-500",children:[ue.summarizedItems," of ",ue.totalItems," items ",!Se&&r.jsxs("span",{className:"text-amber-600 font-medium",children:["· ",ue.totalItems-ue.summarizedItems," missing"]})]})]}),r.jsxs("div",{className:`space-y-1.5 cursor-pointer rounded-lg p-1 -m-1 transition-colors ${D==="chunked"?"ring-2 ring-amber-300 bg-amber-50/50":"hover:bg-black/[0.03]"}`,onClick:()=>P(D==="chunked"?null:"chunked"),title:"Click to see items missing chunking",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-xs font-medium text-gray-600",children:"Items Chunked"}),r.jsxs("span",{className:`text-xs font-bold ${Le?"text-emerald-700":"text-amber-700"}`,children:[me,"%"]})]}),r.jsx("div",{className:"h-2 bg-white rounded-full overflow-hidden border",children:r.jsx("div",{className:`h-full rounded-full transition-all ${Le?"bg-emerald-500":"bg-amber-400"}`,style:{width:`${me}%`}})}),r.jsxs("div",{className:"text-xs text-gray-500",children:[ue.chunkedItems," of ",ue.totalItems," · ",ue.totalChunks.toLocaleString()," chunks ",!Le&&r.jsxs("span",{className:"text-amber-600 font-medium",children:["· ",ue.totalItems-ue.chunkedItems," missing"]})]})]}),r.jsxs("div",{className:`space-y-1.5 cursor-pointer rounded-lg p-1 -m-1 transition-colors ${D==="embedded"?"ring-2 ring-blue-300 bg-blue-50/50":"hover:bg-black/[0.03]"}`,onClick:()=>P(D==="embedded"?null:"embedded"),title:"Click to see items missing embeddings",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-xs font-medium text-gray-600",children:"Items Embedded"}),r.jsxs("span",{className:`text-xs font-bold ${ze?"text-emerald-700":"text-blue-600"}`,children:[ut,"%"]})]}),r.jsx("div",{className:"h-2 bg-white rounded-full overflow-hidden border",children:r.jsx("div",{className:`h-full rounded-full transition-all ${ze?"bg-emerald-500":"bg-blue-400"}`,style:{width:`${ut}%`}})}),r.jsxs("div",{className:"text-xs text-gray-500",children:[ue.embeddedItems," of ",ue.totalItems," · ",ue.embeddedChunks.toLocaleString()," chunks ",!ze&&r.jsxs("span",{className:"text-blue-600 font-medium",children:["· ",ue.totalItems-ue.embeddedItems," missing"]})]})]}),r.jsxs("div",{className:`space-y-1.5 cursor-pointer rounded-lg p-1 -m-1 transition-colors ${D==="vectorized"?"ring-2 ring-orange-300 bg-orange-50/50":"hover:bg-black/[0.03]"}`,onClick:()=>P(D==="vectorized"?null:"vectorized"),title:"Click to see items missing vectorization",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-xs font-medium text-gray-600",children:"Items Vectorized"}),r.jsxs("span",{className:`text-xs font-bold ${He?"text-emerald-700":"text-orange-600"}`,children:[tt,"%"]})]}),r.jsx("div",{className:"h-2 bg-white rounded-full overflow-hidden border",children:r.jsx("div",{className:`h-full rounded-full transition-all ${He?"bg-emerald-500":"bg-orange-400"}`,style:{width:`${tt}%`}})}),r.jsxs("div",{className:"text-xs text-gray-500",children:[ue.vectorizedItems," of ",ue.totalItems," · ",ue.totalSupabaseDocs.toLocaleStr
1063ing()," total docs ",!He&&r.jsxs("span",{className:"text-orange-600 font-medium",children:["· ",ue.totalItems-ue.vectorizedItems," missing"]})]})]})]})]})})(),!o&&ie.length>0&&r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8",children:[r.jsxs("div",{className:"bg-white border rounded-xl p-4 text-center",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"KBs"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:ie.length}),r.jsxs("div",{className:"text-xs text-gray-400 mt-0.5",children:[re.length," active"]})]}),Me.length>0&&r.jsxs("div",{className:"bg-white border rounded-xl p-4 col-span-2 sm:col-span-2",children:[r.jsxs("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide mb-2 flex items-center gap-1",children:[r.jsx(ac,{className:"w-3 h-3"})," Tags (",Me.length,")",N&&r.jsxs("button",{onClick:()=>C(null),className:"ml-auto flex items-center gap-1 text-xs text-indigo-500 hover:text-red-500 transition-colors",children:[r.jsx(jt,{className:"w-3 h-3"})," clear filter"]})]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:Me.map(te=>r.jsxs("button",{onClick:()=>C(N===te?null:te),className:`text-xs px-2 py-0.5 rounded-full border font-medium flex items-center gap-1 transition-colors
1064                          ${N===te?"bg-indigo-600 text-white border-indigo-600":"bg-indigo-50 text-indigo-600 border-indigo-200 hover:bg-indigo-100"}`,children:[te,r.jsx("span",{className:`text-[10px] font-bold ${N===te?"text-indigo-200":"text-indigo-400"}`,children:Oe[te]})]},te))})]}),r.jsxs("div",{className:"bg-white border rounded-xl p-4 text-center",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"Total Items"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:ue.totalItems.toLocaleString()}),r.jsxs("div",{className:"text-xs text-gray-400 mt-0.5",children:[(ue.totalChars/1e3).toFixed(1),"K chars"]})]}),r.jsxs("div",{className:"bg-white border rounded-xl p-4 text-center",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"Chunks"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:ue.totalChunks.toLocaleString()}),r.jsxs("div",{className:`text-xs mt-0.5 ${ue.chunkedItems<ue.totalItems?"text-amber-500":"text-gray-400"}`,children:[ue.chunkedItems,"/",ue.totalItems," items chunked"]})]}),r.jsxs("div",{className:`border rounded-xl p-4 text-center ${ue.summarizedItems<ue.totalItems?"bg-amber-50 border-amber-200":"bg-white"}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"Summarized"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:ue.summarizedItems.toLocaleString()}),r.jsxs("div",{className:`text-xs mt-0.5 ${ue.summarizedItems<ue.totalItems?"text-amber-600":"text-gray-400"}`,children:[ue.totalItems>0?Math.round(ue.summarizedItems/ue.totalItems*100):0,"% coverage"]})]}),r.jsxs("div",{className:`border rounded-xl p-4 text-center ${ue.vectorizedItems<ue.totalItems?"bg-orange-50 border-orange-200":"bg-white"}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"Vectorized"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:ue.vectorizedItems.toLocaleString()}),r.jsxs("div",{className:`text-xs mt-0.5 ${ue.vectorizedItems<ue.totalItems?"text-orange-600":"text-gray-400"}`,children:[ue.totalItems>0?Math.round(ue.vectorizedItems/ue.totalItems*100):0,"% · ",ue.totalSupabaseDocs.toLocaleString()," docs"]})]}),r.jsxs("div",{className:`border rounded-xl p-4 text-center ${ue.embeddedItems<ue.totalItems?"bg-blue-50 border-blue-200":"bg-white"}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"Embedded"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:ue.embeddedItems.toLocaleString()}),r.jsxs("div",{className:`text-xs mt-0.5 ${ue.embeddedItems<ue.totalItems?"text-blue-600":"text-gray-400"}`,children:[ue.totalItems>0?Math.round(ue.embeddedItems/ue.totalItems*100):0,"% · ",ue.embeddedChunks.toLocaleStr
1064ing()," chunks"]})]}),ue.mediaItems>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"bg-purple-50 border border-purple-100 rounded-xl p-4 text-center",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"Media Items"}),r.jsx("div",{className:"text-2xl font-bold text-purple-700 mt-1",children:ue.mediaItems})]}),r.jsxs("button",{className:`border rounded-xl p-4 text-center cursor-pointer transition-all ${ue.ccExtracted<ue.mediaItems?"bg-amber-50 border-amber-200":"bg-teal-50 border-teal-100"} ${D==="cc_extracted"?"ring-2 ring-amber-300":"hover:shadow-md"}`,onClick:()=>P(D==="cc_extracted"?null:"cc_extracted"),title:"Click to see media items missing CC extraction",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"CC Extracted"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:ue.ccExtracted}),r.jsxs("div",{className:`text-xs mt-0.5 ${ue.ccExtracted<ue.mediaItems?"text-amber-600":"text-teal-600"}`,children:["of ",ue.mediaItems," media items",ue.ccExtracted<ue.mediaItems&&r.jsxs("span",{className:"font-medium",children:[" · ",ue.mediaItems-ue.ccExtracted," missing"]})]})]}),ue.ccExtracted>0&&r.jsxs("button",{className:`border rounded-xl p-4 text-center cursor-pointer transition-all ${ue.ccSummarized<ue.ccExtracted?"bg-amber-50 border-amber-200":"bg-cyan-50 border-cyan-100"} ${D==="cc_summarized"?"ring-2 ring-amber-300":"hover:shadow-md"}`,onClick:()=>P(D==="cc_summarized"?null:"cc_summarized"),title:"Click to see CC items missing summarization",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium uppercase tracking-wide",children:"CC Summarized"}),r.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:ue.ccSummarized}),r.jsxs("div",{className:`text-xs mt-0.5 ${ue.ccSummarized<ue.ccExtracted?"text-amber-600":"text-cyan-600"}`,children:["of ",ue.ccExtracted," CC items",ue.ccSummarized<ue.ccExtracted&&r.jsxs("span",{className:"font-medium",children:[" · ",ue.ccExtracted-ue.ccSummarized," missing"]})]})]})]})]}),o?r.jsx("div",{className:"space-y-4",children:[1,2,3].map(te=>r.jsx("div",{className:"h-32 bg-gray-100 animate-pulse rounded-2xl"},te))}):ie.length===0?r.jsxs("div",{className:"text-center py-32 border-2 border-dashed border-gray-200 rounded-2xl",children:[r.jsx(_n,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),r.jsx("h3",{className:"text-gray-700 text-xl font-semibold mb-2",children:"No knowledge bases here"}),r.jsx("p",{className:"text-gray-400 text-base mb-6",children:j==="all"?"Create a knowledge base to store content your AI can reference.":"Move knowledge bases to this library from the main list."}),j==="all"&&r.jsx(wt,{to:yt("NewKnowledgeBase"),children:r.jsxs(de,{size:"lg",className:"gap-2 text-base px-6 py-3 h-auto",children:[r.jsx(ln,{className:"w-5 h-5"})," Create your first one"]})})]}):r.jsxs(r.Fragment,{children:[N&&r.jsxs("div",{className:"flex items-center gap-2 mb-4 text-sm text-indigo-700 bg-indigo-50 border border-indigo-200 rounded-xl px-4 py-2",children:[r.jsx(ac,{className:"w-4 h-4"}),"Filtering by tag: ",r.jsx("strong",{children:N})," (",ie.length," KB",ie.length!==1?"s":"",")",r.jsx("button",{onClick:()=>C(null),className:"ml-auto text-gray-400 hover:text-red-500",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-5",children:[D&&re.length===0&&r.jsxs("div",{className:"text-center py-16 border-2 border-dashed border-emerald-200 rounded-2xl bg-emerald-50",children:[r.jsx("p",{className:"text-emerald-700 text-lg font-semibold mb-1",children:"No gaps found! 🎉"}),r.jsxs("p",{className:"text-emerald-600 text-sm",children:["All KBs have full coverage for ",(Xe=t3[D])==null?void 0:Xe.label.toLowerCase(),"."]}),r.jsx("button",{onClick:()=>P(null),className:"mt-4 text-sm text-indigo-600 hover:text-indigo-800 font-medium",children:"Clear filter"})]}),re.map(te=>{var De;return r.jsx(DB,{kb:te,count:a[te.id]||0,togglingId:f,summarizing:R===te.id,libraryName:((De=n.find(_e=>_e.id===te.library_id))==null?void 0:De.name)||null,isFavorite:I.has(String(te.id)),onToggleFavorite:_e=>L(te.id,_e),onDelete:K,onToggle:M,onEdit:G,onMove:_e=>{_e.preventDefault(),_e.stopPropagation(),_(te)},onLoadStats:_e=>{_e.preventDefault(),_e.stopPropagation(),V(te.id)},tagInputValue:k[te.id]||"",onTagInputChange:_e=>S(We=>({...We,[te.id]:_e})),onAddTag:_e=>U(te.id,_e),onRemoveTag:_e=>ee(te.id,_e),onTagClick:_e=>C(N===_e?null:_e),activeTagFilter:N,gapFilter:D,gapCount:D?ih(te,D):0},te.id)})]}),Ue.length>0&&r.jsxs("div",{className:"mt-8",children:[r.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wide mb-3 px-1",children:"Inactive"}),r.jsx("div",{className:"space-y-5",children:Ue.map(te=>{var De;return r.jsx(DB,{kb:te,count:a[te.id]||0,togglingId:f,summarizing:R===te.id,libraryName:((De=n.find(_e=>_e.id===te.library_id))==null?void 0:De.name)||null,isFavorite:I.has(String(te.id)),onToggleFavorite:_e=>L(te.id,_e),onDelete:K,onToggle:M,onEdit:G,onMove:_e=>{_e.preventDefault(),_e.stopPropagation(),_(te)},onLoadStats:_e=>{_e.preventDefault(),_e.stopPropagation(),V(te.id)},tagInputValue:k[te.id]||"",onTagInputChange:_e=>S(We=>({...We,[te.id]:_e})),onAddTag:_e=>U(te.id,_e),onRemoveTag:_e=>ee(te.id,_e),onTagClick:_e=>C(N===_e?null:_e),activeTagFilter:N},te.id)})})]})]})]})}),g&&r.jsx(dOe,{kb:g,onSave:q,onClose:()=>x(null)}),w&&r.jsx(Ub,{itemName:w.name,libraries:n,currentLibraryId:w.library_id||"",onMove:ne,onClose:()=>_(null)})]})}function DB({kb:e,count:t,togglingId:n,summarizing:s,onDelete:a,onToggle:i,onEdit:o,onMove:l,onLoadStats:c,libraryName:d,isFavorite:f,onToggleFavorite:m,tagInputValue:g,onTagInputChange:x,onAddTag:j,onRemoveTag:b,onTagClick:y,activeTagFilter:w,gapFilter:_,gapCount:N}){const[C,k]=h.useState(!1),[S,A]=h.useState(!1),T=RB[e.color]||RB.indigo,R=MB[e.color]||MB.indigo,B=e.status!=="inactive",D=!!(e.human_summary||e.semantic_summary),P=_?t3[_]:null;return r.jsx(wt,{to:yt(`KnowledgeBaseDetail?id=${e.id}`),children:r.jsxs("div",{className:"border rounded-2xl bg-white hover:shadow-lg hover:border-indigo-200 transition-all group cursor-pointer overflow-hidden",children:[s&&r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-indigo-50 border-b border-indigo-100 text-xs text-indigo-600 font-medium",children:[r.jsx(Pe,{className:"w-3 h-3 animate-spin"})," Summarizing…"]}),r.jsxs("div",{className:"px-7 py-6 space-y-5",children:[r.jsxs("div",{className:"flex items-start gap-4",children:[e.icon_url?r.jsx("img",{src:e.icon_url,alt:"",className:"w-14 h-14 roun
1064ded-xl object-contain shrink-0 border bg-gray-50 shadow-sm"}):r.jsx("div",{className:`w-14 h-14 rounded-xl flex items-center justify-center shrink-0 border ${R}`,children:r.jsx("div",{className:`w-6 h-6 rounded-full ${T}`})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[r.jsx("span",{className:"font-bold text-lg text-gray-900 group-hover:text-indigo-700 transition-colors",children:e.name}),_&&N>0&&r.jsxs("span",{className:"text-xs border px-2 py-0.5 rounded-full bg-red-50 text-red-600 border-red-200 font-bold flex items-center gap-1",children:[P==null?void 0:P.icon," ",N," missing"]}),e.type&&r.jsx("span",{className:`text-xs border px-2 py-0.5 rounded-full ${mOe[e.type]||"bg-gray-50 text-gray-500 border-gray-200"}`,children:e.type}),d&&r.jsx("span",{className:"text-xs border px-2 py-0.5 rounded-full bg-violet-50 text-violet-600 border-violet-200",children:d}),!d&&r.jsx("span",{className:"text-xs border px-2 py-0.5 rounded-full bg-gray-50 text-gray-400 border-gray-200 italic",children:"Not in a Library"}),!B&&r.jsx("span",{className:"text-xs border px-2 py-0.5 rounded-full bg-gray-50 text-gray-400 border-gray-200",children:"inactive"})]}),e.description&&r.jsx("p",{className:"text-sm text-gray-500",children:e.description}),r.jsxs("div",{className:"flex flex-wrap gap-1 mt-1.5 items-center",children:[(e.tags||[]).map(I=>r.jsxs("span",{className:`text-xs px-2 py-0.5 rounded-full border font-medium flex items-center gap-0.5 transition-colors
1065                    ${w===I?"bg-indigo-600 text-white border-indigo-600":"bg-indigo-50 text-indigo-600 border-indigo-200"}`,children:[r.jsx("button",{onClick:z=>{z.preventDefault(),z.stopPropagation(),y(I)},className:"hover:underline",children:I}),r.jsx("button",{onClick:z=>{z.preventDefault(),z.stopPropagation(),b(I)},className:`ml-0.5 transition-colors ${w===I?"text-indigo-200 hover:text-red-300":"text-indigo-300 hover:text-red-500"}`,children:r.jsx(jt,{className:"w-2.5 h-2.5"})})]},I)),S?r.jsxs("div",{className:"flex items-center gap-1",onClick:I=>{I.preventDefault(),I.stopPropagation()},children:[r.jsx("input",{autoFocus:!0,value:g,onChange:I=>{I.stopPropagation(),x(I.target.value)},onBlur:()=>{g||A(!1)},onKeyDown:I=>{I.stopPropagation(),I.key==="Enter"&&(I.preventDefault(),g.trim()&&(j(g.trim()),A(!1))),I.key==="Escape"&&(A(!1),x(""))},placeholder:"tag…",className:"text-xs border border-indigo-300 rounded-full px-2 py-0.5 w-20 focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("button",{type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),g.trim()&&(j(g.trim()),A(!1))},className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Add"}),r.jsx("button",{type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),A(!1),x("")},className:"text-gray-400 hover:text-red-400",children:r.jsx(jt,{className:"w-3 h-3"})})]}):r.jsxs("button",{type:"button",onClick:I=>{I.preventDefault(),I.stopPropagation(),A(!0)},className:"text-xs px-2 py-0.5 rounded-full border border-dashed border-gray-300 text-gray-400 hover:border-indigo-300 hover:text-indigo-500 transition-colors flex items-center gap-0.5",children:[r.jsx(ln,{className:"w-2.5 h-2.5"})," tag"]})]})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx("button",{onClick:m,className:`p-1.5 rounded-lg transition-colors ${f?"text-amber-400 hover:text-amber-500":"text-gray-200 hover:text-amber-300"}`,title:f?"Remove from favorites":"Add to favorites",children:r.jsx(Xi,{className:"w-4 h-4",fill:f?"currentColor":"none"})}),r.jsx(en,{className:"w-5 h-5 text-gray-300 group-hover:text-indigo-400 transition-colors mt-1"})]})]}),r.jsxs("div",{className:"space-y-3 border-t pt-4",children:[r.jsxs("div",{className:"flex items-center gap-6 text-sm text-gray-500 flex-wrap",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(ns,{className:"w-4 h-4"}),t," item",t!==1?"s":""]}),r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Lm,{className:"w-4 h-4"}
1065),new Date(e.created_date).toLocaleString()]})]}),t>0&&e._stats&&r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs("div",{className:"bg-gray-50 rounded-lg p-2.5 text-center",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"Total Chars"}),r.jsxs("div",{className:"text-sm font-bold text-gray-900 mt-1",children:[(e._stats.totalChars/1e3).toFixed(1),"K"]})]}),r.jsxs("div",{className:"bg-gray-50 rounded-lg p-2.5 text-center",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"Chunks"}),r.jsx("div",{className:"text-sm font-bold text-gray-900 mt-1",children:e._stats.totalChunks})]}),r.jsxs("div",{className:`rounded-lg p-2.5 text-center ${e._stats.chunkedCount<t?"bg-amber-50":"bg-gray-50"} ${_==="chunked"?"ring-2 ring-amber-300":""}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"Chunked Items"}),r.jsxs("div",{className:"text-sm font-bold text-gray-900 mt-1",children:[e._stats.chunkedCount,r.jsxs("span",{className:"text-gray-400 font-normal",children:["/",t]})]})]}),r.jsxs("div",{className:`rounded-lg p-2.5 text-center ${e._stats.summarizedCount<t?"bg-amber-50":"bg-gray-50"} ${_==="summarized"?"ring-2 ring-amber-300":""}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"Summarized"}),r.jsxs("div",{className:"text-sm font-bold text-gray-900 mt-1",children:[e._stats.summarizedCount,r.jsxs("span",{className:"text-gray-400 font-normal",children:["/",t]})]})]}),r.jsxs("div",{className:`rounded-lg p-2.5 text-center ${(e._stats.vectorizedCount||0)<t?"bg-orange-50":"bg-gray-50"} ${_==="vectorized"?"ring-2 ring-orange-300":""}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"Vectorized"}),r.jsxs("div",{className:"text-sm font-bold text-gray-900 mt-1",children:[e._stats.vectorizedCount||0,r.jsxs("span",{className:"text-gray-400 font-normal",children:["/",t]})]}),(e._stats.totalSupabaseDocs||0)>0&&r.jsxs("div",{className:"text-[10px] text-orange-600 mt-0.5",children:[e._stats.totalSupabaseDocs," docs"]})]}),r.jsxs("div",{className:`rounded-lg p-2.5 text-center ${(e._stats.embeddedCount||0)<t?"bg-blue-50":"bg-gray-50"} ${_==="embedded"?"ring-2 ring-blue-300":""}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"Embedded"}),r.jsxs("div",{className:"text-sm font-bold text-gray-900 mt-1",children:[e._stats.embeddedCount||0,r.jsxs("span",{className:"text-gray-400 font-normal",children:["/",t]})]}),(e._stats.embeddedChunks||0)>0&&r.jsxs("div",{className:"text-[10px] text-blue-600 mt-0.5",children:[e._stats.embeddedChunks," chunks"]})]}),e._stats.mediaCount>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"bg-purple-50 rounded-lg p-2.5 text-center",children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"With Media"}),r.jsx("div",{className:"text-sm font-bold text-purple-700 mt-1",children:e._stats.mediaCount})]}),r.jsxs("div",{className:`rounded-lg p-2.5 text-center ${e._stats.ccCount<e._stats.mediaCount?"bg-amber-50":"bg-teal-50"} ${_==="cc_extracted"?"ring-2 ring-amber-300":""}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"CC Extracted"}),r.jsxs("div",{className:"text-sm font-bold text-gray-900 mt-1",children:[e._stats.ccCount,r.jsxs("span",{className:"text-gray-400 font-normal",children:["/",e._stats.mediaCount]})]})]}),e._stats.ccCount>0&&r.jsxs("div",{className:`rounded-lg p-2.5 text-center ${e._stats.ccSummarizedCount<e._stats.ccCount?"bg-amber-50":"bg-cyan-50"} ${_==="cc_summarized"?"ring-2 ring-amber-300":""}`,children:[r.jsx("div",{className:"text-xs text-gray-500 font-medium",children:"CC Summarized"}),r.jsxs("div",{className:"text-sm font-bold text-gray-900 mt-1",children:[e._stats.ccSummarizedCount,r.jsxs("span",{className:"text-gray-400 font-normal",children:["/",e._stats.ccCount]})]})]})]})]})]}),D&&r.jsxs("div",{className:"border-t pt-3",children:[r.jsxs("button",{onClick:I=>{I.preventDefault(),I.stopPropagation(),k(z=>!z)},className:"flex items-center gap-1.5 text-xs font-medium text-indigo-500 hover:text-indigo-700 transition-colors",children:[C?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"}),"KB Summaries"]}),C&&r.jsxs("div",{className:"mt-2 space-y-2",onClick:I=>{I.preventDefault(),I.stopPropagation()},children:[e.human_summary&&r.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("p",{className:"text-[10px] font-semibold text-blue-600 uppercase tracking-wide",children:"Human Summary"}),r.jsxs("span",{className:"text-[10px] text-blue-400 font-mono",children:[e.human_summary.length.toLocaleStr
1065ing()," chars"]})]}),r.jsx("p",{className:"text-xs text-blue-800 leading-relaxed",children:e.human_summary})]}),e.semantic_summary&&r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("p",{className:"text-[10px] font-semibold text-violet-600 uppercase tracking-wide",children:"Semantic Summary"}),r.jsxs("span",{className:"text-[10px] text-violet-400 font-mono",children:[e.semantic_summary.length.toLocaleString()," chars"]})]}),r.jsx("p",{className:"text-xs text-violet-800 leading-relaxed",children:e.semantic_summary})]})]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap border-t pt-4",children:[r.jsxs("button",{onClick:c,disabled:e._statsLoading,className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium text-gray-700 bg-gray-50 border border-gray-200 hover:bg-gray-100 transition-colors disabled:opacity-50",children:[e._statsLoading?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Wp,{className:"w-4 h-4"}),e._stats?"Reload Stats":"Load Stats"]}),r.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium text-violet-700 bg-violet-50 border border-violet-200 hover:bg-violet-100 transition-colors",children:[r.jsx(Jp,{className:"w-4 h-4"})," Move"]}),r.jsxs("button",{onClick:I=>i(e,I),disabled:n===e.id,className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium transition-colors border
1066                ${B?"text-emerald-700 bg-emerald-50 border-emerald-200 hover:bg-emerald-100":"text-gray-500 bg-gray-50 border-gray-200 hover:bg-gray-100"}`,children:[n===e.id?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):B?r.jsx(i7,{className:"w-4 h-4"}):r.jsx(a7,{className:"w-4 h-4"}),B?"Active":"Inactive"]}),r.jsxs("button",{onClick:I=>o(e,I),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium text-indigo-700 bg-indigo-50 border border-indigo-200 hover:bg-indigo-100 transition-colors",children:[r.jsx(ra,{className:"w-4 h-4"})," Edit"]}),r.jsxs("button",{onClick:I=>a(e,I),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium text-red-600 bg-red-50 border border-red-200 hover:bg-red-100 transition-colors",children:[r.jsx(un,{className:"w-4 h-4"})," Delete"]})]})]})]})})}function hOe(e,t=[]){let n=[];function s(i,o){const l=h.createContext(o);l.displayName=i+"Context";const c=n.length;n=[...n,o];const d=m=>{var w;const{scope:g,children:x,...j}=m,b=((w=g==null?void 0:g[e])==null?void 0:w[c])||l,y=h.useMemo(()=>j,Object.values(j));return r.jsx(b.Provider,{value:y,children:x})};d.displayName=i+"Provider";function f(m,g){var b;const x=((b=g==null?void 0:g[e])==null?void 0:b[c])||l,j=h.useContext(x);if(j)return j;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[d,f]}const a=()=>{const i=n.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[s,pOe(a,...t)]}function pOe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=s.reduce((l,{useScope:c,scopeName:d})=>{const m=c(i)[`__scope${d}`];return{...l,...m}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var gOe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dW=gOe.reduce((e,t)=>{const n=fE(`Primitive.${t}`),s=h.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),n3="Progress",r3=100,[xOe]=hOe(n3),[yOe,bOe]=xOe(n3),uW=h.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:a,getValueLabel:i=vOe,...o}=e;(a||a===0)&&!LB(a)&&console.error(wOe(`${a}`,"Progress"));const l=LB(a)?a:r3;s!==null&&!$B(s,l)&&console.error(jOe(`${s}`,"Progress"));const c=$B(s,l)?s:null,d=ab(c)?i(c,l):void 0;return r.jsx(yOe,{scope:n,value:c,max:l,children:r.jsx(dW.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":ab(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":hW(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});uW.displayName=n3;var mW="ProgressIndicator",fW=h.forwardRef((e,t)=>
1066{const{__scopeProgress:n,...s}=e,a=bOe(mW,n);return r.jsx(dW.div,{"data-state":hW(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:t})});fW.displayName=mW;function vOe(e,t){return`${Math.round(e/t*100)}%`}function hW(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function ab(e){return typeof e=="number"}function LB(e){return ab(e)&&!isNaN(e)&&e>0}function $B(e,t){return ab(e)&&!isNaN(e)&&e<=t&&e>=0}function wOe(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${r3}\`.`}function jOe(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
1067  - a positive number
1068  - less than the value passed to \`max\` (or ${r3} if no \`max\` prop is set)
1069  - \`null\` or \`undefined\` if the progress is indeterminate.
1070
1071Defaulting to \`null\`.`}var pW=uW,_Oe=fW;const NOe=h.forwardRef(({className:e,value:t,...n},s)=>r.jsx(pW,{ref:s,className:rn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:r.jsx(_Oe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));NOe.displayName=pW.displayName;const SOe=[{label:"FAST Exam Protocol",level:88},{label:"Cardiac Echo Windows",level:72},{label:"Lung Ultrasound (B-lines)",level:65},{label:"Vascular Access Guidance",level:80}],kOe=["Emergency Medicine","Critical Care","Resuscitation","Airway Management","Trauma"],COe=[{label:"Professional Formation",hint:"Residency, fellowship, specialty board — we don't know yet."},{label:"Clinical Setting",hint:"ED, ICU, rural clinic? This shapes your learning path."},{label:"Years of POCUS Practice",hint:"Helps us gauge your experience level accurately."},{label:"Scan Volume (cases/month)",hint:"How many scans do you perform monthly?"}],EOe=[{title:"Transesophageal Echo (TEE) Basics",reason:"You're strong in TTE but TEE is a natural next step for critical care POCUS.",icon:Zk,color:"text-violet-600",bg:"bg-violet-50"},{title:"Optic Nerve Sheath Diameter",reason:"Elevated ICP assessment via ONSD is underutilized — high impact for your ICU work.",icon:r2,color:"text-emerald-600",bg:"bg-emerald-50"},{title:"Advanced Lung Protocols (BLUE/FALLS)",reason:"You know B-lines but structured protocols like BLUE/FALLS would elevate your diagnostic accuracy.",icon:Yn,color:"text-amber-600",bg:"bg-amber-50"},{title:"Pediatric POCUS Adaptations",reason:"Your profile shows adult ED focus — pediatric probe selection and views differ significantly.",icon:zn,color:"text-blue-600",bg:"bg-blue-50"}],AOe=[{type:"content",title:"TEE for the ICU Intensivist",desc:"Structured introduction to TEE views, probe manipulation, and safety considerations.",duration:"18 min",contentType:"Webinar",tags:["TEE","Critical Care","Echo"],color:"indigo"},{type:"content",title:"BLUE Protocol: Step-by-Step",desc:"Algorithmic approach to lung ultrasound in acute dyspnea using the BLUE protocol.",duration:"25 min",contentType:"Lesson",tags:["Lung US","Dyspnea","Protocol"],color:"indigo"},{type:"content",title:"Optic Nerve Sheath Measurement",desc:"How to measure ONSD, normal values, and pitfalls in elevated ICP screening.",duration:"10 min",contentType:"Article",tags:["Neurology","ICP","ONSD"],color:"violet"},{type:"content",title:"Advanced POCUS in Trauma",desc:"Extended FAST, pneumothorax detection, and hemopericardium assessment in trauma patients.",duration:"40 min",contentType:"Program",tags:["Trauma","FAST","Emergency"],color:"indigo"},{type:"content",title:"5 Mistakes in Cardiac POCUS",desc:"Common errors in parasternal and apical views — and how to avoid them.",duration:"6 min",contentType:"Blog",tags:["Cardiac","Echo"],color:"violet"},{type:"profile",title:"Tell us your Clinical Setting",desc:"ED, ICU, or ambulatory? Knowing your environment sharpens content recommendations.",color:"amber"},{type:"chat",title:"Chat with AI about your Scan Volume",desc:"Answer a few questions so we can understand your experience level and tailor your path.",color:"emerald"}],TOe=[{role:"assistant",content:"Hi! I'm your POCUS learning assistant. I can see you're strong in FAST exams and vascular access. Would you like to explore what's next in y
1071our learning journey?"},{role:"user",content:"Yes! I want to get better at lung ultrasound."},{role:"assistant",content:"Great choice! You already know B-lines, so the next step is the **BLUE Protocol** — a structured algorithm for acute dyspnea. I also found a module on **FALLS Protocol** which pairs well with it. Want me to pull those from the Learning KB?"}];function gW({children:e,label:t}){const n=h.useRef(null),s=a=>{n.current&&n.current.scrollBy({left:a*220,behavior:"smooth"})};return r.jsxs("div",{className:"relative",children:[r.jsx("button",{onClick:()=>s(-1),className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 bg-white border border-gray-200 rounded-full w-6 h-6 flex items-center justify-center shadow-sm hover:bg-gray-50 transition-colors",children:r.jsx(ii,{className:"w-3.5 h-3.5 text-gray-500"})}),r.jsx("div",{ref:n,className:"flex gap-3 overflow-x-auto scroll-smooth px-8 pb-1 scrollbar-hide",style:{scrollbarWidth:"none"},children:e}),r.jsx("button",{onClick:()=>s(1),className:"absolute right-0 top-1/2 -translate-y-1/2 z-10 bg-white border border-gray-200 rounded-full w-6 h-6 flex items-center justify-center shadow-sm hover:bg-gray-50 transition-colors",children:r.jsx(en,{className:"w-3.5 h-3.5 text-gray-500"})})]})}function POe(){return r.jsxs("div",{className:"flex flex-col h-full gap-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:"What I'm Good At"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(P0,{className:"w-3.5 h-3.5 text-amber-500"}),r.jsx("span",{className:"text-xs font-semibold text-amber-600",children:"Your profile is 62% complete"})]})]}),r.jsxs("div",{className:"flex gap-4 flex-1 min-h-0 overflow-hidden",children:[r.jsxs("div",{className:"flex-1 min-w-0 space-y-2 overflow-hidden",children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"Skills"}),SOe.map(e=>r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"h-7 w-full rounded-md overflow-hidden bg-indigo-100",children:r.jsx("div",{className:"h-full bg-indigo-500 rounded-md flex items-center px-2 transition-all",style:{width:`${e.level}%`},children:r.jsx("span",{className:"text-[11px] font-semibold text-white truncate",children:e.label})})}),r.jsxs("span",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-[10px] font-bold text-indigo-700",children:[e.level,"%"]})]},e.label)),r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide pt-1",children:"Interests"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:kOe.map(e=>r.jsx(Gr,{className:"text-[9px] bg-indigo-50 text-indigo-700 border border-indigo-100 px-1.5 py-0",children:e},e))})]}),r.jsxs("div",{className:"w-44 shrink-0 space-y-1.5 overflow-hidden",children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"We don't know yet"}),COe.map(e=>r.jsxs("div",{className:"bg-amber-50 border border-amber-100 rounded-lg p-2",children:[r.jsxs("div",{className:"flex items-start gap-1.5",children:[r.jsx(fr,{className:"w-3 h-3 text-amber-400 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] font-semibold text-gray-700",children:e.label}),r.jsx("p",{className:"text-[10px] text-gray-400 leading-snug",children:e.hint})]})]}),r.jsxs("button",{className:"mt-1.5 text-[10px] font-semibold text-amber-600 hover:text-amber-700 flex items-center gap-0.5 transition-colors",children:["Tell us more ",r.jsx(Rh,{className:"w-3 h-3"})]})]},e.label))]})]})]})}function OOe(){return r.jsxs("div",{className:"flex flex-col h-full gap-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx(o7,{className:"w-4 h-4 text-violet-500"}),r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:"What I Can Improve"}),r.jsx(Gr,{className:"ml-auto text-[10px] bg-violet-100 text-violet-700 border-0",children:"AI Suggested"})]}),r.jsx(gW,{children:EOe.map(e=>r.jsxs("div",{className:`flex-shrink-0 w-52 rounded-xl border border-gray-100 p-3 flex flex-col hover:border-indigo-200 hover:shadow-sm transition-all ${e.bg}`,children:[r.jsx(e.icon,{className:`w-5 h-5 mb-2 ${e.color}`}
1071),r.jsx("p",{className:"text-xs font-semibold text-gray-800 mb-1",children:e.title}),r.jsx("p",{className:"text-[11px] text-gray-500 leading-snug flex-1",children:e.reason}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-3 pt-2 border-t border-white/60",children:[r.jsx("button",{className:"flex items-center gap-1 text-[10px] text-gray-500 hover:text-emerald-600 px-1.5 py-1 rounded-md hover:bg-white/80 transition-colors",title:"Relevant",children:r.jsx(qo,{className:"w-3.5 h-3.5"})}),r.jsx("button",{className:"flex items-center gap-1 text-[10px] text-gray-500 hover:text-red-500 px-1.5 py-1 rounded-md hover:bg-white/80 transition-colors",title:"Not relevant",children:r.jsx(hc,{className:"w-3.5 h-3.5"})}),r.jsx("button",{className:"flex items-center gap-1 text-[10px] text-gray-500 hover:text-indigo-600 px-1.5 py-1 rounded-md hover:bg-white/80 transition-colors",title:"Discuss with AI",children:r.jsx(Br,{className:"w-3.5 h-3.5"})}),r.jsxs("span",{className:"ml-auto text-[10px] font-semibold text-indigo-600 flex items-center gap-0.5 cursor-pointer hover:underline",children:["Explore ",r.jsx(en,{className:"w-3 h-3"})]})]})]},e.title))})]})}function IOe(){return r.jsxs("div",{className:"flex flex-col h-full gap-3 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx(Zo,{className:"w-4 h-4 text-emerald-500"}),r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:"Recommended Learning"}),r.jsx(Gr,{className:"ml-auto text-[10px] bg-emerald-100 text-emerald-700 border-0",children:"Suggestions"})]}),r.jsx(gW,{children:AOe.map((e,t)=>{const n={indigo:{bg:"bg-indigo-50",border:"border-indigo-100",title:"text-indigo-700",btn:"bg-indigo-600 hover:bg-indigo-700",tag:"bg-indigo-100 text-indigo-700"},violet:{bg:"bg-violet-50",border:"border-violet-100",title:"text-violet-700",btn:"bg-violet-600 hover:bg-violet-700",tag:"bg-violet-100 text-violet-700"},amber:{bg:"bg-amber-50",border:"border-amber-100",title:"text-amber-700",btn:"bg-amber-500 hover:bg-amber-600",tag:"bg-amber-100 text-amber-700"},emerald:{bg:"bg-emerald-50",border:"border-emerald-100",title:"text-emerald-700",btn:"bg-emerald-600 hover:bg-emerald-700",tag:"bg-emerald-100 text-emerald-700"}},s=n[e.color]||n.indigo;return r.jsxs("div",{className:`flex-shrink-0 w-56 rounded-xl border ${s.border} ${s.bg} p-3 flex flex-col gap-2`,children:[r.jsx("p",{className:`text-xs font-bold ${s.title}`,children:e.title}),r.jsx("p",{className:"text-[11px] text-gray-600 leading-snug flex-1",children:e.desc}),r.jsxs("div",{className:"flex items-center gap-2",children:[e.contentType&&r.jsx("span",{className:`text-[9px] font-bold px-2 py-0.5 rounded-full uppercase tracking-wide ${s.tag}`,children:e.contentType}),e.duration&&r.jsxs("span",{className:"text-[10px] text-gray-400 flex items-center gap-0.5",children:[r.jsx(ni,{className:"w-3 h-3"}),e.duration]})]}),e.tags&&r.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.map(a=>r.jsx("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full font-medium bg-white/70 text-gray-500 border border-gray-200",children:a},a))}),r.jsxs("div",{className:"flex gap-1.5 mt-1",children:[e.type==="content"&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:`flex items-center gap-1 text-[10px] font-semibold text-white px-2 py-1 rounded-md ${s.btn} transition-colors`,children:[r.jsx(rc,{className:"w-3 h-3"})," Learn"]}),r.jsxs("button",{className:"flex items-center gap-1 text-[10px] font-semibold text-gray-600 px-2 py-1 rounded-md bg-white border border-gray-200 hover:bg-gray-50 transition-colors",children:[r.jsx(Br,{className:"w-3 h-3"})," Ask AI"]})]}),e.type==="profile"&&r.jsxs("button",{className:`flex items-center gap-1 text-[10px] font-semibold text-white px-2 py-1 rounded-md ${s.btn} transition-colors`,children:[r.jsx(Ci,{className:"w-3 h-3"})," Update Profile"]}),e.type==="chat"&&r.jsxs("button",{className:`flex items-center gap-1 text-[10px] font-semibold text-white px-2 py-1 rounded-md ${s.btn} transition-colors`,children:[r.jsx(Br,{className:"w-3 h-3"})," Start Chat"]})]})]},t)})})]})}function ROe(){const[e,t]=h.useState(TOe),[n,s]=h.useState("");function a(){if(!n.trim())return;const i=n;t(o=>[...o,{role:"user",content:i}]),s(""),setTimeout(()=>{t(o=>[...o,{role:"assistant",content:"Based on your POCUS profile, that's a great area to explore. I can pull relevant modules from the Learning KB — shall I suggest a structured path for that topic?"}])},800)}return r.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 pb-3 border-b border-gray-100 shrink-0",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg bg-indigo-600 flex items-center justify-center",children:r.jsx(Vn,{className:"w-4 h-4 text-white"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-gray-800",children:"POCUS Learning Assistant"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Personalized to your profile"})]}),r.jsxs(Gr,{className:"ml-auto text-[10px] bg-emerald-100 text-emerald-700 border-0 flex items-center gap-1",children:[r.jsx(mr,{className:"w-2.5 h-2.5"})," Online"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto py-3 space-y-3 min-h-0",children:e.map((i,o)=>r.jsx("div",{className:`flex ${i.role==="user"?"justify-end":"justify-start"}`,children:r.jsx("div",{className:`max-w-[88%] rounded-2xl px-3.5 py-2.5 text-xs leading-relaxed
1072              ${i.role==="user"?"bg-indigo-600 text-white rounded-br-sm":"bg-gray-100 text-gray-800 rounded-bl-sm"}`,children:i.content})},o))}),r.jsx("div",{className:"flex gap-1.5 flex-wrap pb-2 shrink-0",children:["What should I learn next?","My lung US gaps","FAST exam tips"].map(i=>r.jsx("button",{onClick:()=>s(i),className:"text-[10px] px-2.5 py-1 rounded-full border border-indigo-200 text-indigo-600 hover:bg-indigo-50 transition-colors",children:i},i))}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[r.jsx(It,{value:n,onChange:i=>s(i.target.value),onKeyDown:i=>i.key==="Enter"&&a(),placeholder:"Ask your POCUS assistant...",className:"text-sm h-9"}),r.jsx(de,{size:"sm",onClick:a,disabled:!n.trim(),className:"bg-indigo-600 hover:bg-indigo-700 shrink-0 px-3",children:r.jsx(Fd,{className:"w-3.5 h-3.5"})})]})]})}function MOe(){return r.jsxs("div",{className:"flex flex-col bg-gray-50 overflow-hidden",style:{height:"calc(100vh - 48px)"},children:[r.jsxs("div",{className:"bg-white border-b px-6 py-3 flex items-center gap-3 shrink-0",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-indigo-600 flex items-center justify-center",children:r.jsx(ao,{className:"w-4 h-4 text-white"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-base font-bold text-gray-900",children:"My Learning Journey"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Personalized POCUS learning based on your profile"})]}),r.jsx(Gr,{className:"ml-auto text-xs bg-amber-100 text-amber-700 border-0 px-2.5",children:"✦ UX Prototype"})]}),r.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[r.jsxs("div",{className:"flex flex-col flex-1 min-w-0 divide-y divide-gray-100 overflow-hidden",children:[r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden p-4 bg-white",children:r.jsx(POe,{})}),r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden p-4 bg-white",children:r.jsx(OOe,{})}),r.jsx("div",{className:"flex-1 min-h-0 overflow-hidden p-4 bg-white",children:r.jsx(IOe,{})})]}),r.jsx("div",{className:"w-96 shrink-0 border-l border-gray-200 bg-white p-4 flex flex-col overflow-hidden",children:r.jsx(ROe,{})})]})]})}const DOe=["indigo","emerald","violet","amber","rose"],LOe={indigo:"bg-indigo-500",emerald:"bg-emerald-500",violet:"bg-violet-500",amber:"bg-amber-500",rose:"bg-rose-500"},$Oe=["QA","Assistant Knowledge","Learning Content"];function BOe(){const e=Ca(),[t,n]=h.useState({name:"",description:"",color:"indigo",type:"Assistant Knowledge",status:"inactive",icon_url:""}),[s,a]=h.useState(!1);async function i(){t.name.trim()&&(a(!0),await Y.entities.KnowledgeBase.create(t),e(yt("KnowledgeBases")))}return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:yt("KnowledgeBases"),children:r.jsxs(de,{variant:"ghost",size:"sm",className:"gap-1",children:[r.jsx(or,{className:"w-4 h-4"})," Back"]})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"New Knowledge Base"}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Store content your AI assistants can reference"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(wt,{to:yt("KnowledgeBases"),children:r.jsx(de,{variant:"outline",children:"Cancel"})}),r.jsxs(de,{onClick:i,disabled:!t.name.trim()||s,className:"gap-2",children:[s?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Ar,{className:"w-4 h-4"}),"Create"]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsx("div",{className:"max-w-2xl mx-auto",children:r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-5",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Icon"}),r.jsx(Pb,{value:t.icon_url,onChange:o=>n(l=>({...l,icon_url:o}))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Name *"}),r.jsx(It,{value:t.name,onChange:o=>n(l=>({...l,name:o.target.value})),placeholder:"Knowledge base name",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Description"}),r.jsx(rr,{value:t.description,onChange:o=>n(l=>({...l,description:o.target.value})),placeholder:"What this knowledge base contains...",className:"min-h-[80px]"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Type"}
1072),r.jsx("select",{value:t.type,onChange:o=>n(l=>({...l,type:o.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:$Oe.map(o=>r.jsx("option",{value:o,children:o},o))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-1 block",children:"Status"}),r.jsxs("select",{value:t.status,onChange:o=>n(l=>({...l,status:o.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"inactive",children:"Inactive"})]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-gray-500 mb-2 block",children:"Accent Color"}),r.jsx("div",{className:"flex gap-2",children:DOe.map(o=>r.jsx("button",{onClick:()=>n(l=>({...l,color:o})),className:`w-7 h-7 rounded-full transition-all ${LOe[o]} ${t.color===o?"ring-2 ring-offset-2 ring-gray-400 scale-110":"opacity-60 hover:opacity-100"}`},o))})]})]})})})]})}const FOe=[{title:"Test Sets",description:"Create and run semantic RAG test cases grouped into test sets. Validate that your knowledge base retrieves the right content.",icon:Fm,color:"bg-indigo-50 border-indigo-200",iconColor:"bg-indigo-100 text-indigo-600",page:"TestSets"},{title:"Embedding Tests",description:"Create HTML test pages with AI assistance to test how assistant landing pages embed via iframes, links, or other methods. Open them publicly at /testpage/:slug.",icon:O0,color:"bg-emerald-50 border-emerald-200",iconColor:"bg-emerald-100 text-emerald-600",page:"EmbeddingTests"},{title:"Vector Search",description:"Test Supabase vector storage: pick a chunk from your knowledge base, generate a Jina AI embedding, and insert it into the documents table.",icon:_n,color:"bg-cyan-50 border-cyan-200",iconColor:"bg-cyan-100 text-cyan-600",page:"VectorTrace"},{title:"Investigation Test",description:"Test investigation assistants in a split chat + debug view. Inspect raw responses and trace changes made to user profile objects in real time.",icon:ur,color:"bg-amber-50 border-amber-200",iconColor:"bg-amber-100 text-amber-600",page:"InvestigationTest"},{title:"Shell Test",description:"Manage shell hierarchy and test shell-based conversations with full CRUD controls, live chat, and routing debug info.",icon:Sa,color:"bg-indigo-50 border-indigo-200",iconColor:"bg-indigo-100 text-indigo-600",page:"ShellTest"},{title:"Assistant Prompt Test",description:"Trace how assistantPromptBuilder works step by step: load assistant config, run semantic search, assemble the prompt, and get the LLM answer.",icon:aZ,color:"bg-rose-50 border-rose-200",iconColor:"bg-rose-100 text-rose-600",page:"PromptTest"},{title:"Issue Reports",description:"Review and manage answer quality issues reported by users directly from the embedded chat. Track status from open to resolved.",icon:Nr,color:"bg-amber-50 border-amber-200",iconColor:"bg-amber-100 text-amber-600",page:"IssueReports"},{title:"Search Trace",description:"Trace and debug how queries are matched against your knowledge base. Inspect ranking and retrieval quality step by step.",icon:zn,color:"bg-violet-50 border-violet-200",iconColor:"bg-violet-100 text-violet-600",page:"SearchTrace"}];function zOe(){return r.jsxs("div",{className:"p-6 md:p-10 max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-10",children:[r.jsx("div",{className:"w-12 h-12 rounded-2xl bg-indigo-100 flex items-center justify-center",children:r.jsx(si,{className:"w-6 h-6 text-indigo-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Quality Assurance"}),r.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"Test and validate your RAG pipeline"})]})]}),r.jsx("div",{className:"grid gap-4",children:FOe.map(e=>r.jsx(wt,{to:yt(e.page),children:r.jsxs("div",{className:`border rounded-2xl p-6 flex items-center gap-5 hover:shadow-md transition-all cursor-pointer ${e.color}
1072`,children:[r.jsx("div",{className:`w-14 h-14 rounded-xl flex items-center justify-center shrink-0 ${e.iconColor}`,children:r.jsx(e.icon,{className:"w-7 h-7"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:e.title}),e.comingSoon&&r.jsx("span",{className:"text-xs font-medium bg-gray-100 text-gray-500 border border-gray-200 px-2 py-0.5 rounded-full",children:"Coming soon"})]}),r.jsx("p",{className:"text-sm text-gray-500 mt-1 leading-relaxed",children:e.description})]}),r.jsx(en,{className:"w-5 h-5 text-gray-400 shrink-0"})]})},e.page))})]})}function UOe({pages:e,loading:t,onNew:n,onEdit:s,onDelete:a,onClone:i}){return t?r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"w-8 h-8 border-4 border-slate-200 border-t-indigo-600 rounded-full animate-spin"})}):r.jsxs("div",{className:"p-6 md:p-10 max-w-4xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Embedding Tests"}),r.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"Create HTML test pages to test assistant embedding (iframes, links, etc.)"})]}),r.jsxs("button",{onClick:n,className:"flex items-center gap-2 text-sm bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 transition-colors shrink-0",children:[r.jsx(ln,{className:"w-4 h-4"})," New Test Page"]})]}),e.length===0?r.jsxs("div",{className:"text-center py-20",children:[r.jsx(O0,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),r.jsx("p",{className:"text-gray-400",children:"No test pages yet. Create one to get started."})]}):r.jsx("div",{className:"grid gap-3",children:e.map(o=>r.jsxs("div",{className:"border border-gray-200 rounded-xl p-4 flex items-center gap-4 hover:shadow-sm transition-all bg-white",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-indigo-50 flex items-center justify-center shrink-0",children:r.jsx(O0,{className:"w-5 h-5 text-indigo-600"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium text-gray-900 truncate",children:o.title}),r.jsxs("p",{className:"text-xs text-gray-400 truncate font-mono",children:["/testpage/",o.slug]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsx("a",{href:`${window.location.origin}/testpage/${o.slug}`,target:"_blank",rel:"noopener noreferrer",className:"p-2 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-colors",title:"Open in new tab",children:r.jsx(yr,{className:"w-4 h-4"})}),r.jsx("button",{onClick:()=>i(o),className:"p-2 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-colors",title:"Clone",children:r.jsx(ri,{className:"w-4 h-4"})}),r.jsx("button",{onClick:()=>s(o),className:"p-2 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-colors",title:"Edit",children:r.jsx(ra,{className:"w-4 h-4"})}),r.jsx("button",{onClick:()=>a(o),className:"p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",title:"Delete",children:r.jsx(un,{className:"w-4 h-4"})})]})]},o.id))})]})}function xW(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),a=Ca(),i=h.useCallback(async()=>{s(!0);try{const f=await Y.entities.EmbeddingTestPage.list("-updated_date",100);t(f)}catch(f){console.error(f)}finally{s(!1)}},[]);h.useEffect(()=>{i()},[i]);function o(){a("/EmbeddingTestEdit")}function l(f){a(`/EmbeddingTestEdit?id=${f.id}`)}async function c(f){if(confirm(`Delete "${f.title}"? This cannot be undone.`))try{await Y.entities.EmbeddingTestPage.delete(f.id),i()}catch(m){alert(m.message)}}async function d(f){const m=(f.slug||"page").replace(/-copy(-\d+)?$/,"");let g=`${m}-copy`,x=1;const j=new Set(e.map(b=>
1072b.slug).filter(Boolean));for(;j.has(g);)x+=1,g=`${m}-copy-${x}`;try{await Y.entities.EmbeddingTestPage.create({title:`${f.title||"Untitled"} (copy)`,slug:g,description:f.description||"",html_content:f.html_content||"",html_file_url:f.html_file_url||""}),i()}catch(b){alert(b.message)}}return r.jsx(UOe,{pages:e,loading:n,onNew:o,onEdit:l,onDelete:c,onClone:d})}const o0="w-full border rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-100 transition-all bg-white",qOe=[{key:"min_kb_score",label:"KB Min Score",pct:!0},{key:"min_item_score",label:"Item Min Score",pct:!0},{key:"min_chunk_score",label:"Chunk Min Score",pct:!0},{key:"early_exit_score",label:"Early Exit Score",pct:!0},{key:"max_items_per_kb",label:"Max Items / KB",pct:!1},{key:"max_chunks_per_item",label:"Max Chunks / Item",pct:!1},{key:"top_k",label:"Top K",pct:!1},{key:"max_stage3_llm_calls",label:"S3 LLM Calls",pct:!1},{key:"keyword_boost_kbs",label:"Boost KBs",bool:!0},{key:"keyword_boost_items",label:"Boost Items",bool:!0},{key:"use_summary_mode",label:"Summary Mode",bool:!0}];function KOe({key:e,pct:t,bool:n},s){return n?s?"on":"off":t?`${Math.round(s*100)}%`:(e==="max_chunks_per_item"||e==="max_stage3_llm_calls")&&s===0?"∞":s}function VOe({testCase:e,kbs:t,assistants:n=[],currentKbIds:s,currentAssistantId:a,currentThresholds:i,onSave:o,onClose:l}){var x,j,b;const[c,d]=h.useState({name:"",description:"",group:"",query:"",expected_top_title:"",knowledge_base_ids:(s==null?void 0:s.length)>0?s:(e==null?void 0:e.knowledge_base_ids)??[],assistant_id:a||(e==null?void 0:e.assistant_id)||"",thresholds:i||(e==null?void 0:e.thresholds)||null,...e,...(s==null?void 0:s.length)>0?{knowledge_base_ids:s}:{},...a?{assistant_id:a}:{},...i?{thresholds:i}:{}});function f(y,w){d(_=>({..._,[y]:w}))}const m=((x=c.name)==null?void 0:x.trim())&&((j=c.query)==null?void 0:j.trim()),g=!!(e!=null&&e.id);return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg max-h-[90vh] flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b bg-gray-50 rounded-t-2xl shrink-0",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-gray-900 text-sm",children:g?"Edit Test Case":"Save Test Case"}),r.jsx("p",{className:"text-[11px] text-gray-400 mt-0.5",children:"Captures current query, KBs, and thresholds"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(de,{variant:"outline",size:"sm",onClick:l,className:"gap-1.5 h-8 text-xs",children:[r.jsx(jt,{className:"w-3.5 h-3.5"})," Cancel"]}),r.jsxs(de,{size:"sm",onClick:()=>o(c),disabled:!m,className:"gap-1.5 h-8 text-xs bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(Ar,{className:"w-3.5 h-3.5"})," ",g?"Update":"Save"]})]})]}),r.jsxs("div",{className:"overflow-y-auto flex-1 px-5 py-4 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wide",children:"Name *"}),r.jsx("input",{className:o0,value:c.name||"",onChange:y=>f("name",y.target.value),placeholder:"e.g. Synonym dosage",autoFocus:!0})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("label",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wide flex items-center gap-1",children:[r.jsx(ac,{className:"w-3 h-3"})," Group"]}),r.jsx("input",{className:o0,value:c.group||"",onChange:y=>f("group",y.target.value),placeholder:"e.g. Medical"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wide",children:"Query *"}),r.jsx("input",{className:o0,value:c.query||"",onChange:y=>f("query",y.target.value),placeholder:"e.g. What is the dosage for ibuprofen?"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("label",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wide",children:["Expected Top Result ",r.jsx("span",{className:"text-gray-300 font-normal normal-case",children:"(optional)"})]}),r.jsx("input",{className:o0,value:c.expected_top_title||"",onChange:y=>f("expected_top_title",y.target.value),placeholder:"Title of KB item expected at #1"})]}),r.jsxs("div",{className:"border rounded-xl overflow-hidden bg-gray-50",children:[r.jsxs("div",{className:"px-4 py-2.5 border-b flex items-center gap-2",children:[r.jsx(s7,{className:"w-3.5 h-3.5 text-gray-400"}),r.jsx("p",{className:"text-xs font-semibold text-gray-600",children:"Saved Configuration Snapshot"}),r.jsx("span",{className:"text-[10px] text-gray-400 ml-auto",children:"from current panel"})]}),r.jsxs("div",{className:"px-4 py-3 space-y-3 bg-white",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(_n,{className:"w-3.5 h-3.5 text-indigo-400 shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide mb-1",children:"Knowledge Bases"}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[(c.knowledge_base_ids||[]).map(y=>{const w=t.find(_=>_.id===y);return w?r.jsx("span",{className:"text-xs bg-indigo-50 text-indigo-700 border border-indigo-200 rounded-full px-2 py-0.5",children:w.name},y):null}),(!c.knowledge_base_ids||c.knowledge_base_ids.length===0)&&r.jsx("span",{className:"text-xs text-gray-400 italic",children:"None selected"})]})]})]}),c.assistant_id&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Vn,{className:"w-3.5 h-3.5 text-violet-400 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide mb-1",children:"Assistant"}),r.jsx("span",{className:"text-xs bg-violet-50 text-violet-700 border border-violet-200 rounded-full px-2 py-0.5",children:((b=n.find(y=>y.id===c.assistant_id))==null?void 0:b.name)||c.assistant_id})]})]}),c.thresholds&&r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide mb-1.5",children:"Thresholds"}),r.jsx("div",{className:"grid grid-cols-3 gap-x-3 gap-y-1.5",children:qOe.map(y=>{const w=c.thresholds[y.key];return w==null?null:r.jsxs("div",{className:"bg-gray-50 border border-gray-100 rounded-lg px-2 py-1.5 text-center",children:[r.jsx("div",{className:"text-[9px] text-gray-400 font-medium uppercase tracking-wide truncate",children:y.label}),r.jsx("div",{className:"text-xs font-mono font-bold text-indigo-700 mt-0.5",children:KOe(y,w)})]},y.key)})})]})]})]})]})]})})}function Dv({score:e}){const t=Math.round((e||0)*100),n=t>=80?"bg-emerald-500":t>=50?"bg-amber-400":"bg-red-400";return r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"h-1.5 w-16 bg-gray-200 rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full ${n}`,style:{width:`${t}%`}})}),r.jsx("span",{className:`text-[10px] font-mono font-bold shrink-0 ${t>=80?"text-emerald-600":t>=50?"text-amber-600":"text-red-500"}`,children:(e||0).toFixed(2)})]})}function _r({label:e,color:t="gray"}){const n={gray:"bg-gray-100 text-gray-500 border-gray-200",indigo:"bg-indigo-100 text-indigo-700 border-indigo-200",emerald:"bg-emerald-100 text-emerald-700 border-emerald-200",amber:"bg-amber-100 text-amber-700 border-amber-200",violet:"bg-violet-100 text-violet-700 border-violet-200",red:"bg-red-100 text-red-600 border-red-200"};return r.jsx("span",{className:`inline-flex items-center text-[10px] font-semibold border rounded-full px-2 py-0.5 ${n[t]}`,children:e})}function HOe({ms:e}){return e?r.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-mono font-semibold bg-indigo-50 text-indigo-600 border border-indigo-100 rounded-full px-2 py-0.5",children:[r.jsx(ni,{className:"w-2.5 h-2.5"})," ",(e/1e3).toFixed(2),"s"]}):null}function s3({label:e="Raw Response",content:t}){const[n,s]=h.useState(!1);return r.jsxs("div",{className:"border rounded-lg overflow-hidden text-xs",children:[r.jsxs("button",{onClick:()=>s(a=>!a),className:"w-full flex items-center gap-2 px-3 py-2 bg-gray-100 hover:bg-gray-200 text-left transition-colors",children:[n?r.jsx(gt,{className:"w-3 h-3 text-gray-400"}):r.jsx(en,{className:"w-3 h-3 text-gray-400"}),r.jsx("span",{className:"font-semibold text-gray-600",children:e})]}),n&&r.jsx("pre",{className:"bg-gray-950 text-emerald-300 text-[10px] font-mono p-3 overflow-auto max-h-80 whitespace-pre-wrap leading-relaxed",children:JSON.stringify(t,null,2)})]})}function a3({callLog:e}){if(!(e!=null&&e.length))return null;const t=e.reduce((n,s)=>n+(s.duration_ms??0),0);return r.jsxs("div",{className:"border rounded-xl overflow-hidden text-xs",children:[r.jsxs("div",{className:"px-3 py-2 bg-gray-100 text-[10px] font-semibold text-gray-500 uppercase tracking-wide flex items-center gap-2",children:[r.jsx(zn,{className:"w-3 h-3"})," LLM Calls (",e.length,") — total active: ",t,"ms"]}),e.map((n,s)=>{const a=e[s+1],i=a!=null?a.at_ms-(n.at_ms+(n.duration_ms??0)):null;return r.jsxs("div",{className:`grid grid-cols-[24px_1fr_55px_55px_55px] gap-2 px-3 py-2 border-t border-gray-100 items-center ${n.success?s%2===0?"bg-white":"bg-gray-50/50":"bg-red-50"}`,children:[r.jsx("div",{className:`w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-bold text-white shrink-0 ${n.stage===1?"bg-emerald-500":n.stage===2?"bg-indigo-500":"bg-violet-500"}`,children:s+1}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold text-gray-700 truncate",children:n.stage_name||`Stage ${n.stage}`}),n.error&&r.jsxs("div",{className:"text-[10px] text-red-500 truncate",children:["✗ ",n.error]}),n.prompt_pct_of_window&&r.jsxs("div",{className:"text-[10px] text-gray-400 font-mono",children:[n.items_sent," items · ",n.prompt_pct_of_window," of ctx window"]})]}),r.jsxs("div",{className:"text-right font-mono text-gray-400 text-[10px]",children:["+",n.at_ms,"ms"]}),r.jsx("div",{className:`text-right font-mono font-semibold text-[10px] ${n.success?"text-emerald-600":"text-red-500"}`,children:n.duration_ms!=null?`${n.duration_ms}ms`:"—"}),r.jsx("div",{className:`text-right font-mono text-[10px] ${i!=null&&i>1e3?"text-amber-600 font-semibold":"text-gray-300"}`,children:i!=null?`${i}ms↓`:"—"})]},s)})]})}function wk({number:e,icon:t,label:n,sublabel:s,status:a,onRun:i,disabled:o,timing:l,children:c}){const d=t,[f,m]=h.useState(!1),g={idle:"border-gray-200",running:"border-indigo-300",done:"border-emerald-400",error:"border-red-300"}[a],x={idle:"bg-white",running:"bg-indigo-50",done:"bg-emerald-50",error:"bg-red-50"}[a],j={idle:"bg-gray-200 text-gray-400",running:"bg-indigo-500 text-white",done:"bg-emerald-500 text-white",error:"bg-red-400 text-white"}[a],b=a==="done"&&c;return r.jsxs("div",{className:`border-2 rounded-2xl overflow-hidden transition-all duration-200 ${g} ${x}`,children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 ${j}`,children:a==="running"?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):e}),d&&r.jsx(d,{className:`w-4 h-4 shrink-0 ${a==="done"?"text-emerald-500":a==="running"?"text-indigo-400":"text-gray-300"}`}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-semibold text-sm text-gray-800",children:n}),s&&r.jsx("div",{className:"text-xs text-gray-400",children:s})]}),a==="done"&&r.jsx(mr,{className:"w-4 h-4 text-emerald-500 shrink-0"}),a==="error"&&r.jsx(Nr,{className:"w-4 h-4 text-red-400 shrink-0"}),l&&r.jsx(HOe,{ms:l}),b&&r.jsx("button",{onClick:()=>m(y=>!y),className:"text-gray-400 hover:text-gray-600 shrink-0",children:f?r.jsx(en,{className:"w-4 h-4"}):r.jsx(gt,{className:"w-4 h-4"})}),r.jsxs(de,{size:"sm",variant:a==="done"?"outline":"default",onClick:i,disabled:o||a==="running",className:"shrink-0 gap-1.5 h-7 text-xs",children:[a==="running"?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(Bo,{className:"w-3 h-3"}),a==="done"?"Re-run":"Run"]})]}),(a==="running"||a==="done"&&!f||a==="error")&&c&&r.jsx("div",{className:"border-t px-4 py-3 space-y-3",children:c})]})}function WOe({result:e,kbs:t}){var d,f,m,g;const n=((d=e==null?void 0:e.debug)==null?void 0:d.stage1_kbs)||[],s=((f=e==null?void 0:e.debug)==null?void 0:f.stage_timings)||{},a=((m=e==null?void 0:e.debug)==null?void 0:m.llm_call_log)||[],i=((g=e==null?void 0:e.debug)==null?void 0:g.rate_limit_retries)||[],o=(e==null?void 0:e.selectedKbIds)||[],l=n.filter(x=>!x.has_summary),c=n.length>0&&n.every(x=>!x.has_summary);return r.jsxs("div",{className:"space-y-3",children:[c&&r.jsxs("div",{className:"flex items-start gap-2 bg-amber-50 border border-amber-300 rounded-xl px-3 py-2.5 text-xs text-amber-800",children:[r.jsx(Nr,{className:"w-4 h-4 shrink-0 mt-0.5 text-amber-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"All KBs are missing summaries — no LLM ranking was performed."}),r.jsxs("p",{className:"mt-0.5 text-amber-700",children:["Go to ",r.jsx("strong",{children:"Knowledge Bases"})," → select each KB → click ",r.jsx("strong",{children:'"Summarize KB"'})," to generate summaries. Without summaries, Stage 1 cannot score any KB and nothing will be selected."]})]})]}),!c&&l.length>0&&r.jsxs("div",{className:"flex items-start gap-2 bg-amber-50 border border-amber-200 rounded-xl px-3 py-2.5 text-xs text-amber-700",children:[r.jsx(Nr,{className:"w-3.5 h-3.5 shrink-0 mt-0.5 text-amber-400"}),r.jsxs("p",{children:[r.jsxs("strong",{children:[l.length," KB",l.length>
10721?"s":""]})," (",l.map(x=>x.name).join(", "),") have no summary and were skipped from LLM ranking."]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(_r,{label:`${o.length} KBs selected`,color:"emerald"}),r.jsx(_r,{label:`${t.length-o.length} skipped`,color:"gray"}),s.stage1_duration_ms&&r.jsx(_r,{label:`LLM: ${s.stage1_duration_ms}ms`,color:"indigo"}),r.jsx(_r,{label:`${a.length} LLM call${a.length!==1?"s":""}`,color:"violet"})]}),r.jsxs("div",{className:"space-y-1.5",children:[n.map(x=>r.jsx(GOe,{kb:x},x.id)),n.length===0&&t.map(x=>{var y,w;const j=(w=(y=e==null?void 0:e.stage_result)==null?void 0:y.scores)==null?void 0:w[x.id],b=o.includes(x.id);return r.jsxs("div",{className:`flex items-center gap-2 text-xs px-3 py-1.5 rounded-lg border ${b?"bg-emerald-50 border-emerald-200":"bg-gray-50 border-gray-200 opacity-60"}`,children:[r.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${b?"bg-emerald-500":"bg-gray-300"}`}),r.jsx("span",{className:"font-medium flex-1 truncate",children:x.name}),j!=null&&r.jsx(Dv,{score:j})]},x.id)})]}),r.jsx(a3,{callLog:a}),i.length>0&&r.jsxs("div",{className:"border border-amber-200 bg-amber-50 rounded-xl p-3 space-y-1",children:[r.jsxs("p",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wide flex items-center gap-1.5",children:[r.jsx(Nr,{className:"w-3 h-3"})," ",i.length," rate-limit ",i.length===1?"retry":"retries"]}),i.map((x,j)=>r.jsxs("div",{className:"text-[10px] font-mono bg-white border border-amber-200 rounded px-2 py-1 text-amber-700",children:[x.call," · attempt ",x.attempt," · waited ",x.delay_ms,"ms · +",x.at_ms,"ms ",x.fatal&&"· FATAL"]},j))]}),r.jsx(s3,{label:"Raw semanticSearch stage=1 response",content:e})]})}function GOe({kb:e}){const[t,n]=h.useState(!1),{name:s,score:a,reason:i,selected:o,boosted:l,boost_keywords:c=[],has_summary:d,semantic_summary:f,human_summary:m}=e;return r.jsxs("div",{className:`border rounded-xl overflow-hidden text-xs ${o?"border-emerald-200 bg-emerald-50":"border-gray-200 bg-gray-50 opacity-60"}`,children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[r.jsx(_n,{className:`w-3 h-3 shrink-0 ${o?"text-emerald-500":"text-gray-300"}`}),r.jsx("span",{className:`font-medium flex-1 truncate ${o?"text-gray-800":"line-through text-gray-400"}`,children:s}),a!=null&&r.jsx(Dv,{score:a}),o&&(l?r.jsx(_r,{label:"⚡ keyword",color:"amber"}):r.jsx(_r,{label:"🧠 LLM",color:"emerald"})),!o&&r.jsx(_r,{label:"skipped",color:"gray"}),!d&&r.jsx(_r,{label:"no summary",color:"amber"}),r.jsx("button",{onClick:()=>n(g=>!g),className:"text-gray-300 hover:text-indigo-400",children:t?r.jsx($m,{className:"w-3 h-3"}):r.jsx(Ts,{className:"w-3 h-3"})})]}),t&&r.jsxs("div",{className:"border-t px-3 py-2.5 bg-white space-y-2",children:[i&&r.jsxs("div",{className:`text-xs rounded px-2 py-1.5 border ${o?"bg-emerald-50 border-emerald-200 text-emerald-700":"bg-gray-50 border-gray-200 text-gray-500"}`,children:[r.jsx("span",{className:"font-semibold",children:"LLM reason:"})," ",i]}),l&&c.length>0&&r.jsxs("div",{className:"text-xs bg-amber-50 border border-amber-200 text-amber-700 rounded px-2 py-1.5",children:[r.jsx("span",{className:"font-semibold",children:"Keyword boost:"})," ",c.map(g=>r.jsx("code",{className:"mx-0.5 bg-amber-100 px-1 rounded",children:g},g))]}),f&&r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded p-2",children:[r.jsx("p",{className:"text-[10px] font-semibold text-violet-500 mb-0.5",children:"Semantic Summary"}),r.jsx("p",{className:"text-gray-600 text-[11px]",children:f})]}),m&&r.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded p-2",children:[r.jsx("p",{className:"text-[10px] font-semibold text-blue-500 mb-0.5",children:"Human Summary"}),r.jsx("p",{className:"text-gray-600 text-[11px]",children:m})]})]})]})}function YOe({result:e}){var m,g,x,j;const[t,n]=h.useState("all"),s=((m=e==null?void 0:e.debug)==null?void 0:m.stage2_items)||[],a=((g=e==null?void 0:e.debug)==null?void 0:g.stage_timings)||{},i=((x=e==null?void 0:e.debug)==null?void 0:x.llm_call_log)||[],o=((j=e==null?void 0:e.debug)==null?void 0:j.rate_limit_retries)||[],l=(e==null?void 0:e.selectedItemIds)||[],c=s.filter(b=>t==="selected"?b.selected:t==="skipped"?!b.selected:!0),d={};for(const b of c){const y=b.kb_name||"Unknown";d[y]||(d[y]=[]),d[y].push(b)}const f=b=>`text-[10px] px-2 py-0.5 rounded-lg border font-semibold transition-colors ${t===b?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300"}`;return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(_r,{label:`${l.length} items selected`,color:"indigo"}),r.jsx(_r,{label:`${s.length-l.length} skipped`,color:"gray"}),a.stage2_duration_ms&&r.jsx(_r,{label:`LLM: ${a.stage2_duration_ms}ms`,color:"indigo"}),r.jsx(_r,{label:`${i.length} LLM call${i.length!==1?"s":""}`,color:"violet"})]}),r.jsxs("div",{className:"flex gap-1.5 flex-wrap items-center",children:[r.jsx("span",{className:"text-[10px] text-gray-400 font-semibold",children:"Show:"}),r.jsxs("button",{className:f("all"),onClick:()=>n("all"),children:["All (",s.length,")"]}),r.jsxs("button",{className:f("selected"),onClick:()=>n("selected"),children:["Selected (",l.length,")"]}),r.jsxs("button",{className:f("skipped"),onClick:()=>n("skipped"),children:["Skipped (",s.length-l.length,")"]})]}),r.jsxs("div",{className:"space-y-3",children:[Object.entries(d).map(([b,y])=>r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[r.jsx(_n,{className:"w-3 h-3 text-indigo-400"}),r.jsx("span",{className:"text-[11px] font-semibold text-indigo-600 uppercase tracking-wide",children:b}),r.jsxs("span",{className:"text-[10px] text-gray-400",children:["(",y.length,")"]})]}),r.jsx("div",{className:"space-y-1 pl-3 border-l-2 border-indigo-100",children:y.map(w=>r.jsx(JOe,{item:w},w.id))})]},b)),c.length===0&&r.jsx("p",{className:"text-xs text-gray-400 italic text-center py-2",children:"No items in this group."})]}),r.jsx(a3,{callLog:i}),o.length>0&&r.jsxs("div",{className:"border border-amber-200 bg-amber-50 rounded-xl p-3 space-y-1",children:[r.jsxs("p",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wide flex items-center gap-1.5",children:[r.jsx(Nr,{className:"w-3 h-3"})," ",o.length," rate-limit retries"]}),o.map((b,y)=>r.jsxs("div",{className:"text-[10px] font-mono bg-white border border-amber-200 rounded px-2 py-1 text-amber-700",children:[b.call," · attempt ",b.attempt," · waited ",b.delay_ms,"ms · +",b.at_ms,"ms ",b.fatal&&"· FATAL"]},y))]}),r.jsx(s3,{label:"Raw semanticSearch stage=2 response",content:e})]})}function JOe({item:e}){const[t,n]=h.useState(!1),{title:s,kb_name:a,score:i,reason:o,selected:l,boosted:c,boost_keywords:d=[],has_summary:f,semantic_summary:m,human_summary:g}=e;return r.jsxs("div",{className:`border rounded-xl overflow-hidden text-xs ${l?"border-indigo-200 bg-indigo-50":"border-gray-200 bg-gray-50 opacity-60"}`,children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[r.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${l?"bg-indigo-500":"bg-gray-300"}`}),r.jsx("span",{className:`font-medium flex-1 truncate ${l?"text-gray-800":"line-through text-gray-400"}`,children:s}),i!=null&&r.jsx(Dv,{score:i}),l&&(c?r.jsx(_r,{label:"⚡ keyword",color:"amber"}):r.jsx(_r,{label:"🧠 LLM",color:"indigo"})),!l&&r.jsx(_r,{label:"skipped",color:"gray"}),!f&&r.jsx(_r,{label:"no summary",color:"amber"}),r.jsx("button",{onClick:()=>n(x=>!x),className:"text-gray-300 hover:text-indigo-400",children:t?r.jsx($m,{className:"w-3 h-3"}):r.jsx(Ts,{className:"w-3 h-3"})})]}),t&&r.jsxs("div",{className:"border-t px-3 py-2.5 bg-white space-y-2",children:[o&&r.jsxs("div",{className:`text-xs rounded px-2 py-1.5 border ${l?"bg-indigo-50 border-indigo-200 text-indigo-700":"bg-gray-50 border-gray-200 text-gray-500"}`,children:[r.jsx("span",{className:"font-semibold",children:"LLM reason:"})," ",o]}),c&&d.length>0&&r.jsxs("div",{className:"text-xs bg-amber-50 border border-amber-200 text-amber-700 rounded px-2 py-1.5",children:[r.jsx("span",{className:"font-semibold",children:"Keyword boost:"})," ",d.map(x=>r.jsx("code",{className:"mx-0.5 bg-amber-100 px-1 rounded",children:x},x))]}),m&&r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded p-2",children:[r.jsx("p",{className:"text-[10px] font-semibold text-violet-500 mb-0.5",children:"Semantic Summary"}),r.jsx("p",{className:"text-gray-600 text-[11px]",children:m})]}),g&&r.jsxs("div",{className:"bg-blue-50 border border-blue-100 rounded p-2",children:[r.jsx("p",{className:"text-[10px] font-semibold text-blue-500 mb-0.5",children:"Human Summary"}),r.jsx("p",{className:"text-gray-600 text-[11px]",children:g})]})]})]})}function QOe({result:e}){var o,l,c,d,f,m,g;const t=((o=e==null?void 0:e.debug)==null?void 0:o.stage3_chunks)||((l=e==null?void 0:e.stage_result)==null?void 0:l.scored)||[],n=((c=e==null?void 0:e.debug)==null?void 0:c.stage3_stats)||((d=e==null?void 0:e.stage_result)==null?void 0:d.stats)||null,s=((f=e==null?void 0:e.debug)==null?void 0:f.stage_timings)||{},a=((m=e==null?void 0:e.debug)==null?void 0:m.llm_call_log)||[],i=((g=e==null?void 0:e.debug)==null?void 0:g.rate_limit_retries)||[];return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(_r,{label:`${t.length} chunks ranked`,color:"violet"}),(n==null?void 0:n.total_chunks_in_pool)!=null&&r.jsx(_r,{label:`pool: ${n.total_chunks_in_pool}`,color:"gray"}),(n==null?void 0:n.llm_batches_used)!=null&&r.jsx(_r,{label:`${n.llm_batches_used}/${n.llm_batches_total} batches`,color:"indigo"}),s.stage3_duration_ms&&r.jsx(_r,{label:`LLM: ${s.stage3_duration_ms}ms`,color:"indigo"}),r.jsx(_r,{label:`${a.length} LLM call${a.length!==1?"s":""}`,color:"violet"})]}
1072),n&&r.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-5 gap-2 bg-gray-50 border rounded-xl p-3",children:[{label:"Pool",value:n.total_chunks_in_pool,hint:"Total candidate chunks"},{label:"LLM scored",value:n.chunks_ranked_by_llm,hint:"Scored by LLM"},{label:"Batches",value:`${n.llm_batches_used}/${n.llm_batches_total}`,hint:"LLM batches used/total"},{label:"Skipped",value:n.chunks_skipped_by_limit??0,hint:"Skipped by LLM call limit"},{label:"Filtered",value:n.chunks_filtered_out,hint:"Removed by min_chunk_score"},{label:"Final ctx",value:n.chunks_in_final_context,hint:"In final context"},{label:"Items",value:n.items_represented??"—",hint:"Distinct items"},{label:"KBs",value:n.kbs_represented??"—",hint:"Distinct KBs"},{label:"Top score",value:n.top_score!=null?n.top_score.toFixed(2):"—",hint:"Best chunk score"},{label:"Avg score",value:n.avg_score!=null?n.avg_score.toFixed(2):"—",hint:"Average chunk score"}].map(({label:x,value:j,hint:b})=>r.jsxs("div",{className:"text-center",title:b,children:[r.jsx("div",{className:"text-[9px] text-gray-400 font-medium uppercase tracking-wide",children:x}),r.jsx("div",{className:"text-sm font-bold text-gray-800 mt-0.5",children:j})]},x))}),((n==null?void 0:n.kb_distribution_in_pool)||(n==null?void 0:n.kb_distribution_final))&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-3 space-y-1.5",children:[r.jsx("p",{className:"text-[10px] font-semibold text-indigo-600 uppercase tracking-wide",children:"KB Distribution"}),r.jsx("div",{className:"flex flex-wrap gap-x-6 gap-y-1.5",children:Object.entries(n.kb_distribution_in_pool||{}).map(([x,j])=>{const b=(n.kb_distribution_final||{})[x]||0;return r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsx("span",{className:"font-semibold text-indigo-700 truncate max-w-[140px]",children:x}),r.jsxs("span",{className:"font-mono text-indigo-400",children:[j," pool"]}),r.jsx("span",{className:"text-gray-300",children:"→"}),r.jsxs("span",{className:`font-mono font-bold ${b>0?"text-emerald-600":"text-gray-400"}`,children:[b," ctx"]})]},x)})})]}),r.jsx("div",{className:"space-y-1.5",children:t.map((x,j)=>r.jsx(XOe,{chunk:x,rank:j+1},x.id+j))}),r.jsx(a3,{callLog:a}),i.length>0&&r.jsxs("div",{className:"border border-amber-200 bg-amber-50 rounded-xl p-3 space-y-1",children:[r.jsxs("p",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wide flex items-center gap-1.5",children:[r.jsx(Nr,{className:"w-3 h-3"})," ",i.length," rate-limit retries"]}),i.map((x,j)=>r.jsxs("div",{className:"text-[10px] font-mono bg-white border border-amber-200 rounded px-2 py-1 text-amber-700",children:[x.call," · attempt ",x.attempt," · waited ",x.delay_ms,"ms ",x.fatal&&"· FATAL"]},j))]}),r.jsx(s3,{label:"Raw semanticSearch stage=3 response",content:e})]})}function XOe({chunk:e,rank:t}){var i,o,l;const[n,s]=h.useState(!1),a=t<=3;return r.jsxs("div",{className:`border rounded-xl overflow-hidden text-xs ${a?"border-violet-200 bg-violet-50":"border-gray-200 bg-white"}`,children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[r.jsx("div",{className:`w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 ${a?"bg-violet-500 text-white":"bg-gray-200 text-gray-500"}`,children:t}),r.jsx(ys,{className:"w-3 h-3 text-gray-300 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[e.kb_name&&r.jsx("span",{className:"text-[10px] text-violet-500 font-semibold shrink-0",children:e.kb_name}),e.kb_name&&r.jsx("span",{className:"text-gray-300 shrink-0",children:"·"}),r.jsx("span",{className:"font-medium text-gray-800 truncate",children:e.title}),e.chunk_index!=null&&r.jsxs("span",{className:"text-[10px] text-gray-400 font-mono shrink-0",children:["#",e.chunk_index]})]}),r.jsx(Dv,{score:e.score})]}),((i=e.keyword_matches)==null?void 0:i.length)>0&&r.jsx(_r,{label:"⚡ kw",color:"amber"}),r.jsx("button",{onClick:()=>s(c=>!c),className:"text-gray-300 hover:text-indigo-400",children:n?r.jsx($m,{className:"w-3 h-3"}):r.jsx(Ts,{className:"w-3 h-3"})})]}),n&&r.jsxs("div",{className:"border-t px-3 py-2.5 bg-white space-y-2",children:[e.reason&&r.jsxs("div",{className:"text-xs bg-indigo-50 border border-indigo-200 text-indigo-700 rounded px-2 py-1.5",children:[r.jsx("span",{className:"font-semibold",children:"LLM reason:"})," ",e.reason]}),((o=e.keyword_matches)==null?void 0:o.length)>0&&r.jsxs("div",{className:"text-xs bg-amber-50 border border-amber-200 text-amber-700 rounded px-2 py-1.5",children:[r.jsx("span",{className:"font-semibold",children:"Keyword matches:"})," ",e.keyword_matches.map(c=>r.jsx("code",{className:"mx-0.5 bg-amber-100 px-1 rounded",children:c},c))]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] text-gray-500 bg-gray-50 rounded p-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:"Score:"})," ",(l=e.score)==null?void 0:l.toFixed(3)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:"Chunk #:"})," ",e.chunk_index??"—"]}
1072),r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:"KB:"})," ",e.kb_name||"—"]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:"Item ID:"})," ",r.jsxs("span",{className:"font-mono",children:[(e.knowledge_item_id||"—").slice(0,8),"…"]})]})]}),r.jsx("pre",{className:"text-[11px] text-gray-600 bg-gray-50 rounded p-2 max-h-40 overflow-auto whitespace-pre-wrap",children:e.content||"(no content)"}),e.url&&r.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-indigo-500 underline truncate block",children:e.url})]})]})}function ZOe({query:e,kbIds:t,thresholds:n,kbs:s,context:a}){var q,F,U,ee,ne,X;const[i,o]=h.useState(!0),[l,c]=h.useState("idle"),[d,f]=h.useState(null),[m,g]=h.useState(null),[x,j]=h.useState(null),[b,y]=h.useState("idle"),[w,_]=h.useState(null),[N,C]=h.useState(null),[k,S]=h.useState(null),[A,T]=h.useState("idle"),[R,B]=h.useState(null),[D,P]=h.useState(null),[I,z]=h.useState(null);function L(){return{query:e,knowledge_base_ids:t,top_k:n.top_k,min_chunk_score:n.min_chunk_score,min_kb_score:n.min_kb_score,min_item_score:n.min_item_score,max_items_per_kb:n.max_items_per_kb,max_chunks_per_item:n.max_chunks_per_item,early_exit_score:n.early_exit_score,max_context_items:n.top_k,keyword_boost_kbs:n.keyword_boost_kbs,keyword_boost_items:n.keyword_boost_items,max_stage3_llm_calls:n.max_stage3_llm_calls,use_summary_mode:n.use_summary_mode,caller:"SearchTrace/StepMode",context:a||"",debug_mode:i}}async function H(){var Z,ce;if(l==="running")return;c("running"),g(null),y("idle"),_(null),T("idle"),B(null);const ie=Date.now();try{const le=await Y.functions.invoke("semanticSearch",{...L(),stage:1});j(Date.now()-ie);const re=le==null?void 0:le.data;if(re!=null&&re.error)throw new Error(re.error);f(re),c("done")}catch(le){const re=((ce=(Z=le==null?void 0:le.response)==null?void 0:Z.data)==null?void 0:ce.error)||le.message;g(re),c("error"),j(Date.now()-ie)}}async function W(){var Z,ce;if(!d||b==="running")return;y("running"),C(null),T("idle"),B(null);const ie=Date.now();try{const le=await Y.functions.invoke("semanticSearch",{...L(),stage:2,s1_result:d.stage_result});S(Date.now()-ie);const re=le==null?void 0:le.data;if(re!=null&&re.error)throw new Error(re.error);_(re),y("done")}catch(le){const re=((ce=(Z=le==null?void 0:le.response)==null?void 0:Z.data)==null?void 0:ce.error)||le.message;C(re),y("error"),S(Date.now()-ie)}}async function V(){var Z,ce;if(!w||A==="running")return;T("running"),P(null);const ie=Date.now();try{const le=await Y.functions.invoke("semanticSearch",{...L(),stage:3,s1_result:d.stage_result,s2_result:w.stage_result});z(Date.now()-ie);const re=le==null?void 0:le.data;if(re!=null&&re.error)throw new Error(re.error);B(re),T("done")}catch(le){const re=((ce=(Z=le==null?void 0:le.response)==null?void 0:Z.data)==null?void 0:ce.error)||le.message;P(re),T("error"),z(Date.now()-ie)}}const K=e.trim()&&t.length>0,M=l==="done"&&(((q=d==null?void 0:d.selectedKbIds)==null?void 0:q.length)??0)>0,G=b==="done"&&(((F=w==null?void 0:w.selectedItemIds)==null?void 0:F.length)??0)>0;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Debug mode"}),r.jsx("button",{onClick:()=>o(ie=>!ie),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${i?"bg-indigo-600":"bg-gray-200"}`,children:r.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white shadow transition-transform ${i?"translate-x-4.5":"translate-x-0.5"}`})})]}),r.jsxs(wk,{number:"1",icon:_n,label:"Stage 1 — KB Ranking",sublabel:`Score ${s.filter(ie=>t.includes(ie.id)).length} KBs against the query`,status:l,onRun:H,disabled:!K,timing:x,children:[m&&r.jsxs("p",{className:"text-xs text-red-600 font-mono bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:["✗ ",m]}),d&&r.jsx(WOe,{result:d,kbs:s.filter(ie=>t.includes(ie.id))})]}),r.jsxs("div",{className:"flex items-center gap-2 px-4",children:[r.jsx("div",{className:"flex-1 h-px bg-gray-200"}),M?r.jsxs("span",{className:"text-[10px] text-emerald-600 font-semibold bg-emerald-50 border border-emerald-200 rounded-full px-2 py-0.5",children:[(U=d==null?void 0:d.selectedKbIds)==null?void 0:U.length," KBs → Stage 2"]}):r.jsx("span",{className:"text-[10px] text-gray-400 font-semibold bg-gray-50 border border-gray-200 rounded-full px-2 py-0.5",children:"Run Stage 1 first"}),r.jsx("div",{className:"flex-1 h-px bg-gray-200"})]}),r.jsxs(wk,{number:"2",icon:ao,label:"Stage 2 — Item Ranking",sublabel:M?`Rank items from ${(ee=d==null?void 0:d.selectedKbIds)==null?void 0:ee.length} selected KBs`:"Requires Stage 1 results",status:b,onRun:W,disabled:!M,timing:k,children:[N&&r.jsxs("p",{className:"text-xs text-red-600 font-mono bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:["✗ ",N]}),w&&r.jsx(YOe,{result:w})]}),r.jsxs("div",{className:"flex items-center gap-2 px-4",children:[r.jsx("div",{className:"flex-1 h-px bg-gray-200"}),G?r.jsxs("span",{className:"text-[10px] text-emerald-600 font-semibold bg-emerald-50 border border-emerald-200 rounded-full px-2 py-0.5",children:[(ne=w==null?void 0:w.selectedItemIds)==null?void 0:ne.length," items → Stage 3"]}):r.jsx("span",{className:"text-[10px] text-gray-400 font-semibold bg-gray-50 border border-gray-200 rounded-full px-2 py-0.5",children:"Run Stage 2 first"}),r.jsx("div",{className:"flex-1 h-px bg-gray-200"})]}),r.jsxs(wk,{number:"3",icon:Sa,label:"Stage 3 — Chunk Ranking",sublabel:G?`Fetch & rank chunks from ${(X=w==null?void 0:w.selectedItemIds)==null?void 0:X.length} items`:"Requires Stage 2 results",status:A,onRun:V,disabled:!G,timing:I,children:[D&&r.jsxs("p",{className:"text-xs text-red-600 font-mono bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:["✗ ",D]}),R&&r.jsx(QOe,{result:R})]})]})}function e4e({score:e,size:t="md"}){const n=Math.round((e||0)*100),s=n>=80?"bg-emerald-500":n>=50?"bg-amber-400":"bg-red-400";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`bg-gray-200 rounded-full overflow-hidden ${t==="sm"?"h-1 w-16":"h-1.5 flex-1"}`,children:r.jsx("div",{className:`h-full rounded-full ${s}`,style:{width:`${n}%`}})}),r.jsx("span",{className:`font-mono font-semibold shrink-0 ${t==="sm"?"text-[10px]":"text-xs"} ${n>=80?"text-emerald-600":n>=50?"text-amber-600":"text-red-500"}`,children:(e||0).toFixed(2)})]})}function ed({label:e,count:t,color:n="indigo"}){const s={indigo:"bg-indigo-100 text-indigo-700 border-indigo-200",emerald:"bg-emerald-100 text-emerald-700 border-emerald-200",amber:"bg-amber-100 text-amber-700 border-amber-200",gray:"bg-gray-100 text-gray-500 border-gray-200",violet:"bg-violet-100 text-violet-700 border-violet-200"};return r.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-semibold border rounded-full px-2 py-0.5 ${s[n]}`,children:[e,t!=null&&r.jsxs("span",{className:"font-mono",children:["(",t,")"]})]})}function Eu({title:e,defaultOpen:t=!1,children:n,badge:s}){const[a,i]=h.useState(t);return r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("button",{onClick:()=>i(o=>!o),className:"w-full flex items-center gap-2 px-3 py-2.5 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[a?r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}):r.jsx(en,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsx("span",{className:"text-xs font-semibold text-gray-600 flex-1",children:e}),s]}),a&&r.jsx("div",{className:"border-t",children:n})]})}function BB({content:e}){return r.jsx("pre",{className:"bg-gray-950 text-emerald-300 text-[10px] font-mono p-3 overflow-auto max-h-64 whitespace-pre-wrap leading-relaxed",children:typeof e=="string"?e:JSON.stringify(e,null,2)})}function t4e({itemDebug:e,rank:t}){const[n,s]=h.useState(!1);if(!e)return r.jsx("div",{className:"text-xs text-red-500",children:"Error: Item data missing"});const a=e.title||e.item_title,i=e.kb_name,o=e.score,l=e.reason,c=e.selected,d=e.boosted,f=e.boost_keywords||[],m=e.fallback,g=e.has_summary,x=e.human_summary,j=e.semantic_summary,b=e.item_id!==void 0&&c===void 0,y=b?!0:c,w=!y&&!m;return r.jsxs("div",{className:`border rounded-xl overflow-hidden text-xs transition-all ${m?"border-amber-300 bg-amber-50":y?"border-indigo-300 bg-indigo-50":"border-gray-200 bg-gray-50 opacity-60"}`,children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[t!=null&&r.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 bg-indigo-100 text-indigo-600",children:t}),r.jsx(ns,{className:`w-3.5 h-3.5 shrink-0 ${y?"text-indigo-500":m?"text-amber-500":"text-gray-300"}`}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("span",{className:`font-medium block truncate ${w?"line-through text-gray-400":"text-gray-800"}`,children:a||"(no title)"}),i&&r.jsx("span",{className:"text-[10px] text-gray-400",children:i})]}),o!=null&&r.jsx(e4e,{score:o,size:"sm"}),!g&&!b&&r.jsx(ed,{label:"no summary",color:"amber"}),(y||m)&&!b&&(d?r.jsx(ed,{label:"⚡ keyword",color:"amber"}):m?r.jsx(ed,{label:"fallback",color:"amber"}):r.jsx(ed,{label:"🧠 LLM",color:"indigo"})),!y&&!m&&r.jsx(ed,{label:"skipped",color:"gray"}),r.jsx("button",{onClick:()=>s(_=>!_),className:"text-gray-400 hover:text-indigo-500 shrink-0",children:n?r.jsx($m,{className:"w-3 h-3"}):r.jsx(Ts,{className:"w-3 h-3"})})]}),n&&r.jsxs("div",{className:"border-t px-3 py-3 bg-white space-y-2",children:[l&&r.jsxs("div",{className:`text-xs rounded-lg px-2 py-1.5 border ${y?"bg-indigo-50 border-indigo-200 text-indigo-700":"bg-gray-50 border-gray-200 text-gray-500"}`,children:[r.jsx("span",{className:"font-semibold",children:"LLM reason:"})," ",l]}),d&&f.length>0&&r.jsxs("div",{className:"text-xs rounded-lg px-2 py-1.5 border bg-amber-50 border-amber-200 text-amber-700",children:[r.jsx("span",{className:"font-semibold",children:"Keyword:"})," ",f.map(_=>r.jsx("code",{className:"mx-0.5 bg-amber-100 px-1 rounded",children:_},_))]}),x&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-lg p-2",children:[r.jsx("span",{className:"text-[10px] font-semibold text-indigo-500 block mb-0.5",children:"Summary"}),r.jsx("p",{className:"text-gray-600 leading-relaxed text-[11px]",children:x})]}),j&&!x&&r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-lg p-2",children:[r.jsx("span",{className:"text-[10px] font-semibold text-violet-500 block mb-0.5",children:"Semantic Summary"}),r.jsx("p",{className:"text-gray-600 leading-relaxed text-[11px]",children:j})]})]})]})}function n4e(){var $e;const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState([]),[o,l]=h.useState(!0),[c,d]=h.useState(null),[f,m]=h.useState(null),[g,x]=h.useState(null),[j,b]=h.useState(null),[y,w]=h.useState(!1),[_,N]=h.useState(!1),[C,k]=h.useState(""),[S,A]=h.useState([]),[T,R]=h.useState(""),[B,D]=h.useState(""),[P,I]=h.useState({min_kb_score:.3,min_item_score:.4,max_items_per_kb:5,max_chunks_per_item:0,min_chunk_score:0,early_exit_score:.85,top_k:8,keyword_boost_kbs:!1,keyword_boost_items:!0,max_stage3_llm_calls:0,use_summary_mode:!1}),[z,L]=h.useState("idle"),[H,W]=h.useState({kb:"idle",item:"idle",chunk:"idle"}),[V,K]=h.useState([]),[M,G]=h.useState([]),[q,F]=h.useState([]),[U,ee]=h.useState([]),[ne,X]=h.useState(null),[ie,Z]=h.useState(!1),[ce,le]=h.useState(!1),[re,Ue]=h.useState(null),[Ne,Oe]=h.useState(""),[Me,ue]=h.useState(null),[Ve,Xe]=h.useState([]),[te,De]=h.useState(null),[_e,We]=h.useState([]),[tt,me]=h.useState(null),[ae,Se]=h.useState("pipeline"),[Le,He]=h.useState(!1),ut=z==="running",[ze,fe]=h.useState(null),[dt,ct]=h.useState(null);h.useEffect(()=>{if(!ut||!ze)return;const he=setInterval(()=>ct(Date.now()-ze),100);return()=>clearInterval(he)},[ut,ze]),h.useEffect(()=>{Wt()},[]);async function Wt(){l(!0);const[he,Q,ke,Ee]=await Promise.all([Y.entities.KnowledgeBase.list("-created_date"),Y.entities.TraceTestCase.list("-created_date"),Y.entities.Assistant.list("name"),Y.auth.me().catch(()=>null)]);
1072if(t(he),i(Q),s(ke.filter(Ye=>Ye.status==="active"&&(Ye.knowledge_base_ids||[]).length>0)),d(Ee),Ee!=null&&Ee.email){const Ye=await Y.entities.UserProfile.filter({user_email:Ee.email});m(Ye[0]||null)}l(!1)}async function bt(){const he=await Y.entities.TraceTestCase.list("-created_date");i(he)}function sn(he){var ke;D(he);const Q=n.find(Ee=>Ee.id===he);Q&&(((ke=Q.knowledge_base_ids)==null?void 0:ke.length)>0&&A(Q.knowledge_base_ids),I({min_kb_score:Q.min_kb_score??.3,min_item_score:Q.min_item_score??.4,max_items_per_kb:Q.max_items_per_kb??5,max_chunks_per_item:Q.max_chunks_per_item??0,min_chunk_score:Q.min_chunk_score??0,early_exit_score:Q.early_exit_score??.85,top_k:Q.max_context_items??8,keyword_boost_kbs:Q.keyword_boost_kbs??!1,keyword_boost_items:Q.keyword_boost_items??!0,max_stage3_llm_calls:Q.max_stage3_llm_calls??0,use_summary_mode:Q.use_summary_mode??!1}))}function we(he){A(Q=>Q.includes(he)?Q.filter(ke=>ke!==he):[...Q,he])}function Qe(he){var Q;b(he),k(he.query),((Q=he.knowledge_base_ids)==null?void 0:Q.length)>0?A(he.knowledge_base_ids):he.knowledge_base_id&&A([he.knowledge_base_id]),R(he.expected_top_title||""),he.assistant_id&&D(he.assistant_id),he.thresholds&&I(ke=>({...ke,...he.thresholds})),it(),w(!1)}function it(){L("idle"),W({kb:"idle",item:"idle",chunk:"idle"}),G([]),F([]),ee([]),X(null),K([]),Z(!1),le(!1),Ue(null),Oe(""),ue(null),Xe([]),De(null),We([]),me(null)}async function at(he){he.id?await Y.entities.TraceTestCase.update(he.id,he):await Y.entities.TraceTestCase.create(he),x(null),bt()}async function Gt(he){confirm(`Delete "${he.name}"?`)&&(await Y.entities.TraceTestCase.delete(he.id),(j==null?void 0:j.id)===he.id&&b(null),bt())}function Cn(){const he=[];return c&&he.push(`USER:
1073name: ${c.full_name||""}
1074email: ${c.email||""}
1075role: ${c.role||""}`),f&&(f.profiles&&Object.keys(f.profiles).length>0&&he.push(`USER PROFILES:
1076${JSON.stringify(f.profiles,null,2)}`),f.interests&&Object.keys(f.interests).length>0&&he.push(`USER INTERESTS:
1077${JSON.stringify(f.interests,null,2)}`),f.knowledges&&Object.keys(f.knowledges).length>0&&he.push(`USER KNOWLEDGES:
1078${JSON.stringify(f.knowledges,null,2)}`)),he.join(`
1079
1080`)}async function Jn(){var zs;if(!C.trim()||S.length===0)return;it(),L("running"),Oe("");const he=Cn();if(ae==="items")return Hn(he);const Q={query:C,knowledge_base_ids:S,top_k:P.top_k,min_chunk_score:P.min_chunk_score,min_kb_score:P.min_kb_score,min_item_score:P.min_item_score,max_items_per_kb:P.max_items_per_kb,max_chunks_per_item:P.max_chunks_per_item,early_exit_score:P.early_exit_score,max_context_items:P.top_k,keyword_boost_kbs:P.keyword_boost_kbs,keyword_boost_items:P.keyword_boost_items,max_stage3_llm_calls:P.max_stage3_llm_calls,use_summary_mode:P.use_summary_mode,caller:"SearchTrace",debug_mode:!0,stage:0,...he?{context:he}:{}};W(oe=>({...oe,kb:"running"}));const ke=Date.now();fe(ke),ct(0);let Ee,Ye;try{Ee=await Y.functions.invoke("semanticSearch",Q),Ye=Ee==null?void 0:Ee.data}catch(oe){const Be=((zs=oe==null?void 0:oe.response)==null?void 0:zs.data)||{},Ze=(Be==null?void 0:Be.error)||(oe==null?void 0:oe.message)||"Unknown error";Oe(Ze),Be!=null&&Be.debug&&(We(Be.debug.llm_call_log||[]),Xe(Be.debug.rate_limit_retries||[]),De(Be.debug.llm_calls??null)),L("error"),W({kb:"idle",item:"idle",chunk:"idle"}),ue(Date.now()-ke);return}const Tt=Date.now()-ke;if(ue(Tt),ct(Tt),!Ye||Ye.error){Oe((Ye==null?void 0:Ye.error)||"Unknown error"),L("error"),W({kb:"idle",item:"idle",chunk:"idle"});return}Ue(Ye);const Ut=Ye.debug||{},$t=P.use_summary_mode;K(Ut.query_keywords||[]),Xe(Ut.rate_limit_retries||[]),me(Ut.stage_timings||null);const En=Ut.llm_call_log||[],Pr=$t?En.filter(oe=>oe.stage!==3):En;De(Pr.length),We(Pr),G(Ut.stage1_kbs||[]),W(oe=>({...oe,kb:"done"})),F(Ut.stage2_items||[]),W(oe=>({...oe,item:"done"})),$t?(ee(Ye.results||[]),X(null),W(oe=>({...oe,chunk:"skipped"}))):(X(Ut.stage3_stats||null),ee(Ut.stage3_chunks||Ye.results||[]),W(oe=>({...oe,chunk:"done"}))),le(Ye.early_exit||!1),Z(Ye.used_fallback||!1),L("done")}async function Hn(he){var Ee,Ye,Tt,Ut;const Q=Date.now();fe(Q),ct(0),W({kb:"idle",item:"running",chunk:"idle"});const ke={query:C,knowledge_base_ids:S,min_item_score:P.min_item_score,max_items_per_kb:P.max_items_per_kb,caller:"SearchTrace",debug_mode:Le,...he?{context:he}:{}};try{const $t=await Y.functions.invoke("itemsSemanticSearch",ke),En=$t==null?void 0:$t.data,Pr=Date.now()-Q;if(ue(Pr),ct(Pr),!En||En.error){Oe((En==null?void 0:En.error)||"Unknown error"),L("error"),W({kb:"idle",item:"idle",chunk:"idle"});return}Ue(En),F(En.results||[]),W({kb:"idle",item:"done",chunk:"idle"}),We(((Ee=En.debug)==null?void 0:Ee.llm_call_log)||[]),De(((Tt=(Ye=En.debug)==null?void 0:Ye.llm_call_log)==null?void 0:Tt.length)||0),L("done")}catch($t){const En=((Ut=$t==null?void 0:$t.response)==null?void 0:Ut.data)||{},Pr=(En==null?void 0:En.error)||($t==null?void 0:$t.message)||"Unknown error";Oe(Pr),L("error"),W({kb:"idle",item:"idle",chunk:"idle"}),ue(Date.now()-Q)}}const tn=a.reduce((he,Q)=>{const ke=Q.group||"Ungrouped";return he[ke]||(he[ke]=[]),he[ke].push(Q),he},{}),On=U[0];T&&(($e=On==null?void 0:On.title)==null||$e.toLowerCase(),T.toLowerCase());const as=()=>r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-3 py-3 border-b bg-white shrink-0",children:r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Saved Tests"}),r.jsx("button",{onClick:()=>{x({}),w(!1)},className:"p-1 rounded text-gray-400 hover:text-indigo-500 hover:bg-indigo-50",children:r.jsx(ln,{className:"w-3.5 h-3.5"})})]})}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-3",children:[o&&[1,2,3].map(he=>r.jsx("div",{className:"h-12 bg-gray-100 animate-pulse rounded-xl"},he)),!o&&a.length===0&&r.jsx("p",{className:"text-xs text-gray-400 text-center py-4 italic",children:"No tests saved yet. Run a query and save it."}),Object.entries(tn).map(([he,Q])=>r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider px-2 mb-1",children:he}),r.jsx("div",{className:"space-y-0.5",children:Q.map(ke=>{var Ee;return r.jsx(r4e,{tc:ke,kbName:(((Ee=ke.knowledge_base_ids)==null?void 0:Ee.length)>0?ke.knowledge_base_ids:ke.knowledge_base_id?[ke.knowledge_base_id]:[]).map(Ye=>{var Tt;return(Tt=e.find(Ut=>Ut.id===Ye))==null?void 0:Tt.name}
1080).filter(Boolean).join(", "),active:(j==null?void 0:j.id)===ke.id,onSelect:Qe,onEdit:Ye=>{x(Ye),w(!1)},onDelete:Gt},ke.id)})})]},he))]})]});return r.jsxs("div",{className:"flex h-full overflow-hidden",children:[r.jsx("div",{className:"hidden md:flex w-60 shrink-0 border-r bg-gray-50 flex-col overflow-hidden",children:r.jsx(as,{})}),y&&r.jsxs("div",{className:"md:hidden fixed inset-0 z-40 flex",children:[r.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:()=>w(!1)}),r.jsx("div",{className:"relative w-72 bg-gray-50 flex flex-col z-50 shadow-2xl",children:r.jsx(as,{})})]}),r.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"bg-white border-b px-4 py-3 shrink-0 flex items-center gap-3",children:[r.jsx("button",{onClick:()=>w(!0),className:"md:hidden p-1.5 rounded text-gray-400 hover:bg-gray-100",children:r.jsx(zn,{className:"w-4 h-4"})}),r.jsx(zn,{className:"w-4 h-4 text-indigo-500 shrink-0"}),r.jsx("h1",{className:"font-bold text-gray-900",children:"Search Trace"}),r.jsx("span",{className:"text-xs bg-indigo-100 text-indigo-600 px-2 py-0.5 rounded-full font-medium hidden sm:inline",children:"3-Stage Pipeline"}),r.jsx("button",{onClick:()=>N(he=>!he),className:`text-xs px-2.5 py-1 rounded-lg border font-semibold transition-colors ${_?"bg-amber-500 text-white border-amber-500":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,children:_?"⚡ Step-by-Step":"Step-by-Step"}),r.jsxs("select",{value:ae,onChange:he=>Se(he.target.value),className:"text-xs px-2.5 py-1 rounded-lg border bg-white text-gray-600 border-gray-200 hover:bg-gray-50 font-semibold",children:[r.jsx("option",{value:"pipeline",children:"3-Stage Pipeline"}),r.jsx("option",{value:"items",children:"Items Search Only"})]}),ut&&dt!=null&&r.jsxs("span",{className:"text-xs font-mono text-indigo-500 bg-indigo-50 border border-indigo-200 px-2 py-0.5 rounded-full animate-pulse",children:["⏱ ",(dt/1e3).toFixed(1),"s"]}),z==="done"&&Me&&r.jsxs("span",{className:"text-xs font-mono text-emerald-700 bg-emerald-50 border border-emerald-200 px-2 py-0.5 rounded-full",children:["✓ ",(Me/1e3).toFixed(2),"s"]}),r.jsx("div",{className:"flex-1"}),z==="done"&&r.jsxs("button",{onClick:it,className:"text-xs text-gray-400 hover:text-gray-700 flex items-center gap-1",children:[r.jsx(Rn,{className:"w-3 h-3"})," Reset"]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 max-w-3xl mx-auto w-full",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-5 space-y-4",children:[n.length>0&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide flex items-center gap-1.5",children:[r.jsx(W5,{className:"w-3.5 h-3.5 text-indigo-400"})," Load from Assistant ",r.jsx("span",{className:"text-gray-300 font-normal",children:"(pre-fills KBs + thresholds)"})]}),r.jsxs("select",{value:B,onChange:he=>sn(he.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:"— choose an assistant —"}),n.map(he=>r.jsx("option",{value:he.id,children:he.name},he.id))]})]}),r.jsx(Eu,{title:"Knowledge Bases",defaultOpen:!1,badge:r.jsx(ed,{label:`${S.length} selected`,color:S.length>0?"indigo":"gray"}),children:r.jsx("div",{className:"p-3 flex flex-wrap gap-1.5",children:e.map(he=>r.jsx("button",{onClick:()=>we(he.id),className:`text-xs px-3 py-1.5 rounded-lg border transition-all ${S.includes(he.id)?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300"}`,children:he.name},he.id))})}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"User Query"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:C,onChange:he=>k(he.target.value),onKeyDown:he=>!_&&he.key==="Enter"&&Jn(),placeholder:"Type a query or select a saved test…",className:"flex-1 border rounded-xl px-4 py-2.5 text-sm outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-100"}),_&&r.jsx("span",{className:"shrink-0 text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded-xl px-3 py-2.5 font-medium",children:"⚡ Run each stage below →"}),!_&&r.jsxs(de,{onClick:Jn,disabled:!C.trim()||S.length===0||ut,className:"gap-1.5 shrink-0",children:[ut?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(ur,{className:"w-4 h-4"}),"Run"]})]}),V.length>0&&r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"text-[10px] text-gray-400 font-semibold uppercase tracking-wide",children:"Matched keywords:"}),V.map(he=>r.jsx("span",{className:"text-[11px] font-mono bg-amber-50 border border-amber-200 text-amber-700 rounded px-1.5 py-0.5",children:he},he))]})]}),r.jsx(Eu,{title:"Retrieval Thresholds",badge:r.jsx(ed,{label:"editable",color:"indigo"}),children:r.jsxs("div",{className:"p-4 space-y-4 bg-gray-50",children:[[{key:"min_kb_score",label:"KB Min Score",hint:"Stage 1: min score for a KB to be searched"},{key:"min_item_score",label:"Item Min Score",hint:"Stage 2: min score for an item's chunks to be fetched"},{key:"min_chunk_score",label:"Chunk Min Score",hint:"Stage 3: min score for a chunk to appear in results"},{key:"early_exit_score",label:"Early Exit Score",hint:"Skip fallback if all results exceed this"}].map(({key:he,label:Q,hint:ke})=>r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600",children:Q}),r.jsxs("span",{className:"font-mono text-xs font-bold text-indigo-600",children:[Math.round(P[he]*100),"%"]})]}),r.jsx(xr,{value:[P[he]*100],onValueChange:([Ee])=>I(Ye=>({...Ye,[he]:Math.round(Ee)/100})),min:0,max:100,step:5,className:"w-full"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:ke})]},he)),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600",children:"Top K (context size)"}),r.jsx("span",{className:"font-mono text-xs font-bold text-indigo-600",children:P.top_k})]}),r.jsx(xr,{value:[P.top_k],onValueChange:([he])=>I(Q=>({...Q,top_k:he})),min:3,max:30,step:1,className:"w-full"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Max chunks to return in final context"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600",children:"Max Items per KB"}),r.jsx("span",{className:"font-mono text-xs font-bold text-indigo-600",children:P.max_items_per_kb})]}),r.jsx(xr,{value:[P.max_items_per_kb],onValueChange:([he])=>I(Q=>({...Q,max_items_per_kb:he})),min:1,max:20,step:1,className:"w-full"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Stage 2: max items per KB to select"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600",children:"Max Chunks per Item"}),r.jsx("span",{className:"font-mono text-xs font-bold text-indigo-600",children:P.max_chunks_per_item===0?"∞":P.max_chunks_per_item})]}),r.jsx(xr,{value:[P.max_chunks_per_item],onValueChange:([he])=>I(Q=>({...Q,max_chunks_per_item:he})),min:0,max:10,step:1,className:"w-full"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Stage 3: max chunks per item (0 = unlimited)"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600",children:"Max LLM Calls (Stage 3)"}),r.jsx("span",{className:"font-mono text-xs font-bold text-indigo-600",children:P.max_stage3_llm_calls===0?"∞":P.max_stage3_llm_calls})]}),r.jsx(xr,{value:[P.max_stage3_llm_calls],onValueChange:([he])=>I(Q=>({...Q,max_stage3_llm_calls:he})),min:0,max:10,step:1,className:"w-full"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Chunk ranking LLM batches (0 = unlimited, rank all)"})]}),r.jsxs("div",{className:"border-t pt-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600",children:"Keyword Boost KBs"}),r.jsx("p",{className:"text-[10px] text-gray-400 mt-0.5",children:"Stage 1: prioritize KBs matching query keywords"})]}),r.jsx("button",{onClick:()=>I(he=>({...he,keyword_boost_kbs:!he.keyword_boost_kbs})),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${P.keyword_boost_kbs?"bg-indigo-600":"bg-gray-300"}`,children:r.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${P.keyword_boost_kbs?"translate-x-4.5":"translate-x-0.5"}`})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600",children:"Keyword Boost Items"}),r.jsx("p",{className:"text-[10px] text-gray-400 mt-0.5",children:"Stage 2: prioritize items matching query keywords"})]}),r.jsx("button",{onClick:()=>I(he=>({...he,keyword_boost_items:!he.keyword_boost_items})),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${P.keyword_boost_items?"bg-indigo-600":"bg-gray-300"}`,children:r.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${P.keyword_boost_items?"translate-x-4.5":"translate-x-0.5"}`})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600",children:"Summary Mode"}),r.jsx("p",{className:"text-[10px] text-gray-400 mt-0.5",children:"Skip Stage 3 chunk ranking, use item summaries instead"})]}),r.jsx("button",{onClick:()=>I(he=>({...he,use_summary_mode:!he.use_summary_mode})),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${P.use_summary_mode?"bg-amber-500":"bg-gray-300"}`,children:r.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${P.use_summary_mode?"translate-x-4.5":"translate-x-0.5"}`})})]})]})]})})]}),_&&r.jsx(ZOe,{query:C,kbIds:S,thresholds:P,kbs:e,context:Cn()}),!_&&z==="error"&&r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-2xl p-4 space-y-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Nr,{className:"w-4 h-4 text-red-500 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-red-700",children:"Search failed"}),r.jsx("p",{className:"text-xs text-red-500 mt-0.5 font-mono",children:Ne})]})]})}),ae==="items"&&z==="idle"&&r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-gray-100 rounded-lg border border-gray-300",children:[r.jsx("input",{type:"checkbox",id:"debugToggle",checked:Le,onChange:he=>He(he.target.checked),className:"w-4 h-4 rounded"}),r.jsx("label",{htmlFor:"debugToggle",className:"text-xs font-semibold text-gray-700 cursor-pointer",children:"Enable Debug Mode"})]}),!_&&z==="done"&&ae==="items"&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-2xl px-5 py-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mr,{className:"w-4 h-4 text-indigo-500"}),r.jsx("span",{className:"font-semibold text-indigo-800 text-sm",children:"Item search complete"}),Me&&r.jsxs("span",{className:"text-xs text-indigo-400 font-mono ml-auto",children:[Me,"ms"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2 text-xs text-indigo-600",children:[r.jsxs("span",{children:[q.length," items found"]}
1080),te!==null&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"·"}),r.jsxs("span",{children:[te," LLM calls"]})]})]}),q.length>0&&r.jsx(Eu,{title:`Results (${q.length})`,defaultOpen:!0,children:r.jsx("div",{className:"p-3 space-y-2",children:q.map((he,Q)=>r.jsx(t4e,{itemDebug:he,rank:Q+1},he.item_id||Q))})}),re&&r.jsx(Eu,{title:"Raw response",children:r.jsx(BB,{content:re})}),_e.length>0&&r.jsx(Eu,{title:`LLM Call Log (${_e.length})`,children:r.jsx("div",{className:"p-3 space-y-2 text-xs",children:_e.map((he,Q)=>r.jsxs("div",{className:"bg-white border rounded-lg p-2 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zn,{className:"w-3 h-3 text-amber-500"}),r.jsx("span",{className:"font-mono font-semibold text-gray-700",children:he.model||"unknown"}),r.jsx("span",{className:"text-gray-400",children:"·"}),r.jsxs("span",{className:"text-gray-500",children:[he.latency_ms,"ms"]})]}),he.error&&r.jsxs("p",{className:"text-red-600 font-mono text-[10px]",children:["Error: ",he.error]})]},Q))})})]}),_&&z==="done"&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-2xl px-5 py-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mr,{className:"w-4 h-4 text-indigo-500"}),r.jsx("span",{className:"font-semibold text-indigo-800 text-sm",children:"Search complete"}),Me&&r.jsxs("span",{className:"text-xs text-indigo-400 font-mono ml-auto",children:[Me,"ms"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2 text-xs text-indigo-600",children:[r.jsxs("span",{children:[M.filter(he=>he.selected).length,"/",M.length," KBs"]}),r.jsx("span",{children:"·"}),P.use_summary_mode?r.jsxs("span",{children:[U.length," items (summary mode)"]}):r.jsxs(r.Fragment,{children:[r.jsxs("span",{children:[q.filter(he=>he.selected||he.fallback).length,"/",q.length," items"]}),r.jsx("span",{children:"·"}),r.jsxs("span",{children:[U.length," chunks in context"]})]})]}),re&&r.jsx(Eu,{title:"Raw response",children:r.jsx(BB,{content:re})})]}),r.jsx("div",{className:"h-8"})]})]}),g!==null&&r.jsx(VOe,{testCase:g,kbs:e,assistants:n,currentKbIds:S,currentAssistantId:B,currentThresholds:P,onSave:at,onClose:()=>x(null)})]})}function r4e({tc:e,kbName:t,active:n,onSelect:s,onEdit:a,onDelete:i}){return r.jsx("div",{onClick:()=>s(e),className:`group px-3 py-2.5 rounded-xl cursor-pointer transition-all border ${n?"bg-indigo-50 border-indigo-200 shadow-sm":"border-transparent hover:border-gray-200 hover:bg-gray-50"}`,children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:`w-1.5 h-1.5 rounded-full mt-1.5 shrink-0 ${n?"bg-indigo-500":"bg-gray-300"}`}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:`font-semibold text-xs truncate ${n?"text-indigo-800":"text-gray-700"}`,children:e.name}),r.jsxs("div",{className:"text-[11px] text-gray-400 truncate mt-0.5 italic",children:['"',e.query,'"']})]}),r.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:o=>o.stopPropagation(),children:[r.jsx("button",{onClick:()=>a(e),className:"p-1 rounded text-gray-300 hover:text-indigo-500 hover:bg-indigo-50 transition-colors",children:r.jsx(ra,{className:"w-3 h-3"})}),r.jsx("button",{onClick:()=>i(e),className:"p-1 rounded text-gray-300 hover:text-red-500 hover:bg-red-50 transition-colors",children:r.jsx(un,{className:"w-3 h-3"})})]})]})})}const s4e=[{path:"/SettingsPromptChain",icon:Br,color:"bg-indigo-50 text-indigo-600",label:"Prompt Chain",desc:"Master system prompt, KB item template, conversation history, instructions, and closing instruction."},{path:"/SettingsRagChunking",icon:_n,color:"bg-blue-50 text-blue-600",label:"RAG & Chunking",desc:"Context window, max chars per item, chunk size, overlap, separators, and chunking mode."},{path:"/SettingsKbRag",icon:_n,color:"bg-cyan-50 text-cyan-600",label:"KB RAG",desc:"Item & KB summary prompts, human/semantic summary sizes, summarization model, and ranking configuration."},{path:"/SettingsAssistantDefaults",icon:Sa,color:"bg-violet-50 text-violet-600",label:"Assistant Defaults",desc:"Default answer instructions and response objects per assistant type."},{path:"/SettingsShellRouting",icon:_b,color:"bg-emerald-50 text-emerald-600",label:"Shell Routing",desc:"Shell router model, history size, routing prompt, return object, and shell mapping."}
1080,{path:"/SettingsJsonObjects",icon:dr,color:"bg-amber-50 text-amber-600",label:"JSON Objects",desc:"AI JSON generation prompt template and live preview editor."},{path:"/SettingsIgnoreKeywords",icon:ur,color:"bg-rose-50 text-rose-600",label:"Ignore Keywords",desc:"Global ignore keyword prompt and keyword list used during semantic search."},{path:"/SettingsIntegrations",icon:zn,color:"bg-orange-50 text-orange-600",label:"Integrations",desc:"Jina AI, Supadata, Supabase credentials, and embedded chat special rendering."},{path:"/ApiKeyManagement",icon:e2,color:"bg-gray-50 text-gray-600",label:"API Key Management",desc:"Issue and manage API keys for external access to the app."},{path:"/KbQueue",icon:el,color:"bg-indigo-50 text-indigo-600",label:"KB Task Queue",desc:"Manage knowledge base processing tasks, automations, and batch execution controller."}];function a4e(){const[e,t]=h.useState(null);return h.useEffect(()=>{Y.auth.me().then(n=>t(!!(n!=null&&n.is_manager))).catch(()=>t(!1))},[]),e===!1?r.jsxs("div",{className:"p-8 text-center text-gray-400",children:[r.jsx(M0,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"Access restricted to managers only."})]}):r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsx("div",{className:"border-b bg-white px-6 py-4 shrink-0",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-9 h-9 rounded-xl bg-gray-100 flex items-center justify-center",children:r.jsx(Zp,{className:"w-4 h-4 text-gray-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"App Settings"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Select a section to configure"})]})]})}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 max-w-5xl",children:[r.jsx(wt,{to:"/SettingsV1",children:r.jsxs("div",{className:"group bg-white border-2 border-dashed border-gray-200 hover:border-gray-300 rounded-2xl p-5 flex items-start gap-4 cursor-pointer transition-all hover:shadow-sm",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gray-50 text-gray-400 flex items-center justify-center shrink-0",children:r.jsx(Ih,{className:"w-5 h-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("h3",{className:"font-semibold text-sm text-gray-500",children:"Settings V1 (Legacy)"}),r.jsx(en,{className:"w-4 h-4 text-gray-300 group-hover:text-gray-400 shrink-0"})]}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Full tabbed settings view — kept for reference."})]})]})}),s4e.map(n=>r.jsx(wt,{to:n.path,children:r.jsxs("div",{className:"group bg-white border border-gray-200 hover:border-indigo-200 rounded-2xl p-5 flex items-start gap-4 cursor-pointer transition-all hover:shadow-md",children:[r.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center shrink-0 ${n.color}`,children:r.jsx(n.icon,{className:"w-5 h-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("h3",{className:"font-semibold text-sm text-gray-800",children:n.label}),r.jsx(en,{className:"w-4 h-4 text-gray-300 group-hover:text-indigo-400 shrink-0 transition-colors"})]}),r.jsx("p",{className:"text-xs text-gray-400 mt-1 leading-relaxed",children:n.desc})]})]})},n.path))]})})]})}const FB="w-full border rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-100 transition-all";function i4e({testSet:e,onSave:t,onClose:n}){const[s,a]=h.useState({name:"",description:"",...e}),[i,o]=h.useState(!1);async function l(){o(!0),await t(s),o(!1)}return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b",children:[r.jsx("h2",{className:"font-semibold text-gray-900",children:e!=null&&e.id?"
1080Edit Test Set":"New Test Set"}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600 text-xl leading-none",children:"×"})]}),r.jsxs("div",{className:"px-6 py-5 space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600 uppercase tracking-wide",children:"Name"}),r.jsx("input",{className:FB,value:s.name,onChange:c=>a(d=>({...d,name:c.target.value})),placeholder:"e.g. Semantic Search"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600 uppercase tracking-wide",children:"Description"}),r.jsx("input",{className:FB,value:s.description,onChange:c=>a(d=>({...d,description:c.target.value})),placeholder:"What does this set test?"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 px-6 py-4 border-t",children:[r.jsx(de,{variant:"outline",onClick:n,children:"Cancel"}),r.jsxs(de,{onClick:l,disabled:i||!s.name,children:[i?r.jsx(Pe,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save"]})]})]})})}function o4e({stats:e}){if(!e||e.total===0)return r.jsx("div",{className:"text-xs text-gray-400 italic",children:"No runs yet"});const t=i=>Math.round(i/e.total*100),n=t(e.pass),s=t(e.partial),a=t(e.fail);return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex h-2 rounded-full overflow-hidden bg-gray-100 gap-px",children:[e.pass>0&&r.jsx("div",{className:"bg-emerald-400 rounded-l-full",style:{width:`${n}%`}}),e.partial>0&&r.jsx("div",{className:"bg-amber-400",style:{width:`${s}%`}}),e.fail>0&&r.jsx("div",{className:"bg-red-400 rounded-r-full",style:{width:`${a}%`}})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[e.pass>0&&r.jsxs("span",{className:"flex items-center gap-1 text-emerald-600 font-medium",children:[r.jsx(mr,{className:"w-3 h-3"})," ",e.pass," pass"]}),e.partial>0&&r.jsxs("span",{className:"flex items-center gap-1 text-amber-600 font-medium",children:[r.jsx(Gp,{className:"w-3 h-3"})," ",e.partial," partial"]}),e.fail>0&&r.jsxs("span",{className:"flex items-center gap-1 text-red-500 font-medium",children:[r.jsx(sc,{className:"w-3 h-3"})," ",e.fail," fail"]}),r.jsxs("span",{className:"text-gray-400 ml-auto",children:[e.total," runs · avg ",e.avgScore,"/100"]})]})]})}function l4e({ts:e,stats:t,onEdit:n,onDelete:s,onMove:a,onClone:i}){return r.jsx(wt,{to:yt(`TestSetDetail?id=${e.id}`),children:r.jsx("div",{className:"border rounded-2xl bg-white hover:shadow-lg hover:border-indigo-200 transition-all group cursor-pointer overflow-hidden",children:r.jsxs("div",{className:"px-6 py-5 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-indigo-50 border border-indigo-100 flex items-center justify-center shrink-0",children:r.jsx(si,{className:"w-5 h-5 text-indigo-600"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-bold text-lg text-gray-900 group-hover:text-indigo-700 transition-colors",children:e.name}),e.description&&r.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:e.description})]}),r.jsx(en,{className:"w-5 h-5 text-gray-300 group-hover:text-indigo-400 transition-colors shrink-0 mt-1"})]}),r.jsx("div",{className:"border-t pt-3",onClick:o=>o.preventDefault(),children:r.jsx(o4e,{stats:t})}),r.jsx("div",{className:"flex items-center gap-4 text-sm text-gray-400 border-t pt-3",children:r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Lm,{className:"w-3.5 h-3.5"}),new Date(e.created_date).toLocaleDateString()]})}),r.jsxs("div",{className:"flex gap-2 flex-wrap border-t pt-3",onClick:o=>o.preventDefault(),children:[r.jsxs("button",{onClick:o=>{o.preventDefault(),o.stopPropagation(),a(e)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-violet-700 bg-violet-50 border border-violet-200 hover:bg-violet-100 transition-colors",children:[r.jsx(Jp,{className:"w-3.5 h-3.5"})," Move"]}),r.jsxs("button",{onClick:o=>{o.preventDefault(),o.stopPropagation(),i(e)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-teal-700 bg-teal-50 border border-teal-200 hover:bg-teal-100 transition-colors",children:[r.jsx(ri,{className:"w-3.5 h-3.5"})," Clone"]}),r.jsxs("button",{onClick:o=>{o.preventDefault(),o.stopPropagation(),n(e)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-indigo-700 bg-indigo-50 border border-indigo-200 hover:bg-indigo-100 transition-colors",children:[r.jsx(ra,{className:"w-3.5 h-3.5"})," Edit"]}),r.jsxs("button",{onClick:o=>{o.preventDefault(),o.stopPropagation(),s(e)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-red-600 bg-red-50 border border-red-200 hover:bg-red-100 transition-colors",children:[r.jsx(un,{className:"w-3.5 h-3.5"})," Delete"]})]})]})})})}function c4e(){var k;const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState({}),[o,l]=h.useState(!0),[c,d]=h.useState(null),[f,m]=h.useState("all"),[g,x]=h.useState(null);h.useEffect(()=>{j()},[]);async function j(){l(!0);const[S,A,T]=await Promise.all([Y.entities.TestSet.list("-created_date"),Y.entities.Library.list("name"),Y.entities.TestResult.list("-ran_at",500)]);t(S),s(A);const R={};for(const D of T)D.test_case_id&&!R[D.test_case_id]&&(R[D.test_case_id]=D);const B={};for(const D of Object.values(R)){const P=D.test_set_id;if(!P)continue;const I=D.human_override_verdict||D.verdict;!I||I==="error"||(B[P]||(B[P]={total:0,pass:0,partial:0,fail:0,scoreSum:0,scoredCount:0}),B[P].total++,I==="pass"?B[P].pass++:I==="partial"?B[P].partial++:I==="fail"&&B[P].fail++,D.score!=null&&(B[P].scoreSum+=D.score,B[P].scoredCount++))}for(const D of Object.keys(B)){const P=B[D];P.avgScore=P.scoredCount>0?Math.round(P.scoreSum/P.scoredCount):0}i(B),l(!1)}async function b(S){if(S.id)await Y.entities.TestSet.update(S.id,{name:S.name,description:S.description}),t(A=>A.map(T=>T.id===S.id?{...T,...S}:T));else{const A=await Y.entities.TestSet.create({name:S.name,description:S.description,library_id:f!=="all"&&f!=="none"?f:""});t(T=>[A,...T])}d(null)}async function y(S){if(!confirm(`Delete test set "${S.name}" and all its cases?`))return;const A=await Y.entities.TestCase.filter({test_set_id:S.id});await Promise.all(A.map(T=>Y.entities.TestCase.delete(T.id))),await Y.entities.TestSet.delete(S.id),t(T=>T.filter(R=>R.id!==S.id))}async function w(S){const A=await Y.entities.TestSet.create({name:`${S.name} (copy)`,description:S.description||"",library_id:S.library_id||"",target_assistant_id:S.target_assistant_id||"",evaluator_assistant_id:S.evaluator_assistant_id||"",response_nodes:S.response_nodes||[]}),T=await Y.entities.TestCase.filter({test_set_id:S.id});await Promise.all(T.map(R=>Y.entities.TestCase.create({test_set_id:A.id,name:R.name,description:R.description||"",query:R.query,expected_answer:R.expected_answer||"",node_expectations:R.node_expectations||[],target_assistant_id:R.target_assistant_id||"",evaluator_assistant_id:R.evaluator_assistant_id||""}))),t(R=>[A,...R])}async function _(S){await Y.entities.TestSet.update(g.id,{library_id:S}),t(A=>A.map(T=>T.id===g.id?{...T,library_id:S}:T)),x(null)}const N=f==="all"?e:f==="none"?e.filter(S=>!S.library_id):e.filter(S=>S.library_id===f),C={__all__:e.length,__none__:e.filter(S=>!S.library_id).length,...Object.fromEntries(n.map(S=>[S.id,e.filter(A=>A.library_id===S.id).length]))};return r.jsxs("div",{className:"flex h-full min-h-0",children:[r.jsx(zb,{libraries:n,selected:f,onSelect:m,counts:C,onLibrariesChange:s,onItemsUnassigned:S=>{t(A=>A.map(T=>T.library_id===S?{...T,library_id:""}:T))}}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs("div",{className:"p-6 md:p-10 max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-10",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:f==="all"?"Test Sets":f==="none"?"Uncategorized Test Sets":((k=n.find(S=>S.id===f))==null?void 0:k.name)||"Test Sets"}),r.jsxs("p",{className:"text-gray-500 text-base mt-1",children:[N.length," test set",N.length!==1?"s":""]})]}),r.jsxs(de,{size:"lg",className:"gap-2 text-base px-6 py-3 h-auto",onClick:()=>d({}),children:[r.jsx(ln,{className:"w-5 h-5"})," New Test Set"]})]}),o?r.jsx("div",{className:"space-y-4",children:[1,2,3].map(S=>r.jsx("div",{className:"h-32 bg-gray-100 animate-pulse rounded-2xl"},S))}):N.length===0?r.jsxs("div",{className:"text-center py-32 border-2 border-dashed border-gray-200 rounded-2xl",children:[r.jsx(si,{className:"w-16 h-16 mx-auto mb-4 text-gray-300"}),r.jsx("h3",{className:"text-gray-700 text-xl font-semibold mb-2",children:"No test sets here"}),r.jsx("p",{className:"text-gray-400 text-base mb-6",children:"Create a test set to group related test cases"}),f==="all"&&r.jsxs(de,{size:"lg",className:"gap-2",onClick:()=>d({}),children:[r.jsx(ln,{className:"w-5 h-5"})," Create Test Set"]})]}):r.jsx("div",{className:"space-y-5",children:N.map(S=>r.jsx(l4e,{ts:S,stats:a[S.id]||null,onEdit:A=>d(A),onDelete:y,onMove:A=>x(A),onClone:w},S.id))})]})}),c&&r.jsx(i4e,{testSet:c,onSave:b,onClose:()=>d(null)}),g&&r.jsx(Ub,{itemName:g.name,libraries:n,currentLibraryId:g.library_id||"",onMove:_,onClose:()=>x(null)})]})}const d4e={profile:"bg-indigo-50 text-indigo-700 border-indigo-200",interest:"bg-emerald-50 text-emerald-700 border-emerald-200",knowledge:"bg-violet-50 text-violet-700 border-violet-200"};
1080function u4e({value:e,onChange:t}){const[n,s]=h.useState(JSON.stringify(e||{},null,2)),[a,i]=h.useState("");function o(l){s(l);try{const c=JSON.parse(l);i(""),t(c)}catch{i("Invalid JSON")}}return r.jsxs("div",{className:"space-y-1",children:[r.jsx("textarea",{value:n,onChange:l=>o(l.target.value),spellCheck:!1,rows:8,className:"w-full font-mono text-xs rounded-lg border border-gray-200 px-3 py-2 bg-gray-950 text-green-400 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"}),a&&r.jsx("p",{className:"text-xs text-red-500",children:a})]})}function m4e({record:e,onEdit:t,onDelete:n}){const[s,a]=h.useState(!1),i=e.investigationObject&&Object.keys(e.investigationObject).length>0;return r.jsxs("div",{className:"border rounded-xl bg-white overflow-hidden shadow-sm",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsxs("button",{onClick:()=>a(o=>!o),className:"flex-1 flex items-center gap-3 px-4 py-3 hover:bg-gray-50 transition-colors text-left min-w-0",children:[s?r.jsx(gt,{className:"w-4 h-4 text-gray-400 shrink-0"}):r.jsx(en,{className:"w-4 h-4 text-gray-400 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-semibold text-sm text-gray-900",children:e.investigationName||e.investigationKey}),e.type&&r.jsx("span",{className:`text-xs border px-2 py-0.5 rounded-full font-medium ${d4e[e.type]||"bg-gray-100 text-gray-600 border-gray-200"}`,children:e.type}),e.investigationKey&&r.jsx("span",{className:"text-[10px] font-mono bg-gray-100 text-gray-500 px-1.5 py-0.5 rounded",children:e.investigationKey})]}),e.completion!=null&&r.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[r.jsx("div",{className:"flex-1 h-1.5 bg-gray-100 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-indigo-400 rounded-full transition-all",style:{width:`${Math.min(100,e.completion)}%`}})}),r.jsxs("span",{className:"text-[10px] text-gray-400 shrink-0",children:[e.completion,"%"]})]}),e.lastUpdate&&r.jsxs("p",{className:"text-[10px] text-gray-400 mt-0.5",children:["Updated ",new Date(e.lastUpdate).toLocaleString()]})]})]}),r.jsxs("div",{className:"flex items-center gap-1 px-3 shrink-0",children:[r.jsx("button",{onClick:()=>t(e),className:"p-1.5 rounded-lg text-gray-300 hover:text-indigo-500 hover:bg-indigo-50 transition-colors",children:r.jsx(ra,{className:"w-4 h-4"})}),r.jsx("button",{onClick:()=>n(e),className:"p-1.5 rounded-lg text-gray-300 hover:text-red-500 hover:bg-red-50 transition-colors",children:r.jsx(un,{className:"w-4 h-4"})})]})]}),s&&r.jsx("div",{className:"border-t px-4 py-3 bg-gray-50",children:i?r.jsx("pre",{className:"text-xs font-mono text-gray-700 whitespace-pre-wrap bg-white border rounded-lg p-3 overflow-auto max-h-64",children:JSON.stringify(e.investigationObject,null,2)}):r.jsx("p",{className:"text-xs text-gray-400 italic",children:"No data collected yet."})})]})}function f4e({record:e,userEmail:t,onSave:n,onClose:s}){const a=!e.id,[i,o]=h.useState({investigationKey:e.investigationKey||"",investigationName:e.investigationName||"",type:e.type||"profile",investigationObject:e.investigationObject||{},completion:e.completion??""}),[l,c]=h.useState(!1);async function d(){c(!0);const f={user_email:t,investigationKey:i.investigationKey,investigationName:i.investigationName,type:i.type,investigationObject:i.investigationObject,completion:i.completion!==""?Number(i.completion):null,lastUpdate:new Date().toISOString()};a?await Y.entities.UserInvestigation.create(f):await Y.entities.UserInvestigation.update(e.id,f),c(!1),n()}return r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg max-h-[90vh] flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b shrink-0",children:[r.jsx("h3",{className:"font-semibold text-gray-900",children:a?"Add Investigation Record":"Edit Investigation Record"}),r.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-700",children:r.jsx(jt,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"overflow-y-auto flex-1 p-5 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Investigation Key *"}),r.jsx(It,{value:i.investigationKey,onChange:f=>o(m=>({...m,investigationKey:f.target.value})),placeholder:"e.g. tech_skills",className:"text-sm"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Display Name"}),r.jsx(It,{value:i.investigationName,onChange:f=>o(m=>({...m,investigationName:f.target.value})),placeholder:"e.g. Tech Skills",className:"text-sm"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Type"}
1080),r.jsxs("select",{value:i.type,onChange:f=>o(m=>({...m,type:f.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"profile",children:"Profile"}),r.jsx("option",{value:"interest",children:"Interest"}),r.jsx("option",{value:"knowledge",children:"Knowledge"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Completion (%)"}),r.jsx(It,{type:"number",min:"0",max:"100",value:i.completion,onChange:f=>o(m=>({...m,completion:f.target.value})),placeholder:"0–100",className:"text-sm"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Investigation Data (JSON)"}),r.jsx(u4e,{value:i.investigationObject,onChange:f=>o(m=>({...m,investigationObject:f}))})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 px-5 py-4 border-t shrink-0",children:[r.jsx(de,{variant:"outline",onClick:s,children:"Cancel"}),r.jsxs(de,{onClick:d,disabled:l||!i.investigationKey,className:"gap-2",children:[l?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Tn,{className:"w-4 h-4"}),a?"Add":"Save"]})]})]})})}function h4e(){const e=Ca(),n=new URLSearchParams(window.location.search).get("user_email"),[s,a]=h.useState(null),[i,o]=h.useState(null),[l,c]=h.useState(null),[d,f]=h.useState([]),[m,g]=h.useState(!0),[x,j]=h.useState(!1),[b,y]=h.useState(!1),[w,_]=h.useState(""),[N,C]=h.useState(""),[k,S]=h.useState(""),[A,T]=h.useState(""),[R,B]=h.useState(!1),[D,P]=h.useState(""),[I,z]=h.useState(!1),[L,H]=h.useState(null),[W,V]=h.useState("");h.useEffect(()=>{K()},[]);async function K(){g(!0);const X=await Y.auth.me();a(X);const ie=n||X.email;if(V(ie),n&&n!==X.email){const ce=(await Y.entities.User.list()).find(le=>le.email===n);o(ce||{email:n,full_name:n})}else o(X);await M(ie),g(!1)}async function M(X){const[ie,Z]=await Promise.all([Y.entities.UserProfile.filter({user_email:X}),Y.entities.UserInvestigation.filter({user_email:X})]);if(ie.length>0){const ce=ie[0];c(ce),_(ce.exhibitionName||""),C(ce.photo||""),S(ce.bio||""),T(ce.summary||"")}f(Z)}async function G(X){var ce;const ie=(ce=X.target.files)==null?void 0:ce[0];if(!ie)return;B(!0);const{file_url:Z}=await Y.integrations.Core.UploadFile({file:ie});C(Z),B(!1)}async function q(){j(!0);const ie={user_email:n||s.email,exhibitionName:w,photo:N,bio:k,summary:A};if(l!=null&&l.id)await Y.entities.UserProfile.update(l.id,ie);else{const Z=await Y.entities.UserProfile.create(ie);c(Z)}j(!1),y(!0),setTimeout(()=>y(!1),2e3)}async function F(){z(!0);const X=d.map(Z=>({key:Z.investigationKey,name:Z.investigationName||Z.investigationKey,type:Z.type,data:Z.investigationObject})),ie=await Y.integrations.Core.InvokeLLM({prompt:`You are writing a professional summary for a user profile.
1081
1082User name: ${(i==null?void 0:i.full_name)||W}
1083User email: ${W}
1084Bio: ${k||"(not provided)"}
1085
1086Investigation data collected about this user:
1087${JSON.stringify(X,null,2)}
1088
1089Additional instructions from the requester: ${D||"Write a concise, insightful summary."}
1090
1091Write a clear, professional summary paragraph (3-6 sentences) that synthesizes the user's profile and investigation data. Return only the summary text, no preamble.`});T(typeof ie=="string"?ie:(ie==null?void 0:ie.summary)||(ie==null?void 0:ie.text)||""),z(!1)}async function U(X){confirm(`Delete investigation record "${X.investigationName||X.investigationKey}"?`)&&(await Y.entities.UserInvestigation.delete(X.id),await M(W))}async function ee(){H(null),await M(W)}if(m)return r.jsxs("div",{className:"p-8 text-center text-gray-400",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading..."]});const ne=w||(i==null?void 0:i.full_name)||(i==null?void 0:i.email);return r.jsxs("div",{className:"p-6 w-full",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n&&r.jsx("button",{onClick:()=>e(yt("UsersManagement")),className:"text-gray-400 hover:text-gray-700",children:r.jsx(or,{className:"w-5 h-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900 truncate",children:ne}),r.jsx("p",{className:"text-sm text-gray-500 truncate",children:i==null?void 0:i.email})]}),r.jsxs(de,{className:"gap-2",onClick:q,disabled:x,children:[x?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Ar,{className:"w-4 h-4"}),b?"Saved!":"Save Profile"]})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsx("div",{className:"lg:col-span-1",children:r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-gray-400",children:"Profile Info"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"relative w-16 h-16 rounded-full overflow-hidden border-2 border-gray-200 bg-gray-100 flex items-center justify-center shrink-0",children:[N?r.jsx("img",{src:N,alt:"profile",className:"w-full h-full object-cover"}):r.jsx(Ci,{className:"w-7 h-7 text-gray-400"}),r.jsxs("label",{className:"absolute inset-0 bg-black/30 flex items-center justify-center cursor-pointer opacity-0 hover:opacity-100 transition-opacity rounded-full",children:[R?r.jsx(Pe,{className:"w-4 h-4 text-white animate-spin"}):r.jsx(dZ,{className:"w-4 h-4 text-white"}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:G})]})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Exhibition Name"}),r.jsx(It,{value:w,onChange:X=>_(X.target.value),placeholder:(i==null?void 0:i.full_name)||(i==null?void 0:i.email)||"Display name..."}),r.jsx("p",{className:"text-[10px] text-gray-400 mt-0.5",children:"Falls back to account name if empty."})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 block",children:"Bio"}),r.jsx(rr,{value:k,onChange:X=>S(X.target.value),placeholder:"Write a short bio...",className:"min-h-[100px] text-sm"})]}),r.jsxs("div",{className:"space-y-2 border-t pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yn,{className:"w-4 h-4 text-violet-500"}),r.jsx("label",{className:"text-xs font-medium text-gray-500 block",children:"AI Summary"})]}),r.jsx(rr,{value:A,onChange:X=>T(X.target.value),placeholder:"AI-generated or manually written summary...",className:"min-h-[100px] text-sm"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{value:D,onChange:X=>P(X.target.value),placeholder:"Instructions for AI (optional)...",className:"text-xs flex-1",onKeyDown:X=>X.key==="Enter"&&F()}),r.jsxs(de,{size:"sm",onClick:F,disabled:I,className:"gap-1.5 shrink-0 bg-violet-600 hover:bg-violet-700",children:[I?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Yn,{className:"w-3.5 h-3.5"}),I?"Generating...":"AI Generate"]})]}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"AI uses the investigation data + bio to write a summary. You can edit it freely after."})]})]})}),r.jsx("div",{className:"lg:col-span-2",children:r.jsxs("div",{className:"bg-white border rounded-2xl p-6",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(si,{className:"w-4 h-4 text-violet-500"}),r.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-gray-400",children:"Investigation Records"}),r.jsx("span",{className:"text-xs bg-gray-100 text-gray-500 px-2 py-0.5 rounded-full",children:d.length}),r.jsxs(de,{size:"sm",variant:"outline",className:"ml-auto gap-1.5 h-7 text-xs",onClick:()=>H({}),children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," Add"]})]}),d.length===0?r.jsxs("div",{className:"text-center py-12 border-2 border-dashed rounded-xl text-gray-400",children:[r.jsx(si,{className:"w-8 h-8 mx-auto mb-2 opacity-30"}),r.jsx("p",{className:"text-sm",children:"No investigation data yet."}),r.jsx("p",{className:"text-xs mt-1",children:"Data appears here as the user completes investigation conversations."}),r.jsxs(de,{size:"sm",variant:"outline",className:"mt-3 gap-1.5",onClick:()=>H({}),children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," Add manually"]})]}):r.jsx("div",{className:"space-y-2",children:d.map(X=>r.jsx(m4e,{record:X,onEdit:ie=>H(ie),onDelete:U},X.id))})]})})]}),L!==null&&r.jsx(f4e,{record:L,userEmail:W,onSave:ee,onClose:()=>H(null)})]})}function p4e(){const[e,t]=h.useState(null),[n,s]=h.useState([]),[a,i]=h.useState(!0),[o,l]=h.useState(null),c=Ca();h.useEffect(()=>{d()},[]);async function d(){const g=await Y.auth.me();if(t(g),!(g!=null&&g.is_manager)){i(!1);return}const x=await Y.entities.User.list();s(x),i(!1)}async function f(g){l(g.id),await Y.entities.User.update(g.id,{is_manager:!g.is_manager}),s(x=>x.map(j=>j.id===g.id?{...j,is_manager:!j.is_manager}:j)),l(null)}function m(g){c(yt(`UserProfile?user_email=${encodeURIComponent(g.email)}`))}return a?r.jsxs("div",{className:"p-8 text-center text-gray-400",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading..."]}):e!=null&&e.is_manager?r.jsxs("div",{className:"p-6 max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-50 flex items-center justify-center",children:r.jsx(eg,{className:"w-5 h-5 text-emerald-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Users Management"}),r.jsxs("p",{className:"text-sm text-gray-500",children:[n.length," users"]})]})]}),r.jsx("div",{className:"space-y-2",children:n.map(g=>r.jsxs("div",{className:"flex items-center gap-3 border rounded-lg px-4 py-3 bg-white hover:bg-gray-50 transition-colors",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-100 flex items-center justify-center text-sm font-medium text-gray-600",children:(g.full_name||g.email||"?")[0].toUpperCase()}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-gray-900 truncate",children:g.full_name||g.email}),r.jsx("div",{className:"text-xs text-gray-400 truncate",children:g.email})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[g.is_manager&&r.jsxs("span",{className:"text-xs bg-emerald-50 text-emerald-700 border border-emerald-200 px-2 py-0.5 rounded-full flex items-center gap-1",children:[r.jsx(M0,{className:"w-3 h-3"}),"Manager"]}),r.jsxs(de,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>m(g),children:[r.jsx(Gz,{className:"w-3 h-3 mr-1"})," Profile"]}),r.jsx(de,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:o===g.id||g.id===e.id,onClick:()=>f(g),children:o===g.id?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):g.is_manager?"Remove Manager":"Make Manager"})]})]},g.id))})]}):r.jsxs("div",{className:"p-8 text-center text-gray-400",children:[r.jsx(M0,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"Access restricted to managers only."})]})}const N5=[{label:"Functional V1",page:"LearningV3"},{label:"Wireframe V1",page:"Learning"},{label:"Wireframe V2",page:"LearningV2"}],zB=[{label:"Learning",page:null,icon:zn,submenu:N5},{label:"Assistants",page:"Assistants",icon:Vn},{label:"Conversations",page:"ConversationsExplorer",icon:Br},{label:"Knowledge Bases",page:"KnowledgeBases",icon:_n},{label:"Profile",page:"UserProfile",icon:Gz},{label:"Investigations",page:"Investigations",icon:ur},{label:"Quality Assurance",page:"QualityAssurance",icon:Fm,managerOnly:!0},{label:"Users",page:"UsersManagement",icon:eg,managerOnly:!0},{label:"Settings",page:"Settings",icon:Zp,managerOnly:!0}];function g4e({currentPageName:e}){const[t,n]=h.useState(!1),s=h.useRef(null),a=N5.some(i=>i.page===e);return h.useEffect(()=>{function i(o){s.current&&!s.current.contains(o.target)&&n(!1)}return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[]),r.jsxs("div",{className:"relative",ref:s,children:[r.jsxs("button",{onClick:()=>n(i=>!i),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors
1092          ${a?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-500 hover:bg-gray-100"}`,children:[r.jsx(zn,{className:"w-3.5 h-3.5"}),"Learning",r.jsx(gt,{className:`w-3 h-3 transition-transform ${t?"rotate-180":""}`})]}),t&&r.jsx("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-200 rounded-xl shadow-lg z-50 py-1 min-w-[160px]",children:N5.map(i=>r.jsx(wt,{to:yt(i.page),onClick:()=>n(!1),children:r.jsx("button",{className:`w-full text-left px-4 py-2 text-sm transition-colors
1093                ${e===i.page?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-50"}`,children:i.label})},i.page))})]})}function x4e({children:e,currentPageName:t}){const[n,s]=h.useState(!1),[a,i]=h.useState(!1);return h.useState(()=>{Y.auth.me().then(o=>i(!!(o!=null&&o.is_manager))).catch(()=>{})}),r.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50",children:[r.jsx("style",{children:`
1094        :root {
1095          --primary: 238 84% 60%;
1096          --primary-foreground: 0 0% 100%;
1097        }
1098      `}),r.jsxs("header",{className:"bg-white border-b px-4 py-2.5 flex items-center gap-3 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2 font-bold text-indigo-700 mr-4",children:[r.jsx(si,{className:"w-5 h-5"}),r.jsx("span",{className:"text-sm tracking-wide",children:"AI RAG - PoC"})]}),r.jsx("nav",{className:"hidden xl:flex gap-1 flex-1",children:zB.filter(o=>!o.managerOnly||a).map(({label:o,page:l,icon:c,submenu:d})=>{if(d)return r.jsx(g4e,{currentPageName:t},"Learning");const f=t===l;return r.jsx(wt,{to:yt(l),children:r.jsxs("button",{className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm transition-colors
1099                  ${f?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-500 hover:bg-gray-100"}`,children:[r.jsx(c,{className:"w-3.5 h-3.5"}),o]})},l)})}),r.jsx("div",{className:"flex-1 flex justify-end xl:hidden",children:r.jsx("button",{onClick:()=>s(o=>!o),className:"p-2 rounded-lg text-gray-500 hover:bg-gray-100 transition-colors",children:n?r.jsx(jt,{className:"w-5 h-5"}):r.jsx(Uee,{className:"w-5 h-5"})})})]}),n&&r.jsx("div",{className:"xl:hidden bg-white border-b shadow-sm px-4 py-3 space-y-1",children:zB.filter(o=>!o.managerOnly||a).map(({fullLabel:o,label:l,page:c,icon:d,submenu:f})=>{if(f)return f.map(g=>r.jsx(wt,{to:yt(g.page),onClick:()=>s(!1),children:r.jsxs("button",{className:`w-full flex items-center gap-2.5 px-3 py-2.5 rounded-lg text-sm transition-colors
1100                    ${t===g.page?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,children:[r.jsx(zn,{className:"w-4 h-4"}),"Learning · ",g.label]})},g.page));const m=t===c;return r.jsx(wt,{to:yt(c),onClick:()=>s(!1),children:r.jsxs("button",{className:`w-full flex items-center gap-2.5 px-3 py-2.5 rounded-lg text-sm transition-colors
1101                  ${m?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,children:[r.jsx(d,{className:"w-4 h-4"}),o||l]})},c)})}),r.jsx("main",{className:"flex-1 overflow-y-auto flex flex-col pb-20 xl:pb-0",children:e})]})}const y4e={AssistantForm:Gce,AssistantSessions:She,Assistants:VEe,Chat:WEe,ConversationDetail:GEe,ConversationsExplorer:lAe,InvestigationEdit:dAe,InvestigationTest:bAe,Investigations:wAe,KnowledgeBaseDetail:sOe,KnowledgeBases:fOe,Learning:MOe,LearningV2:bI,NewKnowledgeBase:BOe,QualityAssurance:zOe,EmbeddingTests:xW,SearchTrace:n4e,Settings:a4e,TestSets:c4e,UserProfile:h4e,UsersManagement:p4e,ShellTest:rq,LearningV3:bI},b4e={mainPage:"KnowledgeBases",Pages:y4e,Layout:x4e};function v4e({}){var a;const t=Ud().pathname.substring(1),{data:n,isFetched:s}=Dre({queryKey:["user"],queryFn:async()=>{try{return{user:await Y.auth.me(),isAuthenticated:!0}}catch{return{user:null,isAuthenticated:!1}}}});return r.jsx("div",{className:"min-h-screen flex items-center justify-center p-6 bg-slate-50",children:r.jsx("div",{className:"max-w-md w-full",children:r.jsxs("div",{className:"text-center space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-7xl font-light text-slate-300",children:"404"}),r.jsx("div",{className:"h-0.5 w-16 bg-slate-200 mx-auto"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h2",{classNa
1101me:"text-2xl font-medium text-slate-800",children:"Page Not Found"}),r.jsxs("p",{className:"text-slate-600 leading-relaxed",children:["The page ",r.jsxs("span",{className:"font-medium text-slate-700",children:['"',t,'"']})," could not be found in this application."]})]}),s&&n.isAuthenticated&&((a=n.user)==null?void 0:a.role)==="admin"&&r.jsx("div",{className:"mt-8 p-4 bg-slate-100 rounded-lg border border-slate-200",children:r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-orange-100 flex items-center justify-center mt-0.5",children:r.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-400"})}),r.jsxs("div",{className:"text-left space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-slate-700",children:"Admin Note"}),r.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:"This could mean that the AI hasn't implemented this page yet. Ask it to implement it in the chat."})]})]})}),r.jsx("div",{className:"pt-6",children:r.jsxs("button",{onClick:()=>window.location.href="/",className:"inline-flex items-center px-4 py-2 text-sm font-medium text-slate-700 bg-white border border-slate-200 rounded-lg hover:bg-slate-50 hover:border-slate-300 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-slate-500",children:[r.jsx("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})}),"Go Home"]})})]})})})}const yW=h.createContext(),w4e=({children:e})=>{const[t,n]=h.useState(null),[s,a]=h.useState(!1),[i,o]=h.useState(!0),[l,c]=h.useState(!0),[d,f]=h.useState(null),[m,g]=h.useState(null);h.useEffect(()=>{x()},[]);const x=async()=>{var w,_;try{c(!0),f(null);const N=Tu({baseURL:"/api/apps/public",headers:{"X-App-Id":rd.appId},token:rd.token,interceptResponses:!0});try{const C=await N.get(`/prod/public-settings/by-id/${rd.appId}`);g(C),rd.token?await j():(o(!1),a(!1)),c(!1)}catch(C){if(console.error("App state check failed:",C),C.status===403&&((_=(w=C.data)==null?void 0:w.extra_data)!=null&&_.reason)){const k=C.data.extra_data.reason;f(k==="auth_required"?{type:"auth_required",message:"Authentication required"}:k==="user_not_registered"?{type:"user_not_registered",message:"User not registered for this app"}:{type:k,message:C.message})}else f({type:"unknown",message:C.message||"Failed to load app"});c(!1),o(!1)}}catch(N){console.error("Unexpected error:",N),f({type:"unknown",message:N.message||"An unexpected error occurred"}),c(!1),o(!1)}},j=async()=>{try{o(!0);const w=await Y.auth.me();n(w),a(!0),o(!1)}catch(w){console.error("User auth check failed:",w),o(!1),a(!1),(w.status===401||w.status===403)&&f({type:"auth_required",message:"Authentication required"})}},b=(w=!0)=>{n(null),a(!1),w?Y.auth.logout(window.location.href):Y.auth.logout()},y=()=>{Y.auth.redirectToLogin(window.location.href)};return r.jsx(yW.Provider,{value:{user:t,isAuthenticated:s,isLoadingAuth:i,isLoadingPublicSettings:l,authError:d,appPublicSettings:m,logout:b,navigateToLogin:y,checkAppState:x},children:e})},j4e=()=>{const e=h.useContext(yW);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},_4e=()=>r.jsx("div",{className:"flex flex-col items-center justify-center min-h-screen bg-gradient-to-b from-white to-slate-50",children:r.jsx("div",{className:"max-w-md w-full p-8 bg-white rounded-lg shadow-lg border border-slate-100",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-6 rounded-full bg-orange-100",children:r.jsx("svg",{className:"w-8 h-8 text-orange-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),r.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-4",children:"Access Restricted"}),r.jsx("p",{className:"text-slate-600 mb-8",children:"You are not registered to use this application. Please contact the app administrator to request access."}),r.jsxs("div",{className:"p-4 bg-slate-50 rounded-md text-sm text-slate-600",children:[r.jsx("p",{children:"If you believe this is an error, you can:"}),r.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[r.jsx("li",{children:"Verify you are logged in with the correct account"}),r.jsx("li",{children:"Contact the app administrator for access"}),r.jsx("li",{children:"Try logging out and back in again"})]})]})]})})}),N4e=()=>r.jsx("div",{className:"fixed inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-8 h-8 border-4 border-slate-200 border-t-slate-800 rounded-full animate-spin"})});function S4e({fallback:e=r.jsx(N4e,{}),unauthenticatedElement:t}){const{isAuthenticated:n,isLoadingAuth:s,authError:a}
1101=j4e();return s?e:a?a.type==="user_not_registered"?r.jsx(_4e,{}):t:n?r.jsx(Fle,{}):t}function Om({icon:e,title:t,subtitle:n,footer:s,children:a}){return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsxs("div",{className:"text-center mb-10",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-2xl bg-primary mb-4",children:r.jsx(e,{className:"w-7 h-7 text-primary-foreground","aria-hidden":"true"})}),r.jsx("h1",{className:"text-3xl font-bold tracking-tight text-foreground",children:t}),n&&r.jsx("p",{className:"text-muted-foreground mt-2",children:n})]}),r.jsx("div",{className:"bg-card rounded-2xl shadow-sm border border-border p-8",children:a}),s&&r.jsx("p",{className:"text-center text-sm text-muted-foreground mt-6",children:s})]})})}function bW({className:e="w-5 h-5"}){return r.jsxs("svg",{className:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[r.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),r.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),r.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})}function bh(){const e=new URLSearchParams(window.location.search).get("returnTo");if(!e)return"/";try{const t=new URL(e,window.location.origin);if(t.origin!==window.location.origin)return"/";for(const s of["access_token","clear_access_token","app_id","app_base_url","functions_version","from_url"])t.searchParams.delete(s);const n=t.pathname+t.search;return!n.startsWith("/")||n.startsWith("//")||n.includes("\\")?"/":n}catch{return"/"}}function k4e(){const[e,t]=h.useState(""),[n,s]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(!1),c=bh(),d=async m=>{m.preventDefault(),i(""),l(!0);try{await Y.auth.loginViaEmailPassword(e,n),window.location.href=c}catch(g){i(g.message||"Invalid email or password")}finally{l(!1)}},f=()=>{Y.auth.loginWithProvider("google",c)};return r.jsxs(Om,{icon:$ee,title:"Welcome back",subtitle:"Log in to your account",footer:r.jsxs(r.Fragment,{children:["Don't have an account?"," ",r.jsx(wt,{to:"/register"+(c!=="/"?"?returnTo="+encodeURIComponent(c):""),className:"text-primary font-medium hover:underline",children:"Create one"})]}),children:[r.jsxs(de,{variant:"outline",className:"w-full h-12 text-sm font-medium mb-6",onClick:f,children:[r.jsx(bW,{className:"w-5 h-5 mr-2"}),"Continue with Google"]}),r.jsxs("div",{className:"relative mb-6",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("div",{className:"w-full border-t border-border"})}),r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-card px-3 text-muted-foreground",children:"or"})})]}),a&&r.jsx("div",{className:"mb-4 p-3 rounded-lg bg-destructive/10 text-destructive text-sm",children:a}),r.jsxs("form",{onSubmit:d,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{htmlFor:"email",children:"Email"}),r.jsxs("div",{className:"relative",children:[r.jsx(Dh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),r.jsx(It,{id:"email",type:"email",autoComplete:"email",autoFocus:!0,placeholder:"[email protected]",value:e,onChange:m=>t(m.target.value),className:"pl-10 h-12",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ot,{htmlFor:"password",children:"Password"}),r.jsx(wt,{to:"/forgot-password",className:"text-xs text-primary hover:underline",children:"Forgot password?"})]}),r.jsxs("div",{className:"relative",children:[r.jsx(xd,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),r.jsx(It,{id:"password",type:"password",autoComplete:"current-password",placeholder:"••••••••",value:n,onChange:m=>s(m.target.value),className:"pl-10 h-12",required:!0})]})]}),r.jsx(de,{type:"submit",className:"w-full h-12 font-medium",disabled:o,children:o?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 mr-2 animate-spin"}),"Logging in..."]}):"Log in"})]})]})}var C4e=Object.defineProperty,E4e=Object.defineProperties,A4e=Object.getOwnPropertyDescriptors,ib=Object.getOwnPropertySymbols,vW=Object.prototype.hasOwnProperty,wW=Object.prototype.propertyIsEnumerable,UB=(e,t,n)=>t in e?C4e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T4e=(e,t)=>
1101{for(var n in t||(t={}))vW.call(t,n)&&UB(e,n,t[n]);if(ib)for(var n of ib(t))wW.call(t,n)&&UB(e,n,t[n]);return e},P4e=(e,t)=>E4e(e,A4e(t)),O4e=(e,t)=>{var n={};for(var s in e)vW.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&ib)for(var s of ib(e))t.indexOf(s)<0&&wW.call(e,s)&&(n[s]=e[s]);return n};function I4e(e){let t=setTimeout(e,0),n=setTimeout(e,10),s=setTimeout(e,50);return[t,n,s]}function R4e(e){let t=h.useRef();return h.useEffect(()=>{t.current=e}),t.current}var M4e=18,jW=40,D4e=`${jW}px`,L4e=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function $4e({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:s}){let[a,i]=h.useState(!1),[o,l]=h.useState(!1),[c,d]=h.useState(!1),f=h.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&a&&o,[a,o,n]),m=h.useCallback(()=>{let g=e.current,x=t.current;if(!g||!x||c||n==="none")return;let j=g,b=j.getBoundingClientRect().left+j.offsetWidth,y=j.getBoundingClientRect().top+j.offsetHeight/2,w=b-M4e,_=y;document.querySelectorAll(L4e).length===0&&document.elementFromPoint(w,_)===g||(i(!0),d(!0))},[e,t,c,n]);return h.useEffect(()=>{let g=e.current;if(!g||n==="none")return;function x(){let b=window.innerWidth-g.getBoundingClientRect().right;l(b>=jW)}x();let j=setInterval(x,1e3);return()=>{clearInterval(j)}},[e,n]),h.useEffect(()=>{let g=s||document.activeElement===t.current;if(n==="none"||!g)return;let x=setTimeout(m,0),j=setTimeout(m,2e3),b=setTimeout(m,5e3),y=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(x),clearTimeout(j),clearTimeout(b),clearTimeout(y)}},[t,s,n,m]),{hasPWMBadge:a,willPushPWMBadge:f,PWM_BADGE_SPACE_WIDTH:D4e}}var _W=h.createContext({}),NW=h.forwardRef((e,t)=>{var n=e,{value:s,onChange:a,maxLength:i,textAlign:o="left",pattern:l,placeholder:c,inputMode:d="numeric",onComplete:f,pushPasswordManagerStrategy:m="increase-width",pasteTransformer:g,containerClassName:x,noScriptCSSFallback:j=B4e,render:b,children:y}=n,w=O4e(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),_,N,C,k,S;let[A,T]=h.useState(typeof w.defaultValue=="string"?w.defaultValue:""),R=s??A,B=R4e(R),D=h.useCallback(Ne=>{a==null||a(Ne),T(Ne)},[a]),P=h.useMemo(()=>l?typeof l=="string"?new RegExp(l):l:null,[l]),I=h.useRef(null),z=h.useRef(null),L=h.useRef({value:R,onChange:D,isIOS:typeof window<"u"&&((N=(_=window==null?void 0:window.CSS)==null?void 0:_.supports)==null?void 0:N.call(_,"-webkit-touch-callout","none"))}),H=h.useRef({prev:[(C=I.current)==null?void 0:C.selectionStart,(k=I.current)==null?void 0:k.selectionEnd,(S=I.current)==null?void 0:S.selectionDirection]});h.useImperativeHandle(t,()=>I.current,[]),h.useEffect(()=>{let Ne=I.current,Oe=z.current;if(!Ne||!Oe)return;L.current.value!==Ne.value&&L.current.onChange(Ne.value),H.current.prev=[Ne.selectionStart,Ne.selectionEnd,Ne.selectionDirection];function Me(){if(document.activeElement!==Ne){q(null),U(null);return}let Xe=Ne.selectionStart,te=Ne.selectionEnd,De=Ne.selectionDirection,_e=Ne.maxLength,We=Ne.value,tt=H.current.prev,me=-1,ae=-1,Se;if(We.length!==0&&Xe!==null&&te!==null){let ze=Xe===te,fe=Xe===We.length&&We.length<_e;if(ze&&!fe){let dt=Xe;if(dt===0)me=0,ae=1,Se="forward";
1101else if(dt===_e)me=dt-1,ae=dt,Se="backward";else if(_e>1&&We.length>1){let ct=0;if(tt[0]!==null&&tt[1]!==null){Se=dt<tt[1]?"backward":"forward";let Wt=tt[0]===tt[1]&&tt[0]<_e;Se==="backward"&&!Wt&&(ct=-1)}me=ct+dt,ae=ct+dt+1}}me!==-1&&ae!==-1&&me!==ae&&I.current.setSelectionRange(me,ae,Se)}let Le=me!==-1?me:Xe,He=ae!==-1?ae:te,ut=Se??De;q(Le),U(He),H.current.prev=[Le,He,ut]}if(document.addEventListener("selectionchange",Me,{capture:!0}),Me(),document.activeElement===Ne&&M(!0),!document.getElementById("input-otp-style")){let Xe=document.createElement("style");if(Xe.id="input-otp-style",document.head.appendChild(Xe),Xe.sheet){let te="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";oh(Xe.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),oh(Xe.sheet,`[data-input-otp]:autofill { ${te} }`),oh(Xe.sheet,`[data-input-otp]:-webkit-autofill { ${te} }`),oh(Xe.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),oh(Xe.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let ue=()=>{Oe&&Oe.style.setProperty("--root-height",`${Ne.clientHeight}px`)};ue();let Ve=new ResizeObserver(ue);return Ve.observe(Ne),()=>{document.removeEventListener("selectionchange",Me,{capture:!0}),Ve.disconnect()}},[]);let[W,V]=h.useState(!1),[K,M]=h.useState(!1),[G,q]=h.useState(null),[F,U]=h.useState(null);h.useEffect(()=>{I4e(()=>{var Ne,Oe,Me,ue;(Ne=I.current)==null||Ne.dispatchEvent(new Event("input"));let Ve=(Oe=I.current)==null?void 0:Oe.selectionStart,Xe=(Me=I.current)==null?void 0:Me.selectionEnd,te=(ue=I.current)==null?void 0:ue.selectionDirection;Ve!==null&&Xe!==null&&(q(Ve),U(Xe),H.current.prev=[Ve,Xe,te])})},[R,K]),h.useEffect(()=>{B!==void 0&&R!==B&&B.length<i&&R.length===i&&(f==null||f(R))},[i,f,B,R]);let ee=$4e({containerRef:z,inputRef:I,pushPasswordManagerStrategy:m,isFocused:K}),ne=h.useCallback(Ne=>{let Oe=Ne.currentTarget.value.slice(0,i);if(Oe.length>0&&P&&!P.test(Oe)){Ne.preventDefault();return}typeof B=="string"&&Oe.length<B.length&&document.dispatchEvent(new Event("selectionchange")),D(Oe)},[i,D,B,P]),X=h.useCallback(()=>{var Ne;if(I.current){let Oe=Math.min(I.current.value.length,i-1),Me=I.current.value.length;(Ne=I.current)==null||Ne.setSelectionRange(Oe,Me),q(Oe),U(Me)}M(!0)},[i]),ie=h.useCallback(Ne=>{var Oe,Me;let ue=I.current;if(!g&&(!L.current.isIOS||!Ne.clipboardData||!ue))return;let Ve=Ne.clipboardData.getData("text/plain"),Xe=g?g(Ve):Ve;Ne.preventDefault();let te=(Oe=I.current)==null?void 0:Oe.selectionStart,De=(Me=I.current)==null?void 0:Me.selectionEnd,_e=(te!==De?R.slice(0,te)+Xe+R.slice(De):R.slice(0,te)+Xe+R.slice(te)).slice(0,i);if(_e.length>0&&P&&!P.test(_e))return;ue.value=_e,D(_e);let We=Math.min(_e.length,i-1),tt=_e.length;ue.setSelectionRange(We,tt),q(We),U(tt)},[i,D,P,R]),Z=h.useMemo(()=>({position:"relative",cursor:w.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[w.disabled]),ce=h.useMemo(()=>({position:"absolute",inset:0,width:ee.willPushPWMBadge?`calc(100% + ${ee.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:ee.willPushPWMBadge?`inset(0 ${ee.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[ee.PWM_BADGE_SPACE_WIDTH,ee.willPushPWMBadge,o]),le=h.useMemo(()=>h.createElement("input",P4e(T4e({autoComplete:w.autoComplete||"one-time-code"},w),{"data-input-otp":!0,"data-input-otp-placeholder-shown":R.length===0||void 0,"data-input-otp-mss":G,"data-input-otp-mse":F,inputMode:d,pattern:P==null?void 0:P.source,"aria-placeholder":c,style:ce,maxLength:i,value:R,ref:I,onPaste:Ne=>{var Oe;ie(Ne),(Oe=w.onPaste)==null||Oe.call(w,Ne)},onChange:ne,onMouseOver:Ne=>{var Oe;V(!0),(Oe=w.onMouseOver)==null||Oe.call(w,Ne)},onMouseLeave:Ne=>{var Oe;V(!1),(Oe=w.onMouseLeave)==null||Oe.call(w,Ne)},onFocus:Ne=>{var Oe;X(),(Oe=w.onFocus)==null||Oe.call(w,Ne)},onBlur:Ne=>{var Oe;M(!1),(Oe=w.onBlur)==null||Oe.call(w,Ne)}})),[ne,X,ie,d,ce,i,F,G,w,P==null?void 0:P.source,R]),re=h.useMemo(()=>({slots:Array.from({length:i}).map((Ne,Oe)=>{var Me;let ue=K&&G!==null&&F!==null&&(G===F&&Oe===G||Oe>=G&&Oe<F),Ve=R[Oe]!==void 0?R[Oe]:null,Xe=R[0]!==void 0?null:(Me=c==null?void 0:c[Oe])!=null?Me:null;return{char:Ve,placeholderChar:Xe,isActive:ue,hasFakeCaret:ue&&Ve===null}}),isFocused:K,isHovering:!w.disabled&&W}),[K,W,i,F,G,w.disabled,R]),Ue=h.useMemo(()=>b?b(re):h.createElement(_W.Provider,{value:re},y),[y,re,b]);return h.createElement(h.Fragment,null,j!==null&&h.createElement("noscript",null,h.createElement("style",null,j)),h.createElement("div",{ref:z,"data-input-otp-container":!0,style:Z,className:x},Ue,h.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},le)))});NW.displayName="Input";function oh(e,t){try{e.insertRule(t)}catch{console.error("input-otp could not insert CSS rule:",t)}}var B4e=`
1102[data-input-otp] {
1103  --nojs-bg: white !important;
1104  --nojs-fg: black !important;
1105
1106  background-color: var(--nojs-bg) !important;
1107  color: var(--nojs-fg) !important;
1108  caret-color: var(--nojs-fg) !important;
1109  letter-spacing: .25em !important;
1110  text-align: center !important;
1111  border: 1px solid var(--nojs-fg) !important;
1112  border-radius: 4px !important;
1113  width: 100% !important;
1114}
1115@media (prefers-color-scheme: dark) {
1116  [data-input-otp] {
1117    --nojs-bg: black !important;
1118    --nojs-fg: white !important;
1119  }
1120}`;const SW=h.forwardRef(({className:e,containerClassName:t,...n},s)=>r.jsx(NW,{ref:s,containerClassName:rn("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:rn("disabled:cursor-not-allowed",e),...n}));SW.displayName="InputOTP";const kW=h.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:rn("flex items-center",e),...t}));kW.displayName="InputOTPGroup";const Xc=h.forwardRef(({index:e,className:t,...n},s)=>{const a=h.useContext(_W),{char:i,hasFakeCaret:o,isActive:l}=a.slots[e];return r.jsxs("div",{ref:s,className:rn("relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-1 ring-ring",t),...n,children:[i,o&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});Xc.displayName="InputOTPSlot";const F4e=h.forwardRef(({...e},t)=>r.jsx("div",{ref:t,role:"separator",...e,children:r.jsx(Hee,{})}));F4e.displayName="InputOTPSeparator";function z4e(){const[e,t]=h.useState(""),[n,s]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),[f,m]=h.useState(!1),[g,x]=h.useState(""),j=async _=>{if(_.preventDefault(),l(""),n!==a){l("Passwords do not match");return}d(!0);try{await Y.auth.register({email:e,password:n}),m(!0)}catch(N){l(N.message||"Registration failed")}finally{d(!1)}},b=async()=>
1120{l(""),d(!0);try{const _=await Y.auth.verifyOtp({email:e,otpCode:g});_!=null&&_.access_token&&Y.auth.setToken(_.access_token),window.location.href=bh()}catch(_){l(_.message||"Invalid verification code")}finally{d(!1)}},y=async()=>{l("");try{await Y.auth.resendOtp(e),yz({title:"Code sent",description:"Check your email for the new code."})}catch(_){l(_.message||"Failed to resend code")}},w=()=>{Y.auth.loginWithProvider("google",bh())};return f?r.jsxs(Om,{icon:Dh,title:"Verify your email",subtitle:`We sent a code to ${e}`,children:[o&&r.jsx("div",{className:"mb-4 p-3 rounded-lg bg-destructive/10 text-destructive text-sm",children:o}),r.jsx("div",{className:"flex justify-center mb-6",children:r.jsx(SW,{maxLength:6,value:g,onChange:x,autoFocus:!0,autoComplete:"one-time-code",children:r.jsxs(kW,{children:[r.jsx(Xc,{index:0}),r.jsx(Xc,{index:1}),r.jsx(Xc,{index:2}),r.jsx(Xc,{index:3}),r.jsx(Xc,{index:4}),r.jsx(Xc,{index:5})]})})}),r.jsx(de,{className:"w-full h-12 font-medium",onClick:b,disabled:c||g.length<6,children:c?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify"}),r.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-4",children:["Didn't receive the code?"," ",r.jsx("button",{onClick:y,className:"text-primary font-medium hover:underline",children:"Resend"})]})]}):r.jsxs(Om,{icon:Yte,title:"Create your account",subtitle:"Sign up to get started",footer:r.jsxs(r.Fragment,{children:["Already have an account?"," ",r.jsx(wt,{to:"/login"+(bh()!=="/"?"?returnTo="+encodeURIComponent(bh()):""),className:"text-primary font-medium hover:underline",children:"Log in"})]}),children:[r.jsxs(de,{variant:"outline",className:"w-full h-12 text-sm font-medium mb-6",onClick:w,children:[r.jsx(bW,{className:"w-5 h-5 mr-2"}),"Continue with Google"]}),r.jsxs("div",{className:"relative mb-6",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("div",{className:"w-full border-t border-border"})}),r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-card px-3 text-muted-foreground",children:"or"})})]}),o&&r.jsx("div",{className:"mb-4 p-3 rounded-lg bg-destructive/10 text-destructive text-sm",children:o}),r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{htmlFor:"email",children:"Email"}),r.jsxs("div",{className:"relative",children:[r.jsx(Dh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),r.jsx(It,{id:"email",type:"email",autoComplete:"email",autoFocus:!0,placeholder:"[email protected]",value:e,onChange:_=>t(_.target.value),className:"pl-10 h-12",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(xd,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),r.jsx(It,{id:"password",type:"password",autoComplete:"new-password",placeholder:"••••••••",value:n,onChange:_=>s(_.target.value),className:"pl-10 h-12",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{htmlFor:"confirm",children:"Confirm Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(xd,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),r.jsx(It,{id:"confirm",type:"password",autoComplete:"new-password",placeholder:"••••••••",value:a,onChange:_=>i(_.target.value),className:"pl-10 h-12",required:!0})]})]}),r.jsx(de,{type:"submit",className:"w-full h-12 font-medium",disabled:c,children:c?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating account..."]}):"Create account"})]})]})}function U4e(){const[e,t]=h.useState(""),[n,s]=h.useState(!1),[a,i]=h.useState(!1),o=async l=>{l.preventDefault(),s(!0);try{await Y.auth.resetPasswordRequest(e)}catch{}finally{s(!1),i(!0)}};return r.jsx(Om,{icon:Dh,title:"Reset password",subtitle:"We'll send you a link to reset it",footer:r.jsxs(wt,{to:"/login",className:"text-primary font-medium hover:underline",children:[r.jsx(or,{className:"w-3 h-3 inline mr-1"}),"Back to log in"]}),children:a?r.jsx("p",{className:"text-sm text-foreground text-center",children:"If an account exists with that email, you'll receive a password reset link shortly."}):r.jsxs("form",{onSubmit:o,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{htmlFor:"email",children:"Email address"}),r.jsxs("div",{className:"relative",children:[r.jsx(Dh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),r.jsx(It,{id:"email",type:"email",autoComplete:"email",autoFocus:!0,placeholder:"[email protected]",value:e,onCh
1120ange:l=>t(l.target.value),className:"pl-10 h-12",required:!0})]})]}),r.jsx(de,{type:"submit",className:"w-full h-12 font-medium",disabled:n,children:n?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 mr-2 animate-spin"}),"Sending..."]}):"Send reset link"})]})})}function q4e(){const[e]=FU(),t=e.get("token"),[n,s]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),f=async m=>{if(m.preventDefault(),l(""),n!==a){l("Passwords do not match");return}d(!0);try{await Y.auth.resetPassword({resetToken:t,newPassword:n}),window.location.href="/login"}catch(g){l(g.message||"Failed to reset password")}finally{d(!1)}};return t?r.jsxs(Om,{icon:xd,title:"New password",subtitle:"Enter your new password below",children:[o&&r.jsx("div",{className:"mb-4 p-3 rounded-lg bg-destructive/10 text-destructive text-sm",children:o}),r.jsxs("form",{onSubmit:f,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{htmlFor:"password",children:"New Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(xd,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),r.jsx(It,{id:"password",type:"password",autoComplete:"new-password",autoFocus:!0,placeholder:"••••••••",value:n,onChange:m=>s(m.target.value),className:"pl-10 h-12",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{htmlFor:"confirm",children:"Confirm Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(xd,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),r.jsx(It,{id:"confirm",type:"password",autoComplete:"new-password",placeholder:"••••••••",value:a,onChange:m=>i(m.target.value),className:"pl-10 h-12",required:!0})]})]}),r.jsx(de,{type:"submit",className:"w-full h-12 font-medium",disabled:c,children:c?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 mr-2 animate-spin"}),"Resetting..."]}):"Reset password"})]})]}):r.jsx(Om,{icon:Nr,title:"Invalid reset link",subtitle:"This password reset link is missing or invalid",footer:r.jsx(wt,{to:"/forgot-password",className:"text-primary font-medium hover:underline",children:"Request a new link"}),children:r.jsx("p",{className:"text-sm text-foreground text-center",children:"The link you used appears to be incomplete. Please request a new password reset email."})})}function jk({children:e}){return r.jsx("code",{className:"bg-gray-100 border border-gray-200 text-gray-700 rounded px-1.5 py-0.5 text-[11px] font-mono",children:e})}function l0({name:e,params:t}){const[n,s]=h.useState(!1);return r.jsxs("div",{className:"border border-indigo-200 rounded-xl overflow-hidden text-xs",children:[r.jsxs("button",{onClick:()=>s(a=>!a),className:"w-full flex items-center gap-2 px-3 py-2 bg-indigo-50 hover:bg-indigo-100 transition-colors text-left",children:[r.jsx(W5,{className:"w-3.5 h-3.5 text-indigo-400 shrink-0"}),r.jsxs("span",{className:"font-mono font-semibold text-indigo-700 flex-1",children:[e,"(…)"]}),r.jsx("span",{className:"text-indigo-400",children:"params"}),n?r.jsx(gt,{className:"w-3.5 h-3.5 text-indigo-400"}):r.jsx(en,{className:"w-3.5 h-3.5 text-indigo-400"})]}),n&&r.jsx("pre",{className:"bg-indigo-950 text-indigo-200 p-3 text-xs font-mono whitespace-pre-wrap overflow-auto max-h-48",children:JSON.stringify(t,null,2)})]})}function Vc({label:e,content:t,defaultOpen:n=!1,color:s="gray"}){const[a,i]=h.useState(n),o={gray:"bg-gray-900 text-gray-200",yellow:"bg-gray-900 text-yellow-200",cyan:"bg-gray-900 text-cyan-200",green:"bg-gray-900 text-green-300"};return r.jsxs("div",{className:"border rounded-xl overflow-hidden text-xs",children:[r.jsxs("button",{onClick:()=>i(l=>!l),className:"w-full flex items-center gap-2 px-3 py-2 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsx(dr,{className:"w-3.5 h-3.5 text-gray-400"}),r.jsx("span",{className:"font-medium text-gray-600 flex-1",children:e}),a?r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400"}):r.jsx(en,{className:"w-3.5 h-3.5 text-gray-400"})]}),a&&r.jsx("pre",{className:`${o[s]||o.gray} p-3 text-xs font-mono whitespace-pre-wrap overflow-auto max-h-64 leading-relaxed`,children:t})]})}function c0({number:e,icon:t,label:n,sublabel:s,status:a,children:i}){const[o,l]=h.useState(!1),c={idle:"border-gray-200 bg-white",running:"border-indigo-300 bg-indigo-50",done:"border-emerald-300 bg-emerald-50"},d=a||"idle",f=d==="done";return r.jsxs("div",{className:`border-2 rounded-2xl p-4 transition-all ${c[d]}`,children:[r.jsxs("div",{className:"flex items-start gap-3 mb-1",children:[r.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold shrink-0 ${d==="done"?"bg-emerald-500 text-white":d==="running"?"bg-indigo-500 text-white":"bg-gray-200 text-gray-500"}`,children:d==="done"?r.jsx(mr,{className:"w-4 h-4"}):e}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(t,{className:`w-4 h-4 shrink-0 ${d==="done"?"text-emerald-600":d==="running"?"text-indigo-600":"text-gray-400"}`}),r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:n}),d==="running"&&r.jsx("span",{className:"text-xs text-indigo-500 font-medium animate-pulse",children:"● Running…"}),d==="done"&&r.jsx("span",{className:"text-xs text-emerald-600 font-medium",children:"✓ Done"})]}),s&&r.jsx("p",{className:"text-xs text-gray-400 mt-0.5 ml-6",children:s})]}),f&&r.jsxs("button",{onClick:()=>l(m=>!m),className:"text-xs text-gray-400 hover:text-gray-700 flex items-center gap-1 shrink-0 px-2 py-1 rounded-lg hover:bg-white transition-colors",children:[o?r.jsx(en,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"}),o?"Expand":"Collapse"]})]}),i&&d!=="idle"&&!o&&r.jsx("div",{className:"ml-10 space-y-2 mt-3",children:i})]})}const d0=[{key:"master",marker:null,label:"Master System Prompt",source:"AppConfig.master_system_prompt",color:"border-l-violet-400 bg-vi
1120olet-50"},{key:"instructions",marker:"[INSTRUCTIONS]",label:"[INSTRUCTIONS]",source:"Assistant.prompt_instructions",color:"border-l-indigo-400 bg-indigo-50"},{key:"answer",marker:"[ANSWER FORMAT]",label:"[ANSWER FORMAT]",source:"Assistant.prompt_answer",color:"border-l-sky-400 bg-sky-50"},{key:"kb",marker:"Use the following knowledge base content",label:"KB Context Block",source:"semanticSearch() results",color:"border-l-emerald-400 bg-emerald-50"},{key:"data",marker:"[DATA EXTRACTION]",label:"[DATA EXTRACTION]",source:"Assistant.prompt_data_object schema",color:"border-l-amber-400 bg-amber-50"},{key:"history",marker:"[HISTORY] LAST",label:"[HISTORY] LAST <N> MESSAGES",source:"Last N messages from chat history",color:"border-l-pink-400 bg-pink-50"},{key:"user",marker:"[USER]",label:"[USER] Message",source:"Current user query",color:"border-l-gray-400 bg-gray-50"},{key:"closing",marker:"[CLOSING]",label:"[CLOSING] Instruction",source:"AppConfig.closing_instruction",color:"border-l-orange-400 bg-orange-50"},{key:"json",marker:"[JSON INSTRUCTION]",label:"[JSON INSTRUCTION]",source:"Data extraction schema (Assistant.answer_data_node)",color:"border-l-red-400 bg-red-50"}];function K4e({prompt:e}){const[t,n]=h.useState(null);if(!e)return null;const s=[];d0.forEach(o=>{if(!o.marker)return;const l=e.indexOf(o.marker);l!==-1&&s.push({idx:l,def:o})}),s.sort((o,l)=>o.idx-l.idx);const a=[];s.length>0&&s[0].idx>0?a.push({def:d0[0],text:e.slice(0,s[0].idx).trim()}):s.length===0&&a.push({def:d0[0],text:e.trim()}),s.forEach((o,l)=>{const c=l<s.length-1?s[l+1].idx:e.length;a.push({def:o.def,text:e.slice(o.idx,c).trim()})});const i=a.map(o=>o.def.key);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"bg-white border rounded-xl p-3 space-y-1.5",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-500 mb-2",children:"Prompt Sections — click to highlight"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:d0.filter(o=>i.includes(o.key)).map(o=>r.jsx("button",{onClick:()=>n(t===o.key?null:o.key),className:`text-[11px] px-2.5 py-1 rounded-lg border-l-4 border border-gray-200 font-medium transition-all ${o.color} ${t===o.key?"ring-2 ring-offset-1 ring-gray-400 scale-105":"hover:scale-105 opacity-80"}`,children:o.label},o.key))})]}),r.jsx("div",{className:"space-y-2",children:a.map((o,l)=>r.jsxs("div",{className:`border-l-4 rounded-r-xl p-3 transition-all ${o.def.color} ${t&&t!==o.def.key?"opacity-30":""}`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1.5",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-700",children:o.def.label}),r.jsxs("span",{className:"text-[10px] text-gray-400 text-right shrink-0",children:["source: ",r.jsx("em",{children:o.def.source})]})]}),r.jsx("pre",{className:"text-xs text-gray-700 whitespace-pre-wrap font-mono leading-relaxed max-h-48 overflow-auto",children:o.text})]},l))})]})}function V4e(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState([]),[o,l]=h.useState(""),[c,d]=h.useState([]),[f,m]=h.useState(""),[g,x]=h.useState([]),[j,b]=h.useState(""),[y,w]=h.useState(!1),[_,N]=h.useState(!0),[C,k]=h.useState(""),[S,A]=h.useState({assistant:"idle",search:"idle",prompt:"idle",llm:"idle"}),[T,R]=h.useState(null),[B,D]=h.useState(null),[P,I]=h.useState([]),[z,L]=h.useState(null),[H,W]=h.useState(""),[V,K]=h.useState(!1),[M,G]=h.useState(!1),[q,F]=h.useState(!1),[U,ee]=h.useState(""),[ne,X]=h.useState(""),[ie,Z]=h.useState(null),[ce,le]=h.useState(null),[re,Ue]=h.useState(null),[Ne,Oe]=h.useState(null),[Me,ue]=h.useState(null),[Ve,Xe]=h.useState(0);h.useEffect(()=>{if(!o){d([]),m(""),x([]);return}Y.entities.Chat.filter({assistant_id:o},"-started_at",30).then(d),m(""),x([])},[o]),h.useEffect(()=>{if(!f){x([]);return}Y.entities.Message.filter({chat_id:f}).then(me=>{me.sort((ae,Se)=>ae.sent_at>Se.sent_at?1:-1),x(me.map(ae=>({role:ae.role,content:ae.content})))})},[f]),h.useEffect(()=>{Promise.all([Y.entities.Assistant.list(),Y.entities.KnowledgeBase.list(),Y.entities.Investigation.list()]).then(([me,ae,Se])=>{t(me.filter(Le=>Le.status==="active")),s(ae),i(Se)})},[]);function te(me,ae){A(Se=>({...Se,[me]:ae}))}async function De(){var Jn;if(!o||!j.trim())return;w(!0),A({assistant:"idle",search:"idle",prompt:"idle",llm:"idle"}),R(null),D(null),I([]),L(null),W(""),ee(""),X(""),Z(null),le(null),Ue(null),Oe(null),Xe(0),te("assistant","running");const ae=(await Y.entities.Assistant.filter({id:o}))[0];R(ae),Xe(ae.min_score??0),te("assistant","done"),te("search","running");const Se=ae.knowledge_base_ids||[],Le=ae.min_score??0;if(Xe(Le),Se.length>0){const Hn={query:j,knowledge_base_ids:Se,top_k:ae.max_context_items||5,min_score:Le,caller:"PromptTest"};D(Hn);const tn=await Y.functions.invoke("semanticSearch",Hn);
1120I(((Jn=tn.data)==null?void 0:Jn.results)||[])}else D(null);te("search","done"),te("prompt","running");const He=await Y.auth.me();let ut=g;if(f){const Hn=await Y.entities.Message.filter({chat_id:f});Hn.sort((tn,On)=>tn.sent_at>On.sent_at?1:-1),ut=Hn.map(tn=>({role:tn.role,content:tn.content})),x(ut)}let ze=null;if(C.trim())try{ze=JSON.parse(C)}catch{}const fe={assistant_id:o,user_message:j,user_email:(He==null?void 0:He.email)||"",user_id:(He==null?void 0:He.id)||"",user_name:(He==null?void 0:He.full_name)||"",history:ut,preloadedKbItems:P,...ze?{investigation_data:ze}:{}};L(fe);const dt=await Y.functions.invoke("assistantPromptBuilder",{...fe,kb_context_items:P}),{full_prompt:ct,has_data_extraction:Wt,kb_context_used:bt,investigation_data_injected:sn}=dt.data||{};if(!ct)throw new Error("assistantPromptBuilder returned no prompt: "+JSON.stringify(dt.data));W(ct||""),K(!!Wt),G(!!bt),F(!!sn),ue(ut.length),te("prompt","done"),te("llm","running");const we={assistant_id:o,message:j,user_id:(He==null?void 0:He.id)||"",...f?{chat_id:f}:{},...ze?{investigation_data:ze}:{}};Ue(we);const Qe=await Y.functions.invoke("invokeAssistant",we),{answer:it="",data:at=null,debug_info:Gt=null}=Qe.data||{};ee(String(it||"")),X(JSON.stringify(Qe.data,null,2)),Z(at||null),Oe(Gt||null);const Cn=(ae==null?void 0:ae.investigation_data_node)||"";if(Cn&&at){const Hn=Cn.split(".");let tn=at;for(const On of Hn)tn=tn==null?void 0:tn[On];le(tn??null)}else le(null);te("llm","done"),w(!1)}const _e=e.find(me=>me.id===o),We=_e?n.filter(me=>(_e.knowledge_base_ids||[]).includes(me.id)):[],tt=_e?a.filter(me=>(_e.investigation_ids||[]).includes(me.id)):[];return r.jsxs("div",{className:"p-5 md:p-8 max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx(wt,{to:yt("QualityAssurance"),children:r.jsxs(de,{variant:"ghost",size:"sm",className:"gap-1",children:[r.jsx(or,{className:"w-4 h-4"})," Back"]})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Assistant Prompt Test"}),r.jsx("p",{className:"text-sm text-gray-500",children:"Trace the full pipeline: semantic KB search → prompt assembly → LLM call → extracted data"})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-5 space-y-4 mb-6",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Assistant"}),r.jsxs("select",{value:o,onChange:me=>l(me.target.value),className:"w-full border rounded-xl px-3 py-2.5 text-sm bg-white outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-100",children:[r.jsx("option",{value:"",children:"— Select an assistant —"}),e.map(me=>r.jsxs("option",{value:me.id,children:[me.name," (",me.type,")"]},me.id))]})]}),o&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"Chat Session"}),r.jsxs("select",{value:f,onChange:me=>m(me.target.value),className:"w-full border rounded-xl px-3 py-2.5 text-sm bg-white outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-100",children:[r.jsx("option",{value:"",children:"✦ Create a new chat"}),c.map(me=>r.jsxs("option",{value:me.id,children:[me.title||"Untitled"," · ",new Date(me.started_at).toLocaleDateString()]},me.id))]}),!f&&r.jsx("p",{className:"text-xs text-gray-400",children:"ℹ No chat selected — LLM will run without saving messages"}),f&&g.length>0&&r.jsxs("p",{className:"text-xs text-indigo-600",children:["✓ ",g.length," messages loaded as history"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:"User Query"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:j,onChange:me=>b(me.target.value),onKeyDown:me=>me.key==="Enter"&&De(),placeholder:"Type a question to trace through the pipeline…",className:"flex-1 border rounded-xl px-4 py-2.5 text-sm outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-100"}),r.jsxs(de,{onClick:De,disabled:!o||!j.trim()||y,className:"gap-1.5 shrink-0",children:[y?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(ur,{className:"w-4 h-4"}),"Run"]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide",children:["Current Investigation Data ",r.jsx("span",{className:"text-gray-300 font-normal",children:"(optional JSON — injected into prompt as current state)"})]}),r.jsx("textarea",{value:C,onChange:me=>k(me.target.value),rows:4,placeholder:`{
1121  "field": "value"
1122}`,className:`w-full border rounded-xl px-4 py-2.5 text-xs font-mono outline-none focus:ring-1 resize-y ${C.trim()&&(()=>{try{return JSON.parse(C),!1}catch{return!0}})()?"border-red-400 focus:border-red-400 focus:ring-red-100":"border-gray-200 focus:border-indigo-400 focus:ring-indigo-100"}`}),C.trim()&&(()=>{try{return JSON.parse(C),!1}catch{return!0}})()&&r.jsx("p",{className:"text-xs text-red-500 font-medium",children:"⚠ Invalid JSON — investigation_data will NOT be sent to the prompt builder"}),C.trim()&&(()=>{try{return JSON.parse(C),!0}catch{return!1}})()&&r.jsx("p",{className:"text-xs text-emerald-600 font-medium",children:"✓ Valid JSON — will be injected as investigation_data"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(c0,{number:"1",icon:W5,label:"Step 1 · Assistant Loaded",sublabel:"base44.entities.Assistant.filter({ id }) — load config from database",status:S.assistant,children:T&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(l0,{name:"base44.entities.Assistant.filter",params:{id:o}}),r.jsx("div",{className:"flex flex-wrap gap-2 text-xs",children:[["type",T.type],["temperature",T.temperature??.3],["max_context_items",T.max_context_items??10],["context_messages",T.context_messages??6],["max_chars_per_item",T.max_chars_per_item??2e3],["min_score",T.min_score??0,!0],["use_internet",String(T.use_internet??!1)],["response_language",T.response_language||"auto"]].map(([me,ae,Se])=>r.jsxs("span",{className:`border rounded-lg px-2.5 py-1 ${Se&&(T.min_score??0)>0?"border-amber-300 bg-amber-50 font-bold text-amber-700":"bg-white"}`,children:[r.jsxs("strong",{children:[me,":"]}
1122)," ",ae]},me))}),r.jsxs("div",{className:"bg-white border rounded-xl p-3 space-y-2",children:[r.jsxs("p",{className:"text-xs font-semibold text-gray-500 flex items-center gap-1.5",children:[r.jsx(ao,{className:"w-3.5 h-3.5 text-emerald-500"})," Knowledge Bases (",We.length,")"]}),We.length===0?r.jsx("p",{className:"text-xs text-gray-400 italic",children:"No KB linked to this assistant"}):We.map(me=>r.jsxs("div",{className:"flex items-center gap-2 bg-emerald-50 border border-emerald-100 rounded-lg px-2.5 py-1.5",children:[r.jsx("span",{className:"text-xs font-semibold text-emerald-700",children:me.name}),me.type&&r.jsx("span",{className:"text-[10px] text-emerald-500",children:me.type}),r.jsx("span",{className:"text-[10px] text-gray-400 ml-auto font-mono",children:me.id})]},me.id))]}),tt.length>0&&r.jsxs("div",{className:"bg-white border rounded-xl p-3 space-y-2",children:[r.jsxs("p",{className:"text-xs font-semibold text-gray-500 flex items-center gap-1.5",children:[r.jsx(si,{className:"w-3.5 h-3.5 text-amber-500"})," Investigations (",tt.length,")"]}),tt.map(me=>r.jsxs("div",{className:"flex items-center gap-2 bg-amber-50 border border-amber-100 rounded-lg px-2.5 py-1.5",children:[r.jsx("span",{className:"text-xs font-semibold text-amber-700",children:me.name}),r.jsx("span",{className:"text-[10px] text-amber-500",children:me.type}),r.jsx("span",{className:"text-[10px] text-gray-400 ml-auto font-mono",children:me.id})]},me.id))]}),T.prompt_instructions&&r.jsx(Vc,{label:"prompt_instructions (raw)",content:T.prompt_instructions,color:"yellow"}),T.prompt_answer&&r.jsx(Vc,{label:"prompt_answer (raw)",content:T.prompt_answer,color:"yellow"}),T.prompt_data_object&&Object.keys(T.prompt_data_object).length>0&&r.jsx(Vc,{label:"prompt_data_object (extraction schema)",content:JSON.stringify(T.prompt_data_object,null,2),color:"cyan"}),T.agent_name&&r.jsxs("div",{className:"text-xs bg-violet-50 border border-violet-200 rounded-lg px-3 py-1.5",children:[r.jsx("strong",{children:"Linked agent:"})," ",r.jsx(jk,{children:T.agent_name}),T.answer_data_node&&r.jsxs("span",{className:"ml-2",children:["answer_data_node: ",r.jsx(jk,{children:T.answer_data_node})]})]})]})}),r.jsx(c0,{number:"2",icon:xte,label:"Step 2 · Semantic Search",sublabel:"functions/semanticSearch — fetch + rank KB chunks by semantic relevance",status:S.search,children:S.search!=="idle"&&r.jsxs("div",{className:"space-y-2",children:[B?r.jsx(l0,{name:"base44.functions.invoke('semanticSearch')",params:B}):r.jsx("p",{className:"text-xs text-gray-400 italic",children:"No KB linked — semanticSearch() was not called."}),P.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-xs text-gray-500",children:[r.jsxs(jk,{children:["results[",P.length,"]"]})," — sorted by semantic relevance score",Ve>0&&r.jsxs("span",{className:"ml-2 text-amber-600 font-medium",children:["· min_score filter: ≥",Ve," applied"]})]}),P.map((me,ae)=>{const Se=me.score<(Ve??0);return r.jsxs("div",{className:`border rounded-xl p-3 space-y-1 ${Se?"opacity-40 bg-gray-100 border-gray-200":"bg-white"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-xs font-bold text-gray-400",children:["#",ae+1]}),r.jsx("span",{className:"text-sm font-medium text-gray-800 flex-1",children:me.title||me.item_title}),Se&&r.jsx("span",{className:"text-[10px] bg-red-100 text-red-600 border border-red-200 rounded-full px-2 py-0.5 font-semibold",children:"filtered out"}),r.jsxs("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full ${me.score>=.7?"bg-emerald-100 text-emerald-700":me.score>=.4?"bg-amber-100 text-amber-700":"bg-red-100 text-red-600"}`,children:[(me.score*100).toFixed(0),"%"]})]}),me.reason&&r.jsx("p",{className:"text-xs text-indigo-600 italic ml-5",children:me.reason}),r.jsx("p",{className:"text-xs text-gray-400 ml-5 line-clamp-2",children:(me.content||"").slice(0,200)})]},me.id)})]})]})}),r.jsx(c0,{number:"3",icon:_n,label:"Step 3 · Prompt Built",sublabel:"assistantPromptBuilder — assembles the full prompt (with pre-fetched KB items)",status:S.prompt,children:H&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(l0,{name:"base44.functions.invoke('assistantPromptBuilder')",params:z}),Me>0&&r.jsxs("p",{className:"text-xs text-indigo-600",children:["✓ ",Me," history messages loaded from chat and injected into prompt"]}),Me===0&&r.jsx("p",{className:"text-xs text-gray-400",children:"✗ No chat history injected (new chat or no prior messages)"}),r.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[r.jsx("span",{className:`rounded-full px-2.5 py-0.5 border font-medium ${M?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-gray-100 text-gray-500 border-gray-200"}`,children:M?"✓ KB context injected":"✗ No KB context"}),r.jsx("span",{className:`rounded-full px-2.5 py-0.5 border font-medium ${V?"bg-violet-50 text-violet-700 border-violet-200":"bg-gray-100 text-gray-500 border-gray-200"}`,children:V?"✓ Data extraction schema":"✗ No data extraction"}),r.jsx("span",{className:`rounded-full px-2.5 py-0.5 border font-medium ${q?"bg-amber-50 text-amber-700 border-amber-200":"bg-gray-100 text-gray-500 border-gray-200"}`,children:q?"✓ Investigation data injected":"✗ No investigation data"})]}),q&&(z==null?void 0:z.investigation_data)&&r.jsxs("div",{className:"border border-amber-200 rounded-xl overflow-hidden text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-50",children:[r.jsx(dr,{className:"w-3.5 h-3.5 text-amber-500"}),r.jsx("span",{className:"font-medium text-amber-700",children:"investigation_data sent to builder"})]}),r.jsx("pre",{className:"bg-amber-950 text-amber-100 p-3 text-xs font-mono whitespace-pre-wrap overflow-auto max-h-40 leading-relaxed",children:JSON.stringify(z.investigation_data,null,2)})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>N(!0),className:`text-xs px-3 py-1.5 rounded-lg border font-medium transition-all ${_?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300"}`,children:"Annotated view"}),r.jsx("button",{onClick:()=>N(!1),className:`text-xs px-3 py-1.5 rounded-lg border font-medium transition-all ${_?"bg-white text-gray-600 border-gray-200 hover:border-indigo-300":"bg-indigo-600 text-white border-indigo-600"}`,children:"Raw prompt"})]}),_?r.jsx(K4e,{prompt:H}):r.jsx(Vc,{label:"full_prompt (raw)",content:H,color:"yellow",defaultOpen:!0})]})}),r.jsxs(c0,{number:"4",icon:zn,label:"Step 4 · invokeAssistant",sublabel:`invokeAssistant — calls LLM${f?" · saves messages to selected chat":" · new chat will be created"}`,status:S.llm,children:[re&&r.jsx(l0,{name:"base44.functions.invoke('invokeAssistant')",params:re}),ne&&r.jsx(Vc,{label:"Full invokeAssistant Response (raw)",content:ne,color:"green",defaultOpen:!0}),H&&r.jsx(Vc,{label:"Full Prompt Sent to LLM",content:H,color:"yellow",defaultOpen:!1}),(Ne==null?void 0:Ne.full_llm_response)&&r.jsx(Vc,{label:`Full LLM Response (raw JSON) — answer_data_node: "${(T==null?void 0:T.answer_data_node)||"none"}"`,content:JSON.stringify(Ne.full_llm_response,null,2),color:"cyan",defaultOpen:!0}),U&&U!=="(see extracted data below)"&&r.jsxs("div",{className:"bg-white border-2 border-emerald-200 rounded-xl px-4 py-3",children:[r.jsxs("div",{className:"text-xs font-semibold text-emerald-600 mb-1 flex items-center gap-1.5",children:[r.jsx(mr,{className:"w-3.5 h-3.5"})," Answer (",(T==null?void 0:T.answer_data_node)||"message",")"]}),r.jsx("div",{className:"text-gray-800 text-sm leading-relaxed [&_a]:text-indigo-600 [&_a]:underline [&_a]:hover:text-indigo-800",dangerouslySetInnerHTML:{__html:U}})]}),ce&&r.jsxs("div",{className:"border-2 border-amber-200 rounded-xl overflow-hidden text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-amber-50",children:[r.jsx(dr,{className:"w-3.5 h-3.5 text-amber-500"}),r.jsxs("span",{className:"font-medium text-amber-700 flex-1",children:["Investigation Node: ",r.jsx("code",{className:"bg-amber-100 border border-amber-200 rounded px-1.5 py-0.5 text-[11px] font-mono",children:T==null?void 0:T.investigation_data_node})]}),r.jsx("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(ce,null,2))},className:"text-xs text-amber-600 hover:text-amber-800 px-2 py-0.5 rounded hover:bg-amber-100 transition-colors font-medium",children:"Copy"})]}),r.jsx("pre",{className:"bg-amber-950 text-amber-100 p-3 text-xs font-mono whitespace-pre-wrap overflow-auto max-h-64 leading-relaxed",children:JSON.stringify(ce,null,2)})]})]}),S.llm==="done"&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-2xl px-4 py-3 text-sm text-indigo-700",children:[r.jsx("p",{className:"font-semibold",children:"Trace complete ✓"}),r.jsxs("p",{className:"text-xs text-indigo-500 mt-0.5",children:["Assistant loaded → KB searched (",P.length," chunks) → prompt assembled → LLM answered."]})]}),r.jsx("div",{className:"h-6"})]})]})}function H4e(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function W4e({value:e}){return H4e(e)?r.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-indigo-500 hover:text-indigo-700 underline break-all leading-relaxed",children:e}):r.jsx("p",{className:"text-xs text-gray-500 leading-relaxed",children:e})}function i3({items:e,linkNode:t,onLinkClick:n}){return!e||e.length===0?null:r.jsx("div",{className:"w-full max-w-[90%] mt-2",children:r.jsx("div",{className:"bg-white border border-indigo-100 rounded-2xl shadow-sm overflow-hidden",children:e.map((s,a)=>{const i=s[t],l=Object.entries(s).filter(([m])=>m!==t).map(([,m])=>String(m)).filter(m=>m&&m!=="null"&&m!=="undefined"),[c,...d]=l,f=r.jsxs("div",{className:`px-4 py-3 flex items-start justify-between gap-3 group
1123                ${a<e.length-1?"border-b border-indigo-50":""}
1124                ${i?"hover:bg-indigo-50 transition-colors cursor-pointer":""}
1125              `,children:[r.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[c&&r.jsx("p",{className:"text-sm font-semibold text-gray-800 leading-snug",children:c}),d.map((m,g)=>r.jsx(W4e,{value:m},g))]}),i&&r.jsx("div",{className:"shrink-0 mt-0.5",children:r.jsx("div",{className:"w-7 h-7 rounded-full bg-indigo-100 group-hover:bg-indigo-600 flex items-center justify-center transition-colors",children:r.jsx("svg",{className:"w-3.5 h-3.5 text-indigo-500 group-hover:text-white transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})})})]});return i?r.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"block",onClick:()=>n&&n(i),children:f},a):r.jsx("div",{children:f},a)})})})}const G4e=[{value:"content_suggestion",label:"Suggest content to add"},{value:"answer_quality",label:"Report an issue with AI responses"},{value:"general",label:"Other / General feedback"}];function o3({msg:e,query:t,chatId:n,assistantKey:s,assistantName:a,reporterName:i,onClose:o,onNameSave:l,debugMode:c}){const[d,f]=h.useState(i||""),[m,g]=h.useState(""),[x,j]=h.useState(""),[b,y]=h.useState(""),[w,_]=h.useState(!1),[N,C]=h.useState(!1),k=!!c,S=k?d.trim()&&m.trim():b&&m.trim();async function A(T){if(T.preventDefault(),!S)return;_(!0);const R=new Date;await Y.functions.invoke("submitIssueReport",{reported_at:R.toISOString(),reporter_name:d.trim()||null,assistant_key:s,assistant_name:a,chat_id:n||null,query:t,answer:e.content,raw_data:k&&e.rawData||null,full_prompt:k&&e.fullPrompt||null,expected_answer:m.trim(),comments:x.trim()||null,issue_type:k||b==="general"?"answer_quality":b,status:"open"}),d.trim()&&d.trim()!==i&&l(d.trim()),_(!1),C(!0),setTimeout(()=>
1125o(),1500)}return r.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[k?r.jsx(Nr,{className:"w-5 h-5 text-amber-500"}):r.jsx(Br,{className:"w-5 h-5 text-indigo-500"}),r.jsx("h2",{className:"font-semibold text-gray-900",children:k?"Report Answer Issue":"Feedback"})]}),r.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(jt,{className:"w-5 h-5"})})]}),N?r.jsxs("div",{className:"p-8 flex flex-col items-center gap-3 text-center",children:[r.jsx(Bd,{className:"w-12 h-12 text-emerald-500"}),r.jsx("p",{className:"font-medium text-gray-900",children:k?"Issue reported successfully!":"Thanks for your feedback!"})]}):k?r.jsxs("form",{onSubmit:A,className:"p-5 space-y-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:["Your Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{value:d,onChange:T=>f(T.target.value),placeholder:"Enter your name...",className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:"Query"}),r.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg px-3 py-2 text-sm text-gray-700",children:t})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:"Answer"}),r.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg px-3 py-2 text-sm text-gray-700 max-h-28 overflow-y-auto",children:e.content})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:["Expected Answer ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("textarea",{value:m,onChange:T=>g(T.target.value),placeholder:"What should the correct answer be?",rows:3,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 resize-none"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:["Comments ",r.jsx("span",{className:"text-gray-400",children:"(optional)"})]}),r.jsx("textarea",{value:x,onChange:T=>j(T.target.value),placeholder:"Any additional context...",rows:2,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 resize-none"})]}),r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsx("button",{type:"button",onClick:o,className:"flex-1 border border-gray-200 text-gray-600 rounded-lg py-2 text-sm font-medium hover:bg-gray-50 transition-colors",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!S||w,className:"flex-1 bg-amber-500 hover:bg-amber-600 disabled:opacity-50 text-white rounded-lg py-2 text-sm font-medium transition-colors",children:w?"Submitting...":"Submit Report"})]})]}):r.jsxs("form",{onSubmit:A,className:"p-5 space-y-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-2",children:["Feedback Type ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("div",{className:"space-y-2",children:G4e.map(T=>r.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[r.jsx("input",{type:"radio",name:"feedbackType",value:T.value,checked:b===T.value,onChange:()=>y(T.value),className:"accent-indigo-600 w-4 h-4 flex-shrink-0"}),r.jsx("span",{className:"text-sm text-gray-700 group-hover:text-gray-900",children:T.label})]},T.value))})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:["Your Feedback ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("textarea",{value:m,onChange:T=>g(T.target.value),placeholder:"Tell us what you'd like to see, what went wrong, or any other thoughts.",rows:4,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 resize-none"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:["Additional Context ",r.jsx("span",{className:"text-gray-400",children:"(optional)"})]}),r.jsx("textarea",{value:x,onChange:T=>j(T.target.value),placeholder:"Links, references, or anything else that might help.",rows:2,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 resize-none"})]}),r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsx("button",{type:"button",onClick:o,className:"flex-1 border border-gray-200 text-gray-600 rounded-lg py-2 text-sm font-medium hover:bg-gray-50 transition-colors",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!S||w,className:"flex-1 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white rounded-lg py-2 text-sm font-medium transition-colors",children:w?"Submitting...":"Send Feedback"})]})]})]})})}function CW({msg:e,query:t,chatId:n,assistantKey:s,assistantName:a,reporterName:i,onClose:o,onNameSave:l}){const[c,d]=h.useState(i||""),[f,m]=h.useState(""),[g,x]=h.useState(""),[j,b]=h.useState(!1),[y,w]=h.useState(!1);async function _(N){N.preventDefault(),!(!c.trim()||!f.trim())&&(b(!0),await Y.functions.invoke("submitIssueReport",{reported_at:new Date().toISOString(),reporter_name:c.trim(),issue_type:"content_suggestion",assistant_key:s,assistant_name:a,chat_id:n||null,query:t,answer:e.content,suggested_content:f.trim(),comments:g.trim()||null,status:"open"}),c.trim()!==i&&l(c.trim()),b(!1),w(!0),setTimeout(()=>
1125o(),1500))}return r.jsx("div",{className:"fixed inset-0 bg-black/40 z-50 flex items-center justify-center p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zo,{className:"w-5 h-5 text-emerald-500"}),r.jsx("h2",{className:"font-semibold text-gray-900",children:"Suggest Content"})]}),r.jsx("button",{onClick:o,className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(jt,{className:"w-5 h-5"})})]}),y?r.jsxs("div",{className:"p-8 flex flex-col items-center gap-3 text-center",children:[r.jsx(Bd,{className:"w-12 h-12 text-emerald-500"}),r.jsx("p",{className:"font-medium text-gray-900",children:"Suggestion submitted! Thank you."}),r.jsx("p",{className:"text-sm text-gray-500",children:"Our team will review it for the knowledge library."})]}):r.jsxs("form",{onSubmit:_,className:"p-5 space-y-4",children:[r.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded-xl px-4 py-3 text-sm text-emerald-800",children:[r.jsx("p",{className:"font-medium mb-1",children:"Couldn't find what you were looking for?"}),r.jsx("p",{className:"text-emerald-700 text-xs",children:"Suggest content or topics to be added to our learning library so we can improve future responses."})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:["Your Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{value:c,onChange:N=>d(N.target.value),placeholder:"Enter your name...",className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-emerald-400"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:"Your Question (context)"}),r.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg px-3 py-2 text-sm text-gray-700 max-h-20 overflow-y-auto",children:t})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:["What content should be added? ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("textarea",{value:f,onChange:N=>m(N.target.value),placeholder:"Describe the topic, content, or resource you think should be in our knowledge base...",rows:4,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-emerald-400 resize-none"})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-semibold text-gray-600 mb-1",children:["Additional Comments ",r.jsx("span",{className:"text-gray-400",children:"(optional)"})]}),r.jsx("textarea",{value:g,onChange:N=>x(N.target.value),placeholder:"Links, references, or extra context...",rows:2,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-emerald-400 resize-none"})]}),r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsx("button",{type:"button",onClick:o,className:"flex-1 border border-gray-200 text-gray-600 rounded-lg py-2 text-sm font-medium hover:bg-gray-50 transition-colors",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!c.trim()||!f.trim()||j,className:"flex-1 bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 text-white rounded-lg py-2 text-sm font-medium transition-colors",children:j?"Submitting…":"Submit Suggestion"})]})]})]})})}const ob={en:{online:"Online",yourName:"+ Your name",yourNamePlaceholder:"Your name...",typeMessage:"Type your message...",send:"Send",defaultWelcome:"Hi! How can I help you today?",suggest:"Suggest",report:"Report",feedback:"Feedback",translateAnswer:"Translate",showOriginal:"Original",searchModeLibrary:"Whole library",searchModePage:"Current page",contextLabel:"Context",compactMode:"Compact",exitDebug:"Exit debug",readingPage:"Reading",suggestContent:"Suggest content",quickActions:"Quick actions",aiMemory:"AI Memory",openTranslatedTo:"Open page translated to",followUpQuestions:"Follow-up questions"},pt:{online:"Online",yourName:"+ Seu nome",yourNamePlaceholder:"Seu nome...",typeMessage:"Digite sua mensagem...",send:"Enviar",defaultWelcome:"Olá! Como posso ajudar?",suggest:"Sugerir",report:"Reportar",feedback:"Comentário",translateAnswer:"Traduzir",showOriginal:"Original",searchModeLibrary:"Toda a biblioteca",searchModePage:"Página atual",contextLabel:"Contexto",compactMode:"Compacto",exitDebug:"Sair debug",readingPage:"Lendo",suggestContent:"Sugerir conteúdo",quickActions:"Ações rápidas",followUpQuestions:"Perguntas de acompanhamento"},es:{online:"En línea",yourName:"+ Tu nombre",yourNamePlaceholder:"Tu nombre...",typeMessage:"Escribe tu mensaje...",send:"Enviar",defaultWelcome:"¡Hola! ¿Cómo puedo ayudarte?",suggest:"Sugerir",report:"Reportar",feedback:"Comentario",translateAnswer:"Traducir",showOriginal:"Original",searchModeLibrary:"Toda la biblioteca",searchModePage:"Página actual",contextLabel:"Contexto"},fr:{online:"En ligne",yourName:"+ Votre nom",yourNamePlaceholder:"Votre nom...",typeMessage:"Tapez votre message...",send:"Envoyer",defaultWelcome:"Bonjour ! Comment puis-je vous aider ?",suggest:"Suggérer",report:"Signaler",feedback:"Commentaire",translateAnswer:"Traduire",showOriginal:"Original",searchModeLibrary:"Toute la bibliothèque",searchModePage:"Page actuelle",contextLabel:"Contexte"},de:{online:"Online",yourName:"+ Ihr Name",yourNamePlaceholder:"Ihr Name...",typeMessage:"Nachricht eingeben...",send:"Senden",defaultWelcome:"Hallo! Wie kann ich helfen?",suggest:"Vorschlagen",report:"Melden",feedback:"Rückmeldung",translateAnswer:"Übersetzen",showOriginal:"Original",searchModeLibrary:"Ganze Bibliothek",searchModePage:"Aktuelle Seite",contextLabel:"Kontext"},it:{online:"Online",yourName:"+ Il tuo nome",yourNamePlaceholder:"Il tuo nome...",typeMessage:"Scrivi il tuo messaggio...",send:"Invia",defaultWelcome:"Ciao! Come posso aiutarti?",suggest:"Suggerisci",report:"Segnala",feedback:"Commento",translateAnswer:"Traduci",showOriginal:"Originale",searchModeLibrary:"Tutta la libreria",searchModePage:"Pagina corrente",contextLabel:"Contesto"},ja:{online:"オンライン",yourName:"+ お名前",yourNamePlaceholder:"お名前...",typeMessage:"メッセージを入力...",send:"送信",defaultWelcome:"こんにちは!お手伝いしましょうか?",suggest:"提案",report:"報告",feedback:"フィードバック",translateAnswer:"翻訳",showOriginal:"原文",searchModeLibrary:"ライブラリ全体",searchModePage:"現在のページ",contextLabel:"コンテキスト"},zh:{online:"在线",yourName:"+ 你的名字",yourNamePlaceholder:"你的名字...",typeMessage:"输入消息...",send:"发送",defaultWelcome:"你好!我能帮你什么?",suggest:"建议",report:"报告",feedback:"反馈",translateAnswer:"翻译",showOriginal:"原文",searchModeLibrary:"整个库",searchModePage:"当前页面",contextLabel:"上下文"}},Y4e={Brazil:"pt",Portugal:"pt",Angola:"pt",Mozambique:"pt","Cape Verde":"pt",Spain:"es",Mexico:"es",Argentina:"es",Chile:"es",Colombia:"es",Peru:"es",Venezuela:"es",Uruguay:"es",Paraguay:"es",Bolivia:"es",Ecuador:"es",Cuba:"es","Dominican Republic":"es","Puerto Rico":"es",France:"fr",Monaco:"fr",Senegal:"fr",Cameroon:"fr",Germany:"de",Austria:"de",Liechtenstein:"de",Switzerland:"de",Italy:"it","San Marino":"it","Vatican City":"it",Jap
1125an:"ja",China:"zh",Taiwan:"zh","Hong Kong":"zh","South Korea":"ko",Netherlands:"nl",Belgium:"nl",Russia:"ru",Belarus:"ru",Kazakhstan:"ru","Saudi Arabia":"ar",UAE:"ar",Egypt:"ar",Morocco:"ar",Algeria:"ar",Tunisia:"ar",Libya:"ar",Jordan:"ar",Lebanon:"ar",Syria:"ar",Iraq:"ar",Qatar:"ar",Kuwait:"ar",Oman:"ar",Bahrain:"ar",Yemen:"ar",Palestine:"ar",Sudan:"ar",India:"hi",Pakistan:"ur",Bangladesh:"bn",Israel:"he",Turkey:"tr",Greece:"el",Poland:"pl",Sweden:"sv",Norway:"no",Denmark:"da",Finland:"fi","Czech Republic":"cs",Czechia:"cs",Slovakia:"sk",Slovenia:"sl",Croatia:"hr",Serbia:"sr",Bulgaria:"bg",Romania:"ro",Hungary:"hu",Thailand:"th",Vietnam:"vi",Indonesia:"id",Malaysia:"ms",Philippines:"tl",Ukraine:"uk",Lithuania:"lt",Latvia:"lv",Estonia:"et",Iceland:"is",Ireland:"en","United Kingdom":"en",Australia:"en",Canada:"en","New Zealand":"en","United States":"en","South Africa":"en",Nigeria:"en",Singapore:"en",Kenya:"sw",Tanzania:"sw",Uganda:"sw",Ethiopia:"am",Iran:"fa",Afghanistan:"ps"},l3={en:"English",pt:"Português",es:"Español",fr:"Français",de:"Deutsch",it:"Italiano",ja:"日本語",zh:"中文",ko:"한국어",nl:"Nederlands",ru:"Русский",ar:"العربية",hi:"हिन्दी",he:"עברית",tr:"Türkçe",pl:"Polski",sv:"Svenska",no:"Norsk",da:"Dansk",fi:"Suomi",cs:"Čeština",el:"Ελληνικά",uk:"Українська",th:"ไทย",vi:"Tiếng Việt",id:"Indonesia",ms:"Melayu",ro:"Română",hu:"Magyar",hr:"Hrvatski",sr:"Српски",bg:"Български",sk:"Slovenčina",sl:"Slovenščina",lt:"Lietuvių",lv:"Latviešu",et:"Eesti",is:"Íslenska",fa:"فارسی",ur:"اردو",bn:"বাংলা",sw:"Kiswahili",am:"አማርኛ",tl:"Filipino",ps:"پښتو",kk:"Қазақ",uz:"Oʻzbek"},J4e={en:"gb",pt:"br",es:"es",fr:"fr",de:"de",it:"it",ja:"jp",zh:"cn",ko:"kr",nl:"nl",ru:"ru",ar:"sa",hi:"in",he:"il",tr:"tr",pl:"pl",sv:"se",no:"no",da:"dk",fi:"fi",cs:"cz",el:"gr",uk:"ua",th:"th",vi:"vn",id:"id",ms:"my",ro:"ro",hu:"hu",hr:"hr",sr:"rs",bg:"bg",sk:"sk",sl:"si",lt:"lt",lv:"lv",et:"ee",is:"is",fa:"ir",ur:"pk",bn:"bd",sw:"ke",am:"et",tl:"ph",ps:"af",kk:"kz",uz:"uz"};function Q4e(e){return{...ob.en,...ob[e]||{}}}function EW(e){return e&&Y4e[e]||null}function Es(e){return e?e.split("-")[0].toLowerCase():"en"}function ro(e){const t=Es(e);return l3[t]||e}function Tp(e){const t=Es(e);return`https://flagcdn.com/24x18/${J4e[t]||t}.png`}function AW({currentLang:e,translating:t,showOriginal:n,uiStrings:s,pageLang:a,browserLang:i,onTranslate:o,onToggle:l,onReset:c}){const[d,f]=h.useState(!1),[m,g]=h.useState(""),x=h.useRef(null),j=e?Es(e):null,b=a?Es(a):null,y=i?Es(i):null,w=["en"];b&&b!=="en"&&!w.includes(b)&&w.push(b),y&&y!=="en"&&!w.includes(y)&&w.push(y),j&&!w.includes(j)&&w.push(j),h.useEffect(()=>{function N(C){x.current&&!x.current.contains(C.target)&&f(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);const _=Object.entries(l3).filter(([N,C])=>{const k=m.toLowerCase();return N.includes(k)||C.toLowerCase().includes(k)});return r.jsxs("div",{className:"flex items-center gap-1.5 relative flex-wrap",ref:x,children:[r.jsx("div",{className:"flex items-center gap-0.5 bg-white/10 rounded-lg p-0.5 border border-white/20",children:w.map(N=>r.jsxs("button",{onClick:()=>o(N),title:ro(N),className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded-md transition-all ${j===N?"bg-indigo-100 ring-1 ring-indigo-400":"hover:bg-white/10"}`,children:[r.jsx("img",{src:Tp(N),alt:N,className:"w-3.5 h-2.5 rounded-sm object-cover",onError:C=>{C.target.style.opacity=.3}}),r.jsx("span",{className:`text-[9px] font-medium ${j===N?"text-indigo-700":"text-white/70"}`,children:N.toUpperCase()})]},N))}),r.jsxs("button",{onClick:()=>f(N=>!N),className:`flex items-center gap-0.5 px-1.5 py-1 rounded-lg border transition-colors ${d?"bg-indigo-50 border-indigo-300 text-indigo-700":"bg-white/10 border-white/20 text-white/60 hover:bg-white/20"}`,title:"More languages",children:[r.jsx(Na,{className:"w-3 h-3"}),r.jsx(gt,{className:`w-2.5 h-2.5 transition-transform ${d?"rotate-180":""}`})]}),e&&!t&&r.jsx("button",{onClick:l,className:"text-[10px] text-white/60 hover:text-white px-1 py-0.5 border border-white/20 rounded",children:n?`→ ${ro(e)}`:`← ${s.showOriginal||"Original"}`}),e&&!t&&r.jsx("button",{onClick:c,title:"Reset translation",className:"text-white/40 hover:text-white/70 px-1 py-0.5",children:r.jsx(Dr,{className:"w-3 h-3"})}),t&&r.jsx("span",{className:"text-[10px] text-white/60 animate-pulse",children:"Translating…"}),d&&r.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-50 min-w-[200px] overflow-hidden",children:[r.jsx("div",{className:"px-2 py-1.5 border-b border-gray-100 bg-white",children:r.jsxs("div",{className:"flex items-center gap-1.5 border border-gray-200 rounded-lg px-2 py-1",children:[r.jsx(ur,{className:"w-3 h-3 text-gray-400 shrink-0"}),r.jsx("input",{value:m,onChange:N=>g(N.target.value),onKeyDown:N=>
1125{N.key==="Escape"&&f(!1)},placeholder:"Search language...",className:"flex-1 text-xs focus:outline-none min-w-0",autoFocus:!0})]})}),r.jsxs("div",{className:"max-h-48 overflow-y-auto",children:[_.map(([N,C])=>r.jsxs("button",{onClick:()=>{o(N),f(!1),g("")},className:"w-full text-left px-2.5 py-1.5 text-[11px] hover:bg-gray-50 flex items-center gap-2",children:[r.jsx("img",{src:Tp(N),alt:"",className:"w-3 h-2 rounded-sm shrink-0"}),r.jsx("span",{className:"text-gray-700",children:C}),r.jsx("span",{className:"text-[9px] text-gray-400 ml-auto",children:N.toUpperCase()}),j===N&&r.jsx(Tn,{className:"w-3 h-3 text-indigo-500"})]},N)),_.length===0&&r.jsx("div",{className:"px-3 py-2 text-xs text-gray-400",children:"No language found"})]})]})]})}function X4e(){var as;const e=window.location.pathname.match(/\/assistant\/([^/?#]+)/),t=e?e[1]:null,[n,s]=h.useState([]),[a,i]=h.useState(""),[o,l]=h.useState(!1),[c,d]=h.useState(null),[f,m]=h.useState(""),[g,x]=h.useState(""),[j,b]=h.useState(""),[y,w]=h.useState(""),[_,N]=h.useState([]),[C,k]=h.useState(!1),[S]=h.useState(()=>`anon-${Math.random().toString(36).slice(2)}`),A=new URLSearchParams(window.location.search),T={page_url:A.get("page_url")||null,referrer_url:A.get("referrer")||null,gated_cookie:A.get("gated_cookie")||null,guide_cookie:A.get("guide_cookie")||null,wp_user_id:A.get("wp_user_id")||null,wp_user_email:A.get("wp_user_email")||null},[R,B]=h.useState(""),[D,P]=h.useState("ContentLink"),[I,z]=h.useState("system"),[L,H]=h.useState(!1),[W,V]=h.useState(!1),[K,M]=h.useState({fontFamily:"Open Sans",bodyFontSize:14,titleFontSize:18,textColor:"#2B2A2D",answerBg:"#163898",sendBtnColor:"#FF4E17",userBg:"#CCE3FF",iconScale:1.8}),[G,q]=h.useState(null),[F,U]=h.useState([]),[ee,ne]=h.useState(null),[X,ie]=h.useState(null),[Z,ce]=h.useState(!1);h.useRef(!1);const[le,re]=h.useState(null),[Ue,Ne]=h.useState({}),[Oe,Me]=h.useState("jina-embeddings-v5-text-small"),[ue,Ve]=h.useState("none"),Xe=["jina-embeddings-v5-text-small","jina-embeddings-v3"],[te,De]=h.useState(null),[_e,We]=h.useState(null),[tt,me]=h.useState(""),[ae,Se]=h.useState(!1),[Le,He]=h.useState({}),[ut,ze]=h.useState({}),[fe,dt]=h.useState({}),[ct,Wt]=h.useState({}),bt=h.useRef(null),sn=h.useRef(null);h.useEffect(()=>{const $e={};try{$e.parentUrl=window.parent.location.href,$e.parentPingStatus="success"}catch(he){$e.parentUrl=null,$e.parentPingStatus="blocked",$e.parentPingError=he.message}try{const he="embed_url_history",Q=JSON.parse(sessionStorage.getItem(he)||"[]"),ke=window.location.href,Ee=document.referrer||null;Q[Q.length-1]!==ke&&(Q.push({url:ke,ts:new Date().toISOString()}),Q.length>20&&Q.shift(),sessionStorage.setItem(he,JSON.stringify(Q))),$e.sessionHistory=Q,$e.sessionPingStatus="success",$e.referrer=Ee}catch(he){$e.sessionHistory=null,$e.sessionPingStatus="blocked",$e.sessionHistoryError=he.message}$e.selfUrl=window.location.href,$e.browserReferrer=document.referrer||"(empty)",ie($e)},[]);const we=W||(I==="debug"?!0:I==="production"?!1:L);h.useEffect(()=>{const $e=K.fontFamily||"Open Sans",he="embed-chat-font",Q=document.getElementById(he),Ee=`https://fonts.googleapis.com/css2?family=${$e.replace(/ /g,"+")}:wght@400;700&display=swap`;if(Q)Q.href=Ee;else{const Ye=document.createElement("link");Ye.id=he,Ye.rel="stylesheet",Ye.href=Ee,document.head.appendChild(Ye)}},[K.fontFamily]),h.useEffect(()=>{if(!t){k(!0);return}(async()=>{let $e=null;try{const he=await fetch("https://api.ipify.org?format=json");he.ok&&($e=(await he.json()).ip||null)}catch{}Y.functions.invoke("getEmbedAssistantInfo",{assistant_key:t,api_user_id:S,current_url:window.location.href||null,referrer:document.referrer||null,user_agent:navigator.userAgent||null,visitor_ip:$e,language:navigator.language||null,path_depth:window.location.pathname.split("/").filter(Boolean).length,wp_params:T}).then(he=>{const Q=he.data;if(!Q||Q.error){k(!0);return}if(Q.embed_page_type&&Q.embed_page_type!=="original"){k(!0);return}m(Q.name),x(Q.icon_url||""),N(Q.suggested_prompts||[]),b(Q.public_page_message||""),w(Q.disclaimer||""),document.title=Q.chat_title||Q.name||"Assistant",q(Q.assistant_id||null),U(Q.knowledge_base_ids||[]);const ke=Q.ivss_query_model_primary||"jina-embeddings-v5-text-small",Ee=Q.ivss_query_model_secondary||"none";re({model:Q.model||"automatic",temperature:Q.temperature??.3,search_function:Q.search_function||"ItemsVectorSemanticSearch",jina_task:Q.jina_task||null,max_context_items:Q.max_context_items??10,min_chunk_score:Q.min_chunk_score??0,ivss_top_k_multiple:Q.ivss_top_k_multiple??1,ivss_include_summaries:Q.ivss_include_summaries??!1,context_messages:Q.context_messages??6,max_chars_per_item:Q.max_chars_per_item??2e3,knowledge_base_ids:Q.knowledge_base_ids||[],ivss_query_model_primary:ke,ivss_query_model_secondary:Ee}),Me(ke),Ve(Ee),ne({ip_address:Q.visitor_ip||null,org:Q.visitor_org||null,country:Q.visitor_country||null,city:Q.visitor_city||null,browser:Q.visitor_browser||null,os:Q.visitor_os||null,device:Q.visitor_device||null,language:Q.visitor_language||null}),z(Q.embed_debug_mode||"system"),H(Q.system_debug??!1),V(Q.debug_mode??!1),B(Q.embed_special_node||""),P(Q.embed_link_node||"ContentLink"),M({fontFamily:Q.embed_chat_font_family||"Open Sans",bodyFontSize:Q.embed_chat_body_font_size??14,titleFontSize:Q.embed_chat_title_font_size??18,textColor:Q.embed_chat_text_color||"#2B2A2D",answerBg:Q.embed_chat_answer_bg||"#163898",sendBtnColor:Q.embed_chat_send_btn_color||"#FF4E17",userBg:Q.embed_chat_user_bg||"#CCE3FF",iconScale:Q.embed_chat_icon_scale??1.8})}).catch(()=>k(!0))})()},[t]),h.useEffect(()=>{var $e;($e=bt.current)==null||$e.scrollIntoView({behavior:"smooth"})},[n,o]);function Qe($e,he){Ne(Q=>({...Q,[$e]:{...Q[$e]||{},...he}}))}async function it($e,he){Qe($e,{invokeLoading:!0,invokeData:null,invokeError:null,openPanel:"invoke"});try{const Q=await Y.functions.invoke("embeddedAssistantChat",{assistant_key:t,message:he,api_user_id:`debug-${S}`,no_persist:!0,debug_mode:!0});Qe($e,{invokeLoading:!1,invokeData:Q.data})}catch(Q){Qe($e,{invokeLoading:!1,invokeError:Q.message})}}async function at($e,he){Qe($e,{searchLoading:!0,searchData:null,searchError:null,openPanel:"search"});const Q=le||{},ke={query:he,knowledge_base_ids:Q.knowledge_base_ids||F,top_k:Q.max_context_items??10,top_k_multiple:Q.ivss_top_k_multiple??1,min_chunk_score:Q.min_chunk_score??0,include_summaries:Q.ivss_include_summaries??!1,...Q.jina_task?{jina_task:Q.jina_task}:{},query_model_primary:Oe,...ue!=="none"?{query_model_secondary:ue}:{},caller:"embed_debug_search"};try{const Ee=await Y.functions.invoke("ItemsVectorSemanticSearch",ke);Qe($e,{searchLoading:!1,searchData:Ee.data,searchPayload:ke})}catch(Ee){Qe($e,{searchLoading:!1,searchError:Ee.message,searchPayload:ke})}}async function Gt($e){if(!$e||o)return;i(""),s(ke=>[...ke,{role:"user",content:$e}]),l(!0);const he=Date.now(),Q=c;try{const Ee=(await Y.functions.invoke("embeddedAssistantChat",{assistant_key:t,message:$e,api_user_id:S,...Q?{chat_id:Q}:{},...we?{debug_mode:!0}:{},...!Q&&ee?{visitor_info:ee}:{},...Q?{}:{wp_params:T}})).data;Ee!=null&&Ee.chat_id&&!Q&&d(Ee.chat_id);const Ye=R&&(Ee!=null&&Ee.data)&&Array.isArray(Ee.data[R])?Ee.data[R]:null,Tt=Date.now()-he;s(Ut=>{var $t;return[...Ut,{role:"assistant",content:((Ee==null?void 0:Ee.answer)||"No response.").replace(/\\n
1125/g,`
1126`),query:$e,specialItems:Ye,rawData:Ee??null,fullPrompt:(($t=Ee==null?void 0:Ee.debug_info)==null?void 0:$t.full_prompt)??null,messageId:(Ee==null?void 0:Ee.message_id)??null,elapsed:Tt}]})}catch(ke){const Ee=Date.now()-he;s(Ye=>[...Ye,{role:"assistant",content:"Something went wrong. Please try again.",query:$e,error:!0,errorMessage:(ke==null?void 0:ke.message)||"Unknown error",elapsed:Ee}])}l(!1)}async function Cn($e){$e==null||$e.preventDefault();const he=a.trim();await Gt(he)}async function Jn($e){c&&Y.entities.Chat.filter({id:c}).then(([he])=>{const Q=(he==null?void 0:he.link_clicks)||{},ke={...Q,[$e]:(Q[$e]||0)+1};Y.entities.Chat.update(c,{link_clicks:ke}).catch(()=>{})}).catch(()=>{})}async function Hn($e,he,Q){const Ee=Le[$e]===Q?null:Q;He(Ye=>({...Ye,[$e]:Ee})),he.messageId&&await Y.entities.Message.update(he.messageId,{feedback:Ee||null}),Ee&&!we&&De(he)}async function tn($e,he){var ke;const Q=(((ke=ut[$e])==null?void 0:ke.text)||"").trim();if(!Q){dt(Ee=>({...Ee,[$e]:!1}));return}ze(Ee=>({...Ee,[$e]:{...Ee[$e],submitting:!0}})),await Y.functions.invoke("submitIssueReport",{assistant_key:t,assistant_name:f,chat_id:c||null,query:he.query||"",answer:he.content||"",expected_answer:Q,comments:`Feedback: ${Le[$e]==="up"?"👍 Positive":"👎 Negative"}`}).catch(()=>{}),ze(Ee=>({...Ee,[$e]:{text:"",submitting:!1,submitted:!0}})),setTimeout(()=>dt(Ee=>({...Ee,[$e]:!1})),1500)}if(C)return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("p",{className:"text-2xl font-bold text-gray-400",children:"404"}),r.jsx("p",{className:"text-gray-500",children:"Assistant not found."})]})});const On=Math.round(36*K.iconScale);return r.jsxs("div",{className:"min-h-screen flex flex-col bg-gradient-to-br from-indigo-50 to-white",style:{fontFamily:`'${K.fontFamily}', sans-serif`},children:[r.jsxs("div",{className:"bg-white border-b px-6 py-4 flex items-center gap-3 shadow-sm",children:[r.jsx("div",{className:"rounded-full bg-indigo-100 flex items-center justify-center shrink-0 overflow-hidden",style:{width:On,height:On,minWidth:On},children:g?r.jsx("img",{src:g,alt:"",className:"w-full h-full object-contain"}):r.jsx("span",{className:"text-indigo-600 font-bold text-sm",children:"AI"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-bold text-gray-900",style:{fontSize:`${K.titleFontSize}px`,fontFamily:`'${K.fontFamily}', sans-serif`,fontWeight:700},children:f||"Assistant"}),r.jsx("p",{className:"text-xs text-emerald-500 font-medium",children:"● Online"})]}),r.jsx("div",{className:"flex items-center gap-2",children:ae?r.jsx("input",{ref:sn,value:tt,onChange:$e=>me($e.target.value),onBlur:()=>Se(!1),onKeyDown:$e=>{$e.key==="Enter"&&Se(!1)},autoFocus:!0,placeholder:"Your name...",className:"border border-indigo-300 rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 w-40"}):r.jsx("button",{onClick:()=>Se(!0),className:`text-sm rounded-lg px-3 py-1.5 border transition-colors ${tt?"border-gray-200 text-gray-700 hover:bg-gray-50":"border-dashed border-gray-300 text-gray-400 hover:border-indigo-400 hover:text-indigo-600"}`,children:tt||"+ Your name"})}),we&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:()=>ce($e=>!$e),title:"URL Diagnostics",className:`text-[10px] font-mono border rounded-lg px-2.5 py-1 transition-colors ${Z?"bg-sky-700 border-sky-500 text-white":"bg-sky-50 border-sky-300 text-sky-700 hover:bg-sky-100"}`,children:"🔗 URL Diag"}),r.jsxs("div",{className:"flex items-center gap-1.5 bg-amber-100 border border-amber-300 text-amber-700 rounded-full px-3 py-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),r.jsx("span",{className:"text-[11px] font-semibold tracking-wide",children:"DEBUG"})]})]})]}),we&&Z&&X&&r.jsxs("div",{className:"bg-slate-950 border-b border-slate-700 px-6 py-4 space-y-3 font-mono text-[11px]",children:[r.jsx("div",{className:"text-slate-400 font-semibold uppercase tracking-widest text-[10px]",children:"🔗 URL Diagnostics"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-slate-500",children:"embed self URL (window.location.href):"}),r.jsx("div",{className:"text-sky-300 break-all",children:X.selfUrl})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-slate-500",children:"browser referrer (document.referrer):"}),r.jsx("div",{className:X.browserReferrer==="(empty)"?"text-slate-600 italic":"text-yellow-300 break-all",children:X.browserReferrer})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"text-slate-500",children:["Strategy 3 — parent ping (window.parent.location.href):",r.jsx("span",{className:`ml-2 px-1.5 py-0.5 rounded text-[10px] ${X.parentPingStatus==="success"?"bg-emerald-800 text-emerald-200":"bg-red-900 text-red-300"}`,children:X.parentPingStatus})]}),X.parentPingStatus==="success"?r.jsxs("div",{className:"text-emerald-300 break-all",children:["✅ ",X.parentUrl]}):r.jsxs("div",{className:"text-red-400 break-all",children:["❌ ",X.parentPingError]})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"text-slate-500",children:["Strategy 2 — sessionStorage history:",r.jsx("span",{className:`ml-2 px-1.5 py-0.5 rounded text-[10px] ${X.sessionPingStatus==="success"?"bg-emerald-800 text-emerald-200":"bg-red-900 text-red-300"}`,children:X.sessionPingStatus})]}),X.sessionPingStatus==="success"?((as=X.sessionHistory)==null?void 0:as.length)>0?r.jsx("div",{className:"space-y-0.5 pl-2 border-l border-slate-700",children:X.sessionHistory.map(($e,he)=>{var Q;return r.jsxs("div",{className:"text-slate-300 break-all",children:[r.jsxs("span",{className:"text-slate-600",children:[(Q=$e.ts)==null?void 0:Q.slice(11,19)," "]}),$e.url]},he)})}):r.jsx("div",{className:"text-slate-600 italic",children:"No history yet (this is the first visit in this session)."}):r.jsxs("div",{className:"text-red-400 break-all",children:["❌ ",X.sessionHistoryError]})]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-6 space-y-4 max-w-2xl w-full mx-auto",children:[n.length===0&&r.jsxs("div",{className:"text-center mt-16 space-y-6",children:[r.jsx("div",{className:"space-y-2",children:j?r.jsx("div",{className:"prose prose-sm max-w-none text-gray-600",dangerouslySetInnerHTML:{__html:j}}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-3xl",children:"💬"}),r.jsx("p",{className:"text-gray-500 text-sm",children:"Hi! How can I help you today?"})]})}),_.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:_.map(($e,he)=>r.jsx("button",{onClick:()=>Gt($e),className:"text-xs bg-indigo-100 hover:bg-indigo-200 text-indigo-700 px-3 py-1.5 rounded-full border border-indigo-200 transition-colors",children:$e},he))})]}),n.map(($e,he)=>{var ke,Ee,Ye,Tt,Ut,$t,En,Pr,zs,oe,Be,Ze,pt,qt,Kt,Xt,Nn;$e.role==="assistant"&&n.slice(0,he).map((Et,Zt)=>Et.role==="user"?Zt:-1).filter(Et=>Et>=0).pop();const Q=Ue[he]||{};return r.jsxs("div",{className:`flex flex-col ${$e.role==="user"?"items-end":"items-start"}`,children:[r.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-2.5 leading-relaxed ${$e.role==="user"?"rounded-br-sm":"rounded-bl-sm shadow-sm border border-gray-200"}`,style:$e.role==="user"?{background:K.userBg,color:K.textColor,fontSize:`${K.bodyFontSize}px`,fontFamily:`'${K.fontFamily}', sans-serif`,fontWeight:400}:{background:K.answerBg,color:"#ffffff",fontSize:`${K.bodyFontSize}px`,fontFamily:`'${K.fontFamily}', sans-serif`,fontWeight:400},children:r.jsx("span",{className:"whitespace-pre-wrap",children:(ke=ct[he])!=null&&ke.text&&!((Ee=ct[he])!=null&&Ee.showOriginal)?ct[he].text:$e.content})}),$e.role==="assistant"&&$e.specialItems&&$e.specialItems.length>0&&r.jsx(i3,{items:$e.specialItems,linkNode:D,onLinkClick:Jn}),$e.role==="assistant"&&!$e.error&&r.jsxs("div",{className:"mt-1.5 space-y-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx("button",{onClick:()=>Hn(he,$e,"up"),title:"Good answer",className:`inline-flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-lg border transition-colors ${Le[he]==="up"?"bg-emerald-200 border-emerald-400 text-emerald-800 font-bold":"bg-gray-100 border-gray-300 text-gray-500 hover:border-gray-400"}`,children:r.jsx(qo,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>Hn(he,$e,"down"),title:"Poor answer",className:`inline-flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-lg border transition-colors ${Le[he]==="down"?"bg-red-200 border-red-400 text-red-800 font-bold":"bg-gray-100 border-gray-300 text-gray-500 hover:border-gray-400"}`,children:r.jsx(hc,{className:"w-3.5 h-3.5"})}),we?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>We($e),title:"Suggest content",className:"inline-flex items-center gap-1.5 text-sm font-bold px-3 py-1.5 rounded-lg border bg-emerald-100 border-emerald-300 text-emerald-700 hover:bg-emerald-150 transition-colors",children:[r.jsx(Zo,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:"Suggest"})]}),r.jsxs("button",{onClick:()=>De($e),title:"Report a problem",className:"inline-flex items-center gap-1.5 text-sm font-bold px-3 py-1.5 rounded-lg border bg-amber-100 border-amber-300 text-amber-700 hover:bg-amber-150 transition-colors",children:[r.jsx(R0,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:"Report"})]})]}):r.jsxs("button",{onClick:()=>De($e),title:"Send feedback",className:"inline-flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-lg border bg-gray-100 border-gray-300 text-gray-500 hover:border-gray-400 transition-colors",children:[r.jsx(R0,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:"Feedback"})]})]}),fe[he]&&r.jsx("div",{className:"flex items-center gap-2 max-w-sm",children:(Ye=ut[he])!=null&&Ye.submitted?r.jsx("span",{className:"text-xs text-emerald-600 font-medium",children:"Thanks for your feedback!"}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,value:((Tt=ut[he])==null?void 0:Tt.text)||"",onChange:Et=>ze(Zt=>({...Zt,[he]:{...Zt[he],text:Et.target.value}})),onKeyDown:Et=>{Et.key==="Enter"&&tn(he,$e),Et.key==="Escape"&&dt(Zt=>({...Zt,[he]:!1}))},placeholder:"Tell us more (optional)...",className:"flex-1 text-xs border border-gray-300 rounded-lg px-3 py-1.5 focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("button",{onClick:()=>tn(he,$e),disabled:(Ut=ut[he])==null?void 0:Ut.submitting,className:"text-xs px-3 py-1.5 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:($t=ut[he])!=null&&$t.submitting?"…":"Send"}),r.jsx("button",{onClick:()=>dt(Et=>({...Et,[he]:!1})),className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-3.5 h-3.5"})})]})}),r.jsx(AW,{currentLang:(En=ct[he])==null?void 0:En.lang,translating:(Pr=ct[he])==null?void 0:Pr.translating,showOriginal:(zs=ct[he])==null?void 0:zs.showOriginal,pageLang:navigator.language,browserLang:navigator.language,onTranslate:async Et=>{if(Es(Et)==="en"){Wt(Zt=>{const mn={...Zt};return delete mn[he],mn});return}Wt(Zt=>({...Zt,[he]:{lang:Et,translating:!0,showOriginal:!1}}));try{const Zt=await Y.integrations.Core.InvokeLLM({prompt:`Translate the following text to ${ro(Et)}. Preserve any HTML tags — only translate the text content. Return only the translated text, no explanation.
1127
1128${$e.content}`});Wt(mn=>({...mn,[he]:{lang:Et,text:Zt,translating:!1,showOriginal:!1}}))}catch{Wt(Zt=>({...Zt,[he]:{lang:Et,translating:!1,showOriginal:!1}}))}},onToggle:()=>Wt(Et=>{var Zt;return{...Et,[he]:{...Et[he],showOriginal:!((Zt=Et[he])!=null&&Zt.showOriginal)}}}),onReset:()=>Wt(Et=>{const Zt={...Et};return delete Zt[he],Zt})})]}),$e.role==="assistant"&&we&&$e.elapsed!==void 0&&r.jsxs("div",{className:"mt-1.5 flex flex-col gap-1 w-full max-w-[80%]",children:[r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r.jsxs("div",{className:`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 border text-[10px] font-mono ${$e.error?"bg-red-100 border-red-300 text-red-700":"bg-amber-100 border-amber-300 text-amber-800"}`,children:["⏱ ",($e.elapsed/1e3).toFixed(2),"s",$e.error&&" · ERROR"]}),!$e.error&&$e.rawData&&r.jsx("button",{onClick:()=>Qe(he,{openPanel:Q.openPanel==="prod_raw"?null:"prod_raw"}),className:`text-[10px] font-mono border rounded px-2 py-1 transition-colors ${Q.openPanel==="prod_raw"?"bg-slate-700 border-slate-500 text-slate-200":"bg-slate-100 border-slate-300 text-slate-600 hover:bg-slate-200"}`,children:"📦 raw response"})]}),$e.error&&$e.errorMessage&&r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:r.jsx("p",{className:"text-xs font-mono text-red-700 break-all",children:$e.errorMessage})}),Q.openPanel==="prod_raw"&&$e.rawData&&r.jsxs("div",{className:"space-y-1.5 mt-0.5",children:[r.jsx("div",{className:"text-[10px] font-mono text-slate-400",children:"↳ production response 
1128(send button — invokeAssistant used assistant settings, no debug_mode)"}),r.jsx("pre",{className:"bg-gray-900 text-green-300 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-72 w-full",children:JSON.stringify($e.rawData,null,2)})]})]}),$e.role==="user"&&we&&r.jsxs("div",{className:"mt-1.5 w-full space-y-2",children:[r.jsxs("div",{className:"flex gap-1.5 flex-wrap justify-end",children:[r.jsx("button",{onClick:()=>Qe(he,{openPanel:Q.openPanel==="settings"?null:"settings"}),className:`text-[10px] font-mono border rounded px-2 py-1 transition-colors ${Q.openPanel==="settings"?"bg-slate-700 border-slate-500 text-slate-200":"bg-slate-100 border-slate-300 text-slate-600 hover:bg-slate-200"}`,children:"🤖 Assistant"}),G&&r.jsx("button",{onClick:()=>it(he,$e.content),disabled:Q.invokeLoading,className:`text-[10px] font-mono border rounded px-2 py-1 transition-colors disabled:opacity-50 ${Q.openPanel==="invoke"?"bg-indigo-700 border-indigo-500 text-indigo-100":"bg-indigo-50 border-indigo-300 text-indigo-700 hover:bg-indigo-100"}`,children:Q.invokeLoading?"⏳ invoking…":"⚡ invokeAssistant()"}),F.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("select",{value:Oe,onChange:Et=>Me(Et.target.value),className:"text-[10px] font-mono border border-emerald-300 rounded px-1.5 py-1 bg-white text-emerald-800 focus:outline-none",title:"Primary model (pre-loaded from assistant config)",children:Xe.map(Et=>r.jsx("option",{value:Et,children:Et},Et))}),r.jsxs("select",{value:ue,onChange:Et=>Ve(Et.target.value),className:"text-[10px] font-mono border border-emerald-300 rounded px-1.5 py-1 bg-white text-emerald-800 focus:outline-none",title:"Secondary model (pre-loaded from assistant config)",children:[r.jsx("option",{value:"none",children:"2nd: none"}),Xe.map(Et=>r.jsx("option",{value:Et,children:Et},Et))]}),r.jsx("button",{onClick:()=>at(he,$e.content),disabled:Q.searchLoading,className:`text-[10px] font-mono border rounded px-2 py-1 transition-colors disabled:opacity-50 ${Q.openPanel==="search"?"bg-emerald-700 border-emerald-500 text-emerald-100":"bg-emerald-50 border-emerald-300 text-emerald-700 hover:bg-emerald-100"}`,children:Q.searchLoading?"⏳ searching…":"🔍 Search"})]})]}),Q.openPanel==="settings"&&le&&r.jsxs("div",{className:"bg-slate-900 border border-slate-600 rounded-xl p-3",children:[r.jsx("div",{className:"text-[10px] font-mono text-slate-400 mb-1.5",children:"assistant settings — these are the EXACT params invokeAssistant uses in production:"}),r.jsx("pre",{className:"text-[10px] font-mono text-slate-200 whitespace-pre-wrap overflow-auto max-h-64",children:JSON.stringify({...le,"→ search_payload_will_include":{query_model_primary:le.ivss_query_model_primary,query_model_secondary:le.ivss_query_model_secondary!=="none"?le.ivss_query_model_secondary:"(disabled)"}},null,2)})]}),Q.openPanel==="invoke"&&!Q.invokeLoading&&r.jsx("div",{className:"space-y-1.5",children:Q.invokeError?r.jsx("div",{className:"bg-red-950 border border-red-700 rounded-lg px-3 py-2 text-[10px] font-mono text-red-300",children:Q.invokeError}):Q.invokeData&&r.jsxs(r.Fragment,{children:[((Be=(oe=Q.invokeData)==null?void 0:oe.debug_info)==null?void 0:Be.search_payload_sent)&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-mono text-amber-500 mb-0.5",children:"→ ItemsVectorSemanticSearch payload:"}),r.jsx("pre",{className:"bg-slate-900 text-slate-300 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-40 w-full",children:JSON.stringify(Q.invokeData.debug_info.search_payload_sent,null,2)})]}),((qt=(pt=(Ze=Q.invokeData)==null?void 0:Ze.debug_info)==null?void 0:pt.kb_context_items)==null?void 0:qt.length)>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"text-[10px] font-mono text-emerald-500 mb-0.5",children:["items retrieved (",Q.invokeData.debug_info.kb_context_items.length,"):"]}),r.jsx("pre",{className:"bg-emerald-950 text-emerald-200 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-32 w-full",children:Q.invokeData.debug_info.kb_context_items.map(Et=>`[${Et.score!=null?(Et.score*100).toFixed(0)+"%":"?"}] ${Et.title}`).join(`
1129`)})]}),((Xt=(Kt=Q.invokeData)==null?void 0:Kt.debug_info)==null?void 0:Xt.full_prompt)&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-mono text-violet-400 mb-0.5",children:"full prompt sent to LLM:"}),r.jsx("pre",{className:"bg-indigo-950 text-indigo-200 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-64 w-full whitespace-pre-wrap break-words",children:Q.invokeData.debug_info.full_prompt})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-mono text-slate-400 mb-0.5",children:"raw response JSON:"}),r.jsx("pre",{className:"bg-gray-900 text-green-300 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-72 w-full",children:JSON.stringify(Q.invokeData,null,2)})]})]})}),Q.openPanel==="search"&&!Q.searchLoading&&r.jsx("div",{className:"space-y-1.5",children:Q.searchError?r.jsx("div",{className:"bg-red-950 border border-red-700 rounded-lg px-3 py-2 text-[10px] font-mono text-red-300",children:Q.searchError}):r.jsxs(r.Fragment,{children:[Q.searchPayload&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-mono text-amber-500 mb-0.5",children:"payload sent to ItemsVectorSemanticSearch:"}),r.jsx("pre",{className:"bg-slate-900 text-slate-300 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-40 w-full",children:JSON.stringify(Q.searchPayload,null,2)})]}),Q.searchData&&r.jsxs("div",{children:[r.jsxs("div",{className:"text-[10px] font-mono text-emerald-500 mb-0.5",children:["results (",((Nn=Q.searchData.results)==null?void 0:Nn.length)??0,") · latency: ",Q.searchData.latency_ms,"ms:"]}),r.jsx("pre",{className:"bg-emerald-950 text-emerald-200 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-72 w-full",children:(Q.searchData.results||[]).map(Et=>`[${(Et.score*100).toFixed(0)}%] ${Et.title}
1130  kb: ${Et.kb_name||"-"} | url: ${Et.url||"-"}
1131  ${(Et.human_summary||Et.content||"").slice(0,150)}…`).join(`
1132
1133`)})]})]})})]})]},he)}),o&&r.jsx("div",{className:"flex justify-start",children:r.jsx("div",{className:"bg-white border border-gray-200 rounded-2xl rounded-bl-sm px-4 py-3 shadow-sm",children:r.jsxs("div",{className:"flex gap-1 items-center",children:[r.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),r.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),r.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})}),r.jsx("div",{ref:bt})]}),r.jsxs("div",{className:"bg-white border-t px-4 pt-4 pb-3",children:[r.jsxs("form",{onSubmit:Cn,className:"max-w-2xl mx-auto flex gap-2",children:[r.jsx("input",{value:a,onChange:$e=>i($e.target.value),placeholder:"Type your message...",disabled:o,className:"flex-1 border border-gray-200 rounded-xl px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 disabled:opacity-50"}),r.jsx("button",{type:"submit",disabled:!a.trim()||o,className:"disabled:opacity-50 text-white px-5 py-2.5 rounded-xl text-sm font-medium transition-colors",style:{background:K.sendBtnColor},children:"Send"})]}),y&&r.jsx("p",{className:"max-w-2xl mx-auto mt-2 text-[10px] text-gray-400 text-center leading-snug",children:y})]}),te&&r.jsx(o3,{msg:te,query:te.query||"",chatId:c,assistantKey:t,assistantName:f,reporterName:tt,onClose:()=>De(null),onNameSave:$e=>me($e),debugMode:we}),_e&&r.jsx(CW,{msg:_e,query:_e.query||"",chatId:c,assistantKey:t,assistantName:f,reporterName:tt,onClose:()=>We(null),onNameSave:$e=>me($e)})]})}function Z4e({selectedLang:e,onLangChange:t,browserLang:n,country:s}){const[a,i]=h.useState(!1),[o,l]=h.useState(""),c=h.useRef(null),d=Es(e),f=Es(n),m=s?Es(EW(s)||""):null;let g=null;f!=="en"?g=f:m&&m!=="en"?g=m:g="es";const x=["en"];g&&!x.includes(g)&&x.push(g),m&&m!=="en"&&m!==f&&!x.includes(m)&&x.push(m),h.useEffect(()=>{function y(w){c.current&&!c.current.contains(w.target)&&i(!1)}return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);function j(y){t(y),i(!1),l("")}const b=Object.entries(l3).filter(([y,w])=>{const _=o.toLowerCase();return y.includes(_)||w.toLowerCase().includes(_)});return r.jsxs("div",{className:"flex items-center gap-1.5 relative",ref:c,children:[r.jsx("div",{className:"flex items-center gap-0.5 bg-gray-50 rounded-lg p-0.5 border border-gray-200",children:x.map(y=>r.jsxs("button",{onClick:()=>j(y),title:ro(y),className:`flex items-center gap-1 px-1.5 py-1 rounded-md transition-all ${d===y?"bg-indigo-100 ring-1 ring-indigo-400":"hover:bg-gray-100"}`,children:[r.jsx("img",{src:Tp(y),alt:y,className:"w-4 h-3 rounded-sm object-cover",onError:w=>{w.target.style.opacity=.3}}),r.jsx("span",{className:`text-[10px] font-medium ${d===y?"text-indigo-700":"text-gray-500"}`,children:y.toUpperCase()})]},y))}),r.jsxs("button",{onClick:()=>i(y=>
1133!y),className:`flex items-center gap-0.5 px-2 py-1.5 rounded-lg border transition-colors ${a?"bg-indigo-50 border-indigo-300":"bg-white border-gray-200 hover:bg-gray-50"}`,title:"More languages",children:[r.jsx(Na,{className:"w-3.5 h-3.5 text-gray-500"}),r.jsx(gt,{className:`w-3 h-3 text-gray-400 transition-transform ${a?"rotate-180":""}`})]}),a&&r.jsxs("div",{className:"absolute top-full right-0 mt-1 bg-white border border-gray-200 rounded-xl shadow-lg z-50 min-w-[220px] overflow-hidden",children:[r.jsx("div",{className:"px-2 py-1.5 border-b border-gray-100 bg-white",children:r.jsxs("div",{className:"flex items-center gap-1.5 border border-gray-200 rounded-lg px-2 py-1",children:[r.jsx(ur,{className:"w-3 h-3 text-gray-400 shrink-0"}),r.jsx("input",{value:o,onChange:y=>l(y.target.value),onKeyDown:y=>{y.key==="Escape"&&i(!1)},placeholder:"Search language...",className:"flex-1 text-xs focus:outline-none min-w-0",autoFocus:!0})]})}),r.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[b.map(([y,w])=>r.jsxs("button",{onClick:()=>j(y),className:"w-full text-left px-3 py-2 text-xs hover:bg-gray-50 flex items-center gap-2",children:[r.jsx("img",{src:Tp(y),alt:y,className:"w-4 h-3 rounded-sm shrink-0"}),r.jsx("span",{className:d===y?"text-indigo-600 font-medium":"text-gray-600",children:w}),r.jsx("span",{className:"text-[10px] text-gray-400 ml-auto",children:y.toUpperCase()}),d===y&&r.jsx(Tn,{className:"w-3 h-3 text-indigo-500"})]},y)),b.length===0&&r.jsx("div",{className:"px-3 py-2 text-xs text-gray-400",children:"No language found"})]})]})]})}function eIe({selectedLang:e,browserLang:t,country:n,pageUrl:s}){const[a,i]=h.useState(!0),o=Es(e),l=Es(t),c=n?Es(EW(n)||""):null;let d=null;l!=="en"?d=l:c&&c!=="en"?d=c:d="es";const f=o!=="en"?o:d!=="en"?d:null,m=f?ro(f):null;if(!s||!f)return null;function g(){if(a){const x=`https://translate.google.com/translate?sl=auto&tl=${f}&u=${encodeURIComponent(s)}`;window.open(x,"_blank","noopener,noreferrer")}else{const x=new URL(window.location.origin+"/TranslatePage");x.searchParams.set("page_url",s),x.searchParams.set("lang",f),x.searchParams.set("engine","ai"),window.open(x.toString(),"_blank","noopener,noreferrer")}}return r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsxs("button",{onClick:g,title:`Open page translated to ${m}`,className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border border-violet-200 bg-violet-50 text-violet-700 hover:bg-violet-100 transition-colors whitespace-nowrap",children:[r.jsx(V5,{className:"w-2.5 h-2.5 shrink-0"}),r.jsxs("span",{className:"leading-tight",children:["Translate to ",m]}),r.jsx(yr,{className:"w-2 h-2 shrink-0"})]}),r.jsxs("div",{className:"flex items-center bg-gray-100 rounded p-0.5",children:[r.jsx("button",{onClick:()=>i(!0),className:`px-1 py-0.5 rounded text-[9px] font-medium transition-colors ${a?"bg-white text-indigo-600 shadow-sm":"text-gray-400"}`,children:"Google"}),r.jsx("button",{onClick:()=>i(!1),className:`px-1 py-0.5 rounded text-[9px] font-medium transition-colors ${a?"text-gray-400":"bg-white text-indigo-600 shadow-sm"}`,children:"AI translation"})]})]})}const qB=["page_url","referrer_url","gated_cookie","guide_cookie","wp_user_id","wp_user_email","assistant_mode","suggest_content","compact_mode"],KB={referrer_url:"referrer"},tIe={page_url:"https://example.com/page",referrer_url:"https://referrer.com",gated_cookie:"cookie value",guide_cookie:"cookie value",wp_user_id:"WP user ID",wp_user_email:"[email protected]",assistant_mode:"PAGE_ONLY",suggest_content:"NO",compact_mode:"no"};function TW({params:e,onChange:t}){const[n,s]=h.useState(!1),a=window.location.origin+window.location.pathname,i=new URLSearchParams;qB.forEach(d=>{const f=e[d];if(f!=null&&f!==""){const m=KB[d]||d;i.set(m,String(f))}});const o=i.toString(),l=o?`${a}?${o}`:a;function c(){navigator.clipboard.writeText(l).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})}return r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-slate-500",children:"Editable parameters (updates URL below):"}),r.jsx("div",{className:"space-y-1",children:qB.map(d=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-violet-300 shrink-0 w-32",children:[KB[d]||d,":"]}),r.jsx("input",{value:e[d]||"",onChange:f=>t(d,f.target.value),placeholder:tIe[d]||"",className:"flex-1 min-w-0 bg-slate-900 border border-slate-700 rounded px-2 py-0.5 text-emerald-300 text-[11px] focus:outline-none focus:ring-1 focus:ring-indigo-500 placeholder-slate-600"})]},d))}),r.jsxs("div",{className:"pt-2 border-t border-slate-700 space-y-1",children:[r.jsx("div",{className:"text-slate-500",children:"Assembled URL:"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{readOnly:!0,value:l,className:"flex-1 min-w-0 bg-slate-900 border border-slate-700 rounded px-2 py-1 text-sky-300 text-[11px] font-mono"}),r.jsxs("button",{onClick:c,className:"flex items-center gap-1 px-2 py-1 text-[10px] bg-indigo-600 text-white rounded hover:bg-indigo-700 transition-colors whitespace-nowrap",children:[n?r.jsx(Tn,{className:"w-3 h-3"}):r.jsx(ri,{className:"w-3 h-3"}),n?"Copied!":"Copy"]}),r.jsx("button",{onClick:()=>window.open(l,"_blank","noopener,noreferrer"),title:"Open in new tab",className:"flex items-center gap-1 px-2 py-1 text-[10px] bg-emerald-600 text-white rounded hover:bg-emerald-700 transition-colors",children:r.jsx(yr,{className:"w-3 h-3"})})]})]})]})}
1133function nIe({urlParams:e,wpParams:t,assistantMode:n,suggestContent:s,apiUserId:a,editableParams:i,onParamChange:o}){const l=[];return e&&e.forEach((c,d)=>{l.push({key:d,value:c})}),r.jsxs("div",{className:"bg-slate-950 border-b border-slate-700 px-6 py-4 space-y-3 font-mono text-[11px]",children:[r.jsx("div",{className:"text-slate-400 font-semibold uppercase tracking-widest text-[10px]",children:"📋 URL Parameters Received"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"text-slate-500",children:["All URL search params (",l.length,"):"]}),l.length===0?r.jsx("div",{className:"text-slate-600 italic",children:"No URL parameters."}):l.map(({key:c,value:d},f)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("span",{className:"text-sky-300 shrink-0",children:[c,":"]}),r.jsx("span",{className:"text-emerald-300 break-all",children:d||"(empty)"})]},f))]}),r.jsx("div",{className:"pt-2 border-t border-slate-700",children:r.jsx(TW,{params:i,onChange:o})}),r.jsxs("div",{className:"pt-2 border-t border-slate-700 space-y-0.5",children:[r.jsx("div",{className:"text-slate-500",children:"Other context params (read-only):"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-violet-300 shrink-0",children:"api_user_id:"}),r.jsx("span",{className:"text-yellow-300 break-all",children:a})]})]})]})}function rIe({visitorInfo:e,wpParams:t,apiUserId:n,assistantKey:s,editableParams:a,onParamChange:i}){const o=e||{};return r.jsxs("div",{className:"bg-slate-950 border-b border-slate-700 px-6 py-4 space-y-3 font-mono text-[11px]",children:[r.jsx("div",{className:"text-slate-400 font-semibold uppercase tracking-widest text-[10px]",children:"👤 User & Analytics Stored"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-slate-500",children:"Geography (IP-enriched):"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-sky-300 shrink-0",children:"IP address:"}),r.jsx("span",{className:"text-emerald-300",children:o.ip_address||"(not enriched)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-sky-300 shrink-0",children:"Organization:"}),r.jsx("span",{className:"text-emerald-300",children:o.org||"(not enriched)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-sky-300 shrink-0",children:"Country:"}),r.jsx("span",{className:"text-emerald-300",children:o.country||"(not enriched)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-sky-300 shrink-0",children:"City:"}),r.jsx("span",{className:"text-emerald-300",children:o.city||"(not enriched)"})]})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-slate-500",children:"Browser & Device:"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-sky-300 shrink-0",children:"Browser:"}),r.jsx("span",{className:"text-emerald-300",children:o.browser||"-"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-sky-300 shrink-0",children:"OS:"}),r.jsx("span",{className:"text-emerald-300",children:o.os||"-"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-sky-300 shrink-0",children:"Device:"}),r.jsx("span",{className:"text-emerald-300",children:o.device||"-"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-sky-300 shrink-0",children:"Language:"}),r.jsx("span",{className:"text-emerald-300",children:o.language||"-"})]})]}),r.jsx("div",{className:"pt-2 border-t border-slate-700",children:r.jsx(TW,{params:a,onChange:i})}),r.jsxs("div",{className:"space-y-0.5 pt-2 border-t border-slate-700",children:[r.jsx("div",{className:"text-slate-500",children:"Where this data is stored:"}),r.jsxs("div",{className:"text-slate-300",children:["• ",r.jsx("span",{className:"text-indigo-300",children:"AssistantPageView"})," — page load event (IP, geo, browser, URL, referrer, WP params)"]}),r.jsxs("div",{className:"text-slate-300",children:["• ",r.jsx("span",{className:"text-indigo-300",children:"Chat"}
1133)," — conversation record (IP, geo, browser, WP params, tags)"]}),r.jsxs("div",{className:"text-slate-300",children:["• ",r.jsx("span",{className:"text-indigo-300",children:"Message"})," — each message in the conversation"]})]})]})}function sIe({mode:e,onChange:t,uiStrings:n,pageUrl:s,compact:a}){const i=e==="PAGE_ONLY",o=!!s;return r.jsxs("div",{className:"flex items-center gap-0.5 bg-gray-50 rounded-lg p-0.5 border border-gray-200",children:[r.jsxs("button",{onClick:()=>o&&t("PAGE_ONLY"),disabled:!o,className:`flex items-center gap-1 px-2 py-1 rounded-md text-[10px] transition-all ${i&&o?"bg-indigo-100 text-indigo-700 font-medium ring-1 ring-indigo-400":o?"text-gray-500 hover:bg-gray-100":"text-gray-300 cursor-not-allowed"}`,title:o?n.searchModePage:n.searchModePageUnavailable||"No page context",children:[r.jsx(ns,{className:"w-3 h-3"}),!a&&n.searchModePage]}),r.jsxs("button",{onClick:()=>t("LIBRARY"),className:`flex items-center gap-1 px-2 py-1 rounded-md text-[10px] transition-all ${i?"text-gray-500 hover:bg-gray-100":"bg-indigo-100 text-indigo-700 font-medium ring-1 ring-indigo-400"}`,title:n.searchModeLibrary,children:[r.jsx(Cee,{className:"w-3 h-3"}),!a&&n.searchModeLibrary]})]})}function aIe(){var pn;const e=window.location.pathname.match(/\/LearningAssistant\/v2\/([^/?#]+)/),t=e?e[1]:null,[n,s]=h.useState([]),[a,i]=h.useState(""),[o,l]=h.useState(!1),[c,d]=h.useState(null),[f,m]=h.useState(""),[g,x]=h.useState(""),[j,b]=h.useState(""),[y,w]=h.useState(""),[_,N]=h.useState([]),[C,k]=h.useState(0),[S,A]=h.useState(0),[T,R]=h.useState(!1),[B]=h.useState(()=>`anon-${Math.random().toString(36).slice(2)}`),D=new URLSearchParams(window.location.search),[P,I]=h.useState({page_url:D.get("page_url")||null,referrer_url:D.get("referrer")||null,gated_cookie:D.get("gated_cookie")||null,guide_cookie:D.get("guide_cookie")||null,wp_user_id:D.get("wp_user_id")||null,wp_user_email:D.get("wp_user_email")||null}),[z,L]=h.useState(()=>{const je=D.get("assistant_mode")||"PAGE_ONLY",Ke=!!D.get("page_url");return je==="PAGE_ONLY"&&!Ke?"LIBRARY":je}),[H,W]=h.useState(D.get("suggest_content")||"NO"),[V,K]=h.useState(()=>{const je=(D.get("compact_mode")||"no").toLowerCase();return je==="yes"||je==="true"||je==="1"}),[M,G]=h.useState(""),[q,F]=h.useState(""),[U,ee]=h.useState(null),ne={...P,assistant_mode:z,suggest_content:H,compact_mode:V?"yes":"no"};function X(je,Ke){je==="assistant_mode"?L(Ke):je==="suggest_content"?W(Ke):je==="compact_mode"?K(Ke===!0||Ke==="true"||Ke==="yes"||Ke==="1"):I(Te=>({...Te,[je]:Ke||null}))}const[ie,Z]=h.useState(""),[ce,le]=h.useState("ContentLink"),[re,Ue]=h.useState("system"),[Ne,Oe]=h.useState(!1),[Me,ue]=h.useState(!1),[Ve,Xe]=h.useState(null),[te,De]=h.useState({fontFamily:"Open Sans",bodyFontSize:14,titleFontSize:18,textColor:"#2B2A2D",answerBg:"#163898",sendBtnColor:"#FF4E17",userBg:"#CCE3FF",iconScale:1.8}),[_e,We]=h.useState(null),[tt,me]=h.useState([]),[ae,Se]=h.useState(null),[Le,He]=h.useState(null),[ut,ze]=h.useState(!1),[fe,dt]=h.useState(!1),[ct,Wt]=h.useState(!1),[bt,sn]=h.useState(()=>{try{const je=D.get("lang");return je||localStorage.getItem(`embed_lang_${t||"default"}`)||navigator.language||"en"}catch{return navigator.language||"en"}}),[we,Qe]=h.useState(null),[it,at]=h.useState(null),[Gt,Cn]=h.useState(null),[Jn,Hn]=h.useState(null),[tn,On]=h.useState(null),[as,$e]=h.useState(!1),he=h.useRef({}),Q=h.useRef({}),ke=h.useRef(0);h.useRef(!1);const[Ee,Ye]=h.useState(null),[Tt,Ut]=h.useState({}),[$t,En]=h.useState("jina-embeddings-v5-text-small"),[Pr,zs]=h.useState("none"),oe=["jina-embeddings-v5-text-small","jina-embeddings-v3"],[Be,Ze]=h.useState(null),[pt,qt]=h.useState(null),[Kt,Xt]=h.useState(()=>{try{return localStorage.getItem(`embed_name_${t||"default"}`)||""}catch{return""}}),[Nn,Et]=h.useState(!1),[Zt,mn]=h.useState({}),[Os,la]=h.useState({}),[Ea,Ri]=h.useState({}),[Aa,po]=h.useState({}),Mi=h.useRef(null),Is=h.useRef(null);h.useEffect(()=>{const je={};try{je.parentUrl=window.parent.location.href,je.parentPingStatus="success"}catch(Ke){je.parentUrl=null,je.parentPingStatus="blocked",je.parentPingError=Ke.message}try{const Ke="embed_url_history",Te=JSON.parse(sessionStorage.getItem(Ke)||"[]"),nn=window.location.href,_t=document.referrer||null;Te[Te.length-1]!==nn&&(Te.push({url:nn,ts:new Date().toISOString()}),Te.length>20&&Te.shift(),sessionStorage.setItem(Ke,JSON.stringify(Te))),je.sessionHistory=Te,je.sessionPingStatus="success",je.referrer=_t}catch(Ke){je.sessionHistory=null,je.sessionPingStatus="blocked",je.sessionHistoryError=Ke.message}je.selfUrl=window.location.href,je.browserReferrer=document.referrer||"(empty)",He(je)},[]);const Us=Ve!==null?Ve:Me||(re==="debug"?!0:re==="production"?!1:Ne);h.useEffect(()=>{const je=te.fontFamily||"Open Sans",Ke="embed-chat-font",Te=document.getElementById(Ke),_t=`https://fonts.googleapis.com/css2?family=${je.replace(/ /g,"+")}:wght@400;700&display=swap`;if(Te)Te.href=_t;else{const fn=document.createElement("link");fn.id=Ke,fn.rel="stylesheet",fn.href=_t,document.head.appendChild(fn)}},[te.fontFamily]),h.useEffect(()=>{if(!t){R(!0);return}(async()=>{let je=null;try{const Ke=await fetch("https://api.ipify.org?format=json");Ke.ok&&(je=(await Ke.json()).ip||null)}catch{}Y.functions.invoke("getEmbedAssistantInfo",{assistant_key:t,api_user_id:B,current_url:window.location.href||null,referrer:document.referrer||null,user_agent:navigator.userAgent||null,visitor_ip:je,language:navigator.language||null,path_depth:window.location.pathname.split("/").filter(
1133Boolean).length,wp_params:P,assistant_mode:z,suggest_content:H}).then(Ke=>{const Te=Ke.data;if(!Te||Te.error){R(!0);return}if(Te.embed_page_type!=="learning"){R(!0);return}m(Te.name),x(Te.icon_url||""),N(Te.suggested_prompts||[]),k(Te.max_suggested_prompts??0),b(Te.public_page_message||""),G(Te.page_aware_welcome||""),F(Te.library_label||""),w(Te.disclaimer||""),document.title=Te.chat_title||Te.name||"Assistant",We(Te.assistant_id||null),me(Te.knowledge_base_ids||[]);const nn=Te.ivss_query_model_primary||"jina-embeddings-v5-text-small",_t=Te.ivss_query_model_secondary||"none";Ye({model:Te.model||"automatic",temperature:Te.temperature??.3,search_function:Te.search_function||"ItemsVectorSemanticSearch",jina_task:Te.jina_task||null,max_context_items:Te.max_context_items??10,min_chunk_score:Te.min_chunk_score??0,ivss_top_k_multiple:Te.ivss_top_k_multiple??1,ivss_include_summaries:Te.ivss_include_summaries??!1,context_messages:Te.context_messages??6,max_chars_per_item:Te.max_chars_per_item??2e3,knowledge_base_ids:Te.knowledge_base_ids||[],ivss_query_model_primary:nn,ivss_query_model_secondary:_t}),En(nn),zs(_t),Se({ip_address:Te.visitor_ip||null,org:Te.visitor_org||null,country:Te.visitor_country||null,city:Te.visitor_city||null,browser:Te.visitor_browser||null,os:Te.visitor_os||null,device:Te.visitor_device||null,language:Te.visitor_language||null}),Ue(Te.embed_debug_mode||"system"),Oe(Te.system_debug??!1),ue(Te.debug_mode??!1),Z(Te.embed_special_node||""),le(Te.embed_link_node||"ContentLink"),De({fontFamily:Te.embed_chat_font_family||"Open Sans",bodyFontSize:Te.embed_chat_body_font_size??14,titleFontSize:Te.embed_chat_title_font_size??18,textColor:Te.embed_chat_text_color||"#2B2A2D",answerBg:Te.embed_chat_answer_bg||"#163898",sendBtnColor:Te.embed_chat_send_btn_color||"#FF4E17",userBg:Te.embed_chat_user_bg||"#CCE3FF",iconScale:Te.embed_chat_icon_scale??1.8})}).catch(()=>R(!0))})()},[t]),h.useEffect(()=>{try{localStorage.setItem(`embed_lang_${t||"default"}`,bt)}catch{}},[bt,t]),h.useEffect(()=>{try{localStorage.setItem(`embed_name_${t||"default"}`,Kt)}catch{}},[Kt,t]),h.useEffect(()=>{const je=Es(bt),Ke=!!ob[je];if(je==="en"){Qe(null),at(null),ee(null),Cn(null),Hn(null),On(null);return}if(he.current[je]){const fn=he.current[je];Qe(fn.prompts),at(fn.welcome),ee(fn.pageAwareWelcome||null),Cn(fn.disclaimer),Hn(fn.ui||null);return}if(!_.length&&!j&&!M&&!y&&Ke)return;const Te=++ke.current;$e(!0);const nn=(_||[]).map(fn=>Di(fn).text),_t={welcome:j||"",pageAwareWelcome:M||"",prompts:nn,disclaimer:y||""};Ke||(_t.ui={...ob.en}),Y.integrations.Core.InvokeLLM({prompt:`Translate the following JSON values to ${ro(bt)} (${je}). Preserve any HTML tags — only translate the text content. Keep the same keys and structure. Return only the JSON, no explanation.
1134${JSON.stringify(_t)}`,response_json_schema:{type:"object",properties:{welcome:{type:"string"},pageAwareWelcome:{type:"string"},prompts:{type:"array",items:{type:"string"}},disclaimer:{type:"string"},...Ke?{}:{ui:{type:"object",properties:{online:{type:"string"},yourName:{type:"string"},yourNamePlaceholder:{type:"string"},typeMessage:{type:"string"},send:{type:"string"},defaultWelcome:{type:"string"},suggest:{type:"string"},report:{type:"string"},feedback:{type:"string"},translateAnswer:{type:"string"},showOriginal:{type:"string"},searchModeLibrary:{type:"string"},searchModePage:{type:"string"},contextLabel:{type:"string"}}}}}}}).then(fn=>{if(Te!==ke.current)return;const Pa=Array.isArray(fn.prompts)?fn.prompts.map((zr,xo)=>({text:zr,scope:Di((_||[])[xo]).scope})):_,is={welcome:fn.welcome??j,pageAwareWelcome:fn.pageAwareWelcome??M,prompts:Pa,disclaimer:fn.disclaimer??y,ui:fn.ui||null};he.current[je]=is,Qe(is.prompts),at(is.welcome),ee(is.pageAwareWelcome),Cn(is.disclaimer),Hn(is.ui),$e(!1)}).catch(()=>{Te===ke.current&&$e(!1)})},[bt,_,j,M,y]),h.useEffect(()=>{const je=Es(bt),Ke=P.page_url&&z==="PAGE_ONLY"?hr(P.page_url):q||f||"Library";if(je==="en"||!Ke){On(null);return}const Te=`${je}:${Ke}`;if(Q.current[Te]){On(Q.current[Te]);return}Y.integrations.Core.InvokeLLM({prompt:`Translate the following short text to ${ro(bt)} (${je}). This is a page name or library label shown in a chat header. Return only the translated text, no explanation.
1135${Ke}`}).then(nn=>{Q.current[Te]=nn,On(nn)}).catch(()=>{})},[bt,P.page_url,z,q,f]),h.useEffect(()=>{var je;(je=Mi.current)==null||je.scrollIntoView({behavior:"smooth"})},[n,o]),h.useEffect(()=>{if(C<=0)return;const je=Cc(we||_,z);if(je.length<=C)return;const Ke=setInterval(()=>{A(Te=>(Te+C)%je.length)},7e3);return()=>clearInterval(Ke)},[C,_,we,z]);function hr(je){if(!je)return null;
1135try{const Ke=new URL(je),Te=Ke.pathname.split("/").filter(Boolean).pop();return Te?decodeURIComponent(Te).replace(/[-_]/g," "):Ke.hostname}catch{return je}}function Di(je){return typeof je=="string"?{text:je,scope:"both"}:{text:(je==null?void 0:je.text)||"",scope:(je==null?void 0:je.scope)||"both"}}function Cc(je,Ke){if(!Array.isArray(je))return[];const Te=Ke==="PAGE_ONLY"?"page":"library";return je.map(Di).filter(nn=>nn.scope===Te||nn.scope==="both")}function qs(je,Ke){Ut(Te=>({...Te,[je]:{...Te[je]||{},...Ke}}))}async function Li(je,Ke){qs(je,{invokeLoading:!0,invokeData:null,invokeError:null,openPanel:"invoke"});try{const Te=await Y.functions.invoke("embeddedAssistantChat",{assistant_key:t,message:Ke,api_user_id:`debug-${B}`,no_persist:!0,debug_mode:!0});qs(je,{invokeLoading:!1,invokeData:Te.data})}catch(Te){qs(je,{invokeLoading:!1,invokeError:Te.message})}}async function al(je,Ke){qs(je,{searchLoading:!0,searchData:null,searchError:null,openPanel:"search"});const Te=Ee||{},nn={query:Ke,knowledge_base_ids:Te.knowledge_base_ids||tt,top_k:Te.max_context_items??10,top_k_multiple:Te.ivss_top_k_multiple??1,min_chunk_score:Te.min_chunk_score??0,include_summaries:Te.ivss_include_summaries??!1,...Te.jina_task?{jina_task:Te.jina_task}:{},query_model_primary:$t,...Pr!=="none"?{query_model_secondary:Pr}:{},caller:"embed_debug_search"};try{const _t=await Y.functions.invoke("ItemsVectorSemanticSearch",nn);qs(je,{searchLoading:!1,searchData:_t.data,searchPayload:nn})}catch(_t){qs(je,{searchLoading:!1,searchError:_t.message,searchPayload:nn})}}async function Fr(je){if(!je||o)return;i(""),s(nn=>[...nn,{role:"user",content:je}]),l(!0);const Ke=Date.now(),Te=c;try{const _t=(await Y.functions.invoke("embeddedAssistantChat",{assistant_key:t,message:je,api_user_id:B,...Te?{chat_id:Te}:{},...Us?{debug_mode:!0}:{},...ae?{visitor_info:ae}:{},...P?{wp_params:P}:{},assistant_mode:z,suggest_content:H,user_selected_language:bt})).data;_t!=null&&_t.chat_id&&!Te&&d(_t.chat_id);const fn=ie&&(_t!=null&&_t.data)&&Array.isArray(_t.data[ie])?_t.data[ie]:null,Pa=_t!=null&&_t.data&&Array.isArray(_t.data.followup_questions)?_t.data.followup_questions.map(zr=>String(zr).trim()).filter(zr=>zr):[],is=Date.now()-Ke;s(zr=>{var xo;return[...zr,{role:"assistant",content:((_t==null?void 0:_t.answer)||"No response.").replace(/\\n
1135/g,`
1136`),query:je,specialItems:fn,followupQuestions:Pa,rawData:_t??null,fullPrompt:((xo=_t==null?void 0:_t.debug_info)==null?void 0:xo.full_prompt)??null,messageId:(_t==null?void 0:_t.message_id)??null,elapsed:is}]})}catch(nn){const _t=Date.now()-Ke;s(fn=>[...fn,{role:"assistant",content:"Something went wrong. Please try again.",query:je,error:!0,errorMessage:(nn==null?void 0:nn.message)||"Unknown error",elapsed:_t}])}l(!1)}async function Ta(je){je==null||je.preventDefault();const Ke=a.trim();await Fr(Ke)}async function il(je){c&&Y.entities.Chat.filter({id:c}).then(([Ke])=>{const Te=(Ke==null?void 0:Ke.link_clicks)||{},nn={...Te,[je]:(Te[je]||0)+1};Y.entities.Chat.update(c,{link_clicks:nn}).catch(()=>{})}).catch(()=>{})}async function Gd(je,Ke,Te){const _t=Zt[je]===Te?null:Te;mn(fn=>({...fn,[je]:_t})),Ke.messageId&&await Y.entities.Message.update(Ke.messageId,{feedback:_t||null}),_t&&!Us&&Ze(Ke)}async function go(je,Ke){var nn;const Te=(((nn=Ea[je])==null?void 0:nn.text)||"").trim();if(!Te){po(_t=>({..._t,[je]:!1}));return}Ri(_t=>({..._t,[je]:{..._t[je],submitting:!0}})),await Y.functions.invoke("submitIssueReport",{assistant_key:t,assistant_name:f,chat_id:c||null,query:Ke.query||"",answer:Ke.content||"",expected_answer:Te,comments:`Feedback: ${Zt[je]==="up"?"👍 Positive":"👎 Negative"}`}).catch(()=>{}),Ri(_t=>({..._t,[je]:{text:"",submitting:!1,submitted:!0}})),setTimeout(()=>po(_t=>({..._t,[je]:!1})),1500)}if(T)return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx("p",{className:"text-2xl font-bold text-gray-400",children:"404"}),r.jsx("p",{className:"text-gray-500",children:"Assistant not found."})]})});const Sr=Jn||Q4e(Es(bt)),li=Cc(we||_,z),$i=C>0&&li.length>C?Array.from({length:C},(je,Ke)=>li[(S+Ke)%li.length]):li,Ec=P.page_url&&z==="PAGE_ONLY"?hr(P.page_url):q||f||"Library",ye=hr(P.page_url),qe=!!(P.page_url&&z==="PAGE_ONLY"&&(M||U)),nt=U||M,ft=qe&&nt?nt.replace(/\{\{page_name\}\}/g,ye||""):it||j,Lt=Gt||y,Yt=V?28:Math.round(36*te.iconScale);return r.jsxs("div",{className:"h-screen flex flex-col overflow-hidden bg-gradient-to-br from-indigo-50 to-white",style:{fontFamily:`'${te.fontFamily}', sans-serif`},children:[r.jsx("div",{className:`bg-white border-b shadow-sm ${V?"px-2 py-1.5":"px-4 py-3 sm:px-6 sm:py-4"}`,children:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 shrink-0",children:[r.jsx("div",{className:"rounded-full bg-indigo-100 flex items-center justify-center shrink-0 overflow-hidden",style:{width:Yt,height:Yt,minWidth:Yt},children:g?r.jsx("img",{src:g,alt:"",className:"w-full h-full object-contain"}):r.jsx("span",{className:"text-indigo-600 font-bold text-sm",children:"AI"})}),r.jsx("div",{className:"min-w-0",children:r.jsx("p",{className:"font-bold text-gray-900 truncate",style:{fontSize:V?"14px":`${te.titleFontSize}px`,fontFamily:`'${te.fontFamily}', sans-serif`,fontWeight:700},children:f||"Assistant"})})]}),r.jsx("div",{className:"flex-1 flex justify-center min-w-0",children:Nn?r.jsx("input",{ref:Is,value:Kt,onChange:je=>Xt(je.target.value),onBlur:()=>Et(!1),onKeyDown:je=>{je.key==="Enter"&&Et(!1)},autoFocus:!0,placeholder:Sr.yourNamePlaceholder,className:`border border-indigo-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-400 w-48 sm:w-64 ${V?"px-3 py-1.5 text-sm":"px-5 py-2.5 text-2xl"}`}):r.jsx("button",{onClick:()=>Et(!0),className:`${V?"text-sm px-3 py-1.5":"text-2xl px-5 py-2.5"} rounded-lg border transition-colors ${Kt?"border-gray-200 text-gray-700 hover:bg-gray-50":"border-dashed border-gray-300 text-gray-400 hover:border-indigo-400 hover:text-indigo-600"}`,children:Kt||Sr.yourName})}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx(Z4e,{selectedLang:bt,onLangChange:sn,browserLang:navigator.language,country:ae==null?void 0:ae.country}),Us&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>dt(je=>!je),title:"URL Parameters received",className:`text-[10px] font-mono border rounded-lg px-2.5 py-1 transition-colors ${fe?"bg-violet-700 border-violet-500 text-white":"bg-violet-50 border-violet-300 text-violet-700 hover:bg-violet-100"}`,children:"📋 Params"}),r.jsx("button",{onClick:()=>Wt(je=>!je),title:"User & Analytics stored",className:`text-[10px] font-mono border rounded-lg px-2.5 py-1 transition-colors ${ct?"bg-emerald-700 border-emerald-500 text-white":"bg-emerald-50 border-emerald-300 text-emerald-700 hover:bg-emerald-100"}`,children:"👤 User"}),r.jsx("button",{onClick:()=>ze(je=>!je),title:"URL Diagnostics",className:`text-[10px] font-mono border rounded-lg px-2.5 py-1 transition-colors ${ut?"bg-sky-700 border-sky-500 text-white":"bg-sky-50 border-sky-300 text-sky-700 hover:bg-sky-100"}`,children:"🔗 URL Diag"}),r.jsxs("button",{onClick:()=>K(je=>!je),title:"Toggle compact mode",className:`text-[10px] font-mono border rounded-lg px-2.5 py-1 transition-colors ${V?"bg-indigo-700 border-indigo-500 text-white":"bg-indigo-50 border-indigo-300 text-indigo-700 hover:bg-indigo-100"}`,children:["📐 ",Sr.compactMode]}),r.jsxs("button",{onClick:()=>Xe(!1),title:Sr.exitDebug,className:"flex items-center gap-1.5 bg-amber-100 border border-amber-300 text-amber-700 rounded-full px-3 py-1 hover:bg-amber-200 transition-colors cursor-pointer",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),r.jsx("span",{className:"text-[11px] font-semibold tracking-wide",children:"DEBUG"}),r.jsx(jt,{className:"w-3 h-3"})]})]})]})]})}),Us&&ut&&Le&&r.jsxs("div",{className:"bg-slate-950 border-b border-slate-700 px-6 py-4 space-y-3 font-mono text-[11px]",children:[r.jsx("div",{className:"text-slate-400 font-semibold uppercase tracking-widest text-[10px]",children:"🔗 URL Diagnostics"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-slate-500",children:"embed self URL (window.location.href):"}),r.jsx("div",{className:"text-sky-300 break-all",children:Le.selfUrl})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-slate-500",children:"browser referrer (document.referrer):"}),r.jsx("div",{className:Le.browserReferrer==="(empty)"?"text-slate-600 italic":"text-yellow-300 break-all",children:Le.browserReferrer})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"text-slate-500",children:["Strategy 3 — parent ping (window.parent.location.href):",r.jsx("span",{className:`ml-2 px-1.5 py-0.5 rounded text-[10px] ${Le.parentPingStatus==="success"?"bg-emerald-800 text-emerald-200":"bg-red-900 text-red-300"}`,children:Le.parentPingStatus})]}),Le.parentPingStatus==="success"?r.jsxs("div",{className:"text-emerald-300 break-all",children:["✅ ",Le.parentUrl]}):r.jsxs("div",{className:"text-red-400 break-all",children:["❌ ",Le.parentPingError]})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"text-slate-500",children:["Strategy 2 — sessionStorage history:",r.jsx("span",{className:`ml-2 px-1.5 py-0.5 rounded text-[10px] ${Le.sessionPingStatus==="success"?"bg-emerald-800 text-emerald-200":"bg-red-900 text-red-300"}`,children:Le.sessionPingStatus})]}),Le.sessionPingStatus==="success"?((pn=Le.sessionHistory)==null?void 0:pn.length)>0?r.jsx("div",{className:"space-y-0.5 pl-2 border-l border-slate-700",children:Le.sessionHistory.map((je,Ke)=>{var Te;return r.jsxs("div",{className:"text-slate-300 break-all",children:[r.jsxs("span",{className:"text-slate-600",children:[(Te=je.ts)==null?void 0:Te.slice(11,19)," "]}),je.url]},Ke)})}):r.jsx("div",{className:"text-slate-600 italic",children:"No history yet (this is the first visit in this session)."}):r.jsxs("div",{className:"text-red-400 break-all",children:["❌ ",Le.sessionHistoryError]})]})]}
1136),Us&&fe&&r.jsx(nIe,{urlParams:D,wpParams:P,assistantMode:z,suggestContent:H,apiUserId:B,editableParams:ne,onParamChange:X}),Us&&ct&&r.jsx(rIe,{visitorInfo:ae,wpParams:P,apiUserId:B,assistantKey:t,editableParams:ne,onParamChange:X}),r.jsxs("div",{className:`flex-1 overflow-y-auto ${V?"px-2 py-3 space-y-2 w-full":"px-4 py-6 space-y-4 max-w-2xl w-full mx-auto"}`,children:[n.length===0&&r.jsxs("div",{className:`text-center space-y-6 ${V?"mt-4":"mt-16"}`,children:[r.jsxs("div",{className:"space-y-2",children:[ft?r.jsx("div",{className:"prose prose-sm max-w-none text-gray-600",dangerouslySetInnerHTML:{__html:ft}}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-3xl",children:"💬"}),r.jsx("p",{className:"text-gray-500 text-sm",children:Sr.defaultWelcome})]}),as&&Es(bt)!=="en"&&r.jsx("p",{className:"text-[10px] text-indigo-400 animate-pulse",children:"Translating…"})]}),$i.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 justify-center",children:$i.map((je,Ke)=>r.jsx("button",{onClick:()=>Fr(je.text),className:"text-xs bg-indigo-100 hover:bg-indigo-200 text-indigo-700 px-3 py-1.5 rounded-full border border-indigo-200 transition-colors whitespace-normal break-words max-w-full",children:je.text},Ke))})]}),n.map((je,Ke)=>{var nn,_t,fn,Pa,is,zr,xo,df,ol,Ng,uf,Ac,mf,Sg,ll,cl,yo;je.role==="assistant"&&n.slice(0,Ke).map((Bt,br)=>Bt.role==="user"?br:-1).filter(Bt=>Bt>=0).pop();const Te=Tt[Ke]||{};return r.jsxs("div",{className:`flex flex-col ${je.role==="user"?"items-end":"items-start"}`,children:[r.jsxs("div",{className:`max-w-[85%] sm:max-w-[80%] rounded-2xl ${je.role==="user"?"rounded-br-sm overflow-hidden":"rounded-bl-sm shadow-sm border border-gray-200 overflow-visible relative z-10"}`,style:je.role==="user"?{background:te.userBg,color:te.textColor,fontSize:`${te.bodyFontSize}px`,fontFamily:`'${te.fontFamily}', sans-serif`,fontWeight:400}:{background:te.answerBg,color:"#ffffff",fontSize:`${te.bodyFontSize}px`,fontFamily:`'${te.fontFamily}', sans-serif`,fontWeight:400},children:[r.jsx("div",{className:"px-4 py-2.5 leading-relaxed",children:r.jsx("span",{className:"whitespace-pre-wrap",children:(nn=Os[Ke])!=null&&nn.text&&!((_t=Os[Ke])!=null&&_t.showOriginal)?Os[Ke].text:je.content})}),je.role==="assistant"&&!je.error&&r.jsx("div",{className:"px-3 py-1.5 bg-white/10 border-t border-white/15 rounded-bl-sm rounded-br-2xl",children:r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r.jsx(AW,{currentLang:(fn=Os[Ke])==null?void 0:fn.lang,translating:(Pa=Os[Ke])==null?void 0:Pa.translating,showOriginal:(is=Os[Ke])==null?void 0:is.showOriginal,uiStrings:Sr,pageLang:bt,browserLang:navigator.language,onTranslate:async Bt=>{la(br=>({...br,[Ke]:{lang:Bt,translating:!0,showOriginal:!1}}));try{const br=await Y.integrations.Core.InvokeLLM({prompt:`Translate the following text to ${ro(Bt)}. Preserve any HTML tags — only translate the text content. Return only the translated text, no explanation.
1137
1138${je.content}`});la(Gv=>({...Gv,[Ke]:{lang:Bt,text:br,translating:!1,showOriginal:!1}}))}catch{la(br=>({...br,[Ke]:{lang:Bt,translating:!1,showOriginal:!1}}))}},onToggle:()=>la(Bt=>{var br;return{...Bt,[Ke]:{...Bt[Ke],showOriginal:!((br=Bt[Ke])!=null&&br.showOriginal)}}}),onReset:()=>la(Bt=>{const br={...Bt};return delete br[Ke],br})}),r.jsx("span",{className:"w-px h-4 bg-white/20 shrink-0"}),r.jsx("button",{onClick:()=>Gd(Ke,je,"up"),title:"Good answer",className:`inline-flex items-center p-1.5 rounded-lg transition-colors ${Zt[Ke]==="up"?"text-emerald-300 bg-emerald-500/20":"text-white/60 hover:text-white hover:bg-white/10"}`,children:r.jsx(qo,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>Gd(Ke,je,"down"),title:"Poor answer",className:`inline-flex items-center p-1.5 rounded-lg transition-colors ${Zt[Ke]==="down"?"text-red-300 bg-red-500/20":"text-white/60 hover:text-white hover:bg-white/10"}`,children:r.jsx(hc,{className:"w-3.5 h-3.5"})}),Us?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>qt(je),title:"Suggest content",className:"inline-flex items-center gap-1 text-xs font-bold px-2 py-1.5 rounded-lg text-emerald-300 hover:bg-emerald-500/20 transition-colors",children:[r.jsx(Zo,{className:"w-3.5 h-3.5"}
1138),r.jsx("span",{children:Sr.suggest})]}),r.jsxs("button",{onClick:()=>Ze(je),title:"Report a problem",className:"inline-flex items-center gap-1 text-xs font-bold px-2 py-1.5 rounded-lg text-amber-300 hover:bg-amber-500/20 transition-colors",children:[r.jsx(R0,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:Sr.report})]})]}):r.jsxs("button",{onClick:()=>Ze(je),title:"Send feedback",className:"inline-flex items-center gap-1 text-xs font-bold px-2 py-1.5 rounded-lg text-white/60 hover:text-white hover:bg-white/10 transition-colors",children:[r.jsx(R0,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:Sr.feedback})]})]})})]}),je.role==="assistant"&&je.specialItems&&je.specialItems.length>0&&r.jsx(i3,{items:je.specialItems,linkNode:ce,onLinkClick:il}),je.role==="assistant"&&je.followupQuestions&&je.followupQuestions.length>0&&r.jsxs("div",{className:"w-full max-w-[85%] sm:max-w-[80%] mt-2 space-y-1.5",children:[r.jsx("p",{className:"text-[10px] text-gray-400 font-medium",children:Sr.followUpQuestions||"Follow-up questions"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:je.followupQuestions.map((Bt,br)=>r.jsx("button",{onClick:()=>Fr(Bt),className:"text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 px-3 py-1.5 rounded-full border border-indigo-200 transition-colors whitespace-nowrap",children:Bt},br))})]}),je.role==="assistant"&&!je.error&&Aa[Ke]&&r.jsx("div",{className:"mt-1.5",children:r.jsx("div",{className:"flex items-center gap-2 max-w-sm",children:(zr=Ea[Ke])!=null&&zr.submitted?r.jsx("span",{className:"text-xs text-emerald-600 font-medium",children:"Thanks for your feedback!"}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,value:((xo=Ea[Ke])==null?void 0:xo.text)||"",onChange:Bt=>Ri(br=>({...br,[Ke]:{...br[Ke],text:Bt.target.value}})),onKeyDown:Bt=>{Bt.key==="Enter"&&go(Ke,je),Bt.key==="Escape"&&po(br=>({...br,[Ke]:!1}))},placeholder:"Tell us more (optional)...",className:"flex-1 text-xs border border-gray-300 rounded-lg px-3 py-1.5 focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("button",{onClick:()=>go(Ke,je),disabled:(df=Ea[Ke])==null?void 0:df.submitting,className:"text-xs px-3 py-1.5 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:(ol=Ea[Ke])!=null&&ol.submitting?"…":"Send"}),r.jsx("button",{onClick:()=>po(Bt=>({...Bt,[Ke]:!1})),className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-3.5 h-3.5"})})]})})}),je.role==="assistant"&&Us&&je.elapsed!==void 0&&r.jsxs("div",{className:"mt-1.5 flex flex-col gap-1 w-full max-w-[80%]",children:[r.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r.jsxs("div",{className:`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 border text-[10px] font-mono ${je.error?"bg-red-100 border-red-300 text-red-700":"bg-amber-100 border-amber-300 text-amber-800"}`,children:["⏱ ",(je.elapsed/1e3).toFixed(2),"s",je.error&&" · ERROR"]}),!je.error&&je.rawData&&r.jsx("button",{onClick:()=>qs(Ke,{openPanel:Te.openPanel==="prod_raw"?null:"prod_raw"}),className:`text-[10px] font-mono border rounded px-2 py-1 transition-colors ${Te.openPanel==="prod_raw"?"bg-slate-700 border-slate-500 text-slate-200":"bg-slate-100 border-slate-300 text-slate-600 hover:bg-slate-200"}`,children:"📦 raw response"})]}),je.error&&je.errorMessage&&r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:r.jsx("p",{className:"text-xs font-mono text-red-700 break-all",children:je.errorMessage})}),Te.openPanel==="prod_raw"&&je.rawData&&r.jsxs("div",{className:"space-y-1.5 mt-0.5",children:[r.jsx("div",{className:"text-[10px] font-mono text-slate-400",children:"↳ production response (send button — invokeAssistant used assistant settings, no debug_mode)"}),r.jsx("pre",{className:"bg-gray-900 text-green-300 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-72 w-full",children:JSON.stringify(je.rawData,null,2)})]})]}),je.role==="user"&&Us&&r.jsxs("div",{className:"mt-1.5 w-full space-y-2",children:[r.jsxs("div",{className:"flex gap-1.5 flex-wrap justify-end",children:[r.jsx("button",{onClick:()=>qs(Ke,{openPanel:Te.openPanel==="settings"?null:"settings"}),className:`text-[10px] font-mono border rounded px-2 py-1 transition-colors ${Te.openPanel==="settings"?"bg-slate-700 border-slate-500 text-slate-200":"bg-slate-100 border-slate-300 text-slate-600 hover:bg-slate-200"}`,children:"🤖 Assistant"}),_e&&r.jsx("button",{onClick:()=>Li(Ke,je.content),disabled:Te.invokeLoading,className:`text-[10px] font-mono border rounded px-2 py-1 transition-colors disabled:opacity-50 ${Te.openPanel==="invoke"?"bg-indigo-700 border-indigo-500 text-indigo-100":"bg-indigo-50 border-indigo-300 text-indigo-700 hover:bg-indigo-100"}`,children:Te.invokeLoading?"⏳ invoking…":"⚡ invokeAssistant()"}),tt.length>
11380&&r.jsxs(r.Fragment,{children:[r.jsx("select",{value:$t,onChange:Bt=>En(Bt.target.value),className:"text-[10px] font-mono border border-emerald-300 rounded px-1.5 py-1 bg-white text-emerald-800 focus:outline-none",title:"Primary model (pre-loaded from assistant config)",children:oe.map(Bt=>r.jsx("option",{value:Bt,children:Bt},Bt))}),r.jsxs("select",{value:Pr,onChange:Bt=>zs(Bt.target.value),className:"text-[10px] font-mono border border-emerald-300 rounded px-1.5 py-1 bg-white text-emerald-800 focus:outline-none",title:"Secondary model (pre-loaded from assistant config)",children:[r.jsx("option",{value:"none",children:"2nd: none"}),oe.map(Bt=>r.jsx("option",{value:Bt,children:Bt},Bt))]}),r.jsx("button",{onClick:()=>al(Ke,je.content),disabled:Te.searchLoading,className:`text-[10px] font-mono border rounded px-2 py-1 transition-colors disabled:opacity-50 ${Te.openPanel==="search"?"bg-emerald-700 border-emerald-500 text-emerald-100":"bg-emerald-50 border-emerald-300 text-emerald-700 hover:bg-emerald-100"}`,children:Te.searchLoading?"⏳ searching…":"🔍 Search"})]})]}),Te.openPanel==="settings"&&Ee&&r.jsxs("div",{className:"bg-slate-900 border border-slate-600 rounded-xl p-3",children:[r.jsx("div",{className:"text-[10px] font-mono text-slate-400 mb-1.5",children:"assistant settings — these are the EXACT params invokeAssistant uses in production:"}),r.jsx("pre",{className:"text-[10px] font-mono text-slate-200 whitespace-pre-wrap overflow-auto max-h-64",children:JSON.stringify({...Ee,"→ search_payload_will_include":{query_model_primary:Ee.ivss_query_model_primary,query_model_secondary:Ee.ivss_query_model_secondary!=="none"?Ee.ivss_query_model_secondary:"(disabled)"}},null,2)})]}),Te.openPanel==="invoke"&&!Te.invokeLoading&&r.jsx("div",{className:"space-y-1.5",children:Te.invokeError?r.jsx("div",{className:"bg-red-950 border border-red-700 rounded-lg px-3 py-2 text-[10px] font-mono text-red-300",children:Te.invokeError}):Te.invokeData&&r.jsxs(r.Fragment,{children:[((uf=(Ng=Te.invokeData)==null?void 0:Ng.debug_info)==null?void 0:uf.search_payload_sent)&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-mono text-amber-500 mb-0.5",children:"→ ItemsVectorSemanticSearch payload:"}),r.jsx("pre",{className:"bg-slate-900 text-slate-300 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-40 w-full",children:JSON.stringify(Te.invokeData.debug_info.search_payload_sent,null,2)})]}),((Sg=(mf=(Ac=Te.invokeData)==null?void 0:Ac.debug_info)==null?void 0:mf.kb_context_items)==null?void 0:Sg.length)>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"text-[10px] font-mono text-emerald-500 mb-0.5",children:["items retrieved (",Te.invokeData.debug_info.kb_context_items.length,"):"]}),r.jsx("pre",{className:"bg-emerald-950 text-emerald-200 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-32 w-full",children:Te.invokeData.debug_info.kb_context_items.map(Bt=>`[${Bt.score!=null?(Bt.score*100).toFixed(0)+"%":"?"}] ${Bt.title}`).join(`
1139`)})]}),((cl=(ll=Te.invokeData)==null?void 0:ll.debug_info)==null?void 0:cl.full_prompt)&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-mono text-violet-400 mb-0.5",children:"full prompt sent to LLM:"}),r.jsx("pre",{className:"bg-indigo-950 text-indigo-200 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-64 w-full whitespace-pre-wrap break-words",children:Te.invokeData.debug_info.full_prompt})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-mono text-slate-400 mb-0.5",children:"raw response JSON:"}),r.jsx("pre",{className:"bg-gray-900 text-green-300 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-72 w-full",children:JSON.stringify(Te.invokeData,null,2)})]})]})}),Te.openPanel==="search"&&!Te.searchLoading&&r.jsx("div",{className:"space-y-1.5",children:Te.searchError?r.jsx("div",{className:"bg-red-950 border border-red-700 rounded-lg px-3 py-2 text-[10px] font-mono text-red-300",children:Te.searchError}):r.jsxs(r.Fragment,{children:[Te.searchPayload&&r.jsxs("div",{children:[r.jsx("div",{className:"text-[10px] font-mono text-amber-500 mb-0.5",children:"payload sent to ItemsVectorSemanticSearch:"}),r.jsx("pre",{className:"bg-slate-900 text-slate-300 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-40 w-full",children:JSON.stringify(Te.searchPayload,null,2)})]}),Te.searchData&&r.jsxs("div",{children:[r.jsxs("div",{className:"text-[10px] font-mono text-emerald-500 mb-0.5",children:["results (",((yo=Te.searchData.results)==null?void 0:yo.length)??0,") · latency: ",Te.searchData.latency_ms,"ms:"]}),r.jsx("pre",{className:"bg-emerald-950 text-emerald-200 text-[10px] font-mono rounded-lg p-2 overflow-auto max-h-72 w-full",children:(Te.searchData.results||[]).map(Bt=>`[${(Bt.score*100).toFixed(0)}%] ${Bt.title}
1140  kb: ${Bt.kb_name||"-"} | url: ${Bt.url||"-"}
1141  ${(Bt.human_summary||Bt.content||"").slice(0,150)}…`).join(`
1142
1143`)})]})]})})]})]},Ke)}),o&&r.jsx("div",{className:"flex justify-start",children:r.jsx("div",{className:"bg-white border border-gray-200 rounded-2xl rounded-bl-sm px-4 py-3 shadow-sm",children:r.jsxs("div",{className:"flex gap-1 items-center",children:[r.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),r.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),r.jsx("span",{className:"w-1.5 h-1.5 bg-indigo-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})}),r.jsx("div",{ref:Mi})]}),r.jsx("div",{className:`bg-white border-t ${V?"px-3 pt-2 pb-2":"px-4 pt-4 pb-3"}`,children:r.jsxs("div",{className:V?"w-full":"max-w-2xl mx-auto",children:[r.jsxs("form",{onSubmit:Ta,className:"flex gap-2 items-center",children:[r.jsx("input",{value:a,onChange:je=>i(je.target.value),placeholder:Sr.typeMessage,disabled:o,className:"flex-1 border border-gray-200 rounded-xl px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 disabled:opacity-50 min-w-0"}),r.jsx(sIe,{mode:z,onChange:L,uiStrings:Sr,pageUrl:P.page_url,compact:V}
1143),r.jsx("button",{type:"submit",disabled:!a.trim()||o,className:"disabled:opacity-50 text-white px-5 py-2.5 rounded-xl text-sm font-medium transition-colors shrink-0",style:{background:te.sendBtnColor},children:Sr.send})]}),Lt&&r.jsx("p",{className:"mt-2 text-[10px] text-gray-400 text-center leading-snug",children:Lt}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-2 min-w-0",children:[r.jsx(ns,{className:"w-3 h-3 text-indigo-400 shrink-0"}),r.jsxs("span",{className:"text-[11px] font-semibold text-gray-400 shrink-0",children:[Sr.aiMemory,":"]}),r.jsx("span",{className:"text-xs font-bold text-indigo-700 truncate",title:P.page_url&&z==="PAGE_ONLY"?P.page_url:q||f,children:(()=>{const je=tn||Ec||"";return je.length>30?je.slice(0,30)+"…":je})()}),P.page_url&&r.jsx(eIe,{selectedLang:bt,browserLang:navigator.language,country:ae==null?void 0:ae.country,pageUrl:P.page_url})]})]})}),Be&&r.jsx(o3,{msg:Be,query:Be.query||"",chatId:c,assistantKey:t,assistantName:f,reporterName:Kt,onClose:()=>Ze(null),onNameSave:je=>Xt(je),debugMode:Us}),pt&&r.jsx(CW,{msg:pt,query:pt.query||"",chatId:c,assistantKey:t,assistantName:f,reporterName:Kt,onClose:()=>qt(null),onNameSave:je=>Xt(je)})]})}const _k=[{icon:Na,label:"Fetching page"},{icon:Yn,label:"Translating with AI"},{icon:ns,label:"Rendering"}];function iIe(){const e=new URLSearchParams(window.location.search),t=e.get("page_url"),n=e.get("lang")||"en",s=e.get("engine")||"ai",[a,i]=h.useState(s),[o,l]=h.useState(!0),[c,d]=h.useState(""),[f,m]=h.useState(!0),[g,x]=h.useState(""),[j,b]=h.useState(0),[y,w]=h.useState(0),_=h.useRef(null),N=h.useRef(null),C=t?`https://translate.google.com/translate?sl=auto&tl=${n}&u=${encodeURIComponent(t)}`:null;h.useEffect(()=>{if(a==="ai"&&!t){x("No page URL provided"),l(!1);return}},[a]),h.useEffect(()=>{a!=="google"||!C||window.open(C,"_blank","noopener,noreferrer")},[a,C]),h.useEffect(()=>{if(a==="ai"&&t)return l(!0),x(""),b(0),w(0),_.current=setInterval(()=>{b(S=>S<1?S+.15:S)},2e3),N.current=setInterval(()=>{w(S=>S+1)},1e3),Y.functions.invoke("translatePage",{url:t,lang:n,lang_name:ro(n)}).then(S=>{const A=S.data||S;A.error?x(A.error):(b(2),d(A.translated_html||""),m(A.is_html!==!1))}).catch(S=>{x(S.message||"Failed to translate page")}).finally(()=>{clearInterval(_.current),clearInterval(N.current),l(!1)}),()=>{clearInterval(_.current),clearInterval(N.current)}},[t,n,a]);const k=Math.min(Math.floor(j),2);return r.jsxs("div",{className:"h-screen flex flex-col bg-gray-50",children:[r.jsxs("div",{className:"bg-white border-b px-4 py-2.5 flex items-center gap-3 shadow-sm shrink-0",children:[r.jsxs("button",{onClick:()=>window.history.back(),className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-indigo-600 transition-colors shrink-0",children:[r.jsx(or,{className:"w-4 h-4"}),"Back"]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("img",{src:Tp(n),alt:"",className:"w-4 h-3 rounded-sm"}),r.jsxs("p",{className:"text-sm font-medium text-gray-700",children:["Translated to ",ro(n)]})]}),r.jsx("p",{className:"text-xs text-gray-400 truncate",children:t})]}),r.jsxs("div",{className:"flex items-center gap-0.5 bg-gray-100 rounded-lg p-0.5 shrink-0",children:[r.jsxs("button",{onClick:()=>i("ai"),className:`flex items-center gap-1 px-2.5 py-1 text-xs rounded-md transition-all ${a==="ai"?"bg-white text-indigo-600 shadow-sm font-medium":"text-gray-500 hover:text-gray-700"}`,title:"AI translation",children:[r.jsx(Vn,{className:"w-3 h-3"}),"AI"]}),r.jsxs("button",{onClick:()=>i("google"),className:`flex items-center gap-1 px-2.5 py-1 text-xs rounded-md transition-all ${a==="google"?"bg-white text-blue-600 shadow-sm font-medium":"text-gray-500 hover:text-gray-700"}`,title:"Google Translate",children:[r.jsx(Na,{className:"w-3 h-3"}),"Google"]})]}),r.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-indigo-600 hover:text-indigo-700 transition-colors whitespace-nowrap shrink-0",children:[r.jsx(yr,{className:"w-3.5 h-3.5"}),"Original"]})]}),r.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[a==="google"&&C&&r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 px-4 text-center",children:[r.jsx(Na,{className:"w-12 h-12 text-blue-500"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Opening Google Translate in a new tab…"}),r.jsx("p",{className:"text-xs text-gray-400",children:"If it didn't open, click the button below."})]}),r.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700 transition-colors",children:[r.jsx(yr,{className:"w-4 h-4"}),"Open in Google Translate"]})]}),a==="ai"&&r.jsxs(r.Fragment,{children:[o&&r.jsxs("div",{className:"flex flex-col items-center justify-center py-20 gap-6 px-4",children:[r.jsx("div",{className:"flex items-center gap-4",children:_k.map((S,A)=>{const T=S.icon,R=A===k,B=A<k;return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`flex items-center justify-center w-10 h-10 rounded-full border-2 transition-all duration-500
1144                          ${B?"bg-emerald-500 border-emerald-500 text-white":R?"bg-indigo-50 border-indigo-500 text-indigo-600 scale-110":"bg-gray-50 border-gray-200 text-gray-300"}`,children:B?"✓":r.jsx(T,{className:`w-5 h-5 ${R?"animate-pulse":""}`})}),r.jsx("span",{className:`text-sm font-medium transition-colors ${R?"text-indigo-600":B?"text-emerald-600":"text-gray-400"}`,children:S.label}),A<_k.length-1&&r.jsx("div",{className:`w-8 h-0.5 mx-1 rounded transition-colors ${B?"bg-emerald-400":"bg-gray-200"}`})]},A)})}),r.jsxs("div",{className:"text-center space-y-1",children:[r.jsxs("p",{className:"text-sm text-gray-500",children:[_k[k].label,"…"]}),r.jsxs("p",{className:"text-xs text-gray-400 tabular-nums",children:[y,"s elapsed"]}),r.jsx("p",{className:"text-[11px] text-gray-300 max-w-md",children:"AI translation can take 30–60 seconds for large pages"})]})]}),g&&r.jsx("div",{className:"max-w-3xl mx-auto px-6 py-8 w-full",children:r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-sm text-red-700",children:g})}),!o&&!g&&c&&f&&r.jsx("iframe",{srcDoc:c,title:"Translated page",className:"flex-1 w-full border-0 bg-white",sandbox:"allow-same-origin allow-popups allow-scripts"}),!o&&!g&&c&&!f&&r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsx("div",{className:"max-w-3xl mx-auto px-6 py-8 w-full",children:r.jsx("div",{className:"prose prose-sm max-w-none whitespace-pre-wrap text-gray-700 leading-relaxed",children:c})})})]})]})]})}const oIe=[{value:"gemini_3_flash",label:"Gemini 3 Flash (default)"},{value:"gemini_3_1_pro",label:"Gemini 3.1 Pro"},{value:"gpt_5_mini",label:"GPT-5 Mini"},{value:"gpt_5",label:"GPT-5"},{value:"claude_sonnet_4_6",label:"Claude Sonnet"},{value:"automatic",label:"Automatic"}],Io={shell_router_model:"gemini_3_flash",shell_router_history_size:5,shell_transition_system_prompt:"You are transitioning to another personalized assistant. Inform the user in your answer which direction the conversation will change using the transition information below and the transition instruction.",shell_router_routing_prompt:`You are a Shell Router. Your only task is to decide which shell the conversation should be in after this user message.
1145
1146Current Shell: "{{current_shell_name}}" (ID: {{current_shell_id}})
1147{{routing_instructions}}
1148Available Shells:
1149{{active_shells}}
1150
1151{{recent_history}}
1152User Message: "{{message}}"
1153
1154Rules:
1155- Only change shell if the user's intent clearly maps to a different shell.
1156- If unsure or ambiguous, stay in current shell.
1157- In candidate_scores, rate ALL available shells (0.0 = irrelevant, 1.0 = perfect match).
1158
1159Respond with valid JSON only.`,shell_router_return_object:{action:"change_shell | stay_in_current_shell",target_shell_id:"",reason:"",candidate_scores:[{shell_id:"",shell_name:"",probability:0,rationale:""}]},shell_router_mapping:{next_shell_id_node:"target_shell_id",transition_message_template:"*Switched to shell: **{{shell_name}}**.*",routing_debug_info_template:`action: {{action}}
1160reason: {{reason}}
1161from: {{from_shell}}
1162to: {{to_shell}}
1163candidates: {{candidate_scores}}`}};function S5({vars:e}){return r.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:e.map(t=>r.jsx("span",{className:"text-[10px] font-mono bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5",children:t},t))})}function VB({label:e,desc:t,value:n,onChange:s,onReset:a,vars:i,rows:o=4}){return r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-xs uppercase tracking-wide text-gray-400",children:e}),t&&r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:t}),i&&r.jsx(S5,{vars:i})]}),r.jsx("button",{onClick:a,title:"Reset to default",className:"text-gray-300 hover:text-gray-500 transition-colors shrink-0 mt-0.5",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})})]}),r.jsx("textarea",{value:n,onChange:l=>s(l.target.value),rows:o,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]})}
1163function lIe({value:e,onChange:t,returnObjectKeys:n,onReset:s}){const a=e||Io.shell_router_mapping,i=(o,l)=>t({...a,[o]:l});return r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-xs uppercase tracking-wide text-gray-400",children:"Return Mapping"}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Map LLM return object nodes to routing output fields."})]}),r.jsx("button",{onClick:s,title:"Reset to default",className:"text-gray-300 hover:text-gray-500 transition-colors shrink-0",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-medium text-gray-600",children:"next_shell_id — source node"}),r.jsxs("select",{value:a.next_shell_id_node||"target_shell_id",onChange:o=>i("next_shell_id_node",o.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[n.map(o=>r.jsx("option",{value:o,children:o},o)),!n.includes(a.next_shell_id_node||"target_shell_id")&&r.jsx("option",{value:a.next_shell_id_node,children:a.next_shell_id_node})]}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Which field in the LLM return object contains the target shell ID."})]}),r.jsx("div",{className:"bg-gray-50 border rounded-lg px-3 py-2",children:r.jsxs("p",{className:"text-xs text-gray-500",children:[r.jsx("span",{className:"font-semibold",children:"assistant_id"})," — resolved automatically from the shell record (not configurable)."]})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-medium text-gray-600",children:"transition_message template"}),r.jsx(S5,{vars:["{{shell_name}}","{{from_shell}}","{{to_shell}}","{{reason}}"]}),r.jsx("textarea",{value:a.transition_message_template||"",onChange:o=>i("transition_message_template",o.target.value),rows:2,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-medium text-gray-600",children:"routing_debug_info template"}),r.jsx(S5,{vars:["{{action}}","{{reason}}","{{from_shell}}","{{to_shell}}","{{candidate_scores}}","{{routing_prompt}}"]}),r.jsx("textarea",{value:a.routing_debug_info_template||"",onChange:o=>i("routing_debug_info_template",o.target.value),rows:4,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Used to build the debug string shown in Shell Test. Leave blank to use raw JSON object."})]})]})}function cIe({routingConfig:e}){var w;const[t,n]=h.useState([]),[s,a]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(!1),[d,f]=h.useState(null),[m,g]=h.useState(null),[x,j]=h.useState(!0);h.useEffect(()=>{Y.entities.Shell.filter({status:"active"}).then(_=>{n(_),_.length>0&&a(_[0].id)})},[]);async function b(){if(!(!i.trim()||!s)){c(!0),f(null),g(null);try{const _=await Y.functions.invoke("shellRouter",{message:i.trim(),current_shell_id:s,history_snippet:[]});f(_.data)}catch(_){g(_.message||"Error calling shellRouter")}c(!1)}}const y=d==null?void 0:d.routing_debug_info;return r.jsxs("div",{className:"bg-white border rounded-xl overflow-hidden",children:[r.jsxs("button",{onClick:()=>j(_=>!_),className:"w-full flex items-center justify-between px-5 py-3 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zn,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-semibold text-gray-700",children:"Test Router"})]}),x?r.jsx(gt,{className:"w-4 h-4 text-gray-400"}):r.jsx(en,{className:"w-4 h-4 text-gray-400"})]}),x&&r.jsxs("div",{className:"p-5 space-y-4 border-t",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(ot,{className:"text-xs",children:"Current Shell"}),r.jsx("select",{value:s,onChange:_=>a(_.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:t.map(_=>r.jsx("option",{value:_.id,children:_.name},_.id))})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(ot,{className:"text-xs",children:"User Message"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(It,{value:i,onChange:_=>o(_.target.value),onKeyDown:_=>_.key==="Enter"&&b(),placeholder:"Type a message to route...",className:"flex-1"}),r.jsxs(de,{onClick:b,disabled:l||!i.trim()||!s,size:"sm",className:"gap-1.5 shrink-0",children:[l?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Fd,{className:"w-3.5 h-3.5"}),"Test"]})]})]})]}),m&&r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg px-4 py-3 text-sm text-red-600",children:m}),d&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[{label:"Action",value:y==null?void 0:y.action,color:(y==null?void 0:y.action)==="change_shell"?"text-amber-600":"text-emerald-600"},{label:"Next Shell",value:d.next_shell_name||d.next_shell_id||"—"},{label:"Type",value:(y==null?void 0:y.type)||"—"},{label:"Is Command",value:d.is_command?"Yes":"No"}].map(_=>r.jsxs("div",{className:"bg-gray-50 rounded-lg px-3 py-2",children:[r.jsx("p",{className:"text-[10px] text-gray-400 font-medium",children:_.label}),r.jsx("p",{className:`text-sm font-semibold ${_.color||"text-gray-700"}`,children:_.value})]},_.label))}),(y==null?void 0:y.reason)&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-lg px-3 py-2",children:[r.jsx("p",{className:"text-[10px] text-indigo-400 font-medium mb-0.5",children:"Reason"}),r.jsx("p",{className:"text-xs text-indigo-700",children:y.reason})]}),((w=y==null?void 0:y.candidate_scores)==null?void 0:w.length)>0&&r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] text-gray-400 font-medium mb-1.5",children:"Candidate Scores"}),r.jsx("div",{className:"space-y-1.5",children:[...y.candidate_scores].sort((_,
1163N)=>N.probability-_.probability).map((_,N)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-28 shrink-0",children:r.jsx("p",{className:"text-xs font-medium text-gray-600 truncate",children:_.shell_name})}),r.jsx("div",{className:"flex-1 h-2 bg-gray-100 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-indigo-400 transition-all",style:{width:`${Math.round((_.probability||0)*100)}%`}})}),r.jsxs("span",{className:"text-[10px] font-mono text-gray-500 w-8 text-right shrink-0",children:[((_.probability||0)*100).toFixed(0),"%"]})]},N))})]}),d.transition_message&&r.jsxs("div",{className:"bg-amber-50 border border-amber-100 rounded-lg px-3 py-2 text-xs text-amber-700",children:[r.jsx("span",{className:"font-semibold",children:"Transition message: "}),d.transition_message]}),(y==null?void 0:y.routing_prompt)&&r.jsxs("details",{className:"text-xs",children:[r.jsx("summary",{className:"cursor-pointer text-gray-400 hover:text-gray-600",children:"Show routing prompt sent to LLM"}),r.jsx("pre",{className:"mt-2 bg-gray-900 text-green-400 rounded-lg p-3 whitespace-pre-wrap text-[11px] font-mono overflow-auto max-h-64",children:y.routing_prompt})]})]})]})]})}function PW({data:e,setData:t}){const n=e,s=(o,l)=>t(c=>({...c,[o]:l})),a=o=>t(l=>({...l,[o]:Io[o]})),i=Object.keys(n.shell_router_return_object||{});return r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-2xl p-4 text-xs text-indigo-700 flex gap-2",children:[r.jsx(_d,{className:"w-4 h-4 shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold mb-0.5",children:"Shell Router Configuration"}),r.jsx("p",{children:"These settings control how the shellRouter function decides which shell to route conversations to. Changes are saved with the main Save button and picked up by the shellRouter on every call."})]})]}),r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-5",children:[r.jsx("h3",{className:"font-semibold text-xs uppercase tracking-wide text-gray-400",children:"Router Settings"}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ot,{className:"text-sm",children:"Routing Model"}),r.jsx("button",{onClick:()=>a("shell_router_model"),title:"Reset",className:"text-gray-300 hover:text-gray-500 transition-colors",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})})]}),r.jsx("select",{value:n.shell_router_model||"gemini_3_flash",onChange:o=>s("shell_router_model",o.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:oIe.map(o=>r.jsx("option",{value:o.value,children:o.label},o.value))}),r.jsx("p",{className:"text-[10px] text-gray-400",children:"Model used for LLM-driven routing decisions (not used for /commands)."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"History Size"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-mono text-indigo-600 font-semibold",children:[n.shell_router_history_size??5," messages"]}),r.jsx("button",{onClick:()=>a("shell_router_history_size"),title:"Reset",className:"text-gray-300 hover:text-gray-500 transition-colors",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})})]})]}),r.jsx(xr,{value:[n.shell_router_history_size??5],onValueChange:([o])=>s("shell_router_history_size",o),min:0,max:20,step:1,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Number of recent messages included in the routing context ({{recent_history}} variable)."})]})]}),r.jsx(VB,{label:"Shell Transition System Prompt",desc:"Injected into the assistant prompt when a shell transition occurs. Tells the assistant how to communicate the transition.",value:n.shell_transition_system_prompt||"",onChange:o=>s("shell_transition_system_prompt",o),onReset:()=>a("shell_transition_system_prompt"),vars:[],rows:3}),r.jsx(VB,{label:"Routing Prompt Template",desc:"The prompt sent to the LLM to decide which shell to route to.",value:n.shell_router_routing_prompt||"",onChange:o=>s("shell_router_routing_prompt",o),onReset:()=>a("shell_router_routing_prompt"),vars:["{{current_shell_name}}","{{current_shell_id}}","{{routing_instructions}}","{{active_shells}}","{{recent_history}}","{{message}}"],rows:14}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between px-1",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Return Object (JSON Schema)"}),r.jsxs("button",{onClick:()=>a("shell_router_return_object"),className:"flex items-center gap-1 text-xs text-gray-400 hover:text-gray-600 transition-colors",children:[r.jsx(Dr,{className:"w-3 h-3"})," Reset"]})]}),r.jsx(Ed,{title:"Router Return Object",description:"The JSON schema the LLM must return. Define the fields the routing decision should contain.",value:n.shell_router_return_object||{},onChange:o=>s("shell_router_return_object",o)})]}),r.jsx(lIe,{value:n.shell_router_mapping||{},onChange:o=>s("shell_router_mapping",o),returnObjectKeys:i,onReset:()=>a("shell_router_mapping")}),r.jsx(cIe,{routingConfig:n})]})}const HB=`You are a semantic relevance ranker. Score each item's relevance to the user query from 0.00 to 1.00.
1164Focus on semantic meaning and user intent — not on keyword overlap.
1165USER CONTEXT:
1166{{context}}
1167
1168USER QUERY:
1169{{query}}
1170
1171DEBUG MODE: {{debug_mode}}
1172
1173RANK ARRAY:
1174{{rank_array}}
1175
1176Return JSON with a "rankings" array. Each entry must have: id (string), score (0.00–1.00), reason (1 concise sentence, if in debug mode), and keywords (if in debug mode).`,WB=[{value:"automatic",label:"Automatic (default)",maxTokens:"~128K tokens"},{value:"gpt_5_mini",label:"GPT-5 Mini",maxTokens:"~128K tokens"},{value:"gpt_5",label:"GPT-5",maxTokens:"~128K tokens"},{value:"gpt_5_4",label:"GPT-5.4",maxTokens:"~128K tokens"},{value:"gemini_3_flash",label:"Gemini 3 Flash",maxTokens:"~1M tokens"},{value:"gemini_3_1_pro",label:"Gemini 3.1 Pro",maxTokens:"~1M tokens"},{value:"claude_sonnet_4_6",label:"Claude Sonnet 4.6",maxTokens:"~200K tokens"},{value:"claude_opus_4_6",label:"Claude Opus 4.6",maxTokens:"~200K tokens"},{value:"claude_opus_4_7",label:"Claude Opus 4.7",maxTokens:"~200K tokens"}],GB=`You are a knowledge summarization assistant. Given the aggregated content of a knowledge base below, generate two summaries:
1177
11781. humanSummary: A clear, human-readable summary of {{humanSummarySize}} characters (approximately). This should explain what this knowledge base covers in plain language.
1179
11802. semanticSummary: A semantically rich, keyword-dense summary of {{semanticSummarySize}} characters (approximately). Optimize this for vector search and retrieval — include key concepts, entities, synonyms, and important topics covered.
1181
1182KNOWLEDGE BASE CONTENT (aggregated item summaries, including CC transcripts where available):
1183{{content}}
1184
1185Return ONLY a JSON object with keys: humanSummary and semanticSummary.`,Nk=`You are a knowledge summarization assistant. Given the content below, generate two summaries:
1186
11871. humanSummary: A clear, human-readable summary of {{humanSummarySize}} characters (approximately). This should explain the topic in plain language for a person to read.
1188
11892. semanticSummary: A semantically rich, keyword-dense summary of {{semanticSummarySize}} characters (approximately). Optimize this for vector search and retrieval — include key concepts, entities, synonyms, and important facts without filler words.
1190
1191CONTENT:
1192{{content}}
1193
1194Return ONLY a JSON object with keys: humanSummary and semanticSummary.`;
1194function YB({value:e,onChange:t}){const[n,s]=h.useState(!1),[a,i]=h.useState(JSON.stringify(e||{},null,2)),[o,l]=h.useState("");function c(d){i(d);try{const f=JSON.parse(d);l(""),t(f)}catch{l("Invalid JSON")}}return r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>s(d=>!d),className:"flex items-center gap-1 text-xs text-gray-400 hover:text-gray-600 transition-colors",children:[n?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"}),"Additional parameters"]}),n&&r.jsxs("div",{className:"mt-2",children:[r.jsx("textarea",{value:a,onChange:d=>c(d.target.value),rows:4,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y",placeholder:'{"temperature": 0.3}'}),o&&r.jsx("p",{className:"text-xs text-red-500 mt-1",children:o})]})]})}function OW({data:e,setData:t}){const[n,s]=h.useState(!1);async function a(){s(!0);const i=await Y.integrations.Core.InvokeLLM({prompt:`You are a prompt engineering expert. Improve the following KB summarization prompt. Keep the same structure (humanSummary, semanticSummary) and the template variables {{humanSummarySize}}, {{semanticSummarySize}}, {{content}}. Make it more effective for generating high-quality summaries for RAG systems.
1195
1196Current prompt:
1197${e.kb_summary_prompt||Nk}`});t(o=>({...o,kb_summary_prompt:i})),s(!1)}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Item Summary Sizes"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Target sizes for per-item summaries (used in item cards and RAG context)."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Human Summary Size"}),r.jsxs("span",{className:"font-mono text-indigo-600 font-semibold",children:[(e.kb_human_summary_size||500).toLocaleString()," chars"]})]}),r.jsx(xr,{value:[e.kb_human_summary_size||500],onValueChange:([i])=>t(o=>({...o,kb_human_summary_size:i})),min:100,max:3e3,step:100,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Target character length for human-readable summaries."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Semantic Summary Size"}),r.jsxs("span",{className:"font-mono text-indigo-600 font-semibold",children:[(e.kb_semantic_summary_size||300).toLocaleString()," chars"]})]}),r.jsx(xr,{value:[e.kb_semantic_summary_size||300],onValueChange:([i])=>t(o=>({...o,kb_semantic_summary_size:i})),min:100,max:2e3,step:100,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Target character length for semantic/retrieval-optimized summaries."})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Item Summary Prompt"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Used to generate both summaries from a single KB item's content."}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:["{{humanSummarySize}}","{{semanticSummarySize}}","{{content}}"].map(i=>r.jsx("span",{className:"text-xs font-mono bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5",children:i},i))})]}),r.jsxs("div",{className:"flex gap-1 shrink-0",children:[r.jsx("button",{onClick:()=>t(i=>({...i,kb_summary_prompt:Nk})),title:"Restore default",className:"text-gray-300 hover:text-gray-500 transition-colors",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:a,disabled:n,title:"Improve with AI",className:"text-gray-300 hover:text-indigo-500 transition-colors",children:r.jsx(yd,{className:`w-3.5 h-3.5 ${n?"animate-pulse text-indigo-400":""}`})})]})]}),r.jsx("textarea",{value:e.kb_summary_prompt||Nk,onChange:i=>t(o=>({...o,kb_summary_prompt:i.target.value})),rows:12,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Must return a JSON object with ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"humanSummary"})," and ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"semanticSummary"})," fields."]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Knowledge Base Summary Sizes"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Target sizes for the KB-level summary (aggregated from all item summaries, including CC transcripts)."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"KB Human Summary Size"}),r.jsxs("span",{className:"font-mono text-indigo-600 font-semibold",children:[(e.kb_kb_human_summary_size||2e3).toLocaleStr
1197ing()," chars"]})]}),r.jsx(xr,{value:[e.kb_kb_human_summary_size||2e3],onValueChange:([i])=>t(o=>({...o,kb_kb_human_summary_size:i})),min:200,max:8e3,step:200,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Target character length for the knowledge base's human-readable summary."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"KB Semantic Summary Size"}),r.jsxs("span",{className:"font-mono text-indigo-600 font-semibold",children:[(e.kb_kb_semantic_summary_size||2e3).toLocaleString()," chars"]})]}),r.jsx(xr,{value:[e.kb_kb_semantic_summary_size||2e3],onValueChange:([i])=>t(o=>({...o,kb_kb_semantic_summary_size:i})),min:200,max:8e3,step:200,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Target character length for the knowledge base's semantic/retrieval-optimized summary."})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Knowledge Base Summary Prompt"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:'Used when "Summarize KB" is triggered — receives all item summaries (including CC) as input.'}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:["{{humanSummarySize}}","{{semanticSummarySize}}","{{content}}"].map(i=>r.jsx("span",{className:"text-xs font-mono bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5",children:i},i))})]}),r.jsx("button",{onClick:()=>t(i=>({...i,kb_kb_summary_prompt:GB})),title:"Restore default",className:"text-gray-300 hover:text-gray-500 transition-colors shrink-0",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})})]}),r.jsx("textarea",{value:e.kb_kb_summary_prompt||GB,onChange:i=>t(o=>({...o,kb_kb_summary_prompt:i.target.value})),rows:12,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Must return a JSON object with ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"humanSummary"})," and ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"semanticSummary"})," fields. The ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"{{content}}"})," variable will contain aggregated item summaries + CC summaries."]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Ranking Model"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"LLM used for semantic ranking across all 3 pipeline stages."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Model"}),r.jsx("select",{value:e.kb_ranking_model||"gemini_3_flash",onChange:i=>t(o=>({...o,kb_ranking_model:i.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:WB.map(i=>r.jsxs("option",{value:i.value,children:[i.label," — ",i.maxTokens]},i.value))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Temperature"}),r.jsx("span",{className:"font-mono text-indigo-600 font-semibold",children:(e.kb_ranking_temperature??0
1197).toFixed(2)})]}),r.jsx(xr,{value:[Math.round((e.kb_ranking_temperature??0)*100)],onValueChange:([i])=>t(o=>({...o,kb_ranking_temperature:i/100})),min:0,max:100,step:5,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"0 = fully deterministic (recommended for ranking). Higher values add randomness."})]}),r.jsx(YB,{value:e.kb_ranking_model_params||{},onChange:i=>t(o=>({...o,kb_ranking_model_params:i}))}),r.jsxs("div",{className:"border-t pt-5 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-sm text-gray-600",children:"Ranking Prompt"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Template sent to the LLM for KB, item, and chunk ranking."}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:["{{context}}","{{query}}","{{debug_mode}}","{{rank_array}}"].map(i=>r.jsx("span",{className:"text-xs font-mono bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5",children:i},i))})]}),r.jsx("button",{onClick:()=>t(i=>
1197({...i,kb_ranking_prompt:HB})),title:"Restore default",className:"text-gray-300 hover:text-gray-500 transition-colors shrink-0",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})})]}),r.jsx("textarea",{value:e.kb_ranking_prompt||HB,onChange:i=>t(o=>({...o,kb_ranking_prompt:i.target.value})),rows:14,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"}),r.jsxs("p",{className:"text-xs text-gray-400",children:[r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"{{rank_array}}"})," is a JSON array of objects with ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"id"}),", ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"name"}),", and ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"summary"})," fields. Must return a ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"rankings"})," array with ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"id"})," and ",r.jsx("span",{className:"font-mono bg-gray-100 px-1 rounded",children:"score"})," per item."]})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Summarization Model"}),r.jsx("p",{className:"text-xs text-gray-400",children:"LLM used for generating KB item and knowledge base summaries."}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Model"}),r.jsx("select",{value:e.kb_summarization_model||"automatic",onChange:i=>t(o=>({...o,kb_summarization_model:i.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:WB.map(i=>r.jsxs("option",{value:i.value,children:[i.label," — ",i.maxTokens]},i.value))})]}),r.jsx(YB,{value:e.kb_summarization_model_params||{},onChange:i=>t(o=>({...o,kb_summarization_model_params:i}))})]})]})}async function JB(e,t){const s=(await Y.functions.invoke("testIntegrationKey",{integration:e,...t})).data;if(s!=null&&s.error)throw new Error(s.error);return(s==null?void 0:s.message)||"Connected"}function Hu({integration:e,data:t}){const[n,s]=h.useState(null),[a,i]=h.useState(""),[o,l]=h.useState(null),[c,d]=h.useState(""),m=e==="jina"?t.jina_api_key?{api_key:t.jina_api_key}
1197:null:e==="supadata"?t.supadata_api_key?{api_key:t.supadata_api_key}:null:e==="supabase"&&t.supabase_url&&t.supabase_key?{url:t.supabase_url,key:t.supabase_key}:null,g=async()=>{s("loading"),i("");try{const j=await JB(e,m);s("ok"),i(j)}catch(j){s("error"),i(j.message||"Failed")}},x=async()=>{l("loading"),d("");try{const j=await JB(e,{});l("ok"),d(j)}catch(j){l("error"),d(j.message||"Failed")}};return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m&&r.jsxs(de,{size:"sm",variant:"outline",onClick:g,disabled:n==="loading",className:"gap-1.5",children:[n==="loading"?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(ote,{className:"w-3.5 h-3.5"}),"Test AppConfig Key"]}),r.jsxs(de,{size:"sm",variant:"outline",onClick:x,disabled:o==="loading",className:"gap-1.5 border-amber-300 text-amber-700 hover:bg-amber-50",children:[o==="loading"?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(xd,{className:"w-3.5 h-3.5"}),"Test Env Secret"]})]}),n==="ok"&&r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-emerald-700 font-medium",children:[r.jsx(mr,{className:"w-3.5 h-3.5"})," AppConfig: ",a]}),n==="error"&&r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-red-600 font-medium",children:[r.jsx(sc,{className:"w-3.5 h-3.5"})," AppConfig: ",a]}),o==="ok"&&r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-emerald-700 font-medium",children:[r.jsx(mr,{className:"w-3.5 h-3.5"})," Secret: ",c]}),o==="error"&&r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-red-600 font-medium",children:[r.jsx(sc,{className:"w-3.5 h-3.5"})," Secret: ",c]})]})}function IW({data:e}){const[t,n]=h.useState(`Hello world.
1198
1199Second paragraph here.
1200New line.
1201Another line. With sentence. And more!`),[s,a]=h.useState(null),[i,o]=h.useState(!1),[l,c]=h.useState(null),[d,f]=h.useState(!1),m=e.chunk_separators??[`
1202
1203`,`
1204`,". ","! ","? "," "],g=e.chunk_separators_ignore_between_numbers??[],x=e.chunk_size??1e3,j=e.chunk_overlap??150,b=e.min_chunk_size??0,y=e.min_chunk_size_action??"discard",w=e.chunk_mode??"both_last";function _(k){if(!k||k.trim().length===0)return[];function S(I,z,L){const H=z>0?I[z-1]:"",W=z+L.length<I.length?I[z+L.length]:"";return/\d/.test(H)&&/\d/.test(W)}function A(I,z,L){let H=L;for(;;){const W=I.indexOf(z,H);if(W===-1)return-1;if(g.includes(z)&&S(I,W,z)){H=W+1;continue}return W}}function T(I,z,L,H){let W=I.lastIndexOf(z,L);for(;W>H;){if(g.includes(z)&&S(I,W,z)){W=I.lastIndexOf(z,W-1);continue}return W}return-1}const R=Math.min(j,Math.floor(x*.8)),B=[];function D(I,z){if(!(!I||!I.trim())){if(b>0&&I.trim().length<b){y==="append"&&B.length>0&&(B[B.length-1].content+=I,B[B.length-1].merged=!0);return}B.push({content:I,sepUsed:z})}}if(w==="separators"){let I=k;for(;I.length>0;){let z=-1,L=0,H=null;for(const W of m){if(!W)continue;const V=A(I,W,1);V!==-1&&(z===-1||V<z)&&(z=V,L=W.length,H=W)}if(z===-1){D(I,null);break}D(I.slice(0,z+L),H),I=I.slice(z+L)}return B}let P=0;for(;P<k.length;){const I=Math.min(P+x,k.length);if(w==="size"){D(k.slice(P,I),null);const L=I-R;P=L<=P?P+1:L;continue}if(w==="both_first"){let L=-1,H=-1,W=null;for(const M of m){if(!M)continue;const G=A(k,M,P+1);G!==-1&&G<I&&(L===-1||G<L)&&(L=G,H=G+M.length,W=M)}const V=L!==-1?H:I;D(k.slice(P,V),W);const K=V-R;P=K<=P?P+1:K;continue}if(w==="both_last"){let L=I,H=null;if(I<k.length){const V=P+Math.floor(x*.5);for(const K of m){if(!K)continue;const M=T(k,K,I,V);if(M>V){L=M+K.length,H=K;break}}}D(k.slice(P,L),H);const W=L-R;P=W<=P?P+1:W;continue}D(k.slice(P,I),null);const z=I-R;P=z<=P?P+1:z}return B}function N(){c(null);try{const k=_(t);a(k)}catch(k){c(k.message)}}function C(k){return[...k].map(S=>{const A=S.charCodeAt(0);return S===`
1205`?"\\n(0x0A)":S==="\r"?"\\r(0x0D)":S==="	"?"\\t(0x09)":S===" "?"SP(0x20)":`${S}(0x${A.toString(16).padStart(2,"0").toUpperCase()})`}).join(" ")}return r.jsxs("div",{className:"border rounded-2xl bg-white overflow-hidden",children:[r.jsxs("button",{onClick:()=>f(k=>!k),className:"w-full flex items-center justify-between px-6 py-4 bg-amber-50 hover:bg-amber-100 transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Mh,{className:"w-4 h-4 text-amber-600"}),r.jsx("span",{className:"font-semibold text-sm text-amber-800",children:"Chunking Debug & Live Preview"}),r.jsx("span",{className:"text-xs bg-amber-200 text-amber-800 px-2 py-0.5 rounded-full font-medium",children:"debug"})]}),d?r.jsx(Mn,{className:"w-4 h-4 text-amber-500"}):r.jsx(gt,{className:"w-4 h-4 text-amber-500"})]}),d&&r.jsxs("div",{className:"p-6 space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Separator Byte Inspector"}),r.jsxs("p",{className:"text-[11px] text-gray-400",children:["Shows the exact bytes stored for each separator. Newlines should appear as ",r.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"\\n(0x0A)"}),", not as literal text. If you see ",r.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"\\n"})," as two characters (0x5C + 0x6E) — that's a bug: the separator was saved as escaped text instead of a real newline."]}),r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{className:"bg-gray-50 border-b",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium w-8",children:"#"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium",children:"Display"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium",children:"Length"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium",children:"Raw Bytes"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium w-16",children:"Ignore↕"})]})}),r.jsxs("tbody",{children:[m.map((k,S)=>{const A=C(k),T=k.includes("\\n")&&!k.includes(`
1206`);return r.jsxs("tr",{className:`border-b last:border-0 ${T?"bg-red-50":""}`,children:[r.jsx("td",{className:"px-3 py-2 text-gray-400",children:S}),r.jsx("td",{className:"px-3 py-2 font-mono",children:r.jsx("span",{className:"bg-indigo-50 text-indigo-700 border border-indigo-200 rounded px-1.5 py-0.5",children:_5(k)||r.jsx("em",{className:"text-gray-400",children:"empty"})})}),r.jsx("td",{className:"px-3 py-2 font-mono text-gray-600",children:k.length}),r.jsxs("td",{className:"px-3 py-2 font-mono text-[10px] text-gray-600 break-all",children:[r.jsx("span",{className:T?"text-red-600 font-bold":"",children:A}),T&&r.jsx("span",{className:"ml-2 text-red-500 text-[10px]",children:"⚠ escaped \\n — will not match real newlines!"})]}),r.jsx("td",{className:"px-3 py-2",children:g.includes(k)?r.jsx("span",{className:"text-amber-600 text-[10px] font-medium",children:"✓ yes"}):r.jsx("span",{className:"text-gray-300 text-[10px]",children:"no"})})]},S)}),m.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:5,className:"px-3 py-4 text-center text-gray-400 italic text-[11px]",children:"No separators configured"})})]})]})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:["Live Chunk Preview ",r.jsx("span",{className:"text-gray-400 font-normal normal-case",children:"(runs client-side, mirrors backend logic)"})]}),r.jsx("textarea",{rows:6,value:t,onChange:k=>{n(k.target.value),a(null)},placeholder:"Paste sample text here...",className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-amber-400 resize-y"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{onClick:N,className:"flex items-center gap-1.5 px-4 py-2 bg-amber-500 text-white rounded-lg text-sm hover:bg-amber-600 transition-colors",children:[r.jsx(Mh,{className:"w-3.5 h-3.5"})," Run Chunk Preview"]}),r.jsxs("span",{className:"text-[11px] text-gray-400",children:["mode=",r.jsx("strong",{children:w})," · size=",r.jsx("strong",{children:x})," · overlap=",r.jsx("strong",{children:j})," · minSize=",r.jsx("strong",{children:b}),"(",r.jsx("strong",{children:y}
1206),") · seps=",r.jsx("strong",{children:m.length})]})]}),l&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-600 bg-red-50 border border-red-200 rounded-lg p-3",children:[r.jsx(fr,{className:"w-3.5 h-3.5 shrink-0"})," ",l]}),s!==null&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-emerald-700 bg-emerald-50 border border-emerald-200 rounded-lg px-3 py-2",children:[r.jsx(mr,{className:"w-3.5 h-3.5 shrink-0"}),r.jsxs("span",{children:[r.jsxs("strong",{children:[s.length," chunks"]})," produced from ",t.length," chars"]})]}),s.map((k,S)=>r.jsxs("div",{className:"border rounded-lg overflow-hidden text-xs",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-gray-50 border-b",children:[r.jsxs("span",{className:"font-semibold text-gray-600",children:["Chunk #",S+1]}),r.jsxs("div",{className:"flex items-center gap-2",children:[k.merged&&r.jsx("span",{className:"text-[10px] bg-orange-100 text-orange-700 border border-orange-200 rounded px-1.5",children:"merged (too small)"}),k.sepUsed!==null?r.jsxs("span",{className:"font-mono text-[10px] bg-indigo-50 text-indigo-700 border border-indigo-200 rounded px-1.5",children:["split on: ",_5(k.sepUsed)||"(empty)"]}):r.jsx("span",{className:"text-[10px] text-gray-400",children:"hard cut / end"}),r.jsxs("span",{className:"text-[10px] text-gray-400",children:[k.content.length," chars"]})]})]}),r.jsx("pre",{className:"px-3 py-2 text-[11px] text-gray-700 whitespace-pre-wrap bg-white max-h-32 overflow-y-auto leading-relaxed",children:k.content})]},S))]})]})]})]})}const dIe="chunkConfig";function uIe({value:e=[],onChange:t}){const[n,s]=h.useState("");function a(){const o=n.trim().toLowerCase();if(!o||e.includes(o)){s("");return}t([...e,o]),s("")}function i(o){t(e.filter(l=>l!==o))}return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:n,onChange:o=>s(o.target.value),onKeyDown:o=>o.key==="Enter"&&a(),placeholder:"Type a word and press Enter…",className:"flex-1 border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("button",{onClick:a,className:"px-3 py-2 bg-indigo-600 text-white rounded-lg text-sm hover:bg-indigo-700 transition-colors",children:"Add"})]}),e.length>0?r.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-48 overflow-y-auto p-1",children:e.map(o=>r.jsxs("span",{className:"inline-flex items-center gap-1 bg-amber-50 border border-amber-200 text-amber-800 text-xs font-mono rounded-full px-2.5 py-1",children:[o,r.jsx("button",{onClick:()=>i(o),className:"text-amber-400 hover:text-red-500 transition-colors",children:r.jsx(jt,{className:"w-3 h-3"})})]},o))}):r.jsx("p",{className:"text-xs text-gray-400 italic",children:"No keywords yet."}),r.jsxs("p",{className:"text-[11px] text-gray-400",children:[e.length," keyword",e.length!==1?"s":""," in list"]})]})}const Tl={master_system_prompt:`You are a helpful AI assistant. Answer the user's questions based on the provided knowledge base content.
1207Be accurate, concise, and always cite your sources.
1208If the knowledge base doesn't contain relevant information, say so honestly.`,kb_item_template:`[Source: "{{title}}" from "{{kb_name}}"]
1209{{content}}`,history_template:`CONVERSATION HISTORY:
1210{{history}}`,instructions_template:"",closing_instruction:"Answer based on the knowledge base content. If you use information from it, specify which items you referenced.",shell_transition_system_prompt:"You are transitioning to another personalized assistant. Inform the user in your answer which direction the conversation will change using the transition information below and the transition instruction.",context_window_messages:6,max_chars_per_item:2e3,chunk_size:1e3,chunk_overlap:150,json_object_prompt:`You are an expert data modeler. The user wants to generate a JSON object schema.
1211Object Type: {{objectType}}
1212User request: {{userQuery}}
1213Current object: {{currentObject}}
1214
1215For investigationDataScheme: generate investigation profile data fields.
1216For userProfileObject/userInterestsObject/userKnowledgesObject: generate user attributes with nested metadata support.
1217For responseObject: generate LLM response fields (answer, sentiment, extracted_data, etc).
1218
1219Generate a practical, well-structured JSON object where each key has a meaningful null or empty default value.
1220Return only the json_object field with the generated object.`,default_answer_by_type:{},default_response_object_by_type:{},supadata_api_key:"sd_ad618375943235812acca27af416b4ca",...Io},mIe=[{key:"master_system_prompt",label:"Master System Prompt",desc:"Prepended to every assistant. Sets global behavior, brand voice, safety rules.",mono:!0,rows:8,vars:["{{date}}"]},{key:"kb_item_template",label:"Knowledge Item Template",desc:"How each individual KB item is formatted inside the context block.",mono:!0,rows:3,vars:["{{title}}","{{kb_name}}","{{content}}","{{URL}}","{{relevance_score}}"]},{key:"history_template",label:"Conversation History Template",desc:"Wraps the conversation history block 
1220injected into the prompt.",mono:!0,rows:3,vars:["{{history}}"]},{key:"instructions_template",label:"Instructions",desc:"Global instructions template prepended to every assistant's Instructions section.",mono:!0,rows:4,vars:["{{date}}","{{user_name}}","{{user_email}}","{{userBio}}","{{userInvestigations}}"]},{key:"closing_instruction",label:"System Closing Instruction",desc:"Final instruction appended after the user message — e.g. citation rules, format requirements.",mono:!0,rows:3,vars:["{{date}}"]}];function fIe(){const[e,t]=h.useState(null),[n,s]=h.useState(!1),[a,i]=h.useState(!1),[o,l]=h.useState(Tl),[c,d]=h.useState(null),[f,m]=h.useState(""),[g,x]=h.useState("prompt"),[j,b]=h.useState({Test:!0,Investigation:!0,Knowledge:!0,"Learning Assistant":!0}),[y,w]=h.useState({}),[_,N]=h.useState({}),[C,k]=h.useState({}),[S,A]=h.useState({});h.useEffect(()=>{Y.auth.me().then(P=>d(!!(P!=null&&P.is_manager))).catch(()=>d(!1)),T()},[]);async function T(){const P=await Y.entities.AppConfig.filter({key:"global"});if(P[0]){const I=P[0];t(I.id),l({master_system_prompt:I.master_system_prompt??Tl.master_system_prompt,kb_item_template:I.kb_item_template??Tl.kb_item_template,history_template:I.history_template??Tl.history_template,instructions_template:I.instructions_template??Tl.instructions_template,closing_instruction:I.closing_instruction??Tl.closing_instruction,shell_transition_system_prompt:I.shell_transition_system_prompt??Tl.shell_transition_system_prompt,context_window_messages:I.context_window_messages??6,max_chars_per_item:I.max_chars_per_item??2e3,chunk_size:I.chunk_size??1e3,chunk_overlap:I.chunk_overlap??150,min_chunk_size:I.min_chunk_size??0,min_chunk_size_action:I.min_chunk_size_action??"discard",chunk_mode:I.chunk_mode??"both_last",chunk_separators:I.chunk_separators??[`
1221
1222`,`
1223`,". ","! ","? "," "],chunk_separators_ignore_between_numbers:I.chunk_separators_ignore_between_numbers??[],default_answer_by_type:I.default_answer_by_type??{},default_response_object_by_type:I.default_response_object_by_type??{},json_object_prompt:I.json_object_prompt??"",shell_router_model:I.shell_router_model??Io.shell_router_model,shell_router_history_size:I.shell_router_history_size??Io.shell_router_history_size,shell_router_routing_prompt:I.shell_router_routing_prompt??Io.shell_router_routing_prompt,shell_router_return_object:I.shell_router_return_object??Io.shell_router_return_object,shell_router_mapping:I.shell_router_mapping??Io.shell_router_mapping,shell_transition_system_prompt:I.shell_transition_system_prompt??Io.shell_transition_system_prompt,embed_special_node:I.embed_special_node??"",embed_link_node:I.embed_link_node??"ContentLink",embed_debug:I.embed_debug??!1,kb_summary_prompt:I.kb_summary_prompt??"",kb_human_summary_size:I.kb_human_summary_size??500,kb_semantic_summary_size:I.kb_semantic_summary_size??300,kb_ranking_model:I.kb_ranking_model??"gemini_3_flash",kb_ranking_model_params:I.kb_ranking_model_params??{},kb_ranking_prompt:I.kb_ranking_prompt??"",kb_ranking_temperature:I.kb_ranking_temperature??0,kb_summarization_model:I.kb_summarization_model??"automatic",kb_summarization_model_params:I.kb_summarization_model_params??{},kb_kb_summary_prompt:I.kb_kb_summary_prompt??"",kb_kb_human_summary_size:I.kb_kb_human_summary_size??2e3,kb_kb_semantic_summary_size:I.kb_kb_semantic_summary_size??2e3,supadata_api_key:I.supadata_api_key??"",supadata_notes:I.supadata_notes??"",jina_api_key:I.jina_api_key??"",jina_model:I.jina_model??"jina-embeddings-v5-text-small",jina_notes:I.jina_notes??"",supabase_url:I.supabase_url??"",supabase_key:I.supabase_key??"",supabase_notes:I.supabase_notes??"",ignore_keyword_prompt:I.ignore_keyword_prompt??"",ignore_keywords_list:I.ignore_keywords_list??[]})}}async function R(){s(!0);const P={key:"global",...o};if(e)await Y.entities.AppConfig.update(e,P);else{const I=await Y.entities.AppConfig.create(P);t(I.id)}localStorage.setItem(dIe,JSON.stringify({chunkSize:o.chunk_size,chunkOverlap:o.chunk_overlap})),s(!1),i(!0),setTimeout(()=>i(!1),2e3)}function B(P){l(I=>({...I,[P]:Tl[P]}))}const D=[{id:"prompt",label:"Prompt Chain",icon:Br},{id:"rag",label:"RAG & Chunking",icon:_n},{id:"kbrag",label:"KB RAG",icon:_n},{id:"defaults",label:"Assistant Defaults",icon:Sa},{id:"shellrouting",label:"Shell Routing",icon:_b},{id:"jsonobjects",label:"JSON Objects",icon:dr},{id:"keywords",label:"Ignore Keywords",icon:ur},{id:"integrations",label:"Integrations",icon:zn}];return c===!1?r.jsxs("div",{className:"p-8 text-center text-gray-400",children:[r.jsx(M0,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"Access restricted to managers only."})]}):r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-9 h-9 rounded-xl bg-gray-100 flex items-center justify-center",children:r.jsx(Zp,{className:"w-4 h-4 text-gray-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"App Settings"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Global prompt chain and RAG configuration"})]})]}),r.jsxs(de,{onClick:R,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":a?"Saved!":"Save Settings"]})]}),r.jsx("div",{className:"border-b bg-white px-6 shrink-0",children:r.jsx("div",{className:"flex gap-0",children:D.map(P=>r.jsxs("button",{onClick:()=>x(P.id),className:`flex items-center gap-2 px-4 py-3 text-sm font-medium border-b-2 transition-colors
1224                ${g===P.id?"border-indigo-500 text-indigo-700":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[r.jsx(P.icon,{className:"w-4 h-4"}),P.label]},P.id))})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs("div",{className:"p-6 pb-12 space-y-6",children:[g==="prompt"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-2xl p-4 text-sm text-indigo-700 space-y-1",children:[r.jsxs("div",{className:"font-semibold mb-1 flex items-center gap-2",children:[r.jsx(_d,{className:"w-4 h-4"})," Prompt Chain Order"]}),r.jsxs("ol",{className:"list-decimal list-inside text-xs space-y-0.5 text-indigo-600",children:[r.jsx("li",{children:"Master System Prompt"}
1224),r.jsx("li",{children:"Assistant-specific Instructions (from assistant config)"}),r.jsx("li",{children:"RAG Instruction + KB items (using templates below)"}),r.jsx("li",{children:"Conversation History"}),r.jsx("li",{children:"[USER] message"}),r.jsx("li",{children:"Closing Instruction"})]})]}),mIe.map(P=>r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:P.label}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:P.desc}),P.vars&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:P.vars.map(I=>r.jsx("span",{className:"text-xs font-mono bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5",children:I},I))})]}),r.jsx("button",{onClick:()=>B(P.key),title:"Reset to default",className:"text-gray-300 hover:text-gray-500 transition-colors shrink-0 mt-1",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})})]}),r.jsx("textarea",{value:o[P.key],onChange:I=>l({...o,[P.key]:I.target.value}),rows:P.rows,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]},P.key))]}),g==="rag"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Default RAG Limits"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Conversation History Window"}),r.jsxs("span",{className:"font-mono text-indigo-600 font-semibold",children:[o.context_window_messages," messages"]})]}),r.jsx(xr,{value:[o.context_window_messages],onValueChange:([P])=>l({...o,context_window_messages:P}),min:2,max:20,step:2,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"How many past messages to include in the LLM context."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Max Characters Per Knowledge Item"}),r.jsx("span",{className:"font-mono text-indigo-600 font-semibold",children:o.max_chars_per_item.toLocaleString()})]}),r.jsx(xr,{value:[o.max_chars_per_item],onValueChange:([P])=>l({...o,max_chars_per_item:P}),min:500,max:1e4,step:500,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Truncation limit per item to keep prompts manageable."})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Chunking Configuration"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Controls how knowledge items are split into retrievable chunks. Re-chunk your items after changing these."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ot,{children:["Chunk Size ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(chars, 0–1000)"})]}),r.jsx("input",{type:"number",min:0,max:1e3,value:o.chunk_size??1e3,onChange:P=>l({...o,chunk_size:Math.max(0,Math.min(1e3,parseInt(P.target.value)||0))}),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Target number of characters per chunk."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ot,{children:["Min Chunk Size ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(chars, 0 = disabled)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"number",min:0,value:o.min_chunk_size??0,onChange:P=>l({...o,min_chunk_size:Math.max(0,parseInt(P.target.value)||0)}),className:"flex-1 border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("select",{value:o.min_chunk_size_action??"discard",onChange:P=>l({...o,min_chunk_size_action:P.target.value}),className:"border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"discard",children:"Discard"}),r.jsx("option",{value:"append",children:"Append to previous"})]})]}),r.jsx("p",{className:"text-xs text-gray-400",children:"Chunks smaller than this are either discarded or appended to the previous chunk. Set size to 0 to disable."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ot,{children:["Chunk Overlap ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(chars, 0–300)"})]}),r.jsx("input",{type:"number",min:0,max:300,value:o.chunk_overlap??150,onChange:P=>l({...o,chunk_overlap:Math.max(0,Math.min(300,parseInt(P.target.value)||0))}),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Characters shared between consecutive chunks."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Chunking Mode"}
1224),r.jsxs("select",{value:o.chunk_mode??"both_last",onChange:P=>l({...o,chunk_mode:P.target.value}),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"size",children:"Size only — fixed size, no separator awareness"}),r.jsx("option",{value:"separators",children:"Separators only — split on any separator"}),r.jsx("option",{value:"both_first",children:"Size + Separators — first occurrence within range"}),r.jsx("option",{value:"both_last",children:"Size + Separators — last occurrence within range (default)"})]}),r.jsx("p",{className:"text-xs text-gray-400",children:"How chunk boundaries are determined."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Separator Characters"}),r.jsx("p",{className:"text-xs text-gray-400",children:'Separators are tried in order (left = highest priority). Used in "Separators" and "Both" modes.'}),r.jsx(Mv,{value:o.chunk_separators??[`
1225
1226`,`
1227`,". ","! ","? "," "],onChange:P=>l({...o,chunk_separators:P}),ignoreBetweenNumbers:o.chunk_separators_ignore_between_numbers??[],onIgnoreBetweenNumbersChange:P=>l({...o,chunk_separators_ignore_between_numbers:P})})]})]}),r.jsx(IW,{data:o})]}),g==="kbrag"&&r.jsx(OW,{data:o,setData:l}),g==="shellrouting"&&r.jsx(PW,{data:o,setData:l}),g==="defaults"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-4",children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Assistant Defaults"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Default Answer section and Response Object for new assistants of each type."})]}),["Test","Investigation","Knowledge","Learning Assistant"].map(P=>{const I=j[P],z=(o.default_response_object_by_type||{})[P]||{};return r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("button",{onClick:()=>b(L=>({...L,[P]:!L[P]})),className:"w-full flex items-center justify-between px-4 py-3 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsx("span",{className:"text-sm font-semibold text-gray-700",children:P}),I?r.jsx(en,{className:"w-4 h-4 text-gray-400"}):r.jsx(gt,{className:"w-4 h-4 text-gray-400"})]}),!I&&r.jsxs("div",{className:"p-4 space-y-4 border-t bg-white",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-gray-500 font-medium",children:"Default Answer Instruction"}),r.jsx("textarea",{value:(o.default_answer_by_type||{})[P]||"",onChange:L=>l(H=>({...H,default_answer_by_type:{...H.default_answer_by_type||{},[P]:L.target.value}})),rows:3,placeholder:`Default answer instruction for ${P} assistants...`,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsx(Ed,{title:"Default Response Object",value:z,onChange:L=>l(H=>({...H,default_response_object_by_type:{...H.default_response_object_by_type||{},[P]:L}})),aiPrompt:o.json_object_prompt,objectType:"responseObject"})]})]},P)})]}),g==="keywords"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-2xl p-4 text-sm text-amber-800",children:[r.jsxs("div",{className:"font-semibold mb-1 flex items-center gap-2",children:[r.jsx(_d,{className:"w-4 h-4"})," Global Defaults"]}),r.jsx("p",{className:"text-xs text-amber-700",children:"These are the global defaults. Each assistant can override the prompt and list individually, or fall back to these values when left empty."})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Ignore Keyword Prompt"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Prompt sent to the LLM to generate a list of keywords to ignore during semantic search keyword boosting (e.g. generic words that should not influence retrieval)."})]}),r.jsx("textarea",{value:o.ignore_keyword_prompt||"",onChange:P=>l(I=>({...I,ignore_keyword_prompt:P.target.value})),rows:6,placeholder:`You are helping configure a semantic search system for an AI assistant.
1228Given the assistant's context below, generate a list of words that are TOO GENERIC or DOMAIN-COMMON to be useful for keyword boosting during retrieval.
1229
1230Include:
1231- Common English stopwords
1232- Generic verbs overused in this domain (e.g. "provide", "explain", "describe")
1233- Generic nouns that appear everywhere but don't distinguish topics (e.g. "information", "content", "data")
1234- Domain-specific filler words that would match too many documents
1235
1236Return ONLY a flat JSON array of lowercase words in the "ignore_keywords" field.`,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"}),r.jsx("p",{className:"text-xs text-amber-700",children:"The assistant's name, description, KB names, and instructions are automatically appended as context when this prompt is sent to the LLM."})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Global Ignore Keywords List"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Words in this list are filtered out of query terms before keyword boosting. Used as fallback when an assistant's own list is empty."})]}),r.jsx(uIe,{value:o.ignore_keywords_list||[],onChange:P=>l(I=>({...I,ignore_keywords_list:P}))})]})]}),g==="integrations"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Jina AI — Embeddings"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Used to generate vector embeddings for knowledge chunks. Powers real vector search."})]}),r.jsx("a",{href:"https://jina.ai/embeddings/",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-indigo-600 hover:text-indigo-800 border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 rounded-lg px-3 py-1.5 transition-colors shrink-0",children:"jina.ai ↗"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"API Key"}),r.jsx("input",{type:"password",value:o.jina_api_key||"",onChange:P=>l(I=>({...I,jina_api_key:P.target.value})),placeholder:"jina_••••••••••••••••••••••••••••••••••",className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Get your free API key from ",r.jsx("a",{href:"https://jina.ai/embeddings/",target:"_blank",rel:"noopener noreferrer",className:"text-indigo-500 hover:underline",children:"jina.ai/embeddings"}),"."]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Model"}),r.jsx("input",{value:o.jina_model||"jina-embeddings-v5-text-small",onChange:P=>l(I=>({...I,jina_model:P.target.value})),placeholder:"jina-embeddings-v5-text-small",className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Embedding model. Recommended: ",r.jsx("code",{className:"bg-gray-100 px-1 rounded font-mono text-[11px]",children:"jina-embeddings-v5-text-small"})," (1024 dims)."]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Notes"}
1236),r.jsx("textarea",{value:o.jina_notes||"",onChange:P=>l(I=>({...I,jina_notes:P.target.value})),rows:3,placeholder:"Internal notes about Jina AI setup, usage, or status...",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Hu,{integration:"jina",data:o}),r.jsxs(de,{size:"sm",variant:"outline",onClick:async()=>{var P,I,z,L;try{const H=await Y.functions.invoke("jinaEmbeddings",{text:"Test embedding for connection validation"});alert(`Jina Embedding Success!
1237Model: ${(P=H.data)==null?void 0:P.model}
1238Dimensions: ${(I=H.data)==null?void 0:I.dimensions}
1239Vector preview: [${(L=(z=H.data)==null?void 0:z.embedding)==null?void 0:L.slice(0,5).join(", ")}...]`)}catch(H){alert(`Jina Embedding Failed:
1240${H.message}`)}},className:"gap-1.5",children:[r.jsx(zn,{className:"w-3.5 h-3.5"}),"Test Jina Function"]})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Supadata — Transcript Extraction"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:'Used by the "API Extract CC" button to pull YouTube transcripts via the Supadata API.'})]}),r.jsx("a",{href:"https://supadata.ai",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-indigo-600 hover:text-indigo-800 border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 rounded-lg px-3 py-1.5 transition-colors shrink-0",children:"supadata.ai ↗"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"API Key"}),r.jsx("input",{type:"password",value:o.supadata_api_key||"",onChange:P=>l(I=>({...I,supadata_api_key:P.target.value})),placeholder:"sd_••••••••••••••••••••••••••••••••••",className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Get your API key from ",r.jsx("a",{href:"https://supadata.ai",target:"_blank",rel:"noopener noreferrer",className:"text-indigo-500 hover:underline",children:"supadata.ai"}),". This key is stored in the app settings (not in environment secrets)."]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Notes"}),r.jsx("textarea",{value:o.supadata_notes||"",onChange:P=>l(I=>({...I,supadata_notes:P.target.value})),rows:3,placeholder:"Internal notes about Supadata setup, usage, or status...",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsx(Hu,{integration:"supadata",data:o})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Supabase — Database"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Supabase connection details for data storage and management."})]}),r.jsx("a",{href:"https://supabase.io",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-indigo-600 hover:text-indigo-800 border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 rounded-lg px-3 py-1.5 transition-colors shrink-0",children:"supabase.io ↗"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"URL"}),r.jsx("input",{type:"text",value:o.supabase_url||"",onChange:P=>l(I=>({...I,supabase_url:P.target.value})),placeholder:"https://your-project.supabase.co",className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Your Supabase project URL."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Key (API)"}),r.jsx("input",{type:"password",value:o.supabase_key||"",onChange:P=>l(I=>({...I,supabase_key:P.target.value})),placeholder:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Your Supabase API key (anon or service role)."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Notes"}),r.jsx("textarea",{value:o.supabase_notes||"",onChange:P=>l(I=>({...I,supabase_notes:P.target.value})),rows:3,placeholder:"Internal notes about Supabase setup, tables, authentication, or status...",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsx(Hu,{integration:"supabase",data:o})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Embedded Chat — Special Rendering"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Configure how the embedded assistant chat renders special nodes from the LLM response JSON."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Special Node"}),r.jsx("input",{value:o.embed_special_node||"",onChange:P=>l(I=>({...I,embed_special_node:P.target.value})),placeholder:"e.g. suggestions, cards, results",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-xs text-gray-400",children:"The node name in the LLM response JSON whose value (array) will be rendered in a special area below each assistant message."})]}),r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Debug Mode"}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Show a debug button on each assistant message to inspect the raw response JSON."})]}),r.jsx("button",{onClick:()=>l(P=>({...P,embed_debug:!P.embed_debug})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${o.embed_debug?"bg-indigo-600":"bg-gray-200"}`,children:r.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${o.embed_debug?"translate-x-6":"translate-x-1"}`})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Link Node"}),r.jsx("input",{value:o.embed_link_node||"",onChange:P=>l(I=>({...I,embed_link_node:P.target.value})),placeholder:"ContentLink",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["The field name inside each item of the special node array that holds a URL to open in a new window. Default: ",r.jsx("code",{className:"bg-gray-100 px-1 rounded font-mono",children:"ContentLink"}),"."]})]}),r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-4 text-xs text-indigo-700 space-y-1",children:[r.jsx("p",{className:"font-semibold",children:"How it works"}),r.jsxs("p",{children:["If ",r.jsx("strong",{children:"Special Node"})," is set to ",r.jsx("code",{className:"bg-indigo-100 px-1 rounded font-mono",children:"suggestions"})," and your LLM returns:"]}),r.jsx("pre",{className:"bg-indigo-100 rounded p-2 mt-1 font-mono text-[11px] whitespace-pre-wrap",children:'{ "answer": "...", "suggestions": [{ "title": "Item", "ContentLink": "https://..." }] }'}),r.jsxs("p",{className:"mt-1",children:["Each item in the array is rendered as a card. If the item has a ",r.jsx("strong",{children:"Link Node"})," field, it becomes a clickable link opening in a new tab."]})]})]})]}),g==="jsonobjects"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"AI JSON Generation Prompt"}),r.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["This prompt is used by the AI Generate button in all JSON Object editors. Use ",r.jsx("code",{className:"bg-gray-100 px-1 rounded font-mono",children:"{{userQuery}}"})," where the user's description should be injected."]})]}),r.jsx("textarea",{value:o.json_object_prompt||"",onChange:P=>l(I=>({...I,json_object_prompt:P.target.value})),rows:8,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y",placeholder:`You are an expert data modeler. The user wants to generate a JSON object schema.
1241User request: {{userQuery}}
1242
1243Generate a practical, flat JSON object...`}),r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[r.jsx("span",{className:"text-xs bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5 font-mono",children:"{{userQuery}}"}),r.jsx("span",{className:"text-xs bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5 font-mono",children:"{{currentObject}}"}),r.jsx("span",{className:"text-xs bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5 font-mono",children:"{{objectType}}"})]}),r.jsxs("p",{className:"text-xs text-gray-400",children:[r.jsx("code",{className:"bg-gray-100 px-1 rounded font-mono",children:"{{objectType}}"})," values: ",r.jsx("span",{className:"font-mono",children:"responseObject"}),", ",r.jsx("span",{className:"font-mono",children:"investigationDataScheme"}),", ",r.jsx("span",{className:"font-mono",children:"userProfileObject"}),", ",r.jsx("span",{className:"font-mono",children:"userInterestsObject"}),", ",r.jsx("span",{className:"font-mono",children:"userKnowledgesObject"})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Live Preview"}),r.jsx(Ed,{title:"Test JSON Object Editor",description:"Use this to test the AI generation with your configured prompt above.",value:S,onChange:A,aiPrompt:o.json_object_prompt,objectType:"responseObject"})]})]})]})})]})}function Sc(e={}){const[t,n]=h.useState(null),[s,a]=h.useState(e),[i,o]=h.useState(!1),[l,c]=h.useState(!1);h.useEffect(()=>{Y.entities.AppConfig.filter({key:"global"}).then(f=>{f[0]&&(n(f[0].id),a(m=>({...m,...f[0]})))})},[]);async function d(){o(!0);const f={key:"global",...s};if(t)await Y.entities.AppConfig.update(t,f);else{const m=await Y.entities.AppConfig.create(f);n(m.id)}o(!1),c(!0),setTimeout(()=>c(!1),2e3)}return{configId:t,data:s,setData:a,saving:i,saved:l,handleSave:d}}const QB={master_system_prompt:`You are a helpful AI assistant. Answer the user's questions based on the provided knowledge base content.
1244Be accurate, concise, and always cite your sources.
1245If the knowledge base doesn't contain relevant information, say so honestly.`,kb_item_template:`[Source: "{{title}}" from "{{kb_name}}"]
1246{{content}}`,history_template:`CONVERSATION HISTORY:
1247{{history}}`,instructions_template:"",closing_instruction:"Answer based on the knowledge base content. If you use information from it, specify which items you referenced."},hIe=[{key:"master_system_prompt",label:"Master System Prompt",desc:"Prepended to every assistant. Sets global behavior, brand voice, safety rules.",rows:8,vars:["{{date}}"]},{key:"kb_item_template",label:"Knowledge Item Template",desc:"How each individual KB item is formatted inside the context block.",rows:3,vars:["{{title}}","{{kb_name}}","{{content}}","{{URL}}","{{relevance_score}}"]},{key:"history_template",label:"Conversation History Template",desc:"Wraps the conversation history block 
1247injected into the prompt.",rows:3,vars:["{{history}}"]},{key:"instructions_template",label:"Instructions",desc:"Global instructions template prepended to every assistant's Instructions section.",rows:4,vars:["{{date}}","{{user_name}}","{{user_email}}","{{userBio}}","{{userInvestigations}}"]},{key:"closing_instruction",label:"System Closing Instruction",desc:"Final instruction appended after the user message — e.g. citation rules, format requirements.",rows:3,vars:["{{date}}"]}];function pIe(){const{data:e,setData:t,saving:n,saved:s,handleSave:a}=Sc(QB);return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/Settings",className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-5 h-5"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-indigo-50 flex items-center justify-center",children:r.jsx(Br,{className:"w-4 h-4 text-indigo-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Prompt Chain"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Global prompt templates and instructions"})]})]}),r.jsxs(de,{onClick:a,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":s?"Saved!":"Save"]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 pb-12 space-y-6",children:[r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-2xl p-4 text-sm text-indigo-700",children:[r.jsxs("div",{className:"font-semibold mb-1 flex items-center gap-2",children:[r.jsx(_d,{className:"w-4 h-4"})," Prompt Chain Order"]}),r.jsxs("ol",{className:"list-decimal list-inside text-xs space-y-0.5 text-indigo-600",children:[r.jsx("li",{children:"Master System Prompt"}),r.jsx("li",{children:"Assistant-specific Instructions (from assistant config)"}),r.jsx("li",{children:"RAG Instruction + KB items (using templates below)"}),r.jsx("li",{children:"Conversation History"}),r.jsx("li",{children:"[USER] message"}),r.jsx("li",{children:"Closing Instruction"})]})]}),hIe.map(i=>r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:i.label}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:i.desc}),i.vars&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:i.vars.map(o=>r.jsx("span",{className:"text-xs font-mono bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5",children:o},o))})]}),r.jsx("button",{onClick:()=>t(o=>({...o,[i.key]:QB[i.key]})),title:"Reset to default",className:"text-gray-300 hover:text-gray-500 transition-colors shrink-0 mt-1",children:r.jsx(Dr,{className:"w-3.5 h-3.5"})})]}),r.jsx("textarea",{value:e[i.key]??"",onChange:o=>t(l=>({...l,[i.key]:o.target.value})),rows:i.rows,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]},i.key))]})]})}const gIe={context_window_messages:6,max_chars_per_item:2e3,chunk_size:1e3,chunk_overlap:150,min_chunk_size:0,min_chunk_size_action:"discard",chunk_mode:"both_last",chunk_separators:[`
1248
1249`,`
1250`,". ","! ","? "," "],chunk_separators_ignore_between_numbers:[]},xIe="chunkConfig";function yIe(){const{data:e,setData:t,saving:n,saved:s,handleSave:a}=Sc(gIe);async function i(){await a(),localStorage.setItem(xIe,JSON.stringify({chunkSize:e.chunk_size,chunkOverlap:e.chunk_overlap}))}return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/Settings",className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-5 h-5"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-blue-50 flex items-center justify-center",children:r.jsx(_n,{className:"w-4 h-4 text-blue-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"RAG & Chunking"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Context limits and chunking configuration"})]})]}),r.jsxs(de,{onClick:i,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":s?"Saved!":"Save"]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 pb-12 space-y-6",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Default RAG Limits"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Conversation History Window"}),r.jsxs("span",{className:"font-mono text-indigo-600 font-semibold",children:[e.context_window_messages," messages"]})]}),r.jsx(xr,{value:[e.context_window_messages],onValueChange:([o])=>t(l=>({...l,context_window_messages:o})),min:2,max:20,step:2,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"How many past messages to include in the LLM context."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ot,{children:"Max Characters Per Knowledge Item"}),r.jsx("span",{className:"font-mono text-indigo-600 font-semibold",children:(e.max_chars_per_item??2e3).toLocaleStr
1250ing()})]}),r.jsx(xr,{value:[e.max_chars_per_item??2e3],onValueChange:([o])=>t(l=>({...l,max_chars_per_item:o})),min:500,max:1e4,step:500,className:"w-full"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Truncation limit per item to keep prompts manageable."})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Chunking Configuration"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Controls how knowledge items are split into retrievable chunks. Re-chunk your items after changing these."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ot,{children:["Chunk Size ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(chars, 0–1000)"})]}),r.jsx("input",{type:"number",min:0,max:1e3,value:e.chunk_size??1e3,onChange:o=>t(l=>({...l,chunk_size:Math.max(0,Math.min(1e3,parseInt(o.target.value)||0))})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Target number of characters per chunk."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ot,{children:["Min Chunk Size ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(chars, 0 = disabled)"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"number",min:0,value:e.min_chunk_size??0,onChange:o=>t(l=>({...l,min_chunk_size:Math.max(0,parseInt(o.target.value)||0)})),className:"flex-1 border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("select",{value:e.min_chunk_size_action??"discard",onChange:o=>t(l=>({...l,min_chunk_size_action:o.target.value})),className:"border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"discard",children:"Discard"}),r.jsx("option",{value:"append",children:"Append to previous"})]})]}),r.jsx("p",{className:"text-xs text-gray-400",children:"Chunks smaller than this are either discarded or appended to the previous chunk."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ot,{children:["Chunk Overlap ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(chars, 0–300)"})]}),r.jsx("input",{type:"number",min:0,max:300,value:e.chunk_overlap??150,onChange:o=>t(l=>({...l,chunk_overlap:Math.max(0,Math.min(300,parseInt(o.target.value)||0))})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Characters shared between consecutive chunks."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Chunking Mode"}),r.jsxs("select",{value:e.chunk_mode??"both_last",onChange:o=>t(l=>({...l,chunk_mode:o.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"size",children:"Size only — fixed size, no separator awareness"}),r.jsx("option",{value:"separators",children:"Separators only — split on any separator"}),r.jsx("option",{value:"both_first",children:"Size + Separators — first occurrence within range"}),r.jsx("option",{value:"both_last",children:"Size + Separators — last occurrence within range (default)"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{children:"Separator Characters"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Separators are tried in order (left = highest priority)."}),r.jsx(Mv,{value:e.chunk_separators??[`
1251
1252`,`
1253`,". ","! ","? "," "],onChange:o=>t(l=>({...l,chunk_separators:o})),ignoreBetweenNumbers:e.chunk_separators_ignore_between_numbers??[],onIgnoreBetweenNumbersChange:o=>t(l=>({...l,chunk_separators_ignore_between_numbers:o}))})]})]}),r.jsx(IW,{data:e})]})]})}function bIe(){const{data:e,setData:t,saving:n,saved:s,handleSave:a}=Sc({});return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/Settings",className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-5 h-5"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-cyan-50 flex items-center justify-center",children:r.jsx(_n,{className:"w-4 h-4 text-cyan-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"KB RAG"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Knowledge base summarization and ranking configuration"})]})]}),r.jsxs(de,{onClick:a,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":s?"Saved!":"Save"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6 pb-12",children:r.jsx(OW,{data:e,setData:t})})]})}function vIe(){const{data:e,setData:t,saving:n,saved:s,handleSave:a}=Sc({}),[i,o]=h.useState({Test:!0,Investigation:!0,Knowledge:!0,"Learning Assistant":!0});return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/Settings",className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-5 h-5"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-violet-50 flex items-center justify-center",children:r.jsx(Sa,{className:"w-4 h-4 text-violet-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Assistant Defaults"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Default answer and response objects per assistant type"})]})]}),r.jsxs(de,{onClick:a,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":s?"Saved!":"Save"]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 pb-12 space-y-4",children:[r.jsx("div",{className:"bg-white border rounded-2xl p-4",children:r.jsx("p",{className:"text-xs text-gray-400",children:"Default Answer section and Response Object for new assistants of each type."})}),["Test","Investigation","Knowledge","Learning Assistant"].map(l=>{const c=i[l],d=(e.default_response_object_by_type||{})[l]||{};return r.jsxs("div",{className:"border rounded-xl overflow-hidden",children:[r.jsxs("button",{onClick:()=>o(f=>({...f,[l]:!f[l]})),className:"w-full flex items-center justify-between px-4 py-3 bg-gray-50 hover:bg-gray-100 transition-colors text-left",children:[r.jsx("span",{className:"text-sm font-semibold text-gray-700",children:l}),c?r.jsx(en,{className:"w-4 h-4 text-gray-400"}):r.jsx(gt,{className:"w-4 h-4 text-gray-400"})]}),!c&&r.jsxs("div",{className:"p-4 space-y-4 border-t bg-white",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-gray-500 font-medium",children:"Default Answer Instruction"}),r.jsx("textarea",{value:(e.default_answer_by_type||{})[l]||"",onChange:f=>t(m=>({...m,default_answer_by_type:{...m.default_answer_by_type||{},[l]:f.target.value}})),rows:3,placeholder:`Default answer instruction for ${l} assistants...`,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsx(Ed,{title:"Default Response Object",value:d,onChange:f=>t(m=>({...m,default_response_object_by_type:{...m.default_response_object_by_type||{},[l]:f}})),aiPrompt:e.json_object_prompt,objectType:"responseObject"})]})]},l)})]})]})}function wIe(){const{data:e,setData:t,saving:n,saved:s,handleSave:a}=Sc({});return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/Settings",className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-5 h-5"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-emerald-50 flex items-center justify-center",children:r.jsx(_b,{className:"w-4 h-4 text-emerald-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Shell Routing"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Router model, prompts, and shell mapping"})]})]}),r.jsxs(de,{onClick:a,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":s?"Saved!":"Save"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6 pb-12",children:r.jsx(PW,{data:e,setData:t})})]})}function jIe(){const{data:e,setData:t,saving:n,saved:s,handleSave:a}=Sc({}),[i,o]=h.useState({});return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/Settings",className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-5 h-5"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-amber-50 flex items-center justify-center",children:r.jsx(dr,{className:"w-4 h-4 text-amber-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"JSON Objects"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"AI JSON generation prompt and live preview"})]})]}),r.jsxs(de,{onClick:a,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":s?"Saved!":"Save"]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 pb-12 space-y-6",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"AI JSON Generation Prompt"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Used by the AI Generate button in all JSON Object editors."})]}),r.jsx("textarea",{value:e.json_object_prompt||"",onChange:l=>t(c=>({...c,json_object_prompt:l.target.value})),rows:8,className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y",placeholder:`You are an expert data modeler. The user wants to generate a JSON object schema.
1254User request: {{userQuery}}
1255
1256Generate a practical, flat JSON object...`}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:["{{userQuery}}","{{currentObject}}","{{objectType}}"].map(l=>r.jsx("span",{className:"text-xs bg-indigo-50 text-indigo-600 border border-indigo-100 rounded px-1.5 py-0.5 font-mono",children:l},l))})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Live Preview"}),r.jsx(Ed,{title:"Test JSON Object Editor",description:"Use this to test the AI generation with your configured prompt above.",value:i,onChange:o,aiPrompt:e.json_object_prompt,objectType:"responseObject"})]})]})]})}function _Ie({value:e=[],onChange:t}){const[n,s]=h.useState("");function a(){const o=n.trim().toLowerCase();if(!o||e.includes(o)){s("");return}t([...e,o]),s("")}function i(o){t(e.filter(l=>l!==o))}return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:n,onChange:o=>s(o.target.value),onKeyDown:o=>o.key==="Enter"&&a(),placeholder:"Type a word and press Enter…",className:"flex-1 border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("button",{onClick:a,className:"px-3 py-2 bg-indigo-600 text-white rounded-lg text-sm hover:bg-indigo-700 transition-colors",children:"Add"})]}),e.length>0?r.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-48 overflow-y-auto p-1",children:e.map(o=>r.jsxs("span",{className:"inline-flex items-center gap-1 bg-amber-50 border border-amber-200 text-amber-800 text-xs font-mono rounded-full px-2.5 py-1",children:[o,r.jsx("button",{onClick:()=>i(o),className:"text-amber-400 hover:text-red-500 transition-colors",children:r.jsx(jt,{className:"w-3 h-3"})})]},o))}):r.jsx("p",{className:"text-xs text-gray-400 italic",children:"No keywords yet."}),r.jsxs("p",{className:"text-[11px] text-gray-400",children:[e.length," keyword",e.length!==1?"s":""," in list"]})]})}function NIe(){const{data:e,setData:t,saving:n,saved:s,handleSave:a}=Sc({});return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/Settings",className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-5 h-5"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-rose-50 flex items-center justify-center",children:r.jsx(ur,{className:"w-4 h-4 text-rose-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Ignore Keywords"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Global keyword filtering for semantic search"})]})]}),r.jsxs(de,{onClick:a,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":s?"Saved!":"Save"]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 pb-12 space-y-6",children:[r.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-2xl p-4 text-sm text-amber-800",children:[r.jsxs("div",{className:"font-semibold mb-1 flex items-center gap-2",children:[r.jsx(_d,{className:"w-4 h-4"})," Global Defaults"]}),r.jsx("p",{className:"text-xs text-amber-700",children:"These are the global defaults. Each assistant can override the prompt and list individually."})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Ignore Keyword Prompt"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Prompt sent to the LLM to generate a list of keywords to ignore during semantic search keyword boosting."})]}),r.jsx("textarea",{value:e.ignore_keyword_prompt||"",onChange:i=>t(o=>({...o,ignore_keyword_prompt:i.target.value})),rows:6,placeholder:"You are helping configure a semantic search system...",className:"w-full border rounded-lg px-3 py-2 text-xs font-mono bg-gray-50 focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Global Ignore Keywords List"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Words filtered out of query terms before keyword boosting."})]}),r.jsx(_Ie,{value:e.ignore_keywords_list||[],onChange:i=>t(o=>({...o,ignore_keywords_list:i}))})]})]})]})}function SIe(){const{data:e,setData:t,saving:n,saved:s,handleSave:a}=Sc({});return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 flex items-center justify-between shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/Settings",className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(ii,{className:"w-5 h-5"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-orange-50 flex items-center justify-center",children:r.jsx(zn,{className:"w-4 h-4 text-orange-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Integrations"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Jina AI, Supadata, Supabase, and embedded chat"})]})]}),r.jsxs(de,{onClick:a,disabled:n,className:"gap-2",children:[r.jsx(Ar,{className:"w-4 h-4"}),n?"Saving...":s?"Saved!":"Save"]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 pb-12 space-y-6",children:[r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Jina AI â
1256€” Embeddings"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Used to generate vector embeddings for knowledge chunks."})]}),r.jsx("a",{href:"https://jina.ai/embeddings/",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-indigo-600 hover:text-indigo-800 border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 rounded-lg px-3 py-1.5 transition-colors shrink-0",children:"jina.ai ↗"})]}),r.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded-lg px-4 py-3 flex items-start gap-2",children:[r.jsx("span",{className:"text-emerald-600 text-sm mt-0.5",children:"🔒"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-emerald-800",children:"API Key stored in secure secrets manager"}),r.jsxs("p",{className:"text-xs text-emerald-700 mt-0.5",children:["Set ",r.jsx("code",{className:"bg-emerald-100 px-1 rounded",children:"JINA_API_KEY"})," in Dashboard → Settings → Environment Variables."]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Chunk Embedding Model"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Model used when ",r.jsx("strong",{children:"storing vectors"})," (chunking pipeline)."]}),r.jsxs("select",{value:e.jina_model||"jina-embeddings-v5-text-small",onChange:i=>t(o=>({...o,jina_model:i.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400 bg-white",children:[r.jsx("option",{value:"jina-embeddings-v5-text-small",children:"jina-embeddings-v5-text-small"}),r.jsx("option",{value:"jina-embeddings-v3",children:"jina-embeddings-v3"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Query Model — Primary"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Used for ",r.jsx("strong",{children:"all searches"})," (1st round)."]}),r.jsxs("select",{value:e.jina_query_model_primary||"jina-embeddings-v5-text-small",onChange:i=>t(o=>({...o,jina_query_model_primary:i.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400 bg-white",children:[r.jsx("option",{value:"jina-embeddings-v5-text-small",children:"jina-embeddings-v5-text-small"}),r.jsx("option",{value:"jina-embeddings-v3",children:"jina-embeddings-v3"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Query Model — Secondary"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["2nd search round — results merged. ",r.jsx("code",{children:"none"})," = disabled."]}),r.jsxs("select",{value:e.jina_query_model_secondary||"none",onChange:i=>t(o=>({...o,jina_query_model_secondary:i.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400 bg-white",children:[r.jsx("option",{value:"none",children:"none (disabled)"}),r.jsx("option",{value:"jina-embeddings-v5-text-small",children:"jina-embeddings-v5-text-small"}),r.jsx("option",{value:"jina-embeddings-v3",children:"jina-embeddings-v3"})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"IVSS Early Exit Score"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["In ",r.jsx("code",{className:"bg-gray-100 px-1 py-0.5 rounded",children:"ItemsVectorSemanticSearch"}),", if the top result from the ",r.jsx("strong",{children:"1st round"})," already meets or exceeds this score, skip the 2nd (secondary model) round entirely. Set to ",r.jsx("code",{children:"1"})," to disable early exit."]}),r.jsx("input",{type:"number",min:"0",max:"1",step:"0.01",value:e.ivss_early_exit_score??.95,onChange:i=>t(o=>({...o,ivss_early_exit_score:Number(i.target.value)})),className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Task"}
1256),r.jsx("input",{value:e.jina_task||"retrieval.passage",onChange:i=>t(o=>({...o,jina_task:i.target.value})),placeholder:"retrieval.passage",className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Jina embedding task type. Common values: ",r.jsx("code",{children:"retrieval.passage"}),", ",r.jsx("code",{children:"retrieval.query"}),", ",r.jsx("code",{children:"text-matching"}),". Used by the ",r.jsx("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded",children:"jinaEmbeddings"})," backend function."]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Delay between requests (ms)"}),r.jsx("input",{type:"number",min:"0",value:e.jina_delay_ms??0,onChange:i=>t(o=>({...o,jina_delay_ms:Number(i.target.value)})),placeholder:"0",className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Optional delay (milliseconds) between consecutive Jina API calls to avoid rate limiting."})]}),r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-lg p-3 space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold text-indigo-900",children:"💡 For Prompt Builders"}),r.jsxs("p",{className:"text-xs text-indigo-800",children:["When instructing searches that use embeddings, reference the ",r.jsx("code",{className:"bg-white px-1.5 py-0.5 rounded",children:"jinaEmbeddings"})," function. This function is called by:"]}),r.jsxs("ul",{className:"text-xs text-indigo-800 list-disc list-inside space-y-0.5",children:[r.jsxs("li",{children:[r.jsx("code",{children:"ItemsVectorSemanticSearch"})," — for item-level deduplication"]}),r.jsxs("li",{children:[r.jsx("code",{children:"directQuery"})," — for raw chunk retrieval"]}),r.jsxs("li",{children:[r.jsx("code",{children:"VectorTrace"})," — for debugging embeddings"]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Notes"}),r.jsx("textarea",{value:e.jina_notes||"",onChange:i=>t(o=>({...o,jina_notes:i.target.value})),rows:3,placeholder:"Internal notes...",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Hu,{integration:"jina",data:e}),r.jsxs(de,{size:"sm",variant:"outline",onClick:async()=>{var i,o,l,c;try{const d=await Y.functions.invoke("jinaEmbeddings",{text:"Test embedding for connection validation"});alert(`Jina Embedding Success!
1257Model: ${(i=d.data)==null?void 0:i.model}
1258Dimensions: ${(o=d.data)==null?void 0:o.dimensions}
1259Vector preview: [${(c=(l=d.data)==null?void 0:l.embedding)==null?void 0:c.slice(0,5).join(", ")}...]`)}catch(d){alert(`Jina Embedding Failed:
1260${d.message}`)}},className:"gap-1.5",children:[r.jsx(zn,{className:"w-3.5 h-3.5"}),"Test Jina Function"]})]})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Supadata — Transcript Extraction"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Used to pull YouTube transcripts via the Supadata API."})]}),r.jsx("a",{href:"https://supadata.ai",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-indigo-600 hover:text-indigo-800 border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 rounded-lg px-3 py-1.5 transition-colors shrink-0",children:"supadata.ai ↗"})]}),r.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded-lg px-4 py-3 flex items-start gap-2",children:[r.jsx("span",{className:"text-emerald-600 text-sm mt-0.5",children:"🔒"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-emerald-800",children:"API Key stored in secure secrets manager"}),r.jsxs("p",{className:"text-xs text-emerald-700 mt-0.5",children:["Set ",r.jsx("code",{className:"bg-emerald-100 px-1 rounded",children:"SUPADATA_API_KEY"})," in Dashboard → Settings → Environment Variables."]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Notes"}),r.jsx("textarea",{value:e.supadata_notes||"",onChange:i=>t(o=>({...o,supadata_notes:i.target.value})),rows:3,placeholder:"Internal notes...",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsx(Hu,{integration:"supadata",data:e})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Supabase — Database"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Supabase connection details for data storage and management."})]}),r.jsx("a",{href:"https://supabase.io",target:"_blank",rel:"noopener noreferrer",className:"text-xs font-medium text-indigo-600 hover:text-indigo-800 border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 rounded-lg px-3 py-1.5 transition-colors shrink-0",children:"supabase.io ↗"})]}),r.jsxs("div",{className:"bg-emerald-50 border border-emerald-200 rounded-lg px-4 py-3 flex items-start gap-2",children:[r.jsx("span",{className:"text-emerald-600 text-sm mt-0.5",children:"🔒"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-emerald-800",children:"Credentials stored in secure secrets manager"}),r.jsxs("p",{className:"text-xs text-emerald-700 mt-0.5",children:["Set ",r.jsx("code",{className:"bg-emerald-100 px-1 rounded",children:"SUPABASE_URL"})," and ",r.jsx("code",{className:"bg-emerald-100 px-1 rounded",children:"SUPABASE_KEY"})," in Dashboard → Settings → Environment Variables."]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Notes"}),r.jsx("textarea",{value:e.supabase_notes||"",onChange:i=>t(o=>({...o,supabase_notes:i.target.value})),rows:3,placeholder:"Internal notes...",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Integration Contract"}),r.jsx("span",{className:"text-[11px] text-gray-400",children:"Used by backend search functions"})]}),r.jsxs("p",{className:"text-xs text-gray-400",children:["Source function name and technical details used by the search pipeline (e.g. RPC name, table, vector column, metadata fields). Referenced in ",r.jsx("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded",children:"ItemsVectorSemanticSearch"})," and ",r.jsx("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded",children:"directQuery"})," functions."]}),r.jsx("textarea",{value:e.supabase_contract||"",onChange:i=>t(o=>({...o,supabase_contract:i.target.value})),rows:6,placeholder:`Function: match_documents
1261Table: documents
1262Vector column: embedding
1263Metadata: knowledge_base_id, knowledge_item_id, item_title, content_type, chunk_index
1264Match count param: match_count
1265Threshold param: match_threshold`,className:"w-full border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400 resize-y"}),r.jsxs("p",{className:"text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded px-2 py-1.5",children:[r.jsx("strong",{children:"Tip for prompt builders:"})," When instructing the system to perform KB searches, reference this contract to ensure the backend functions apply the correct RPC and metadata filters."]})]}),r.jsx(Hu,{integration:"supabase",data:e})]}),r.jsxs("div",{className:"bg-white border rounded-2xl p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-sm uppercase tracking-wide text-gray-400",children:"Embedded Chat — Special Rendering"}),r.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Configure how the embedded assistant chat renders special nodes from the LLM response JSON."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Special Node"}),r.jsx("input",{value:e.embed_special_node||"",onChange:i=>t(o=>({...o,embed_special_node:i.target.value})),placeholder:"e.g. suggestions, cards, results",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"})]}),r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Debug Mode"}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Show a debug button on each assistant message to inspect the raw response JSON."})]}),r.jsx("button",{onClick:()=>t(i=>({...i,embed_debug:!i.embed_debug})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${e.embed_debug?"bg-indigo-600":"bg-gray-200"}`,children:r.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${e.embed_debug?"translate-x-6":"translate-x-1"}`})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Link Node"}),r.jsx("input",{value:e.embed_link_node||"",onChange:i=>t(o=>({...o,embed_link_node:i.target.value})),placeholder:"ContentLink",className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"})]}),r.jsxs("div",{className:"border-t pt-5 space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-sm text-gray-600",children:"Chat UI Styling"}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Customize colors, fonts and icon size for the embedded chat landing page."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Font Family"}),r.jsxs("select",{value:e.embed_chat_font_family||"Open Sans",onChange:i=>t(o=>({...o,embed_chat_font_family:i.target.value})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"Open Sans",children:"Open Sans"}),r.jsx("option",{value:"Roboto",children:"Roboto"}),r.jsx("option",{value:"Inter",children:"Inter"}),r.jsx("option",{value:"Lato",children:"Lato"}),r.jsx("option",{value:"Montserrat",children:"Montserrat"}),r.jsx("option",{value:"Poppins",children:"Poppins"}),r.jsx("option",{value:"Nunito",children:"Nunito"}),r.jsx("option",{value:"Raleway",children:"Raleway"}),r.jsx("option",{value:"Arial",children:"Arial"}),r.jsx("option",{value:"Georgia",children:"Georgia"})]}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"Font used across the embedded chat UI"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Body Font Size (px)"}),r.jsx("input",{type:"number",min:"10",max:"24",value:e.embed_chat_body_font_size??14,onChange:i=>t(o=>({...o,embed_chat_body_font_size:Number(i.target.value)})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"Text inside chat balloons (Open Sans Regular)"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Title Font Size (px)"}),r.jsx("input",{type:"number",min:"12",max:"32",value:e.embed_chat_title_font_size??18,onCh
1265ange:i=>t(o=>({...o,embed_chat_title_font_size:Number(i.target.value)})),className:"w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"Assistant name in header (Open Sans Bold)"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Balloon Text Color"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e.embed_chat_text_color||"#2B2A2D",onChange:i=>t(o=>({...o,embed_chat_text_color:i.target.value})),className:"h-9 w-12 border rounded-lg cursor-pointer"}),r.jsx("input",{type:"text",value:e.embed_chat_text_color||"#2B2A2D",onChange:i=>t(o=>({...o,embed_chat_text_color:i.target.value})),className:"flex-1 border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Answer Balloon BG"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e.embed_chat_answer_bg||"#163898",onChange:i=>t(o=>({...o,embed_chat_answer_bg:i.target.value})),className:"h-9 w-12 border rounded-lg cursor-pointer"}),r.jsx("input",{type:"text",value:e.embed_chat_answer_bg||"#163898",onChange:i=>t(o=>({...o,embed_chat_answer_bg:i.target.value})),className:"flex-1 border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Send Button Color"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e.embed_chat_send_btn_color||"#FF4E17",onChange:i=>t(o=>({...o,embed_chat_send_btn_color:i.target.value})),className:"h-9 w-12 border rounded-lg cursor-pointer"}),r.jsx("input",{type:"text",value:e.embed_chat_send_btn_color||"#FF4E17",onChange:i=>t(o=>({...o,embed_chat_send_btn_color:i.target.value})),className:"flex-1 border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"User Query BG"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e.embed_chat_user_bg||"#CCE3FF",onChange:i=>t(o=>({...o,embed_chat_user_bg:i.target.value})),className:"h-9 w-12 border rounded-lg cursor-pointer"}),r.jsx("input",{type:"text",value:e.embed_chat_user_bg||"#CCE3FF",onChange:i=>t(o=>({...o,embed_chat_user_bg:i.target.value})),className:"flex-1 border rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400"})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Assistant Icon Scale"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"range",min:"0.5",max:"3",step:"0.1",value:e.embed_chat_icon_scale??1.8,onChange:i=>t(o=>({...o,embed_chat_icon_scale:Number(i.target.value)})),className:"flex-1"}),r.jsxs("span",{className:"text-sm font-mono text-gray-700 w-10 text-right",children:[(e.embed_chat_icon_scale??1.8).toFixed(1),"×"]})]}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"1.0 = original size · 1.8 = 80% bigger (default)"})]}),r.jsxs("div",{className:"bg-gray-50 border rounded-xl p-4 space-y-2",children:[r.jsx("p",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wide",children:"Preview"}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("div",{className:"flex justify-end",children:r.jsx("div",{className:"rounded-2xl rounded-br-sm px-4 py-2.5 text-sm max-w-[70%]",style:{background:e.embed_chat_user_bg||"#CCE3FF",color:e.embed_chat_text_color||"#2B2A2D",fontSize:`${e.embed_chat_body_font_size??14}px`},children:"What can you help me with?"})}),r.jsx("div",{className:"flex justify-start",children:r.jsx("div",{className:"rounded-2xl rounded-bl-sm px-4 py-2.5 text-sm max-w-[70%]",style:{background:e.embed_chat_answer_bg||"#163898",color:"#ffffff",fontSize:`${e.embed_chat_body_font_size??14}px`},children:"I can answer questions about your knowledge base!"})})]}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx("div",{className:"flex-1 border border-gray-200 rounded-xl px-4 py-2 text-sm text-gray-400 bg-white",children:"Type your message..."}),r.jsx("div",{className:"px-5 py-2 rounded-xl text-sm font-medium text-white",style:{background:e.embed_chat_send_btn_color||"#FF4E17"},children:"Send"})]})]})]})]})]})]})}function kIe({onClose:e,onCreated:t}){const[n,s]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(!1),{toast:c}=bb();async function d(){if(!n.trim())return;l(!0);const f=await Y.functions.invoke("issueApiKey",{name:n.trim(),description:a});t(f.data.api_key),c({title:"API Key created",description:"Copy it now — it won't be shown again in full."}),e(),l(!1)}return r.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-sm p-5 space-y-4",children:[r.jsx("h3",{className:"font-semibold text-sm text-gray-900",children:"New API Key"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Name *"}),r.jsx(It,{value:n,onChange:f=>s(f.target.value),placeholder:"e.g. CRM Integration",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-medium text-gray-500 mb-1 block",children:"Description"}),r.jsx(It,{value:a,onChange:f=>i(f.target.value),placeholder:"Optional description"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[r.jsx(de,{variant:"outline",size:"sm",onClick:e,children:"Cancel"}),r.jsx(de,{size:"sm",onClick:d,disabled:!n.trim()||o,children:o?"Creating...":"Create"})]})]})})}function RW({text:e}){const[t,n]=h.useState(!1);function s(){navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return r.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-gray-100 text-gray-400 hover:text-gray-700 transition-colors",title:"Copy",children:t?r.jsx(Tn,{className:"w-3.5 h-3.5 text-emerald-500"}):r.jsx(ri,{className:"w-3.5 h-3.5"})})}function CIe({apiKey:e,onDelete:t,onToggle:n}){const[s,a]=h.useState(!1),i=e.key.slice(0,7)+"••••••••••••••••••••"+e.key.slice(-4);return r.jsxs("div",{className:"border rounded-xl bg-white p-4 flex flex-col sm:flex-row sm:items-center gap-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-semibold text-sm text-gray-800",children:e.name}),r.jsx(Gr,{className:e.status==="active"?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-gray-100 text-gray-500 border-gray-200",children:e.status})]}),e.description&&r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:e.description}),r.jsxs("div",{className:"flex items-center gap-1 mt-1.5",children:[r.jsx("code",{className:"text-xs font-mono text-gray-600 bg-gray-50 px-2 py-0.5 rounded border",children:s?e.key:i}),r.jsx("button",{onClick:()=>a(o=>!o),className:"p-1 rounded hover:bg-gray-100 text-gray-400 transition-colors",title:s?"Hide":"Show",children:s?r.jsx($m,{className:"w-3.5 h-3.5"}):r.jsx(Ts,{className:"w-3.5 h-3.5"})}),r.jsx(RW,{text:e.key})]}),r.jsxs("p",{className:"text-[10px] text-gray-400 mt-1",children:["Created: ",new Date(e.created_date).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx(de,{size:"sm",variant:"outline",className:"text-xs h-7 px-2.5",onClick:()=>n(e),children:e.status==="active"?"Deactivate":"Activate"}),r.jsx("button",{onClick:()=>t(e),className:"text-gray-300 hover:text-red-500 transition-colors",children:r.jsx(un,{className:"w-4 h-4"})})]})]})}function EIe({user:e}){return r.jsxs("div",{className:"border rounded-xl bg-white px-4 py-3 flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-indigo-50 flex items-center justify-center shrink-0",children:r.jsx(eg,{className:"w-4 h-4 text-indigo-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-gray-800 truncate",children:e.name||e.api_user_id}),r.jsx("p",{className:"text-[10px] text-gray-400 font-mono",children:e.api_user_id})]}),r.jsx("p",{className:"text-[10px] text-gray-400 shrink-0",children:new Date(e.created_date).toLocaleDateString()})]})}function AIe(e,t,n){const s=`POST ${e}
1266X-API-Key: ${t}
1267Content-Type: application/json
1268
1269{
1270  "api_user_id": "external-user-123",
1271  "assistant_key": "${n}",
1272  "message": "Hello, what can you help me with?",
1273  "chat_id": "optional_existing_chat_id"   // omit to start a new conversation
1274}
1275
1276// Response:
1277{
1278  "answer": "I can help you with...",
1279  "chat_id": "chat_abc123",
1280  "api_user": { "id": "...", "api_user_id": "external-user-123" }
1281}`,a=`// Google Apps Script — Tools > Script editor
1282
1283// Internal helper — all config passed as parameters so every value can come from a cell
1284function askAssistant(userMessage, apiUserId, assistantKey, apiKey, url, chatId) {
1285  var payload = { api_user_id: apiUserId || "sheets-user", assistant_key: assistantKey, message: userMe
1285ssage };
1286  if (chatId) payload.chat_id = chatId;
1287  var resp = UrlFetchApp.fetch(url, {
1288    method: "post", contentType: "application/json",
1289    headers: { "X-API-Key": apiKey },
1290    payload: JSON.stringify(payload), muteHttpExceptions: true,
1291  });
1292  var data = JSON.parse(resp.getContentText());
1293  return { answer: data.answer || data.error || "", chat_id: data.chat_id || "" };
1294}
1295
1296// Custom formula:
1297//   =ASK_RAG(message, userId, assistantKey, apiKey, url, chatId)
1298//
1299//   message      (required) — cell with the question,         e.g. A2
1300//   userId       (required) — unique user identifier,         e.g. "user-001"
1301//   assistantKey (required) — assistant key,                  e.g. $B$1
1302//   apiKey       (required) — your API key,                   e.g. $A$1
1303//   url          (required) — endpoint URL,                   e.g. $C$1
1304//   chatId       (optional) — previous chat_id to continue,  e.g. B2
1305//
1306// Tip: put url="${e}" in C1, api key in A1, assistant key in B1.
1307//
1308// Examples:
1309//   =ASK_RAG(A2, "user-001", $B$1, $A$1, $C$1)
1310//   =ASK_RAG(A3, "user-001", $B$1, $A$1, $C$1, B2)
1311function ASK_RAG(message, userId, assistantKey, apiKey, url, chatId) {
1312  return askAssistant(message, userId, assistantKey, apiKey, url, chatId).answer;
1313}
1314
1315// Returns [answer, chat_id] — use from a script to persist the chat_id
1316function ASK_RAG_FULL(message, userId, assistantKey, apiKey, url, chatId) {
1317  var r = askAssistant(message, userId, assistantKey, apiKey, url, chatId);
1318  return [r.answer, r.chat_id];
1319}`;return{rest:s,gsheets:a,excel:`' Excel VBA — Developer > Visual Basic > Module
1320' Requires: Tools > References > Microsoft XML v6.0
1321
1322' Tip: store url, apiKey, assistantKey in named cells and pass them as parameters.
1323'
1324' =AskAssistant(A2, "user-001", B1, A1, C1)        — new conversation  (A1=apiKey, B1=assistantKey, C1=url)
1325' =AskAssistant(A2, "user-001", B1, A1, C1, B2)    — continue conversation (B2 = previous chat_id)
1326Function AskAssistant(userMessage As String, _
1327                      apiUserId As String, _
1328                      assistantKey As String, _
1329                      apiKey As String, _
1330                      url As String, _
1331                      Optional chatId As String = "") As String
1332    Dim http As Object: Set http = CreateObject("MSXML2.XMLHTTP.6.0")
1333    Dim body As String
1334    body = "{""api_user_id"":""" & apiUserId & """,""assistant_key"":""" & assistantKey & """,""message"":""" & userMessage & """"
1335    If chatId <> "" Then body = body & ",""chat_id"":""" & chatId & """"
1336    body = body & "}"
1337    http.Open "POST", url, False
1338    http.setRequestHeader "Content-Type", "application/json"
1339    http.setRequestHeader "X-API-Key", apiKey
1340    http.Send body
1341    AskAssistant = CreateObject("ScriptControl").Eval("(" & http.responseText & ").answer")
1342End Function
1343
1344' Returns Array(answer, chat_id) — use to persist conversation state
1345Function AskAssistantFull(userMessage As String, _
1346                           apiUserId As String, _
1347                           assistantKey As String, _
1348                           apiKey As String, _
1349                           url As String, _
1350                           Optional chatId As String = "") As Variant
1351    Dim http As Object: Set http = CreateObject("MSXML2.XMLHTTP.6.0")
1352    Dim body As String
1353    body = "{""api_user_id"":""" & apiUserId & """,""assistant_key"":""" & assistantKey & """,""message"":""" & userMessage & """"
1354    If chatId <> "" Then body = body & ",""chat_id"":""" & chatId & """"
1355    body = body & "}"
1356    http.Open "POST", url, False
1357    http.setRequestHeader "Content-Type", "application/json"
1358    http.setRequestHeader "X-API-Key", apiKey
1359    http.Send body
1360    Dim js As Object: Set js = CreateObject("ScriptControl"): js.Language = "JScript"
1361    AskAssistantFull = Array(js.Eval("(" & http.responseText & ").answer"), js.Eval("(" & http.responseText & ").chat_id || ''"))
1362End Function`}}function TIe(e,t){const n=`GET ${e}
1363X-API-Key: ${t}
1364
1365// Response:
1366{
1367  "assistants": [
1368    {
1369      "id": "abc123",
1370      "name": "Support Bot",
1371      "assistant_key": "support-bot",
1372      "type": "Knowledge",
1373      "description": "Answers support questions"
1374    }
1375  ]
1376}`,s=`// Google Apps Script — Tools > Script editor
1377
1378// Custom formula:
1379//   =LIST_ASSISTANTS(apiKey, url)
1380//
1381//   apiKey  (required) — your API key,      e.g. $A$1
1382//   url     (required) — endpoint URL,      e.g. $C$1  ("${e}")
1383//
1384// Returns a 2D array [[assistant_key, name, type, description], ...]
1385//
1386// Tip: put url in C1, api key in A1, then reference both as $C$1 and $A$1.
1387function LIST_ASSISTANTS(apiKey, url) {
1388  var resp = UrlFetchApp.fetch(url, {
1389    method: "get",
1390    headers: { "X-API-Key": apiKey },
1391    muteHttpExceptions: true,
1392  });
1393  var data = JSON.parse(resp.getContentText());
1394  return data.assistants.map(function(a) {
1395    return [a.assistant_key, a.name, a.type, a.description];
1396  });
1397}
1398
1399// To populate a sheet automatically:
1400function populateAssistants() {
1401  var rows = LIST_ASSISTANTS("${t}", "${e}");
1402  var sheet = SpreadsheetApp.getActiveSheet();
1403  sheet.getRange(1, 1, rows.length, rows[0].length).setValues(rows);
1404}`;return{rest:n,gsheets:s,excel:`' Excel VBA — Developer > Visual Basic > Module
1405' Requires: Tools > References > Microsoft XML v6.0
1406
1407' Tip: store url and apiKey in named cells and pass them as parameters.
1408' Call: PopulateAssistants Range("A1").Value, Range("C1").Value
1409Sub PopulateAssistants(apiKey As String, url As String)
1410    Dim http As Object: Set http = CreateObject("MSXML2.XMLHTTP.6.0")
1411    http.Open "GET", url, False
1412    http.setRequestHeader "X-API-Key", apiKey
1413    http.Send
1414
1415    Dim js As Object: Set js = CreateObject("ScriptControl"): js.Language = "JScript"
1416    Dim parsed As Object: Set parsed = js.Eval("(" & http.responseText & ")")
1417    Dim assistants As Object: Set assistants = parsed.assistants
1418
1419    Dim ws As Worksheet: Set ws = ActiveSheet
1420    Dim i As Integer
1421    For i = 0 To assistants.length - 1
1422        Dim a As Object: Set a = assistants(i)
1423        ws.Cells(i + 1, 1).Value = a.assistant_key
1424        ws.Cells(i + 1, 2).Value = a.name
1425        ws.Cells(i + 1, 3).Value = a.type
1426        ws.Cells(i + 1, 4).Value = a.description
1427    Next i
1428    MsgBox "Done! " & assistants.length & " assistants loaded."
1429End Sub`}}function PIe(e,t,n){const s=`POST ${e}
1430X-API-Key: ${t}
1431Content-Type: application/json
1432
1433{
1434  "api_user_id": "external-user-123",
1435  "assistant_key": "${n}"   // optional — omit to get all chats for this user
1436}
1437
1438// Response:
1439{
1440  "chats": [
1441    {
1442      "chat_id": "chat_abc123",
1443      "title": "First message preview...",
1444      "started_at": "2026-04-20T12:00:00Z",
1445      "assistant_id": "abc123"
1446    }
1447  ]
1448}`,a=`// Google Apps Script — Tools > Script editor
1449
1450// Custom formula:
1451//   =GET_CHATS(apiUserId, apiKey, url, assistantKey)
1452//
1453//   apiUserId    (required) — the external user ID
1454//   apiKey       (required) — your API key,     e.g. $A$1
1455//   url          (required) — endpoint URL,     e.g. $C$1  ("${e}")
1456//   assistantKey (optional) — filter by assistant
1457//
1458// Returns a 2D array [[chat_id, title, started_at], ...]
1459//
1460// Tip: put url in C1, api key in A1, then reference both as $C$1 and $A$1.
1461function GET_CHATS(apiUserId, apiKey, url, assistantKey) {
1462  var payload = { api_user_id: apiUserId };
1463  if (assistantKey) payload.assistant_key = assistantKey;
1464  var resp = UrlFetchApp.fetch(url, {
1465    method: "post", contentType: "application/json",
1466    headers: { "X-API-Key": apiKey },
1467    payload: JSON.stringify(payload), muteHttpExceptions: true,
1468  });
1469  var data = JSON.parse(resp.getContentText());
1470  return data.chats.map(function(c) { return [c.chat_id, c.title, c.started_at]; });
1471}
1472
1473// To populate a sheet:
1474function populateChats() {
1475  var rows = GET_CHATS("user-123", "${t}", "${e}", "${n}");
1476  if (!rows.length) return;
1477  SpreadsheetApp.getActiveSheet().getRange(1, 1, rows.length, rows[0].length).setValues(rows);
1478}`,i=`' Excel VBA — Developer > Visual Basic > Module
1479' Requires: Tools > References > Microsoft XML v6.0
1480
1481' Tip: store url and apiKey in named cells and pass them as parameters.
1482' Call: PopulateChats "user-123", Range("A1").Value, Range("C1").Value, "${n}"
1483Sub PopulateChats(apiUserId As String, apiKey As String, url As String, Optional assistantKey As String = "")
1484    Dim http As Object: Set http = CreateObject("MSXML2.XMLHTTP.6.0")
1485    Dim body As String
1486    body = "{""api_user_id"":""" & apiUserId & """"
1487    If assistantKey <> "" Then body = body & ",""assistant_key"":""" & assistantKey & """"
1488    body = body & "}"
1489    http.Open "POST", url, False
1490    http.setRequestHeader "Content-Type", "application/json"
1491    http.setRequestHeader "X-API-Key", apiKey
1492    http.Send body
1493
1494    Dim js As Object: Set js = CreateObject("ScriptControl"): js.Language = "JScript"
1495    Dim parsed As Object: Set parsed = js.Eval("(" & http.responseText & ")")
1496    Dim chats As Object: Set chats = parsed.chats
1497
1498    Dim ws As Worksheet: Set ws = ActiveSheet
1499    Dim i As Integer
1500    For i = 0 To chats.length - 1
1501        Dim c As Object: Set c = chats(i)
1502        ws.Cells(i + 1, 1).Value = c.chat_id
1503        ws.Cells(i + 1, 2).Value = c.title
1504        ws.Cells(i + 1, 3).Value = c.started_at
1505    Next i
1506    MsgBox "Done! " & chats.length & " chats loaded."
1507End Sub
1508
1509' Example call from another macro:
1510' PopulateChats "user-123", Range("A1").Value, Range("C1").Value, "${n}"`;return{rest:s,gsheets:a,excel:i}}const XB=[{id:"ragAssistant",label:"POST /RagAssistant",method:"POST",description:"Send a message to an assistant"},{id:"getAssistants",label:"GET /getAssistants",method:"GET",description:"List all active assistants"},{id:"getChats",label:"POST /getChats",method:"POST",description:"List conversation history for a user"}],OIe=[{id:"rest",label:"REST / cURL",icon:dr},{id:"gsheets",label:"Google Sheets",icon:wte},{id:"excel",label:"Excel VBA",icon:JZ}];function IIe({apiKeys:e}){const[t,n]=h.useState("ragAssistant"),[s,a]=h.useState("rest"),[i,o]=h.useState(""),[l,c]=h.useState([]),[d,f]=h.useState("");h.useEffect(()=>{Y.entities.Assistant.filter({status:"active"}).then(k=>{const S=k.filter(A=>A.assistant_key);c(S),S.length>0&&f(S[0].assistant_key)})},[]),h.useEffect(()=>{const k=e.find(S=>S.status==="active");k&&o(k.key)},[e]);const m=i||"rk_your_api_key_here",g=d||"your-assistant-key",x=rd.appI
1510d||"YOUR_APP_ID",j=rd.appBaseUrl||"https://api.base44.com",b=`${j}/api/apps/${x}/functions/RagAssistant`,y=`${j}/api/apps/${x}/functions/getAssistants`,w=`${j}/api/apps/${x}/functions/getChats`,N={ragAssistant:AIe(b,m,g),getAssistants:TIe(y,m),getChats:PIe(w,m,g)}[t][s],C=XB.find(k=>k.id===t);return r.jsxs("div",{className:"mt-8 bg-gray-50 border rounded-xl p-5 space-y-4",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Usage"}),r.jsxs("div",{className:"flex flex-wrap gap-3",children:[r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("label",{className:"text-[10px] font-medium text-gray-400 uppercase tracking-wide",children:"API Key"}),r.jsxs("select",{value:i,onChange:k=>o(k.target.value),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 min-w-[180px]",children:[r.jsx("option",{value:"",children:"— use placeholder —"}),e.filter(k=>k.status==="active").map(k=>r.jsx("option",{value:k.key,children:k.name},k.id))]})]}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("label",{className:"text-[10px] font-medium text-gray-400 uppercase tracking-wide",children:"Assistant"}),r.jsxs("select",{value:d,onChange:k=>f(k.target.value),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 min-w-[180px]",children:[r.jsx("option",{value:"",children:"— use placeholder —"}),l.map(k=>r.jsxs("option",{value:k.assistant_key,children:[k.name," (",k.assistant_key,")"]},k.id))]})]})]}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("label",{className:"text-[10px] font-medium text-gray-400 uppercase tracking-wide",children:"Endpoint"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:XB.map(k=>r.jsxs("button",{onClick:()=>n(k.id),className:`flex items-center gap-2 px-3 py-1.5 rounded-lg border text-xs font-medium transition-colors ${t===k.id?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300 hover:text-indigo-700"}`,children:[r.jsx("span",{className:`text-[9px] font-bold px-1 py-0.5 rounded ${k.method==="GET"?"bg-emerald-100 text-emerald-700":"bg-blue-100 text-blue-700"} ${t===k.id?"bg-white/20 text-white":""}`,children:k.method}),k.label.replace(/^(POST|GET) /,"")]},k.id))}),C&&r.jsx("p",{className:"text-[10px] text-gray-400 mt-0.5",children:C.description})]}),r.jsx("div",{className:"flex gap-1 border-b border-gray-200",children:OIe.map(({id:k,label:S,icon:A})=>r.jsxs("button",{onClick:()=>a(k),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium border-b-2 -mb-px transition-colors ${s===k?"border-indigo-500 text-indigo-700":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[r.jsx(A,{className:"w-3.5 h-3.5"})," ",S]},k))}),r.jsxs("div",{className:"relative group",children:[r.jsx("pre",{className:"text-xs font-mono bg-gray-900 text-green-400 rounded-lg p-3 pr-10 overflow-x-auto whitespace-pre max-h-80 overflow-y-auto",children:N}),r.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx(RW,{text:N})})]}),r.jsxs("p",{className:"text-[11px] text-gray-400",children:["API users are created automatically on first call. The ",r.jsx("code",{className:"bg-white border rounded px-1",children:"chat_id"})," returned in each response can be passed back to continue a conversation."]})]})}function RIe(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState(null),[o,l]=h.useState(!0),[c,d]=h.useState(!1),[f,m]=h.useState("keys"),{toast:g}=bb();h.useEffect(()=>{x()},[]);async function x(){l(!0);const w=await Y.auth.me();i(w);const[_,N]=await Promise.all([Y.entities.ApiKey.filter({owner_user_id:w.id}),Y.entities.APIUser.filter({owner_user_id:w.id})]);_.sort((C,k)=>k.created_date>C.created_date?1:-1),N.sort((C,k)=>k.created_date>C.created_date?1:-1),t(_),s(N),l(!1)}async function j(w){confirm(`Delete key "${w.name}"? This cannot be undone.`)&&(await Y.entities.ApiKey.delete(w.id),t(_=>_.filter(N=>N.id!==w.id)),g({title:"API Key deleted"}))}async function b(w){const _=w.status==="active"?"inactive":"active";await Y.entities.ApiKey.update(w.id,{status:_}),t(N=>N.map(C=>C.id===w.id?{...C,status:_}:C))}function y(w){t(_=>[w,..._])}return r.jsxs("div",{className:"p-6 md:p-8 max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold text-gray-900 flex items-center gap-2",children:[r.jsx(e2,{className:"w-6 h-6 text-indigo-500"})," API Key Management"]}),r.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Manage API keys for external integrations via the ",r.jsx("code",{className:"bg-gray-100 px-1 rounded text-xs",children:"RagAssistant"})," endpoint."]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{onClick:x,className:"p-2 rounded-lg hover:bg-gray-100 text-gray-400 hover:text-gray-600 transition-colors",title:"Refresh",children:r.jsx(Rn,{className:"w-4 h-4"})}),r.jsxs(de,{onClick:()=>d(!0),className:"gap-2",children:[r.jsx(ln,{className:"w-4 h-4"})," New Key"]})]})]}),r.jsx("div",{className:"flex gap-1 border-b mb-5",children:[{id:"keys",label:`API Keys (${e.length})`},{id:"users",label:`API Users (${n.length})`}].map(w=>r.jsx("button",{onClick:()=>m(w.id),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${f===w.id?"border-indigo-500 text-indigo-700":"border-transparent text-gray-500 hover:text-gray-700"}`,children:w.label},w.id))}),o?r.jsx("div",{className:"space-y-3",children:[1,2,3].map(w=>r.jsx("div",{className:"h-20 bg-gray-100 animate-pulse rounded-xl"},w))}):f==="keys"?e.length===0?r.jsxs("div",{className:"text-center py-16 border-2 border-dashed border-gray-200 rounded-2xl",children:[r.jsx(e2,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),r.jsx("p",{className:"font-medium text-gray-600",children:"No API keys yet"}),r.jsx("p",{className:"text-sm text-gray-400 mt-1 mb-4",children:"Create a key to allow external systems to call the RagAssistant endpoint."}),r.jsxs(de,{onClick:()=>d(!0),className:"gap-2",children:[r.jsx(ln,{className:"w-4 h-4"})," Create First Key"]})]}):r.jsx("div",{className:"space-y-3",children:e.map(w=>r.jsx(CIe,{apiKey:w,onDelete:j,onToggle:b},w.id))}):n.length===0?r.jsxs("div",{className:"text-center py-16 border-2 border-dashed border-gray-200 rounded-2xl",children:[r.jsx(eg,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),r.jsx("p",{className:"font-medium text-gray-600",children:"No API users yet"}),r.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"API users are created automatically on first call."})]}):r.jsx("div",{className:"space-y-3",children:n.map(w=>r.jsx(EIe,{user:w},w.id))}),r.jsx(IIe,{apiKeys:e}),c&&r.jsx(kIe,{onClose:()=>d(!1),onCreated:y})]})}function Sk(e){const t=e.split(/\n/).map(s=>
1510s.trim()).filter(Boolean),n=[];for(const s of t)!/[.!?]/.test(s)&&s.includes(",")?s.split(",").map(i=>i.trim()).filter(Boolean).forEach(i=>n.push(i)):n.push(s);return[...new Set(n)]}function MIe({item:e,index:t,onChange:n,onRemove:s}){const[a,i]=h.useState(!1);return r.jsxs("div",{className:"border rounded-xl bg-white overflow-hidden",children:[r.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[r.jsx("span",{className:"text-xs font-mono text-gray-400 pt-0.5 shrink-0 w-5",children:t+1}),r.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[r.jsx("div",{className:"font-medium text-sm text-gray-800 truncate",children:e.name||r.jsx("span",{className:"text-gray-400 italic",children:"No name"})}),r.jsxs("div",{className:"text-xs text-gray-500 italic truncate",children:['"',e.query,'"']})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx("button",{onClick:()=>i(o=>!o),className:"p-1.5 rounded-lg text-gray-300 hover:text-indigo-500 hover:bg-indigo-50 transition-colors",title:"Edit",children:a?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(ra,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>s(t),className:"p-1.5 rounded-lg text-gray-300 hover:text-red-500 hover:bg-red-50 transition-colors",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]})]}),a&&r.jsxs("div",{className:"border-t bg-gray-50 px-4 py-3 space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Query"}),r.jsx("textarea",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400 resize-none",rows:2,value:e.query,onChange:o=>n(t,{...e,query:o.target.value})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Name"}),r.jsx("input",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:e.name,onChange:o=>n(t,{...e,name:o.target.value})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Description"}),r.jsx("input",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:e.description,onChange:o=>n(t,{...e,description:o.target.value})})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:["Expected Answer ",r.jsx("span",{className:"text-gray-400 font-normal normal-case",children:"(optional)"})]}),r.jsx("textarea",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400 resize-none",rows:2,value:e.expected_answer,onChange:o=>n(t,{...e,expected_answer:o.target.value})})]})]})]})}function DIe({testSetId:e,onClose:t,onAdded:n}){const[s,a]=h.useState("input"),[i,o]=h.useState(""),[l,c]=h.useState(!1),[d,f]=h.useState([]),[m,g]=h.useState(!1),[x,j]=h.useState(null);async function b(){const N=Sk(i);if(N.length!==0){c(!0);try{const C=await Y.integrations.Core.InvokeLLM({prompt:`You are helping create test cases for an AI assistant QA system.
1511Given the following list of user queries, generate a JSON array of test case objects.
1512For each query, produce:
1513- "query": the original query (unchanged)
1514- "name": a short (3-7 word) descriptive name for the test case
1515- "description": one sentence describing what this test case validates
1516- "expected_answer": a brief description of what a correct answer should contain (or empty string "" if not determinable from the query alone)
1517
1518Queries:
1519${N.map((A,T)=>`${T+1}. ${A}`).join(`
1520`)}
1521
1522Return ONLY the JSON array, no explanation.`,response_json_schema:{type:"object",properties:{cases:{type:"array",items:{type:"object",properties:{query:{type:"string"},name:{type:"string"},description:{type:"string"},expected_answer:{type:"string"}}}}}}}),k=(C==null?void 0:C.cases)||[],S={};for(const A of k)S[A.query]=A;f(N.map(A=>{var T,R,B;return{query:A,name:((T=S[A])==null?void 0:T.name)||A.slice(0,50),description:((R=S[A])==null?void 0:R.description)||"",expected_answer:((B=S[A])==null?void 0:B.expected_answer)||""}})),a("review")}finally{c(!1)}}}function y(N,C){f(k=>k.map((S,A)=>A===N?C:S))}function w(N){f(C=>C.filter((k,S)=>S!==N))}async function _(){if(d.length===0)return;g(!0),j(0);const N=[];for(let C=0;C<d.length;C++){const k=d[C],S=await Y.entities.TestCase.create({test_set_id:e,name:k.name,description:k.description,query:k.query,expected_answer:k.expected_answer,sort_order:9e3+C});N.push(S),j(C+1)}g(!1),n(N),t()}return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:t,children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-2xl flex flex-col max-h-[90vh]",onClick:N=>N.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b shrink-0",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:"Bulk Add Test Cases"}),r.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:s==="input"?"Paste queries — one per line or comma-separated":`Review ${d.length} generated test cases`})]}),r.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 p-1",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:s==="input"?r.jsxs("div",{className:"space-y-3",children:[r.jsx("textarea",{className:"w-full border rounded-xl px-4 py-3 text-sm bg-white outline-none focus:border-indigo-400 resize-none font-mono",rows:12,placeholder:`What is the return policy?
1523How do I reset my password?
1524How can I contact support?
1525
1526or comma-separated: query one, query two, query three`,value:i,onChange:N=>o(N.target.value),autoFocus:!0}),i.trim()&&r.jsxs("p",{className:"text-xs text-gray-400",children:[Sk(i).length," quer",Sk(i).length===1?"y":"ies"," detected"]})]}):r.jsxs("div",{className:"space-y-2",children:[d.map((N,C)=>r.jsx(MIe,{index:C,item:N,onChange:y,onRemove:w},C)),d.length===0&&r.jsx("p",{className:"text-center text-sm text-gray-400 py-8",children:"All items removed."})]})}),r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-t shrink-0 bg-gray-50 rounded-b-2xl",children:[s==="review"&&r.jsx(de,{variant:"outline",size:"sm",onClick:()=>a("input"),children:"← Back"}),s==="input"&&r.jsx("div",{}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(de,{variant:"outline",size:"sm",onClick:t,children:"Cancel"}),s==="input"?r.jsx(de,{size:"sm",className:"gap-1.5",disabled:!i.trim()||l,onClick:b,children:l?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}),"Generating…"]}):r.jsxs(r.Fragment,{children:[r.jsx(Yn,{className:"w-3.5 h-3.5"}),"Generate with AI"]})}):r.jsx(de,{size:"sm",className:"gap-1.5",disabled:d.length===0||m,onClick:_,children:m?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}),"Saving ",x,"/",d.length,"…"]}):r.jsxs(r.Fragment,{children:[r.jsx(Tn,{className:"w-3.5 h-3.5"}),"Add ",d.length," Test Case",d.length!==1?"s":""]})})]})]})]})})}function LIe(e){const t=$Ie(e),n=h.forwardRef((s,a)=>{const{children:i,...o}=s,l=h.Children.toArray(i),c=l.find(FIe);if(c){const d=c.props.children,f=l.map(m=>m===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:m);return r.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,f):null})}return r.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function $Ie(e){const t=h.forwardRef((n,s)=>{const{children:a,...i}=n;if(h.isValidElement(a)){const o=UIe(a),l=zIe(i,a.props);return a.type!==h.Fragment&&(l.ref=s?ei(s,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BIe=Symbol("radix.slottable");function FIe(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===BIe}function zIe(e,t){const n={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function UIe(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Lv="Popover",[MW]=Ti(Lv,[Av]),vg=Av(),[qIe,kc]=MW(Lv),DW=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:a,onOpenChange:i,modal:o=!1}=e,l=vg(t),c=h.useRef(null),[d,f]=h.useState(!1),[m,g]=so({prop:s,defaultProp:a??!1,onChange:i,caller:Lv});return r.jsx(gH,{...l,children:r.jsx(qIe,{scope:t,contentId:Fs(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:h.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:d,onCustomAnchorAdd:h.useCallback(()=>f(!0),[]),onCustomAnchorRemove:h.useCallback(()=>f(!1),[]),modal:o,children:n})})};DW.displayName=Lv;var LW="PopoverAnchor",KIe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=kc(LW,n),i=vg(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=a;return h.useEffect(()=>(o(),()=>l()),[o,l]),r.jsx(XA,{...i,...s,ref:t})});KIe.displayName=LW;var $W="PopoverTrigger",BW=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=kc($W,n),i=vg(n),o=xn(t,a.triggerRef),l=r.jsx(Mt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":KW(a.open),...s,ref:o,onClick:Rt(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:r.jsx(XA,{asChild:!0,...i,children:l})});BW.displayName=$W;var c3="PopoverPortal",[VIe,HIe]=MW(c3,{forceMount:void 0}),FW=e=>{const{__scopePopover:t,forceMount:n,children:s,container:a}=e,i=kc(c3,t);return r.jsx(VIe,{scope:t,forceMount:n,children:r.jsx(Xo,{present:n||i.open,children:r.jsx(Vp,{asChild:!0,container:a,children:s})})})};FW.displayName=c3;var Im="PopoverContent",zW=h.forwardRef((e,t)=>
vendor: 21,647 bytes, lines 1526-1530
1526{const n=HIe(Im,e.__scopePopover),{forceMount:s=n.forceMount,...a}=e,i=kc(Im,e.__scopePopover);return r.jsx(Xo,{present:s||i.open,children:i.modal?r.jsx(GIe,{...a,ref:t}):r.jsx(YIe,{...a,ref:t})})});zW.displayName=Im;var WIe=LIe("PopoverContent.RemoveScroll"),GIe=h.forwardRef((e,t)=>{const n=kc(Im,e.__scopePopover),s=h.useRef(null),a=xn(t,s),i=h.useRef(!1);return h.useEffect(()=>{const o=s.current;if(o)return ZA(o)},[]),r.jsx(Pv,{as:WIe,allowPinchZoom:!0,children:r.jsx(UW,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Rt(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Rt(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Rt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),YIe=h.forwardRef((e,t)=>{const n=kc(Im,e.__scopePopover),s=h.useRef(!1),a=h.useRef(!1);return r.jsx(UW,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),UW=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...m}=e,g=kc(Im,n),x=vg(n);return qA(),r.jsx(Nv,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:i,children:r.jsx(Kp,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>g.onOpenChange(!1),children:r.jsx(xH,{"data-state":KW(g.open),role:"dialog",id:g.contentId,...x,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),qW="PopoverClose",JIe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=kc(qW,n);return r.jsx(Mt.button,{type:"button",...s,ref:t,onClick:Rt(e.onClick,()=>a.onOpenChange(!1))})});JIe.displayName=qW;var QIe="PopoverArrow",XIe=h.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=vg(n);return r.jsx(yH,{...a,...s,ref:t})});XIe.displayName=QIe;function KW(e){return e?"open":"closed"}var ZIe=DW,eRe=BW,tRe=FW,VW=zW;const nRe=ZIe,rRe=eRe,HW=h.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},a)=>r.jsx(tRe,{children:r.jsx(VW,{ref:a,align:t,sideOffset:n,className:rn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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),...s})}));HW.displayName=VW.displayName;var ZB=1,sRe=.9,aRe=.8,iRe=.17,kk=.1,Ck=.999,oRe=.9999,lRe=.99,cRe=/[\\\/_+.#"@\[\(\{&]/,dRe=/[\\\/_+.#"@\[\(\{&]/g,uRe=/[\s-]/,WW=/[\s-]/g;function k5(e,t,n,s,a,i,o){if(i===t.length)return a===e.length?ZB:lRe;var l=`${a},${i}`;if(o[l]!==void 0)return o[l];for(var c=s.charAt(i),d=n.indexOf(c,a),f=0,m,g,x,j;d>=0;)m=k5(e,t,n,s,d+1,i+1,o),m>f&&(d===a?m*=ZB:cRe.test(e.charAt(d-1))?(m*=aRe,x=e.slice(a,d-1).match(dRe),x&&a>0&&(m*=Math.pow(Ck,x.length))):uRe.test(e.charAt(d-1))?(m*=sRe,j=e.slice(a,d-1).match(WW),j&&a>0&&(m*=Math.pow(Ck,j.length))):(m*=iRe,a>0&&(m*=Math.pow(Ck,d-a))),e.charAt(d)!==t.charAt(i)&&(m*=oRe)),(m<kk&&n.charAt(d-1)===s.charAt(i+1)||s.charAt(i+1)===s.charAt(i)&&n.charAt(d-1)!==s.charAt(i))&&(g=k5(e,t,n,s,d+1,i+2,o),g*kk>m&&(m=g*kk)),m>f&&(f=m),d=n.indexOf(c,d+1);return o[l]=f,f}function eF(e){return e.toLowerCase().replace(WW," ")}function mRe(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,k5(e,t,eF(e),eF(t),0,0,{})}function fRe(e){const t=hRe(e),n=h.forwardRef((s,a)=>{const{children:i,...o}=s,l=h.Children.toArray(i),c=l.find(gRe);if(c){const d=c.props.children,f=l.map(m=>m===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:m);return r.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,f):null})}return r.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}function hRe(e){const t=h.forwardRef((n,s)=>{const{children:a,...i}=n;if(h.isValidElement(a)){const o=yRe(a),l=xRe(i,a.props);return a.type!==h.Fragment&&(l.ref=s?ei(s,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pRe=Symbol("radix.slottable");function gRe(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pRe}function xRe(e,t){const n={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function yRe(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $v="Dialog",[GW]=Ti($v),[bRe,Ii]=GW($v),YW=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:a,onOpenChange:i,modal:o=!0}=e,l=h.useRef(null),c=h.useRef(null),[d,f]=so({prop:s,defaultProp:a??!1,onChange:i,caller:$v});return r.jsx(bRe,{scope:t,triggerRef:l,contentRef:c,contentId:Fs(),titleId:Fs(),descriptionId:Fs(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};YW.displayName=$v;var JW="DialogTrigger",vRe=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ii(JW,n),i=xn(t,a.triggerRef);return r.jsx(Mt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":m3(a.open),...s,ref:i,onClick:Rt(e.onClick,a.onOpenToggle)})});vRe.displayName=JW;var d3="DialogPortal",[wRe,QW]=GW(d3,{forceMount:void 0}),XW=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,i=Ii(d3,t);return r.jsx(wRe,{scope:t,forceMount:n,children:h.Children.map(s,o=>r.jsx(Xo,{present:n||i.open,children:r.jsx(Vp,{asChild:!0,container:a,children:o})}))})};XW.displayName=d3;var lb="DialogOverlay",ZW=h.forwardRef((e,t)=>{const n=QW(lb,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,i=Ii(lb,e.__scopeDialog);return i.modal?r.jsx(Xo,{present:s||i.open,children:r.jsx(_Re,{...a,ref:t})}):null});ZW.displayName=lb;var jRe=fRe("DialogOverlay.RemoveScroll"),_Re=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ii(lb,n);return r.jsx(Pv,{as:jRe,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(Mt.div,{"data-state":m3(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Dd="DialogContent",eG=h.forwardRef((e,t)=>{const n=QW(Dd,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,i=Ii(Dd,e.__scopeDialog);return r.jsx(Xo,{present:s||i.open,children:i.modal?r.jsx(NRe,{...a,ref:t}):r.jsx(SRe,{...a,ref:t})})});eG.displayName=Dd;var NRe=h.forwardRef((e,t)=>{const n=Ii(Dd,e.__scopeDialog),s=h.useRef(null),a=xn(t,n.contentRef,s);return h.useEffect(()=>{const i=s.current;if(i)return ZA(i)},[]),r.jsx(tG,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Rt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Rt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:Rt(e.onFocusOutside,i=>i.preventDefault())})}),SRe=h.forwardRef((e,t)=>{const n=Ii(Dd,e.__scopeDialog),s=h.useRef(!1),a=h.useRef(!1);return r.jsx(tG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),tG=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=e,l=Ii(Dd,n),c=h.useRef(null),d=xn(t,c);return qA(),r.jsxs(r.Fragment,{children:[r.jsx(Nv,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:i,children:r.jsx(Kp,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":m3(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(kRe,{titleId:l.titleId}),r.jsx(ERe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),u3="DialogTitle",nG=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ii(u3,n);return r.jsx(Mt.h2,{id:a.titleId,...s,ref:t})});nG.displayName=u3;var rG="DialogDescription",sG=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ii(rG,n);return r.jsx(Mt.p,{id:a.descriptionId,...s,ref:t})});sG.displayName=rG;var aG="DialogClose",iG=h.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Ii(aG,n);return r.jsx(Mt.button,{type:"button",...s,ref:t,onClick:Rt(e.onClick,()=>a.onOpenChange(!1))})});iG.displayName=aG;function m3(e){return e?"open":"closed"}var oG="DialogTitleWarning",[aze,lG]=zQ(oG,{contentName:Dd,titleName:u3,docsSlug:"dialog"}),kRe=({titleId:e})=>{const t=lG(oG),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
1527
1528If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
1529
1530For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},CRe="DialogDescriptionWarning",ERe=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lG(CRe).contentName}}.`;return h.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},ARe=YW,cG=XW,f3=ZW,h3=eG,dG=nG,uG=sG,TRe=iG,lh='[cmdk-group=""]',Ek='[cmdk-group-items=""]',PRe='[cmdk-group-heading=""]',mG='[cmdk-item=""]',tF=`${mG}:not([aria-disabled="true"])`,C5="cmdk-item-select",Ou="data-value",ORe=(e,t,n)=>mRe(e,t,n),fG=h.createContext(void 0),wg=()=>h.useContext(fG),hG=h.createContext(void 0),p3=()=>h.useContext(hG),pG=h.createContext(void 0),gG=h.forwardRef((e,t)=>{let n=Iu(()=>{var q,F;return{search:"",value:(F=(q=e.value)!=null?q:e.defaultValue)!=null?F:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=Iu(()=>new Set),a=Iu(()=>new Map),i=Iu(()=>new Map),o=Iu(()=>new Set),l=xG(e),{label:c,children:d,value:f,onValueChange:m,filter:g,shouldFilter:x,loop:j,disablePointerSelection:b=!1,vimBindings:y=!0,...w}=e,_=Fs(),N=Fs(),C=Fs(),k=h.useRef(null),S=qRe();Ld(()=>{if(f!==void 0){let q=f.trim();n.current.value=q,A.emit()}},[f]),Ld(()=>{S(6,I)},[]);let A=h.useMemo(()=>({subscribe:q=>(o.current.add(q),()=>o.current.delete(q)),snapshot:()=>n.current,setState:(q,F,U)=>{var ee,ne,X,ie;if(!Object.is(n.current[q],F)){if(n.current[q]=F,q==="search")P(),B(),S(1,D);else if(q==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Z=document.getElementById(C);Z?Z.focus():(ee=document.getElementById(_))==null||ee.focus()}if(S(7,()=>{var Z;n.current.selectedItemId=(Z=z())==null?void 0:Z.id,A.emit()}),U||S(5,I),((ne=l.current)==null?void 0:ne.value)!==void 0){let Z=F??"";(ie=(X=l.current).onValueChange)==null||ie.call(X,Z);return}}A.emit()}},emit:()=>{o.current.forEach(q=>q())}}),[]),T=h.useMemo(()=>({value:(q,F,U)=>{var ee;F!==((ee=i.current.get(q))==null?void 0:ee.value)&&(i.current.set(q,{value:F,keywords:U}),n.current.filtered.items.set(q,R(F,U)),S(2,()=>{B(),A.emit()}))},item:(q,F)=>(s.current.add(q),F&&(a.current.has(F)?a.current.get(F).add(q):a.current.set(F,new Set([q]))),S(3,()=>{P(),B(),n.current.value||D(),A.emit()}),()=>{i.current.delete(q),s.current.delete(q),n.current.filtered.items.delete(q);let U=z();S(4,()=>{P(),(U==null?void 0:U.getAttribute("id"))===q&&D(),A.emit()})}),group:q=>(a.current.has(q)||a.current.set(q,new Set),()=>{i.current.delete(q),a.current.delete(q)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:_,inputId:C,labelId:N,listInnerRef:k}),[]);function R(q,F){var U,ee;let ne=(ee=(U=l.current)==null?void 0:U.filter)!=null?ee:ORe;return q?ne(q,n.current.search,F):0}function B(){if(!n.current.search||l.current.shouldFilter===!1)return;let q=n.current.filtered.items,F=[];n.current.filtered.groups.forEach(ee=>{let ne=a.current.get(ee),X=0;ne.forEach(ie=>{let Z=q.get(ie);X=Math.max(Z,X)}),F.push([ee,X])});let U=k.current;L().sort((ee,ne)=>{var X,ie;let Z=ee.getAttribute("id"),ce=ne.getAttribute("id");return((X=q.get(ce))!=null?X:0)-((ie=q.get(Z))!=null?ie:0)}).forEach(ee=>{let ne=ee.closest(Ek);ne?ne.appendChild(ee.parentElement===ne?ee:ee.closest(`${Ek} > *`)):U.appendChild(ee.parentElement===U?ee:ee.closest(`${Ek} > *`))}),F.sort((ee,ne)=>ne[1]-ee[1]).forEach(ee=>{var ne;let X=(ne=k.current)==null?void 0:ne.querySelector(`${lh}[${Ou}="${encodeURIComponent(ee[0])}"]`);X==null||X.parentElement.appendChild(X)})}function D(){let q=L().find(U=>U.getAttribute("aria-disabled")!=="true"),F=q==null?void 0:q.getAttribute(Ou);A.setState("value",F||void 0)}function P(){var q,F,U,ee;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let X of s.current){let ie=(F=(q=i.current.get(X))==null?void 0:q.value)!=null?F:"",Z=(ee=(U=i.current.get(X))==null?void 0:U.keywords)!=null?ee:[],ce=R(ie,Z);n.current.filtered.items.set(X,ce),ce>0&&ne++}for(let[X,ie]of a.current)for(let Z of ie)if(n.current.filtered.items.get(Z)>0){n.current.filtered.groups.add(X);break}n.current.filtered.count=ne}function I(){var q,F,U;let ee=z();ee&&(((q=ee.parentElement)==null?void 0:q.firstChild)===ee&&((U=(F=ee.closest(lh))==null?void 0:F.querySelector(PRe))==null||U.scrollIntoView({block:"nearest"})),ee.scrollIntoView({block:"nearest"}))}function z(){var q;return(q=k.current)==null?void 0:q.querySelector(`${mG}[aria-selected="true"]`)}function L(){var q;return Array.from(((q=k.current)==null?void 0:q.querySelectorAll(tF))||[])}function H(q){let F=L()[q];F&&A.setState("value",F.getAttribute(Ou))}function W(q){var F;let U=z(),ee=L(),ne=ee.findIndex(ie=>ie===U),X=ee[ne+q];(F=l.current)!=null&&F.loop&&(X=ne+q<0?ee[ee.length-1]:ne+q===ee.length?ee[0]:ee[ne+q]),X&&A.setState("value",X.getAttribute(Ou))}function V(q){let F=z(),U=F==null?void 0:F.closest(lh),ee;for(;U&&!ee;)U=q>0?zRe(U,lh):URe(U,lh),ee=U==null?void 0:U.querySelector(tF);ee?A.setState("value",ee.getAttribute(Ou)):W(q)}let K=()=>H(L().length-1),M=q=>{q.preventDefault(),q.metaKey?K():q.altKey?V(1):W(1)},G=q=>{q.preventDefault(),q.metaKey?H(0):q.altKey?V(-1):W(-1)};return h.createElement(Mt.div,{ref:t,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:q=>{var F;(F=w.onKeyDown)==null||F.call(w,q);let U=q.nativeEvent.isComposing||q.keyCode===229;if(!(q.defaultPrevented||U))switch(q.key){case"n":case"j":{y&&q.ctrlKey&&M(q);break}case"ArrowDown":{M(q);break}case"p":case"k":{y&&q.ctrlKey&&G(q);break}case"ArrowUp":{G(q);break}case"Home":{q.preventDefault(),H(0);break}case"End":{q.preventDefault(),K();break}case"Enter":{q.preventDefault();let ee=z();if(ee){let ne=new Event(C5);ee.dispatchEvent(ne)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:VRe},c),Bv(e,q=>h.createElement(hG.Provider,{value:A},h.createElement(fG.Provider,{value:T},q))))}),IRe=h.forwardRef((e,t)=>{var n,s;let a=Fs(),i=h.useRef(null),o=h.useContext(pG),l=wg(),c=xG(e),d=(s=(n=c.current)==null?void 0:n.forceMount)!=null?s:o==null?void 0:o.forceMount;Ld(()=>{if(!d)return l.item(a,o==null?void 0:o.id)},[d]);let f=yG(a,i,[e.value,e.children,i],e.keywords),m=p3(),g=uc(S=>S.value&&S.value===f.current),x=uc(S=>d||l.filter()===!1?!0:S.search?S.filtered.items.get(a)>0:!0);h.useEffect(()=>{let S=i.current;if(!(!S||e.disabled))return S.addEventListener(C5,j),()=>S.removeEventListener(C5,j)},[x,e.onSelect,e.disabled]);function j(){var S,A;b(),(A=(S=c.current).onSelect)==null||A.call(S,f.current)}function b(){m.setState("value",f.current,!0)}if(!x)return null;let{disabled:y,value:w,onSelect:_,forceMount:N,keywords:C,...k}=e;return h.createElement(Mt.div,{ref:ei(i,t),...k,id:a,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!g,"data-disabled":!!y,"data-selected":!!g,onPointerMove:y||l.getDisablePointerSelection()?void 0:b,onClick:y?void 0:j},e.children)}),RRe=h.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:a,...i}=e,o=Fs(),l=h.useRef(null),c=h.useRef(null),d=Fs(),f=wg(),m=uc(x=>a||f.filter()===!1?!0:x.search?x.filtered.groups.has(o):!0);Ld(()=>f.group(o),[]),yG(o,l,[e.value,e.heading,c]);let g=h.useMemo(()=>({id:o,forceMount:a}),[a]);return h.createElement(Mt.div,{ref:ei(l,t),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&h.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),Bv(e,x=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},h.createElement(pG.Provider,{value:g},x))))}),MRe=h.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,a=h.useRef(null),i=uc(o=>!o.search);return!n&&!i?null:h.createElement(Mt.div,{ref:ei(a,t),...s,"cmdk-separator":"",role:"separator"})}),DRe=h.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,a=e.value!=null,i=p3(),o=uc(d=>d.search),l=uc(d=>d.selectedItemId),c=wg();return h.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),h.createElement(Mt.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:a?e.value:o,onChange:d=>{a||i.setState("search",d.target.value),n==null||n(d.target.value)}})}),LRe=h.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...a}=e,i=h.useRef(null),o=h.useRef(null),l=uc(d=>d.selectedItemId),c=wg();return h.useEffect(()=>{if(o.current&&i.current){let d=o.current,f=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=d.offsetHeight;f.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(d),()=>{cancelAnimationFrame(m),g.unobserve(d)}}},[]),h.createElement(Mt.div,{ref:ei(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":s,id:c.listId},Bv(e,d=>h.createElement("div",{ref:ei(o,c.listInnerRef),"cmdk-list-sizer":""},d)))}),$Re=h.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:a,contentClassName:i,container:o,...l}=e;return h.createElement(ARe,{open:n,onOpenChange:s},h.createElement(cG,{container:o},h.createElement(f3,{"cmdk-overlay":"",className:a}),h.createElement(h3,{"aria-label":e.label,"cmdk-dialog":"",className:i},h.createElement(gG,{ref:t,...l}))))}),BRe=h.forwardRef((e,t)=>uc(n=>n.filtered.count===0)?h.createElement(Mt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),FRe=h.forwardRef((e,t)=>{let{progress:n,children:s,label:a="Loading...",...i}=e;return h.createElement(Mt.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Bv(e,o=>h.createElement("div",{"aria-hidden":!0},o)))}),oa=Object.assign(gG,{List:LRe,Item:IRe,Input:DRe,Group:RRe,Separator:MRe,Dialog:$Re,Empty:BRe,Loading:FRe});function zRe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function URe(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function xG(e){let t=h.useRef(e);return Ld(()=>{t.current=e}),t}var Ld=typeof window>"u"?h.useEffect:h.useLayoutEffect;function Iu(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function uc(e){let t=p3(),n=()=>e(t.snapshot());return h.useSyncExternalStore(t.subscribe,n,n)}function yG(e,t,n,s=[]){let a=h.useRef(),i=wg();return Ld(()=>{var o;let l=(()=>{var d;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(d=f.current.textContent)==null?void 0:d.trim():a.current}})(),c=s.map(d=>d.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(Ou,l),a.current=l}),a}var qRe=()=>{let[e,t]=h.useState(),n=Iu(()=>new Map);return Ld(()=>{n.current.forEach(s=>
1530s()),n.current=new Map},[e]),(s,a)=>{n.current.set(s,a),t({})}};function KRe(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Bv({asChild:e,children:t},n){return e&&h.isValidElement(t)?h.cloneElement(KRe(t),{ref:t.ref},n(t.props.children)):n(t)}var VRe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const HRe=cG,bG=h.forwardRef(({className:e,...t},n)=>r.jsx(f3,{ref:n,className:rn("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}));bG.displayName=f3.displayName;const WRe=h.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(HRe,{children:[r.jsx(bG,{}),r.jsxs(h3,{ref:s,className:rn("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,r.jsxs(TRe,{className:"absolute right-4 top-4 roun
1530ded-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:[r.jsx(jt,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));WRe.displayName=h3.displayName;const GRe=h.forwardRef(({className:e,...t},n)=>r.jsx(dG,{ref:n,className:rn("text-lg font-semibold leading-none tracking-tight",e),...t}));GRe.displayName=dG.displayName;const YRe=h.forwardRef(({className:e,...t},n)=>r.jsx(uG,{ref:n,className:rn("text-sm text-muted-foreground",e),...t}));YRe.displayName=uG.displayName;const vG=h.forwardRef(({className:e,...t},n)=>r.jsx(oa,{ref:n,className:rn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));vG.displayName=oa.displayName;const wG=h.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(ur,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(oa.Input,{ref:n,className:rn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));wG.displayName=oa.Input.displayName;const jG=h.forwardRef(({className:e,...t},n)=>r.jsx(oa.List,{ref:n,className:rn("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));jG.displayName=oa.List.displayName;const _G=h.forwardRef((e,t)=>r.jsx(oa.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));_G.displayName=oa.Empty.displayName;const JRe=h.forwardRef(({className:e,...t},n)=>r.jsx(oa.Group,{ref:n,className:rn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));JRe.displayName=oa.Group.displayName;const QRe=h.forwardRef(({className:e,...t},n)=>r.jsx(oa.Separator,{ref:n,className:rn("-mx-1 h-px bg-border",e),...t}));QRe.displayName=oa.Separator.displayName;const NG=h.forwardRef(({className:e,...t},n)=>r.jsx(oa.Item,{ref:n,className:rn("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));NG.displayName=oa.Item.displayName;const XRe=50;function ZRe({knowledgeBaseIds:e=[],value:t,onChange:n,disabled:s=!1,placeholder:a="Select a KB item"}){const[i,o]=h.useState(!1),[l,c]=h.useState(""),[d,f]=h.useState("all"),[m,g]=h.useState([]),[x,j]=h.useState(!1),[b,y]=h.useState(!1),[w,_]=h.useState(null),[N,C]=h.useState([]),[k,S]=h.useState(""),A=h.useRef(null),T=h.useRef(0),R=JSON.stringify(e);h.useEffect(()=>{if(!(e!=null&&e.length)){C([]);return}let I=!0;return(async()=>{const z=await Y.entities.KnowledgeBase.filter({id:{$in:e}},"name",200);I&&C(z)})(),()=>{I=!1}},[R]),h.useEffect(()=>{if(!t){S("");return}let I=!0;return(async()=>{const z=m.find(H=>H.id===t);if(z){I&&S(z.title);return}const L=await Y.entities.KnowledgeItem.filter({id:t},"title",1);I&&L[0]&&S(L[0].title)})(),()=>{I=!1}},[t]);const B=h.useCallback(async({reset:I,search:z,kb:L,cur:H})=>{if(!(e!=null&&e.length)){g([]),y(!1);return}j(!0);const W=++T.current,V={};V.knowledge_base_id=L&&L!=="all"?L:{$in:e},z&&z.trim()&&(V.title={$regex:z.trim(),$options:"i"});const K={sort:"title",limit:XRe};H&&(K.cursor=H);const M=await Y.entities.KnowledgeItem.filter(V,K);if(W!==T.current)return;const G=M.items||[];g(q=>I?G:[...q,...G]),y(!!M.has_more),_(M.next_cursor||null),j(!1)},[R]);h.useEffect(()=>{i&&(c(""),f("all"))},[i]),h.useEffect(()=>{if(i)return A.current&&clearTimeout(A.current),A.current=setTimeout(()=>B({reset:!0,search:l,kb:d}),200),()=>{A.current&&clearTimeout(A.current)}},[i,l,d]);function D(){!b||x||B({reset:!1,search:l,kb:d,cur:w})}const P=!e||e.length===0;return r.jsxs(nRe,{open:i,onOpenChange:o,children:[r.jsx(rRe,{asChild:!0,children:r.jsxs(de,{type:"button",variant:"outline",role:"combobox",disabled:s||P,className:"w-full justify-between font-normal h-9",children:[r.jsx("span",{className:"truncate text-left",children:k||(P?"No knowledge bases":a)}),r.jsx(bZ,{className:"w-4 h-4 opacity-50 shrink-0"})]})}),r.jsxs(HW,{className:"p-0 min-w-[340px]",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:[r.jsxs("div",{className:"flex items-center gap-2 px-2 py-2 border-b bg-gray-50",children:[r.jsx(_n,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsxs("select",{value:d,onChange:I=>f(I.target.value),className:"text-xs border rounded px-2 py-1 bg-white outline-none focus:border-indigo-400 max-w-[70%]",children:[r.jsxs("option",{value:"all",children:["All knowledge bases (",N.length,")"]}),N.map(I=>r.jsx("option",{value:I.id,children:I.name},I.id))]})]}),r.jsxs(vG,{shouldFilter:!1,children:[r.jsx(wG,{placeholder:"Search by title…",value:l,onValueChange:c}),r.jsxs(jG,{className:"max-h-[300px]",children:[x&&m.length===0&&r.jsx("div",{className:"py-6 text-center text-sm text-gray-400",children:"Loading…"}),!x&&m.length===0&&r.jsx(_G,{children:"No items found."}),m.map(I=>r.jsxs(NG,{value:I.id,onSelect:()=>{n(I.id,I),S(I.title),o(!1)},className:"gap-2",children:[r.jsx(Tn,{className:`w-4 h-4 ${t===I.id?"opacity-100":"opacity-0"}`}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"truncate text-sm",children:I.title}),I.url&&r.jsx("div",{className:"truncate text-xs text-gray-400",children:I.url})]})]},I.id)),b&&r.jsx("div",{className:"p-2 border-t sticky bottom-0 bg-white",children:r.jsx(de,{type:"button",variant:"ghost",size:"sm",className:"w-full",onClick:D,disabled:x,children:x?"Loading…":"Load more"})})]})]})]})]})}const eMe=[{value:"kb_item",label:"KB item",icon:_n},{value:"page_url",label:"Page URL",icon:Na},{value:"pasted_content",label:"Pasted content",icon:ns}];
1530function SG({value:e,onChange:t,knowledgeBaseIds:n=[],disabled:s=!1}){const a=e||{},i=a.assistant_mode||"LIBRARY",o=a.source_page_method||"kb_item";function l(c){t({...a,...c})}return r.jsxs("div",{className:`space-y-3 ${s?"opacity-60 pointer-events-none":""}`,children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("button",{type:"button",onClick:()=>l({assistant_mode:"LIBRARY"}),className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm transition-colors
1531            ${i==="LIBRARY"?"bg-indigo-50 border-indigo-300 text-indigo-700 font-medium":"bg-white border-gray-200 text-gray-500 hover:border-gray-300"}`,children:[r.jsx(ao,{className:"w-4 h-4"})," Whole library"]}),r.jsxs("button",{type:"button",onClick:()=>l({assistant_mode:"PAGE_ONLY"}),className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm transition-colors
1532            ${i==="PAGE_ONLY"?"bg-indigo-50 border-indigo-300 text-indigo-700 font-medium":"bg-white border-gray-200 text-gray-500 hover:border-gray-300"}`,children:[r.jsx(ns,{className:"w-4 h-4"})," Source page"]})]}),i==="PAGE_ONLY"&&r.jsxs("div",{className:"space-y-3 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[r.jsx("div",{className:"flex gap-1.5 flex-wrap",children:eMe.map(c=>{const d=c.icon,f=o===c.value;return r.jsxs("button",{type:"button",onClick:()=>l({source_page_method:c.value}),className:`inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded-full border transition-colors
1533                    ${f?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-500 border-gray-200 hover:border-indigo-300"}`,children:[r.jsx(d,{className:"w-3.5 h-3.5"})," ",c.label]},c.value)})}),o==="kb_item"&&r.jsx(ZRe,{knowledgeBaseIds:n,value:a.source_kb_item_id||null,onChange:c=>l({source_kb_item_id:c||null}),disabled:s}),o==="page_url"&&r.jsx("input",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:a.source_page_url||"",onChange:c=>l({source_page_url:c.target.value||null}),placeholder:"https://example.com/page"}),o==="pasted_content"&&r.jsx("textarea",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400 min-h-[120px] resize-y",value:a.source_page_content||"",onChange:c=>l({source_page_content:c.target.value||null}),placeholder:"Paste the source page text here…"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(V5,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsx("input",{className:"flex-1 border rounded-lg px-3 py-1.5 text-sm bg-white outline-none focus:border-indigo-400",value:a.user_selected_language||"",onChange:c=>l({user_selected_language:c.target.value||null}),placeholder:"Visitor language (optional, e.g. pt-BR)"})]})]})}const tMe={pass:"Pass",fail:"Fail",partial:"Partial",error:"Error"};function gi(e){return e==null?"":String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function nF(e){return e==="pass"?"#059669":e==="fail"?"#dc2626":e==="partial"?"#d97706":"#6b7280"}function nMe({testSet:e,testCases:t,latestResults:n,assistants:s}){const[a,i]=h.useState(!1);function o(c){var d;return c?((d=s.find(f=>f.id===c))==null?void 0:d.name)||c:"—"}function l(){const c=t.map(w=>{const _=n[w.id]||null,N=(_==null?void 0:_.human_override_verdict)||(_==null?void 0:_.verdict)||null;return{tc:w,result:_,verdict:N}}),d=c.filter(w=>w.verdict==="pass").length,f=c.filter(w=>w.verdict==="fail").length,m=c.filter(w=>w.verdict==="partial").length,g=c.filter(w=>w.verdict==="error").length,x=c.filter(w=>!w.verdict).length,j=c.map(({tc:w,result:_,verdict:N},C)=>{const k=(_==null?void 0:_.score)!=null?`${_.score}/100`:"—",S=_!=null&&_.ran_at?new Date(_.ran_at).toLocaleString():"Never run",A=N?tMe[N]||N:"Not run",T=nF(N),R=((_==null?void 0:_.node_results)||[]).map(B=>{const D=nF(B.verdict==="n/a"?null:B.verdict),P=B.value!=null&&B.value!==""?gi(B.value):"<span style='color:#d1d5db;'>— no value —</span>";return`<div style="margin-bottom:6px;padding:4px 8px;border-radius:6px;background:${B.verdict==="pass"?"#ecfdf5":B.verdict==="fail"?"#fef2f2":B.verdict==="partial"?"#fffbeb":"#f9fafb"};border:1px solid #e5e7eb;">
1534            <div style="font-size:10px;font-weight:600;color:${D};">${gi(B.node)}: ${gi(B.verdict)}${B.score!=null?` (${B.score})`:""}</div>
1535            <div style="font-size:11px;color:#374151;margin-top:2px;word-break:break-word;">${P}</div>
1536          </div>`}).join("");return`
1537        <tr>
1538          <td style="text-align:center;color:#9ca3af;font-size:12px;">${C+1}</td>
1539          <td>
1540            <div style="font-weight:600;color:#111827;">${gi(w.name)}</div>
1541            ${w.description?`<div style="font-size:11px;color:#9ca3af;margin-top:2px;">${gi(w.description)}</div>`:""}
1542          </td>
1543          <td style="font-size:11px;color:#6b7280;max-width:300px;">${gi(w.query)}</td>
1544          <td style="font-size:11px;color:#6b7280;max-width:250px;">${gi(w.expected_answer)}</td>
1545          <td style="text-align:center;">
1546            <span style="font-weight:600;color:${T};">${A}</span>
1547            ${_!=null&&_.human_override_verdict?'<div style="font-size:9px;color:#9ca3af;">overridden</div>':""}
1548          </td>
1549          <td style="text-align:center;font-family:monospace;font-size:12px;color:#374151;">${k}</td>
1550          <td style="font-size:11px;color:#6b7280;white-space:nowrap;">${S}</td>
1551          <td style="font-size:11px;color:#6b7280;">${gi(o(w.target_assistant_id||(e==null?void 0:e.target_assistant_id)))}</td>
1552          <td>${R||"—"}</td>
1553        </tr>
1554      `}).join(""),b=`<!DOCTYPE html><html><head><meta charset="utf-8"><title>${gi((e==null?void 0:e.name)||"Test Set")} — Report</title>
1555    <style>
1556      * { box-sizing: border-box; }
1557      body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; margin: 40px; color: #1f2937; }
1558      h1 { font-size: 22px; margin: 0 0 4px; }
1559      .meta { color: #6b7280; font-size: 13px; margin-bottom: 24px; }
1560      .summary { display: flex; gap: 16px; margin-bottom: 24px; }
1561      .stat { padding: 10px 16px; border-radius: 10px; border: 1px solid #e5e7eb; font-size: 13px; }
1562      .stat .num { font-size: 20px; font-weight: 700; }
1563      table { width: 100%; border-collapse: collapse; font-size: 13px; }
1564      th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #e5e7eb; font-size: 11px; text-transform: uppercase; color: #6b7280; font-weight: 600; }
1565      td { padding: 10px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
1566      tr:nth-child(even) { background: #fafafa; }
1567      @media print { body { margin: 20px; } .no-print { display: none; } }
1568    </style></head>
1569    <body>
1570      <h1>${gi((e==null?void 0:e.name)||"Test Set")}</h1>
1571      <div class="meta">
1572        ${e!=null&&e.description?gi(e.description)+" · ":""}
1573        Generated ${new Date().toLocaleString()} · ${t.length} test cases
1574      </div>
1575      <div class="summary">
1576        <div class="stat" style="border-color:#a7f3d0;"><div class="num" style="color:#059669;">${d}</div>Pass</div>
1577        <div class="stat" style="border-color:#fde68a;"><div class="num" style="color:#d97706;">${m}</div>Partial</div>
1578        <div class="stat" style="border-color:#fecaca;"><div class="num" style="color:#dc2626;">${f}</div>Fail</div>
1579        ${g>0?`<div class="stat" style="border-color:#e5e7eb;"><div class="num" style="color:#6b7280;">${g}</div>Error</div>`:""}
1580        <div class="stat" style="border-color:#e5e7eb;"><div class="num" style="color:#9ca3af;">${x}</div>Not run</div>
1581      </div>
1582      <table>
1583        <thead>
1584          <tr>
1585            <th style="width:30px;">#</th>
1586            <th>Test Case</th>
1587            <th>Query</th>
1588            <th>Expected</th>
1589            <th style="text-align:center;">Verdict</th>
1590            <th style="text-align:center;">Score</th>
1591            <th>Last Run</th>
1592            <th>Target</th>
1593            <th>Nodes</th>
1594          </tr>
1595        </thead>
1596        <tbody>${j}</tbody>
1597      </table>
1598      <script>window.onload = () => setTimeout(() => window.print(), 300);<\/script>
1599    </body></html>`,y=window.open("","_blank");if(!y){alert("Please allow popups to generate the report.");return}y.document.write(b),y.document.close()}return r.jsxs(de,{variant:"outline",className:"gap-1.5",onClick:l,disabled:t.length===0,children:[r.jsx(ns,{className:"w-4 h-4"})," Report"]})}function Fv(e){if(!e)return"Default (whole library)";if((e.assistant_mode||"LIBRARY")==="LIBRARY")return"Whole library";const n=e.source_page_method||"kb_item";return n==="kb_item"?`Source page · ${e.source_kb_item_name||"KB item"}`:n==="page_url"?`Source page · ${e.source_page_url||"URL"}`:n==="pasted_content"?"Source page · pasted content":"Source page"}function Ls(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var rMe=typeof Symbol=="function"&&Symbol.observable||"@@observable",rF=rMe,sF=()=>Math.random().toString(36).substring(7).split("").join("."),sMe={INIT:`@@redux/INIT${sF()}`,REPLACE:`@@redux/REPLACE${sF()}`},aF=sMe;function aMe(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function kG(e,t,n){if(typeof e!="function")throw new Error(Ls(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Ls(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ls(1));return n(kG)(e,t)}let s=e,a=t,i=new Map,o=i,l=0,c=!1;
1599function d(){o===i&&(o=new Map,i.forEach((y,w)=>{o.set(w,y)}))}function f(){if(c)throw new Error(Ls(3));return a}function m(y){if(typeof y!="function")throw new Error(Ls(4));if(c)throw new Error(Ls(5));let w=!0;d();const _=l++;return o.set(_,y),function(){if(w){if(c)throw new Error(Ls(6));w=!1,d(),o.delete(_),i=null}}}function g(y){if(!aMe(y))throw new Error(Ls(7));if(typeof y.type>"u")throw new Error(Ls(8));if(typeof y.type!="string")throw new Error(Ls(17));if(c)throw new Error(Ls(9));try{c=!0,a=s(a,y)}finally{c=!1}return(i=o).forEach(_=>{_()}),y}function x(y){if(typeof y!="function")throw new Error(Ls(10));s=y,g({type:aF.REPLACE})}function j(){const y=m;return{subscribe(w){if(typeof w!="object"||w===null)throw new Error(Ls(11));function _(){const C=w;C.next&&C.next(f())}return _(),{unsubscribe:y(_)}},[rF](){return this}}}return g({type:aF.INIT}),{dispatch:g,subscribe:m,getState:f,replaceReducer:x,[rF]:j}}function iF(e,t){return function(...n){return t(e.apply(this,n))}}function oF(e,t){if(typeof e=="function")return iF(e,t);if(typeof e!="object"||e===null)throw new Error(Ls(16));const n={};for(const s in e){const a=e[s];typeof a=="function"&&(n[s]=iF(a,t))}return n}function CG(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...s)=>t(n(...s)))}function iMe(...e){return t=>(n,s)=>{const a=t(n,s);let i=()=>{throw new Error(Ls(15))};const o={getState:a.getState,dispatch:(c,...d)=>i(c,...d)},l=e.map(c=>c(o));return i=CG(...l)(a.dispatch),{...a,dispatch:i}}}var Ak={exports:{}},Tk={};/**
1600 * @license React
1601 * use-sync-external-store-with-selector.production.js
1602 *
1603 * Copyright (c) Meta Platforms, Inc. and affiliates.
1604 *
1605 * This source code is licensed under the MIT license found in the
1606 * LICENSE file in the root directory of this source tree.
1607 */var lF;function oMe(){if(lF)return Tk;lF=1;var e=xb();function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var n=typeof Object.is=="function"?Object.is:t,s=e.useSyncExternalStore,a=e.useRef,i=e.useEffect,o=e.useMemo,l=e.useDebugValue;return Tk.useSyncExternalStoreWithSelector=function(c,d,f,m,g){var x=a(null);if(x.current===null){var j={hasValue:!1,value:null};x.current=j}else j=x.current;x=o(function(){function y(k){if(!w){if(w=!0,_=k,k=m(k),g!==void 0&&j.hasValue){var S=j.value;if(g(S,k))return N=S}return N=k}if(S=N,n(_,k))return S;var A=m(k);return g!==void 0&&g(S,A)?(_=k,S):(_=k,N=A)}var w=!1,_,N,C=f===void 0?null:f;return[function(){return y(d())},C===null?void 0:function(){return y(C())}]},[d,f,m,g]);var b=s(c,x[0],x[1]);return i(function(){j.hasValue=!0,j.value=b},[b]),l(b),b},Tk}var cF;function lMe(){return cF||(cF=1,Ak.exports=oMe()),Ak.exports}lMe();var cMe=h.version.startsWith("19"),dMe=Symbol.for(cMe?"react.transitional.element":"react.element"),uMe=Symbol.for("react.portal"),mMe=Symbol.for("react.fragment"),fMe=Symbol.for("react.strict_mode"),hMe=Symbol.for("react.profiler"),pMe=Symbol.for("react.consumer"),gMe=Symbol.for("react.context"),EG=Symbol.for("react.forward_ref"),xMe=Symbol.for("react.suspense"),yMe=Symbol.for("react.suspense_list"),g3=Symbol.for("react.memo"),bMe=Symbol.for("react.lazy"),vMe=EG,wMe=g3;function jMe(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case dMe:switch(e=e.type,e){case mMe:case hMe:case fMe:case xMe:case yMe:return e;default:switch(e=e&&e.$$typeof,e){case gMe:case EG:case bMe:case g3:return e;case pMe:return e;default:return t}}case uMe:return t}}}function _Me(e){return jMe(e)===g3}function NMe(e,t,n,s,{areStatesEqual:a,areOwnPropsEqual:i,areStatePropsEqual:o}){let l=!1,c,d,f,m,g;function x(_,N){return c=_,d=N,f=e(c,d),m=t(s,d),g=n(f,m,d),l=!0,g}function j(){return f=e(c,d),t.dependsOnOwnProps&&(m=t(s,d)),g=n(f,m,d),g}function b(){return e.dependsOnOwnProps&&(f=e(c,d)),t.dependsOnOwnProps&&(m=t(s,d)),g=n(f,m,d),g}function y(){const _=e(c,d),N=!o(_,f);return f=_,N&&(g=n(f,m,d)),g}function w(_,N){const C=!i(N,d),k=!a(_,c,N,d);return c=_,d=N,C&&k?j():C?b():k?y():g}return function(N,C){return l?w(N,C):x(N,C)}}function SMe(e,{initMapStateToProps:t,initMapDispatchToProps:n,initMergeProps:s,...a}){const i=t(e,a),o=n(e,a),l=s(e,a);return NMe(i,o,l,e,a)}function kMe(e,t){const n={};for(const s in e){const a=e[s];typeof a=="function"&&(n[s]=(...i)=>t(a(...i)))}return n}function E5(e){return function(n){const s=e(n);function a(){return s}return a.dependsOnOwnProps=!1,a}}function dF(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function AG(e,t){return function(s,{displayName:a}){const i=function(l,c){return i.dependsOnOwnProps?i.mapToProps(l,c):i.mapToProps(l,void 0)};return i.dependsOnOwnProps=!0,i.mapToProps=function(l,c){i.mapToProps=e,i.dependsOnOwnProps=dF(e);let d=i(l,c);return typeof d=="function"&&(i.mapToProps=d,i.dependsOnOwnProps=dF(d),d=i(l,c)),d},i}}function x3(e,t){return(n,s)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${s.wrappedComponentName}.`)}}function CMe(e){return e&&typeof e=="object"?E5(t=>kMe(e,t)):e?typeof e=="function"?AG(e):x3(e,"mapDispatchToProps"):E5(t=>({dispatch:t}))}function EMe(e){return e?typeof e=="function"?AG(e):x3(e,"mapStateToProps"):E5(()=>({}))}function AMe(e,t,n){return{...n,...e,...t}}function TMe(e){return function(n,{displayName:s,areMergedPropsEqual:a}){let i=!1,o;return function(c,d,f){const m=e(c,d,f);return i?a(m,o)||(o=m):(i=!0,o=m),o}}}function PMe(e){return e?typeof e=="function"?TMe(e):x3(e,"mergeProps"):()=>AMe}function OMe(e){e()}function IMe(){let e=null,t=null;return{clear(){e=null,t=null},notify(){OMe(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let s=e;for(;s;)n.push(s),s=s.next;return n},subscribe(n){let s=!0;const a=t={callback:n,next:null,prev:t};return a.prev?a.prev.next=a:e=a,function(){!s||e===null||(s=!1,a.next?a.next.prev=a.prev:t=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}var uF={notify(){},get:()=>[]};function TG(e,t){let n,s=uF,a=0,i=!1;function o(b){f();const y=s.subscribe(b);let w=!1;return()=>{w||(w=!0,y(),m())}}function l(){s.notify()}function c(){j.onStateChange&&j.onStateChange()}function d(){return i}function f(){a++,n||(n=t?t.addNestedSub(c):e.subscribe(c),s=IMe())}function m(){a--,n&&a===0&&(n(),n=void 0,s.clear(),s=uF)}function g(){i||(i=!0,f())}function x(){i&&(i=!1,m())}const j={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:g,tryUnsubscribe:x,getListeners:()=>s};return j}var RMe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",MMe=RMe(),DMe=()=>typeof navigator<"u"&&navigator.product==="ReactNative",LMe=DMe(),$Me=()=>MMe||LMe?h.useLayoutEffect:h.useEffect,cb=$Me();function mF(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Pk(e,t){if(mF(e,t))return!0;
1607if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(let a=0;a<n.length;a++)if(!Object.prototype.hasOwnProperty.call(t,n[a])||!mF(e[n[a]],t[n[a]]))return!1;return!0}var BMe={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},FMe={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},zMe={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},PG={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},UMe={[vMe]:zMe,[wMe]:PG};function fF(e){return _Me(e)?PG:UMe[e.$$typeof]||BMe}var qMe=Object.defineProperty,KMe=Object.getOwnPropertyNames,hF=Object.getOwnPropertySymbols,VMe=Object.getOwnPropertyDescriptor,HMe=Object.getPrototypeOf,pF=Object.prototype;function A5(e,t){if(typeof t!="string"){if(pF){const i=HMe(t);i&&i!==pF&&A5(e,i)}let n=KMe(t);hF&&(n=n.concat(hF(t)));const s=fF(e),a=fF(t);for(let i=0;i<n.length;++i){const o=n[i];if(!FMe[o]&&!(a&&a[o])&&!(s&&s[o])){const l=VMe(t,o);try{qMe(e,o,l)}catch{}}}}return e}var Ok=Symbol.for("react-redux-context"),Ik=typeof globalThis<"u"?globalThis:{};function WMe(){if(!h.createContext)return{};const e=Ik[Ok]??(Ik[Ok]=new Map);let t=e.get(h.createContext);return t||(t=h.createContext(null),e.set(h.createContext,t)),t}var OG=WMe(),GMe=[null,null];function YMe(e,t,n){cb(()=>e(...t),n)}function JMe(e,t,n,s,a,i){e.current=s,n.current=!1,a.current&&(a.current=null,i())}function QMe(e,t,n,s,a,i,o,l,c,d,f){if(!e)return()=>{};let m=!1,g=null;const x=()=>{if(m||!l.current)return;const b=t.getState();let y,w;try{y=s(b,a.current)}catch(_){w=_,g=_}w||(g=null),y===i.current?o.current||d():(i.current=y,c.current=y,o.current=!0,f())};return n.onStateChange=x,n.trySubscribe(),x(),()=>{if(m=!0,n.tryUnsubscribe(),n.onStateChange=null,g)throw g}}function XMe(e,t){return e===t}function ZMe(e,t,n,{pure:s,areStatesEqual:a=XMe,areOwnPropsEqual:i=Pk,areStatePropsEqual:o=Pk,areMergedPropsEqual:l=Pk,forwardRef:c=!1,context:d=OG}={}){const f=d,m=EMe(e),g=CMe(t),x=PMe(n),j=!!e;return y=>{const w=y.displayName||y.name||"Component",_=`Connect(${w})`,N={shouldHandleStateChanges:j,displayName:_,wrappedComponentName:w,WrappedComponent:y,initMapStateToProps:m,initMapDispatchToProps:g,initMergeProps:x,areStatesEqual:a,areStatePropsEqual:o,areOwnPropsEqual:i,areMergedPropsEqual:l};function C(A){const[T,R,B]=h.useMemo(()=>{const{reactReduxForwardedRef:re,...Ue}=A;return[A.context,re,Ue]},[A]),D=h.useMemo(()=>{let re=f;return T!=null&&T.Consumer,re},[T,f]),P=h.useContext(D),I=!!A.store&&!!A.store.getState&&!!A.store.dispatch,z=!!P&&!!P.store,L=I?A.store:P.store,H=z?P.getServerState:L.getState,W=h.useMemo(()=>SMe(L.dispatch,N),[L]),[V,K]=h.useMemo(()=>{if(!j)return GMe;const re=TG(L,I?void 0:P.subscription),Ue=re.notifyNestedSubs.bind(re);return[re,Ue]},[L,I,P]),M=h.useMemo(()=>I?P:{...P,subscription:V},[I,P,V]),G=h.useRef(void 0),q=h.useRef(B),F=h.useRef(void 0),U=h.useRef(!1),ee=h.useRef(!1),ne=h.useRef(void 0);cb(()=>(ee.current=!0,()=>{ee.current=!1}),[]);const X=h.useMemo(()=>()=>F.current&&B===q.current?F.current:W(L.getState(),B),[L,B]),ie=h.useMemo(()=>Ue=>V?QMe(j,L,V,W,q,G,U,ee,F,K,Ue):()=>{},[V]);YMe(JMe,[q,G,U,B,F,K]);let Z;try{Z=h.useSyncExternalStore(ie,X,H?()=>W(H(),B):X)}catch(re){throw ne.current&&(re.message+=`
1608The error may be correlated with this previous error:
1609${ne.current.stack}
1610
1611`),re}cb(()=>{ne.current=void 0,F.current=void 0,G.current=Z});const ce=h.useMemo(()=>h.createElement(y,{...Z,ref:R}),[R,y,Z]);return h.useMemo(()=>j?h.createElement(D.Provider,{value:M},ce):ce,[D,ce,M])}const S=h.memo(C);if(S.WrappedComponent=y,S.displayName=C.displayName=_,c){const T=h.forwardRef(function(B,D){return h.createElement(S,{...B,reactReduxForwardedRef:D})});return T.displayName=_,T.WrappedComponent=y,A5(T,y)}return A5(S,y)}}var IG=ZMe;function eDe(e){const{children:t,context:n,serverState:s,store:a}=e,i=h.useMemo(()=>{const c=TG(a);return{store:a,subscription:c,getServerState:s?()=>s:void 0}},[a,s]),o=h.useMemo(()=>a.getState(),[a]);cb(()=>{const{subscription:c}=i;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==a.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[i,o]);const l=n||OG;return h.createElement(l.Provider,{value:i},t)}var tDe=eDe;function nDe(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function RG(e,t){var n=h.useState(function(){return{inputs:t,result:e()}})[0],s=h.useRef(!0),a=h.useRef(n),i=s.current||!!(t&&a.current.inputs&&nDe(t,a.current.inputs)),o=i?a.current:{inputs:t,result:e()};return h.useEffect(function(){s.current=!1,a.current=o},[o]),o.result}function rDe(e,t){return RG(function(){return e},t)}var kn=RG,Dt=rDe,ki=function(t){var n=t.top,s=t.right,a=t.bottom,i=t.left,o=s-i,l=a-n,c={top:n,right:s,bottom:a,left
1611:i,width:o,height:l,x:i,y:n,center:{x:(s+i)/2,y:(a+n)/2}};return c},y3=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},gF=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},sDe=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},Rk={top:0,right:0,bottom:0,left:0},b3=function(t){var n=t.borderBox,s=t.margin,a=s===void 0?Rk:s,i=t.border,o=i===void 0?Rk:i,l=t.padding,c=l===void 0?Rk:l,d=ki(y3(n,a)),f=ki(gF(n,o)),m=ki(gF(f,c));return{marginBox:d,borderBox:ki(n),paddingBox:f,contentBox:m,margin:a,border:o,padding:c}},za=function(t){var n=t.slice(0,-2),s=t.slice(-2);if(s!=="px")return 0;var a=Number(n);return isNaN(a)&&ic(),a},aDe=function(){return{x:window.pageXOffset,y:window.pageYOffset}},db=function(t,n){var s=t.borderBox,a=t.border,i=t.margin,o=t.padding,l=sDe(s,n);return b3({borderBox:l,border:a,margin:i,padding:o})},ub=function(t,n){return n===void 0&&(n=aDe()),db(t,n)},MG=function(t,n){var s={top:za(n.marginTop),right:za(n.marginRight),bottom:za(n.marginBottom),left:za(n.marginLeft)},a={top:za(n.paddingTop),right:za(n.paddingRight),bottom:za(n.paddingBottom),left:za(n.paddingLeft)},i={top:za(n.borderTopWidth),right:za(n.borderRightWidth),bottom:za(n.borderBottomWidth),left:za(n.borderLeftWidth)};return b3({borderBox:t,margin:s,padding:a,border:i})},DG=function(t){var n=t.getBoundingClientRect(),s=window.getComputedStyle(t);return MG(n,s)},xF=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function iDe(e,t){return!!(e===t||xF(e)&&xF(t))}function oDe(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!iDe(e[n],t[n]))return!1;return!0}function ts(e,t){t===void 0&&(t=oDe);var n=null;function s(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];if(n&&n.lastThis===this&&t(a,n.lastArgs))return n.lastResult;var o=e.apply(this,a);return n={lastResult:o,lastArgs:a,lastThis:this},o}return s.clear=function(){n=null},s}var Pp=function(t){var n=[],s=null,a=function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];n=l,!s&&(s=requestAnimationFrame(function(){s=null,t.apply(void 0,n)}))};return a.cancel=function(){s&&(cancelAnimationFrame(s),s=null)},a};function LG(e,t){}LG.bind(null,"warn");LG.bind(null,"error");function tc(){}function lDe(e,t){return{...e,...t}}function Ga(e,t,n){const s=t.map(a=>{const i=lDe(n,a.options);return e.addEventListener(a.eventName,a.fn,i),function(){e.removeEventListener(a.eventName,a.fn,i)}});return function(){s.forEach(i=>{i()})}}const cDe="Invariant failed";class mb extends Error{}mb.prototype.toString=function(){return this.message};function lt(e,t){throw new mb(cDe)}class dDe extends xe.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=tc,this.onWindowError=n=>{const s=this.getCallbacks();s.isDragging()&&s.tryAbort(),n.error instanceof mb&&n.preventDefault()},this.getCallbacks=()=>{if(!this.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return this.callbacks},this.setCallbacks=n=>{this.callbacks=n}}componentDidMount(){this.unbind=Ga(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof mb){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const uDe=`
1612  Press space bar to start a drag.
1613  When dragging you can use the arrow keys to move the item around and escape to cancel.
1614  Some screen readers may require you to be in focus mode or to use your pass through key
1615`,fb=e=>e+1,mDe=e=>`
1616  You have lifted an item in position ${fb(e.source.index)}
1617`,$G=(e,t)=>{const n=e.droppableId===t.droppableId,s=fb(e.index),a=fb(t.index);return n?`
1618      You have moved the item from position ${s}
1619      to position ${a}
1620    `:`
1621    You have moved the item from position ${s}
1622    in list ${e.droppableId}
1623    to list ${t.droppableId}
1624    in position ${a}
1625  `},BG=(e,t,n)=>t.droppableId===n.droppableId?`
1626      The item ${e}
1627      has been combined with ${n.draggableId}`:`
1628      The item ${e}
1629      in list ${t.droppableId}
1630      has been combined with ${n.draggableId}
1631      in list ${n.droppableId}
1632    `,fDe=e=>{const t=e.destination;if(t)return $G(e.source,t);
1632const n=e.combine;return n?BG(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},yF=e=>`
1633  The item has returned to its starting position
1634  of ${fb(e.index)}
1635`,hDe=e=>{if(e.reason==="CANCEL")return`
1636      Movement cancelled.
1637      ${yF(e.source)}
1638    `;const t=e.destination,n=e.combine;return t?`
1639      You have dropped the item.
1640      ${$G(e.source,t)}
1641    `:n?`
1642      You have dropped the item.
1643      ${BG(e.draggableId,e.source,n)}
1644    `:`
1645    The item has been dropped while not over a drop area.
1646    ${yF(e.source)}
1647  `},T0={dragHandleUsageInstructions:uDe,onDragStart:mDe,onDragUpdate:fDe,onDragEnd:hDe},rs={x:0,y:0},ps=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),va=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),nc=(e,t)=>e.x===t.x&&e.y===t.y,of=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),$d=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},Op=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),bF=(e,t)=>Math.min(...t.map(n=>Op(e,n))),FG=e=>t=>({x:e(t.x),y:e(t.y)});var pDe=(e,t)=>{const n=ki({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const jg=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),vF=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],gDe={top:0,right:0,bottom:0,left:0},xDe=(e,t)=>t?jg(e,t.scroll.diff.displacement):e,yDe=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,bDe=(e,t)=>t&&t.shouldClipSubject?pDe(t.pageMarginBox,e):ki(e);var Rm=({page:e,withPlaceholder:t,axis:n,frame:s})=>{const a=xDe(e.marginBox,s),i=yDe(a,n,t),o=bDe(i,s);return{page:e,withPlaceholder:t,active:o}},v3=(e,t)=>{e.frame||lt();const n=e.frame,s=va(t,n.scroll.initial),a=of(s),i={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:s,displacement:a},max:n.scroll.max}},o=Rm({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:o}};const zG=ts(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),UG=ts(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),zv=ts(e=>Object.values(e)),vDe=ts(e=>Object.values(e));var lf=ts((e,t)=>vDe(t).filter(s=>e===s.descriptor.droppableId).sort((s,a)=>s.descriptor.index-a.descriptor.index));function w3(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Uv(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var qv=ts((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),wDe=({isMovingForward:e,draggable:t,destination:n,insideDestination:s,previousImpact:a})=>{if(!n.isCombineEnabled||!w3(a))return null;function o(x){const j={type:"COMBINE",combine:{draggableId:x,droppableId:n.descriptor.id}};return{...a,at:j}}const l=a.displaced.all,c=l.length?l[0]:null;if(e)return c?o(c):null;const d=qv(t,s);if(!c){if(!d.length)return null;const x=d[d.length-1];return o(x.descriptor.id)}const f=d.findIndex(x=>x.descriptor.id===c);f===-1&&lt();const m=f-1;if(m<0)return null;const g=d[m];return o(g.descriptor.id)},cf=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const qG={point:rs,value:0},Ip={invisible:{},visible:{},all:[]},jDe={displaced:Ip,displacedBy:qG,at:null};var Za=(e,t)=>n=>e<=n&&n<=t,KG=e=>{const t=Za(e.top,e.bottom),n=Za(e.left,e.right);return s=>{if(t(s.top)&&t(s.bottom)&&n(s.left)&&n(s.right))return!0;const i=t(s.top)||t(s.bottom),o=n(s.left)||n(s.right);if(i&&o)return!0;const c=s.top<e.top&&s.bottom>e.bottom,d=s.left<e.left&&s.right>e.right;return c&&d?!0:c&&o||d&&i}},_De=e=>{const t=Za(e.top,e.bottom),n=Za(e.left,e.right);return s=>t(s.top)&&t(s.bottom)&&n(s.left)&&n(s.right)};const j3={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},VG={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var NDe=e=>t=>{const n=Za(t.top,t.bottom),s=Za(t.left,t.right);return a=>e===j3?n(a.top)&&n(a.bottom):s(a.left)&&s(a.right)};const SDe=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:rs;return jg(e,n)},kDe=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,CDe=(e,t,n)=>n(t)(e),_3=({target:e,destination:t,viewport:n,withDroppableDisplacement:s,isVisibleThroughFrameFn:a})=>{const i=s?SDe(e,t):e;return kDe(i,t,a)&&CDe(i,n,a)},EDe=e=>_3({...e,isVisibleThroughFrameFn:KG}),HG=e=>_3({...e,isVisibleThroughFrameFn:_De}),ADe=e=>_3({...e,isVisibleThroughFrameFn:NDe(e.destination.axis)}),TDe=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;
1647const{invisible:s,visible:a}=t;if(s[e])return!1;const i=a[e];return i?i.shouldAnimate:!0};function PDe(e,t){const n=e.page.marginBox,s={top:t.point.y,right:0,bottom:0,left:t.point.x};return ki(y3(n,s))}function Rp({afterDragging:e,destination:t,displacedBy:n,viewport:s,forceShouldAnimate:a,last:i}){return e.reduce(function(l,c){const d=PDe(c,n),f=c.descriptor.id;if(l.all.push(f),!EDe({target:d,destination:t,viewport:s,withDroppableDisplacement:!0}))return l.invisible[c.descriptor.id]=!0,l;const g=TDe(f,i,a),x={draggableId:f,shouldAnimate:g};return l.visible[f]=x,l},{all:[],visible:{},invisible:{}})}function ODe(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}function wF({insideDestination:e,inHomeList:t,displacedBy:n,destination:s}){const a=ODe(e,{inHomeList:t});return{displaced:Ip,displacedBy:n,at:{type:"REORDER",destination:{droppableId:s.descriptor.id,index:a}}}}function hb({draggable:e,insideDestination:t,destination:n,viewport:s,displacedBy:a,last:i,index:o,forceShouldAnimate:l}){const c=cf(e,n);if(o==null)return wF({insideDestination:t,inHomeList:c,displacedBy:a,destination:n});const d=t.find(j=>j.descriptor.index===o);if(!d)return wF({insideDestination:t,inHomeList:c,displacedBy:a,destination:n});const f=qv(e,t),m=t.indexOf(d),g=f.slice(m);return{displaced:Rp({afterDragging:g,destination:n,displacedBy:a,last:i,viewport:s.frame,forceShouldAnimate:l}),displacedBy:a,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:o}}}}function mc(e,t){return!!t.effected[e]}var IDe=({isMovingForward:e,destination:t,draggables:n,combine:s,afterCritical:a})=>{if(!t.isCombineEnabled)return null;const i=s.draggableId,l=n[i].descriptor.index;return mc(i,a)?e?l:l-1:e?l+1:l},RDe=({isMovingForward:e,isInHomeList:t,insideDestination:n,location:s})=>{if(!n.length)return null;const a=s.index,i=e?a+1:a-1,o=n[0].descriptor.index,l=n[n.length-1].descriptor.index,c=t?l:l+1;return i<o||i>c?null:i},MDe=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:s,destination:a,insideDestination:i,previousImpact:o,viewport:l,afterCritical:c})=>{const d=o.at;if(d||lt(),d.type==="REORDER"){const m=RDe({isMovingForward:e,isInHomeList:t,location:d.destination,insideDestination:i});return m==null?null:hb({draggable:n,insideDestination:i,destination:a,viewport:l,last:o.displaced,displacedBy:o.displacedBy,index:m})}const f=IDe({isMovingForward:e,destination:a,displaced:o.displaced,draggables:s,combine:d.combine,afterCritical:c});return f==null?null:hb({draggable:n,insideDestination:i,destination:a,viewport:l,last:o.displaced,displacedBy:o.displacedBy,index:f})},DDe=({displaced:e,afterCritical:t,combineWith:n,displacedBy:s})=>{const a=!!(e.visible[n]||e.invisible[n]);return mc(n,t)?a?rs:of(s.point):a?s.point:rs},LDe=({afterCritical:e,impact:t,draggables:n})=>{const s=Uv(t);s||lt();const a=s.draggableId,i=n[a].page.borderBox.center,o=DDe({displaced:t.displaced,afterCritical:e,combineWith:a,displacedBy:t.displacedBy});return ps(i,o)};const WG=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,$De=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,N3=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,jF=({axis:e,moveRelativeTo:t,isMoving:n})=>$d(e.line,t.marginBox[e.end]+WG(e,n),N3(e,t.marginBox,n)),_F=({axis:e,moveRelativeTo:t,isMoving:n})=>$d(e.line,t.marginBox[e.start]-$De(e,n),N3(e,t.marginBox,n)),BDe=({axis:e,moveInto:t,isMoving:n})=>$d(e.line,t.contentBox[e.start]+WG(e,n),N3(e,t.contentBox,n));var FDe=({impact:e,draggable:t,draggables:n,droppable:s,afterCritical:a})=>{const i=lf(s.descriptor.id,n),o=t.page,l=s.axis;if(!i.length)return BDe({axis:l,moveInto:s.page,isMoving:o});const{displaced:c,displacedBy:d}=e,f=c.all[0];if(f){const g=n[f];if(mc(f,a))return _F({axis:l,moveRelativeTo:g.page,isMoving:o});const x=db(g.page,d.point);return _F({axis:l,moveRelativeTo:x,isMoving:o})}const m=i[i.length-1];if(m.descriptor.id===t.descriptor.id)return o.borderBox.center;if(mc(m.descriptor.id,a)){const g=db(m.page,of(a.displacedBy.point));return jF({axis:l,moveRelativeTo:g,isMoving:o})}return jF({axis:l,moveRelativeTo:m.page,isMoving:o})},T5=(e,t)=>{const n=e.frame;return n?ps(t,n.scroll.diff.displacement):t};const zDe=({impact:e,draggable:t,droppable:n,draggables:s,afterCritical:a})=>{const i=t.page.borderBox.center,o=e.at;return!n||!o?i:o.type==="REORDER"?FDe({impact:e,draggable:t,draggables:s,droppable:n,afterCritical:a}):LDe({impact:e,draggables:s,afterCritical:a})};var Kv=e=>{const t=zDe(e),n=e.droppable;return n?T5(n,t):t},GG=(e,t)=>{const n=va(t,e.scroll.initial),s=of(n);return{frame:ki({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:s}}}};function NF(e,t){return e.map(n=>t[n])}function UDe(e,t){for(let n=0;n<t.length;n++){const s=t[n].visible[e];if(s)return s}return null}var qDe=({impact:e,viewport:t,destination:n,draggables:s,maxScrollChange:a})=>{const i=GG(t,ps(t.scroll.current,a)),o=n.frame?v3(n,ps(n.frame.scroll.current,a)):n,l=e.displaced,c=Rp({afterDragging:NF(l.all,s),destination:n,displacedBy:e.displacedBy,viewport:i.frame,last:l,forceShouldAnimate:!1}),d=Rp({afterDragging:NF(l.all,s),destination:o,displacedBy:e.displacedBy,viewport:t.frame,last:l,forceShouldAnimate:!1}),f={},m={},g=[l,c,d];return l.all.forEach(j=>{const b=UDe(j,g);if(b){m[j]=b;return}f[j]=!0}),{...e,displaced:{all:l.all,invisible:f,visible:m}}},KDe=(e,t)=>ps(e.scroll.diff.displacement,t),S3=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const s=KDe(n,e),a=va(s,t.page.borderBox.center);return ps(t.client.borderBox.center,a)},YG=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:s,withDroppableDisplacement:a,onlyOnMainAxis:i=!1})=>{const o=va(n,e.page.borderBox.center),c={target:jg(e.page.borderBox,o),destination:t,withDroppableDisplacement:a,viewport:s};return i?ADe(c):HG(c)},VDe=({isMovingForward:e,draggable:t,destination:n,draggables:s,previousImpact:a,viewport:i,previousPageBorderBoxCenter:o,previousClientSelection:l,afterCritical:c})=>{if(!n.isEnabled)return null;const d=lf(n.descriptor.id,s),f=cf(t,n),m=wDe({isMovingForward:e,draggable:t,destination:n,insideDestination:d,previousImpact:a})||MDe({isMovingForward:e,isInHomeList:f,draggable:t,draggables:s,destination:n,insideDestination:d,previousImpact:a,viewport:i,afterCritical:c});if(!m)return null;const g=Kv({impact:m,draggable:t,droppable:n,draggables:s,afterCritical:c});if(YG({draggable:t,destination:n,newPageBorderBoxCenter:g,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:S3({pageBorderBoxCenter:g,draggable:t,viewport:i}),impact:m,scrollJumpRequest:null};const j=va(g,o),b=qDe({impact:m,viewport:i,destination:n,draggables:s,maxScrollChange:j});return{clientSelection:l,impact:b,scrollJumpRequest:j}};const Ds=e=>{const t=e.subject.active;return t||lt(),t};var HDe=({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:s,viewport:
1647a})=>{const i=n.subject.active;if(!i)return null;const o=n.axis,l=Za(i[o.start],i[o.end]),c=zv(s).filter(f=>f!==n).filter(f=>f.isEnabled).filter(f=>!!f.subject.active).filter(f=>KG(a.frame)(Ds(f))).filter(f=>{const m=Ds(f);return e?i[o.crossAxisEnd]<m[o.crossAxisEnd]:m[o.crossAxisStart]<i[o.crossAxisStart]}).filter(f=>{const m=Ds(f),g=Za(m[o.start],m[o.end]);return l(m[o.start])||l(m[o.end])||g(i[o.start])||g(i[o.end])}).sort((f,m)=>{const g=Ds(f)[o.crossAxisStart],x=Ds(m)[o.crossAxisStart];return e?g-x:x-g}).filter((f,m,g)=>Ds(f)[o.crossAxisStart]===Ds(g[0])[o.crossAxisStart]);if(!c.length)return null;if(c.length===1)return c[0];const d=c.filter(f=>Za(Ds(f)[o.start],Ds(f)[o.end])(t[o.line]));return d.length===1?d[0]:d.length>1?d.sort((f,m)=>Ds(f)[o.start]-Ds(m)[o.start])[0]:c.sort((f,m)=>{const g=bF(t,vF(Ds(f))),x=bF(t,vF(Ds(m)));return g!==x?g-x:Ds(f)[o.start]-Ds(m)[o.start]})[0]};const SF=(e,t)=>{const n=e.page.borderBox.center;return mc(e.descriptor.id,t)?va(n,t.displacedBy.point):n},WDe=(e,t)=>{const n=e.page.borderBox;return mc(e.descriptor.id,t)?jg(n,of(t.displacedBy.point)):n};var GDe=({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:s,afterCritical:a})=>s.filter(o=>HG({target:WDe(o,a),destination:n,viewport:t.frame,withDroppableDisplacement:!0})).sort((o,l)=>{const c=Op(e,T5(n,SF(o,a))),d=Op(e,T5(n,SF(l,a)));return c<d?-1:d<c?1:o.descriptor.index-l.descriptor.index})[0]||null,_g=ts(function(t,n){const s=n[t.line];return{value:s,point:$d(t.line,s)}});const YDe=(e,t,n)=>{const s=e.axis;if(e.descriptor.mode==="virtual")return $d(s.line,t[s.line]);const a=e.subject.page.contentBox[s.size],c=lf(e.descriptor.id,n).reduce((d,f)=>d+f.client.marginBox[s.size],0)+t[s.line]-a;return c<=0?null:$d(s.line,c)},JG=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),QG=(e,t,n)=>{const s=e.frame;cf(t,e)&&lt(),e.subject.withPlaceholder&&lt();const a=_g(e.axis,t.displaceBy).point,i=YDe(e,a,n),o={placeholderSize:a,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!s){const f=Rm({page:e.subject.page,withPlaceholder:o,axis:e.axis,frame:e.frame});return{...e,subject:f}}const l=i?ps(s.scroll.max,i):s.scroll.max,c=JG(s,l),d=Rm({page:e.subject.page,withPlaceholder:o,axis:e.axis,frame:c});return{...e,subject:d,frame:c}},JDe=e=>{const t=e.subject.withPlaceholder;t||lt();const n=e.frame;if(!n){const o=Rm({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:o}}const s=t.oldFrameMaxScroll;s||lt();const a=JG(n,s),i=Rm({page:e.subject.page,axis:e.axis,frame:a,withPlaceholder:null});return{...e,subject:i,frame:a}};var QDe=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:s,draggables:a,destination:i,viewport:o,afterCritical:l})=>{if(!t){if(n.length)return null;const m={displaced:Ip,displacedBy:qG,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},g=Kv({impact:m,draggable:s,droppable:i,draggables:a,afterCritical:l}),x=cf(s,i)?i:QG(i,s,a);return YG({draggable:s,destination:x,newPageBorderBoxCenter:g,viewport:o.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?m:null}const c=e[i.axis.line]<=t.page.borderBox.center[i.axis.line],d=(()=>{const m=t.descriptor.index;return t.descriptor.id===s.descriptor.id||c?m:m+1})(),f=_g(i.axis,s.displaceBy);return hb({draggable:s,insideDestination:n,destination:i,viewport:o,displacedBy:f,last:Ip,index:d})},XDe=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:s,draggables:a,droppables:i,viewport:o,afterCritical:l})=>{const c=HDe({isMovingForward:e,pageBorderBoxCenter:t,source:s,droppables:i,viewport:o});if(!c)return null;const d=lf(c.descriptor.id,a),f=GDe({pageBorderBoxCenter:t,viewport:o,destination:c,insideDestination:d,afterCritical:l}),m=QDe({previousPageBorderBoxCenter:t,destination:c,draggable:n,draggables:a,moveRelativeTo:f,insideDestination:d,viewport:o,afterCritical:l});if(!m)return null;const g=Kv({impact:m,draggable:n,droppable:c,draggables:a,afterCritical:l});return{clientSelection:S3({pageBorderBoxCenter:g,draggable:n,viewport:o}),impact:m,scrollJumpRequest:null}},ja=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const ZDe=(e,t)=>{const n=ja(e);return n?t[n]:null};var eLe=({state:e,type:t})=>{const n=ZDe(e.impact,e.dimensions.droppables),s=!!n,a=e.dimensions.droppables[e.critical.droppable.
1647id],i=n||a,o=i.axis.direction,l=o==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||o==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(l&&!s)return null;const c=t==="MOVE_DOWN"||t==="MOVE_RIGHT",d=e.dimensions.draggables[e.critical.draggable.id],f=e.current.page.borderBoxCenter,{draggables:m,droppables:g}=e.dimensions;return l?VDe({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:d,destination:i,draggables:m,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):XDe({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:d,isOver:i,draggables:m,droppables:g,viewport:e.viewport,afterCritical:e.afterCritical})};function Zc(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function XG(e){const t=Za(e.top,e.bottom),n=Za(e.left,e.right);return function(a){return t(a.y)&&n(a.x)}}function tLe(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function nLe({pageBorderBox:e,draggable:t,candidates:n}){const s=t.page.borderBox.center,a=n.map(i=>{const o=i.axis,l=$d(i.axis.line,e.center[o.line],i.page.borderBox.center[o.crossAxisLine]);return{id:i.descriptor.id,distance:Op(s,l)}}).sort((i,o)=>o.distance-i.distance);return a[0]?a[0].id:null}function rLe({pageBorderBox:e,draggable:t,droppables:n}){const s=zv(n).filter(a=>{if(!a.isEnabled)return!1;const i=a.subject.active;if(!i||!tLe(e,i))return!1;if(XG(i)(e.center))return!0;const o=a.axis,l=i.center[o.crossAxisLine],c=e[o.crossAxisStart],d=e[o.crossAxisEnd],f=Za(i[o.crossAxisStart],i[o.crossAxisEnd]),m=f(c),g=f(d);return!m&&!g?!0:m?c<l:d>l});return s.length?s.length===1?s[0].descriptor.id:nLe({pageBorderBox:e,draggable:t,candidates:s}):null}const ZG=(e,t)=>ki(jg(e,t));var sLe=(e,t)=>{const n=e.frame;return n?ZG(t,n.scroll.diff.value):t};function eY({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function aLe({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var iLe=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:s,last:a,viewport:i,afterCritical:o})=>{const l=n.axis,c=_g(n.axis,t.displaceBy),d=c.value,f=e[l.start],m=e[l.end],x=qv(t,s).find(b=>{const y=b.descriptor.id,w=b.page.borderBox.center[l.line],_=mc(y,o),N=eY({displaced:a,id:y});return _?N?m<=w:f<w-d:N?m<=w+d:f<w})||null,j=aLe({draggable:t,closest:x,inHomeList:cf(t,n)});return hb({draggable:t,insideDestination:s,destination:n,viewport:i,last:a,displacedBy:c,index:j})};const oLe=4;var lLe=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:s,insideDestination:a,afterCritical:i})=>{if(!s.isCombineEnabled)return null;const o=s.axis,l=_g(s.axis,e.displaceBy),c=l.value,d=t[o.start],f=t[o.end],g=qv(e,a).find(j=>{const b=j.descriptor.id,y=j.page.borderBox,_=y[o.size]/oLe,N=mc(b,i),C=eY({displaced:n.displaced,id:b});return N?C?f>y[o.start]+_&&f<y[o.end]-_:d>y[o.start]-c+_&&d<y[o.end]-c-_:C?f>y[o.start]+c+_&&f<y[o.end]+c-_:d>y[o.start]+_&&d<y[o.end]-_});return g?{displacedBy:l,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:g.descriptor.id,droppableId:s.descriptor.id}}}:null},tY=({pageOffset:e,draggable:t,draggables:n,droppables:s,previousImpact:a,viewport:i,afterCritical:o})=>{const l=ZG(t.page.borderBox,e),c=rLe({pageBorderBox:l,draggable:t,droppables:s});if(!c)return jDe;const d=s[c],f=lf(d.descriptor.id,n),m=sLe(d,l);return lLe({pageBorderBoxWithDroppableScroll:m,draggable:t,previousImpact:a,destination:d,insideDestination:f,afterCritical:o})||iLe({pageBorderBoxWithDroppableScroll:m,draggable:t,destination:d,insideDestination:f,last:a.displaced,viewport:i,afterCritical:o})},k3=(e,t)=>({...e,[t.descriptor.id]:t});const cLe=({previousImpact:e,impact:t,droppables:n})=>{const s=ja(e),a=ja(t);if(!s||s===a)return n;const i=n[s];if(!i.subject.withPlaceholder)return n;const o=JDe(i);return k3(n,o)};var dLe=({draggable:e,draggables:t,droppables:n,previousImpact:s,impact:a})=>{const i=cLe({previousImpact:s,impact:a,droppables:n}),o=ja(a);if(!o)return i;const l=n[o];if(cf(e,l)||l.subject.withPlaceholder)return i;const c=QG(l,e,t);return k3(i,c)},Ph=({state:e,clientSelection:t,dimensions:n,viewport:s,impact:a,scrollJumpRequest:i})=>{const o=s||e.viewport,l=n||e.dimensions,c=t||e.current.client.selection,d=va(c,e.initial.client.selection),f={offset:d,selection:c,borderBoxCenter:ps(e.initial.client.borderBoxCenter,d)},m={selection:ps(f.selection,o.scroll.current),borderBoxCenter:ps(f.borderBoxCenter,o.scroll.current),offset:ps(f.offset,o.scroll.diff.value)},g={client:f,page:m};if(e.phase==="COLLECTING")return{...e,dimensions:l,viewport:o,current:g};const x=l.draggables[e.critical.draggable.id],j=a||tY({pageOffset:m.offset,draggable:x,draggables:l.draggables,droppables:l.droppables,previousImpact:e.impact,viewport:o,afterCritical:e.afterCritical}),b=dLe({draggable:x,impact:j,previousImpact:e.impact,draggables:l.draggables,droppables:l.droppables});return{...e,current:g,dimensions:{draggables:l.draggables,droppables:b},impact:j,viewport:o,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function uLe(e,t){return e.map(n=>t[n])}var nY=({impact:e,viewport:t,draggables:n,destination:s,forceShouldAnimate:a})=>{const i=e.displaced,o=uLe(i.all,n),l=Rp({afterDragging:o,destination:s,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:a,last:i});return{...e,displaced:l}}
1647,rY=({impact:e,draggable:t,droppable:n,draggables:s,viewport:a,afterCritical:i})=>{const o=Kv({impact:e,draggable:t,draggables:s,droppable:n,afterCritical:i});return S3({pageBorderBoxCenter:o,draggable:t,viewport:a})},sY=({state:e,dimensions:t,viewport:n})=>{e.movementMode!=="SNAP"&&lt();const s=e.impact,a=n||e.viewport,i=t||e.dimensions,{draggables:o,droppables:l}=i,c=o[e.critical.draggable.id],d=ja(s);d||lt();const f=l[d],m=nY({impact:s,viewport:a,destination:f,draggables:o}),g=rY({impact:m,draggable:c,droppable:f,draggables:o,viewport:a,afterCritical:e.afterCritical});return Ph({impact:m,clientSelection:g,state:e,dimensions:i,viewport:a})},mLe=e=>({index:e.index,droppableId:e.droppableId}),aY=({draggable:e,home:t,draggables:n,viewport:s})=>{const a=_g(t.axis,e.displaceBy),i=lf(t.descriptor.id,n),o=i.indexOf(e);o===-1&&lt();const l=i.slice(o+1),c=l.reduce((g,x)=>(g[x.descriptor.id]=!0,g),{}),d={inVirtualList:t.descriptor.mode==="virtual",displacedBy:a,effected:c};return{impact:{displaced:Rp({afterDragging:l,destination:t,displacedBy:a,last:null,viewport:s.frame,forceShouldAnimate:!1}),displacedBy:a,at:{type:"REORDER",destination:mLe(e.descriptor)}},afterCritical:d}},fLe=(e,t)=>({draggables:e.draggables,droppables:k3(e.droppables,t)}),hLe=({draggable:e,offset:t,initialWindowScroll:n})=>{const s=db(e.client,t),a=ub(s,n);return{...e,placeholder:{...e.placeholder,client:s},client:s,page:a}},pLe=e=>{const t=e.frame;return t||lt(),t},gLe=({additions:e,updatedDroppables:t,viewport:n})=>{const s=n.scroll.diff.value;return e.map(a=>{const i=a.descriptor.droppableId,o=t[i],c=pLe(o).scroll.diff.value,d=ps(s,c);return hLe({draggable:a,offset:d,initialWindowScroll:n.scroll.initial})})},xLe=({state:e,published:t})=>{const n=t.modified.map(w=>{const _=e.dimensions.droppables[w.droppableId];return v3(_,w.scroll)}),s={...e.dimensions.droppables,...zG(n)},a=UG(gLe({additions:t.additions,updatedDroppables:s,viewport:e.viewport})),i={...e.dimensions.draggables,...a};t.removals.forEach(w=>{delete i[w]});const o={droppables:s,draggables:i},l=ja(e.impact),c=l?o.droppables[l]:null,d=o.draggables[e.critical.draggable.id],f=o.droppables[e.critical.droppable.id],{impact:m,afterCritical:g}=aY({draggable:d,home:f,draggables:i,viewport:e.viewport}
1647),x=c&&c.isCombineEnabled?e.impact:m,j=tY({pageOffset:e.current.page.offset,draggable:o.draggables[e.critical.draggable.id],draggables:o.draggables,droppables:o.droppables,previousImpact:x,viewport:e.viewport,afterCritical:g}),b={...e,phase:"DRAGGING",impact:j,onLiftImpact:m,dimensions:o,afterCritical:g,forceShouldAnimate:!1};return e.phase==="COLLECTING"?b:{...b,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const P5=e=>e.movementMode==="SNAP",Mk=(e,t,n)=>{const s=fLe(e.dimensions,t);return!P5(e)||n?Ph({state:e,dimensions:s}):sY({state:e,dimensions:s})};function Dk(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const kF={phase:"IDLE",completed:null,shouldFlush:!1};var yLe=(e=kF,t)=>{if(t.type==="FLUSH")return{...kF,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&lt();const{critical:n,clientSelection:s,viewport:a,dimensions:i,movementMode:o}=t.payload,l=i.draggables[n.draggable.id],c=i.droppables[n.droppable.id],d={selection:s,borderBoxCenter:l.client.borderBox.center,offset:rs},f={client:d,page:{selection:ps(d.selection,a.scroll.initial),borderBoxCenter:ps(d.selection,a.scroll.initial),offset:ps(d.selection,a.scroll.diff.value)}},m=zv(i.droppables).every(b=>!b.isFixedOnPage),{impact:g,afterCritical:x}=aY({draggable:l,home:c,draggables:i.draggables,viewport:a});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:o,dimensions:i,initial:f,current:f,isWindowScrollAllowed:m,impact:g,afterCritical:x,onLiftImpact:g,viewport:a,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&lt(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||lt(),xLe({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;Zc(e)||lt();const{client:n}=t.payload;return nc(n,e.current.client.selection)?e:Ph({state:e,clientSelection:n,impact:P5(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return Dk(e);Zc(e)||lt();const{id:n,newScroll:s}=t.payload,a=e.dimensions.droppables[n];if(!a)return e;const i=v3(a,s);return Mk(e,i,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;Zc(e)||lt();const{id:n,isEnabled:s}=t.payload,a=e.dimensions.droppables[n];a||lt(),a.isEnabled===s&&lt();const i={...a,isEnabled:s};return Mk(e,i,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;Zc(e)||lt();const{id:n,isCombineEnabled:s}=t.payload,a=e.dimensions.droppables[n];a||lt(),a.isCombineEnabled===s&&lt();const i={...a,isCombineEnabled:s};return Mk(e,i,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;Zc(e)||lt(),e.isWindowScrollAllowed||lt();const n=t.payload.newScroll;if(nc(e.viewport.scroll.current,n))return Dk(e);const s=GG(e.viewport,n);return P5(e)?sY({state:e,viewport:s}):Ph({state:e,viewport:s})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!Zc(e))return e;const n=t.payload.maxScroll;if(nc(n,e.viewport.scroll.max))return e;const s={...e.viewport,scroll:{...e.viewport.scroll,max:n}};return{...e,viewport:s}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&lt();const n=eLe({state:e,type:t.type});return n?Ph({state:e,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const n=t.payload.reason;return e.phase!=="COLLECTING"&&lt(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(t.type==="DROP_ANIMATE"){const{completed:n,dropDuration:s,newHomeClientOffset:a}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||lt(),{phase:"DROP_ANIMATING",completed:n,dropDuration:s,newHomeClientOffset:a,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:n}=t.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return e};function Bn(e,t){return e instanceof Object&&"type"in e&&e.type===t}const bLe=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),vLe=e=>({type:"LIFT",payload:e}),wLe=e=>({type:"INITIAL_PUBLISH",payload:e}),jLe=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),_Le=()=>({type:"COLLECTION_STARTING",payload:null}),NLe=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),SLe=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),kLe=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),iY=e=>({type:"MOVE",payload:e}),CLe=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),ELe=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),ALe=()=>({type:"MOVE_UP",payload:null}),TLe=()=>({type:"MOVE_DOWN",payload:null}),PLe=()=>({type:"MOVE_RIGHT",payload:null}),OLe=()=>({type:"MOVE_LEFT",payload:null}),C3=()=>({type:"FLUSH",payload:null}),ILe=e=>({type:"DROP_ANIMATE",payload:e}),E3=e=>({type:"DROP_COMPLETE",payload:e}),oY=e=>({type:"DROP",payload:e}),RLe=e=>({type:"DROP_PENDING",payload:e}),lY=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var MLe=e=>({getState:t,dispatch:n})=>s=>a=>{if(!Bn(a,"LIFT")){s(a);return}const{id:i,clientSelection:o,movementMode:l}=a.payload,c=t();c.phase==="DROP_ANIMATING"&&n(E3({completed:c.completed})),t().phase!=="IDLE"&&lt(),n(C3()),n(bLe({draggableId:i,movementMode:l}));const f={draggableId:i,scrollOptions:{shouldPublishImmediately:l==="SNAP"}},{critical:m,dimensions:g,viewport:x}=e.startPublishing(f);n(wLe({critical:m,dimensions:g,clientSelection:o,movementMode:l,viewport:x}))},DLe=e=>()=>t=>n=>{Bn(n,"INITIAL_PUBLISH")&&e.dragging(),Bn(n,"DROP_ANIMATE")&&e.dropping(n.payload.completed.result.reason),(Bn(n,"FLUSH")||Bn(n,"DROP_COMPLETE"))&&e.resting(),t(n)};const A3={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Mp={opacity:{drop:0,combining:.7},scale:{drop:.75}},cY={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Hc=`${cY.outOfTheWay}s ${A3.outOfTheWay}`,Oh={fluid:`opacity ${Hc}`,snap:`transform ${Hc}, opacity ${Hc}`,drop:e=>{const t=`${e}s ${A3.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Hc}`,placeholder:`height ${Hc}, width ${Hc}, margin ${Hc}`},CF=e=>nc(e,rs)?void 0:`translate(${e.x}px, ${e.y}px)`,O5={moveTo:CF,drop:(e,t)=>{const n=CF(e);if(n)return t?`${n} scale(${Mp.scale.drop})`:n}},{minDropTime:I5,maxDropTime:dY}
1647=cY,LLe=dY-I5,EF=1500,$Le=.6;var BLe=({current:e,destination:t,reason:n})=>{const s=Op(e,t);if(s<=0)return I5;if(s>=EF)return dY;const a=s/EF,i=I5+LLe*a,o=n==="CANCEL"?i*$Le:i;return Number(o.toFixed(2))},FLe=({impact:e,draggable:t,dimensions:n,viewport:s,afterCritical:a})=>{const{draggables:i,droppables:o}=n,l=ja(e),c=l?o[l]:null,d=o[t.descriptor.droppableId],f=rY({impact:e,draggable:t,draggables:i,afterCritical:a,droppable:c||d,viewport:s});return va(f,t.client.borderBox.center)},zLe=({draggables:e,reason:t,lastImpact:n,home:s,viewport:a,onLiftImpact:i})=>!n.at||t!=="DROP"?{impact:nY({draggables:e,impact:i,destination:s,viewport:a,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Ip},didDropInsideDroppable:!0};const ULe=({getState:e,dispatch:t})=>n=>s=>{if(!Bn(s,"DROP")){n(s);return}const a=e(),i=s.payload.reason;if(a.phase==="COLLECTING"){t(RLe({reason:i}));return}if(a.phase==="IDLE")return;a.phase==="DROP_PENDING"&&a.isWaiting&&lt(),a.phase==="DRAGGING"||a.phase==="DROP_PENDING"||lt();const l=a.critical,c=a.dimensions,d=c.draggables[a.critical.draggable.id],{impact:f,didDropInsideDroppable:m}=zLe({reason:i,lastImpact:a.impact,afterCritical:a.afterCritical,onLiftImpact:a.onLiftImpact,home:a.dimensions.droppables[a.critical.droppable.id],viewport:a.viewport,draggables:a.dimensions.draggables}),g=m?w3(f):null,x=m?Uv(f):null,j={index:l.draggable.index,droppableId:l.droppable.id},b={draggableId:d.descriptor.id,type:d.descriptor.type,source:j,reason:i,mode:a.movementMode,destination:g,combine:x},y=FLe({impact:f,draggable:d,dimensions:c,viewport:a.viewport,afterCritical:a.afterCritical}),w={critical:a.critical,afterCritical:a.afterCritical,result:b,impact:f};if(!(!nc(a.current.client.offset,y)||!!b.combine)){t(E3({completed:w}));return}const N=BLe({current:a.current.client.offset,destination:y,reason:i});t(ILe({newHomeClientOffset:y,dropDuration:N,completed:w}))};var uY=()=>({x:window.pageXOffset,y:window.pageYOffset});function qLe(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function KLe({onWindowScroll:e}){function t(){e(uY())}const n=Pp(t),s=qLe(n);let a=tc;function i(){return a!==tc}function o(){i()&&lt(),a=Ga(window,[s])}function l(){i()||lt(),n.cancel(),a(),a=tc}return{start:o,stop:l,isActive:i}}const VLe=e=>Bn(e,"DROP_COMPLETE")||Bn(e,"DROP_ANIMATE")||Bn(e,"FLUSH"),HLe=e=>{const t=KLe({onWindowScroll:n=>{e.dispatch(CLe({newScroll:n}))}});return n=>s=>{!t.isActive()&&Bn(s,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&VLe(s)&&t.stop(),n(s)}};var WLe=e=>{let t=!1,n=!1;const s=setTimeout(()=>{n=!0}),a=i=>{t||n||(t=!0,e(i),clearTimeout(s))};return a.wasCalled=()=>t,a},GLe=()=>{const e=[],t=a=>{const i=e.findIndex(l=>l.timerId===a);i===-1&&lt();const[o]=e.splice(i,1);o.callback()};return{add:a=>{const i=setTimeout(()=>t(i)),o={timerId:i,callback:a};e.push(o)},flush:()=>
1647{if(!e.length)return;const a=[...e];e.length=0,a.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}};const YLe=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,JLe=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,QLe=(e,t)=>{if(e===t)return!0;const n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,s=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&s},ch=(e,t)=>{t()},u0=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function Lk(e,t,n,s){if(!e){n(s(t));return}const a=WLe(n);e(t,{announce:a}),a.wasCalled()||n(s(t))}var XLe=(e,t)=>{const n=GLe();let s=null;const a=(m,g)=>{s&&lt(),ch("onBeforeCapture",()=>{const x=e().onBeforeCapture;x&&x({draggableId:m,mode:g})})},i=(m,g)=>{s&&lt(),ch("onBeforeDragStart",()=>{const x=e().onBeforeDragStart;x&&x(u0(m,g))})},o=(m,g)=>{s&&lt();const x=u0(m,g);s={mode:g,lastCritical:m,lastLocation:x.source,lastCombine:null},n.add(()=>{ch("onDragStart",()=>Lk(e().onDragStart,x,t,T0.onDragStart))})},l=(m,g)=>{const x=w3(g),j=Uv(g);s||lt();const b=!QLe(m,s.lastCritical);b&&(s.lastCritical=m);const y=!YLe(s.lastLocation,x);y&&(s.lastLocation=x);const w=!JLe(s.lastCombine,j);if(w&&(s.lastCombine=j),!b&&!y&&!w)return;const _={...u0(m,s.mode),combine:j,destination:x};n.add(()=>{ch("onDragUpdate",()=>Lk(e().onDragUpdate,_,t,T0.onDragUpdate))})},c=()=>{s||lt(),n.flush()},d=m=>{s||lt(),s=null,ch("onDragEnd",()=>Lk(e().onDragEnd,m,t,T0.onDragEnd))};return{beforeCapture:a,beforeStart:i,start:o,update:l,flush:c,drop:d,abort:()=>{if(!s)return;const m={...u0(s.lastCritical,s.mode),combine:null,destination:null,reason:"CANCEL"};d(m)}}},ZLe=(e,t)=>{const n=XLe(e,t);return s=>a=>i=>{if(Bn(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(Bn(i,"INITIAL_PUBLISH")){const l=i.payload.critical;n.beforeStart(l,i.payload.movementMode),a(i),n.start(l,i.payload.movementMode);return}if(Bn(i,"DROP_COMPLETE")){const l=i.payload.completed.result;n.flush(),a(i),n.drop(l);return}if(a(i),Bn(i,"FLUSH")){n.abort();return}const o=s.getState();o.phase==="DRAGGING"&&n.update(o.critical,o.impact)}};const e$e=e=>t=>n=>{if(!Bn(n,"DROP_ANIMATION_FINISHED")){t(n);return}const s=e.getState();s.phase!=="DROP_ANIMATING"&&lt(),e.dispatch(E3({completed:s.completed}))},t$e=e=>{let t=null,n=null;function s(){n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)}return a=>i=>{if((Bn(i,"FLUSH")||Bn(i,"DROP_COMPLETE")||Bn(i,"DROP_ANIMATION_FINISHED"))&&s(),a(i),!Bn(i,"DROP_ANIMATE"))return;const o={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(lY())}};n=requestAnimationFrame(()=>{n=null,t=Ga(window,[o])})}};var n$e=e=>()=>t=>n=>{(Bn(n,"DROP_COMPLETE")||Bn(n,"FLUSH")||Bn(n,"DROP_ANIMATE"))&&e.stopPublishing(),t(n)},r$e=e=>{let t=!1;return()=>n=>s=>{if(Bn(s,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(s.payload.critical.draggable.id),n(s),e.tryRestoreFocusRecorded();return}if(n(s),!!t){if(Bn(s,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Bn(s,"DROP_COMPLETE")){t=!1;const a=s.payload.completed.result;a.combine&&e.tryShiftRecord(a.draggableId,a.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const s$e=e=>Bn(e,"DROP_COMPLETE")||Bn(e,"DROP_ANIMATE")||Bn(e,"FLUSH");var a$e=e=>t=>n=>s=>{if(s$e(s)){e.stop(),n(s);return}if(Bn(s,"INITIAL_PUBLISH")){n(s);const a=t.getState();a.phase!=="DRAGGING"&&lt(),e.start(a);return}n(s),e.scroll(t.getState())};const i$e=e=>t=>n=>{if(t(n),!Bn(n,"PUBLISH_WHILE_DRAGGING"))return;const s=e.getState();s.phase==="DROP_PENDING"&&(s.isWaiting||e.dispatch(oY({reason:s.reason})))},o$e=CG;var l$e=({dimensionMarshal:e,focusMarshal:t,styleMarshal:n,getResponders:s,announce:a,autoScroller:i})=>kG(yLe,o$e(iMe(DLe(n),n$e(e),MLe(e),ULe,e$e,t$e,i$e,a$e(i),HLe,r$e(t),ZLe(s,a))));const $k=()=>({additions:{},removals:{},modified:{}});function c$e({registry:e,callbacks:t}){let n=$k(),s=null;const a=()=>{s||(t.collectionStarting(),s=requestAnimationFrame(()=>{s=null;const{additions:c,removals:d,modified:f}=n,m=Object.keys(c).map(j=>e.draggable.getById(j).getDimension(rs)).sort((j,b)=>j.descriptor.index-b.descriptor.index),g=Object.keys(f).map(j=>{const y=e.droppable.getById(j).callbacks.getScrollWhileDragging();return{droppableId:j,scroll:y}}),x={additions:m,removals:Object.keys(d),modified:g};n=$k(),t.publish(x)}))};return{add:c=>{const d=c.descriptor.id;n.additions[d]=c,n.modified[c.descriptor.droppableId]=!0,n.removals[d]&&delete n.removals[d],a()},remove:c=>{const d=c.descriptor;n.removals[d.id]=!0,n.modified[d.droppableId]=!0,n.additions[d.id]&&delete n.additions[d.id],a()},stop:()=>{s&&(cancelAnimationFrame(s),s=null,n=$k())}}}var mY=({scrollHeight:e,scrollWidth:t,height:n,width:s})=>{const a=va({x:t,y:e},{x:s,y:n});return{x:Math.max(0,a.x),y:Math.max(0,a.y)}},fY=()=>{const e=document.documentElement;return e||lt(),e},hY=()=>{const e=fY();return mY({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},d$e=()=>{const e=uY(),t=hY(),n=e.y,s=e.x,a=fY(),i=a.clientWidth,o=a.clientHeight,l=s+i,c=n+o;return{frame:ki({top:n,left:s,right:l,bottom:c}),scroll:{initial:e,current:e,max:t,diff:{value:rs,displacement:rs}}}},u$e=({critical:e,scrollOptions:t,registry:n})=>{const s=d$e(),a=s.scroll.current,i=e.droppable,o=n.droppable.getAllByType(i.type).map(f=>f.callbacks.getDimensionAndWatchScroll(a,t)),l=n.draggable.getAllByType(e.draggable.type).map(f=>f.getDimension(a));return{dimensions:{draggables:UG(l),droppables:zG(o)},critical:e,viewport:s}};function AF(e,t,n){return!(n.descriptor.id===t.id||n.descriptor.type!==t.type||e.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var m$e=(e,t)=>
1647{let n=null;const s=c$e({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),a=(g,x)=>{e.droppable.exists(g)||lt(),n&&t.updateDroppableIsEnabled({id:g,isEnabled:x})},i=(g,x)=>{n&&(e.droppable.exists(g)||lt(),t.updateDroppableIsCombineEnabled({id:g,isCombineEnabled:x}))},o=(g,x)=>{n&&(e.droppable.exists(g)||lt(),t.updateDroppableScroll({id:g,newScroll:x}))},l=(g,x)=>{n&&e.droppable.getById(g).callbacks.scroll(x)},c=()=>{if(!n)return;s.stop();const g=n.critical.droppable;e.droppable.getAllByType(g.type).forEach(x=>x.callbacks.dragStopped()),n.unsubscribe(),n=null},d=g=>{n||lt();const x=n.critical.draggable;g.type==="ADDITION"&&AF(e,x,g.value)&&s.add(g.value),g.type==="REMOVAL"&&AF(e,x,g.value)&&s.remove(g.value)};return{updateDroppableIsEnabled:a,updateDroppableIsCombineEnabled:i,scrollDroppable:l,updateDroppableScroll:o,startPublishing:g=>{n&&lt();const x=e.draggable.getById(g.draggableId),j=e.droppable.getById(x.descriptor.droppableId),b={draggable:x.descriptor,droppable:j.descriptor},y=e.subscribe(d);return n={critical:b,unsubscribe:y},u$e({critical:b,registry:e,scrollOptions:g.scrollOptions})},stopPublishing:c}},pY=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",f$e=e=>{window.scrollBy(e.x,e.y)};const h$e=ts(e=>zv(e).filter(t=>!(!t.isEnabled||!t.frame))),p$e=(e,t)=>
1647h$e(t).find(s=>(s.frame||lt(),XG(s.frame.pageMarginBox)(e)))||null;var g$e=({center:e,destination:t,droppables:n})=>{if(t){const a=n[t];return a.frame?a:null}return p$e(e,n)};const Dp={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var x$e=(e,t,n=()=>Dp)=>{const s=n(),a=e[t.size]*s.startFromPercentage,i=e[t.size]*s.maxScrollAtPercentage;return{startScrollingFrom:a,maxScrollValueAt:i}},gY=({startOfRange:e,endOfRange:t,current:n})=>{const s=t-e;return s===0?0:(n-e)/s},T3=1,y$e=(e,t,n=()=>Dp)=>{const s=n();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return s.maxPixelScroll;if(e===t.startScrollingFrom)return T3;const i=1-gY({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),o=s.maxPixelScroll*s.ease(i);return Math.ceil(o)},b$e=(e,t,n)=>{const s=n(),a=s.durationDampening.accelerateAt,i=s.durationDampening.stopDampeningAt,o=t,l=i,d=Date.now()-o;if(d>=i)return e;if(d<a)return T3;const f=gY({startOfRange:a,endOfRange:l,current:d}),m=e*s.ease(f);return Math.ceil(m)},TF=({distanceToEdge:e,thresholds:t,dragStartTime:n,shouldUseTimeDampening:s,getAutoScrollerOptions:a})=>{const i=y$e(e,t,a);return i===0?0:s?Math.max(b$e(i,n,a),T3):i},PF=({container:e,distanceToEdges:t,dragStartTime:n,axis:s,shouldUseTimeDampening:a,getAutoScrollerOptions:i})=>{const o=x$e(e,s,i);return t[s.end]<t[s.start]?TF({distanceToEdge:t[s.end],thresholds:o,dragStartTime:n,shouldUseTimeDampening:a,getAutoScrollerOptions:i}):-1*TF({distanceToEdge:t[s.start],thresholds:o,dragStartTime:n,shouldUseTimeDampening:a,getAutoScrollerOptions:i})},v$e=({container:e,subject:t,proposedScroll:n})=>{const s=t.height>e.height,a=t.width>e.width;return!a&&!s?n:a&&s?null:{x:a?0:n.x,y:s?0:n.y}};const w$e=FG(e=>e===0?0:e);var xY=({dragStartTime:e,container:t,subject:n,center:s,shouldUseTimeDampening:a,getAutoScrollerOptions:i})=>{const o={top:s.y-t.top,right:t.right-s.x,bottom:t.bottom-s.y,left:s.x-t.left},l=PF({container:t,distanceToEdges:o,dragStartTime:e,axis:j3,shouldUseTimeDampening:a,getAutoScrollerOptions:i}),c=PF({container:t,distanceToEdges:o,dragStartTime:e,axis:VG,shouldUseTimeDampening:a,getAutoScrollerOptions:i}),d=w$e({x:c,y:l});if(nc(d,rs))return null;const f=v$e({container:t,subject:n,proposedScroll:d});return f?nc(f,rs)?null:f:null};const j$e=FG(e=>e===0?0:e>0?1:-1),P3=(()=>{const e=(t,n)=>t<0?t:t>n?t-n:0;return({current:t,max:n,change:s})=>{const a=ps(t,s),i={x:e(a.x,n.x),y:e(a.y,n.y)};return nc(i,rs)?null:i}})(),yY=({max:e,current:t,change:n})=>{const s={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},a=j$e(n),i=P3({max:s,current:t,change:a});return!i||a.x!==0&&i.x===0||a.y!==0&&i.y===0},O3=(e,t)=>yY({current:e.scroll.current,max:e.scroll.max,change:t}),_$e=(e,t)=>{if(!O3(e,t))return null;const n=e.scroll.max,s=e.scroll.current;return P3({current:s,max:n,change:t})},I3=(e,t)=>{const n=e.frame;return n?yY({current:n.scroll.current,max:n.scroll.max,change:t}):!1},N$e=(e,t)=>{const n=e.frame;return!n||!I3(e,t)?null:P3({current:n.scroll.current,max:n.scroll.max,change:t})};var S$e=({viewport:e,subject:t,center:n,dragStartTime:s,shouldUseTimeDampening:a,getAutoScrollerOptions:i})=>{const o=xY({dragStartTime:s,container:e.frame,subject:t,center:n,shouldUseTimeDampening:a,getAutoScrollerOptions:i});return o&&O3(e,o)?o:null},k$e=({droppable:e,subject:t,center:n,dragStartTime:s,shouldUseTimeDampening:a,getAutoScrollerOptions:i})=>{const o=e.frame;if(!o)return null;const l=xY({dragStartTime:s,container:o.pageMarginBox,subject:t,center:n,shouldUseTimeDampening:a,getAutoScrollerOptions:i});return l&&I3(e,l)?l:null},OF=({state:e,dragStartTime:t,shouldUseTimeDampening:n,scrollWindow:s,scrollDroppable:a,getAutoScrollerOptions:i})=>{const o=e.current.page.borderBoxCenter,c=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const m=e.viewport,g=S$e({dragStartTime:t,viewport:m,subject:c,center:o,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(g){s(g);return}}const d=g$e({center:o,destination:ja(e.impact),droppables:e.dimensions.droppables});if(!d)return;const f=k$e({dragStartTime:t,droppable:d,subject:c,center:o,shouldUseTimeDampening:n,getAutoScrollerOptions:i});f&&a(d.descriptor.id,f)},C$e=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:n=()=>Dp})=>{const s=Pp(e),a=Pp(t);let i=null;const o=d=>{i||lt();const{shouldUseTimeDampening:f,dragStartTime:m}=i;OF({state:d,scrollWindow:s,scrollDroppable:a,dragStartTime:m,shouldUseTimeDampening:f,getAutoScrollerOptions:n})};return{start:d=>{i&&lt();const f=Date.now();let m=!1;const g=()=>{m=!0};OF({state:d,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:g,scrollDroppable:g,getAutoScrollerOptions:n}),i={dragStartTime:f,shouldUseTimeDampening:m},m&&o(d)},stop:()=>
1647{i&&(s.cancel(),a.cancel(),i=null)},scroll:o}},E$e=({move:e,scrollDroppable:t,scrollWindow:n})=>{const s=(l,c)=>{const d=ps(l.current.client.selection,c);e({client:d})},a=(l,c)=>{if(!I3(l,c))return c;const d=N$e(l,c);if(!d)return t(l.descriptor.id,c),null;const f=va(c,d);return t(l.descriptor.id,f),va(c,f)},i=(l,c,d)=>{if(!l||!O3(c,d))return d;const f=_$e(c,d);if(!f)return n(d),null;const m=va(d,f);return n(m),va(d,m)};return l=>{const c=l.scrollJumpRequest;if(!c)return;const d=ja(l.impact);d||lt();const f=a(l.dimensions.droppables[d],c);if(!f)return;const m=l.viewport,g=i(l.isWindowScrollAllowed,m,f);g&&s(l,g)}},A$e=({scrollDroppable:e,scrollWindow:t,move:n,getAutoScrollerOptions:s})=>{const a=C$e({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:s}),i=E$e({move:n,scrollWindow:t,scrollDroppable:e});return{scroll:c=>{if(!(s().disabled||c.phase!=="DRAGGING")){if(c.movementMode==="FLUID"){a.scroll(c);return}c.scrollJumpRequest&&i(c)}},start:a.start,stop:a.stop}};const Mm="data-rfd",Dm=(()=>{const e=`${Mm}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),R5=(()=>{const e=`${Mm}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),T$e=(()=>{const e=`${Mm}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),IF={contextId:`${Mm}-scroll-container-context-id`},P$e=e=>t=>`[${t}="${e}"]`,dh=(e,t)=>e.map(n=>{const s=n.styles[t];return s?`${n.selector} { ${s} }`:""}).join(" "),O$e="pointer-events: none;";var I$e=e=>{const t=P$e(e),n=(()=>{const l=`
1648      cursor: -webkit-grab;
1649      cursor: grab;
1650    `;return{selector:t(Dm.contextId),styles:{always:`
1651          -webkit-touch-callout: none;
1652          -webkit-tap-highlight-color: rgba(0,0,0,0);
1653          touch-action: manipulation;
1654        `,resting:l,dragging:O$e,dropAnimating:l}}})(),s=(()=>{const l=`
1655      transition: ${Oh.outOfTheWay};
1656    `;return{selector:t(R5.contextId),styles:{dragging:l,dropAnimating:l,userCancel:l}}})(),a={selector:t(T$e.contextId),styles:{always:"overflow-anchor: none;"}},o=[s,n,a,{selector:"body",styles:{dragging:`
1657        cursor: grabbing;
1658        cursor: -webkit-grabbing;
1659        user-select: none;
1660        -webkit-user-select: none;
1661        -moz-user-select: none;
1662        -ms-user-select: none;
1663        overflow-anchor: none;
1664      `}}];return{always:dh(o,"always"),resting:dh(o,"resting"),dragging:dh(o,"dragging"),dropAnimating:dh(o,"dropAnimating"),userCancel:dh(o,"userCancel")}};const _a=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?h.useLayoutEffect:h.useEffect,Bk=()=>{const e=document.querySelector("head");return e||lt(),e},RF=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function R$e(e,t){const n=kn(()=>I$e(e),[e]),s=h.useRef(null),a=h.useRef(null),i=Dt(ts(m=>{const g=a.current;g||lt(),g.textContent=m}),[]),o=Dt(m=>{const g=s.current;g||lt(),g.textContent=m},[]);_a(()=>{!s.current&&!a.current||lt();const m=RF(t),g=RF(t);return s.current=m,a.current=g,m.setAttribute(`${Mm}-always`,e),g.setAttribute(`${Mm}-dynamic`,e),Bk().appendChild(m),Bk().appendChild(g),o(n.always),i(n.resting),()=>{const x=j=>{const b=j.current;b||lt(),Bk().removeChild(b),j.current=null};x(s),x(a)}},[t,o,i,n.always,n.resting,e]);const l=Dt(()=>i(n.dragging),[i,n.dragging]),c=Dt(m=>{if(m==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),d=Dt(()=>{a.current&&i(n.resting)},[i,n.resting]);return kn(()=>({dragging:l,dropping:c,resting:d}),[l,c,d])}function bY(e,t){return Array.from(e.querySelectorAll(t))}var vY=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function Vv(e){return e instanceof vY(e).HTMLElement}function M$e(e,t){const n=`[${Dm.contextId}="${e}"]`,s=bY(document,n);if(!s.length)return null;const a=s.find(i=>i.getAttribute(Dm.draggableId)===t);return!a||!Vv(a)?null:a}function D$e(e){const t=h.useRef({}),n=h.useRef(null),s=h.useRef(null),a=h.useRef(!1),i=Dt(function(g,x){const j={id:g,focus:x};return t.current[g]=j,function(){const y=t.current;y[g]!==j&&delete y[g]}},[]),o=Dt(function(g){const x=M$e(e,g);x&&x!==document.activeElement&&x.focus()},[e]),l=Dt(function(g,x){n.current===g&&(n.current=x)},[]),c=Dt(function(){s.current||a.current&&(s.current=requestAnimationFrame(()=>{s.current=null;const g=n.current;g&&o(g)}))}
1664,[o]),d=Dt(function(g){n.current=null;const x=document.activeElement;x&&x.getAttribute(Dm.draggableId)===g&&(n.current=g)},[]);return _a(()=>(a.current=!0,function(){a.current=!1;const g=s.current;g&&cancelAnimationFrame(g)}),[]),kn(()=>({register:i,tryRecordFocus:d,tryRestoreFocusRecorded:c,tryShiftRecord:l}),[i,d,c,l])}function L$e(){const e={draggables:{},droppables:{}},t=[];function n(m){return t.push(m),function(){const x=t.indexOf(m);x!==-1&&t.splice(x,1)}}function s(m){t.length&&t.forEach(g=>g(m))}function a(m){return e.draggables[m]||null}function i(m){const g=a(m);return g||lt(),g}const o={register:m=>{e.draggables[m.descriptor.id]=m,s({type:"ADDITION",value:m})},update:(m,g)=>{const x=e.draggables[g.descriptor.id];x&&x.uniqueId===m.uniqueId&&(delete e.draggables[g.descriptor.id],e.draggables[m.descriptor.id]=m)},unregister:m=>{const g=m.descriptor.id,x=a(g);x&&m.uniqueId===x.uniqueId&&(delete e.draggables[g],e.droppables[m.descriptor.droppableId]&&s({type:"REMOVAL",value:m}))},getById:i,findById:a,exists:m=>!!a(m),getAllByType:m=>Object.values(e.draggables).filter(g=>g.descriptor.type===m)};function l(m){return e.droppables[m]||null}function c(m){const g=l(m);return g||lt(),g}const d={register:m=>{e.droppables[m.descriptor.id]=m},unregister:m=>{const g=l(m.descriptor.id);g&&m.uniqueId===g.uniqueId&&delete e.droppables[m.descriptor.id]},getById:c,findById:l,exists:m=>!!l(m),getAllByType:m=>Object.values(e.droppables).filter(g=>g.descriptor.type===m)};function f(){e.draggables={},e.droppables={},t.length=0}return{draggable:o,droppable:d,subscribe:n,clean:f}}function $$e(){const e=kn(L$e,[]);return h.useEffect(()=>function(){e.clean()},[e]),e}var R3=xe.createContext(null),pb=()=>{const e=document.body;return e||lt(),e};const B$e={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},F$e=e=>`rfd-announcement-${e}`;function z$e(e){const t=kn(()=>F$e(e),[e]),n=h.useRef(null);return h.useEffect(function(){const i=document.createElement("div");return n.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),Py(i.style,B$e),pb().appendChild(i),function(){setTimeout(function(){const c=pb();c.contains(i)&&c.removeChild(i),i===n.current&&(n.current=null)})}},[t]),Dt(a=>{const i=n.current;if(i){i.textContent=a;return}},[])}const U$e={separator:"::"};function M3(e,t=U$e){const n=xe.useId();return kn(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function q$e({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function K$e({contextId:e,text:t}){const n=M3("hidden-text",{separator:"-"}),s=kn(()=>q$e({contextId:e,uniqueId:n}),[n,e]);return h.useEffect(function(){const i=document.createElement("div");return i.id=s,i.textContent=t,i.style.display="none",pb().appendChild(i),function(){const l=pb();l.contains(i)&&l.removeChild(i)}},[s,t]),s}var Hv=xe.createContext(null);function wY(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),t}function V$e(){let e=null;function t(){return!!e}function n(o){return o===e}function s(o){e&&lt();const l={abandon:o};return e=l,l}function a(){e||lt(),e=null}function i(){e&&(e.abandon(),a())}return{isClaimed:t,isActive:n,claim:s,release:a,tryAbandon:i}}function Lp(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const H$e=9,W$e=13,D3=27,jY=32,G$e=33,Y$e=34,J$e=35,Q$e=36,X$e=37,Z$e=38,e6e=39,t6e=40,n6e={[W$e]:!0,[H$e]:!0};var _Y=e=>{n6e[e.keyCode]&&e.preventDefault()};const Wv=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(s=>`on${s}`in document)||e})(),NY=0,MF=5;function r6e(e,t){return Math.abs(t.x-e.x)>=MF||Math.abs(t.y-e.y)>=MF}const DF={type:"IDLE"};function s6e({cancel:e,completed:t,getPhase:n,setPhase:s}){return[{eventName:"mousemove",fn:a=>{const{button:i,clientX:o,clientY:l}=a;if(i!==NY)return;const c={x:o,y:l},d=n();if(d.type==="DRAGGING"){a.preventDefault(),d.actions.move(c);return}d.type!=="PENDING"&&lt();const f=d.point;if(!r6e(f,c))return;a.preventDefault();const m=d.actions.fluidLift(c);s({type:"DRAGGING",actions:m})}},{eventName:"mouseup",fn:a=>{const i=n();if(i.type!=="DRAGGING"){e();return}a.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:a=>{n().type==="DRAGGING"&&a.preventDefault(),e()}},{eventName:"keydown",fn:a=>
1664{if(n().type==="PENDING"){e();return}if(a.keyCode===D3){a.preventDefault(),e();return}_Y(a)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:a=>{const i=n();if(i.type==="IDLE"&&lt(),i.actions.shouldRespectForcePress()){e();return}a.preventDefault()}},{eventName:Wv,fn:e}]}function a6e(e){const t=h.useRef(DF),n=h.useRef(tc),s=kn(()=>({eventName:"mousedown",fn:function(m){if(m.defaultPrevented||m.button!==NY||m.ctrlKey||m.metaKey||m.shiftKey||m.altKey)return;const g=e.findClosestDraggableId(m);if(!g)return;const x=e.tryGetLock(g,o,{sourceEvent:m});if(!x)return;m.preventDefault();const j={x:m.clientX,y:m.clientY};n.current(),d(x,j)}}),[e]),a=kn(()=>({eventName:"webkitmouseforcewillbegin",fn:f=>{if(f.defaultPrevented)return;const m=e.findClosestDraggableId(f);if(!m)return;const g=e.findOptionsForDraggable(m);g&&(g.shouldRespectForcePress||e.canGetLock(m)&&f.preventDefault())}}),[e]),i=Dt(function(){const m={passive:!1,capture:!0};n.current=Ga(window,[a,s],m)},[a,s]),o=Dt(()=>{t.current.type!=="IDLE"&&(t.current=DF,n.current(),i())},[i]),l=Dt(()=>{const f=t.current;o(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[o]),c=Dt(function(){const m={capture:!0,passive:!1},g=s6e({cancel:l,completed:o,getPhase:()=>t.current,setPhase:x=>{t.current=x}});n.current=Ga(window,g,m)},[l,o]),d=Dt(function(m,g){t.current.type!=="IDLE"&&lt(),t.current={type:"PENDING",point:g,actions:m},c()},[c]);_a(function(){return i(),function(){n.current()}},[i])}function i6e(){}const o6e={[Y$e]:!0,[G$e]:!0,[Q$e]:!0,[J$e]:!0};function l6e(e,t){function n(){t(),e.cancel()}function s(){t(),e.drop()}return[{eventName:"keydown",fn:a=>{if(a.keyCode===D3){a.preventDefault(),n();return}if(a.keyCode===jY){a.preventDefault(),s();return}if(a.keyCode===t6e){a.preventDefault(),e.moveDown();return}if(a.keyCode===Z$e){a.preventDefault(),e.moveUp();return}if(a.keyCode===e6e){a.preventDefault(),e.moveRight();return}if(a.keyCode===X$e){a.preventDefault(),e.moveLeft();return}if(o6e[a.keyCode]){a.preventDefault();return}_Y(a)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:Wv,fn:n}]}function c6e(e){const t=h.useRef(i6e),n=kn(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==jY)return;const o=e.findClosestDraggableId(i);if(!o)return;const l=e.tryGetLock(o,f,{sourceEvent:i});if(!l)return;i.preventDefault();let c=!0;const d=l.snapLift();t.current();function f(){c||lt(),c=!1,t.current(),s()}t.current=Ga(window,l6e(d,f),{capture:!0,passive:!1})}}),[e]),s=Dt(function(){const i={passive:!1,capture:!0};t.current=Ga(window,[n],i)},[n]);_a(function(){return s(),function(){t.current()}},[s])}const Fk={type:"IDLE"},d6e=120,u6e=.15;function m6e({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(t().type!=="DRAGGING"){e();return}n.keyCode===D3&&n.preventDefault(),e()}},{eventName:Wv,fn:e}]}function f6e({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:s=>{const a=n();if(a.type!=="DRAGGING"){e();return}a.hasMoved=!0;const{clientX:i,clientY:o}=s.touches[0],l={x:i,y:o};s.preventDefault(),a.actions.move(l)}},{eventName:"touchend",fn:s=>{const a=n();if(a.type!=="DRAGGING"){e();return}s.preventDefault(),a.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:s=>{if(n().type!=="DRAGGING"){e();return}s.preventDefault(),e()}},{eventName:"touchforcechange",fn:s=>{const a=n();a.type==="IDLE"&&lt();const i=s.touches[0];if(!i||!(i.force>=u6e))return;const l=a.actions.shouldRespectForcePress();if(a.type==="PENDING"){l&&e();return}if(l){if(a.hasMoved){s.preventDefault();return}e();return}s.preventDefault()}},{eventName:Wv,fn:e}]}function h6e(e){const t=h.useRef(Fk),n=h.useRef(tc),s=Dt(function(){return t.current},[]),a=Dt(function(x){t.current=x},[]),i=kn(()=>({eventName:"touchstart",fn:function(x){if(x.defaultPrevented)return;const j=e.findClosestDraggableId(x);if(!j)return;const b=e.tryGetLock(j,l,{sourceEvent:x});if(!b)return;const y=x.touches[0],{clientX:w,clientY:_}=y,N={x:w,y:_};n.current(),m(b,N)}}),[e]),o=Dt(function(){const x={capture:!0,passive:!1};n.current=Ga(window,[i],x)},[i]),l=Dt(()=>{const g=t.current;g.type!=="IDLE"&&(g.type==="PENDING"&&clearTimeout(g.longPressTimerId),a(Fk),n.current(),o())},[o,a]),c=Dt(()=>{const g=t.current;l(),g.type==="DRAGGING"&&g.actions.cancel({shouldBlockNextClick:!0}),g.type==="PENDING"&&g.actions.abort()},[l]),d=Dt(function(){const x={capture:!0,passive:!1},j={cancel:c,completed:l,getPhase:s},b=Ga(window,f6e(j),x),y=Ga(window,m6e(j),x);n.current=function(){b(),y()}},[c,s,l]),f=Dt(function(){const x=s();x.type!=="PENDING"&&lt();const j=x.actions.fluidLift(x.point);a({type:"DRAGGING",actions:j,hasMoved:!1})},[s,a]),m=Dt(function(x,j){s().type!=="IDLE"&&lt();const b=setTimeout(f,d6e);a({type:"PENDING",point:j,actions:x,longPressTimerId:b}),d()},[d,s,a,f]);_a(function(){return o(),function(){n.current();const j=s();j.type==="PENDING"&&(clearTimeout(j.longPressTimerId),a(Fk))}},[s,o,a]),_a(function(){return Ga(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const p6e=["input","button","textarea","select","option","optgroup","video","audio"];function SY(e,t){if(t==null)return!1;if(p6e.includes(t.tagName.toLowerCase()))return!0;const s=t.getAttribute("contenteditable");return s==="true"||s===""?!0:t===e?!1:SY(e,t.parentElement)}function g6e(e,t){const n=t.target;return Vv(n)?SY(e,n):!1}var x6e=e=>ki(e.getBoundingClientRect()).center;function y6e(e){return e instanceof vY(e).Element}const b6e=(()=>{const e="matches";return typeof document>
1664"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(s=>s in Element.prototype)||e})();function kY(e,t){return e==null?null:e[b6e](t)?e:kY(e.parentElement,t)}function v6e(e,t){return e.closest?e.closest(t):kY(e,t)}function w6e(e){return`[${Dm.contextId}="${e}"]`}function j6e(e,t){const n=t.target;if(!y6e(n))return null;const s=w6e(e),a=v6e(n,s);return!a||!Vv(a)?null:a}function _6e(e,t){const n=j6e(e,t);return n?n.getAttribute(Dm.draggableId):null}function N6e(e,t){const n=`[${R5.contextId}="${e}"]`,a=bY(document,n).find(i=>i.getAttribute(R5.id)===t);return!a||!Vv(a)?null:a}function S6e(e){e.preventDefault()}function m0({expected:e,phase:t,isLockActive:n,shouldWarn:s}){return!(!n()||e!==t)}function CY({lockAPI:e,store:t,registry:n,draggableId:s}){if(e.isClaimed())return!1;const a=n.draggable.findById(s);return!(!a||!a.options.isEnabled||!pY(t.getState(),s))}function k6e({lockAPI:e,contextId:t,store:n,registry:s,draggableId:a,forceSensorStop:i,sourceEvent:o}){if(!CY({lockAPI:e,store:n,registry:s,draggableId:a}))return null;const c=s.draggable.getById(a),d=N6e(t,c.descriptor.id);if(!d||o&&!c.options.canDragInteractiveElements&&g6e(d,o))return null;const f=e.claim(i||tc);let m="PRE_DRAG";function g(){return c.options.shouldRespectForcePress}function x(){return e.isActive(f)}function j(k,S){m0({expected:k,phase:m,isLockActive:x,shouldWarn:!0})&&n.dispatch(S())}const b=j.bind(null,"DRAGGING");function y(k){function S(){e.release(),m="COMPLETED"}m!=="PRE_DRAG"&&(S(),lt()),n.dispatch(vLe(k.liftActionArgs)),m="DRAGGING";function A(T,R={shouldBlockNextClick:!1}){if(k.cleanup(),R.shouldBlockNextClick){const B=Ga(window,[{eventName:"click",fn:S6e,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(B)}S(),n.dispatch(oY({reason:T}))}return{isActive:()=>m0({expected:"DRAGGING",phase:m,isLockActive:x,shouldWarn:!1}),shouldRespectForcePress:g,drop:T=>A("DROP",T),cancel:T=>A("CANCEL",T),...k.actions}}function w(k){const S=Pp(T=>{b(()=>iY({client:T}))});return{...y({liftActionArgs:{id:a,clientSelection:k,movementMode:"FLUID"},cleanup:()=>S.cancel(),actions:{move:S}}),move:S}}function _(){const k={moveUp:()=>b(ALe),moveRight:()=>b(PLe),moveDown:()=>b(TLe),moveLeft:()=>b(OLe)};return y({liftActionArgs:{id:a,clientSelection:x6e(d),movementMode:"SNAP"},cleanup:tc,actions:k})}function N(){m0({expected:"PRE_DRAG",phase:m,isLockActive:x,shouldWarn:!0})&&e.release()}return{isActive:()=>m0({expected:"PRE_DRAG",phase:m,isLockActive:x,shouldWarn:!1}),shouldRespectForcePress:g,fluidLift:w,snapLift:_,abort:N}}const C6e=[a6e,c6e,h6e];function E6e({contextId:e,store:t,registry:n,customSensors:s,enableDefaultSensors:a}){const i=[...a?C6e:[],...s||[]],o=h.useState(()=>V$e())[0],l=Dt(function(y,w){Lp(y)&&!Lp(w)&&o.tryAbandon()},[o]);_a(function(){let y=t.getState();return t.subscribe(()=>{const _=t.getState();l(y,_),y=_})},[o,t,l]),_a(()=>o.tryAbandon,[o.tryAbandon]);const c=Dt(b=>CY({lockAPI:o,registry:n,store:t,draggableId:b}),[o,n,t]),d=Dt((b,y,w)=>k6e({lockAPI:o,registry:n,contextId:e,store:t,draggableId:b,forceSensorStop:y||null,sourceEvent:w&&w.sourceEvent?w.sourceEvent:null}),[e,o,n,t]),f=Dt(b=>_6e(e,b),[e]),m=Dt(b=>{const y=n.draggable.findById(b);return y?y.options:null},[n.draggable]),g=Dt(function(){o.isClaimed()&&(o.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(C3()))},[o,t]),x=Dt(()=>o.isClaimed(),[o]),j=kn(()=>({canGetLock:c,tryGetLock:d,findClosestDraggableId:f,findOptionsForDraggable:m,tryReleaseLock:g,isLockClaimed:x}),[c,d,f,m,g,x]);for(let b=0;b<i.length;b++)i[b](j)}const A6e=e=>({onBeforeCapture:t=>{const n=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};fc.flushSync(n)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),T6e=e=>({...Dp,...e.autoScrollerOptions,durationDampening:{...Dp.durationDampening,...e.autoScrollerOptions}});function uh(e){return e.current||lt(),e.current}function P6e(e){const{contextId:t,setCallbacks:n,sensors:s,nonce:a,dragHandleUsageInstructions:i}=e,o=h.useRef(null),l=wY(e),c=Dt(()=>A6e(l.current),[l]),d=Dt(()=>T6e(l.current),[l]),f=z$e(t),m=K$e({contextId:t,text:i}),g=R$e(t,a),x=Dt(B=>{uh(o).dispatch(B)},[]),j=kn(()=>oF({publishWhileDragging:jLe,updateDroppableScroll:NLe,updateDroppableIsEnabled:SLe,updateDroppableIsCombine
1664Enabled:kLe,collectionStarting:_Le},x),[x]),b=$$e(),y=kn(()=>m$e(b,j),[b,j]),w=kn(()=>A$e({scrollWindow:f$e,scrollDroppable:y.scrollDroppable,getAutoScrollerOptions:d,...oF({move:iY},x)}),[y.scrollDroppable,x,d]),_=D$e(t),N=kn(()=>l$e({announce:f,autoScroller:w,dimensionMarshal:y,focusMarshal:_,getResponders:c,styleMarshal:g}),[f,w,y,_,c,g]);o.current=N;const C=Dt(()=>{const B=uh(o);B.getState().phase!=="IDLE"&&B.dispatch(C3())},[]),k=Dt(()=>{const B=uh(o).getState();return B.phase==="DROP_ANIMATING"?!0:B.phase==="IDLE"?!1:B.isDragging},[]),S=kn(()=>({isDragging:k,tryAbort:C}),[k,C]);n(S);const A=Dt(B=>pY(uh(o).getState(),B),[]),T=Dt(()=>Zc(uh(o).getState()),[]),R=kn(()=>({marshal:y,focus:_,contextId:t,canLift:A,isMovementAllowed:T,dragHandleUsageInstructionsId:m,registry:b}),[t,y,m,_,A,T,b]);return E6e({contextId:t,store:N,registry:b,customSensors:s||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),h.useEffect(()=>C,[C]),xe.createElement(Hv.Provider,{value:R},xe.createElement(tDe,{context:R3,store:N},e.children))}function O6e(){return xe.useId()}function I6e(e){const t=O6e(),n=e.dragHandleUsageInstructions||T0.dragHandleUsageInstructions;return xe.createElement(dDe,null,s=>xe.createElement(P6e,{nonce:e.nonce,contextId:t,setCallbacks:s,dragHandleUsageInstructions:n,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const LF={dragging:5e3,dropAnimating:4500},R6e=(e,t)=>t?Oh.drop(t.duration):e?Oh.snap:Oh.fluid,M6e=(e,t)=>{if(e)return t?Mp.opacity.drop:Mp.opacity.combining},D6e=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function L6e(e){const n=e.dimension.client,{offset:s,combineWith:a,dropping:i}=e,o=!!a,l=D6e(e),c=!!i,d=c?O5.drop(s,o):O5.moveTo(s);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:R6e(l,i),transform:d,opacity:M6e(o,c),zIndex:c?LF.dropAnimating:LF.dragging,pointerEvents:"none"}}function $6e(e){return{transform:O5.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function B6e(e){return e.type==="DRAGGING"?L6e(e):$6e(e)}function F6e(e,t,n=rs){const s=window.getComputedStyle(t),a=t.getBoundingClientRect(),i=MG(a,s),o=ub(i,n),l={client:i,tagName:t.tagName.toLowerCase(),display:s.display},c={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:e,placeholder:l,displaceBy:c,client:i,page:o}}function z6e(e){const t=M3("draggable"),{descriptor:n,registry:s,getDraggableRef:a,canDragInteractiveElements:i,shouldRespectForcePress:o,isEnabled:l}=e,c=kn(()=>({canDragInteractiveElements:i,shouldRespectForcePress:o,isEnabled:l}),[i,l,o]),d=Dt(x=>{const j=a();return j||lt(),F6e(n,j,x)},[n,a]),f=kn(()=>({uniqueId:t,descriptor:n,options:c,getDimension:d}),[n,d,c,t]),m=h.useRef(f),g=h.useRef(!0);_a(()=>(s.draggable.register(m.current),()=>s.draggable.unregister(m.current)),[s.draggable]),_a(()=>{if(g.current){g.current=!1;return}const x=m.current;m.current=f,s.draggable.update(f,x)},[f,s.draggable])}var L3=xe.createContext(null);function gb(e){const t=h.useContext(e);return t||lt(),t}function U6e(e){e.preventDefault()}const q6e=e=>{const t=h.useRef(null),n=Dt((S=null)=>{t.current=S},[]),s=Dt(()=>t.current,[]),{contextId:a,dragHandleUsageInstructionsId:i,registry:o}=gb(Hv),{type:l,droppableId:c}=gb(L3),d=kn(()=>({id:e.draggableId,index:e.index,type:l,droppableId:c}),[e.draggableId,e.index,l,c]),{children:f,draggableId:m,isEnabled:g,shouldRespectForcePress:x,canDragInteractiveElements:j,isClone:b,mapped:y,dropAnimationFinished:w}=e;if(!b){const S=kn(()=>({descriptor:d,registry:o,getDraggableRef:s,canDragInteractiveElements:j,shouldRespectForcePress:x,isEnabled:g}),[d,o,s,j,x,g]);z6e(S)}const _=kn(()=>g?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":m,"data-rfd-drag-handle-context-id":a,draggable:!1,onDragStart:U6e}:null,[a,i,m,g]),N=Dt(S=>{y.type==="DRAGGING"&&y.dropping&&S.propertyName==="transform"&&fc.flushSync(w)},[w,y]),C=kn(()=>{const S=B6e(y),A=y.type==="DRAGGING"&&y.dropping?N:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":a,"data-rfd-draggable-id":m,style:S,onTransitionEnd:A},dragHandleProps:_}},[a,_,m,y,N,n]),k=kn(()=>({draggableId:d.id,type:d.type,source:{index:d.index,droppableId:d.droppableId}}),[d.droppableId,d.id,d.index,d.type]);return xe.createElement(xe.Fragment,null,f(C,y.snapshot,k))};var EY=(e,t)=>e===t,AY=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const K6e=e=>e.combine?e.combine.draggableId:null,V6e=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function H6e(){const e=ts((a,i)=>({x:a,y:i})),t=ts((a,i,o=null,l=null,c=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!c,dropAnimation:c,mode:a,draggingOver:o,combineWith:l,combineTargetFor:null})),n=ts((a,i,o,l,c=null,d=null,f=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:c,combineWith:d,mode:i,offset:a,dimension:o,forceShouldAnimate:f,snapshot:t(i,l,c,d,null)}}));return(a,i)=>{if(Lp(a)){if(a.critical.draggable.id!==i.draggableId)return null;const o=a.current.client.offset,l=a.dimensions.draggables[i.draggableId],c=ja(a.impact),d=V6e(a.impact),f=a.forceShouldAnimate;return n(e(o.x,o.y),a.movementMode,l,i.isClone,c,d,f)}if(a.phase==="DROP_ANIMATING"){const o=a.completed;if(o.result.draggableId!==i.draggableId)return null;const l=i.isClone,c=a.dimensions.draggables[i.draggableId],d=o.result,f=d.mode,m=AY(d),g=K6e(d),j={duration:a.dropDuration,curve:A3.drop,moveTo:a.newHomeClientOffset,opacity:g?Mp.opacity.drop:null,
1664scale:g?Mp.scale.drop:null};return{mapped:{type:"DRAGGING",offset:a.newHomeClientOffset,dimension:c,dropping:j,draggingOver:m,combineWith:g,mode:f,forceShouldAnimate:null,snapshot:t(f,l,m,g,j)}}}return null}}function TY(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const W6e={mapped:{type:"SECONDARY",offset:rs,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:TY(null)}};function G6e(){const e=ts((o,l)=>({x:o,y:l})),t=ts(TY),n=ts((o,l=null,c)=>({mapped:{type:"SECONDARY",offset:o,combineTargetFor:l,shouldAnimateDisplacement:c,snapshot:t(l)}})),s=o=>o?n(rs,o,!0):null,a=(o,l,c,d)=>{const f=c.displaced.visible[o],m=!!(d.inVirtualList&&d.effected[o]),g=Uv(c),x=g&&g.draggableId===o?l:null;if(!f){if(!m)return s(x);if(c.displaced.invisible[o])return null;const y=of(d.displacedBy.point),w=e(y.x,y.y);return n(w,x,!0)}if(m)return s(x);const j=c.displacedBy.point,b=e(j.x,j.y);return n(b,x,f.shouldAnimate)};return(o,l)=>{if(Lp(o))return o.critical.draggable.id===l.draggableId?null:a(l.draggableId,o.critical.draggable.id,o.impact,o.afterCritical);if(o.phase==="DROP_ANIMATING"){const c=o.completed;return c.result.draggableId===l.draggableId?null:a(l.draggableId,c.result.draggableId,c.impact,c.afterCritical)}return null}}const Y6e=()=>{const e=H6e(),t=G6e();return(s,a)=>e(s,a)||t(s,a)||W6e},J6e={dropAnimationFinished:lY},Q6e=IG(Y6e,J6e,null,{context:R3,areStatePropsEqual:EY})(q6e);function PY(e){return gb(L3).isUsingCloneFor===e.draggableId&&!e.isClone?null:xe.createElement(Q6e,e)}function X6e(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,s=!!e.shouldRespectForcePress;return xe.createElement(PY,Py({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:s}))}const OY=e=>t=>e===t,Z6e=OY("scroll"),eBe=OY("auto"),$F=(e,t)=>t(e.overflowX)||t(e.overflowY),tBe=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return $F(n,Z6e)||$F(n,eBe)},nBe=()=>!1,IY=e=>e==null?null:e===document.body?nBe()?e:null:e===document.documentElement?null:tBe(e)?e:IY(e.parentElement);var M5=e=>({x:e.scrollLeft,y:e.scrollTop});const RY=e=>e?window.getComputedStyle(e).position==="fixed"?!0:RY(e.parentElement):!1;var rBe=e=>{const t=IY(e),n=RY(e);return{closestScrollable:t,isFixedOnPage:n}},sBe=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:s,direction:a,client:i,page:o,closest:l})=>{const c=(()=>{if(!l)return null;const{scrollSize:g,client:x}=l,j=mY({scrollHeight:g.scrollHeight,scrollWidth:g.scrollWidth,height:x.paddingBox.height,width:x.paddingBox.width});return{pageMarginBox:l.page.marginBox,frameClient:x,scrollSize:g,shouldClipSubject:l.shouldClipSubject,scroll:{initial:l.scroll,current:l.scroll,max:j,diff:{value:rs,displacement:rs}}}})(),d=a==="vertical"?j3:VG,f=Rm({page:o,withPlaceholder:null,axis:d,frame:c});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:s,axis:d,isEnabled:t,client:i,page:o,frame:c,subject:f}};const aBe=(e,t)=>{const n=DG(e);if(!t||e!==t)return n;const s=n.paddingBox.top-t.scrollTop,a=n.paddingBox.left-t.scrollLeft,i=s+t.scrollHeight,o=a+t.scrollWidth,c=y3({top:s,right:o,bottom:i,left:a},n.border);return b3({borderBox:c,margin:n.margin,border:n.border,padding:n.padding})};var iBe=({ref:e,descriptor:t,env:n,windowScroll:s,direction:a,isDropDisabled:i,isCombineEnabled:o,shouldClipSubject:l})=>{const c=n.closestScrollable,d=aBe(e,c),f=ub(d,s),m=(()=>{if(!c)return null;const x=DG(c),j={scrollHeight:c.scrollHeight,scrollWidth:c.scrollWidth};return{client:x,page:ub(x,s),scroll:M5(c),scrollSize:j,shouldClipSubject:l}})();return sBe({descriptor:t,isEnabled:!i,isCombineEnabled:o,isFixedOnPage:n.isFixedOnPage,direction:a,client:d,page:f,closest:m})};const oBe={passive:!1},lBe={passive:!0};var BF=e=>e.shouldPublishImmediately?oBe:lBe;const f0=e=>e&&e.env.closestScrollable||null;function cBe(e){const t=h.useRef(null),n=gb(Hv),s=M3("droppable"),{registry:a,marshal:i}=n,o=wY(e),l=kn(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),c=h.useRef(l),d=kn(()=>ts((C,k)=>{t.current||lt();const S={x:C,y:k};i.updateDroppableScroll(l.id,S)}),[l.id,i]),f=Dt(()=>{const C=t.current;return!C||!C.env.closestScrollable?rs:M5(C.env.closestScrollable)},[]),m=Dt(()=>{const C=f();d(C.x,C.y)},[f,d]),g=kn(()=>Pp(m),[m]),x=Dt(()=>{const C=t.current,k=f0(C);if(C&&k||lt(),C.scrollOptions.shouldPublishImmediately){m();return}g()},[g,m]),j=Dt((C,k)=>{t.current&&lt();const S=o.current,A=S.getDroppableRef();A||lt();const T=rBe(A),R={ref:A,descriptor:l,env:T,scrollOptions:k};t.current=R;const B=iBe({ref:A,descriptor:l,env:T,windowScroll:C,direction:S.direction,isDropDisabled:S.isDropDisabled,isCombine
1664Enabled:S.isCombineEnabled,shouldClipSubject:!S.ignoreContainerClipping}),D=T.closestScrollable;return D&&(D.setAttribute(IF.contextId,n.contextId),D.addEventListener("scroll",x,BF(R.scrollOptions))),B},[n.contextId,l,x,o]),b=Dt(()=>{const C=t.current,k=f0(C);return C&&k||lt(),M5(k)},[]),y=Dt(()=>{const C=t.current;C||lt();const k=f0(C);t.current=null,k&&(g.cancel(),k.removeAttribute(IF.contextId),k.removeEventListener("scroll",x,BF(C.scrollOptions)))},[x,g]),w=Dt(C=>{const k=t.current;k||lt();const S=f0(k);S||lt(),S.scrollTop+=C.y,S.scrollLeft+=C.x},[]),_=kn(()=>({getDimensionAndWatchScroll:j,getScrollWhileDragging:b,dragStopped:y,scroll:w}),[y,j,b,w]),N=kn(()=>({uniqueId:s,descriptor:l,callbacks:_}),[_,l,s]);_a(()=>(c.current=N.descriptor,a.droppable.register(N),()=>{t.current&&y(),a.droppable.unregister(N)}),[_,l,y,N,i,a.droppable]),_a(()=>{t.current&&i.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),_a(()=>{t.current&&i.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function zk(){}const FF={width:0,height:0,margin:gDe},dBe=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?FF:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},uBe=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const s=dBe({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:s.width,height:s.height,marginTop:s.margin.top,marginRight:s.margin.right,marginBottom:s.margin.bottom,marginLeft:s.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Oh.placeholder:null}},mBe=e=>{const t=h.useRef(null),n=Dt(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:s,onTransitionEnd:a,onClose:i,contextId:o}=e,[l,c]=h.useState(e.animate==="open");h.useEffect(()=>l?s!=="open"?(n(),c(!1),zk):t.current?zk:(t.current=setTimeout(()=>{t.current=null,c(!1)}),n):zk,[s,l,n]);const d=Dt(m=>{m.propertyName==="height"&&(a(),s==="close"&&i())},[s,i,a]),f=uBe({isAnimatingOpenOnMount:l,animate:e.animate,placeholder:e.placeholder});return xe.createElement(e.placeholder.tagName,{style:f,"data-rfd-placeholder-context-id":o,onTransitionEnd:d,ref:e.innerRef})};var fBe=xe.memo(mBe);class hBe extends xe.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const pBe=e=>{const t=h.useContext(Hv);t||lt();const{contextId:n,isMovementAllowed:s}=t,a=h.useRef(null),i=h.useRef(null),{children:o,droppableId:l,type:c,mode:d,direction:f,ignoreContainerClipping:m,isDropDisabled:g,isCombineEnabled:x,snapshot:j,useClone:b,updateViewportMaxScroll:y,getContainerForClone:w}=e,_=Dt(()=>a.current,[]),N=Dt((D=null)=>{a.current=D},[]);Dt(()=>i.current,[]);const C=Dt((D=null)=>{i.current=D},[]),k=Dt(()=>{s()&&y({maxScroll:hY()})},[s,y]);cBe({droppableId:l,type:c,mode:d,direction:f,isDropDisabled:g,isCombineEnabled:x,ignoreContainerClipping:m,getDroppableRef:_});const S=kn(()=>xe.createElement(hBe,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:D,data:P,animate:I})=>xe.createElement(fBe,{placeholder:P,onClose:D,innerRef:C,animate:I,contextId:n,onTransitionEnd:k})),[n,k,e.placeholder,e.shouldAnimatePlaceholder,C]),A=kn(()=>({innerRef:N,placeholder:S,droppableProps:{"data-rfd-droppable-id":l,"data-rfd-droppable-context-id":n}}),[n,l,S,N]),T=b?b.dragging.draggableId:null,R=kn(()=>({droppableId:l,type:c,isUsingCloneFor:T}),[l,T,c]);function B(){if(!b)return null;const{dragging:D,render:P}=b,I=xe.createElement(PY,{draggableId:D.draggableId,index:D.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(z,L)=>P(z,L,D));return bz.createPortal(I,w())}return xe.createElement(L3.Provider,{value:R},o(A,j),B())};function gBe(){return document.body||lt(),document.body}const zF={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombine
1664Enabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:gBe},MY=e=>{let t={...e},n;for(n in zF)e[n]===void 0&&(t={...t,[n]:zF[n]});return t},Uk=(e,t)=>e===t.droppable.type,UF=(e,t)=>t.draggables[e.draggable.id],xBe=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=ts(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),s=ts((i,o,l,c,d,f)=>{const m=d.descriptor.id;if(d.descriptor.droppableId===i){const j=f?{render:f,dragging:n(d.descriptor)}:null,b={isDraggingOver:l,draggingOverWith:l?m:null,draggingFromThisWith:m,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!1,snapshot:b,useClone:j}}if(!o)return t;if(!c)return e;const x={isDraggingOver:l,draggingOverWith:m,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!0,snapshot:x,useClone:null}});return(i,o)=>{const l=MY(o),c=l.droppableId,d=l.type,f=!l.isDropDisabled,m=l.renderClone;if(Lp(i)){const g=i.critical;if(!Uk(d,g))return t;const x=UF(g,i.dimensions),j=ja(i.impact)===c;return s(c,f,j,j,x,m)}if(i.phase==="DROP_ANIMATING"){const g=i.completed;if(!Uk(d,g.critical))return t;const x=UF(g.critical,i.dimensions);return s(c,f,AY(g.result)===c,ja(g.impact)===c,x,m)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const g=i.completed;if(!Uk(d,g.critical))return t;const x=ja(g.impact)===c,j=!!(g.impact.at&&g.impact.at.type==="COMBINE"),b=g.critical.droppable.id===c;return x?j?e:t:b?e:t}return t}},yBe={updateViewportMaxScroll:ELe},bBe=IG(xBe,yBe,(e,t,n)=>({...MY(n),...e,...t}),{context:R3,areStatePropsEqual:EY})(pBe);var vBe=bBe;const wBe={pass:{icon:mr,color:"text-emerald-500",bg:"bg-emerald-50 border-emerald-200",label:"Pass"},fail:{icon:sc,color:"text-red-500",bg:"bg-red-50 border-red-200",label:"Fail"},partial:{icon:Gp,color:"text-amber-500",bg:"bg-amber-50 border-amber-200",label:"Partial"},error:{icon:fr,color:"text-gray-400",bg:"bg-gray-50 border-gray-200",label:"Error"},running:{icon:Pe,color:"text-indigo-400",bg:"bg-indigo-50 border-indigo-200",label:"Running…"}};function jBe({verdict:e}){const t=wBe[e]||{},n=t.icon;return n?r.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${t.bg} ${t.color}`,children:[r.jsx(n,{className:`w-3 h-3 ${e==="running"?"animate-spin":""}`}),t.label]}):r.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-200"})}function _Be({tc:e,onClose:t}){const[n,s]=h.useState([]),[a,i]=h.useState(!0);return h.useEffect(()=>{Y.entities.IssueReport.filter({linked_test_case_id:e.id},"-reported_at").then(o=>{s(o),i(!1)}).catch(()=>i(!1))},[e.id]),r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:t,children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-lg mx-4 p-5 space-y-4 max-h-[80vh] flex flex-col",onClick:o=>o.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[r.jsxs("h3",{className:"font-semibold text-gray-800",children:["Linked Issues — ",e.name]}),r.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"flex-1 overflow-y-auto space-y-2",children:a?r.jsx("p",{className:"text-sm text-gray-400 text-center py-6",children:"Loading…"}):n.length===0?r.jsx("p",{className:"text-sm text-gray-400 text-center py-6",children:"No linked issues for this test case."}):n.map(o=>r.jsxs("button",{onClick:()=>window.open(yt(`IssueReports?highlight=${o.id}`),"_blank"),className:"w-full text-left border border-amber-200 bg-amber-50 hover:bg-amber-100 rounded-xl px-4 py-3 space-y-1 transition-colors group",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("p",{className:"text-sm font-medium text-gray-800 truncate flex-1",children:o.query}),r.jsx(yr,{className:"w-3.5 h-3.5 text-amber-400 group-hover:text-amber-600 shrink-0 mt-0.5"})]}),r.jsxs("p",{className:"text-xs text-gray-500",children:[o.reporter_name||"Anonymous"," · ",new Date(o.reported_at).toLocaleStr
1664ing()," · ",o.assistant_name||o.assistant_key||"—"]}),r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full border font-medium ${o.status==="open"?"bg-red-100 text-red-700 border-red-200":o.status==="in_review"?"bg-amber-100 text-amber-700 border-amber-200":o.status==="resolved"?"bg-emerald-100 text-emerald-700 border-emerald-200":"bg-gray-100 text-gray-500 border-gray-200"}`,children:o.status})]},o.id))})]})})}function NBe({testSet:e,assistants:t,onSave:n}){const[s,a]=h.useState(!1),[i,o]=h.useState({target_assistant_id:e.target_assistant_id||"",evaluator_assistant_id:e.evaluator_assistant_id||"",response_nodes:e.response_nodes||[],default_assistant_mode:e.default_assistant_mode||"",default_source_page_method:e.default_source_page_method||"",default_source_page_url:e.default_source_page_url||"",default_source_kb_item_id:e.default_source_kb_item_id||"",default_source_page_content:e.default_source_page_content||"",default_user_selected_language:e.default_user_selected_language||""}),[l,c]=h.useState(""),[d,f]=h.useState(!1),[m,g]=h.useState("");h.useEffect(()=>{const k=i.default_source_kb_item_id;if(!k){g("");return}let S=!0;return(async()=>{var T;const A=await Y.entities.KnowledgeItem.filter({id:k},"title",1);S&&g(((T=A[0])==null?void 0:T.title)||"")})(),()=>{S=!1}},[i.default_source_kb_item_id]);async function x(){f(!0);const k={...i,default_assistant_mode:i.default_assistant_mode||null,default_source_page_method:i.default_source_page_method||null,default_source_page_url:i.default_source_page_url||null,default_source_kb_item_id:i.default_source_kb_item_id||null,default_source_page_content:i.default_source_page_content||null,default_user_selected_language:i.default_user_selected_language||null};await Y.entities.TestSet.update(e.id,k),await n(k),f(!1),a(!1)}function j(){const k=l.trim();!k||i.response_nodes.includes(k)||(o(S=>({...S,response_nodes:[...S.response_nodes,k]})),c(""))}function b(k){o(S=>({...S,response_nodes:S.response_nodes.filter(A=>A!==k)}))}const y=t.find(k=>k.id===(i.target_assistant_id||e.target_assistant_id)),w=t.find(k=>k.id===(i.evaluator_assistant_id||e.evaluator_assistant_id)),_=y==null?void 0:y.name,N=w==null?void 0:w.name;function C(k){k&&window.open(yt(`AssistantForm?id=${k}`),"_blank")}return r.jsxs("div",{className:"border rounded-xl overflow-hidden bg-white",children:[r.jsxs("button",{onClick:()=>a(k=>!k),className:"w-full flex items-center justify-between px-4 py-3 text-sm hover:bg-gray-50 transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(Zp,{className:"w-4 h-4 text-gray-400 shrink-0"}),r.jsx("span",{className:"font-medium text-gray-700",children:"Default Settings"}),r.jsxs("div",{className:"flex gap-1.5 flex-wrap ml-1",children:[_&&r.jsxs("span",{className:"text-xs bg-indigo-50 text-indigo-700 border border-indigo-100 px-2 py-0.5 rounded-full",children:["Target: ",_]}),N&&r.jsxs("span",{className:"text-xs bg-violet-50 text-violet-700 border border-violet-100 px-2 py-0.5 rounded-full",children:["Eval: ",N]}),i.response_nodes.length>0&&r.jsxs("span",{className:"text-xs bg-teal-50 text-teal-700 border border-teal-100 px-2 py-0.5 rounded-full",children:[i.response_nodes.length," nodes"]}),r.jsx("span",{className:"text-xs bg-sky-50 text-sky-700 border border-sky-100 px-2 py-0.5 rounded-full",children:Fv({assistant_mode:i.default_assistant_mode,source_page_method:i.default_source_page_method,source_page_url:i.default_source_page_url,source_kb_item_name:m})}),!_&&!N&&i.response_nodes.length===0&&r.jsx("span",{className:"text-xs text-amber-600 italic",children:"Not configured"})]})]}),s?r.jsx(gt,{className:"w-4 h-4 text-gray-400 shrink-0"}):r.jsx(en,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s&&r.jsxs("div",{className:"border-t p-4 space-y-4 bg-gray-50",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Default Target Assistant"}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsxs("select",{className:"flex-1 border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:i.target_assistant_id,onChange:k=>o(S=>({...S,target_assistant_id:k.target.value})),children:[r.jsx("option",{value:"",children:"— Not set —"}),t.map(k=>r.jsx("option",{value:k.id,children:k.name},k.id))]}),i.target_assistant_id&&r.jsx("button",{onClick:()=>C(i.target_assistant_id),className:"p-2 border rounded-lg text-gray-400 hover:text-indigo-600 hover:border-indigo-300 transition-colors bg-white",title:"Open assistant",children:r.jsx(yr,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Default Evaluator Assistant"}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsxs("select",{className:"flex-1 border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:i.evaluator_assistant_id,onChange:k=>o(S=>({...S,evaluator_assistant_id:k.target.value})),children:[r.jsx("option",{value:"",children:"— Not set —"}),t.map(k=>r.jsx("option",{value:k.id,children:k.name},k.id))]}),i.evaluator_assistant_id&&r.jsx("button",{onClick:()=>C(i.evaluator_assistant_id),className:"p-2 border rounded-lg text-gray-400 hover:text-indigo-600 hover:border-indigo-300 transition-colors bg-white",title:"Open assistant",children:r.jsx(yr,{className:"w-3.5 h-3.5"})})]}),r.jsx("p",{className:"text-[10px] text-gray-400 mt-1",children:"The evaluator assistant must return this JSON structure:"}),r.jsx("pre",{className:"text-[10px] font-mono bg-gray-900 text-emerald-300 rounded-lg px-3 py-2 overflow-auto",children:'{ "nodes": [{ "node": "string", "verdict": "pass|fail|partial", "score": 0-100, "reasoning": "string" }] }'})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Default JSON Response Nodes"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Node names inherited by all test cases for per-node analysis."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:"flex-1 border rounded-lg px-3 py-2 text-xs font-mono bg-white outline-none focus:border-teal-400",value:l,onCh
1664ange:k=>c(k.target.value),onKeyDown:k=>k.key==="Enter"&&j(),placeholder:"e.g. answer, score, category"}),r.jsxs(de,{size:"sm",variant:"outline",onClick:j,disabled:!l.trim(),className:"gap-1.5",children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," Add Node"]})]}),i.response_nodes.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.response_nodes.map(k=>r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-mono bg-teal-50 text-teal-700 border border-teal-200 px-2 py-0.5 rounded-lg",children:[k,r.jsx("button",{type:"button",onClick:()=>b(k),className:"hover:text-red-500 transition-colors",children:r.jsx(jt,{className:"w-2.5 h-2.5"})})]},k))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Default Answer Source Scenario"}),r.jsx("p",{className:"text-xs text-gray-400",children:"Inherited by all test cases that don't override it."}),r.jsx(SG,{value:{assistant_mode:i.default_assistant_mode||"LIBRARY",source_page_method:i.default_source_page_method||"kb_item",source_page_url:i.default_source_page_url||null,source_kb_item_id:i.default_source_kb_item_id||null,source_page_content:i.default_source_page_content||null,user_selected_language:i.default_user_selected_language||null},onChange:k=>o(S=>({...S,default_assistant_mode:k.assistant_mode||"",default_source_page_method:k.source_page_method||"",default_source_page_url:k.source_page_url||"",default_source_kb_item_id:k.source_kb_item_id||"",default_source_page_content:k.source_page_content||"",default_user_selected_language:k.user_selected_language||""})),knowledgeBaseIds:(y==null?void 0:y.knowledge_base_ids)||[]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsxs(de,{size:"sm",onClick:x,disabled:d,children:[d?r.jsx(Pe,{className:"w-3 h-3 animate-spin mr-1"}):null," Save"]})})]})]})}function SBe({latestResults:e,value:t,onChange:n,invert:s,onInvertChange:a}){const i=[...new Set(Object.values(e).filter(o=>o==null?void 0:o.ran_at).map(o=>{const l=new Date(o.ran_at);return l.setSeconds(0,0),l.toISOString()}))].sort((o,l)=>new Date(l)-new Date(o));return i.length===0?null:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap border rounded-xl px-3 py-2 bg-white text-xs",children:[r.jsx(Yp,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsx("span",{className:"text-gray-500 font-medium",children:"Last run:"}),r.jsxs("select",{className:"border rounded-lg px-2 py-1 text-xs bg-white outline-none focus:border-indigo-400",value:t,onChange:o=>n(o.target.value),children:[r.jsx("option",{value:"",children:"— Show all —"}),i.map(o=>r.jsx("option",{value:o,children:new Date(o).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},o))]}),t&&r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-gray-500",children:[r.jsx("input",{type:"checkbox",checked:s,onChange:o=>a(o.target.checked),className:"rounded"}),r.jsx("span",{children:"equal or more recent"})]})]})}function kBe({tc:e,currentSetId:t,onClose:n,onMoved:s}){const[a,i]=h.useState([]),[o,l]=h.useState(""),[c,d]=h.useState(!1);h.useEffect(()=>{Y.entities.TestSet.list("name").then(m=>i(m.filter(g=>g.id!==t)))},[]);async function f(){o&&(d(!0),await Y.entities.TestCase.update(e.id,{test_set_id:o}),s(e.id),n())}return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:n,children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-sm mx-4 p-5 space-y-4",onClick:m=>m.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"font-semibold text-gray-800 text-sm",children:"Move to another Test Set"}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("p",{className:"text-xs text-gray-500",children:["Moving: ",r.jsx("span",{className:"font-medium text-gray-700",children:e.name})]}),r.jsxs("select",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:o,onChange:m=>l(m.target.value),children:[r.jsx("option",{value:"",children:"— Select destination —"}),a.map(m=>r.jsx("option",{value:m.id,children:m.name},m.id))]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(de,{size:"sm",variant:"outline",onClick:n,children:"Cancel"}),r.jsxs(de,{size:"sm",onClick:f,disabled:!o||c,children:[c?r.jsx(Pe,{className:"w-3 h-3 animate-spin mr-1"}):null,"Move"]})]})]})})}function CBe({tc:e,latestResult:t,runState:n,onRun:s,onDelete:a,onMoved:i,onClone:o,assistants:l,setId:c,issueCount:d=0}){var S,A;const[f,m]=h.useState(!1),[g,x]=h.useState(!1),j=Ca(),b=n==="running"?"running":(t==null?void 0:t.human_override_verdict)||(t==null?void 0:t.verdict),y=!!t,w=y&&!!(t.eval_raw_prompt||t.eval_raw_response);function _(){j(yt(`TestCaseEdit?id=${e.id}`))}function N(){j(yt(`TestResultDetail?id=${t.id}&test_set_id=${c}`))}function C(){j(yt(`TestResultDetail?id=${t.id}&test_set_id=${c}&xray=1`))}function k(){j(yt(`TestCaseResults?test_case_id=${e.id}&test_set_id=${c}`))}return r.jsxs("div",{className:"bg-white border rounded-xl overflow-hidden",children:[b&&b!=="running"&&r.jsx("div",{className:`h-1 w-full ${b==="pass"?"bg-emerald-400":b==="fail"?"bg-red-400":b==="partial"?"bg-amber-400":"bg-gray-300"}`}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-semibold text-sm text-gray-900 leading-snug",children:e.name}),e.description&&r.jsx("div",{className:"text-xs text-gray-400 mt-0.5 line-clamp-1",children:e.description})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx("button",{onClick:_,className:"p-1.5 rounded-lg text-gray-300 hover:text-indigo-500 hover:bg-indigo-50 transition-colors",title:"Edit test case",children:r.jsx(ra,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>m(!0),className:"p-1.5 rounded-lg text-gray-300 hover:text-teal-500 hover:bg-teal-50 transition-colors",title:"Move to another test set",children:r.jsx(Jp,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>o(e),className:"p-1.5 rounded-lg text-gray-300 hover:text-indigo-500 hover:bg-indigo-50 transition-colors",title:"Clone test case",children:r.jsx(ri,{className:"w-3.5 h-3.5"})}),r.jsxs("button",{onClick:()=>x(!0),className:`relative p-1.5 rounded-lg transition-colors ${d>0?"text-amber-500 bg-amber-50 hover:bg-amber-100":"text-gray-300 hover:text-amber-500 hover:bg-amber-50"}`,title:"Linked issues",children:[r.jsx(Nr,{className:"w-3.5 h-3.5"}),d>0&&r.jsx("span",{className:"absolute -top-1 -right-1 bg-amber-500 text-white text-[9px] font-bold rounded-full w-3.5 h-3.5 flex items-center justify-center leading-none",children:d>9?"9+":d})]}),r.jsx("button",{onClick:()=>a(e),className:"p-1.5 rounded-lg text-gray-300 hover:text-red-500 hover:bg-red-50 transition-colors",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]})]}),r.jsxs("p",{className:"text-xs text-gray-500 italic line-clamp-2 bg-gray-50 rounded-lg px-3 py-2 border",children:['"',e.query,'"']}),(e.target_assistant_id||e.evaluator_assistant_id)&&r.jsxs("div",{className:"flex gap-1.5 flex-wrap text-xs",children:[e.target_assistant_id&&r.jsxs("button",{onClick:()=>window.open(yt(`AssistantForm?id=${e.target_assistant_id}`),"_blank"),className:"bg-indigo-50 text-indigo-600 border border-indigo-100 px-1.5 py-0.5 rounded hover:bg-indigo-100 transition-colors flex items-center gap-1",children:["↳ ",((S=l.find(T=>T.id===e.target_assistant_id))==null?void 0:S.name)||"target override",r.jsx(yr,{className:"w-2.5 h-2.5"})]}),e.evaluator_assistant_id&&r.jsxs("button",{onClick:()=>window.open(yt(`AssistantForm?id=${e.evaluator_assistant_id}`),"_blank"),className:"bg-violet-50 text-violet-600 border border-violet-100 px-1.5 py-0.5 rounded hover:bg-violet-100 transition-colors flex items-center gap-1",children:["✦ ",((A=l.find(T=>T.id===e.evaluator_assistant_id))==null?void 0:A.name)||"eval override",r.jsx(yr,{className:"w-2.5 h-2.5"})]})]}),y&&r.jsxs("div",{className:"bg-gray-50 border rounded-xl px-3 py-2.5 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-400",children:[r.jsx(ni,{className:"w-3 h-3"}
1664),new Date(t.ran_at).toLocaleString()]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(jBe,{verdict:t.human_override_verdict||t.verdict}),t.score!=null&&r.jsxs("span",{className:"text-xs font-mono text-gray-600",children:[t.score,"/100"]}),t.evaluation_category&&r.jsx("span",{className:"text-[10px] bg-gray-100 border px-1.5 py-0.5 rounded text-gray-500",children:t.evaluation_category})]})]}),t.node_results&&t.node_results.length>0&&r.jsx("div",{className:"flex gap-1 flex-wrap",children:t.node_results.map((T,R)=>r.jsxs("span",{className:`text-[10px] font-mono px-1.5 py-0.5 rounded border ${T.verdict==="pass"?"bg-emerald-50 text-emerald-700 border-emerald-200":T.verdict==="fail"?"bg-red-50 text-red-600 border-red-200":T.verdict==="partial"?"bg-amber-50 text-amber-700 border-amber-200":"bg-gray-50 text-gray-500 border-gray-200"}`,children:[T.node,T.verdict!=="n/a"?`: ${T.verdict}`:""]},R))})]}),f&&r.jsx(kBe,{tc:e,currentSetId:c,onClose:()=>m(!1),onMoved:i}),g&&r.jsx(_Be,{tc:e,onClose:()=>x(!1)}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap pt-1 border-t",children:[r.jsx(de,{size:"sm",variant:b==="pass"?"outline":"default",className:"gap-1.5 text-xs h-7 px-3",disabled:n==="running",onClick:()=>s(e),children:n==="running"?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-3 h-3 animate-spin"}),"Running…"]}):y?r.jsxs(r.Fragment,{children:[r.jsx(Rn,{className:"w-3 h-3"}),"Re-run"]}):r.jsxs(r.Fragment,{children:[r.jsx(rc,{className:"w-3 h-3"}),"Run"]})}),y&&n!=="running"&&r.jsxs(r.Fragment,{children:[r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 text-xs h-7 px-3",onClick:N,children:[r.jsx(Ts,{className:"w-3 h-3"})," Last result"]}),r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 text-xs h-7 px-3",onClick:k,children:[r.jsx(Bm,{className:"w-3 h-3"})," All results"]}),r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 text-xs h-7 px-3 text-gray-500",onClick:C,disabled:!w,children:[r.jsx(Xp,{className:"w-3 h-3"})," X-Ray"]})]})]})]})]})}function EBe(){var ie;const t=new URLSearchParams(window.location.search).get("id"),[n,s]=h.useState(null),[a,i]=h.useState([]),[o,l]=h.useState({}),[c,d]=h.useState({}),[f,m]=h.useState([]),[g,x]=h.useState(!0),[j,b]=h.useState(!1),[y,w]=h.useState(!1),[_,N]=h.useState(null),[C,k]=h.useState(null),[S,A]=h.useState(""),[T,R]=h.useState(!1),[B,D]=h.useState(new Set),[P,I]=h.useState({});h.useEffect(()=>{t&&z()},[t]);async function z(){x(!0);const[Z,ce,le,re]=await Promise.all([Y.entities.TestSet.filter({id:t}),Y.entities.TestCase.filter({test_set_id:t},"-created_date"),Y.entities.Assistant.list("name"),Y.entities.TestResult.filter({test_set_id:t},"-ran_at")]),Ue=Z[0]||null;s(Ue);const Ne=ce.sort((Me,ue)=>{const Ve=Me.sort_order??1/0,Xe=ue.sort_order??1/0;return Ve-Xe});i(Ne),m(le);const Oe={};for(const Me of re)Oe[Me.test_case_id]||(Oe[Me.test_case_id]=Me);if(l(Oe),Ne.length>0){const Me=await Y.entities.IssueReport.filter({linked_test_case_id:{$in:Ne.map(Ve=>Ve.id)}}),ue={};for(const Ve of Me)Ve.linked_test_case_id&&(Ve.status==="open"||Ve.status==="in_review")&&(ue[Ve.linked_test_case_id]=(ue[Ve.linked_test_case_id]||0)+1);I(ue)}x(!1)}async function L(){const Z=await Y.entities.TestResult.filter({test_set_id:t},"-ran_at"),ce={};for(const le of Z)ce[le.test_case_id]||(ce[le.test_case_id]=le);l(ce)}async function H(Z){const ce=await Y.entities.TestCase.create({test_set_id:Z.test_set_id,name:`${Z.name} (copy)`,description:Z.description||"",query:Z.query,expected_answer:Z.expected_answer||"",node_expectations:Z.node_expectations||[],target_assistant_id:Z.target_assistant_id||"",evaluator_assistant_id:Z.evaluator_assistant_id||""});i(le=>[...le,ce])}async function W(Z){confirm(`Delete test case "${Z.name}"?`)&&(await Y.entities.TestCase.delete(Z.id),i(ce=>ce.filter(le=>le.id!==Z.id)))}async function V(Z,ce=null,le=!1){var re,Ue;d(Ne=>({...Ne,[Z.id]:"running"}));try{const Ne=await Y.functions.invoke("runTestCase",{test_case_id:Z.id,...ce?{test_set_execution_id:ce}:{}});return await L(),Ne==null?void 0:Ne.data}catch(Ne){const Oe=((Ue=(re=Ne==null?void 0:Ne.response)==null?void 0:re.data)==null?void 0:Ue.error)||(Ne==null?void 0:Ne.message)||"Unknown error";return le||alert(`Failed to run "${Z.name}":
1665${Oe}`),{verdict:"error",_errorMsg:Oe}}finally{d(Ne=>({...Ne,[Z.id]:null}))}}async function K(){b(!0),k(null),N({current:0,total:a.length,errors:[]});let Z=null;try{const ce=new Date().toISOString();Z=await Y.entities.TestSetExecution.create({test_set_id:t,started_at:ce,status:"running",total_cases:a.length,passed:0,failed:0,partial:0,errors:0});let le=0,re=0,Ue=0,Ne=0;const Oe=[];for(let Me=0;Me<a.length;Me++){const ue=a[Me],Ve=await V(ue,Z.id,!0);(Ve==null?void 0:Ve.verdict)==="pass"?le++:(Ve==null?void 0:Ve.verdict)==="fail"?re++:(Ve==null?void 0:Ve.verdict)==="partial"?Ue++:(Ne++,Oe.push({name:ue.name,msg:(Ve==null?void 0:Ve._errorMsg)||"Unknown error"})),N({current:Me+1,total:a.length,errors:Oe})}await Y.entities.TestSetExecution.update(Z.id,{finished_at:new Date().toISOString(),status:"completed",passed:le,failed:re,partial:Ue,errors:Ne}),k({passed:le,failed:re,partial:Ue,errors:Ne,errorDetails:Oe})}catch(ce){Z&&await Y.entities.TestSetExecution.update(Z.id,{finished_at:new Date().toISOString(),status:"error"}).catch(()=>{}),k({passed:0,failed:0,partial:0,errors:a.length,errorDetails:[{name:"Bulk run",msg:(ce==null?void 0:ce.message)||"Unexpected error"}]})}finally{b(!1),N(null)}}async function M(Z){const{source:ce,destination:le}=Z;if(!le||ce.droppableId===le.droppableId&&ce.index===le.index)return;const re=q.map(Ve=>Ve.id),Ue=re[ce.index],Ne=Array.from(re);Ne.splice(ce.index,1),Ne.splice(le.index,0,Ue);const Oe=a.filter(Ve=>!re.includes(Ve.id)),ue=[...Ne.map(Ve=>a.find(Xe=>Xe.id===Ve)),...Oe];i(ue),await Promise.all(ue.map((Ve,Xe)=>Y.entities.TestCase.update(Ve.id,{sort_order:Xe})))}function G(Z){D(ce=>{const le=new Set(ce);return le.has(Z)?le.delete(Z):le.add(Z),le})}const q=a.filter(Z=>{if(S){const ce=o[Z.id];if(!(ce!=null&&ce.ran_at))return!1;const le=new Date(ce.ran_at),re=new Date(S);if(T?le<re:le>=re)return!1}if(B.size>0){const ce=o[Z.id],le=(ce==null?void 0:ce.human_override_verdict)||(ce==null?void 0:ce.verdict)||null;if(B.has("never_run")){const re=new Set([...B].filter(Oe=>Oe!=="never_run")),Ue=!ce,Ne=re.size>0&&le&&re.has(le);if(!Ue&&!Ne)return!1}else if(!le||!B.has(le))return!1}return!0}),F=Object.values(c).some(Z=>Z==="running"),U=Object.values(o).filter(Z=>(Z.human_override_verdict||Z.verdict)==="pass").length,ee=Object.values(o).filter(Z=>(Z.human_override_verdict||Z.verdict)==="fail").length,ne=Object.values(o).filter(Z=>(Z.human_override_verdict||Z.verdict)==="partial").length,X=Object.keys(o).length;return g?r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading..."}
1665):n?r.jsxs("div",{className:"p-4 md:p-6 max-w-4xl mx-auto space-y-5 overflow-y-auto",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:yt("TestSets"),children:r.jsx(de,{variant:"ghost",size:"sm",children:r.jsx(or,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-100 flex items-center justify-center shrink-0",children:r.jsx(si,{className:"w-5 h-5 text-indigo-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:n.name}),n.description&&r.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:n.description})]}),(n.target_assistant_id||n.evaluator_assistant_id)&&r.jsxs("div",{className:"flex gap-1.5",children:[n.target_assistant_id&&r.jsxs("button",{onClick:()=>window.open(yt(`AssistantForm?id=${n.target_assistant_id}`),"_blank"),className:"flex items-center gap-1 text-xs bg-indigo-50 text-indigo-600 border border-indigo-200 px-2 py-1 rounded-lg hover:bg-indigo-100 transition-colors",title:"Open target assistant",children:[r.jsx(yr,{className:"w-3 h-3"})," Target"]}),n.evaluator_assistant_id&&r.jsxs("button",{onClick:()=>window.open(yt(`AssistantForm?id=${n.evaluator_assistant_id}`),"_blank"),className:"flex items-center gap-1 text-xs bg-violet-50 text-violet-600 border border-violet-200 px-2 py-1 rounded-lg hover:bg-violet-100 transition-colors",title:"Open evaluator assistant",children:[r.jsx(yr,{className:"w-3 h-3"})," Eval"]})]})]}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[r.jsxs(de,{variant:"outline",className:"gap-1.5",onClick:K,disabled:F||a.length===0||j,children:[F?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(rc,{className:"w-4 h-4"}),"Run All"]}),r.jsx(nMe,{testSet:n,testCases:a,latestResults:o,assistants:f}),r.jsxs(de,{variant:"outline",className:"gap-1.5",onClick:()=>w(!0),children:[r.jsx(Yn,{className:"w-4 h-4"})," Bulk Add"]}),r.jsx(wt,{to:yt(`TestCaseEdit?test_set_id=${t}`),children:r.jsxs(de,{className:"gap-1.5",children:[r.jsx(ln,{className:"w-4 h-4"})," Add Test Case"]})})]})]}),r.jsx(NBe,{testSet:n,assistants:f,onSave:Z=>s(ce=>({...ce,...Z}))},n.id),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[[{key:"pass",label:"Pass",activeClass:"bg-emerald-100 text-emerald-700 border-emerald-300"},{key:"partial",label:"Partial",activeClass:"bg-amber-100 text-amber-700 border-amber-300"},{key:"fail",label:"Fail",activeClass:"bg-red-100 text-red-700 border-red-300"},{key:"never_run",label:"Never run",activeClass:"bg-gray-200 text-gray-700 border-gray-400"}].map(({key:Z,label:ce,activeClass:le})=>{const re=B.has(Z);return r.jsx("button",{onClick:()=>G(Z),className:`text-xs px-3 py-1.5 rounded-full border font-medium transition-colors ${re?le:"bg-white text-gray-400 border-gray-200 hover:border-gray-300 hover:text-gray-600"}`,children:ce},Z)}),B.size>0&&r.jsx("button",{onClick:()=>D(new Set),className:"text-xs text-gray-400 hover:text-red-500 transition-colors px-1",children:r.jsx(jt,{className:"w-3.5 h-3.5"})}),r.jsx("div",{className:"flex-1"}),r.jsx(SBe,{latestResults:o,value:S,onChange:A,invert:T,onInvertChange:R})]}),X>0&&r.jsxs("div",{className:"flex flex-wrap items-center gap-4 bg-white border rounded-xl px-5 py-3 text-sm",children:[r.jsxs("span",{className:"text-gray-500",children:[X," of ",a.length," run"]}),U>0&&r.jsxs("span",{className:"flex items-center gap-1.5 text-emerald-600 font-medium",children:[r.jsx(mr,{className:"w-4 h-4"}),U," pass"]}),ne>0&&r.jsxs("span",{className:"flex items-center gap-1.5 text-amber-500 font-medium",children:[r.jsx(Gp,{className:"w-4 h-4"}),ne," partial"]}),ee>0&&r.jsxs("span",{className:"flex items-center gap-1.5 text-red-500 font-medium",children:[r.jsx(sc,{className:"w-4 h-4"}),ee," fail"]}),S&&r.jsxs("span",{className:"text-xs text-indigo-600 font-medium",children:["Filtered: ",q.length," shown"]})]}),_&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-xl px-4 py-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("span",{className:"text-indigo-700 font-medium flex items-center gap-2",children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"}),"Running all… ",_.current," / ",_.total]}),_.errors.length>0&&r.jsxs("span",{className:"text-red-600 text-xs",children:[_.errors.length," error",_.errors.length>
16651?"s":""," so far"]})]}),r.jsx("div",{className:"w-full bg-indigo-100 rounded-full h-1.5 overflow-hidden",children:r.jsx("div",{className:"bg-indigo-500 h-1.5 rounded-full transition-all duration-300",style:{width:`${Math.round(_.current/_.total*100)}%`}})})]}),C&&!_&&r.jsxs("div",{className:`border rounded-xl px-4 py-3 space-y-2 ${C.errors>0?"bg-amber-50 border-amber-200":"bg-emerald-50 border-emerald-200"}`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-sm text-gray-800",children:"Bulk run complete"}),r.jsx("button",{onClick:()=>k(null),className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-3.5 h-3.5"})})]}),r.jsxs("div",{className:"flex flex-wrap gap-3 text-sm",children:[C.passed>0&&r.jsxs("span",{className:"text-emerald-700 font-medium",children:["✓ ",C.passed," passed"]}),C.partial>0&&r.jsxs("span",{className:"text-amber-700 font-medium",children:["~ ",C.partial," partial"]}),C.failed>0&&r.jsxs("span",{className:"text-red-600 font-medium",children:["✗ ",C.failed," failed"]}),C.errors>0&&r.jsxs("span",{className:"text-red-700 font-semibold",children:["⚠ ",C.errors," error",C.errors>1?"s":""]})]}),((ie=C.errorDetails)==null?void 0:ie.length)>0&&r.jsx("div",{className:"space-y-1 mt-1 border-t border-amber-200 pt-2",children:C.errorDetails.map((Z,ce)=>r.jsxs("p",{className:"text-xs text-red-700",children:[r.jsxs("span",{className:"font-medium",children:[Z.name,":"]})," ",Z.msg]},ce))})]}),q.length===0&&a.length===0?r.jsxs("div",{className:"text-center py-20 border-2 border-dashed border-gray-200 rounded-2xl",children:[r.jsx(si,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),r.jsx("p",{className:"text-gray-500 font-medium mb-1",children:"No test cases yet"}),r.jsx(wt,{to:yt(`TestCaseEdit?test_set_id=${t}`),children:r.jsxs(de,{className:"gap-1.5 mt-4",children:[r.jsx(ln,{className:"w-4 h-4"})," Add First Test Case"]})})]}):q.length===0?r.jsx("div",{className:"text-center py-12 text-gray-400 border-2 border-dashed border-gray-200 rounded-2xl",children:"No test cases match the current filter."}):r.jsx(I6e,{onDragEnd:M,children:r.jsx(vBe,{droppableId:"test-cases",children:(Z,ce)=>r.jsxs("div",{ref:Z.innerRef,...Z.droppableProps,className:`space-y-3 ${ce.isDraggingOver?"bg-indigo-50 rounded-xl p-3":""}`,children:[q.map((le,re)=>r.jsx(X6e,{draggableId:le.id,index:re,children:(Ue,Ne)=>r.jsxs("div",{ref:Ue.innerRef,...Ue.draggableProps,className:`flex items-start gap-2 ${Ne.isDragging?"opacity-50":""}`,children:[r.jsx("div",{...Ue.dragHandleProps,className:"pt-1 text-gray-300 hover:text-gray-500 transition-colors shrink-0",children:r.jsx(Jz,{className:"w-5 h-5"})}),r.jsx("div",{className:"flex-1",children:r.jsx(CBe,{tc:le,latestResult:o[le.id]||null,runState:c[le.id]||null,assistants:f,onRun:V,onDelete:W,onClone:H,onMoved:Oe=>i(Me=>Me.filter(ue=>ue.id!==Oe)),setId:t,issueCount:P[le.id]||0})})]})},le.id)),Z.placeholder]})})}),y&&r.jsx(DIe,{testSetId:t,onClose:()=>w(!1),onAdded:Z=>i(ce=>[...ce,...Z])})]}):r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Test set not found."})}const Au=({label:e,hint:t,children:n})=>r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600 uppercase tracking-wide",children:e}),t&&r.jsx("p",{className:"text-xs text-gray-400",children:t}),n]}),Wl="w-full border rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-100 transition-all bg-white";function qF({value:e,onChange:t,assistants:n,placeholder:s="— Use TestSet default —"}){return r.jsxs("select",{className:Wl,value:e||"",onChange:a=>t(a.target.value||""),children:[r.jsx("option",{value:"",children:s}),n.map(a=>r.jsx("option",{value:a.id,children:a.name},a.id))]})}function ABe({expectations:e,setExpectations:t,inheritedNodes:n}){const s=new Set(e.map(c=>c.node)),a=(n||[]).filter(c=>!s.has(c));function i(c=""){t(d=>[...d,{node:c,expected_description:"",pass_score:70}])}function o(c,d,f){t(m=>m.map((g,x)=>x===c?{...g,[d]:f}:g))}function l(c){t(d=>d.filter((f,m)=>m!==c))}return r.jsxs("div",{className:"space-y-3",children:[e.length===0&&a.length===0&&r.jsx("p",{className:"text-xs text-gray-400 italic",children:"No node expectations configured."}),a.length>0&&r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide",children:"Inherited from TestSet (click to add expectation)"}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(c=>r.jsxs("button",{type:"button",onClick:()=>i(c),className:"text-xs bg-teal-50 text-teal-700 border border-teal-200 px-2 py-1 rounded-lg hover:bg-teal-100 transition-colors flex items-center gap-1",children:[r.jsx(ln,{className:"w-2.5 h-2.5"})," ",c]},c))})]}),e.map((c,d)=>r.jsxs("div",{className:"grid grid-cols-[1fr_2fr_80px_auto] gap-2 items-start",children:[r.jsxs("div",{children:[d===0&&r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide block mb-1",children:"Node name"}),r.jsx("input",{className:Wl+" font-mono text-xs",value:c.node,onChange:f=>o(d,"node",f.target.value),placeholder:"e.g. answer"})]}),r.jsxs("div",{children:[d===0&&r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide block mb-1",children:"Expected result"}),r.jsx("textarea",{className:Wl+" text-xs min-h-[80px] resize-y",value:c.expected_description,onChange:f=>o(d,"expected_description",f.target.value),placeholder:"Describe what this node's value should contain or achieve"})]}),r.jsxs("div",{children:[d===0&&r.jsx("label",{className:"text-[10px] font-semibold text-gray-400 uppercase tracking-wide block mb-1",children:"Pass score"}),r.jsx("input",{type:"number",min:0,max:100,className:Wl+" text-xs text-center",value:c.pass_score??70,onChange:f=>o(d,"pass_score",parseInt(f.target.value)||70),placeholder:"70"})]}),r.jsx("div",{className:d===0?"mt-5":"",children:r.jsx("button",{type:"button",onClick:()=>l(d),className:"p-2 text-gray-300 hover:text-red-500 transition-colors",children:r.jsx(un,{className:"w-3.5 h-3.5"})})})]},d)),r.jsxs("button",{type:"button",onClick:()=>i(""),className:"flex items-center gap-1.5 text-xs text-indigo-600 hover:text-indigo-700 font-medium",children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," Add node expectation"]})]})}function TBe(){var M,G,q,F,U,ee,ne;
1665const e=new URLSearchParams(window.location.search),t=e.get("id"),n=e.get("test_set_id"),[s,a]=h.useState({name:"",description:"",query:"",expected_answer:"",target_assistant_id:"",evaluator_assistant_id:"",user_id:"",assistant_mode:"",source_page_method:"",source_page_url:"",source_kb_item_id:"",source_page_content:"",user_selected_language:""}),[i,o]=h.useState(!0),[l,c]=h.useState(""),[d,f]=h.useState([]),[m,g]=h.useState(null),[x,j]=h.useState([]),[b,y]=h.useState(null),[w,_]=h.useState([]),[N,C]=h.useState(!0),[k,S]=h.useState(!1);h.useEffect(()=>{R()},[]);const A=s.target_assistant_id||(m==null?void 0:m.target_assistant_id)||"",T=i?(m==null?void 0:m.default_source_kb_item_id)||"":s.source_kb_item_id||"";h.useEffect(()=>{if(!T){c("");return}let X=!0;return(async()=>{var Z;const ie=await Y.entities.KnowledgeItem.filter({id:T},"title",1);X&&c(((Z=ie[0])==null?void 0:Z.title)||"")})(),()=>{X=!1}},[T]);async function R(){C(!0);const[X]=await Promise.all([Y.entities.Assistant.list("name")]);if(j(X),t){const Z=(await Y.entities.TestCase.filter({id:t}))[0];if(Z){a({name:Z.name||"",description:Z.description||"",query:Z.query||"",expected_answer:Z.expected_answer||"",target_assistant_id:Z.target_assistant_id||"",evaluator_assistant_id:Z.evaluator_assistant_id||"",user_id:Z.user_id||"",assistant_mode:Z.assistant_mode||"",source_page_method:Z.source_page_method||"",source_page_url:Z.source_page_url||"",source_kb_item_id:Z.source_kb_item_id||"",source_page_content:Z.source_page_content||"",user_selected_language:Z.user_selected_language||""}),o(!(Z.assistant_mode||Z.source_page_method||Z.source_page_url||Z.source_kb_item_id||Z.source_page_content||Z.user_selected_language)),f(Z.node_expectations||[]);const[ce,le,re]=await Promise.all([Y.entities.TestSet.filter({id:Z.test_set_id}),Y.entities.TestResult.filter({test_case_id:t},"-ran_at",1),Y.entities.IssueReport.filter({linked_test_case_id:t},"-reported_at")]);g(ce[0]||null),y(le[0]||null),_(re)}}else if(n){const ie=await Y.entities.TestSet.filter({id:n});g(ie[0]||null)}C(!1)}function B(X,ie){a(Z=>({...Z,[X]:ie}))}function D(){o(!1),a(X=>({...X,assistant_mode:X.assistant_mode||(m==null?void 0:m.default_assistant_mode)||"LIBRARY",source_page_method:X.source_page_method||(m==null?void 0:m.default_source_page_method)||"kb_item",source_page_url:X.source_page_url||(m==null?void 0:m.default_source_page_url)||"",source_kb_item_id:X.source_kb_item_id||(m==null?void 0:m.default_source_kb_item_id)||"",source_page_content:X.source_page_content||(m==null?void 0:m.default_source_page_content)||"",user_selected_language:X.user_selected_language||(m==null?void 0:m.default_user_selected_language)||""}))}function P(){o(!0),a(X=>({...X,assistant_mode:"",source_page_method:"",source_page_url:"",source_kb_item_id:"",source_page_content:"",user_selected_language:""}))}async function I(){S(!0);const X=t?m==null?void 0:m.id:n,ie=i?{assistant_mode:null,source_page_method:null,source_page_url:null,source_kb_item_id:null,source_page_content:null,user_selected_language:null}:{assistant_mode:s.assistant_mode||null,source_page_method:s.source_page_method||null,source_page_url:s.source_page_url||null,source_kb_item_id:s.source_kb_item_id||null,source_page_content:s.source_page_content||null,user_selected_language:s.user_selected_language||null},Z={test_set_id:X,name:s.name,description:s.description,query:s.query,expected_answer:s.expected_answer,target_assistant_id:s.target_assistant_id||"",evaluator_assistant_id:s.evaluator_assistant_id||"",user_id:s.user_id||"",node_expectations:d.filter(ce=>ce.node.trim()),...ie};t?await Y.entities.TestCase.update(t,Z):await Y.entities.TestCase.create(Z),S(!1),window.location.href=yt(`TestSetDetail?id=${X}`)}const z=yt(m?`TestSetDetail?id=${m.id}`:"TestSets"),L=s.target_assistant_id?(M=x.find(X=>X.id===s.target_assistant_id))==null?void 0:M.name:m!=null&&m.target_assistant_id?(G=x.find(X=>X.id===m.target_assistant_id))==null?void 0:G.name:null,H=s.evaluator_assistant_id?(q=x.find(X=>X.id===s.evaluator_assistant_id))==null?void 0:q.name:m!=null&&m.evaluator_assistant_id?(F=x.find(X=>X.id===m.evaluator_assistant_id))==null?void 0:F.name:null,W=(m==null?void 0:m.response_nodes)||[],V=i&&m?{assistant_mode:m.default_assistant_mode||"LIBRARY",source_page_method:m.default_source_page_method||"kb_item",source_page_url:m.default_source_page_url||null,source_kb_item_id:m.default_source_kb_item_id||null,source_page_content:m.default_source_page_content||null,user_selected_language:m.default_user_selected_language||null}:{assistant_mode:s.assistant_mode||null,source_page_method:s.source_page_method||null,source_page_url:s.source_page_url||null,source_kb_item_id:s.source_kb_item_id||null,source_page_content:s.source_page_content||null,user_selected_language:s.user_selected_language||null},K=i&&m?{assistant_mode:m.default_assistant_mode,source_page_method:m.default_source_page_method,source_page_url:m.default_source_page_url,source_kb_item_name:l||null}:{assistant_mode:s.assistant_mode||null,source_page_method:s.source_page_method||null,source_page_url:s.source_page_url||null,source_kb_item_name:l||null};return N?r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading..."}):r.jsxs("div",{className:"flex flex-col h-full bg-gray-50",children:[r.jsxs("div",{className:"bg-white border-b px-6 py-3 flex items-center gap-3 shrink-0",children:[r.jsx(wt,{to:z,children:r.jsx("button",{className:"text-gray-400 hover:text-gray-700 transition-colors",children:r.jsx(or,{className:"w-5 h-5"})})}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold text-lg text-gray-900",children:t?"Edit Test Case":"New Test Case"}),m&&r.jsxs("p",{className:"text-xs text-gray-400",children:["in ",r.jsx("span",{className:"font-medium text-gray-600",children:m.name})]})]}),r.jsxs("div",{className:"ml-auto flex gap-2 items-center",children:[t&&b&&r.jsxs(r.Fragment,{children:[(b.eval_raw_prompt||b.eval_raw_response)&&r.jsx(wt,{to:yt(`TestResultDetail?id=${b.id}&test_set_id=${(m==null?void 0:m.id)||""}`),children:r.jsxs(de,{variant:"outline",size:"sm",className:"gap-1.5 text-gray-500",children:[r.jsx(Xp,{className:"w-3.5 h-3.5"})," X-Ray"]})}),r.jsx(wt,{to:yt(`TestResultDetail?id=${b.id}&test_set_id=${(m==null?void 0:m.id)||""}`),children:r.jsxs(de,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(Ts,{className:"w-3.5 h-3.5"})," Last result"]})}),r.jsx(wt,{to:yt(`TestCaseResults?test_case_id=${t}&test_set_id=${(m==null?void 0:m.id)||""}`),children:r.jsxs(de,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(Bm,{className:"w-3.5 h-3.5"})," All results"]})})]}),r.jsx(wt,{to:z,children:r.jsx(de,{variant:"ghost",disabled:k,children:"Cancel"})}),r.jsx(de,{onClick:I,disabled:k||!s.name||!s.query||W.length===0&&d.filter(X=>X.node.trim()).length===0&&!s.expected_answer,children:k?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin mr-2"}),"Saving…"]}):"Save Test Case"})]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 max-w-2xl mx-auto w-full space-y-5",children:[r.jsx(Au,{label:"Name",children:r.jsx("input",{className:Wl,value:s.name,onChange:X=>B("name",X.target.value),placeholder:"e.g. Basic product info query"})}),r.jsx(Au,{label:"Description",children:r.jsx("input",{className:Wl,value:s.description,onChange:X=>B("description",X.target.value),placeholder:"What does this test case validate?"})}),r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-4 space-y-4",children:[r.jsx("p",{className:"text-xs font-semibold text-indigo-600 uppercase tracking-wide",children:"Query"}),r.jsx(Au,{label:"User Query",hint:"This exact message will be sent to the target assistant",children:r.jsx("textarea",{className:Wl+" min-h-[80px] resize-y",value:s.query,onChange:X=>B("query",X.target.value),placeholder:"What are the main features of your product?"})}),r.jsx(Au,{label:"Expected Answer",hint:"Describe what the correct answer should contain, cover, or achieve — used by the evaluator",children:r.jsx("textarea",{className:Wl+" min-h-[80px] resize-y",value:s.expected_answer,onChange:X=>B("expected_answer",X.target.value),placeholder:"The answer should mention features X, Y, Z and explain the pricing model clearly."})})]}),r.jsxs("div",{className:"bg-teal-50 border border-teal-100 rounded-xl p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dr,{className:"w-4 h-4 text-teal-500"}),r.jsx("p",{className:"text-xs font-semibold text-teal-600 uppercase tracking-wide",children:"JSON Response Node Expectations"})]}),r.jsxs("p",{className:"text-xs text-teal-700",children:["If the target assistant returns a structured JSON response, define per-node expectations here. The evaluator will analyze each node's value individually.",W.length>0&&r.jsxs("span",{className:"block mt-1",children:["TestSet default nodes: ",r.jsx("strong",{children:W.join(", ")})]})]}),r.jsx(ABe,{expectations:d,setExpectations:f,inheritedNodes:W})]}),r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-xl p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"w-4 h-4 text-violet-500"}),r.jsx("p",{className:"text-xs font-semibold text-violet-600 uppercase tracking-wide",children:"Assistant Overrides"})]}),m&&(m.target_assistant_id||m.evaluator_assistant_id)&&r.jsxs("div",{className:"flex items-start gap-2 bg-violet-100 rounded-lg px-3 py-2 text-xs text-violet-700",children:[r.jsx(_d,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),r.jsxs("span",{children:["TestSet defaults: target = ",r.jsx("strong",{children:((U=x.find(X=>X.id===m.target_assistant_id))==null?void 0:U.name)||"—"}),", evaluator = ",r.jsx("strong",{children:((ee=x.find(X=>X.id===m.evaluator_assistant_id))==null?void 0:ee.name)||"—"})]})]}),r.jsx(Au,{label:"Target Assistant (override)",hint:"Leave blank to use the TestSet default",children:r.jsx(qF,{value:s.target_assistant_id,onChange:X=>B("target_assistant_id",X),assistants:x})}),r.jsxs(Au,{label:"Evaluator Assistant (override)",hint:"Leave blank to use the TestSet default",children:[r.jsx(qF,{value:s.evaluator_assistant_id,onChange:X=>B("evaluator_assistant_id",X),assistants:x}),r.jsx("pre",{className:"text-[10px] font-mono bg-gray-900 text-emerald-300 rounded-lg px-3 py-2 overflow-auto mt-1",children:'{ "nodes": [{ "node": "string", "verdict": "pass|fail|partial", "score": 0-100, "reasoning": "string" }] }'})]})]}),r.jsxs("div",{className:"bg-sky-50 border border-sky-100 rounded-xl p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ns,{className:"w-4 h-4 text-sky-500"}),r.jsx("p",{className:"text-xs font-semibold text-sky-600 uppercase tracking-wide",children:"Answer Source Scenario"})]}),m&&r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-sky-700 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:i,onChange:X=>X.target.checked?P():D()}),"Inherit from TestSet"]})]}),r.jsxs("p",{className:"text-xs text-sky-700",children:["Simulate the v2 landing page's answer source: whole-library search, or source-page content (the page a visitor is on).",!m&&" No TestSet default — configure explicitly."]}),r.jsx(SG,{value:V,onChange:X=>a(ie=>({...ie,assistant_mode:X.assistant_mode||"",source_page_method:X.source_page_method||"",source_page_url:X.source_page_url||"",source_kb_item_id:X.source_kb_item_id||"",source_page_content:X.source_page_content||"",user_selected_language:X.user_selected_language||""})),knowledgeBaseIds:((ne=x.find(X=>X.id===A))==null?void 0:ne.knowledge_base_ids)||[],disabled:i&&!!m}),r.jsxs("div",{className:"text-xs text-sky-700 bg-white border border-sky-200 rounded-lg px-3 py-2",children:[r.jsx("span",{className:"font-semibold",children:"Effective:"})," ",Fv(K),i&&m&&r.jsx("span",{className:"text-sky-400 italic",children:" (inherited)"})]})]}),t&&w.length>0&&r.jsxs("div",{className:"border border-amber-200 bg-amber-50 rounded-xl p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Nr,{className:"w-4 h-4 text-amber-500"}),r.jsxs("p",{className:"text-xs font-semibold text-amber-700 uppercase tracking-wide",children:["Linked Issues (",w.length,")"]})]}),r.jsx("div",{className:"space-y-2",children:w.map(X=>r.jsxs("div",{className:"bg-white border border-amber-200 rounded-lg px-3 py-2.5 space-y-1",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("p",{className:"text-xs font-medium text-gray-800 leading-snug line-clamp-2",children:X.query}),r.jsx("button",{type:"button",onClick:()=>window.open(yt("IssueReports"),"_blank"),className:"text-amber-400 hover:text-amber-600 shrink-0",title:"Open in Issue Reports",children:r.jsx(yr,{className:"w-3.5 h-3.5"})})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full border font-medium ${X.status==="open"?"bg-red-100 text-red-700 border-red-200":X.status==="in_review"?"bg-amber-100 text-amber-700 border-amber-200":X.status==="resolved"?"bg-emerald-100 text-emerald-700 border-emerald-200":"bg-gray-100 text-gray-500 border-gray-200"}`,children:X.status}),X.reporter_name&&r.jsx("span",{className:"text-[10px] text-gray-400",children:X.reporter_name}),X.assistant_name&&r.jsxs("span",{className:"text-[10px] text-gray-400",children:["· ",X.assistant_name]}),r.jsxs("span",{className:"text-[10px] text-gray-400",children:["· ",new Date(X.reported_at).toLocaleDateString()]})]}),X.comments&&r.jsx("p",{className:"text-[10px] text-gray-500 italic line-clamp-1",children:X.comments})]},X.id))})]}),r.jsxs("div",{className:"bg-gray-100 border border-gray-200 rounded-xl p-3 text-xs text-gray-600 space-y-1",children:[r.jsx("p",{className:"font-semibold text-gray-700 mb-2",children:"Effective Configuration"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-gray-400",children:"Target:"}),r.jsx("span",{className:L?"font-medium text-gray-800":"text-amber-600 italic",children:L||"Not configured — run will fail"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-gray-400",children:"Evaluator:"}),r.jsx("span",{className:H?"font-medium text-gray-800":"text-amber-600 italic",children:H||"Not configured — run will fail"})]}),d.filter(X=>X.node.trim()).length>0&&r.jsxs("div",{className:"flex gap-2 flex-wrap pt-1",children:[r.jsx("span",{className:"text-gray-400",children:"Nodes:"}),d.filter(X=>X.node.trim()).map(X=>r.jsxs("span",{className:"font-mono bg-teal-50 text-teal-700 border border-teal-100 px-1.5 py-0.5 rounded text-[10px]",children:[X.node,X.expected_description?" ✓":""]},X.node))]})]})]})]})}function PBe(e){if(!e)return null;const t=e.split(`
1666`).map(s=>
1666s.trim()).filter(Boolean);return t.length<4||!/^(include|add|insert|place|append|prepend)/i.test(t[0])?null:{label:t[0],context_before:t[1],new_instruction:t[2],context_after:t[3]}}function OBe({improvement:e}){const t=PBe(e);return r.jsxs("section",{className:"space-y-2",children:[r.jsxs("h3",{className:"text-xs font-semibold text-amber-600 uppercase tracking-wide flex items-center gap-1.5",children:[r.jsx(Zo,{className:"w-3.5 h-3.5"})," Suggested Prompt Improvement"]}),t?r.jsxs("div",{className:"border border-amber-200 rounded-xl overflow-hidden bg-white",children:[r.jsx("div",{className:"px-4 py-2.5 bg-amber-50 border-b border-amber-100",children:r.jsx("p",{className:"text-sm font-semibold text-amber-800",children:t.label})}),r.jsxs("div",{className:"font-mono text-sm divide-y divide-gray-100",children:[r.jsx("div",{className:"px-4 py-2 text-gray-400 bg-gray-50 text-[12px] leading-relaxed",children:t.context_before}),r.jsxs("div",{className:"px-4 py-3 bg-emerald-50 border-l-4 border-emerald-400 text-emerald-800 font-semibold text-[13px] leading-relaxed",children:["+ ",t.new_instruction]}),r.jsx("div",{className:"px-4 py-2 text-gray-400 bg-gray-50 text-[12px] leading-relaxed",children:t.context_after})]})]}):r.jsx("div",{className:"border border-amber-200 rounded-xl px-4 py-3 bg-amber-50 text-amber-900 leading-relaxed whitespace-pre-wrap text-sm",children:e})]})}const D5={pass:"bg-emerald-50 text-emerald-700 border-emerald-200",fail:"bg-red-50 text-red-700 border-red-200",partial:"bg-amber-50 text-amber-700 border-amber-200",error:"bg-gray-50 text-gray-600 border-gray-200"},IBe={pass:mr,fail:sc,partial:Gp,error:fr};function KF({verdict:e}){const t=IBe[e]||fr,n=D5[e]||D5.error;return r.jsxs("span",{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full border text-sm font-medium ${n}`,children:[r.jsx(t,{className:"w-4 h-4"})," ",(e==null?void 0:e.toUpperCase())||"UNKNOWN"]})}function DY(e){if(typeof e!="string")return null;const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{return null}return null}function RBe({label:e,value:t,onClose:n}){let s;const a=typeof t=="string"?DY(t):t;return a!=null&&typeof a=="object"?s=JSON.stringify(a,null,2):s=String(t),r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:n,children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-2xl mx-4 flex flex-col max-h-[80vh]",onClick:i=>i.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dr,{className:"w-4 h-4 text-gray-400"}),r.jsx("span",{className:"font-semibold text-gray-800 text-sm",children:e})]}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsx("div",{className:"flex-1 overflow-auto p-4",children:r.jsx("pre",{className:"text-xs font-mono text-gray-700 bg-gray-50 border rounded-xl p-4 whitespace-pre-wrap break-all leading-relaxed",children:s})})]})})}function MBe({prompt:e,response:t,targetAnswer:n,targetRawJson:s,autoOpen:a=!1}){const[i,o]=h.useState(a),[l,c]=h.useState(a),[d,f]=h.useState(a),m=s&&Object.keys(s).length>0?JSON.stringify(s,null,2):n||null;return!e&&!t&&!m?null:r.jsxs("section",{id:"xray-section",className:"border border-gray-200 rounded-xl overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-gray-900 text-gray-300",children:[r.jsx(Xp,{className:"w-4 h-4 text-gray-400"}),r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:"X-Ray: Evaluator Debug"})]}),r.jsxs("div",{className:"bg-gray-950 p-4 space-y-3",children:[m&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>f(g=>!g),className:"flex items-center gap-1.5 text-xs text-sky-400 font-medium mb-2 hover:text-sky-300",children:[r.jsx(dr,{className:"w-3 h-3"})," Target Assistant Response (",m.length," chars)",d?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"})]}),d&&r.jsx("pre",{className:"text-sky-200 text-[11px] font-mono overflow-auto max-h-96 whitespace-pre-wrap leading-relaxed",children:m})]}),e&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>o(g=>!g),className:"flex items-center gap-1.5 text-xs text-amber-400 font-medium mb-2 hover:text-amber-300",children:[r.jsx(dr,{className:"w-3 h-3"})," Raw Eval Prompt (",e.length," chars)",i?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"})]}),i&&r.jsx("pre",{className:"text-amber-200 text-[11px] font-mono overflow-auto max-h-96 whitespace-pre-wrap leading-relaxed",children:e})]}),t&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>c(g=>!g),className:"flex items-center gap-1.5 text-xs text-emerald-400 font-medium mb-2 hover:text-emerald-300",children:[r.jsx(dr,{className:"w-3 h-3"})," Raw Eval Response (",t.length," chars)",l?r.jsx(gt,{className:"w-3 h-3"}):r.jsx(en,{className:"w-3 h-3"})]}),l&&r.jsx("pre",{className:"text-emerald-200 text-[11px] font-mono overflow-auto max-h-96 whitespace-pre-wrap leading-relaxed",children:t})]})]})]})}function DBe(){var H,W;const e=new URLSearchParams(window.location.search),t=e.get("id"),n=e.get("back"),s=e.get("test_case_id"),a=e.get("test_set_id"),i=e.get("xray")==="1",o=Ca(),[l,c]=h.useState(null),[d,f]=h.useState([]),[m,g]=h.useState(!0),[x,j]=h.useState(!1),[b,y]=h.useState(""),[w,_]=h.useState(""),[N,C]=h.useState(!1),[k,S]=h.useState(!1),[A,T]=h.useState(null);h.useEffect(()=>{R()},[t]);async function R(){const[V,K]=await Promise.all([Y.entities.TestResult.filter({id:t}),Y.entities.Assistant.list("name")]),M=V[0];c(M||null),f(K),M&&(y(M.human_override_verdict||""),_(M.human_override_notes||"")),g(!1)}async function B(){C(!0),await Y.entities.TestResult.update(l.id,{human_override_verdict:b||null,human_override_notes:w}),c(V=>({...V,human_override_verdict:b||null,human_override_notes:w})),C(!1),j(!1)}async function D(){confirm("Delete this result? This cannot be undone.")&&(S(!0),await Y.entities.TestResult.delete(l.id),P())}function P(){o(n==="case"&&s&&a?yt(`TestCaseResults?test_case_id=${s}&test_set_id=${a}`):a?yt(`TestSetDetail?id=${a}`):-1)}if(m)return r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading…"});if(!l)return r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Result not found."});const I=l.human_override_verdict||l.verdict,z=((H=d.find(V=>V.id===l.target_assistant_id))==null?void 0:H.name)||l.target_assistant_id||"—",L=((W=d.find(V=>V.id===l.evaluator_assistant_id))==null?void 0:W.name)||l.evaluator_assistant_id||"—";return r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto bg-gray-50",children:[r.jsxs("div",{className:"bg-white border-b px-5 py-3 flex items-center gap-3 sticky top-0 z-10",children:[r.jsx("button",{onClick:P,className:"text-gray-400 hover:text-gray-700 transition-colors",children:r.jsx(or,{className:"w-5 h-5"})}),r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx(KF,{verdict:I}),l.human_override_verdict&&r.jsx("span",{className:"text-xs text-gray-400 italic",children:"human override"})]}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[r.jsxs(de,{variant:"outline",size:"sm",className:"gap-1.5 text-gray-600",onClick:()=>{var V;return(V=document.getElementById("xray-section"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},disabled:!l.eval_raw_prompt&&!l.eval_raw_response,children:[r.jsx(Xp,{className:"w-3.5 h-3.5"})," X-Ray"]}),r.jsxs(de,{variant:"outline",size:"sm",className:"gap-1.5 text-red-600 border-red-200 hover:bg-red-50",onClick:D,disabled:k,children:[k?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(un,{className:"w-3.5 h-3.5"}),"Delete"]})]})]}),r.jsxs("div",{className:"p-5 max-w-3xl mx-auto w-full space-y-5 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"bg-white border rounded-xl px-4 py-2 text-center",children:[r.jsx("div",{className:"text-xs text-gray-400 uppercase tracking-wide",children:"Ran at"}),r.jsx("div",{className:"text-sm font-medium text-gray-700",children:new Date(l.ran_at).toLocaleStr
1666ing()})]}),l.score!=null&&r.jsxs("div",{className:"bg-white border rounded-xl px-4 py-2 text-center",children:[r.jsx("div",{className:"text-xs text-gray-400 uppercase tracking-wide",children:"Score"}),r.jsxs("div",{className:"text-2xl font-bold text-gray-800",children:[l.score,r.jsx("span",{className:"text-sm font-normal text-gray-400",children:"/100"})]})]}),l.evaluation_category&&r.jsxs("div",{className:"bg-white border rounded-xl px-4 py-2",children:[r.jsx("div",{className:"text-xs text-gray-400 uppercase tracking-wide mb-0.5",children:"Category"}),r.jsx("div",{className:"text-sm font-semibold text-gray-700",children:l.evaluation_category})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-3",children:[r.jsx("div",{className:"text-[10px] font-semibold text-indigo-500 uppercase tracking-wide mb-0.5",children:"Target Assistant"}),r.jsx("div",{className:"text-xs font-medium text-indigo-800",children:z})]}),r.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-xl p-3",children:[r.jsx("div",{className:"text-[10px] font-semibold text-violet-500 uppercase tracking-wide mb-0.5",children:"Evaluator Assistant"}),r.jsx("div",{className:"text-xs font-medium text-violet-800",children:L})]})]}),l.scenario_used&&r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Answer Source Scenario"}),r.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[r.jsx("span",{className:"bg-sky-50 text-sky-700 border border-sky-200 px-2.5 py-1 rounded-full",children:Fv(l.scenario_used)}),l.scenario_used.user_selected_language&&r.jsxs("span",{className:"bg-gray-50 text-gray-600 border border-gray-200 px-2.5 py-1 rounded-full",children:["Language: ",l.scenario_used.user_selected_language]})]})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Query Sent"}),r.jsxs("div",{className:"border rounded-xl px-4 py-3 bg-indigo-50 text-indigo-800 italic",children:['"',l.query,'"']})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Expected Answer"}),r.jsx("div",{className:"border rounded-xl px-4 py-3 bg-gray-50 text-gray-700 leading-relaxed whitespace-pre-wrap",children:l.expected_answer||"—"})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Target Assistant Answer"}),r.jsx("div",{className:"border rounded-xl px-4 py-3 bg-white text-gray-800 leading-relaxed whitespace-pre-wrap",children:l.target_answer||"—"})]}),l.evaluation_reasoning&&r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Evaluator Reasoning"}),r.jsx("div",{className:`border rounded-xl px-4 py-3 leading-relaxed whitespace-pre-wrap ${D5[I]||"bg-gray-50 text-gray-700"}`,children:l.evaluation_reasoning})]}),l.prompt_improvement&&r.jsx(OBe,{improvement:l.prompt_improvement}),l.node_results&&l.node_results.length>0&&r.jsxs("section",{className:"space-y-2",children:[r.jsxs("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide flex items-center gap-1.5",children:[r.jsx(dr,{className:"w-3.5 h-3.5"})," Response Node Analysis"]}),r.jsx("div",{className:"space-y-2",children:l.node_results.map((V,K)=>{const M=V.verdict==="pass"?"border-emerald-200 bg-emerald-50":V.verdict==="fail"?"border-red-200 bg-red-50":V.verdict==="partial"?"border-amber-200 bg-amber-50":"border-gray-200 bg-gray-50",G=V.verdict==="pass"?"text-emerald-700":V.verdict==="fail"?"text-red-700":V.verdict==="partial"?"text-amber-700":"text-gray-600",q=DY(V.value),F=q!==null||typeof V.value=="object"&&V.value!==null;return r.jsxs("div",{className:`border rounded-xl p-3 space-y-1.5 ${M}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("code",{className:"text-xs font-bold text-gray-800 bg-white border px-1.5 py-0.5 rounded",children:V.node}),r.jsxs("div",{className:"flex items-center gap-2",children:[V.score!=null&&V.verdict!=="n/a"&&r.jsxs("span",{className:`text-xs font-mono font-semibold ${G}`,children:[V.score,"/100"]}),V.verdict&&V.verdict!=="n/a"&&r.jsx("span",{className:`text-xs font-semibold uppercase ${G}`,children:V.verdict})]})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"flex-1 text-xs text-gray-700 font-mono bg-white border rounded px-2 py-1 break-all line-clamp-3 overflow-hidden",children:F?JSON.stringify(q??V.value):V.value}),F&&r.jsxs("button",{onClick:()=>T({label:V.node,value:V.value}),className:"shrink-0 flex items-center gap-1 text-[10px] font-medium text-indigo-600 bg-white border border-indigo-200 hover:bg-indigo-50 px-2 py-1 rounded transition-colors",title:"View structured data",children:[r.jsx(Ts,{className:"w-3 h-3"})," View"]})]}),V.expected_description&&r.jsxs("div",{className:"text-xs text-gray-500 italic",children:["Expected: ",V.expected_description]}),V.reasoning&&V.verdict!=="n/a"&&r.jsx("div",{className:`text-xs leading-relaxed ${G}`,children:V.reasoning})]},K)})})]}),A&&r.jsx(RBe,{label:A.label,value:A.value,onClose:()=>T(null)}),r.jsx(MBe,{prompt:l.eval_raw_prompt,response:l.eval_raw_response,targetAnswer:l.target_answer,targetRawJson:l.target_raw_json,autoOpen:i}),l.error_message&&r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold text-red-500 uppercase tracking-wide",children:"Error"}),r.jsx("pre",{className:"bg-red-50 border border-red-200 rounded-xl p-3 text-xs text-red-700 whitespace-pre-wrap",children:l.error_message})]}),r.jsxs("section",{className:"space-y-3 border-t pt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Human Review Override"}),!x&&r.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1 text-xs text-indigo-500 hover:underline",children:[r.jsx(ra,{className:"w-3 h-3"})," Override verdict"]})]}),l.human_override_verdict&&!x&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(KF,{verdict:l.human_override_verdict}),l.human_override_notes&&r.jsx("p",{className:"text-xs text-gray-600 bg-gray-50 border rounded-lg px-3 py-2",children:l.human_override_notes})]}),x&&r.jsxs("div",{className:"space-y-3 bg-gray-50 border rounded-xl p-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600 uppercase tracking-wide",children:"Override Verdict"}),r.jsxs("select",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:b,onChange:V=>y(V.target.value),children:[r.jsx("option",{value:"",children:"— Clear override —"}),r.jsx("option",{value:"pass",children:"Pass"}),r.jsx("option",{value:"partial",children:"Partial"}),r.jsx("option",{value:"fail",children:"Fail"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-600 uppercase tracking-wide",children:"Notes"}),r.jsx("textarea",{className:"w-full border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400 resize-none",rows:3,value:w,onChange:V=>_(V.target.value),placeholder:"Why are you overriding this verdict?"})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(de,{variant:"outline",size:"sm",onClick:()=>j(!1),children:"Cancel"}),r.jsx(de,{size:"sm",onClick:B,disabled:N,children:N?"Saving…":"Save Override"})]})]})]})]})]})}const VF={pass:{icon:mr,color:"text-emerald-500",bg:"bg-emerald-50 border-emerald-200",label:"Pass"},fail:{icon:sc,color:"text-red-500",bg:"bg-red-50 border-red-200",label:"Fail"},partial:{icon:Gp,color:"text-amber-500",bg:"bg-amber-50 border-amber-200",label:"Partial"},error:{icon:fr,color:"text-gray-400",bg:"bg-gray-50 border-gray-200",label:"Error"}};function LBe({verdict:e}){const t=VF[e]||VF.error,n=t.icon;return r.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${t.bg} ${t.color}`,children:[r.jsx(n,{className:"w-3 h-3"})," ",t.label]})}function $Be(){const e=new URLSearchParams(window.location.search),t=e.get("test_case_id"),n=e.get("test_set_id"),s=Ca(),[a,i]=h.useState(null),[o,l]=h.useState([]),[c,d]=h.useState([]),[f,m]=h.useState(!0),[g,x]=h.useState(null),[j,b]=h.useState(null);h.useEffect(()=>{y()},[t]);async function y(){const[k,S,A]=await Promise.all([Y.entities.TestCase.filter({id:t}),Y.entities.TestResult.filter({test_case_id:t},"-ran_at",50),Y.entities.Assistant.list("name")]);i(k[0]||null),l(S),d(A),m(!1)}async function w(k){confirm("Delete this result?")&&(x(k.id),await Y.entities.TestResult.delete(k.id),l(S=>S.filter(A=>A.id!==k.id)),x(null))}async function _(k){b(k.id),await Y.functions.invoke("runTestCase",{test_case_id:k.test_case_id}),await y(),b(null)}function N(k){s(yt(`TestResultDetail?id=${k.id}&back=case&test_case_id=${t}&test_set_id=${n}`))}const C=yt(n?`TestSetDetail?id=${n}`:"TestSets");return f?r.jsx("div",{className:"p-8 text-center text-gray-400",children:"Loading…"}):r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto bg-gray-50",children:[r.jsxs("div",{className:"bg-white border-b px-5 py-3 flex items-center gap-3 sticky top-0 z-10",children:[r.jsx(wt,{to:C,children:r.jsx("button",{className:"text-gray-400 hover:text-gray-700 transition-colors",children:r.jsx(or,{className:"w-5 h-5"})})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-gray-800",children:(a==null?void 0:a.name)||"Test Case"}),r.jsxs("p",{className:"text-xs text-gray-400",children:[o.length," result",o.length!==1?"s":""]})]})]}),r.jsxs("div",{className:"p-5 max-w-3xl mx-auto w-full space-y-3",children:[o.length===0&&r.jsx("div",{className:"text-center py-16 text-gray-400 text-sm",children:"No results yet."}),o.map(k=>{var R;const S=k.human_override_verdict||k.verdict,A=((R=c.find(B=>B.id===k.target_assistant_id))==null?void 0:R.name)||"—",T=!!(k.eval_raw_prompt||k.eval_raw_response);return r.jsxs("div",{className:"bg-white border rounded-xl p-4 space-y-3 hover:shadow-sm transition-shadow",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[r.jsx(ni,{className:"w-3.5 h-3.5"}
1666),new Date(k.ran_at).toLocaleString()]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(LBe,{verdict:S}),k.human_override_verdict&&r.jsx("span",{className:"text-[10px] text-indigo-400 italic",children:"override"})]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500 flex-wrap",children:[k.score!=null&&r.jsxs("span",{className:"font-mono font-semibold text-gray-700",children:["Score: ",k.score,"/100"]}),k.evaluation_category&&r.jsx("span",{className:"bg-gray-100 border px-1.5 py-0.5 rounded",children:k.evaluation_category}),r.jsxs("span",{className:"text-gray-400",children:["Target: ",A]}),k.scenario_used&&r.jsxs("span",{className:"text-sky-600",children:["· ",Fv(k.scenario_used)]})]}),k.node_results&&k.node_results.length>0&&r.jsx("div",{className:"flex gap-1 flex-wrap",children:k.node_results.map((B,D)=>r.jsxs("span",{className:`text-[10px] font-mono px-1.5 py-0.5 rounded border ${B.verdict==="pass"?"bg-emerald-50 text-emerald-700 border-emerald-200":B.verdict==="fail"?"bg-red-50 text-red-600 border-red-200":B.verdict==="partial"?"bg-amber-50 text-amber-700 border-amber-200":"bg-gray-50 text-gray-500 border-gray-200"}`,children:[B.node,B.verdict!=="n/a"?`: ${B.verdict}`:""]},D))}),k.evaluation_reasoning&&r.jsx("p",{className:"text-xs text-gray-500 leading-relaxed line-clamp-2",children:k.evaluation_reasoning}),k.error_message&&r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg px-3 py-2 text-xs text-red-700 font-mono whitespace-pre-wrap break-words",children:[r.jsx("span",{className:"font-semibold text-red-500 block mb-0.5",children:"Error:"}),k.error_message]}),r.jsxs("div",{className:"flex gap-2 pt-1 border-t flex-wrap",children:[r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 h-7 text-xs",onClick:()=>N(k),children:[r.jsx(Ts,{className:"w-3.5 h-3.5"})," View details"]}),T&&r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 h-7 text-xs text-gray-500",onClick:()=>N(k),children:[r.jsx(Xp,{className:"w-3.5 h-3.5"})," X-Ray"]}),S==="error"&&r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 h-7 text-xs text-amber-600 border-amber-200 hover:bg-amber-50",onClick:()=>_(k),disabled:j===k.id,children:[j===k.id?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Rn,{className:"w-3.5 h-3.5"}),"Re-run"]}),r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 h-7 text-xs text-red-500 border-red-200 hover:bg-red-50 ml-auto",onClick:()=>w(k),disabled:g===k.id,children:[g===k.id?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(un,{className:"w-3.5 h-3.5"}),"Delete"]})]})]},k.id)})]})]})}const $p={open:{label:"Open",color:"bg-red-100 text-red-700 border-red-200"},in_review:{label:"In Review",color:"bg-amber-100 text-amber-700 border-amber-200"},resolved:{label:"Resolved",color:"bg-emerald-100 text-emerald-700 border-emerald-200"},dismissed:{label:"Dismissed",color:"bg-gray-100 text-gray-500 border-gray-200"},archived:{label:"Archived",color:"bg-slate-100 text-slate-500 border-slate-200"}};function BBe({status:e}){const t=$p[e]||$p.open;return r.jsx("span",{className:`text-xs font-medium px-2.5 py-0.5 rounded-full border ${t.color}`,children:t.label})}function FBe({issue:e,testSets:t,defaultTestSetId:n,onClose:s,onCreated:a}){var j;const[i,o]=h.useState(n||""),[l,c]=h.useState(((j=e.query)==null?void 0:j.slice(0,80))||""),[d,f]=h.useState(e.expected_answer||""),[m,g]=h.useState(!1);async function x(){if(!i||!l)return;g(!0);const b=await Y.entities.TestCase.create({test_set_id:i,name:l,description:"Created from issue report",query:e.query,expected_answer:d});await Y.entities.IssueReport.update(e.id,{linked_test_case_id:b.id}),g(!1),a(b),s()}return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:s,children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-md mx-4 p-5 space-y-4",onClick:b=>b.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"font-semibold text-gray-800",children:"Create Test Case from Issue"}),r.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Test Set"}),r.jsxs("select",{className:"w-full mt-1 border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:i,onChange:b=>o(b.target.value),children:[r.jsx("option",{value:"",children:"— Select test set —"}),t.map(b=>r.jsx("option",{value:b.id,children:b.name},b.id))]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Test Case Name"}),r.jsx("input",{className:"w-full mt-1 border rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-400",value:l,onCh
1666ange:b=>c(b.target.value),placeholder:"Name for this test case"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Query (pre-filled from issue)"}),r.jsx("div",{className:"w-full mt-1 border rounded-lg px-3 py-2 text-sm bg-gray-50 text-gray-700",children:e.query})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Expected Answer"}),r.jsx("textarea",{className:"w-full mt-1 border rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-400 min-h-[80px] resize-y",value:d,onChange:b=>f(b.target.value),placeholder:"What should the correct answer contain?"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(de,{size:"sm",variant:"outline",onClick:s,children:"Cancel"}),r.jsxs(de,{size:"sm",onClick:x,disabled:!i||!l||m,children:[m?r.jsx(Pe,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(ln,{className:"w-3 h-3 mr-1"}),"Create Test Case"]})]})]})})}function zBe({issue:e,testSets:t,onClose:n,onLinked:s}){const[a,i]=h.useState(""),[o,l]=h.useState([]),[c,d]=h.useState(e.linked_test_case_id||""),[f,m]=h.useState(!1),[g,x]=h.useState(!1),[j,b]=h.useState("");h.useEffect(()=>{if(!a){l([]);return}m(!0),Y.entities.TestCase.filter({test_set_id:a},"name").then(_=>{l(_),m(!1)})},[a]);const y=j.trim()?o.filter(_=>_.name.toLowerCase().includes(j.toLowerCase())||(_.query||"").toLowerCase().includes(j.toLowerCase())):o;async function w(){x(!0),await Y.entities.IssueReport.update(e.id,{linked_test_case_id:c||null}),x(!1),s(c||null),n()}return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:n,children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-md mx-4 p-5 space-y-4",onClick:_=>_.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"font-semibold text-gray-800 text-sm",children:"Link to Test Case"}),r.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Test Set"}),r.jsxs("select",{className:"w-full mt-1 border rounded-lg px-3 py-2 text-sm bg-white outline-none focus:border-indigo-400",value:a,onChange:_=>{i(_.target.value),d(""),b("")},children:[r.jsx("option",{value:"",children:"— Select test set —"}),t.map(_=>r.jsx("option",{value:_.id,children:_.name},_.id))]})]}),a&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-semibold text-gray-500",children:"Test Case"}),r.jsx("input",{className:"w-full border rounded-lg px-3 py-2 text-sm outline-none focus:border-indigo-400",placeholder:"Search test cases…",value:j,onChange:_=>b(_.target.value)}),f?r.jsx("div",{className:"text-xs text-gray-400 py-2 text-center",children:"Loading…"}):r.jsxs("div",{className:"border rounded-lg overflow-auto max-h-52 divide-y",children:[r.jsx("div",{className:`px-3 py-2 text-sm cursor-pointer hover:bg-gray-50 text-gray-400 italic ${c?"":"bg-indigo-50 text-indigo-600 font-medium not-italic"}`,onClick:()=>d(""),children:"— Unlink —"}),y.map(_=>r.jsxs("div",{onClick:()=>d(_.id),className:`px-3 py-2 text-sm cursor-pointer hover:bg-gray-50 ${c===_.id?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-800"}`,children:[r.jsx("div",{className:"font-medium leading-snug",children:_.name}),_.query&&r.jsxs("div",{className:"text-xs text-gray-400 truncate mt-0.5",children:['"',_.query,'"']})]},_.id)),y.length===0&&r.jsx("div",{className:"px-3 py-3 text-xs text-gray-400 text-center",children:"No matches"})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(de,{size:"sm",variant:"outline",onClick:n,children:"Cancel"}),r.jsxs(de,{size:"sm",onClick:w,disabled:g||!a,children:[g?r.jsx(Pe,{className:"w-3 h-3 animate-spin mr-1"}):null," Save"]})]})]})})}function UBe({issue:e,testSets:t,defaultTestSetId:n,onUpdate:s,onDelete:a,onStarChange:i}){const[o,l]=h.useState(!1),[c,d]=h.useState(e.status||"open"),[f,m]=h.useState(!!e.starred),[g,x]=h.useState(e.resolution_notes||""),[j,b]=h.useState(!1),[y,w]=h.useState(!1),[_,N]=h.useState(!1),[C,k]=h.useState(e.linked_test_case_id||null),[S,A]=h.useState((e.tags||[]).map(V=>V.toLowerCase())),[T,R]=h.useState("");async function B(V){V.stopPropagation();const K=!f;m(K),await Y.entities.IssueReport.update(e.id,{starred:K}),i(e.id,K)}async function D(V){b(!0),d(V),await Y.entities.IssueReport.update(e.id,{status:V,resolution_notes:g}),b(!1),s()}async function P(){b(!0),await Y.entities.IssueReport.update(e.id,{resolution_notes:g}),b(!1)}async function I(){const V=T.trim().toLowerCase();if(!V||S.includes(V))return;const K=[...S,V];A(K),R(""),await Y.entities.IssueReport.update(e.id,{tags:K})}async function z(V){const K=S.filter(M=>M!==V);A(K),await Y.entities.IssueReport.update(e.id,{tags:K})}const L=e.reported_at?new Date(e.reported_at):null,H=L?L.toLocaleDateString():"—",W=L?L.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"—";return r.jsxs("div",{className:`border rounded-xl overflow-hidden ${f?"border-amber-300 bg-amber-50/30":"border-gray-200"}`,children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 bg-white hover:bg-gray-50 cursor-pointer",onClick:()=>l(V=>!V),children:[r.jsx("button",{onClick:B,className:`shrink-0 transition-colors ${f?"text-amber-400 hover:text-amber-600":"text-gray-300 hover:text-amber-400"}`,title:f?"Unstar":"Star this issue",children:r.jsx(Xi,{className:"w-4 h-4",fill:f?"currentColor":"none"})}),e.issue_type==="content_suggestion"?r.jsx("span",{className:"text-base shrink-0",children:"💡"}):r.jsx(Nr,{className:"w-4 h-4 text-amber-400 shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:e.query||"—"}),e.issue_type==="content_suggestion"&&r.jsx("span",{className:"text-[10px] font-medium bg-emerald-50 text-emerald-700 border border-emerald-200 rounded-full px-2 py-0.5 
1666shrink-0",children:"Content Suggestion"})]}),r.jsxs("p",{className:"text-xs text-gray-400",children:[e.reporter_name||"Anonymous"," · ",H," ",W," · ",e.assistant_name||e.assistant_key||"—"]})]}),S.length>0&&r.jsxs("div",{className:"hidden sm:flex gap-1",children:[S.slice(0,3).map(V=>r.jsx("span",{className:"text-[10px] bg-violet-50 text-violet-600 border border-violet-200 px-1.5 py-0.5 rounded-full font-medium",children:V},V)),S.length>3&&r.jsxs("span",{className:"text-[10px] text-gray-400",children:["+",S.length-3]})]}),C&&r.jsx(Oj,{className:"w-3.5 h-3.5 text-indigo-400 shrink-0",title:"Linked to test case"}),r.jsx(BBe,{status:c}),o?r.jsx(Mn,{className:"w-4 h-4 text-gray-400 shrink-0"}):r.jsx(gt,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),o&&r.jsxs("div",{className:"border-t border-gray-100 bg-gray-50 p-4 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold text-gray-600",children:"Date:"})," ",r.jsx("span",{className:"text-gray-700",children:H})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold text-gray-600",children:"Time:"})," ",r.jsx("span",{className:"text-gray-700",children:W})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold text-gray-600",children:"Reporter:"})," ",r.jsx("span",{className:"text-gray-700",children:e.reporter_name||"—"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold text-gray-600",children:"Chat ID:"})," ",r.jsx("span",{className:"text-gray-700 font-mono",children:e.chat_id||"—"})]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-gray-600 mb-1",children:"Query"}),r.jsx("div",{className:"bg-white border border-gray-200 rounded-lg px-3 py-2 text-sm text-gray-800",children:e.query})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-gray-600 mb-1",children:"Answer"}),r.jsx("div",{className:"bg-white border border-gray-200 rounded-lg px-3 py-2 text-sm text-gray-800 max-h-32 overflow-y-auto",children:e.answer})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-gray-600 mb-1",children:"Expected Answer"}),r.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg px-3 py-2 text-sm text-gray-800",children:e.expected_answer})]}),e.suggested_content&&r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-gray-600 mb-1 flex items-center gap-1",children:"💡 Suggested Content"}),r.jsx("div",{className:"bg-emerald-50 border border-emerald-200 rounded-lg px-3 py-2 text-sm text-gray-800",children:e.suggested_content})]}),e.comments&&r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-gray-600 mb-1",children:"Comments"}),r.jsx("div",{className:"bg-white border border-gray-200 rounded-lg px-3 py-2 text-sm text-gray-700",children:e.comments})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-xs font-semibold text-gray-600 mb-1.5 flex items-center gap-1",children:[r.jsx(ac,{className:"w-3 h-3"})," Tags"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:S.map(V=>r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs bg-violet-50 text-violet-700 border border-violet-200 px-2 py-0.5 rounded-full font-medium",children:[V,r.jsx("button",{onClick:()=>z(V),className:"hover:text-red-500 transition-colors",children:r.jsx(jt,{className:"w-2.5 h-2.5"})})]},V))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:"flex-1 border border-gray-200 rounded-lg px-3 py-1.5 text-xs outline-none focus:ring-1 focus:ring-violet-400",placeholder:"Add tag…",value:T,onChange:V=>R(V.target.value),onKeyDown:V=>V.key==="Enter"&&I()}),r.jsx("button",{onClick:I,disabled:!T.trim(),className:"px-3 py-1.5 text-xs bg-violet-600 text-white rounded-lg hover:bg-violet-700 disabled:opacity-40 transition-colors font-medium",children:"Add"})]})]}),e.full_prompt&&r.jsxs("details",{className:"text-xs",children:[r.jsx("summary",{className:"cursor-pointer text-indigo-600 font-medium",children:"▼ Full Prompt"}),r.jsx("pre",{className:"mt-2 bg-indigo-950 text-indigo-200 rounded-lg p-3 overflow-auto max-h-48 whitespace-pre-wrap",children:e.full_prompt})]}),e.raw_data&&r.jsxs("details",{className:"text-xs",children:[r.jsx("summary",{className:"cursor-pointer text-gray-500 font-medium",children:"▼ Raw JSON"}),r.jsx("pre",{className:"mt-2 bg-gray-900 text-green-300 rounded-lg p-3 overflow-auto max-h-48 text-[11px]",children:JSON.stringify(e.raw_data,null,2)})]}),C&&r.jsxs("div",{className:"flex items-center gap-2 bg-indigo-50 border border-indigo-100 rounded-lg px-3 py-2 text-xs text-indigo-700",children:[r.jsx(Oj,{className:"w-3.5 h-3.5 shrink-0"}),r.jsx("span",{children:"Linked to test case"}),r.jsxs("a",{href:yt(`TestCaseEdit?id=${C}`),target:"_blank",rel:"noopener noreferrer",className:"underline flex items-center gap-1 hover:text-indigo-900",children:["Open ",r.jsx(yr,{className:"w-2.5 h-2.5"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap pt-1 border-t border-gray-200",children:[r.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-1.5 text-xs border border-indigo-200 text-indigo-600 px-3 py-1.5 rounded-lg hover:bg-indigo-50 transition-colors font-medium",children:[r.jsx(Oj,{className:"w-3.5 h-3.5"})," ",C?"Re-link":"Link"," Test Case"]}),r.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-1.5 text-xs border border-teal-200 text-teal-600 px-3 py-1.5 rounded-lg hover:bg-teal-50 transition-colors font-medium",children:[r.jsx(ln,{className:"w-3.5 h-3.5"})," Create Test Case"]}),r.jsxs("button",{onClick:()=>D("archived"),disabled:c==="archived"||j,className:"flex items-center gap-1.5 text-xs border border-slate-200 text-slate-500 px-3 py-1.5 rounded-lg hover:bg-slate-50 transition-colors font-medium disabled:opacity-40",children:[r.jsx(Ih,{className:"w-3.5 h-3.5"})," Archive"]}),r.jsxs("button",{onClick:()=>a(e),className:"flex items-center gap-1.5 text-xs border border-red-200 text-red-500 px-3 py-1.5 rounded-lg hover:bg-red-50 transition-colors font-medium ml-auto",children:[r.jsx(un,{className:"w-3.5 h-3.5"})," Delete"]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap border-t border-gray-200 pt-2",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-600",children:"Change Status:"}),Object.entries($p).filter(([V])=>V!=="archived").map(([V,K])=>r.jsx("button",{onClick:()=>D(V),disabled:c===V||j,className:`text-xs px-3 py-1 rounded-full border font-medium transition-colors disabled:opacity-50 ${c===V?K.color:"border-gray-200 text-gray-500 hover:bg-gray-100"}`,children:K.label},V))]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs font-semibold text-gray-600 mb-1",children:"Resolution Notes"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("textarea",{value:g,onChange:V=>x(V.target.value),rows:2,placeholder:"Add resolution notes...",className:"flex-1 border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400 resize-none"}),r.jsx("button",{onClick:P,disabled:j,className:"px-3 py-2 bg-indigo-600 text-white rounded-lg text-xs font-medium hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:j?"…":"Save"})]})]})]}),y&&r.jsx(FBe,{issue:e,testSets:t,defaultTestSetId:n,onClose:()=>w(!1),onCreated:V=>k(V.id)}),_&&r.jsx(zBe,{issue:e,testSets:t,onClose:()=>N(!1),onLinked:V=>k(V)})]})}function qBe(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState(!0),[o,l]=h.useState("open"),[c,d]=h.useState(""),[f,m]=h.useState(""),[g,x]=h.useState(""),[j,b]=h.useState(""),[y,w]=h.useState(()=>localStorage.getItem("issueDefaultTestSetId")||""),[_,N]=h.useState(new Set),[C,k]=h.useState("all"),[S,A]=h.useState("asc");async function T(){i(!0);const[K,M]=await Promise.all([Y.entities.IssueReport.list("-reported_at"),Y.entities.TestSet.list("name")]);t(K),s(M),i(!1)}h.useEffect(()=>{T()},[]);function R(K){w(K),localStorage.setItem("issueDefaultTestSetId",K)}async function B(K){confirm("Delete this issue report? This cannot be undone.")&&(await Y.entities.IssueReport.delete(K.id),t(M=>M.filter(G=>G.id!==K.id)))}function D(K,M){t(G=>G.map(q=>q.id===K?{...q,starred:M}:q))}const P=[...new Set(e.map(K=>
1666K.reporter_name).filter(Boolean))],I=[...new Set(e.map(K=>K.assistant_name||K.assistant_key).filter(Boolean))],z=[...new Set(e.flatMap(K=>(K.tags||[]).map(M=>M.toLowerCase())))].sort();function L(K){N(M=>{const G=new Set(M);return G.has(K)?G.delete(K):G.add(K),G})}const H=e.filter(K=>{if(o!=="all"&&(K.status||"open")!==o||c&&(K.reporter_name||"")!==c||f&&(K.assistant_name||K.assistant_key||"")!==f||g&&new Date(K.reported_at)<new Date(g)||j&&new Date(K.reported_at)>new Date(j+"T23:59:59"))return!1;if(_.size>0){const M=K.tags||[];if(![..._].every(G=>M.includes(G)))return!1}return!(C!=="all"&&(K.issue_type||"answer_quality")!==C)}).sort((K,M)=>{if(!!K.starred!=!!M.starred)return K.starred?-1:1;const G=new Date(K.reported_at||0),q=new Date(M.reported_at||0);return S==="asc"?G-q:q-G}),W=e.reduce((K,M)=>{const G=M.status||"open";return K[G]=(K[G]||0)+1,K},{}),V=[...Object.entries($p).map(([K,M])=>[K,M.label]),["all","All"]];return r.jsxs("div",{className:"p-6 md:p-8 max-w-4xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 gap-3 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-100 flex items-center justify-center shrink-0",children:r.jsx(Nr,{className:"w-5 h-5 text-amber-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Issue Reports"}),r.jsx("p",{className:"text-gray-500 text-xs mt-0.5",children:"User-reported answer quality issues"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-1.5 border border-indigo-200 rounded-lg px-2 py-1 bg-indigo-50",children:[r.jsx("span",{className:"text-xs text-indigo-600 font-medium whitespace-nowrap",children:"Default set:"}),r.jsxs("select",{className:"border-0 bg-transparent text-xs text-indigo-700 outline-none font-medium",value:y,onChange:K=>R(K.target.value),children:[r.jsx("option",{value:"",children:"— None —"}),n.map(K=>r.jsx("option",{value:K.id,children:K.name},K.id))]})]}),r.jsxs("button",{onClick:T,className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 border border-gray-200 rounded-lg px-3 py-1.5 hover:bg-gray-50 transition-colors",children:[r.jsx(Rn,{className:"w-3.5 h-3.5"})," Refresh"]})]})]}),r.jsx("div",{className:"grid grid-cols-5 gap-2 mb-4",children:Object.entries($p).map(([K,M])=>r.jsxs("div",{className:`border rounded-xl px-3 py-2 ${M.color}`,children:[r.jsx("p",{className:"text-[10px] font-medium opacity-70",children:M.label}),r.jsx("p",{className:"text-xl font-bold",children:W[K]||0})]},K))}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-3 bg-white border rounded-xl p-3",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-500",children:"Filters:"}),r.jsxs("select",{className:"border rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:border-indigo-400",value:c,onChange:K=>d(K.target.value),children:[r.jsx("option",{value:"",children:"All reporters"}),P.map(K=>r.jsx("option",{value:K,children:K},K))]}),r.jsxs("select",{className:"border rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:border-indigo-400",value:f,onChange:K=>m(K.target.value),children:[r.jsx("option",{value:"",children:"All assistants"}),I.map(K=>r.jsx("option",{value:K,children:K},K))]}),r.jsx("input",{type:"date",className:"border rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:border-indigo-400",value:g,onChange:K=>x(K.target.value),title:"From date"}),r.jsx("span",{className:"text-xs text-gray-400",children:"→"}),r.jsx("input",{type:"date",className:"border rounded-lg px-2 py-1.5 text-xs bg-white outline-none focus:border-indigo-400",value:j,onChange:K=>b(K.target.value),title:"To date"}),r.jsx("div",{className:"flex items-center gap-1",children:[["all","All types"],["answer_quality","⚑ Answer Quality"],["content_suggestion","💡 Suggestions"]].map(([K,M])=>r.jsx("button",{onClick:()=>k(K),className:`text-xs px-2.5 py-1.5 rounded-lg border font-medium transition-colors ${C===K?"bg-indigo-100 border-indigo-300 text-indigo-700":"border-gray-200 text-gray-500 hover:bg-gray-50"}`,children:M},K))}),(c||f||g||j||_.size>0||C!=="all")&&r.jsx("button",{onClick:()=>{d(""),m(""),x(""),b(""),N(new Set),k("all")},className:"text-xs text-gray-400 hover:text-red-500 transition-colors border border-gray-200 rounded-lg px-2 py-1.5",children:"Clear all"}),z.length>0&&r.jsxs("div",{className:"w-full flex items-center gap-2 flex-wrap pt-1 border-t border-gray-100 mt-1",children:[r.jsxs("span",{className:"text-xs text-gray-400 flex items-center gap-1",children:[r.jsx(ac,{className:"w-3 h-3"})," Tags:"]}),z.map(K=>{const M=_.has(K);return r.jsx("button",{onClick:()=>L(K),className:`text-xs px-2.5 py-0.5 rounded-full border font-medium transition-colors ${M?"bg-vi
1666olet-100 text-violet-700 border-violet-300":"bg-white text-gray-400 border-gray-200 hover:border-violet-300 hover:text-violet-600"}`,children:K},K)})]})]}),r.jsxs("div",{className:"flex items-center justify-between gap-2 mb-4 border-b flex-wrap",children:[r.jsx("div",{className:"flex gap-1 overflow-x-auto",children:V.map(([K,M])=>r.jsxs("button",{onClick:()=>l(K),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${o===K?"border-indigo-500 text-indigo-700":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[M," ",K!=="all"&&W[K]?`(${W[K]})`:""]},K))}),r.jsxs("button",{onClick:()=>A(K=>K==="asc"?"desc":"asc"),className:"flex items-center gap-1.5 text-xs border rounded-lg px-3 py-1.5 bg-white hover:bg-gray-50 text-gray-500 transition-colors whitespace-nowrap mb-1",title:S==="asc"?"Oldest first":"Recent first",children:[S==="asc"?r.jsx(eZ,{className:"w-3.5 h-3.5"}):r.jsx(GX,{className:"w-3.5 h-3.5"}),S==="asc"?"Oldest first":"Recent first"]})]}),a?r.jsx("div",{className:"text-center py-12 text-gray-400",children:"Loading..."}):H.length===0?r.jsx("div",{className:"text-center py-12 text-gray-400",children:"No issues found."}):r.jsx("div",{className:"space-y-2",children:H.map(K=>r.jsx(UBe,{issue:K,testSets:n,defaultTestSetId:y,onUpdate:T,onDelete:B,onStarChange:D},K.id))})]})}function KBe({issue:e}){const t=`/IssueReports?id=${e.id}`;return r.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:r.jsxs("div",{className:"inline-flex items-center gap-1.5 text-sm font-bold border-2 border-emerald-300 bg-emerald-50 text-emerald-700 rounded-lg px-3 py-1.5 hover:bg-emerald-100 hover:border-emerald-400 transition-colors cursor-pointer",children:[r.jsx(Zo,{className:"w-4 h-4"}),r.jsxs("span",{children:["Suggestion · ",e.suggested_content?e.suggested_content.slice(0,30)+(e.suggested_content.length>30?"...":""):"content"]})]})})}function h0({label:e,content:t,mono:n=!0}){const[s,a]=h.useState(!1);return t?r.jsxs("div",{className:"border border-gray-700 rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>a(i=>!i),className:"w-full flex items-center justify-between px-3 py-2 bg-gray-800 text-gray-300 text-[11px] font-semibold hover:bg-gray-700 transition-colors",children:[r.jsx("span",{children:e}),s?r.jsx(Mn,{className:"w-3 h-3"}):r.jsx(gt,{className:"w-3 h-3"})]}),s&&r.jsx("pre",{className:`p-2.5 text-[11px] whitespace-pre-wrap overflow-auto max-h-80 ${n?"text-green-300 font-mono":"text-gray-200"}`,children:typeof t=="string"?t:JSON.stringify(t,null,2)})]}):null}function VBe({summary:e}){if(!e)return null;const{full_prompt:t,full_response:n,raw_data:s,...a}=e;return r.jsxs("div",{className:"mt-2 bg-gray-900 rounded-lg p-2.5 space-y-2",children:[r.jsx(h0,{label:"📋 Summary / Meta",content:Object.keys(a).length>0?a:null}),r.jsx(h0,{label:"📝 Full Prompt",content:t,mono:!1}),r.jsx(h0,{label:"🤖 Full LLM Response",content:n,mono:!1}),r.jsx(h0,{label:"🗃 Raw Data (JSON)",content:s}),!t&&!n&&Object.keys(a).length===0&&!s&&r.jsx("pre",{className:"text-green-300 text-[11px] font-mono whitespace-pre-wrap overflow-auto max-h-48",children:JSON.stringify(e,null,2)})]})}function HBe({issue:e}){const t={open:"bg-red-50 border-red-200 text-red-700 hover:bg-red-100 hover:border-red-300",in_review:"bg-amber-50 border-amber-200 text-amber-700 hover:bg-amber-100 hover:border-amber-300",resolved:"bg-emerald-50 border-emerald-200 text-emerald-700 hover:bg-emerald-100 hover:border-emerald-300",dismissed:"bg-gray-100 border-gray-200 text-gray-500 hover:bg-gray-200 hover:border-gray-300",archived:"bg-gray-100 border-gray-200 text-gray-400 hover:bg-gray-200 hover:border-gray-300"},n=t[e.status]||t.open,s=`/IssueReports?id=${e.id}`;return r.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:r.jsxs("div",{className:`inline-flex items-center gap-1.5 text-sm font-bold border-2 rounded-lg px-3 py-1.5 transition-colors cursor-pointer ${n}`,children:[r.jsx(Nr,{className:"w-4 h-4"}),r.jsxs("span",{children:["Issue reported · ",e.status]})]})})}function WBe({msg:e,issues:t,specialNode:n,linkNode:s,prevMsg:a,assistant:i,chat:o,onIssueReported:l}){var w;const c=e.role==="user",[d,f]=h.useState(!1),[m,g]=h.useState(!1);let x=null;if(!c&&n&&((w=e.debug_summary)!=null&&w.raw_data)){const _=e.debug_summary.raw_data;Array.isArray(_[n])&&(x=_[n])}const j=(a==null?void 0:a.role)==="user"?a.content:"",b=c?[]:t.filter(_=>_.query&&j&&_.query.trim().slice(0,80)===j.trim().slice(0,80)),y=e.feedback;return r.jsxs("div",{className:`flex flex-col ${c?"items-end":"items-start"} gap-1`,children:[r.jsxs("div",{className:`flex gap-2.5 ${c?"flex-row-reverse":"flex-row"} items-end max-w-[82%]`,children:[r.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center shrink-0 mb-0.5 ${c?"bg-indigo-100":"bg-violet-100"}`,children:c?r.jsx(Ci,{className:"w-3.5 h-3.5 text-indigo-600"}):r.jsx(Vn,{className:"w-3.5 h-3.5 text-violet-600"})}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("div",{className:`rounded-2xl px-4 py-2.5 text-sm leading-relaxed ${c?"bg-indigo-600 text-white rounded-br-sm":"bg-white border border-gray-200 text-gray-800 rounded-bl-sm shadow-sm"}`,children:c?r.jsx("p",{className:"whitespace-pre-wrap",children:e.content}):r.jsx(Ym,{className:"prose prose-sm max-w-none prose-p:my-1 prose-headings:my-2",components:{a:({children:_,href:N})=>r.jsxs("a",{href:N,target:"_blank",rel:"noopener noreferrer",className:"text-indigo-600 hover:underline inline-flex items-center gap-0.5",children:[_,r.jsx(yr,{className:"w-3 h-3"})]})},children:e.content})}),r.jsxs("div",{className:`flex items-center gap-2 flex-wrap ${c?"justify-end":"justify-start"}`,children:[e.sent_at&&r.jsx("span",{className:"text-[10px] text-gray-400",children:gs(new Date(e.sent_at),"HH:mm")}
1666),!c&&r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] font-medium rounded-full px-2 py-0.5 border ${y==="up"?"bg-emerald-50 border-emerald-200 text-emerald-700":"bg-gray-50 border-gray-200 text-gray-300"}`,children:[r.jsx(qo,{className:"w-3 h-3"}),y==="up"?"Liked":""]}),r.jsxs("span",{className:`inline-flex items-center gap-1 text-[11px] font-medium rounded-full px-2 py-0.5 border ${y==="down"?"bg-red-50 border-red-200 text-red-600":"bg-gray-50 border-gray-200 text-gray-300"}`,children:[r.jsx(hc,{className:"w-3 h-3"}),y==="down"?"Disliked":""]})]}),!c&&r.jsxs("button",{onClick:()=>g(!0),className:"inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border border-gray-200 text-gray-400 hover:border-red-300 hover:text-red-500 transition-colors",children:[r.jsx(Nr,{className:"w-2.5 h-2.5"}),"report"]}),!c&&e.debug_summary&&r.jsxs("button",{onClick:()=>f(_=>!_),className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border transition-colors ${d?"bg-amber-100 border-amber-300 text-amber-700":"border-gray-200 text-gray-400 hover:border-amber-300 hover:text-amber-600"}`,children:[r.jsx(Mh,{className:"w-2.5 h-2.5"}),d?"hide":"debug"]})]}),d&&r.jsx(VBe,{summary:e.debug_summary})]})]}),!c&&x&&x.length>0&&r.jsx("div",{className:"ml-9 w-full max-w-[82%]",children:r.jsx(i3,{items:x,linkNode:s})}),b.length>0&&r.jsx("div",{className:"flex flex-col gap-1 items-start pl-9",children:b.map(_=>_.issue_type==="content_suggestion"?r.jsx(KBe,{issue:_},_.id):r.jsx(HBe,{issue:_},_.id))}),m&&r.jsx(o3,{msg:e,query:j,chatId:o==null?void 0:o.id,assistantKey:(i==null?void 0:i.assistant_key)||"",assistantName:(i==null?void 0:i.name)||"",reporterName:"",onClose:()=>g(!1),onNameSave:()=>{}})]})}function GBe(){const t=new URLSearchParams(window.location.search).get("id"),[n,s]=h.useState(null),[a,i]=h.useState(null),[o,l]=h.useState(null),[c,d]=h.useState([]),[f,m]=h.useState([]),[g,x]=h.useState(null),[j,b]=h.useState(!0),y=h.useRef(null);h.useEffect(()=>{t&&w()},[t]),h.useEffect(()=>{var C;(C=y.current)==null||C.scrollIntoView({behavior:"smooth"})},[c]);async function w(){b(!0);const[C,k]=await Promise.all([Y.entities.Chat.get(t),Y.entities.AppConfig.list(null,1)]);if(s(C),k[0]&&x(k[0]),C){const S=await Y.entities.Message.filter({chat_id:C.id});S.sort((B,D)=>B.sent_at>D.sent_at?1:-1),d(S),b(!1);const[A,T,R]=await Promise.all([C.assistant_id?Y.entities.Assistant.get(C.assistant_id).catch(()=>null):Promise.resolve(null),C.root_shell_id?Y.entities.Shell.get(C.root_shell_id).catch(()=>null):Promise.resolve(null),Y.entities.IssueReport.filter({chat_id:C.id})]);A&&i(A),T&&l(T),m(R)}else b(!1)}const _=(g==null?void 0:g.embed_special_node)||"",N=(g==null?void 0:g.embed_link_node)||"ContentLink";return j?r.jsxs("div",{className:"flex items-center justify-center h-64 text-gray-400",children:[r.jsx("div",{className:"w-6 h-6 border-2 border-indigo-400 border-t-transparent rounded-full animate-spin mr-2"}),"Loading…"]}):n?r.jsxs("div",{className:"flex flex-col h-full max-h-full overflow-hidden",children:[r.jsxs("div",{className:"bg-white border-b px-5 py-3 flex items-center gap-3 shrink-0 shadow-sm",children:[r.jsx(wt,{to:yt("ConversationsExplorer"),children:r.jsx("button",{className:"p-1.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-colors",children:r.jsx(or,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-50 border border-indigo-100 flex items-center justify-center shrink-0 overflow-hidden",children:a!=null&&a.icon_url?r.jsx("img",{src:a.icon_url,alt:"",className:"w-full h-full object-contain"}):o?r.jsx(Sa,{className:"w-4 h-4 text-indigo-400"}):r.jsx(Vn,{className:"w-4 h-4 text-indigo-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-semibold text-sm text-gray-900 truncate",children:n.title||"Untitled"}),r.jsxs("p",{className:"text-xs text-gray-400",children:[(a==null?void 0:a.name)||(o==null?void 0:o.name)||"—"," · ",n.user_email||"Unknown user"," · ",n.started_at?gs(new Date(n.started_at),"MMM d, yyyy HH:mm"):""," · ",c.length," messages",f.length>0&&r.jsxs("span",{className:"ml-1 text-red-500 font-medium",children:["· ",f.length," issue",f.length>
16661?"s":""]})]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-5 space-y-4 bg-gray-50/50",children:r.jsxs("div",{className:"max-w-3xl mx-auto space-y-4",children:[c.length===0?r.jsx("div",{className:"text-center py-16 text-gray-400",children:"No messages in this conversation."}):c.map((C,k)=>r.jsx(WBe,{msg:C,prevMsg:c[k-1],issues:f,specialNode:_,linkNode:N,assistant:a,chat:n},C.id)),r.jsx("div",{ref:y})]})})]}):r.jsx("div",{className:"flex items-center justify-center h-64 text-gray-400",children:"Chat not found."})}function YBe({items:e,value:t,onChange:n,disabled:s,itemOptional:a,loading:i}){const[o,l]=h.useState(!1),[c,d]=h.useState(""),f=h.useRef(null),m=h.useRef(null),g=e.find(y=>y.id===t),x=e.filter(y=>{var w;return!c.trim()||((w=y.title)==null?void 0:w.toLowerCase().includes(c.toLowerCase()))});h.useEffect(()=>{function y(w){f.current&&!f.current.contains(w.target)&&l(!1)}return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]),h.useEffect(()=>{o?setTimeout(()=>{var y;return(y=m.current)==null?void 0:y.focus()},50):d("")},[o]);const j=y=>{n(y),l(!1)},b=i?"Loading items…":!e.length&&!t?"No items found":"Select an item…";return r.jsxs("div",{className:"relative",ref:f,children:[r.jsxs("button",{type:"button",disabled:s,onClick:()=>!s&&l(y=>!y),className:`w-full flex items-center justify-between gap-2 border rounded-md px-3 py-2 text-sm bg-white text-left transition-colors
1667          ${s?"opacity-50 cursor-not-allowed bg-gray-50":"hover:border-gray-400 cursor-pointer"}
1668          ${o?"border-indigo-400 ring-1 ring-indigo-200":"border-gray-200"}`,children:[r.jsx("span",{className:g?"text-gray-900 truncate":"text-gray-400",children:g?g.title:t==="all"?"— All items —":b}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t&&t!=="all"&&!s&&r.jsx("span",{onClick:y=>{y.stopPropagation(),j("all")},className:"text-gray-400 hover:text-gray-600 p-0.5",children:r.jsx(jt,{className:"w-3 h-3"})}),r.jsx(ur,{className:"w-3.5 h-3.5 text-gray-400"})]})]}),o&&r.jsxs("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden",children:[r.jsx("div",{className:"p-2 border-b",children:r.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-md px-2 py-1.5",children:[r.jsx(ur,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsx("input",{ref:m,type:"text",value:c,onChange:y=>d(y.target.value),placeholder:"Type to filter…",className:"bg-transparent text-sm outline-none flex-1 placeholder-gray-400"}),c&&r.jsx("button",{onClick:()=>d(""),className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-3 h-3"})})]})}),r.jsxs("div",{className:"max-h-56 overflow-y-auto py-1",children:[a&&r.jsx("button",{onClick:()=>j("all"),className:`w-full text-left px-3 py-2 text-sm transition-colors hover:bg-gray-50 ${t==="all"?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-500"}`,children:"— All items —"}),x.length===0?r.jsxs("p",{className:"px-3 py-3 text-sm text-gray-400 text-center",children:['No items match "',c,'"']}):x.map(y=>r.jsx("button",{onClick:()=>j(y.id),className:`w-full text-left px-3 py-2 text-sm transition-colors hover:bg-gray-50 truncate
1669                    ${y.id===t?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-700"}`,children:y.title},y.id))]}),e.length>0&&r.jsxs("div",{className:"border-t px-3 py-1.5 text-[11px] text-gray-400",children:[x.length," of ",e.length," items"]})]})]})}function LY({kbs:e,items:t,loadingKbs:n,loadingItems:s,selectedKbId:a,selectedItemId:i,onKbChange:o,onItemChange:l,itemOptional:c=!1}){return r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Knowledge Base"}),r.jsxs(cc,{value:a||"all",onValueChange:d=>{o(d==="all"?"":d),l("")},disabled:n,children:[r.jsx(Jo,{children:r.jsx(dc,{placeholder:n?"Loading…":"Select a Knowledge Base"})}),r.jsxs(Qo,{children:[r.jsx(Kn,{value:"all",children:"— All KBs —"}),e.map(d=>r.jsx(Kn,{value:d.id,children:d.name},d.id))]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(ot,{children:["Knowledge Item ",c&&r.jsx("span",{className:"text-gray-400 font-normal",children:"(optional)"})]}),r.jsx(YBe,{items:t,value:i||"",onChange:l,disabled:!a||s,itemOptional:c,loading:s})]})]})}function JBe({kbs:e,items:t,loadingKbs:n,onKbChange:s}){const[a,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(""),[f,m]=h.useState([]),[g,x]=h.useState(!1),[j,b]=h.useState(""),[y,w]=h.useState(!1),[_,N]=h.useState(null),C=D=>{i(D),l(""),d(""),m([]),b(""),N(null),s(D)}
1669,k=async D=>{if(l(D),d(""),b(""),m([]),N(null),!D)return;x(!0);const P=await Y.entities.KnowledgeChunk.filter({knowledge_item_id:D},"chunk_index",200);P.sort((I,z)=>(I.chunk_index??0)-(z.chunk_index??0)),m(P||[]),x(!1)},S=D=>{d(D);const P=f.find(I=>I.id===D);P&&b(P.content||"")},A=e.find(D=>D.id===a),T=t.find(D=>D.id===o),R=f.find(D=>D.id===c),B=async()=>{if(!j.trim())return;w(!0),N(null);const D={};a&&(D.knowledge_base_id=a),A&&(D.knowledge_base_name=A.name),o&&(D.knowledge_item_id=o),T&&(D.item_title=T.title),c&&(D.chunk_id=c),R&&(D.chunk_index=R.chunk_index??0);const P=await Y.functions.invoke("storeEmbeddings",{text:j,metadata:D});N(P.data),w(!1)};return r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-5",children:[r.jsx("h2",{className:"font-medium text-gray-800",children:"Store a Vector Embedding"}),r.jsx(LY,{kbs:e,items:t,loadingKbs:n,selectedKbId:a,selectedItemId:o,onKbChange:C,onItemChange:k}),o&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(ot,{children:["Chunk ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(loads text automatically)"})]}),r.jsxs(cc,{value:c,onValueChange:S,disabled:g,children:[r.jsx(Jo,{children:r.jsx(dc,{placeholder:g?"Loading chunks…":f.length===0?"No chunks found":"Select a chunk"})}),r.jsx(Qo,{children:f.map(D=>{var P;return r.jsxs(Kn,{value:D.id,children:["Chunk #",D.chunk_index??"?"," — ",D.char_count??((P=D.content)==null?void 0:P.length)??0," chars"]},D.id)})})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Text to Embed"}),r.jsx(rr,{rows:6,placeholder:"Select a chunk above or paste text to embed…",value:j,onChange:D=>b(D.target.value)}),j&&r.jsxs("p",{className:"text-xs text-gray-400",children:[j.length," characters"]})]}),r.jsx(de,{onClick:B,disabled:y||!j.trim(),children:y?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 mr-2 animate-spin"}),"Storing…"]}):"Store Embedding"})]}),_&&r.jsx("div",{className:`rounded-xl border p-4 text-sm ${_.error?"border-red-200 bg-red-50":"border-emerald-200 bg-emerald-50"}`,children:_.error?r.jsxs("div",{className:"flex items-start gap-2 text-red-700",children:[r.jsx(fr,{className:"w-4 h-4 mt-0.5 shrink-0"}),r.jsx("span",{children:_.error})]}):r.jsxs("div",{className:"flex items-start gap-2 text-emerald-700",children:[r.jsx(mr,{className:"w-4 h-4 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Stored successfully"}),r.jsxs("p",{className:"text-xs mt-1 text-emerald-600",children:["ID: ",_.id," · ",_.dimensions," dimensions · Model: ",_.model]})]})]})})]})}function QBe({text:e}){const[t,n]=h.useState("idle"),s=async a=>{var i;a.stopPropagation(),n("loading");try{const o=await Y.functions.invoke("jinaEmbeddings",{text:e}),l=(i=o==null?void 0:o.data)==null?void 0:i.embedding;l?(navigator.clipboard.writeText(JSON.stringify(l)),n("done"),setTimeout(()=>n("idle"),2e3)):(n("error"),setTimeout(()=>n("idle"),2e3))}catch{n("error"),setTimeout(()=>n("idle"),2e3)}};return r.jsxs("button",{onClick:s,disabled:t==="loading",className:`flex items-center gap-1 text-[10px] border rounded px-2 py-0.5 transition-colors bg-white
1670        text-gray-500 border-gray-200 hover:text-indigo-600 hover:border-indigo-300 disabled:opacity-60`,title:"Embed this chunk and copy vector JSON",children:[t==="loading"&&r.jsx(Pe,{className:"w-2.5 h-2.5 animate-spin"}),t==="done"&&r.jsx(Tn,{className:"w-2.5 h-2.5 text-emerald-500"}),t==="error"&&r.jsx(fr,{className:"w-2.5 h-2.5 text-red-400"}),t==="idle"&&r.jsx(ys,{className:"w-2.5 h-2.5"}),t==="loading"?"Embedding…":t==="done"?"Copied!":t==="error"?"Error":"Copy Embedding"]})}function XBe({items:e,value:t,onChange:n,disabled:s}){const[a,i]=h.useState(!1),[o,l]=h.useState(""),c=h.useRef(null),d=h.useRef(null),f=e.find(x=>x.id===t),m=e.filter(x=>{var j;return!o.trim()||((j=x.title)==null?void 0:j.toLowerCase().includes(o.toLowerCase()))});h.useEffect(()=>{function x(j){c.current&&!c.current.contains(j.target)&&i(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]),h.useEffect(()=>{a?setTimeout(()=>{var x;return(x=d.current)==null?void 0:x.focus()},50):l("")},[a]);const g=x=>{n(x),i(!1)};return r.jsxs("div",{className:"relative overflow-visible",ref:c,children:[r.jsxs("button",{type:"button",disabled:s,onClick:()=>!s&&i(x=>!x),className:`w-full flex items-center justify-between gap-2 border rounded-md px-3 py-2 text-sm bg-white text-left transition-colors
1671          ${s?"opacity-50 cursor-not-allowed bg-gray-50":"hover:border-gray-400 cursor-pointer"}
1672          ${a?"border-indigo-400 ring-1 ring-indigo-200":"border-gray-200"}`,children:[r.jsx("span",{className:f?"text-gray-900 truncate":"text-gray-400",children:f?f.title:t==="all"?"— All items —":"All items"}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t&&t!=="all"&&!s&&r.jsx("span",{onClick:x=>{x.stopPropagation(),g("all")},className:"text-gray-400 hover:text-gray-600 p-0.5",children:r.jsx(jt,{className:"w-3 h-3"})}),r.jsx(ur,{className:"w-3.5 h-3.5 text-gray-400"})]})]}),a&&r.jsxs("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg overflow-hidden max-h-64",children:[r.jsx("div",{className:"p-2 border-b",children:r.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-md px-2 py-1.5",children:[r.jsx(ur,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsx("input",{ref:d,type:"text",value:o,onChange:x=>l(x.target.value),placeholder:"Type to filter…",className:"bg-transparent text-sm outline-none flex-1 placeholder-gray-400"}),o&&r.jsx("button",{onClick:()=>l(""),className:"text-gray-400 hover:text-gray-600",children:r.jsx(jt,{className:"w-3 h-3"})})]})}),r.jsxs("div",{className:"max-h-56 overflow-y-auto py-1",children:[r.jsx("button",{onClick:()=>g("all"),className:`w-full text-left px-3 py-2 text-sm transition-colors hover:bg-gray-50 ${t==="all"?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-500"}`,children:"— All items —"}),m.length===0?r.jsxs("p",{className:"px-3 py-3 text-sm text-gray-400 text-center",children:['No items match "',o,'"']}):m.map(x=>r.jsx("button",{onClick:()=>g(x.id),className:`w-full text-left px-3 py-2 text-sm transition-colors hover:bg-gray-50 truncate
1673                    ${x.id===t?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-700"}`,children:x.title},x.id))]}),e.length>0&&r.jsxs("div",{className:"border-t px-3 py-1.5 text-[11px] text-gray-400",children:[m.length," of ",e.length," items"]})]})]})}function ZBe({doc:e,onDelete:t,showEmbeddings:n}){var f;const[s,a]=h.useState(!1),[i,o]=h.useState(!1),l=async()=>
1673{if(confirm("Delete this document from Supabase?")){o(!0);try{await t(e.id)}finally{o(!1)}}},c=e.metadata||{},d=e.embedding?typeof e.embedding=="string"?JSON.parse(e.embedding):e.embedding:null;return r.jsxs("div",{className:"border rounded-lg bg-white overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-gray-800 truncate",children:c.item_title||"Untitled"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[c.knowledge_base_name&&r.jsx(Gr,{variant:"outline",className:"text-xs",children:c.knowledge_base_name}),c.chunk_index!==void 0&&r.jsxs("span",{className:"text-xs text-gray-400",children:["chunk #",c.chunk_index]}),c.chunk_id&&r.jsxs("span",{className:"text-xs text-gray-300 font-mono truncate max-w-[100px]",title:c.chunk_id,children:["cid: ",c.chunk_id.slice(0,8),"…"]}),r.jsxs("span",{className:"text-xs text-gray-400",children:[((f=e.content)==null?void 0:f.length)||0," chars"]}),n&&d&&r.jsxs("span",{className:"text-[10px] text-indigo-400 font-medium flex items-center gap-0.5",children:[r.jsx(ys,{className:"w-2.5 h-2.5"}),d.length,"d"]}),e.id&&r.jsxs("span",{className:"text-xs text-gray-300 font-mono truncate max-w-[80px]",children:["id: ",e.id]})]})]}),r.jsx("button",{onClick:()=>a(m=>!m),className:"p-1.5 text-gray-400 hover:text-gray-600",children:s?r.jsx(Mn,{className:"w-4 h-4"}):r.jsx(gt,{className:"w-4 h-4"})}),r.jsx(de,{size:"sm",variant:"ghost",className:"text-red-500 hover:bg-red-50 hover:text-red-600",onClick:l,disabled:i,children:i?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(un,{className:"w-3.5 h-3.5"})})]}),s&&r.jsxs("div",{className:"px-4 pb-3 border-t bg-gray-50 space-y-2 pt-2",children:[r.jsx("p",{className:"text-xs text-gray-600 whitespace-pre-wrap leading-relaxed",children:e.content}),n&&d&&r.jsx(sb,{embedding:d,label:`Vector (${c.content_type||"doc"})`}),!n&&e.content&&r.jsx(QBe,{text:e.content}),r.jsx("pre",{className:"text-xs text-gray-400 bg-gray-100 rounded p-2 overflow-auto max-h-40",children:JSON.stringify(e.metadata,null,2)})]})]})}function eFe({kbs:e,items:t,loadingKbs:n,onKbChange:s}){const[a,i]=h.useState("all"),[o,l]=h.useState("all"),[c,d]=h.useState(50),[f,m]=h.useState([]),[g,x]=h.useState(null),[j,b]=h.useState(!1),[y,w]=h.useState(null),[_,N]=h.useState(!1),[C,k]=h.useState(!1),[S,A]=h.useState("chunk_asc"),T=I=>{i(I),l("all"),m([]),x(null),s(I==="all"?"":I)},R=I=>{l(I),m([]),x(null)},B=async()=>{var H,W,V;b(!0),w(null);const I={limit:c||50,include_embedding:C};a&&a!=="all"&&(I.knowledge_base_id=a),o&&o!=="all"&&(I.knowledge_item_id=o);const z=await Y.functions.invoke("listSupabaseDocuments",I);if((H=z.data)!=null&&H.error){w(z.data.error),b(!1);return}let L=((W=z.data)==null?void 0:W.documents)||[];L=[...L].sort((K,M)=>{var ee,ne,X,ie;const G=((ee=K.metadata)==null?void 0:ee.chunk_index)??-1,q=((ne=M.metadata)==null?void 0:ne.chunk_index)??-1,F=((X=K.content)==null?void 0:X.length)||0,U=((ie=M.content)==null?void 0:ie.length)||0;return S==="chunk_asc"?G-q:S==="chunk_desc"?q-G:S==="chars_asc"?F-U:S==="chars_desc"?U-F:0}),m(L),x(((V=z.data)==null?void 0:V.total)??null),b(!1)},D=async I=>{var L;const z=await Y.functions.invoke("deleteSupabaseDocument",{id:I});if((L=z.data)!=null&&L.error){w(z.data.error);return}m(H=>H.filter(W=>W.id!==I)),x(H=>H!==null?H-1:H)},P=async()=>{var z;if(confirm(`Delete ${o&&o!=="all"?"all documents for this item":a&&a!=="all"?"all documents for this Knowledge Base":"ALL documents in Supabase"}? This cannot be undone.`)){N(!0),w(null);try{const L={delete_all:!0};o&&o!=="all"?L.knowledge_item_id=o:a&&a!=="all"&&(L.knowledge_base_id=a);const H=await Y.functions.invoke("deleteSupabaseDocument",L);(z=H.data)!=null&&z.error?w(H.data.error):(m([]),x(0))}finally{N(!1)}}};return r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-4",children:[r.jsx("h2",{className:"font-medium text-gray-800",children:"Browse Documents"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Knowledge Base"}),r.jsxs(cc,{value:a,onValueChange:T,disabled:n,children:[r.jsx(Jo,{children:r.jsx(dc,{placeholder:n?"Loading…":"Select KB"})}),r.jsxs(Qo,{children:[r.jsx(Kn,{value:"all",children:"— All Knowledge Bases —"}),e.map(I=>
1673r.jsx(Kn,{value:I.id,children:I.name},I.id))]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(ot,{children:["Knowledge Item ",r.jsx("span",{className:"text-gray-400 font-normal",children:"(optional)"})]}),r.jsx(XBe,{items:t,value:o,onChange:R,disabled:a==="all"||t.length===0})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Limit"}),r.jsx(It,{type:"number",min:1,max:500,value:c,onChange:I=>d(parseInt(I.target.value)||50)})]})]}),r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsx(de,{onClick:B,disabled:j,children:j?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 mr-2 animate-spin"}),"Loading…"]}):r.jsxs(r.Fragment,{children:[r.jsx(Rn,{className:"w-4 h-4 mr-2"}),"Fetch Documents"]})}),r.jsxs("button",{onClick:async()=>{var z,L;const I=!C;if(k(I),I&&f.length>0){b(!0),w(null);const H={limit:c||50,include_embedding:!0};a&&a!=="all"&&(H.knowledge_base_id=a),o&&o!=="all"&&(H.knowledge_item_id=o);const W=await Y.functions.invoke("listSupabaseDocuments",H);(z=W.data)!=null&&z.error?w(W.data.error):m(((L=W.data)==null?void 0:L.documents)||[]),b(!1)}},className:`flex items-center gap-1.5 text-xs border rounded px-3 py-1.5 transition-colors ${C?"bg-indigo-50 text-indigo-700 border-indigo-200":"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:[r.jsx(ys,{className:"w-3.5 h-3.5"})," ",C?"Embeddings ON":"Show Embeddings"]}),r.jsxs(cc,{value:S,onValueChange:A,children:[r.jsx(Jo,{className:"w-40",children:r.jsx(dc,{})}),r.jsxs(Qo,{children:[r.jsx(Kn,{value:"chunk_asc",children:"Chunk # (asc)"}),r.jsx(Kn,{value:"chunk_desc",children:"Chunk # (desc)"}),r.jsx(Kn,{value:"chars_asc",children:"Length (asc)"}),r.jsx(Kn,{value:"chars_desc",children:"Length (desc)"})]})]}),f.length>0&&r.jsxs(de,{variant:"destructive",size:"sm",onClick:P,disabled:_,children:[_?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin mr-1.5"}):r.jsx(un,{className:"w-3.5 h-3.5 mr-1.5"}),"Delete All Shown"]}),g!==null&&r.jsxs("span",{className:"text-sm text-gray-500",children:[g," document",g!==1?"s":""," found"]})]})]}),y&&r.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 border border-red-200 bg-red-50 rounded-xl p-4",children:[r.jsx(fr,{className:"w-4 h-4 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]}),f.length>0&&r.jsx("div",{className:"space-y-2",children:f.map(I=>r.jsx(ZBe,{doc:I,onDelete:D,showEmbeddings:C},I.id))}),!j&&f.length===0&&g===0&&r.jsx("p",{className:"text-center text-sm text-gray-400 py-10",children:"No documents found."})]})}function $Y({text:e}){const[t,n]=h.useState("idle"),s=async a=>{var i;a.stopPropagation(),n("loading");try{const o=await Y.functions.invoke("jinaEmbeddings",{text:e}),l=(i=o==null?void 0:o.data)==null?void 0:i.embedding;l?(navigator.clipboard.writeText(JSON.stringify(l)),n("done"),setTimeout(()=>n("idle"),2e3)):(n("error"),setTimeout(()=>n("idle"),2e3))}catch{n("error"),setTimeout(()=>n("idle"),2e3)}};return r.jsxs("button",{onClick:s,disabled:t==="loading",className:`flex items-center gap-1 text-[10px] border rounded px-2 py-0.5 transition-colors bg-white
1674        text-gray-500 border-gray-200 hover:text-indigo-600 hover:border-indigo-300 disabled:opacity-60`,title:"Embed this chunk and copy vector JSON",children:[t==="loading"&&r.jsx(Pe,{className:"w-2.5 h-2.5 animate-spin"}),t==="done"&&r.jsx(Tn,{className:"w-2.5 h-2.5 text-emerald-500"}),t==="error"&&r.jsx(fr,{className:"w-2.5 h-2.5 text-red-400"}),t==="idle"&&r.jsx(ys,{className:"w-2.5 h-2.5"}),t==="loading"?"Embedding…":t==="done"?"Copied!":t==="error"?"Error":"Copy Embedding"]})}const tFe={summary:"bg-violet-100 text-violet-700 border-violet-300",semantic_summary:"bg-purple-100 text-purple-700 border-purple-300",cc_summary:"bg-blue-100 text-blue-700 border-blue-300",cc_semantic_summary:"bg-sky-100 text-sky-700 border-sky-300",chunk:"bg-emerald-100 text-emerald-700 border-emerald-300",text:"bg-gray-100 text-gray-700 border-gray-300"};function BY({type:e}){if(!e)return null;const t=tFe[e]||"bg-orange-100 text-orange-700 border-orange-300";return r.jsx("span",{className:`text-[11px] font-bold px-2 py-0.5 rounded border uppercase tracking-wide ${t}`,children:e})}function FY({score:e}){const t=(e*100).toFixed(1),n=e>=.8?"bg-emerald-100 text-emerald-700 border-emerald-200":e>=.6?"bg-amber-100 text-amber-700 border-amber-200":"bg-red-100 text-red-600 border-red-200";return r.jsxs("span",{className:`text-xs font-bold px-2 py-0.5 rounded border ${n}`,children:[t,"%"]})}function nFe({item:e,rank:t}){const[n,s]=h.useState(!1);return r.jsxs("div",{className:"border rounded-lg bg-white overflow-hidden text-left",children:[r.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-violet-50 border border-violet-200 flex items-center justify-center text-xs font-bold text-violet-700 shrink-0 mt-0.5",children:t}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-800 leading-tight",children:e.title||"Untitled"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-1",children:[e.score!=null&&r.jsx(FY,{score:e.score}),r.jsx(BY,{type:e.content_type}),e.kb_name&&r.jsx(Gr,{variant:"outline",className:"text-[10px] px-1.5",children:e.kb_name}),e.chunk_index!=null&&r.jsxs("span",{className:"text-[10px] text-gray-400",children:["chunk #",e.chunk_index]}),e.url&&r.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-indigo-500 hover:underline flex items-center gap-0.5",children:[r.jsx(yr,{className:"w-2.5 h-2.5"})," src"]})]})]}),r.jsx("button",{onClick:()=>s(a=>!a),className:"p-1 text-gray-400 hover:text-gray-600 mt-0.5 shrink-0",children:n?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})})]}),n&&r.jsxs("div",{className:"px-3 pb-3 border-t bg-gray-50 space-y-2",children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wide mt-2",children:"Best Chunk Content"}),r.jsx("p",{className:"text-[11px] text-gray-700 whitespace-pre-wrap leading-relaxed bg-white border rounded p-2",children:e.content||"(no content)"}),r.jsxs("div",{className:"grid grid-cols-2 gap-1 text-[10px] text-gray-500 font-mono",children:[r.jsxs("span",{children:[r.jsx("strong",{children:"score:"})," ",e.score]}),r.jsxs("span",{children:[r.jsx("strong",{children:"llm_ranked:"}
1674)," ",String(e.llm_ranked)]}),r.jsxs("span",{className:"col-span-2 truncate",children:[r.jsx("strong",{children:"item_id:"})," ",e.knowledge_item_id]})]}),e.content&&r.jsx($Y,{text:e.content})]})]})}function rFe({doc:e,rank:t}){const[n,s]=h.useState(!1),a=e.metadata||{};return r.jsxs("div",{className:"border rounded-lg bg-white overflow-hidden text-left",children:[r.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-indigo-50 border border-indigo-200 flex items-center justify-center text-xs font-bold text-indigo-700 shrink-0 mt-0.5",children:t}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-800 leading-tight",children:a.item_title||"Untitled"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-1",children:[e.similarity!=null&&r.jsx(FY,{score:e.similarity}),r.jsx(BY,{type:a.content_type}),a.knowledge_base_name&&r.jsx(Gr,{variant:"outline",className:"text-[10px] px-1.5",children:a.knowledge_base_name}),a.chunk_index!==void 0&&r.jsxs("span",{className:"text-[10px] text-gray-400",children:["chunk #",a.chunk_index]}),a.url&&r.jsxs("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-indigo-500 hover:underline flex items-center gap-0.5",children:[r.jsx(yr,{className:"w-2.5 h-2.5"})," src"]})]})]}),r.jsx("button",{onClick:()=>s(i=>!i),className:"p-1 text-gray-400 hover:text-gray-600 mt-0.5 shrink-0",children:n?r.jsx(Mn,{className:"w-3.5 h-3.5"}):r.jsx(gt,{className:"w-3.5 h-3.5"})})]}),n&&r.jsxs("div",{className:"px-3 pb-3 border-t bg-gray-50 space-y-2",children:[r.jsx("p",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wide mt-2",children:"Chunk Content"}),r.jsx("p",{className:"text-[11px] text-gray-700 whitespace-pre-wrap leading-relaxed bg-white border rounded p-2",children:e.content||"(no content)"}),e.content&&r.jsx($Y,{text:e.content}),r.jsx("p",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wide",children:"Raw Metadata"}),r.jsx("pre",{className:"text-[10px] text-gray-600 bg-white border rounded p-2 overflow-x-auto max-h-36",children:JSON.stringify(a,null,2)})]})]})}function qk({number:e,label:t,description:n,status:s,detail:a}){const i={idle:"border-gray-200 bg-gray-50 text-gray-400",running:"border-blue-300 bg-blue-50 text-blue-600",done:"border-emerald-300 bg-emerald-50 text-emerald-700",error:"border-red-300 bg-red-50 text-red-600"},o={idle:"bg-gray-200 text-gray-500",running:"bg-blue-500 text-white",done:"bg-emerald-500 text-white",error:"bg-red-500 text-white"};return r.jsxs("div",{className:`border rounded-lg px-4 py-3 transition-all ${i[s]}`,children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 ${o[s]}`,children:s==="running"?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):s==="done"?r.jsx(mr,{className:"w-3.5 h-3.5"}):s==="error"?r.jsx(fr,{className:"w-3.5 h-3.5"}):e}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-semibold",children:t}),r.jsx("p",{className:"text-[11px] opacity-70",children:n})]})]}),a&&s!=="idle"&&r.jsx("p",{className:"mt-2 text-[11px] font-mono opacity-80 ml-9",children:a})]})}function sFe({error:e}){const[t,n]=h.useState(!1);if(!e)return null;const s=typeof e=="object",a=s?e.error||JSON.stringify(e):e,i=s&&(e.details||e.raw_response||e.step||e.stack);return r.jsxs("div",{className:"text-xs text-red-700 border border-red-200 bg-red-50 rounded-lg p-3 space-y-1",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(fr,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),r.jsx("span",{className:"font-semibold",children:a})]}),i&&r.jsx("button",{onClick:()=>n(o=>!o),className:"ml-5 text-red-500 underline text-[11px]",children:t?"Hide details":"Show details"}),t&&r.jsx("pre",{className:"ml-5 text-[10px] text-red-800 bg-red-100 border border-red-200 rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-48",children:JSON.stringify(s?e:{error:e},null,2)})]})}function HF({title:e,color:t,icon:n,results:s,renderRow:a,debugInfo:i,error:o,loading:l}){const[c,d]=h.useState(!1),f=t==="violet"?"border-violet-200":"border-indigo-200",m=t==="violet"?"bg-violet-50":"bg-indigo-50",g=t==="violet"?"text-violet-700":"text-indigo-700";return r.jsxs("div",{className:`border-2 ${f} rounded-xl overflow-hidden flex flex-col`,children:[r.jsxs("button",{onClick:()=>d(x=>!x),className:`flex items-center justify-between px-4 py-3 ${m} w-full text-left`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(n,{className:`w-4 h-4 ${g}`}),r.jsx("span",{className:`font-semibold text-sm ${g}`,children:e}),s!==null&&!o&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded-full font-bold ${t==="violet"?"bg-violet-200 text-violet-800":"bg-indigo-200 text-indigo-800"}`,children:s.length})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[i&&!o&&r.jsxs("span",{className:"text-[11px] font-mono text-gray-500",children:["⏱ ",i.latency_ms,"ms"]}),l?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin text-gray-400"}):c?r.jsx(gt,{className:"w-4 h-4 text-gray-400"}):r.jsx(Mn,{className:"w-4 h-4 text-gray-400"})]})]}),!c&&r.jsxs("div",{className:"flex-1 overflow-auto p-3 space-y-2 max-h-[70vh]",children:[o&&r.jsx(sFe,{error:o}),!o&&s===null&&!l&&r.jsx("p",{className:"text-center text-xs text-gray-400 py-8",children:"Run the search to see results"}),!o&&l&&r.jsxs("div",{className:"flex items-center justify-center gap-2 py-8 text-gray-400 text-xs",children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," Searching…"]}),!o&&s!==null&&!l&&s.length===0&&r.jsxs("div",{className:"text-center py-8 text-gray-400 text-xs",children:[r.jsx(ur,{className:"w-6 h-6 mx-auto mb-1 opacity-30"}),"No results found"]}
1674),!o&&s!==null&&!l&&s.map((x,j)=>a(x,j))]})]})}const zY="vectorQueryTab_prefs";function UY(){try{return JSON.parse(localStorage.getItem(zY)||"{}")}catch{return{}}}function qi(e){try{const t=UY();localStorage.setItem(zY,JSON.stringify({...t,...e}))}catch{}}function aFe({kbs:e,items:t,loadingKbs:n,loadingItems:s,onKbChange:a}){const i=UY(),[o,l]=h.useState(i.selectedKbId||""),[c,d]=h.useState(i.selectedItemId||""),[f,m]=h.useState(i.queryText||""),[g,x]=h.useState(i.limit||10),[j,b]=h.useState(i.topKMultiple||1),[y,w]=h.useState(i.minScore??0),[_,N]=h.useState("loading…"),[C,k]=h.useState(i.jinaTask||"retrieval.passage"),[S,A]=h.useState(i.itemsPrimaryModel||"jina-embeddings-v5-text-small"),[T,R]=h.useState(i.itemsSecondaryModel||"none"),[B,D]=h.useState(i.directQueryModel||"jina-embeddings-v5-text-small"),P=["retrieval.passage","retrieval.query","text-matching"],I=["jina-embeddings-v5-text-small","jina-embeddings-v3"];h.useEffect(()=>{Y.entities.AppConfig.filter({key:"global"}).then(ze=>{const fe=ze[0];N((fe==null?void 0:fe.jina_model)||"jina-embeddings-v5-text-small"),i.jinaTask||k((fe==null?void 0:fe.jina_task)||"retrieval.passage"),i.itemsPrimaryModel||A((fe==null?void 0:fe.jina_query_model_primary)||"jina-embeddings-v5-text-small"),i.itemsSecondaryModel||R((fe==null?void 0:fe.jina_query_model_secondary)||"none"),i.directQueryModel||D((fe==null?void 0:fe.jina_query_model_primary)||"jina-embeddings-v5-text-small")}).catch(()=>N("jina-embeddings-v5-text-small"))},[]);const[z,L]=h.useState(null),[H,W]=h.useState(null),[V,K]=h.useState(null),[M,G]=h.useState(!1),[q,F]=h.useState(null),[U,ee]=h.useState(null),[ne,X]=h.useState(null),[ie,Z]=h.useState(!1),[ce,le]=h.useState(!1),[re,Ue]=h.useState(null),[Ne,Oe]=h.useState(!1),[Me,ue]=h.useState(null),[Ve,Xe]=h.useState({embed:"idle",supabase:"idle",filter:"idle"}),[te,De]=h.useState({embed:"",supabase:"",filter:""}),[_e,We]=h.useState(null),tt=(ze,fe,dt="")=>{Xe(ct=>({...ct,[ze]:fe})),De(ct=>({...ct,[ze]:dt}))},me=ze=>{l(ze),d(""),qi({selectedKbId:ze,selectedItemId:""}),a(ze)},ae=async()=>{var ze,fe,dt,ct,Wt;K(null),L(null),G(!0),ue(null),We("items"),Xe({embed:"running",supabase:"idle",filter:"idle"}),De({embed:"",supabase:"",filter:""});try{const bt=o?[o]:e.map(Cn=>Cn.id),sn=Date.now(),we=await Y.functions.invoke("ItemsVectorSemanticSearch",{query:f,knowledge_base_ids:bt,top_k:g,top_k_multiple:j,min_chunk_score:y,jina_task:C,query_model_primary:S,query_model_secondary:T,caller:"VectorTrace",...c?{knowledge_item_id:c}:{}});if((ze=we.data)!=null&&ze.error){const Cn={error:we.data.error,details:we.data.details};tt("embed","error",we.data.error+(we.data.details?` — ${JSON.stringify(we.data.details)}`:"")),K(Cn);return}const Qe=((fe=we.data)==null?void 0:fe.latency_ms)||Date.now()-sn,it=g*j;tt("embed","done",`Query embedded with Jina ${_} (${C})`),tt("supabase","done",`${bt.length>1?`${bt.length} parallel RPC calls`:"1 RPC call"} · match_count=${it} (top_k=${g} × ${j})`),tt("filter","done",`KB filter applied server-side${c?" · item filter applied":""} · deduped by item (best chunk) · sliced to top_k=${g}`);const at=((dt=we.data)==null?void 0:dt.results)||[];L(at),W({latency_ms:Qe,results_returned:at.length,top_score:((ct=at[0])==null?void 0:ct.score)??null,kbs_searched:bt.length});const Gt=await Y.functions.invoke("jinaEmbeddings",{text:f,task:C}).catch(()=>null);(Wt=Gt==null?void 0:Gt.data)!=null&&Wt.embedding&&ue(Gt.data.embedding)}catch(bt){tt("embed","error",bt.message),K(bt.message)}finally{G(!1)}},Se=async()=>{var ze,fe,dt,ct,Wt;X(null),F(null),Z(!0),ue(null),We("raw"),Xe({embed:"running",supabase:"idle",filter:"idle"}),De({embed:"",supabase:"",filter:""});try{const bt=Date.now(),sn={query_text:f,limit:g,jina_task:C,query_model:B,...o?{knowledge_base_id:o}:{},...c?{knowledge_item_id:c}:{}},we=await Y.functions.invoke("directQuery",sn);if((ze=we.data)!=null&&ze.error){const Cn={error:we.data.error,details:we.data.details,raw_response:we.data.raw_response,step:we.data.step};tt("embed","error",we.data.error+(we.data.details?` — ${JSON.stringify(we.data.details)}`:"")),X(Cn);return}const Qe=Date.now()-bt,it=c?`metadata_filter={knowledge_item_id: "${c}"}`:o?`metadata_filter={knowledge_base_id: "${o}"}`:"No metadata_filter — results across all docs";tt("embed","done",`Query embedded with Jina ${_} (${C})`),tt("supabase","done",`match_documents RPC — match_count=${g}, threshold=0.0, server-side filtered`),tt("filter","done",it);const at=((fe=we.data)==null?void 0:fe.results)||[];F(at),ee({latency_ms:Qe,results_returned:at.length,top_score:((dt=at[0])==null?void 0:dt.similarity)??null});const Gt=await Y.functions.invoke("jinaEmbeddings",{text:f,task:C}).catch(()=>null);(ct=Gt==null?void 0:Gt.data)!=null&&ct.embedding&&ue(Gt.data.embedding)}catch(bt){const sn={error:bt.message,details:(Wt=bt==null?void 0:bt.response)==null?void 0:Wt.data};tt("embed","error",bt.message),X(sn)}finally{Z(!1)}},Le=async()=>{var ze;le(!0),Ue(null),Oe(!0);try{const fe=await Y.functions.invoke("jinaEmbeddings",{text:f,task:C}),dt=(fe==null?void 0:fe.data)??fe;if(dt!=null&&dt.error)Ue({error:dt.error,raw:dt});else{const ct=(dt==null?void 0:dt.embedding)??[];Ue({embedding:ct,model:dt==null?void 0:dt.model,dims:ct.length,usage:dt==null?void 0:dt.usage})}}catch(fe){Ue({error:fe.message,raw:(ze=fe==null?void 0:fe.response)==null?void 0:ze.data})}le(!1)},He=f.trim().length>0&&!M&&!ie,ut=Ve.embed!=="idle";return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-xl p-4 text-sm text-indigo-800",children:[r.jsx("p",{className:"font-semibold",children:"🔍 Similarity Query — Debug Mode"}),r.jsxs("p",{className:"text-xs text-indigo-700 mt-0.5",children:["Both modes embed your query with ",r.jsx("strong",{children:"Jina AI"})," and call the ",r.jsxs("strong",{children:["Supabase ",r.jsx("code",{children:"match_documents"})," RPC"]}),". Results appear side-by-side for comparison."]})]}),r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-4",children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:"Search Parameters"}),r.jsx(LY,{kbs:e,items:t,loadingKbs:n,loadingItems:s,selectedKbId:o,selectedItemId:c,onKbChange:me,onItemChange:ze=>{d(ze),qi({selectedItemId:ze})},itemOptional:!0}),!o&&r.jsxs("p",{className:"text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded px-3 py-2",children:["⚠️ No KB selected — both searches will run across ",r.jsx("strong",{children:"all KBs"})," (no metadata filter applied)."]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Query text"}),r.jsx(rr,{rows:3,placeholder:"Enter a question or phrase to find similar documents…",value:f,onChange:ze=>{m(ze.target.value),qi({queryText:ze.target.value})},onKeyDown:ze=>{ze.key==="Enter"&&(ze.metaKey||ze.ctrlKey)&&He&&ae()}}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("p",{className:"text-[11px] text-gray-400 flex-1",children:"Cmd/Ctrl+Enter to run Items search"}),r.jsxs("button",{onClick:Le,disabled:!f.trim()||ce,className:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-lg border border-amber-300 bg-amber-50 text-amber-700 hover:bg-amber-100 transition-colors disabled:opacity-40",children:[ce?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(ys,{className:"w-3 h-3"}),"Test Embedding"]})]}),re&&r.jsxs("div",{className:`rounded-lg border text-xs p-3 space-y-2 ${re.error?"bg-red-50 border-red-200 text-red-700":"bg-amber-50 border-amber-200 text-amber-800"}`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-semibold",children:re.error?"❌ Embedding failed":`✅ Embedding OK — ${re.dims} dims · model: ${re.model||_}`}),r.jsxs("button",{onClick:()=>Oe(ze=>!ze),className:"text-[11px] underline opacity-70",children:[Ne?"hide":"show"," details"]}
1674)]}),Ne&&re.error&&r.jsx("pre",{className:"text-[10px] bg-red-100 border border-red-200 rounded p-2 overflow-x-auto whitespace-pre-wrap max-h-32",children:JSON.stringify(re.raw??{error:re.error},null,2)}),Ne&&!re.error&&r.jsxs("div",{className:"space-y-1",children:[re.usage&&r.jsxs("p",{className:"text-[11px] font-mono",children:["tokens: ",JSON.stringify(re.usage)]}),r.jsx("p",{className:"text-[11px] font-semibold text-amber-700",children:"First 16 values:"}),r.jsx("pre",{className:"text-[10px] bg-white border border-amber-200 rounded p-2 overflow-x-auto",children:JSON.stringify(re.embedding.slice(0,16),null,2)}),r.jsx(sb,{embedding:re.embedding,label:`Test embedding (${re.model||_})`})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Top K"}),r.jsx(It,{type:"number",min:1,max:100,value:g,onChange:ze=>{const fe=parseInt(ze.target.value)||10;x(fe),qi({limit:fe})},className:"w-24"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Top K Multiple"}),r.jsx(It,{type:"number",min:1,max:20,step:1,value:j,onChange:ze=>{const fe=Math.max(1,parseInt(ze.target.value)||1);b(fe),qi({topKMultiple:fe})},className:"w-24"}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"match_count = top_k × multiple"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Min 
1674score (0–1)"}),r.jsx(It,{type:"number",min:0,max:1,step:.05,value:y,onChange:ze=>{const fe=parseFloat(ze.target.value)||0;w(fe),qi({minScore:fe})},className:"w-28"}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"Items search only"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ot,{children:"Embedding Task"}),r.jsx("select",{value:C,onChange:ze=>{k(ze.target.value),qi({jinaTask:ze.target.value})},className:"border rounded-lg px-2 py-1.5 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-indigo-400 bg-white",children:P.map(ze=>r.jsx("option",{value:ze,children:ze},ze))}),r.jsx("p",{className:"text-[11px] text-gray-400",children:"Jina task type for query embedding"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 pt-1 border-t",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold text-violet-700",children:"ItemsVectorSemanticSearch models"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx("label",{className:"text-[11px] text-gray-500 font-medium",children:"Primary model"}),r.jsx("select",{value:S,onChange:ze=>{A(ze.target.value),qi({itemsPrimaryModel:ze.target.value})},className:"w-full border rounded-lg px-2 py-1.5 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-violet-400 bg-white",children:I.map(ze=>r.jsx("option",{value:ze,children:ze},ze))})]}),r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx("label",{className:"text-[11px] text-gray-500 font-medium",children:"Secondary model"}),r.jsxs("select",{value:T,onChange:ze=>{R(ze.target.value),qi({itemsSecondaryModel:ze.target.value})},className:"w-full border rounded-lg px-2 py-1.5 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-violet-400 bg-white",children:[r.jsx("option",{value:"none",children:"none"}),I.map(ze=>r.jsx("option",{value:ze,children:ze},ze))]})]})]}),T!=="none"&&r.jsx("p",{className:"text-[11px] text-violet-600 bg-violet-50 border border-violet-200 rounded px-2 py-1",children:"Dual-round: results from both models are merged (best score wins per doc)."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-semibold text-indigo-700",children:"directQuery model"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-[11px] text-gray-500 font-medium",children:"Query model"}),r.jsx("select",{value:B,onChange:ze=>{D(ze.target.value),qi({directQueryModel:ze.target.value})},className:"w-full border rounded-lg px-2 py-1.5 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400 bg-white",children:I.map(ze=>r.jsx("option",{value:ze,children:ze},ze))})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 pt-1",children:[r.jsxs("button",{onClick:ae,disabled:!He,className:`flex flex-col items-start gap-1 rounded-xl border-2 px-5 py-4 text-left transition-all
1675              ${He?"border-violet-300 bg-violet-50 hover:bg-violet-100 hover:border-violet-400 cursor-pointer":"opacity-40 cursor-not-allowed border-gray-200 bg-gray-50"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[M?r.jsx(Pe,{className:"w-4 h-4 animate-spin text-violet-600"}):r.jsx(zn,{className:"w-4 h-4 text-violet-600"}),r.jsx("span",{className:"font-semibold text-violet-800 text-sm",children:"ItemsVectorSemanticSearch"})]}),r.jsxs("p",{className:"text-[11px] text-violet-700 leading-relaxed",children:["Embed → ",r.jsxs("code",{children:[j>1?`${e.length} parallel`:"1"," RPC"]}),"(match_count=top_k×",j,") → ",r.jsx("strong",{children:"server-side KB filter"})," → dedup by item → top_k"]})]}),r.jsxs("button",{onClick:Se,disabled:!He,className:`flex flex-col items-start gap-1 rounded-xl border-2 px-5 py-4 text-left transition-all
1676              ${He?"border-indigo-300 bg-indigo-50 hover:bg-indigo-100 hover:border-indigo-400 cursor-pointer":"opacity-40 cursor-not-allowed border-gray-200 bg-gray-50"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[ie?r.jsx(Pe,{className:"w-4 h-4 animate-spin text-indigo-600"}):r.jsx(_n,{className:"w-4 h-4 text-indigo-600"}),r.jsx("span",{className:"font-semibold text-indigo-800 text-sm",children:"directQuery"})]}),r.jsxs("p",{className:"text-[11px] text-indigo-700 leading-relaxed",children:["Embed → ",r.jsx("code",{children:"match_documents"}),"(limit, metadata_filter) → raw chunks with content_type (server-side filtered)"]})]})]})]}),ut&&r.jsxs("div",{className:"bg-white border rounded-xl p-4",children:[r.jsxs("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3",children:["Pipeline — last run: ",r.jsx("span",{className:_e==="items"?"text-violet-600":"text-indigo-600",children:_e==="items"?"ItemsVectorSemanticSearch":"directQuery"})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(qk,{number:"1",label:"Jina Embedding",status:Ve.embed,description:`Query text → float vector via ${_}`,detail:te.embed}),r.jsx("div",{className:"flex justify-center",children:r.jsx(Rh,{className:"w-4 h-4 text-gray-300"})}),r.jsx(qk,{number:"2",label:"Supabase match_documents RPC",status:Ve.supabase,description:"Cosine similarity across all stored chunk embeddings",detail
1676:te.supabase}),r.jsx("div",{className:"flex justify-center",children:r.jsx(Rh,{className:"w-4 h-4 text-gray-300"})}),r.jsx(qk,{number:"3",label:"Filter & Rank",status:Ve.filter,description:_e==="items"?"KB filter + per-item deduplication (best chunk wins)":"Server-side metadata_filter applied inside Supabase RPC",detail:te.filter})]})]}),Me&&r.jsxs("div",{className:"bg-white border rounded-xl p-4",children:[r.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2",children:"Query Embedding"}),r.jsx(sb,{embedding:Me,label:`Query vector (${_}, ${C})`})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(HF,{title:"ItemsVectorSemanticSearch",color:"violet",icon:zn,results:z,error:V,loading:M,debugInfo:H,renderRow:(ze,fe)=>r.jsx(nFe,{item:ze,rank:fe+1},ze.id||fe)}),r.jsx(HF,{title:"directQuery (raw)",color:"indigo",icon:_n,results:q,error:ne,loading:ie,debugInfo:U,renderRow:(ze,fe)=>r.jsx(rFe,{doc:ze,rank:fe+1},ze.id||fe)})]})]})}function WF({label:e,onEmbedding:t,embedding:n}){const[s,a]=h.useState(""),[i,o]=h.useState(!1),[l,c]=h.useState(null),[d,f]=h.useState(!1),[m,g]=h.useState(""),[x,j]=h.useState(!1),[b,y]=h.useState("retrieval.passage"),[w,_]=h.useState("jina-embeddings-v5-text-small"),N=["retrieval.query","retrieval.passage","text-matching"],C=["jina-embeddings-v5-text-small","jina-embeddings-v3"],k=async()=>{var R,B,D;if(s.trim()){o(!0),c(null);try{const P=await Y.functions.invoke("jinaEmbeddings",{text:s.trim(),task:b,model:w});(R=P.data)!=null&&R.error?c(P.data.error):(D=(B=P.data)==null?void 0:B.embedding)!=null&&D.length?t(P.data.embedding):c("No embedding returned — check your Jina API key in Settings.")}catch(P){c(P.message||"Request failed")}finally{o(!1)}}},S=()=>{try{const R=JSON.parse(m.trim());if(!Array.isArray(R))throw new Error("Not an array");t(R),f(!1),g(""),c(null)}catch{c("Invalid JSON array — paste a vector like [0.123, -0.456, …]")}},A=()=>{n&&(navigator.clipboard.writeText(JSON.stringify(n)),j(!0),setTimeout(()=>j(!1),1500))},T=n?n.slice(0,6).map(R=>R.toFixed(4)).join(", "):null;return r.jsxs("div",{className:"bg-white border rounded-xl p-4 space-y-3 flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"font-semibold text-gray-800 text-sm",children:e}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{onClick:()=>{f(R=>!R),c(null)},className:`text-xs border rounded px-2 py-1 transition-colors ${d?"bg-indigo-50 text-indigo-700 border-indigo-200":"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:"Paste JSON"}),n&&r.jsx("button",{onClick:A,className:"flex items-center gap-1 text-xs border rounded px-2 py-1 text-gray-500 border-gray-200 hover:bg-gray-50 transition-colors",children:x?r.jsxs(r.Fragment,{children:[r.jsx(Tn,{className:"w-3 h-3 text-emerald-500"})," Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(ri,{className:"w-3 h-3"})," Copy"]})})]})]}),d?r.jsxs("div",{className:"space-y-2",children:[r.jsx(rr,{rows:4,placeholder:"Paste embedding JSON array: [0.123, -0.456, ...]",value:m,onChange:R=>g(R.target.value),className:"font-mono text-xs"}),r.jsx(de,{size:"sm",onClick:S,disabled:!m.trim(),children:"Apply"})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(ot,{className:"text-xs",children:"Text to embed"}),r.jsx(rr,{rows:3,placeholder:"Enter text to generate embedding via Jina…",value:s,onChange:R=>a(R.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:w,onChange:R=>_(R.target.value),className:"flex-1 border rounded-lg px-2 py-1.5 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400 bg-white",children:C.map(R=>r.jsx("option",{value:R,children:R},R))}),r.jsx("select",{value:b,onChange:R=>y(R.target.value),className:"flex-1 border rounded-lg px-2 py-1.5 text-xs font-mono focus:outline-none focus:ring-1 focus:ring-indigo-400 bg-white",children:N.map(R=>r.jsx("option",{value:R,children:R},R))})]}),r.jsx(de,{size:"sm",onClick:k,disabled:i||!s.trim(),children:i?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Embedding…"]}):r.jsxs(r.Fragment,{children:[r.jsx(zn,{className:"w-3.5 h-3.5 mr-1.5"}),"Generate"]})})]}),l&&r.jsxs("div",{className:"flex items-start gap-2 text-xs text-red-700 border border-red-200 bg-red-50 rounded p-2",children:[r.jsx(fr,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),l]}),n&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-lg p-3 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ys,{className:"w-3.5 h-3.5 text-indigo-500"}),r.jsxs("span",{className:"text-xs font-semibold text-indigo-700",children:[n.length," dimensions"]})]}),r.jsxs("p",{className:"text-[10px] font-mono text-indigo-600 truncate",children:["[",T,", …]"]})]})]})}function iFe({score:e}){if(e===null)return null;const t=(e*100).toFixed(2),n=e>=.8?"border-emerald-300 bg-emerald-50 text-emerald-700":e>=.6?"border-amber-300 bg-amber-50 text-amber-700":e>=.4?"border-orange-300 bg-orange-50 text-orange-700":"border-red-300 bg-red-50 text-red-700",s=Math.max(0,Math.min(100,e*100)),a=e>=.8?"bg-emerald-500":e>=.6?"bg-amber-500":e>=.4?"bg-orange-500":"bg-red-500",i=e>=.85?"Very High":e>=.7?"High":e>=.5?"Moderate":e>=.3?"Low":"Very Low";return r.jsxs("div",{className:`border-2 rounded-xl p-5 space-y-3 ${n}`,children:[r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider opacity-70 mb-1",children:"Cosine Similarity"}),r.jsxs("p",{className:"text-5xl font-bold font-mono",children:[t,"%"]}
1676),r.jsxs("p",{className:"text-sm font-medium mt-1",children:[i," similarity"]})]}),r.jsx("div",{className:"w-full bg-white/60 rounded-full h-3 overflow-hidden",children:r.jsx("div",{className:`h-3 rounded-full transition-all duration-700 ${a}`,style:{width:`${s}%`}})}),r.jsxs("div",{className:"grid grid-cols-3 text-center text-[10px] opacity-70",children:[r.jsx("span",{children:"0.0 — No match"}),r.jsx("span",{children:"0.5 — Partial"}),r.jsx("span",{children:"1.0 — Identical"})]})]})}function oFe(){const[e,t]=h.useState(null),[n,s]=h.useState(null),a=e&&n?ZPe(e,n):null,i=e&&n&&e.length!==n.length;return r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"bg-indigo-50 border border-indigo-200 rounded-xl p-4 text-sm text-indigo-800",children:[r.jsx("p",{className:"font-semibold",children:"📐 Vector Distance Comparison"}),r.jsxs("p",{className:"text-xs text-indigo-700 mt-0.5",children:["Generate or paste two embedding vectors and compute their ",r.jsx("strong",{children:"cosine similarity"}),". Use this to understand how semantically close two pieces of text are."]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(WF,{label:"Vector A",embedding:e,onEmbedding:t}),r.jsx(WF,{label:"Vector B",embedding:n,onEmbedding:s})]}),r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(JX,{className:"w-4 h-4 text-indigo-500"}),r.jsx("h3",{className:"font-semibold text-gray-800 text-sm",children:"Distance Result"})]}),i&&r.jsxs("div",{className:"flex items-start gap-2 text-sm text-red-700 border border-red-200 bg-red-50 rounded-lg p-3",children:[r.jsx(fr,{className:"w-4 h-4 mt-0.5 shrink-0"}),"Dimension mismatch: Vector A has ",e.length,"d, Vector B has ",n.length,"d. They must match."]}),!e&&!n&&r.jsx("p",{className:"text-sm text-gray-400 text-center py-6",children:"Generate or paste both vectors to compare them."}),n&&!e&&r.jsx("p",{className:"text-sm text-gray-400 text-center py-4",children:"Waiting for Vector A…"}),e&&!n&&r.jsx("p",{className:"text-sm text-gray-400 text-center py-4",children:"Waiting for Vector B…"}),a!==null&&!i&&r.jsx(iFe,{score:a}),a!==null&&r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs text-gray-600",children:[r.jsxs("div",{className:"bg-gray-50 border rounded-lg p-3",children:[r.jsx("p",{className:"font-semibold text-gray-500 mb-1",children:"Raw score"}),r.jsx("p",{className:"font-mono text-gray-900",children:a.toFixed(8)})]}),r.jsxs("div",{className:"bg-gray-50 border rounded-lg p-3",children:[r.jsx("p",{className:"font-semibold text-gray-500 mb-1",children:"Dimensions"}),r.jsx("p",{className:"font-mono text-gray-900",children:(e==null?void 0:e.length)??"—"})]})]})]})]})}function Kk(){const[e,t]=h.useState([]),[n,s]=h.useState(!1);return{items:e,loadingItems:n,loadItemsForKb:async i=>{if(!i){t([]);return}s(!0);const o=await Y.entities.KnowledgeItem.filter({knowledge_base_id:i});t(o||[]),s(!1)}}}function lFe(){const[e,t]=h.useState([]),[n,s]=h.useState(!0),[a,i]=h.useState("query"),o=Kk(),l=Kk(),c=Kk();return h.useEffect(()=>{Y.entities.KnowledgeBase.filter({status:"active"}).then(d=>{t(d||[]),s(!1)})},[]),r.jsxs("div",{className:"flex flex-col min-h-full",children:[r.jsxs("div",{className:"bg-white border-b px-6 py-4 shrink-0",children:[r.jsx("h1",{className:"text-lg font-semibold text-gray-900",children:"Vector Trace"}),r.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:"Manage and test Supabase vector document storage"})]}),r.jsx("div",{className:"flex-1 p-6",children:r.jsx("div",{className:"max-w-4xl mx-auto",children:r.jsxs(WV,{value:a,onValueChange:i,children:[r.jsxs(UA,{className:"mb-6",children:[r.jsx(Hl,{value:"query",children:"🔍 Similarity Query"}),r.jsx(Hl,{value:"store",children:"Store Embedding"}),r.jsx(Hl,{value:"browse",children:"Browse & Delete"}),r.jsx(Hl,{value:"distance",children:"📐 Distance Compare"})]}),r.jsx("div",{className:a==="query"?"":"hidden",children:r.jsx(aFe,{kbs:e,items:o.items,loadingKbs:n,loadingItems:o.loadingItems,onKbChange:o.loadItemsForKb})}),r.jsx("div",{className:a==="store"?"":"hidden",children:r.jsx(JBe,{kbs:e,items:l.items,loadingKbs:n,loadingItems:l.loadingItems,onKbChange:l.loadItemsForKb})}),r.jsx("div",{className:a==="browse"?"":"hidden",children:r.jsx(eFe,{kbs:e,items:c.items,loadingKbs:n,loadingItems:c.loadingItems,onKbChange:c.loadItemsForKb})}),r.jsx("div",{className:a==="distance"?"":"hidden",children:r.jsx(oFe,{})})]})})})]})}function GF({kb:e,result:t,onVectorize:n,vectorizingId:s,vectorizeMsg:a}){const{total:i,missing:o,stale:l}=t,c=i-o,d=i>0?Math.round(c/i*100):0,f=o===0&&l===0,m=l>0,g=s===e.id;return r.jsx("div",{className:`border rounded-xl p-4 bg-white ${o>0?"border-orange-200":m?"border-amber-200":"border-emerald-200"}`,children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`mt-0.5 shrink-0 ${f?"text-emerald-500":o>0?"text-orange-500":"text-amber-500"}`,children:f?r.jsx(mr,{className:"w-5 h-5"}):o>0?r.jsx(Nr,{className:"w-5 h-5"}):r.jsx(ni,{className:"w-5 h-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-semibold text-gray-900",children:e.name}),e.type&&r.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full border bg-gray-50 text-gray-500 border-gray-200",children:e.type}),o>0&&r.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full border bg-orange-50 text-orange-700 border-orange-200 font-medium",children:[o," missing"]}),m&&r.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full border bg-amber-50 text-amber-700 border-amber-200 font-medium",children:[l," stale"]}),f&&r.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full border bg-emerald-50 text-emerald-700 border-emerald-200 font-medium",children:"All up-to-date"})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[r.jsx("div",{className:"flex-1 h-2 bg-gray-100 rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full transition-all ${f?"bg-emerald-500":o>0?"bg-orange-400":"bg-amber-400"}`,style:{width:`${d}%`}})}),r.jsxs("span",{className:"text-xs font-mono text-gray-500 shrink-0",children:[c,"/",i]})]}),m&&r.jsxs("p",{className:"text-xs text-amber-600 mt-1.5 flex items-center gap-1",children:[r.jsx(ni,{className:"w-3 h-3"}),l," item",l!==1?"s":""," updated after last vectorization — re-vectorize to sync"]}),(a==null?void 0:a.kbId)===e.id&&r.jsxs("p",{className:"text-xs text-emerald-600 mt-1.5",children:["✓ ",a.msg]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0 flex-wrap justify-end",children:[(o>0||m)&&r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 text-orange-700 border-orange-300 hover:bg-orange-50",onClick:()=>n(e.id,!1),disabled:g,children:[g?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(zn,{className:"w-3.5 h-3.5"}),"Vectorize All"]}),o>0&&r.jsxs(de,{size:"sm",variant:"outline",className:"gap-1.5 text-indigo-700 border-indigo-300 hover:bg-indigo-50",onClick:()=>n(e.id,!0),disabled:g,children:[g?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Rn,{className:"w-3.5 h-3.5"}),"Continue"]}),r.jsx(wt,{to:yt(`KnowledgeBaseDetail?id=${e.id}`),children:r.jsx(de,{size:"sm",variant:"ghost",className:"text-gray-500",children:r.jsx(en,{className:"w-4 h-4"})})})]})]})})}function cFe(){const[e,t]=h.useState(null),[n,s]=h.useState([]),[a,i]=h.useState(!1),[o,l]=h.useState(null),[c,d]=h.useState(null);async function f(){var A,T;i(!0),t(null),d(null);const k=await Y.entities.KnowledgeBase.list("name");s(k);const S={};for(const R of k){const B=await Y.functions.invoke("getKbStats",{kb_ids:[R.id]}),D=((T=(A=B==null?void 0:B.data)==null?void 0:A.stats)==null?void 0:T[R.id])||{},P=D.totalItems||0,I=D.vectorizedCount||0;S[R.id]={total:P,missing:Math.max(0,P-I),stale:D.staleCount||0,hasVectors:I>0}}t(S),i(!1)}async function m(k,S){var R,B;l(k),d(null);const A=await Y.functions.invoke("vectorizeKBItems",{knowledge_base_id:k,continue_only:S}),T=((R=A==null?void 0:A.data)==null?void 0:R.message)||`${((B=A==null?void 0:A.data)==null?void 0:B.queued)||0} items queued.`;d({kbId:k,msg:T}),l(null)}const g=e?n.filter(k=>{var S;return(((S=e[k.id])==null?void 0:S.missing)||0)>0}
1676):[],x=e?n.filter(k=>{var S,A,T;return(((S=e[k.id])==null?void 0:S.missing)||0)===0&&(((A=e[k.id])==null?void 0:A.stale)||0)>0&&(((T=e[k.id])==null?void 0:T.total)||0)>0}):[],j=e?n.filter(k=>{var S,A,T;return(((S=e[k.id])==null?void 0:S.missing)||0)===0&&(((A=e[k.id])==null?void 0:A.stale)||0)===0&&(((T=e[k.id])==null?void 0:T.total)||0)>0}):[],b=e?n.filter(k=>{var S;return(((S=e[k.id])==null?void 0:S.total)||0)===0}):[],y=[...g,...x],w=e?n.reduce((k,S)=>{var A;return k+(((A=e[S.id])==null?void 0:A.missing)||0)},0):0,_=e?n.reduce((k,S)=>{var A;return k+(((A=e[S.id])==null?void 0:A.stale)||0)},0):0,N=e?n.reduce((k,S)=>{var A;return k+(((A=e[S.id])==null?void 0:A.total)||0)},0):0,C=w===0&&_===0;return r.jsxs("div",{className:"p-6 md:p-10 max-w-4xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[r.jsx(wt,{to:yt("KnowledgeBases"),children:r.jsxs(de,{variant:"ghost",size:"sm",className:"gap-1.5 text-gray-500",children:[r.jsx(or,{className:"w-4 h-4"})," Back"]})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("h1",{className:"text-2xl font-bold text-gray-900 flex items-center gap-2",children:[r.jsx(_n,{className:"w-6 h-6 text-orange-500"}),"Vector Health Dashboard"]}),r.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:"Checks for missing vectors and stale embeddings (items updated after last vectorization)"})]}),r.jsxs(de,{onClick:f,disabled:a,className:"gap-2",children:[a?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Wp,{className:"w-4 h-4"}),a?"Checking…":e?"Re-check":"Run Check"]})]}),!a&&!e&&r.jsxs("div",{className:"text-center py-24 border-2 border-dashed border-gray-200 rounded-2xl",children:[r.jsx(_n,{className:"w-12 h-12 mx-auto mb-3 text-gray-300"}),r.jsx("p",{className:"text-gray-500 font-medium mb-1",children:'Click "Run Check" to scan all knowledge bases'}),r.jsx("p",{className:"text-xs text-gray-400",children:"Detects missing vectors and items updated after their last vectorization"})]}),a&&r.jsxs("div",{className:"space-y-3",children:[[1,2,3,4].map(k=>r.jsx("div",{className:"h-20 bg-gray-100 animate-pulse rounded-xl"},k)),r.jsx("p",{className:"text-center text-sm text-gray-400 pt-2",children:"Checking knowledge bases…"})]}),!a&&e&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:`rounded-xl p-4 mb-6 flex flex-wrap items-start gap-4 ${C?"bg-emerald-50 border border-emerald-200":"bg-orange-50 border border-orange-200"}`,children:[C?r.jsx(mr,{className:"w-5 h-5 text-emerald-500 shrink-0 mt-0.5"}):r.jsx(Nr,{className:"w-5 h-5 text-orange-500 shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:`font-semibold ${C?"text-emerald-800":"text-orange-800"}`,children:C?"All vectors are up-to-date":[w>0&&`${w} item${w!==1?"s":""} missing vectors`,_>0&&`${_} item${_!==1?"s":""} with stale vectors`].filter(Boolean).join(" · ")}),r.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[N-w," of ",N," items vectorized",_>0&&` · ${_} need re-vectorization (source updated)`,b.length>0&&` · ${b.length} empty KB${b.length!==1?"s":""} skipped`]})]})]}),y.length>0&&r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-sm font-semibold text-orange-700 uppercase tracking-wide mb-3 flex items-center gap-1.5",children:[r.jsx(Nr,{className:"w-3.5 h-3.5"})," Needs Attention (",y.length,")"]}),r.jsx("div",{className:"space-y-3",children:y.map(k=>r.jsx(GF,{kb:k,result:e[k.id],onVectorize:m,vectorizingId:o,vectorizeMsg:c},k.id))})]}),j.length>0&&r.jsxs("div",{children:[r.jsxs("h2",{className:"text-sm font-semibold text-emerald-700 uppercase tracking-wide mb-3 flex items-center gap-1.5",children:[r.jsx(mr,{className:"w-3.5 h-3.5"})," Fully Up-to-Date (",j.length,")"]}),r.jsx("div",{className:"space-y-2",children:j.map(k=>r.jsx(GF,{kb:k,result:e[k.id],onVectorize:m,vectorizingId:o,vectorizeMsg:c},k.id))})]})]})]})}const L5={"Item:extract":{fn:"extractAndSaveUrl",desc:"Extract content from URL"},"Item:summarize":{fn:"summarizeItems",desc:"Generate item summary"},"Item:summarize_cc":{fn:"summarizeCCItems",desc:"Summarize closed captions"},"Item:extract_cc":{fn:"extractClosedCaptions",desc:"Extract closed captions from video/audio media links"},"Item:chunk":{fn:"chunkItem",desc:"Chunk item — uses task.parameters for chunking config"},"Item:embed":{fn:"embedItem",desc:"Create Chunk:embed tasks for all chunks"},"Item:store_vectors":{fn:"vectorizeKBItem",desc:"Vectorize & store in Supabase"}
1676,"Item:run_statistics":{fn:"getKbStats",desc:"Run KB statistics"},"Chunk:embed":{fn:"localChunkEmbedding",desc:"Generate local embedding vector"},"Chunk:store_vectors":{fn:"vectorStoreChunk",desc:"Store chunk vector in Supabase (upsert by chunk ID)"},"KnowledgeBase:summarize":{fn:"summarizeKB",desc:"Summarize entire KB"},"KnowledgeBase:run_statistics":{fn:"getKbStats",desc:"Run KB statistics"},"KnowledgeBase:store_vectors":{fn:"vectorizeKB",desc:"Calls vectorizeKBItem() for each KB item"},"KnowledgeBase:chunk":{fn:"chunkKB",desc:"Creates Item:chunk tasks for each KB item (uses task.parameters)"},"KnowledgeBase:embed":{fn:"embedKB",desc:"Calls embedItem() for each KB item"}},YF={hold:"bg-gray-100 text-gray-500 border-gray-200",pending:"bg-blue-50 text-blue-700 border-blue-200",processing:"bg-amber-50 text-amber-700 border-amber-200",done:"bg-emerald-50 text-emerald-700 border-emerald-200",error:"bg-red-50 text-red-600 border-red-200"},Vk={Chunk:"bg-indigo-50 text-indigo-700",Item:"bg-violet-50 text-violet-700",KnowledgeBase:"bg-cyan-50 text-cyan-700"},dFe=["Queue","Test","Reference"],qY="kbqueue_settings";function KY(){try{return JSON.parse(localStorage.getItem(qY)||"{}")}catch{return{}}}function To(e){try{const t=KY();localStorage.setItem(qY,JSON.stringify({...t,...e}))}catch{}}function JF({value:e,onChange:t,options:n,placeholder:s="Search...",disabled:a=!1}){const[i,o]=h.useState(!1),[l,c]=h.useState(""),d=h.useRef(null),f=n.find(g=>g.value===e);h.useEffect(()=>{function g(x){d.current&&!d.current.contains(x.target)&&o(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]);const m=n.filter(g=>g.label.toLowerCase().includes(l.toLowerCase())||g.value.toLowerCase().includes(l.toLowerCase()));return r.jsxs("div",{className:"relative",ref:d,children:[r.jsxs("button",{type:"button",disabled:a,onClick:()=>{o(g=>!g),c("")},className:"w-full border rounded-lg px-3 py-2 text-sm text-left flex items-center justify-between gap-2 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-400 disabled:opacity-50",children:[r.jsx("span",{className:f?"text-gray-900 truncate":"text-gray-400 truncate",children:f?f.label:s}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e&&r.jsx("span",{onClick:g=>{g.stopPropagation(),t("","")},className:"text-gray-400 hover:text-gray-600 cursor-pointer",children:r.jsx(jt,{className:"w-3 h-3"})}),r.jsx(gt,{className:`w-4 h-4 text-gray-400 transition-transform ${i?"rotate-180":""}`})]})]}),i&&r.jsxs("div",{className:"absolute z-50 mt-1 w-full bg-white border rounded-xl shadow-lg",children:[r.jsx("div",{className:"p-2 border-b",children:r.jsx("input",{autoFocus:!0,value:l,onChange:g=>c(g.target.value),placeholder:"Search...",className:"w-full text-sm px-2 py-1 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-400"})}),r.jsx("div",{className:"max-h-52 overflow-y-auto py-1",children:m.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-gray-400",children:"No results"}):m.map(g=>r.jsxs("button",{type:"button",onClick:()=>{t(g.value,g.label),o(!1)},className:`w-full text-left px-3 py-2 text-sm hover:bg-indigo-50 transition-colors ${e===g.value?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-700"}`,children:[r.jsx("div",{className:"font-medium truncate",children:g.label}),r.jsx("div",{className:"text-xs text-gray-400 font-mono truncate",children:g.value})]},g.value))})]})]})}const QF={hold:r.jsx(am,{className:"w-3.5 h-3.5"}),pending:r.jsx(ni,{className:"w-3.5 h-3.5"}),processing:r.jsx(zn,{className:"w-3.5 h-3.5"}),done:r.jsx(mr,{className:"w-3.5 h-3.5"}),error:r.jsx(fr,{className:"w-3.5 h-3.5"})};function uFe({status:e,lastProcessingAt:t}){const[,n]=h.useState(0);h.useEffect(()=>{const i=setInterval(()=>n(o=>o+1),1e4);return()=>clearInterval(i)},[]);const s={running:{icon:r.jsx(Hz,{className:"w-3.5 h-3.5 animate-pulse"}),label:"Running",cls:"bg-emerald-50 text-emerald-700 border-emerald-200"},stalled:{icon:r.jsx(l7,{className:"w-3.5 h-3.5"}),label:"Stalled?",cls:"bg-red-50 text-red-600 border-red-200"}
1676,idle:{icon:r.jsx(c7,{className:"w-3.5 h-3.5"}),label:"Idle",cls:"bg-gray-100 text-gray-500 border-gray-200"},unknown:{icon:r.jsx(ni,{className:"w-3.5 h-3.5"}),label:"…",cls:"bg-gray-100 text-gray-400 border-gray-200"}}[e]||{},a=t?`Last active: ${Math.round((Date.now()-t.getTime())/1e3)}s ago`:"";return r.jsxs("span",{title:`Controller: ${e}${a?" · "+a:""}`,className:`flex items-center gap-1.5 text-xs font-semibold px-2.5 py-1 rounded-lg border ${s.cls}`,children:[s.icon," ",s.label]})}function mFe(){const e=new URLSearchParams(window.location.search),t=e.get("back"),n=e.get("kb"),s=t==="KnowledgeBaseDetail"&&n?`/KnowledgeBaseDetail?id=${n}`:"/KnowledgeBases",a=KY(),[i,o]=h.useState("Queue"),[l,c]=h.useState(!1),[d,f]=h.useState([]),[m,g]=h.useState(!0),[x,j]=h.useState(a.statusFilter??"all"),[b,y]=h.useState(!1),[w,_]=h.useState(null),[N,C]=h.useState(0),[k,S]=h.useState(3),[A,T]=h.useState(null),[R,B]=h.useState(!1),[D,P]=h.useState(new Set),[I,z]=h.useState(null),[L,H]=h.useState(null),[W,V]=h.useState(null),[K,M]=h.useState("unknown"),[G,q]=h.useState(null),[F,U]=h.useState(null),[ee,ne]=h.useState({}),[X,ie]=h.useState(null),[Z,ce]=h.useState({}),[le,re]=h.useState(a.targetFilter??"all"),[Ue,Ne]=h.useState(a.typeFilter??"all"),[Oe,Me]=h.useState(a.displayLimit??500),[ue,Ve]=h.useState(String(a.displayLimit??500)),[Xe,te]=h.useState(!1),[De,_e]=h.useState(!1),[We,tt]=h.useState(a.autoRestart??!1),[me,ae]=h.useState(a.autoRestartInterval??30),[Se,Le]=h.useState(String(a.autoRestartInterval??30)),[He,ut]=h.useState(a.autoRecount??!1),[ze,fe]=h.useState(a.autoRecountInterval??60),[dt,ct]=h.useState(String(a.autoRecountInterval??60)),Wt=h.useRef(a.autoRestart??!1),bt=h.useRef(a.autoRestartInterval??30),sn=h.useRef(a.autoRecount??!1),we=h.useRef(a.autoRecountInterval??60),Qe=h.useRef(!1),it=h.useRef(!1),at=h.useRef(a.statusFilter??"all"),Gt=h.useRef(a.targetFilter??"all"),Cn=h.useRef(a.typeFilter??"all");async function Jn(){var oe,Be;te(!0);try{const Ze=await Y.functions.invoke("countQueueTasks",{}),pt=((oe=Ze==null?void 0:Ze.data)==null?void 0:oe.by_status)||{};ne(pt),ie(((Be=Ze==null?void 0:Ze.data)==null?void 0:Be.total)??0)}catch{}te(!1)}h.useEffect(()=>{Jn()},[]),h.useEffect(()=>{Y.entities.KnowledgeBase.list(null,500).then(oe=>ce(Object.fromEntries(oe.map(Be=>[Be.id,Be.name])))).catch(()=>{})},[]),h.useEffect(()=>{Y.entities.AppConfig.filter({key:"global"}).then(oe=>{const Be=oe[0];Be&&(T(Be.id),Be.controller_delay_ms!=null&&C(Be.controller_delay_ms),Be.controller_max_attempts!=null&&S(Be.controller_max_attempts))}).catch(()=>{})},[]);async function Hn(){B(!0);try{if(A)await Y.entities.AppConfig.update(A,{controller_delay_ms:N,controller_max_attempts:k});else{const oe=await Y.entities.AppConfig.create({key:"global",controller_delay_ms:N,controller_max_attempts:k});T(oe.id)}}catch{}B(!1)}h.useEffect(()=>{at.current=x,To({statusFilter:x})},[x]),h.useEffect(()=>{Gt.current=le,To({targetFilter:le})},[le]),h.useEffect(()=>{Cn.current=Ue,To({typeFilter:Ue})},[Ue]),h.useEffect(()=>{Wt.current=We,To({autoRestart:We})},[We]),h.useEffect(()=>{bt.current=me,To({autoRestartInterval:me})},[me]),h.useEffect(()=>{sn.current=He,To({autoRecount:He})},[He]),h.useEffect(()=>{we.current=ze,To({autoRecountInterval:ze})},[ze]),h.useEffect(()=>{To({displayLimit:Oe})},[Oe]),h.useEffect(()=>{Qe.current=b},[b]),h.useEffect(()=>{tn(x)},[x,Oe]),h.useEffect(()=>{const oe=async()=>{var pt,qt;if(!(!Wt.current||Qe.current))try{const Kt=await Y.entities.KbTasksQueue.filter({status:"pending"},"priority",1);if(Kt&&Kt.length>0){console.log("[KbQueue auto-restart] Pending tasks found, restarting controller..."),y(!0),_(null);try{const Xt=await Y.functions.invoke("queueTaskController",{delay_ms:N,max_attempts:k});_(Xt==null?void 0:Xt.data),await tn(at.current)}catch(Xt){_({error:((qt=(pt=Xt==null?void 0:Xt.response)==null?void 0:pt.data)==null?void 0:qt.error)||Xt.message})}y(!1)}}catch{}};let Be;const Ze=()=>{Be=setTimeout(async()=>{await oe(),Ze()},bt.current*1e3)};return Ze(),()=>clearTimeout(Be)},[N,k]),h.useEffect(()=>{let oe;const Be=()=>{oe=setTimeout(async()=>{sn.current&&await Jn(),Be()},we.current*1e3)};return Be(),()=>clearTimeout(oe)},[]),h.useEffect(()=>{tn(at.current);const oe=Y.entities.KbTasksQueue.subscribe(Be=>{if(it.current)return;const Ze=at.current;f(pt=>Be.type==="create"?Ze!=="all"&&Be.data.status!==Ze?pt:[Be.data,...pt]:Be.type==="update"?Ze!=="all"&&Be.data.status!==Ze?pt.filter(qt=>qt.id!==Be.id):pt.map(qt=>qt.id===Be.id?Be.data:qt):Be.type==="delete"?pt.filter(qt=>qt.id!==Be.id):pt),V(new Date)});return()=>oe()},[]),h.useEffect(()=>{const oe=d.filter(pt=>pt.status==="processing");if(oe.length>0){const pt=oe.map(qt=>new Date(qt.updated_date||qt.created_date).getTime()).reduce((qt,Kt)=>Math.max(qt,Kt),0);q(new Date(pt))}const Be=oe.length>0,Ze=d.some(pt=>pt.status==="pending");if(Be){const pt=Date.now(),qt=oe.map(Xt=>new Date(Xt.updated_date||Xt.created_date).getTime()).reduce((Xt,Nn)=>Math.max(Xt,Nn),0),Kt=pt-qt;M(Kt>12e4?"stalled":"running")}else M("idle")},[d]);async function tn(oe){const Be=oe!==void 0?oe:at.current;g(!0);const Ze=Oe,pt=Be!=="all"?await Y.entities.KbTasksQueue.filter({status:Be},"-created_date",Ze):await Y.entities.KbTasksQueue.list("-created_date",Ze);f(pt),V(new Date),P(new Set),g(!1)}
1676const On=d.filter(oe=>!(le!=="all"&&oe.target!==le||Ue!=="all"&&oe.task_type!==Ue)),as=d.reduce((oe,Be)=>(oe[Be.target]=(oe[Be.target]||0)+1,oe),{}),$e=d.reduce((oe,Be)=>(oe[Be.task_type]=(oe[Be.task_type]||0)+1,oe),{});function he(oe){P(Be=>{const Ze=new Set(Be);return Ze.has(oe)?Ze.delete(oe):Ze.add(oe),Ze})}function Q(){D.size===On.length?P(new Set):P(new Set(On.map(oe=>oe.id)))}async function ke(oe,Be){z(oe),await Y.entities.KbTasksQueue.update(oe,{status:Be,...Be==="pending"?{last_error:null}:{}}),f(Ze=>Ze.map(pt=>pt.id===oe?{...pt,status:Be,...Be==="pending"?{last_error:null}:{}}:pt)),z(null)}async function Ee(oe){if(D.size===0)return;const Be=[...D],Ze=new Set(Be),pt={status:oe,...oe==="pending"?{last_error:null}:{}},qt=20;it.current=!0,z("bulk"),H({done:0,total:Be.length});let Kt=0;for(let Xt=0;Xt<Be.length;Xt+=qt){const Nn=Be.slice(Xt,Xt+qt);await Promise.all(Nn.map(async Et=>{for(let Zt=0;Zt<3;Zt++)try{await Y.entities.KbTasksQueue.update(Et,pt);break}catch{Zt<2&&await new Promise(Os=>setTimeout(Os,300*(Zt+1)))}})),Kt+=Nn.length,H({done:Math.min(Kt,Be.length),total:Be.length}),Xt+qt<Be.length&&await new Promise(Et=>setTimeout(Et,100))}it.current=!1,f(Xt=>Xt.map(Nn=>Ze.has(Nn.id)?{...Nn,...pt}:Nn)),P(new Set),z(null),H(null),Jn()}async function Ye(){if(D.size===0||!confirm(`Delete ${D.size} selected tasks?`))return;const oe=[...D],Be=new Set(oe),Ze=20;it.current=!0,z("bulk"),H({done:0,total:oe.length});let pt=0;for(let qt=0;qt<oe.length;qt+=Ze){const Kt=oe.slice(qt,qt+Ze);await Promise.all(Kt.map(async Xt=>{for(let Nn=0;Nn<3;Nn++)try{await Y.entities.KbTasksQueue.delete(Xt);break}catch{Nn<2&&await new Promise(Zt=>setTimeout(Zt,300*(Nn+1)))}})),pt+=Kt.length,H({done:Math.min(pt,oe.length),total:oe.length}),qt+Ze<oe.length&&await new Promise(Xt=>setTimeout(Xt,100))}it.current=!1,f(qt=>qt.filter(Kt=>!Be.has(Kt.id))),P(new Set),z(null),H(null),Jn()}async function Tt(){var oe,Be;y(!0),_(null);try{const Ze=await Y.functions.invoke("queueTaskController",{delay_ms:N,max_attempts:k});_(Ze==null?void 0:Ze.data),await tn(at.current)}catch(Ze){_({error:((Be=(oe=Ze==null?void 0:Ze.response)==null?void 0:oe.data)==null?void 0:Be.error)||Ze.message})}y(!1)}async function Ut(){var oe,Be;y(!0);try{const Ze=await Y.functions.invoke("queueTaskController",{max_attempts:k,dry_run:!0});_(Ze==null?void 0:Ze.data)}catch(Ze){_({error:((Be=(oe=Ze==null?void 0:Ze.response)==null?void 0:oe.data)==null?void 0:Be.error)||Ze.message})}y(!1)}async function $t(oe){await Y.entities.KbTasksQueue.delete(oe).catch(()=>{}),f(Be=>Be.filter(Ze=>Ze.id!==oe)),P(Be=>{const Ze=new Set(Be);return Ze.delete(oe),Ze})}async function En(){const[oe,Be]=await Promise.all([Y.entities.KbTasksQueue.filter({status:"processing"},"-created_date",500),Y.entities.KbTasksQueue.filter({status:"pending"},"-created_date",500)]);if(oe.length===0&&Be.length===0){alert("No running or pending tasks to stop.");return}if(!confirm(`Stop controller?
1677
1678• ${oe.length} processing → error
1679• ${Be.length} pending → hold`))return;const Ze=[...oe.map(Kt=>({id:Kt.id,patch:{status:"error",last_error:"Stopped by user"}})),...Be.map(Kt=>({id:Kt.id,patch:{status:"hold"}}))],pt=20;it.current=!0,z("bulk"),H({done:0,total:Ze.length});let qt=0;for(let Kt=0;Kt<Ze.length;Kt+=pt){const Xt=Ze.slice(Kt,Kt+pt);await Promise.all(Xt.map(async({id:Nn,patch:Et})=>{for(let Zt=0;Zt<3;Zt++)try{await Y.entities.KbTasksQueue.update(Nn,Et);break}catch{Zt<2&&await new Promise(Os=>setTimeout(Os,300*(Zt+1)))}})),qt+=Xt.length,H({done:Math.min(qt,Ze.length),total:Ze.length}),Kt+pt<Ze.length&&await new Promise(Nn=>setTimeout(Nn,100))}it.current=!1,H(null),z(null),await tn(at.current)}async function Pr(){const[oe,Be,Ze]=await Promise.all([Y.entities.KbTasksQueue.filter({status:"hold"},"-created_date",500),Y.entities.KbTasksQueue.filter({status:"error"},"-created_date",500),Y.entities.KbTasksQueue.filter({status:"processing"},"-created_date",500)]),pt=[...oe,...Be,...Ze];if(pt.length===0){alert("No stuck tasks found (hold/error/processing).");return}const qt=[oe.length>0?`${oe.length} hold`:null,Be.length>0?`${Be.length} error`:null,Ze.length>0?`${Ze.length}
1679 processing`:null].filter(Boolean).join(", ");if(!confirm(`Unstick ${pt.length} tasks (${qt})?
1680
1681All will be reset to pending with cleared errors.`))return;const Kt=20;it.current=!0,z("bulk"),H({done:0,total:pt.length});let Xt=0;for(let Nn=0;Nn<pt.length;Nn+=Kt){const Et=pt.slice(Nn,Nn+Kt);await Promise.all(Et.map(async Zt=>{for(let mn=0;mn<3;mn++)try{await Y.entities.KbTasksQueue.update(Zt.id,{status:"pending",last_error:null});break}catch{mn<2&&await new Promise(la=>setTimeout(la,300*(mn+1)))}})),Xt+=Et.length,H({done:Math.min(Xt,pt.length),total:pt.length}),Nn+Kt<pt.length&&await new Promise(Zt=>setTimeout(Zt,100))}it.current=!1,H(null),z(null),await tn(at.current),Jn()}async function zs(){if(!confirm("Delete all 'done' tasks?"))return;const oe=30;let Be=0;for(;;){const Ze=await Y.entities.KbTasksQueue.filter({status:"done"},"-created_date",500);if(Ze.length===0)break;for(let pt=0;pt<Ze.length;pt+=oe){const qt=Ze.slice(pt,pt+oe);await Promise.all(qt.map(Kt=>Y.entities.KbTasksQueue.delete(Kt.id).catch(()=>{}))),pt+oe<Ze.length&&await new Promise(Kt=>setTimeout(Kt,300))}if(Be+=Ze.length,Ze.length<500)break;await new Promise(pt=>setTimeout(pt,300))}await tn(at.current)}return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:s,children:r.jsx(de,{variant:"ghost",size:"sm",children:r.jsx(or,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-indigo-50 flex items-center justify-center",children:r.jsx(el,{className:"w-5 h-5 text-indigo-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"KB Task Queue"}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Manage and execute knowledge base processing tasks"})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(uFe,{status:K,lastProcessingAt:G}),r.jsx(de,{variant:"outline",size:"sm",onClick:()=>{To({statusFilter:x,targetFilter:le,typeFilter:Ue,displayLimit:Oe,autoRestart:We,autoRestartInterval:me,autoRecount:He,autoRecountInterval:ze}),_e(!0),setTimeout(()=>_e(!1),1500)},title:"Save all current preferences",children:De?r.jsx(Tn,{className:"w-4 h-4 text-emerald-500"}):r.jsx(Ar,{className:"w-4 h-4"})}),r.jsx(de,{variant:"outline",size:"sm",onClick:Jn,disabled:Xe,title:"Recount all tasks (iterative, accurate)",children:r.jsx(Dr,{className:`w-4 h-4 ${Xe?"animate-spin":""}`})}),r.jsx(de,{variant:"outline",size:"sm",onClick:()=>tn(at.current),disabled:m,title:W?`Last refresh: ${W.toLocaleTimeString()}`:"Refresh",children:r.jsx(Rn,{className:`w-4 h-4 ${m?"animate-spin":""}`})})]})]}),r.jsx("div",{className:"flex gap-1 mt-4",children:dFe.map(oe=>r.jsx("button",{onClick:()=>o(oe),className:`px-4 py-1.5 rounded-lg text-sm font-medium transition-colors ${i===oe?"bg-indigo-600 text-white":"text-gray-500 hover:bg-gray-100"}`,children:oe},oe))})]}),F&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-xl max-h-[90vh] flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(I0,{className:"w-4 h-4 text-indigo-600"}),r.jsx("h2",{className:"font-semibold text-gray-900",children:"Task Parameters"})]}),r.jsx("button",{onClick:()=>U(null),className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"p-5 space-y-3 overflow-y-auto flex-1",children:[r.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[["Target",F.target],["Task Type",F.task_type],["Status",F.status],["Priority",F.priority??5],["Attempts",F.attempts??0],["KB",F.knowledge_base_name],["Item",F.knowledge_item_name],["Chunk Index",F.knowledge_chunk_index!=null?F.knowledge_chunk_index:"—"],["Chunk ID",F.knowledge_chunk_id||"—"],["KB ID",F.knowledge_base_id],["Item ID",F.knowledge_item_id||"—"],["Created",
1681new Date(F.created_date).toLocaleString()]].map(([oe,Be])=>Be?r.jsxs("div",{children:[r.jsx("div",{className:"text-gray-400 font-medium",children:oe}),r.jsx("div",{className:"font-mono text-gray-700 truncate",children:Be})]},oe):null)}),F.parameters?r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-semibold text-gray-500 mb-1",children:"Chunk Parameters (JSON)"}),r.jsx("pre",{className:"bg-indigo-50 border border-indigo-100 rounded-lg px-3 py-2.5 text-xs font-mono text-indigo-900 whitespace-pre-wrap overflow-auto max-h-48",children:JSON.stringify(JSON.parse(F.parameters),null,2)})]}):r.jsx("div",{className:"text-xs text-gray-400 italic bg-gray-50 rounded-lg px-3 py-2",children:"No custom parameters — uses KB / AppConfig defaults"}),F.last_error&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[r.jsx(fr,{className:"w-3.5 h-3.5 text-red-500"}),r.jsx("span",{className:"text-xs font-semibold text-red-500",children:"Last Error"}),r.jsx("button",{onClick:()=>navigator.clipboard.writeText(F.last_error),className:"ml-auto text-[11px] text-red-400 hover:text-red-600 underline",title:"Copy error to clipboard",children:"copy"})]}),r.jsx("pre",{className:"bg-red-50 border border-red-200 rounded-lg px-3 py-3 text-xs text-red-800 font-mono whitespace-pre-wrap break-all overflow-auto max-h-72",children:F.last_error})]})]})]})}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[i==="Queue"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-3 md:grid-cols-6 gap-2",children:[r.jsxs("button",{onClick:()=>j("all"),className:`border rounded-xl p-3 text-left transition-all bg-white ${x==="all"?"ring-2 ring-indigo-400 border-indigo-300":"hover:bg-gray-50"}`,children:[r.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide mb-1 text-gray-400",children:"all"}),Xe?r.jsx(Pe,{className:"w-5 h-5 animate-spin text-gray-300 mt-1"}):r.jsx("div",{className:"text-2xl font-bold text-gray-900",children:X??"—"})]}),["hold","pending","processing","done","error"].map(oe=>r.jsxs("button",{onClick:()=>j(Be=>Be===oe?"all":oe),className:`border rounded-xl p-3 text-left transition-all ${x===oe?"ring-2 ring-indigo-400":"hover:opacity-90"} ${YF[oe]}`,children:[r.jsxs("div",{className:"flex items-center gap-1 mb-1 opacity-70",children:[QF[oe],r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:oe})]}),Xe?r.jsx(Pe,{className:"w-4 h-4 animate-spin opacity-50 mt-1"}):r.jsx("div",{className:"text-2xl font-bold",children:ee[oe]||0})]},oe))]}),r.jsxs("div",{className:"flex items-center gap-4 bg-white border rounded-xl px-4 py-2.5 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[r.jsx("span",{className:"font-medium text-xs text-gray-500 uppercase tracking-wide",children:"Show:"}),r.jsx("input",{type:"number",min:"50",max:"5000",step:"50",value:ue,onChange:oe=>Ve(oe.target.value),onBlur:()=>{const oe=Math.max(50,Math.min(5e3,parseInt(ue)||500));Ve(String(oe)),Me(oe)},onKeyDown:oe=>{if(oe.key==="Enter"){const Be=Math.max(50,Math.min(5e3,parseInt(ue)||500));Ve(String(Be)),Me(Be)}},className:"w-20 border rounded-lg px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"}),r.jsx("span",{className:"text-xs text-gray-400",children:"tasks (50–5000)"})]}),r.jsx("div",{className:"w-px h-4 bg-gray-200"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("button",{onClick:()=>tt(oe=>!oe),className:`flex items-center gap-2 text-xs font-semibold px-3 py-1.5 rounded-lg border transition-colors ${We?"bg-emerald-50 text-emerald-700 border-emerald-300":"bg-gray-50 text-gray-500 border-gray-200 hover:bg-gray-100"}`,children:[r.jsx(Dr,{className:`w-3.5 h-3.5 ${We?"animate-spin":""}`}),"Auto-restart ",We?"ON":"OFF"]}),r.jsx("span",{className:"text-xs text-gray-400",children:"every"}),r.jsx("input",{type:"number",min:"10",max:"3600",step:"10",value:Se,onChange:oe=>Le(oe.target.value),onBlur:()=>{const oe=Math.max(10,Math.min(3600,parseInt(Se)||30));Le(String(oe)),ae(oe)},onKeyDown:oe=>{if(oe.key==="Enter"){const Be=Math.max(10,Math.min(3600,parseInt(Se)||30));Le(String(Be)),ae(Be)}},className:"w-16 border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-400"}),r.jsx("span",{className:"text-xs text-gray-400",children:"s when idle with pending tasks"})]}),r.jsx("div",{className:"w-px h-4 bg-gray-200"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("button",{onClick:()=>ut(oe=>!oe),className:`flex items-center gap-2 text-xs font-semibold px-3 py-1.5 rounded-lg border transition-colors ${He?"bg-blue-50 text-blue-700 border-blue-300":"bg-gray-50 text-gray-500 border-gray-200 hover:bg-gray-100"}`,children:[r.jsx(Dr,{className:`w-3.5 h-3.5 ${He&&Xe?"animate-spin":""}`}),"Auto-recount ",He?"ON":"OFF"]}),r.jsx("span",{className:"text-xs text-gray-400",children:"every"}),r.jsx("input",{type:"number",min:"10",max:"3600",step:"10",value:dt,onChange:oe=>ct(oe.target.value),onBlur:()=>{const oe=Math.max(10,Math.min(3600,parseInt(dt)||60));ct(String(oe)),fe(oe)},onKeyDown:oe=>{if(oe.key==="Enter"){const Be=Math.max(10,Math.min(3600,parseInt(dt)||60));ct(String(Be)),fe(Be)}},className:"w-16 border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-400"}),r.jsx("span",{className:"text-xs text-gray-400",children:"s"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap bg-white border rounded-xl px-4 py-2.5",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide mr-1",children:"Filter:"}),r.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:["all","Chunk","Item","KnowledgeBase"].map(oe=>{const Be=oe==="all"?d.length:as[oe]||0;return r.jsxs("button",{onClick:()=>re(oe),className:`text-xs font-medium px-2.5 py-1 rounded-lg border transition-colors flex items-center gap-1 ${le===oe?oe==="all"?"bg-gray-800 text-white border-gray-800":`${Vk[oe]} border-current`:"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:[oe==="all"?"All":oe,r.jsx("span",{className:`text-[10px] font-bold px-1 py-0.5 rounded ${le===oe?"bg-white/20":"bg-gray-100 text-gray-500"}`,children:Be})]},oe)})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 mx-1"}),r.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:["all","extract","extract_cc","summarize","summarize_cc","chunk","embed","store_vectors","run_statistics"].map(oe=>{const Be=oe==="all"?d.length:$e[oe]||0;return r.jsxs("button",{onClick:()=>Ne(oe),className:`text-xs font-medium px-2.5 py-1 rounded-lg border transition-colors font-mono flex items-center gap-1 ${Ue===oe?"bg-indigo-600 text-white border-indigo-600":"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:[oe==="all"?"all":oe,r.jsx("span",{className:`text-[10px] font-bold px-1 py-0.5 rounded font-sans ${Ue===oe?"bg-white/20":"bg-gray-100 text-gray-500"}`,children:Be})]},oe)})}),(le!=="all"||Ue!=="all")&&r.jsxs("button",{onClick:()=>{re("all"),Ne("all")},className:"ml-auto text-xs text-gray-400 hover:text-gray-600 flex items-center gap-1",children:[r.jsx(jt,{className:"w-3 h-3"})," clear"]})]}),r.jsxs("div",{className:"bg-white border rounded-xl overflow-hidden",children:[r.jsxs("div",{onClick:()=>c(oe=>!oe),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-gray-50 transition-colors cursor-pointer",children:[r.jsxs("h2",{className:"font-semibold text-gray-800 flex items-center gap-2 text-sm",children:[r.jsx(H5,{className:"w-4 h-4 text-indigo-500"})," Controller"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex gap-2",onClick:oe=>oe.stopPropagation(),children:[r.jsxs(de,{onClick:Tt,disabled:b,size:"sm",className:"gap-1.5 bg-indigo-600 hover:bg-indigo-700 text-white",children:[b?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Bo,{className:"w-3.5 h-3.5"}),"Run"]}),r.jsxs(de,{variant:"outline",onClick:Ut,disabled:b,size:"sm",className:"gap-1.5",children:[r.jsx(Fm,{className:"w-3.5 h-3.5"})," Dry Run"]}),r.jsxs(de,{variant:"outline",onClick:En,size:"sm",className:"gap-1.5 text-red-600 border-red-200 hover:bg-red-50",children:[r.jsx(jt,{className:"w-3.5 h-3.5"})," Stop"]}),r.jsxs(de,{variant:"outline",onClick:Pr,disabled:I==="bulk",size:"sm",className:"gap-1.5 text-amber-600 border-amber-200 hover:bg-amber-50",children:[I==="bulk"?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Dr,{className:"w-3.5 h-3.5"}),"Unstick All"]}),r.jsxs(de,{variant:"outline",onClick:zs,size:"sm",className:"gap-1.5 text-gray-500",children:[r.jsx(un,{className:"w-3.5 h-3.5"})," Clear Done"]})]}),l?r.jsx(gt,{className:"w-4 h-4 text-gray-400"}):r.jsx(en,{className:"w-4 h-4 text-gray-400"})]})]}),l&&r.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t",children:[r.jsxs("div",{className:"flex gap-4 flex-wrap pt-3 items-end",children:[[["Delay (ms)",N,oe=>C(Math.max(0,parseInt(oe)||0)),0,null,100],["Max Attempts",k,oe=>S(Math.max(1,parseInt(oe)||1)),1,10]].map(([oe,Be,Ze,pt,qt,Kt])=>r.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600",children:[r.jsxs("span",{className:"font-medium whitespace-nowrap",children:[oe,":"]}
1681),r.jsx("input",{type:"number",min:pt,max:qt,step:Kt,value:Be,onChange:Xt=>Ze(Xt.target.value),className:"w-20 border rounded-lg px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"})]},oe)),r.jsxs(de,{variant:"outline",size:"sm",onClick:Hn,disabled:R,className:"gap-1.5 text-indigo-600 border-indigo-200 hover:bg-indigo-50",children:[R?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Ar,{className:"w-3.5 h-3.5"}),"Save"]})]}),w&&r.jsx("div",{className:`rounded-lg p-3 text-xs font-mono ${w.error?"bg-red-50 text-red-700 border border-red-200":"bg-emerald-50 text-emerald-800 border border-emerald-200"}`,children:r.jsx("pre",{className:"whitespace-pre-wrap",children:JSON.stringify(w,null,2)})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("button",{onClick:Q,className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 px-2 py-1 rounded hover:bg-gray-100 transition-colors",children:[D.size===On.length&&On.length>0?r.jsx(D0,{className:"w-4 h-4 text-indigo-600"}):r.jsx(L0,{className:"w-4 h-4"}),D.size>0?`${D.size} selected`:"Select all"]}),r.jsxs("span",{className:"text-xs text-gray-400",children:[`${On.length} shown (limit: ${Oe})`,X!=null&&r.jsxs("span",{className:"ml-1",children:["· ",r.jsxs("span",{className:"font-semibold text-gray-600",children:[X.toLocaleString()," total"]})]}),W&&r.jsxs("span",{className:"ml-2 text-gray-300",children:["· updated ",W.toLocaleTimeString()]})]}),D.size>0&&r.jsxs("div",{className:"flex items-center gap-2 ml-2 pl-2 border-l flex-wrap",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Bulk:"}),L?r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-indigo-700 bg-indigo-50 border border-indigo-200 px-2.5 py-1.5 rounded-lg",children:[r.jsx(Pe,{className:"w-3 h-3 animate-spin"}),L.done,"/",L.total]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>Ee("pending"),disabled:I==="bulk",className:"flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-lg border bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100 transition-colors disabled:opacity-50",children:[r.jsx(rc,{className:"w-3 h-3"})," → Pending"]}),r.jsxs("button",{onClick:()=>Ee("hold"),disabled:I==="bulk",className:"flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-lg border bg-gray-100 text-gray-600 border-gray-300 hover:bg-gray-200 transition-colors disabled:opacity-50",children:[r.jsx(am,{className:"w-3 h-3"})," → Hold"]}),r.jsxs("button",{onClick:Ye,disabled:I==="bulk",className:"flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-lg border bg-red-50 text-red-600 border-red-200 hover:bg-red-100 transition-colors disabled:opacity-50",children:[r.jsx(un,{className:"w-3 h-3"})," Delete"]})]})]})]}),m?r.jsx("div",{className:"text-center py-10 text-gray-400",children:r.jsx(Pe,{className:"w-6 h-6 animate-spin mx-auto"})}):On.length===0?r.jsx("div",{className:"text-center py-10 text-gray-400 border rounded-xl bg-white",children:"No tasks found."}):r.jsx("div",{className:"space-y-1.5",children:On.map(oe=>{const Be=L5[`${oe.target}:${oe.task_type}`],Ze=D.has(oe.id),pt=I===oe.id;return r.jsxs("div",{className:`bg-white border rounded-xl px-4 py-3 flex items-center gap-3 transition-all ${Ze?"border-indigo-300 bg-indigo-50/30 ring-1 ring-indigo-200":"hover:border-gray-300"}`,children:[r.jsx("button",{onClick:()=>he(oe.id),className:"shrink-0",children:Ze?r.jsx(D0,{className:"w-4 h-4 text-indigo-600"}):r.jsx(L0,{className:"w-4 h-4 text-gray-300 hover:text-gray-500"})}),r.jsxs("span",{className:`shrink-0 flex items-center gap-1 text-xs font-semibold px-2 py-1 rounded-lg border ${YF[oe.status]}`,children:[QF[oe.status],oe.status]}),r.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 hidden sm:flex",children:[r.jsxs("span",{className:`flex items-center gap-0.5 text-[11px] font-bold px-1.5 py-0.5 rounded border ${(oe.priority||5)<=2?"bg-red-50 text-red-600 border-red-200":(oe.priority||5)<=4?"bg-orange-50 text-orange-600 border-orange-200":(oe.priority||5)>=8?"bg-gray-100 text-gray-400 border-gray-200":"bg-indigo-50 text-indigo-500 border-indigo-200"}`,children:[r.jsx(r7,{className:"w-2.5 h-2.5"}),"P",oe.priority||5]}),oe.knowledge_chunk_index!=null&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] font-medium px-1.5 py-0.5 rounded border bg-purple-50 text-purple-600 border-purple-200",title:"Chunk index",children:[r.jsx(ys,{className:"w-2.5 h-2.5"}),"c",oe.knowledge_chunk_index]}),(oe.attempts||0)>0&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] font-medium px-1.5 py-0.5 rounded border bg-gray-50 text-gray-500 border-gray-200",title:"Attempts",children:[r.jsx(ys,{className:"w-2.5 h-2.5"}),oe.attempts]}),r.jsx("span",{className:"text-[11px] text-gray-400 font-mono whitespace-nowrap",title:new Date(oe.created_date).toLocaleStr
1681ing(),children:new Date(oe.created_date).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:`text-xs font-medium px-1.5 py-0.5 rounded ${Vk[oe.target]||"bg-gray-100 text-gray-600"}`,children:oe.target}),r.jsx("span",{className:"text-xs bg-gray-100 text-gray-700 px-1.5 py-0.5 rounded font-mono",children:oe.task_type}),Be&&r.jsxs("span",{className:"text-xs text-indigo-400 font-mono hidden sm:inline",children:["→ ",Be.fn,"()"]})]}),r.jsx("div",{className:"text-sm text-gray-800 font-medium mt-0.5 truncate",children:oe.knowledge_item_name||r.jsx("span",{className:"text-gray-400",children:"—"})}),(()=>{const qt=oe.knowledge_base_name||oe.knowledge_base_id&&Z[oe.knowledge_base_id];return qt?r.jsxs("div",{className:"text-xs text-gray-400 truncate flex items-center gap-1",children:[r.jsx(_n,{className:"w-2.5 h-2.5 shrink-0"}),qt]}):null})(),oe.last_error&&r.jsxs("div",{className:"text-xs text-red-600 mt-1 bg-red-50 border border-red-100 rounded px-2 py-1 cursor-pointer hover:bg-red-100 transition-colors",onClick:()=>U(oe),title:"Click to view full error",children:[r.jsx("span",{className:"font-semibold",children:"Error:"})," ",oe.last_error]})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx("button",{onClick:()=>U(oe),title:"View task parameters",className:"p-1.5 rounded-lg hover:bg-indigo-50 text-gray-300 hover:text-indigo-500 transition-colors",children:r.jsx(I0,{className:"w-3.5 h-3.5"})}),oe.status!=="pending"&&oe.status!=="processing"&&r.jsx("button",{onClick:()=>ke(oe.id,"pending"),disabled:pt,title:"Set to Pending",className:"p-1.5 rounded-lg hover:bg-blue-50 text-blue-500 hover:text-blue-700 transition-colors disabled:opacity-50",children:pt?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(rc,{className:"w-3.5 h-3.5"})}),oe.status!=="hold"&&oe.status!=="processing"&&r.jsx("button",{onClick:()=>ke(oe.id,"hold"),disabled:pt,title:"Set to Hold",className:"p-1.5 rounded-lg hover:bg-gray-100 text-gray-400 hover:text-gray-600 transition-colors disabled:opacity-50",children:pt?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(am,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>$t(oe.id),className:"p-1.5 rounded-lg hover:bg-red-50 text-red-400 hover:text-red-600 transition-colors",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]})]},oe.id)})})]})]}),i==="Test"&&r.jsx(fFe,{}),i==="Reference"&&r.jsxs("div",{className:"space-y-4 max-w-3xl",children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:"Task Type → Function Mapping"}),r.jsx("div",{className:"bg-white border rounded-xl overflow-hidden",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"bg-gray-50 border-b",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Target"}),r.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Task Type"}),r.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Function"}),r.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Description"})]})}),r.jsx("tbody",{className:"divide-y",children:Object.entries(L5).map(([oe,Be])=>{const[Ze,pt]=oe.split(":");return r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-4 py-2.5",children:r.jsx("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full ${Vk[Ze]||"bg-gray-100 text-gray-600"}`,children:Ze})}),r.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-gray-700",children:pt}),r.jsxs("td",{className:"px-4 py-2.5 font-mono text-xs text-indigo-700",children:[Be.fn,"()"]}),r.jsx("td",{className:"px-4 py-2.5 text-xs text-gray-500",children:Be.desc})]},oe)})})]})}),r.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4 text-xs text-amber-800 space-y-1",children:[r.jsx("p",{className:"font-semibold text-sm",children:"Notes"}),r.jsxs("ul",{className:"list-disc ml-4 space-y-1",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"executeQueueTask"})," — Executes a single task or batch by task_id / task_ids"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"queueTaskController"})," — Picks up ALL pending tasks sorted by priority, respects delay_ms and max_attempts"]}),r.jsxs("li",{children:["Tasks with ",r.jsx("code",{className:"bg-amber-100 px-1 rounded",children:"hold"})," status are skipped by the controller"]})]})]})]})]})]})}const XF="kbqueue_test_task";function fFe(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState(!0),[o,l]=h.useState(!1),[c,d]=h.useState(!1),[f,m]=h.useState(null),g=(()=>{try{return JSON.parse(localStorage.getItem(XF)||"{}")}catch{return{}}})(),[x,j]=h.useState({knowledge_base_id:"",knowledge_base_name:"",knowledge_item_id:"",knowledge_item_name:"",chunk_index:"",target:g.target||"Item",task_type:g.task_type||"summarize",priority:g.priority??5,parameters:g.parameters||""}),[b,y]=h.useState(!1),[w,_]=h.useState(!1),[N,C]=h.useState(null),[k,S]=h.useState(null);h.useEffect(()=>{localStorage.setItem(XF,JSON.stringify({target:x.target,task_type:x.task_type,priority:x.priority,parameters:x.parameters}))},[x.target,x.task_type,x.priority,x.parameters]),h.useEffect(()=>{Y.entities.KnowledgeBase.list("name",200).then(L=>{t(L.map(H=>({value:H.id,label:H.name,raw:H}))),i(!1)})},[]);async function A(L,H){var K;const W=((K=e.find(M=>M.value===L))==null?void 0:K.raw)||null;if(m(W),j(M=>({...M,knowledge_base_id:L,knowledge_base_name:H,knowledge_item_id:"",knowledge_item_name:""})),s([]),!L)return;l(!0);const V=await Y.entities.KnowledgeItem.filter({knowledge_base_id:L},"title",200);s(V.map(M=>({value:M.id,label:M.title}))),l(!1)}const T=`${x.target}:${x.task_type}`,R=L5[T],B=x.task_type==="chunk"&&(x.target==="Item"||x.target==="KnowledgeBase");function D(L,H){j(W=>({...W,target:L,task_type:H}))}function P(L){j(H=>({...H,parameters:JSON.stringify(L)})),d(!1)}async function I(){if(B&&!x.parameters){d(!0);return}y(!0),C(null),S(null);try{let L={...x,status:"hold"};if(x.target==="Chunk"&&x.knowledge_item_id&&x.chunk_index!==""){const W=await Y.entities.KnowledgeChunk.filter({knowledge_item_id:x.knowledge_item_id,chunk_index:
1681parseInt(x.chunk_index,10)});if(!W||W.length===0){C({error:`No chunk found at index ${x.chunk_index} for this item.`}),y(!1);return}L.knowledge_chunk_id=W[0].id,L.knowledge_chunk_index=W[0].chunk_index}const H=await Y.entities.KbTasksQueue.create(L);S(H.id),C({created:!0,id:H.id,knowledge_chunk_id:L.knowledge_chunk_id,parameters:L.parameters||null})}catch(L){C({error:L.message})}y(!1)}async function z(){var L,H;if(k){_(!0);try{await Y.entities.KbTasksQueue.update(k,{status:"pending"});const W=await Y.functions.invoke("executeQueueTask",{task_id:k});C({executed:!0,...W==null?void 0:W.data})}catch(W){C({error:((H=(L=W==null?void 0:W.response)==null?void 0:L.data)==null?void 0:H.error)||W.message})}_(!1)}}return r.jsxs("div",{className:"max-w-2xl space-y-6",children:[c&&r.jsx(Ap,{title:"Set Chunk Parameters",kb:f,onConfirm:P,onCancel:()=>d(!1)}),r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-4",children:[r.jsxs("h2",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[r.jsx(Fm,{className:"w-4 h-4 text-indigo-500"})," Create & Execute a Test Task"]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Target *"}),r.jsxs("select",{value:x.target,onChange:L=>D(L.target.value,x.task_type),className:"mt-1 w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400",children:[r.jsx("option",{children:"Chunk"}),r.jsx("option",{children:"Item"}),r.jsx("option",{children:"KnowledgeBase"})]})]}),r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Task Type *"}
1681),r.jsx("select",{value:x.task_type,onChange:L=>D(x.target,L.target.value),className:"mt-1 w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400",children:["extract","extract_cc","summarize","summarize_cc","chunk","embed","run_statistics","store_vectors"].map(L=>r.jsx("option",{value:L,children:L},L))})]})]}),R?r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-lg px-4 py-2.5 text-sm",children:[r.jsx("span",{className:"text-indigo-500 font-semibold",children:"Function: "}),r.jsxs("span",{className:"font-mono text-indigo-800",children:[R.fn,"()"]}),r.jsxs("span",{className:"text-indigo-600 ml-2 text-xs",children:["— ",R.desc]})]}):r.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg px-4 py-2.5 text-sm text-amber-700",children:["⚠ No handler defined for ",T]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Knowledge Base *"}),r.jsx("div",{className:"mt-1",children:a?r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 py-2",children:[r.jsx(Pe,{className:"w-3 h-3 animate-spin"})," Loading KBs..."]}):r.jsx(JF,{value:x.knowledge_base_id,onChange:A,options:e,placeholder:"Select a Knowledge Base..."})})]}),(x.target==="Item"||x.target==="Chunk")&&r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Knowledge Item"}),r.jsx("div",{className:"mt-1",children:r.jsx(JF,{value:x.knowledge_item_id,onChange:(L,H)=>j(W=>({...W,knowledge_item_id:L,knowledge_item_name:H})),options:n,placeholder:o?"Loading items...":"Select an Item...",disabled:!x.knowledge_base_id||o})})]}),x.target==="Chunk"&&r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Chunk Index (0-based)"}),r.jsx("input",{type:"number",min:"0",value:x.chunk_index,onChange:L=>j(H=>({...H,chunk_index:parseInt(L.target.value)||""})),placeholder:"0",className:"mt-1 w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"})]}),B&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-indigo-700",children:"Chunk Parameters"}),r.jsx("button",{onClick:()=>d(!0),className:"text-xs font-medium text-indigo-600 hover:text-indigo-800 underline",children:x.parameters?"Edit…":"Set parameters…"})]}),x.parameters?r.jsx("div",{className:"bg-white border border-indigo-200 rounded-lg px-3 py-2 text-xs font-mono text-indigo-800 whitespace-pre-wrap",children:x.parameters}):r.jsx("div",{className:"text-xs text-indigo-500 italic",children:"Using defaults from KB / AppConfig"})]}),r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Priority (1=highest, 10=lowest)"}),r.jsx("input",{type:"number",min:"1",max:"10",value:x.priority,onChange:L=>j(H=>({...H,priority:parseInt(L.target.value)||5})),className:"mt-1 w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"})]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(de,{onClick:I,disabled:b||!x.knowledge_base_id,className:"gap-2 bg-indigo-600 hover:bg-indigo-700 text-white",children:[b?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(el,{className:"w-4 h-4"}),"1. Create Task (hold)"]}),k&&r.jsxs(de,{onClick:z,disabled:w,className:"gap-2 bg-emerald-600 hover:bg-emerald-700 text-white",children:[w?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Bo,{className:"w-4 h-4"}),"2. Execute Task"]})]}),N&&r.jsx("div",{className:`rounded-lg p-4 text-sm font-mono ${N.error?"bg-red-50 text-red-700 border border-red-200":"bg-emerald-50 text-emerald-800 border border-emerald-200"}`,children:r.jsx("pre",{className:"whitespace-pre-wrap",children:JSON.stringify(N,null,2)})})]})]})}const $5={"Item:extract":{fn:"extractAndSaveUrl",desc:"Extract content from URL"},"Item:summarize":{fn:"summarizeItems",desc:"Generate item summary"},"Item:summarize_cc":{fn:"summarizeCCItems",desc:"Summarize closed captions"},"Item:chunk":{fn:"chunkItem",desc:"Chunk item — uses task.parameters for chunking config"},"Item:embed":{fn:"embedItem",desc:"Create Chunk:embed tasks for all chunks"},"Item:store_vectors":{fn:"vectorizeKBItem",desc:"Vectorize & store in Supabase"}
1681,"Item:run_statistics":{fn:"getKbStats",desc:"Run KB statistics"},"Chunk:embed":{fn:"localChunkEmbedding",desc:"Generate local embedding vector"},"Chunk:store_vectors":{fn:"vectorStoreChunk",desc:"Store chunk vector in Supabase (upsert by chunk ID)"},"KnowledgeBase:summarize":{fn:"summarizeKB",desc:"Summarize entire KB"},"KnowledgeBase:run_statistics":{fn:"getKbStats",desc:"Run KB statistics"},"KnowledgeBase:store_vectors":{fn:"vectorizeKB",desc:"Calls vectorizeKBItem() for each KB item"},"KnowledgeBase:chunk":{fn:"chunkKB",desc:"Creates Item:chunk tasks for each KB item (uses task.parameters)"},"KnowledgeBase:embed":{fn:"embedKB",desc:"Calls embedItem() for each KB item"}},ZF={hold:"bg-gray-100 text-gray-500 border-gray-200",pending:"bg-blue-50 text-blue-700 border-blue-200",processing:"bg-amber-50 text-amber-700 border-amber-200",done:"bg-emerald-50 text-emerald-700 border-emerald-200",error:"bg-red-50 text-red-600 border-red-200"},Hk={Chunk:"bg-indigo-50 text-indigo-700",Item:"bg-violet-50 text-violet-700",KnowledgeBase:"bg-cyan-50 text-cyan-700"},hFe=["Queue","Test","Reference"],VY="kbqueue_settings";function HY(){try{return JSON.parse(localStorage.getItem(VY)||"{}")}catch{return{}}}function Po(e){try{const t=HY();localStorage.setItem(VY,JSON.stringify({...t,...e}))}catch{}}function ez({value:e,onChange:t,options:n,placeholder:s="Search...",disabled:a=!1}){const[i,o]=h.useState(!1),[l,c]=h.useState(""),d=h.useRef(null),f=n.find(g=>g.value===e);h.useEffect(()=>{function g(x){d.current&&!d.current.contains(x.target)&&o(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]);const m=n.filter(g=>g.label.toLowerCase().includes(l.toLowerCase())||g.value.toLowerCase().includes(l.toLowerCase()));return r.jsxs("div",{className:"relative",ref:d,children:[r.jsxs("button",{type:"button",disabled:a,onClick:()=>{o(g=>!g),c("")},className:"w-full border rounded-lg px-3 py-2 text-sm text-left flex items-center justify-between gap-2 bg-white focus:outline-none focus:ring-2 focus:ring-indigo-400 disabled:opacity-50",children:[r.jsx("span",{className:f?"text-gray-900 truncate":"text-gray-400 truncate",children:f?f.label:s}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e&&r.jsx("span",{onClick:g=>{g.stopPropagation(),t("","")},className:"text-gray-400 hover:text-gray-600 cursor-pointer",children:r.jsx(jt,{className:"w-3 h-3"})}),r.jsx(gt,{className:`w-4 h-4 text-gray-400 transition-transform ${i?"rotate-180":""}`})]})]}),i&&r.jsxs("div",{className:"absolute z-50 mt-1 w-full bg-white border rounded-xl shadow-lg",children:[r.jsx("div",{className:"p-2 border-b",children:r.jsx("input",{autoFocus:!0,value:l,onChange:g=>c(g.target.value),placeholder:"Search...",className:"w-full text-sm px-2 py-1 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-400"})}),r.jsx("div",{className:"max-h-52 overflow-y-auto py-1",children:m.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-gray-400",children:"No results"}):m.map(g=>r.jsxs("button",{type:"button",onClick:()=>{t(g.value,g.label),o(!1)},className:`w-full text-left px-3 py-2 text-sm hover:bg-indigo-50 transition-colors ${e===g.value?"bg-indigo-50 text-indigo-700 font-medium":"text-gray-700"}`,children:[r.jsx("div",{className:"font-medium truncate",children:g.label}),r.jsx("div",{className:"text-xs text-gray-400 font-mono truncate",children:g.value})]},g.value))})]})]})}const tz={hold:r.jsx(am,{className:"w-3.5 h-3.5"}),pending:r.jsx(ni,{className:"w-3.5 h-3.5"}),processing:r.jsx(zn,{className:"w-3.5 h-3.5"}),done:r.jsx(mr,{className:"w-3.5 h-3.5"}),error:r.jsx(fr,{className:"w-3.5 h-3.5"})};function pFe({status:e,lastProcessingAt:t}){const[,n]=h.useState(0);h.useEffect(()=>{const i=setInterval(()=>n(o=>o+1),1e4);return()=>clearInterval(i)},[]);const s={running:{icon:r.jsx(Hz,{className:"w-3.5 h-3.5 animate-pulse"}),label:"Running",cls:"bg-emerald-50 text-emerald-700 border-emerald-200"},stalled:{icon:r.jsx(l7,{className:"w-3.5 h-3.5"}),label:"Stalled?",cls:"bg-red-50 text-red-600 border-red-200"}
1681,idle:{icon:r.jsx(c7,{className:"w-3.5 h-3.5"}),label:"Idle",cls:"bg-gray-100 text-gray-500 border-gray-200"},unknown:{icon:r.jsx(ni,{className:"w-3.5 h-3.5"}),label:"…",cls:"bg-gray-100 text-gray-400 border-gray-200"}}[e]||{},a=t?`Last active: ${Math.round((Date.now()-t.getTime())/1e3)}s ago`:"";return r.jsxs("span",{title:`Controller: ${e}${a?" · "+a:""}`,className:`flex items-center gap-1.5 text-xs font-semibold px-2.5 py-1 rounded-lg border ${s.cls}`,children:[s.icon," ",s.label]})}function gFe(){const e=HY(),[t,n]=h.useState("Queue"),[s,a]=h.useState(!1),[i,o]=h.useState([]),[l,c]=h.useState(!0),[d,f]=h.useState(e.statusFilter??"all"),[m,g]=h.useState(!1),[x,j]=h.useState(null),[b,y]=h.useState(0),[w,_]=h.useState(3),[N,C]=h.useState(null),[k,S]=h.useState(!1),[A,T]=h.useState(new Set),[R,B]=h.useState(null),[D,P]=h.useState(null),[I,z]=h.useState("unknown"),[L,H]=h.useState(null),[W,V]=h.useState(null),[K,M]=h.useState({}),[G,q]=h.useState(null),[F,U]=h.useState(e.targetFilter??"all"),[ee,ne]=h.useState(e.typeFilter??"all"),[X,ie]=h.useState(e.displayLimit??500),[Z,ce]=h.useState(String(e.displayLimit??500)),[le,re]=h.useState(!1),[Ue,Ne]=h.useState(!1),[Oe,Me]=h.useState(e.autoRestart??!1),[ue,Ve]=h.useState(e.autoRestartInterval??30),[Xe,te]=h.useState(String(e.autoRestartInterval??30)),[De,_e]=h.useState(e.autoRecount??!1),[We,tt]=h.useState(e.autoRecountInterval??60),[me,ae]=h.useState(String(e.autoRecountInterval??60)),Se=h.useRef(e.autoRestart??!1),Le=h.useRef(e.autoRestartInterval??30),He=h.useRef(e.autoRecount??!1),ut=h.useRef(e.autoRecountInterval??60),ze=h.useRef(!1),fe=h.useRef(e.statusFilter??"all"),dt=h.useRef(e.targetFilter??"all"),ct=h.useRef(e.typeFilter??"all");async function Wt(){var Q,ke;re(!0);try{const Ee=await Y.functions.invoke("countQueueTasks",{}),Ye=((Q=Ee==null?void 0:Ee.data)==null?void 0:Q.by_status)||{};M(Ye),q(((ke=Ee==null?void 0:Ee.data)==null?void 0:ke.total)??0)}catch{}re(!1)}h.useEffect(()=>{Y.entities.AppConfig.filter({key:"global"}).then(Q=>{const ke=Q[0];ke&&(C(ke.id),ke.controller_delay_ms!=null&&y(ke.controller_delay_ms),ke.controller_max_attempts!=null&&_(ke.controller_max_attempts))}).catch(()=>{})},[]);async function bt(){S(!0);try{if(N)await Y.entities.AppConfig.update(N,{controller_delay_ms:b,controller_max_attempts:w});else{const Q=await Y.entities.AppConfig.create({key:"global",controller_delay_ms:b,controller_max_attempts:w});C(Q.id)}}catch{}S(!1)}h.useEffect(()=>{fe.current=d,Po({statusFilter:d})},[d]),h.useEffect(()=>{dt.current=F,Po({targetFilter:F})},[F]),h.useEffect(()=>{ct.current=ee,Po({typeFilter:ee})},[ee]),h.useEffect(()=>{Se.current=Oe,Po({autoRestart:Oe})},[Oe]),h.useEffect(()=>{Le.current=ue,Po({autoRestartInterval:ue})},[ue]),h.useEffect(()=>{He.current=De,Po({autoRecount:De})},[De]),h.useEffect(()=>{ut.current=We,Po({autoRecountInterval:We})},[We]),h.useEffect(()=>{Po({displayLimit:X})},[X]),h.useEffect(()=>{ze.current=m},[m]),h.useEffect(()=>{sn(d)},[d,X]),h.useEffect(()=>{const Q=async()=>{var Ye,Tt;if(!(!Se.current||ze.current))try{const Ut=await Y.entities.KbTasksQueue.filter({status:"pending"},"priority",1);if(Ut&&Ut.length>0){console.log("[KbQueueBKP auto-restart] Pending tasks found, restarting controller..."),g(!0),j(null);try{const $t=await Y.functions.invoke("queueTaskController",{delay_ms:b,max_attempts:w});j($t==null?void 0:$t.data),await sn(fe.current)}catch($t){j({error:((Tt=(Ye=$t==null?void 0:$t.response)==null?void 0:Ye.data)==null?void 0:Tt.error)||$t.message})}g(!1)}}catch{}};let ke;const Ee=()=>{ke=setTimeout(async()=>{await Q(),Ee()},Le.current*1e3)};return Ee(),()=>clearTimeout(ke)},[b,w]),h.useEffect(()=>{let Q;const ke=()=>{Q=setTimeout(async()=>{He.current&&await Wt(),ke()},ut.current*1e3)};return ke(),()=>clearTimeout(Q)},[]),h.useEffect(()=>{sn(fe.current);const Q=Y.entities.KbTasksQueue.subscribe(ke=>{const Ee=fe.current;o(Ye=>ke.type==="create"?Ee!=="all"&&ke.data.status!==Ee?Ye:[ke.data,...Ye]:ke.type==="update"?Ee!=="all"&&ke.data.status!==Ee?Ye.filter(Tt=>Tt.id!==ke.id):Ye.map(Tt=>Tt.id===ke.id?ke.data:Tt):ke.type==="delete"?Ye.filter(Tt=>Tt.id!==ke.id):Ye),P(new Date)});return()=>Q()},[]),h.useEffect(()=>{const Q=i.filter(Ye=>Ye.status==="processing");if(Q.length>0){const Ye=Q.map(Tt=>new Date(Tt.updated_date||Tt.created_date).getTime()).reduce((Tt,Ut)=>Math.max(Tt,Ut),0);H(new Date(Ye))}const ke=Q.length>0,Ee=i.some(Ye=>Ye.status==="pending");if(ke){const Ye=Date.now(),Tt=Q.map($t=>new Date($t.updated_date||$t.created_date).getTime()).reduce(($t,En)=>Math.max($t,En),0),Ut=Ye-Tt;z(Ut>12e4?"stalled":"running")}else z("idle")},[i]);async function sn(Q){const ke=Q!==void 0?Q:fe.current;c(!0);const Ee=X,Ye=ke!=="all"?await Y.entities.KbTasksQueue.filter({status:ke},"-created_date",Ee):await Y.entities.KbTasksQueue.list("-created_date",Ee);o(Ye),P(new Date),T(new Set),c(!1)}const we=i.filter(Q=>!(F!=="all"&&Q.target!==F||ee!=="all"&&Q.task_type!==ee)),Qe=i.reduce((Q,ke)=>(Q[ke.target]=(Q[ke.target]||0)+1,Q),{}),it=i.reduce((Q,ke)=>(Q[ke.task_type]=(Q[ke.task_type]||0)+1,Q),{});function at(Q){T(ke=>{const Ee=new Set(ke);return Ee.has(Q)?Ee.delete(Q):Ee.add(Q),Ee})}function Gt(){A.size===we.length?T(new Set):T(new Set(we.map(Q=>Q.id)))}async function Cn(Q,ke){B(Q),await Y.entities.KbTasksQueue.update(Q,{status:ke,...ke==="pending"?{last_error:null}:{}}),o(Ee=>Ee.map(Ye=>Ye.id===Q?{...Ye,status:ke,...ke==="pending"?{last_error:null}:{}}:Ye)),B(null)}async function Jn(Q){if(A.size===0)return;B("bulk");const ke=[...A],Ee={status:Q,...Q==="pending"?{last_error:null}:{}},Ye=50;for(let Tt=0;Tt<ke.length;Tt+=Ye){const Ut=ke.slice(Tt,Tt+Ye);await Promise.all(Ut.map($t=>Y.entities.KbTasksQueue.update($t,Ee)))}o(Tt=>Tt.map(Ut=>A.has(Ut.id)?{...Ut,...Ee}:Ut)),T(new Set),B(null)}async function Hn(){if(A.size===0||!confirm(`Delete ${A.size} selected tasks?`))return;B("bulk");const Q=[...A];await Promise.all(Q.map(ke=>Y.entities.KbTasksQueue.delete(ke).catch(()=>{}))),o(ke=>ke.filter(Ee=>!A.has(Ee.id))),T(new Set),B(null)}async function tn(){var Q,ke;g(!0),j(null);try{const Ee=await Y.functions.invoke("queueTaskController",{delay_ms:b,max_attempts:w});j(Ee==null?void 0:Ee.data),await sn(fe.current)}catch(Ee){j({error:((ke=(Q=Ee==null?void 0:Ee.response)==null?void 0:Q.data)==null?void 0:ke.error)||Ee.message})}g(!1)}async function On(){var Q,ke;g(!0);try{const Ee=await Y.functions.invoke("queueTaskController",{max_attempts:w,dry_run:!0});j(Ee==null?void 0:Ee.data)}catch(Ee){j({error:((ke=(Q=Ee==null?void 0:Ee.response)==null?void 0:Q.data)==null?void 0:ke.error)||Ee.message})}g(!1)}async function as(Q){await Y.entities.KbTasksQueue.delete(Q).catch(()=>{}),o(ke=>ke.filter(Ee=>Ee.id!==Q)),T(ke=>{const Ee=new Set(ke);return Ee.delete(Q),Ee})}async function $e(){const[Q,ke]=await Promise.all([Y.entities.KbTasksQueue.filter({status:"processing"},"-created_date",500),Y.entities.KbTasksQueue.filter({status:"pending"},"-created_date",500)]);if(Q.length===0&&ke.length===0){alert("No running or pending tasks to stop.");return}if(!confirm(`Stop controller?
1682
1683• ${Q.length} processing → error
1684• ${ke.length} pending → hold`))return;B("bulk");const Ee=10,Ye=[...Q.map(Tt=>({id:Tt.id,patch:{status:"error",last_error:"Stopped by user"}})),...ke.map(Tt=>({id:Tt.id,patch:{status:"hold"}}))];for(let Tt=0;Tt<Ye.length;Tt+=Ee){const Ut=Ye.slice(Tt,Tt+Ee);await Promise.all(Ut.map(({id:$t,patch:En})=>Y.entities.KbTasksQueue.update($t,En))),Tt+Ee<Ye.length&&await new Promise($t=>setTimeout($t,300))}await sn(fe.current),B(null)}async function he(){if(!confirm("Delete all 'done' tasks?"))return;const Q=30;let ke=0;for(;;){const Ee=await Y.entities.KbTasksQueue.filter({status:"done"},"-created_date",500);if(Ee.length===0)break;for(let Ye=0;Ye<Ee.length;Ye+=Q){const Tt=Ee.slice(Ye,Ye+Q);await Promise.all(Tt.map(Ut=>Y.entities.KbTasksQueue.delete(Ut.id).catch(()=>{}))),Ye+Q<Ee.length&&await new Promise(Ut=>setTimeout(Ut,300))}if(ke+=Ee.length,Ee.length<500)break;await new Promise(Ye=>setTimeout(Ye,300))}await sn(fe.current)}return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"border-b bg-white px-6 py-4 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wt,{to:"/KnowledgeBases",children:r.jsx(de,{variant:"ghost",size:"sm",children:r.jsx(or,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-indigo-50 flex items-center justify-center",children:r.jsx(el,{className:"w-5 h-5 text-indigo-600"})}),r.jsxs("div",{children:[r.jsxs("h1",{className:"text-xl font-bold text-gray-900",children:["KB Task Queue ",r.jsx("span",{className:"text-xs font-normal text-gray-400 ml-1",children:"(BKP)"})]}),r.jsx("p",{className:"text-gray-500 text-xs",children:"Manage and execute knowledge base processing tasks"})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(pFe,{status:I,lastProcessingAt:L}),r.jsx(de,{variant:"outline",size:"sm",onClick:()=>{Po({statusFilter:d,targetFilter:F,typeFilter:ee,displayLimit:X,autoRestart:Oe,autoRestartInterval:ue,autoRecount:De,autoRecountInterval:We}),Ne(!0),setTimeout(()=>Ne(!1),1500)},title:"Save all current preferences",children:Ue?r.jsx(Tn,{className:"w-4 h-4 text-emerald-500"}):r.jsx(Ar,{className:"w-4 h-4"})}),r.jsx(de,{variant:"outline",size:"sm",onClick:Wt,disabled:le,title:"Recount all tasks (iterative, accurate)",children:r.jsx(Dr,{className:`w-4 h-4 ${le?"animate-spin":""}`})}),r.jsx(de,{variant:"outline",size:"sm",onClick:()=>sn(fe.current),disabled:l,title:D?`Last refresh: ${D.toLocaleTimeString()}`:"Refresh",children:r.jsx(Rn,{className:`w-4 h-4 ${l?"animate-spin":""}`})})]})]}),r.jsx("div",{className:"flex gap-1 mt-4",children:hFe.map(Q=>r.jsx("button",{onClick:()=>n(Q),className:`px-4 py-1.5 rounded-lg text-sm font-medium transition-colors ${t===Q?"bg-indigo-600 text-white":"text-gray-500 hover:bg-gray-100"}`,children:Q},Q))})]}),W&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-xl max-h-[90vh] flex flex-col",children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(I0,{className:"w-4 h-4 text-indigo-600"}),r.jsx("h2",{className:"font-semibold text-gray-900",children:"Task Parameters"})]}),r.jsx("button",{onClick:()=>V(null),className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100",children:r.jsx(jt,{className:"w-4 h-4"})})]}),r.jsxs("div",{className:"p-5 space-y-3 overflow-y-auto flex-1",children:[r.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[["Target",W.target],["Task Type",W.task_type],["Status",W.status],["Priority",W.priority??5],["Attempts",W.attempts??0],["KB",W.knowledge_base_name],["Item",W.knowledge_item_name],["Chunk Index",W.knowledge_chunk_index!=null?W.knowledge_chunk_index:"—"],["Chunk ID",W.knowledge_chunk_id||"—"],["KB ID",W.knowledge_base_id],["Item ID",W.knowledge_item_id||"—"],["Created",
1684new Date(W.created_date).toLocaleString()]].map(([Q,ke])=>ke?r.jsxs("div",{children:[r.jsx("div",{className:"text-gray-400 font-medium",children:Q}),r.jsx("div",{className:"font-mono text-gray-700 truncate",children:ke})]},Q):null)}),W.parameters?r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-semibold text-gray-500 mb-1",children:"Chunk Parameters (JSON)"}),r.jsx("pre",{className:"bg-indigo-50 border border-indigo-100 rounded-lg px-3 py-2.5 text-xs font-mono text-indigo-900 whitespace-pre-wrap overflow-auto max-h-48",children:JSON.stringify(JSON.parse(W.parameters),null,2)})]}):r.jsx("div",{className:"text-xs text-gray-400 italic bg-gray-50 rounded-lg px-3 py-2",children:"No custom parameters — uses KB / AppConfig defaults"}),W.last_error&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[r.jsx(fr,{className:"w-3.5 h-3.5 text-red-500"}),r.jsx("span",{className:"text-xs font-semibold text-red-500",children:"Last Error"}),r.jsx("button",{onClick:()=>navigator.clipboard.writeText(W.last_error),className:"ml-auto text-[11px] text-red-400 hover:text-red-600 underline",title:"Copy error to clipboard",children:"copy"})]}),r.jsx("pre",{className:"bg-red-50 border border-red-200 rounded-lg px-3 py-3 text-xs text-red-800 font-mono whitespace-pre-wrap break-all overflow-auto max-h-72",children:W.last_error})]})]})]})}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[t==="Queue"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-3 md:grid-cols-6 gap-2",children:[r.jsxs("button",{onClick:()=>f("all"),className:`border rounded-xl p-3 text-left transition-all bg-white ${d==="all"?"ring-2 ring-indigo-400 border-indigo-300":"hover:bg-gray-50"}`,children:[r.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide mb-1 text-gray-400",children:"all"}),le?r.jsx(Pe,{className:"w-5 h-5 animate-spin text-gray-300 mt-1"}):r.jsx("div",{className:"text-2xl font-bold text-gray-900",children:G??"—"})]}),["hold","pending","processing","done","error"].map(Q=>r.jsxs("button",{onClick:()=>f(ke=>ke===Q?"all":Q),className:`border rounded-xl p-3 text-left transition-all ${d===Q?"ring-2 ring-indigo-400":"hover:opacity-90"} ${ZF[Q]}`,children:[r.jsxs("div",{className:"flex items-center gap-1 mb-1 opacity-70",children:[tz[Q],r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:Q})]}),le?r.jsx(Pe,{className:"w-4 h-4 animate-spin opacity-50 mt-1"}):r.jsx("div",{className:"text-2xl font-bold",children:K[Q]||0})]},Q))]}),r.jsxs("div",{className:"flex items-center gap-4 bg-white border rounded-xl px-4 py-2.5 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[r.jsx("span",{className:"font-medium text-xs text-gray-500 uppercase tracking-wide",children:"Show:"}),r.jsx("input",{type:"number",min:"50",max:"5000",step:"50",value:Z,onChange:Q=>ce(Q.target.value),onBlur:()=>{const Q=Math.max(50,Math.min(5e3,parseInt(Z)||500));ce(String(Q)),ie(Q)},onKeyDown:Q=>{if(Q.key==="Enter"){const ke=Math.max(50,Math.min(5e3,parseInt(Z)||500));ce(String(ke)),ie(ke)}},className:"w-20 border rounded-lg px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"}),r.jsx("span",{className:"text-xs text-gray-400",children:"tasks (50–5000)"})]}),r.jsx("div",{className:"w-px h-4 bg-gray-200"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("button",{onClick:()=>Me(Q=>!Q),className:`flex items-center gap-2 text-xs font-semibold px-3 py-1.5 rounded-lg border transition-colors ${Oe?"bg-emerald-50 text-emerald-700 border-emerald-300":"bg-gray-50 text-gray-500 border-gray-200 hover:bg-gray-100"}`,children:[r.jsx(Dr,{className:`w-3.5 h-3.5 ${Oe?"animate-spin":""}`}),"Auto-restart ",Oe?"ON":"OFF"]}),r.jsx("span",{className:"text-xs text-gray-400",children:"every"}),r.jsx("input",{type:"number",min:"10",max:"3600",step:"10",value:Xe,onChange:Q=>te(Q.target.value),onBlur:()=>{const Q=Math.max(10,Math.min(3600,parseInt(Xe)||30));te(String(Q)),Ve(Q)},onKeyDown:Q=>{if(Q.key==="Enter"){const ke=Math.max(10,Math.min(3600,parseInt(Xe)||30));te(String(ke)),Ve(ke)}},className:"w-16 border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-400"}),r.jsx("span",{className:"text-xs text-gray-400",children:"s when idle with pending tasks"})]}),r.jsx("div",{className:"w-px h-4 bg-gray-200"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("button",{onClick:()=>_e(Q=>!Q),className:`flex items-center gap-2 text-xs font-semibold px-3 py-1.5 rounded-lg border transition-colors ${De?"bg-blue-50 text-blue-700 border-blue-300":"bg-gray-50 text-gray-500 border-gray-200 hover:bg-gray-100"}`,children:[r.jsx(Dr,{className:`w-3.5 h-3.5 ${De&&le?"animate-spin":""}`}),"Auto-recount ",De?"ON":"OFF"]}),r.jsx("span",{className:"text-xs text-gray-400",children:"every"}),r.jsx("input",{type:"number",min:"10",max:"3600",step:"10",value:me,onChange:Q=>ae(Q.target.value),onBlur:()=>{const Q=Math.max(10,Math.min(3600,parseInt(me)||60));ae(String(Q)),tt(Q)},onKeyDown:Q=>{if(Q.key==="Enter"){const ke=Math.max(10,Math.min(3600,parseInt(me)||60));ae(String(ke)),tt(ke)}},className:"w-16 border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-400"}),r.jsx("span",{className:"text-xs text-gray-400",children:"s"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap bg-white border rounded-xl px-4 py-2.5",children:[r.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide mr-1",children:"Filter:"}),r.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:["all","Chunk","Item","KnowledgeBase"].map(Q=>{const ke=Q==="all"?i.length:Qe[Q]||0;return r.jsxs("button",{onClick:()=>
1684U(Q),className:`text-xs font-medium px-2.5 py-1 rounded-lg border transition-colors flex items-center gap-1 ${F===Q?Q==="all"?"bg-gray-800 text-white border-gray-800":`${Hk[Q]} border-current`:"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:[Q==="all"?"All":Q,r.jsx("span",{className:`text-[10px] font-bold px-1 py-0.5 rounded ${F===Q?"bg-white/20":"bg-gray-100 text-gray-500"}`,children:ke})]},Q)})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 mx-1"}),r.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:["all","extract","summarize","summarize_cc","chunk","embed","store_vectors","run_statistics"].map(Q=>{const ke=Q==="all"?i.length:it[Q]||0;return r.jsxs("button",{onClick:()=>ne(Q),className:`text-xs font-medium px-2.5 py-1 rounded-lg border transition-colors font-mono flex items-center gap-1 ${ee===Q?"bg-indigo-600 text-white border-indigo-600":"text-gray-500 border-gray-200 hover:bg-gray-50"}`,children:[Q==="all"?"all":Q,r.jsx("span",{className:`text-[10px] font-bold px-1 py-0.5 rounded font-sans ${ee===Q?"bg-white/20":"bg-gray-100 text-gray-500"}`,children:ke})]},Q)})}),(F!=="all"||ee!=="all")&&r.jsxs("button",{onClick:()=>{U("all"),ne("all")},className:"ml-auto text-xs text-gray-400 hover:text-gray-600 flex items-center gap-1",children:[r.jsx(jt,{className:"w-3 h-3"})," clear"]})]}),r.jsxs("div",{className:"bg-white border rounded-xl overflow-hidden",children:[r.jsxs("div",{onClick:()=>a(Q=>!Q),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-gray-50 transition-colors cursor-pointer",children:[r.jsxs("h2",{className:"font-semibold text-gray-800 flex items-center gap-2 text-sm",children:[r.jsx(H5,{className:"w-4 h-4 text-indigo-500"})," Controller"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex gap-2",onClick:Q=>Q.stopPropagation(),children:[r.jsxs(de,{onClick:tn,disabled:m,size:"sm",className:"gap-1.5 bg-indigo-600 hover:bg-indigo-700 text-white",children:[m?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Bo,{className:"w-3.5 h-3.5"}),"Run"]}),r.jsxs(de,{variant:"outline",onClick:On,disabled:m,size:"sm",className:"gap-1.5",children:[r.jsx(Fm,{className:"w-3.5 h-3.5"})," Dry Run"]}),r.jsxs(de,{variant:"outline",onClick:$e,size:"sm",className:"gap-1.5 text-red-600 border-red-200 hover:bg-red-50",children:[r.jsx(jt,{className:"w-3.5 h-3.5"})," Stop"]}),r.jsxs(de,{variant:"outline",onClick:he,size:"sm",className:"gap-1.5 text-gray-500",children:[r.jsx(un,{className:"w-3.5 h-3.5"})," Clear Done"]})]}),s?r.jsx(gt,{className:"w-4 h-4 text-gray-400"}):r.jsx(en,{className:"w-4 h-4 text-gray-400"})]})]}),s&&r.jsxs("div",{className:"px-4 pb-4 space-y-3 border-t",children:[r.jsxs("div",{className:"flex gap-4 flex-wrap pt-3 items-end",children:[[["Delay (ms)",b,Q=>y(Math.max(0,parseInt(Q)||0)),0,null,100],["Max Attempts",w,Q=>_(Math.max(1,parseInt(Q)||1)),1,10]].map(([Q,ke,Ee,Ye,Tt,Ut])=>r.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600",children:[r.jsxs("span",{className:"font-medium whitespace-nowrap",children:[Q,":"]}),r.jsx("input",{type:"number",min:Ye,max:Tt,step:Ut,value:ke,onChange:$t=>Ee($t.target.value),className:"w-20 border rounded-lg px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"})]},Q)),r.jsxs(de,{variant:"outline",size:"sm",onClick:bt,disabled:k,className:"gap-1.5 text-indigo-600 border-indigo-200 hover:bg-indigo-50",children:[k?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(Ar,{className:"w-3.5 h-3.5"}),"Save"]})]}),x&&r.jsx("div",{className:`rounded-lg p-3 text-xs font-mono ${x.error?"bg-red-50 text-red-700 border border-red-200":"bg-emerald-50 text-emerald-800 border border-emerald-200"}`,children:r.jsx("pre",{className:"whitespace-pre-wrap",children:JSON.stringify(x,null,2)})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("button",{onClick:Gt,className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 px-2 py-1 rounded hover:bg-gray-100 transition-colors",children:[A.size===we.length&&we.length>0?r.jsx(D0,{className:"w-4 h-4 text-indigo-600"}):r.jsx(L0,{className:"w-4 h-4"}),A.size>0?`${A.size} selected`:"Select all"]}),r.jsxs("span",{className:"text-xs text-gray-400",children:[`${we.length} shown (limit: ${X})`,G!=null&&r.jsxs("span",{className:"ml-1",children:["· ",r.jsxs("span",{className:"font-semibold text-gray-600",children:[G.toLocaleStr
1684ing()," total"]})]}),D&&r.jsxs("span",{className:"ml-2 text-gray-300",children:["· updated ",D.toLocaleTimeString()]})]}),A.size>0&&r.jsxs("div",{className:"flex items-center gap-2 ml-2 pl-2 border-l",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Bulk:"}),r.jsxs("button",{onClick:()=>Jn("pending"),disabled:R==="bulk",className:"flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-lg border bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100 transition-colors disabled:opacity-50",children:[R==="bulk"?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(rc,{className:"w-3 h-3"}),"→ Pending"]}),r.jsxs("button",{onClick:()=>Jn("hold"),disabled:R==="bulk",className:"flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-lg border bg-gray-100 text-gray-600 border-gray-300 hover:bg-gray-200 transition-colors disabled:opacity-50",children:[R==="bulk"?r.jsx(Pe,{className:"w-3 h-3 animate-spin"}):r.jsx(am,{className:"w-3 h-3"}),"→ Hold"]}),r.jsxs("button",{onClick:Hn,disabled:R==="bulk",className:"flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-lg border bg-red-50 text-red-600 border-red-200 hover:bg-red-100 transition-colors disabled:opacity-50",children:[r.jsx(un,{className:"w-3 h-3"})," Delete"]})]})]}),l?r.jsx("div",{className:"text-center py-10 text-gray-400",children:r.jsx(Pe,{className:"w-6 h-6 animate-spin mx-auto"})}):we.length===0?r.jsx("div",{className:"text-center py-10 text-gray-400 border rounded-xl bg-white",children:"No tasks found."}):r.jsx("div",{className:"space-y-1.5",children:we.map(Q=>{const ke=$5[`${Q.target}:${Q.task_type}`],Ee=A.has(Q.id),Ye=R===Q.id;return r.jsxs("div",{className:`bg-white border rounded-xl px-4 py-3 flex items-center gap-3 transition-all ${Ee?"border-indigo-300 bg-indigo-50/30 ring-1 ring-indigo-200":"hover:border-gray-300"}`,children:[r.jsx("button",{onClick:()=>at(Q.id),className:"shrink-0",children:Ee?r.jsx(D0,{className:"w-4 h-4 text-indigo-600"}):r.jsx(L0,{className:"w-4 h-4 text-gray-300 hover:text-gray-500"})}),r.jsxs("span",{className:`shrink-0 flex items-center gap-1 text-xs font-semibold px-2 py-1 rounded-lg border ${ZF[Q.status]}`,children:[tz[Q.status],Q.status]}),r.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 hidden sm:flex",children:[r.jsxs("span",{className:`flex items-center gap-0.5 text-[11px] font-bold px-1.5 py-0.5 rounded border ${(Q.priority||5)<=2?"bg-red-50 text-red-600 border-red-200":(Q.priority||5)<=4?"bg-orange-50 text-orange-600 border-orange-200":(Q.priority||5)>=8?"bg-gray-100 text-gray-400 border-gray-200":"bg-indigo-50 text-indigo-500 border-indigo-200"}`,children:[r.jsx(r7,{className:"w-2.5 h-2.5"}),"P",Q.priority||5]}),Q.knowledge_chunk_index!=null&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] font-medium px-1.5 py-0.5 rounded border bg-purple-50 text-purple-600 border-purple-200",title:"Chunk index",children:[r.jsx(ys,{className:"w-2.5 h-2.5"}),"c",Q.knowledge_chunk_index]}),(Q.attempts||0)>0&&r.jsxs("span",{className:"flex items-center gap-0.5 text-[11px] font-medium px-1.5 py-0.5 rounded border bg-gray-50 text-gray-500 border-gray-200",title:"Attempts",children:[r.jsx(ys,{className:"w-2.5 h-2.5"}),Q.attempts]}),r.jsx("span",{className:"text-[11px] text-gray-400 font-mono whitespace-nowrap",title:new Date(Q.created_date).toLocaleString(),children:new Date(Q.created_date).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:`text-xs font-medium px-1.5 py-0.5 rounded ${Hk[Q.target]||"bg-gray-100 text-gray-600"}`,children:Q.target}),r.jsx("span",{className:"text-xs bg-gray-100 text-gray-700 px-1.5 py-0.5 rounded font-mono",children:Q.task_type}),ke&&r.jsxs("span",{className:"text-xs text-indigo-400 font-mono hidden sm:inline",children:["→ ",ke.fn,"()"]})]}),r.jsx("div",{className:"text-sm text-gray-800 font-medium mt-0.5 truncate",children:Q.knowledge_item_name||Q.knowledge_base_name||r.jsx("span",{className:"text-gray-400",children:"—"})}),Q.knowledge_item_name&&Q.knowledge_base_name&&r.jsx("div",{className:"text-xs text-gray-400 truncate",children:Q.knowledge_base_name}),Q.last_error&&r.jsxs("div",{className:"text-xs text-red-600 mt-1 bg-red-50 border border-red-100 rounded px-2 py-1 cursor-pointer hover:bg-red-100 transition-colors",onClick:()=>V(Q),title:"Click to view full error",children:[r.jsx("span",{className:"font-semibold",children:"Error:"})," ",Q.last_error]})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx("button",{onClick:()=>V(Q),title:"View task parameters",className:"p-1.5 rounded-lg hover:bg-indigo-50 text-gray-300 hover:text-indigo-500 transition-colors",children:r.jsx(I0,{className:"w-3.5 h-3.5"})}),Q.status!=="pending"&&Q.status!=="processing"&&r.jsx("button",{onClick:()=>Cn(Q.id,"pending"),disabled:Ye,title:"Set to Pending",className:"p-1.5 rounded-lg hover:bg-blue-50 text-blue-500 hover:text-blue-700 transition-colors disabled:opacity-50",children:Ye?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(rc,{className:"w-3.5 h-3.5"})}),Q.status!=="hold"&&Q.status!=="processing"&&r.jsx("button",{onClick:()=>Cn(Q.id,"hold"),disabled:Ye,title:"Set to Hold",className:"p-1.5 rounded-lg hover:bg-gray-100 text-gray-400 hover:text-gray-600 transition-colors disabled:opacity-50",children:Ye?r.jsx(Pe,{className:"w-3.5 h-3.5 animate-spin"}):r.jsx(am,{className:"w-3.5 h-3.5"})}),r.jsx("button",{onClick:()=>as(Q.id),className:"p-1.5 rounded-lg hover:bg-red-50 text-red-400 hover:text-red-600 transition-colors",children:r.jsx(un,{className:"w-3.5 h-3.5"})})]})]},Q.id)})})]})]}),t==="Test"&&r.jsx(xFe,{}),t==="Reference"&&r.jsxs("div",{className:"space-y-4 max-w-3xl",children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:"Task Type → Function Mapping"}),r.jsx("div",{className:"bg-white border rounded-xl overflow-hidden",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{className:"bg-gray-50 border-b",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Target"}),r.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Task Type"}),r.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Function"}),r.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"Description"})]})}),r.jsx("tbody",{className:"divide-y",children:Object.entries($5).map(([Q,ke])=>{const[Ee,Ye]=Q.split(":");return r.jsxs("tr",{className:"hover:bg-gray-50",children:[r.jsx("td",{className:"px-4 py-2.5",children:r.jsx("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full ${Hk[Ee]||"bg-gray-100 text-gray-600"}`,children:Ee})}),r.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-gray-700",children:Ye}),r.jsxs("td",{className:"px-4 py-2.5 font-mono text-xs text-indigo-700",children:[ke.fn,"()"]}),r.jsx("td",{className:"px-4 py-2.5 text-xs text-gray-500",children:ke.desc})]},Q)})})]})}),r.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4 text-xs text-amber-800 space-y-1",children:[r.jsx("p",{className:"font-semibold text-sm",children:"Notes"}),r.jsxs("ul",{className:"list-disc ml-4 space-y-1",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"executeQueueTask"})," — Executes a single task or batch by task_id / task_ids"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"queueTaskController"})," — Picks up ALL pending tasks sorted by priority, respects delay_ms and max_attempts"]}),r.jsxs("li",{children:["Tasks with ",r.jsx("code",{className:"bg-amber-100 px-1 rounded",children:"hold"})," status are skipped by the controller"]})]})]})]})]})]})}const nz="kbqueue_test_task";function xFe(){const[e,t]=h.useState([]),[n,s]=h.useState([]),[a,i]=h.useState(!0),[o,l]=h.useState(!1),[c,d]=h.useState(!1),[f,m]=h.useState(null),g=(()=>{try{return JSON.parse(localStorage.getItem(nz)||"{}")}catch{return{}}})(),[x,j]=h.useState({knowledge_base_id:"",knowledge_base_name:"",knowledge_item_id:"",knowledge_item_name:"",chunk_index:"",target:g.target||"Item",task_type:g.task_type||"summarize",priority:g.priority??5,parameters:g.parameters||""}),[b,y]=h.useState(!1),[w,_]=h.useState(!1),[N,C]=h.useState(null),[k,S]=h.useState(null);h.useEffect(()=>{localStorage.setItem(nz,JSON.stringify({target:x.target,task_type:x.task_type,priority:x.priority,parameters:x.parameters}))},[x.target,x.task_type,x.priority,x.parameters]),h.useEffect(()=>{Y.entities.KnowledgeBase.list("name",200).then(L=>{t(L.map(H=>({value:H.id,label:H.name,raw:H}))),i(!1)})},[]);async function A(L,H){var K;const W=((K=e.find(M=>M.value===L))==null?void 0:K.raw)||null;if(m(W),j(M=>({...M,knowledge_base_id:L,knowledge_base_name:H,knowledge_item_id:"",knowledge_item_name:""})),s([]),!L)return;l(!0);const V=await Y.entities.KnowledgeItem.filter({knowledge_base_id:L},"title",200);s(V.map(M=>({value:M.id,label:M.title}))),l(!1)}const T=`${x.target}:${x.task_type}`,R=$5[T],B=x.task_type==="chunk"&&(x.target==="Item"||x.target==="KnowledgeBase");function D(L,H){j(W=>({...W,target:L,task_type:H}))}function P(L){j(H=>({...H,parameters:JSON.stringify(L)})),d(!1)}async function I(){if(B&&!x.parameters){d(!0);return}y(!0),C(null),S(null);try{let L={...x,status:"hold"};if(x.target==="Chunk"&&x.knowledge_item_id&&x.chunk_index!==""){const W=await Y.entities.KnowledgeChunk.filter({knowledge_item_id:x.knowledge_item_id,chunk_index:
1684parseInt(x.chunk_index,10)});if(!W||W.length===0){C({error:`No chunk found at index ${x.chunk_index} for this item.`}),y(!1);return}L.knowledge_chunk_id=W[0].id,L.knowledge_chunk_index=W[0].chunk_index}const H=await Y.entities.KbTasksQueue.create(L);S(H.id),C({created:!0,id:H.id,knowledge_chunk_id:L.knowledge_chunk_id,parameters:L.parameters||null})}catch(L){C({error:L.message})}y(!1)}async function z(){var L,H;if(k){_(!0);try{await Y.entities.KbTasksQueue.update(k,{status:"pending"});const W=await Y.functions.invoke("executeQueueTask",{task_id:k});C({executed:!0,...W==null?void 0:W.data})}catch(W){C({error:((H=(L=W==null?void 0:W.response)==null?void 0:L.data)==null?void 0:H.error)||W.message})}_(!1)}}return r.jsxs("div",{className:"max-w-2xl space-y-6",children:[c&&r.jsx(Ap,{title:"Set Chunk Parameters",kb:f,onConfirm:P,onCancel:()=>d(!1)}),r.jsxs("div",{className:"bg-white border rounded-xl p-5 space-y-4",children:[r.jsxs("h2",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[r.jsx(Fm,{className:"w-4 h-4 text-indigo-500"})," Create & Execute a Test Task"]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Target *"}),r.jsxs("select",{value:x.target,onChange:L=>D(L.target.value,x.task_type),className:"mt-1 w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400",children:[r.jsx("option",{children:"Chunk"}),r.jsx("option",{children:"Item"}),r.jsx("option",{children:"KnowledgeBase"})]})]}),r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Task Type *"}
1684),r.jsx("select",{value:x.task_type,onChange:L=>D(x.target,L.target.value),className:"mt-1 w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400",children:["extract","summarize","summarize_cc","chunk","embed","run_statistics","store_vectors"].map(L=>r.jsx("option",{value:L,children:L},L))})]})]}),R?r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-lg px-4 py-2.5 text-sm",children:[r.jsx("span",{className:"text-indigo-500 font-semibold",children:"Function: "}),r.jsxs("span",{className:"font-mono text-indigo-800",children:[R.fn,"()"]}),r.jsxs("span",{className:"text-indigo-600 ml-2 text-xs",children:["— ",R.desc]})]}):r.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg px-4 py-2.5 text-sm text-amber-700",children:["⚠ No handler defined for ",T]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Knowledge Base *"}),r.jsx("div",{className:"mt-1",children:a?r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 py-2",children:[r.jsx(Pe,{className:"w-3 h-3 animate-spin"})," Loading KBs..."]}):r.jsx(ez,{value:x.knowledge_base_id,onChange:A,options:e,placeholder:"Select a Knowledge Base..."})})]}),(x.target==="Item"||x.target==="Chunk")&&r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Knowledge Item"}),r.jsx("div",{className:"mt-1",children:r.jsx(ez,{value:x.knowledge_item_id,onChange:(L,H)=>j(W=>({...W,knowledge_item_id:L,knowledge_item_name:H})),options:n,placeholder:o?"Loading items...":"Select an Item...",disabled:!x.knowledge_base_id||o})})]}),x.target==="Chunk"&&r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Chunk Index (0-based)"}),r.jsx("input",{type:"number",min:"0",value:x.chunk_index,onChange:L=>j(H=>({...H,chunk_index:parseInt(L.target.value)||""})),placeholder:"0",className:"mt-1 w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"})]}),B&&r.jsxs("div",{className:"bg-indigo-50 border border-indigo-100 rounded-xl p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-indigo-700",children:"Chunk Parameters"}),r.jsx("button",{onClick:()=>d(!0),className:"text-xs font-medium text-indigo-600 hover:text-indigo-800 underline",children:x.parameters?"Edit…":"Set parameters…"})]}),x.parameters?r.jsx("div",{className:"bg-white border border-indigo-200 rounded-lg px-3 py-2 text-xs font-mono text-indigo-800 whitespace-pre-wrap",children:x.parameters}):r.jsx("div",{className:"text-xs text-indigo-500 italic",children:"Using defaults from KB / AppConfig"})]}),r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"text-xs text-gray-500 font-medium",children:"Priority (1=highest, 10=lowest)"}),r.jsx("input",{type:"number",min:"1",max:"10",value:x.priority,onChange:L=>j(H=>({...H,priority:parseInt(L.target.value)||5})),className:"mt-1 w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-400"})]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(de,{onClick:I,disabled:b||!x.knowledge_base_id,className:"gap-2 bg-indigo-600 hover:bg-indigo-700 text-white",children:[b?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(el,{className:"w-4 h-4"}),"1. Create Task (hold)"]}),k&&r.jsxs(de,{onClick:z,disabled:w,className:"gap-2 bg-emerald-600 hover:bg-emerald-700 text-white",children:[w?r.jsx(Pe,{className:"w-4 h-4 animate-spin"}):r.jsx(Bo,{className:"w-4 h-4"}),"2. Execute Task"]})]}),N&&r.jsx("div",{className:`rounded-lg p-4 text-sm font-mono ${N.error?"bg-red-50 text-red-700 border border-red-200":"bg-emerald-50 text-emerald-800 border border-emerald-200"}`,children:r.jsx("pre",{className:"whitespace-pre-wrap",children:JSON.stringify(N,null,2)})})]})]})}const yFe=[{label:"Today",key:"today"},{label:"Yesterday",key:"yesterday"},{label:"7d",key:"7d"},{label:"30d",key:"30d"},{label:"90d",key:"90d"},{label:"All time",key:"alltime"},{label:"Custom",key:"custom"}];function bFe(e){var n;return{"United States":"us",Brazil:"br","United Kingdom":"gb",Canada:"ca",Australia:"au",Germany:"de",France:"fr",Spain:"es",Italy:"it",Netherlands:"nl",Portugal:"pt",Mexico:"mx",Argentina:"ar",Chile:"cl",Colombia:"c
1684o",India:"in",Japan:"jp",China:"cn","South Korea":"kr",Singapore:"sg",Israel:"il","South Africa":"za",Nigeria:"ng",Kenya:"ke",Egypt:"eg",Turkey:"tr",Russia:"ru",Poland:"pl",Sweden:"se",Norway:"no",Denmark:"dk",Finland:"fi",Switzerland:"ch",Austria:"at",Belgium:"be",Ireland:"ie","New Zealand":"nz",UAE:"ae","Saudi Arabia":"sa",Pakistan:"pk",Bangladesh:"bd",Indonesia:"id",Malaysia:"my",Thailand:"th",Vietnam:"vn",Philippines:"ph"}[e]||((n=e==null?void 0:e.slice(0,2))==null?void 0:n.toLowerCase())||"xx"}function p0({title:e,rows:t,total:n,renderLabel:s,mono:a}){return t!=null&&t.length?r.jsxs("div",{className:"bg-gray-50 rounded-xl p-2 space-y-1",children:[r.jsx("div",{className:"text-[9px] font-semibold text-gray-400 uppercase tracking-wide",children:e}),t.map(({label:i,count:o})=>{const l=Math.round(o/n*100);return r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("div",{className:"flex-1 h-1 rounded-full bg-gray-200 overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-indigo-400",style:{width:`${l}%`}})})}),r.jsx("div",{className:`text-[10px] text-gray-600 truncate max-w-[80px] ${a?"font-mono":""}`,children:s?s(i):i}),r.jsxs("span",{className:"text-[9px] text-gray-400 whitespace-nowrap shrink-0",children:[o," · ",l,"%"]})]},i)})]}):null}function vFe({assistants:e}){const[t,n]=h.useState(null),[s,a]=h.useState(!0),[i,o]=h.useState("alltime"),[l,c]=h.useState(""),[d,f]=h.useState(""),[m,g]=h.useState({open:!1,text:"",loading:!1}),x=h.useMemo(()=>e.map(N=>N.id),[e]),j=h.useMemo(()=>[...x].sort().join(","),[x]),b=h.useCallback((N,C,k)=>{const S=new Date;return N==="today"?{date_from:uo(S).toISOString(),date_to:null}:N==="yesterday"?{date_from:uo(Mr(S,1)).toISOString(),date_to:LA(Mr(S,1)).toISOString()}:N==="7d"?{date_from:Mr(S,7).toISOString(),date_to:null}:N==="30d"?{date_from:Mr(S,30).toISOString(),date_to:null}:N==="90d"?{date_from:Mr(S,90).toISOString(),date_to:null}:N==="alltime"?{date_from:null,date_to:null}:N==="custom"?{date_from:C?new Date(C).toISOString():null,date_to:k?new Date(k).toISOString():null}:{date_from:Mr(S,30).toISOString(),date_to:null}},[]);h.useEffect(()=>{if(x.length===0){a(!1);return}a(!0);const{date_from:N,date_to:C}=b(i,l,d);Y.functions.invoke("getPageViewStats",{assistant_ids:x,date_from:N,date_to:C,logs_limit:1,logs_offset:0,ip_top_n:10,excluded_ips:[]}).then(k=>{n(k.data),a(!1)}).catch(()=>a(!1))},[j,i,l,d]);const y=h.useMemo(()=>t!=null&&t.by_day?t.by_day.map(N=>({date:gs(Jy(N.date),"MMM d"),count:N.count})):[],[t]);if(s&&!t)return r.jsx("div",{className:"text-xs text-gray-400 py-4 text-center",children:"Loading combined stats…"});const w=t||{},_=w.total_count||0;return r.jsxs("div",{className:`space-y-4 relative transition-opacity ${s?"opacity-50":""}`,children:[s&&t&&r.jsxs("div",{className:"absolute top-0 right-0 z-10 flex items-center gap-1.5 bg-white border border-indigo-200 rounded-lg px-2.5 py-1 shadow-sm",children:[r.jsx("div",{className:"w-3 h-3 border-2 border-indigo-200 border-t-indigo-600 rounded-full animate-spin"}),r.jsx("span",{className:"text-[11px] text-indigo-600 font-medium",children:"Updating…"})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(Lm,{className:"w-3.5 h-3.5 text-gray-400"}),yFe.map(N=>r.jsx("button",{onClick:()=>o(N.key),className:`px-2.5 py-1 text-xs font-medium rounded-lg border transition-colors ${i===N.key?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300"}`,children:N.label},N.key)),i==="custom"&&r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("input",{type:"date",value:l,onChange:N=>c(N.target.value),className:"border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("span",{className:"text-gray-400",children:"→"}),r.jsx("input",{type:"date",value:d,onChange:N=>f(N.target.value),className:"border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400"})]}),r.jsx("div",{className:"ml-auto flex items-center gap-1.5",children:r.jsxs("button",{onClick:()=>{g({open:!0,text:"",loading:!0}),setTimeout(()=>{const N=MEe(e,t,{preset:i,customFrom:l,customTo:d});g(C=>({...C,text:N,loading:!1}))},30)},className:"flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-lg border bg-white text-gray-700 border-gray-200 hover:bg-gray-50 transition-colors",children:[r.jsx(K5,{
1684className:"w-3 h-3"}),"Export Report"]})})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"bg-indigo-50 rounded-xl p-3 text-center",children:[r.jsx("div",{className:"text-xl font-bold text-indigo-700",children:_}),r.jsx("div",{className:"text-[10px] text-indigo-500 font-medium uppercase tracking-wide",children:"Page Loads"})]}),r.jsxs("div",{className:"bg-violet-50 rounded-xl p-3 text-center",children:[r.jsx("div",{className:"text-xl font-bold text-violet-700",children:w.unique_users||0}),r.jsx("div",{className:"text-[10px] text-violet-500 font-medium uppercase tracking-wide",children:"Unique Visitors"})]}),r.jsxs("div",{className:"bg-emerald-50 rounded-xl p-3 text-center",children:[r.jsx("div",{className:"text-xl font-bold text-emerald-700",children:w.alltime_count||0}),r.jsx("div",{className:"text-[10px] text-emerald-500 font-medium uppercase tracking-wide",children:"Total All-time"})]})]}),_>0&&r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(p0,{title:"Location",rows:w.top_countries,total:_,renderLabel:N=>r.jsxs("span",{className:"flex items-center gap-1",children:[N!=="Unknown"&&r.jsx("img",{src:`https://flagcdn.com/16x12/${bFe(N)}.png`,alt:N,className:"inline-block",onError:C=>{C.target.style.display="none"}}),r.jsx("span",{children:N})]})}),r.jsx(p0,{title:"Browser",rows:w.top_browsers,total:_}),r.jsx(p0,{title:"OS",rows:w.top_os,total:_}),r.jsx(p0,{title:"Device",rows:w.top_devices,total:_,renderLabel:N=>r.jsx("span",{className:"capitalize",children:N})})]}),_>0&&y.length>0&&r.jsx(Zl,{width:"100%",height:140,children:r.jsxs(Od,{data:y,margin:{top:2,right:4,left:-24,bottom:0},children:[r.jsx(Qa,{dataKey:"date",tick:{fontSize:9},tickLine:!1,axisLine:!1}),r.jsx(Xa,{tick:{fontSize:9},tickLine:!1,axisLine:!1,allowDecimals:!1}),r.jsx(us,{contentStyle:{fontSize:11,borderRadius:8},formatter:N=>[N,"Loads"]}),r.jsx(Cs,{dataKey:"count",fill:"#6366f1",radius:[3,3,0,0],name:"Loads"})]})}),r.jsx(BA,{open:m.open,onClose:()=>g(N=>({...N,open:!1})),title:"Combined Page Views Report",filename:`pageviews_combined_${Qy()}.txt`,text:m.text,loading:m.loading})]})}const WY="pageviews_filter";function wFe(){try{return JSON.parse(localStorage.getItem(WY)||"{}")}catch{return{}}}function jFe(){var j;const e=wFe(),[t,n]=h.useState([]),[s,a]=h.useState(e.filterAssistantIds??[]),[i,o]=h.useState(e.showDetailed??!1),[l,c]=h.useState(0),[d,f]=h.useState(!1),m=h.useRef(null);h.useEffect(()=>{localStorage.setItem(WY,JSON.stringify({filterAssistantIds:s,showDetailed:i}))},[s,i]),h.useEffect(()=>{Y.entities.Assistant.list().then(n)},[]),h.useEffect(()=>{function b(y){m.current&&!m.current.contains(y.target)&&f(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]);const g=t.filter(b=>b.assistant_key),x=g.filter(b=>s.includes(b.id));return r.jsxs("div",{className:"p-6 w-full max-w-5xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-50 flex items-center justify-center",children:r.jsx(Ts,{className:"w-5 h-5 text-indigo-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Page Views"}),r.jsx("p",{className:"text-sm text-gray-500",children:"Analytics for public assistant landing pages"})]})]}),r.jsxs("div",{className:"flex gap-2 mb-6 flex-wrap items-center bg-white border border-gray-100 rounded-2xl px-4 py-3 shadow-sm",children:[r.jsx(Yp,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsxs("div",{className:"relative",ref:m,children:[r.jsxs("button",{onClick:()=>f(b=>!b),className:"flex items-center gap-1.5 border rounded-lg px-2 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400 min-w-[180px] max-w-[320px]",children:[r.jsx(Vn,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsx("span",{className:"flex-1 text-left truncate",children:s.length===0?"Select assistants…":s.length===1?((j=g.find(b=>b.id===s[0]))==null?void 0:j.name)||"1 assistant":`${s.length} assistants`}),r.jsx(gt,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"})]}),d&&r.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-200 rounded-xl shadow-lg z-50 py-1 min-w-[240px] max-h-80 overflow-y-auto",children:[r.jsxs("button",{onClick:()=>a([]),className:`w-full text-left px-3 py-2 text-sm flex items-center gap-2 hover:bg-gray-50 transition-colors ${s.length===0?"text-indigo-700 font-medium":"text-gray-600"}`,children:[r.jsx("span",{className:`w-4 h-4 rounded border flex items-center justify-center shrink-0 ${s.length===0?"bg-indigo-600 border-indigo-600":"border-gray-300"}`,children:s.length===0&&r.jsx(Tn,{className:"w-3 h-3 text-white"})}),"None selected"]}),r.jsx("div",{className:"border-t my-1"}),g.map(b=>{const y=s.includes(b.id);return r.jsxs("button",{onClick:()=>a(w=>y?w.filter(_=>_!==b.id):[...w,b.id]),className:"w-full text-left px-3 py-2 text-sm flex items-center gap-2 hover:bg-gray-50 transition-colors",children:[r.jsx("span",{className:`w-4 h-4 rounded border flex items-center justify-center shrink-0 ${y?"bg-indigo-600 border-indigo-600":"border-gray-300"}`,children:y&&r.jsx(Tn,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"truncate",children:b.name})]},b.id)})]})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.length>1&&r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 cursor-pointer select-none",children:[r.jsx("input",{type:"checkbox",checked:i,onChange:b=>o(b.target.checked),className:"w-3.5 h-3.5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-400"}),r.jsx(el,{className:"w-3.5 h-3.5 text-gray-400"}),"Per-assistant breakdown"]}),r.jsxs("button",{onClick:()=>c(b=>b+1),className:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-lg border bg-white text-gray-700 border-gray-200 hover:bg-gray-50 transition-colors",children:[r.jsx(Rn,{className:"w-3.5 h-3.5"}),"Reload"]})]})]}),s.length===0?r.jsx("div",{className:"text-sm text-gray-400 py-10 text-center",children:"Select one or more assistants above to view their page view stats."}):x.length===0?r.jsx("div",{className:"text-sm text-gray-400 py-10 text-center",children:"The selected assistants have no public landing page."}):r.jsxs("div",{className:"space-y-6",children:[x.length>1&&r.jsxs("div",{className:"border-2 border-indigo-200 rounded-2xl bg-gradient-to-br from-indigo-50/50 to-white p-5 shadow-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg bg-indigo-100 flex items-center justify-center",children:r.jsx(Sa,{className:"w-3.5 h-3.5 text-indigo-600"})}),r.jsxs("h2",{className:"font-semibold text-sm text-gray-800",children:["Combined — All Selected (",x.length,")"]})]}),r.jsx(vFe,{assistants:x},`c-${l}`)]}),(i||x.length===1)&&x.map(b=>r.jsxs("div",{className:"border rounded-2xl bg-white p-5 shadow-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg bg-indigo-50 flex items-center justify-center",children:r.jsx(Vn,{className:"w-3.5 h-3.5 text-indigo-600"})}),r.jsx("h2",{className:"font-semibold text-sm text-gray-800",children:b.name}),r.jsx("span",{className:"text-[11px] text-gray-400 font-mono",children:b.assistant_key})]}),r.jsx(SV,{assistant:b})]},`${b.id}-${l}`))]})]})}const GY="pvlogs_filters";function _Fe(e){var n;return{"United States":"us",Brazil:"br","United Kingdom":"gb",Canada:"ca",Australia:"au",Germany:"de",France:"fr",Spain:"es",Italy:"it",Netherlands:"nl",Portugal:"pt",Mexico:"mx",Argentina:"ar",India:"in",Japan:"jp",China:"cn",Israel:"il",Turkey:"tr",Russia:"ru",Sweden:"se",Switzerland:"ch"}[e]||((n=e==null?void 0:e.slice(0,2))==null?void 0:n.toLowerCase())||"xx"}function NFe(){try{return JSON.parse(localStorage.getItem(GY)||"{}")}catch{return{}}}
1684const rz=200;function SFe(e,t,n){const s=new Date;if(e==="today")return{from:uo(s).toISOString(),to:null};if(e==="yesterday"){const a=Mr(s,1);return{from:uo(a).toISOString(),to:LA(a).toISOString()}}return e==="7d"?{from:Mr(s,7).toISOString(),to:null}:e==="30d"?{from:Mr(s,30).toISOString(),to:null}:e==="90d"?{from:Mr(s,90).toISOString(),to:null}:e==="alltime"?{from:null,to:null}:e==="custom"?{from:t?new Date(t).toISOString():null,to:n?new Date(n).toISOString():null}:{from:Mr(s,30).toISOString(),to:null}}function kFe(){const e=NFe(),[t,n]=h.useState([]),[s,a]=h.useState(e.assistantId??""),[i,o]=h.useState(e.preset??"30d"),[l,c]=h.useState(e.customFrom??""),[d,f]=h.useState(e.customTo??""),[m,g]=h.useState(e.search??""),[x,j]=h.useState(e.filterIp??""),[b,y]=h.useState(e.filterOrg??""),[w,_]=h.useState(e.filterCountry??""),[N,C]=h.useState(e.filterBrowser??""),[k,S]=h.useState(e.filterDevice??""),[A,T]=h.useState(e.filterCaller??""),[R,B]=h.useState(e.filterEnriched??""),[D,P]=h.useState([]),[I,z]=h.useState(0),[L,H]=h.useState(0),[W,V]=h.useState(!1),[K,M]=h.useState(null),[G,q]=h.useState(!1),[F,U]=h.useState(null),[ee,ne]=h.useState(!1),[X,ie]=h.useState(!0),{ignoredIps:Z,addIp:ce,removeIp:le}=jv();h.useEffect(()=>{localStorage.setItem(GY,JSON.stringify({assistantId:s,preset:i,customFrom:l,customTo:d,search:m,filterIp:x,filterOrg:b,filterCountry:w,filterBrowser:N,filterDevice:k,filterCaller:A,filterEnriched:R}))},[s,i,l,d,m,x,b,w,N,k,A,R]),h.useEffect(()=>{Y.entities.Assistant.list().then(fe=>{const dt=fe.filter(ct=>ct.assistant_key);n(dt),!s&&dt.length>0&&a(dt[0].id)})},[]),t.find(fe=>fe.id===s);const[re,Ue]=h.useState(m),[Ne,Oe]=h.useState(x),[Me,ue]=h.useState(b),[Ve,Xe]=h.useState(w),[te,De]=h.useState(A);h.useEffect(()=>{const fe=setTimeout(()=>Ue(m),500);return()=>clearTimeout(fe)},[m]),h.useEffect(()=>{const fe=setTimeout(()=>Oe(x),500);return()=>clearTimeout(fe)},[x]),h.useEffect(()=>{const fe=setTimeout(()=>ue(b),500);return()=>clearTimeout(fe)},[b]),h.useEffect(()=>{const fe=setTimeout(()=>Xe(w),500);return()=>clearTimeout(fe)},[w]),h.useEffect(()=>{const fe=setTimeout(()=>De(A),500);return()=>clearTimeout(fe)},[A]);const _e=h.useCallback((fe=0)=>{if(!s)return;V(!0);const{from:dt,to:ct}=SFe(i,l,d);Y.functions.invoke("getPageViewStats",{assistant_id:s,date_from:dt,date_to:ct,logs_limit:rz,logs_offset:fe,ip_top_n:1,excluded_ips:X?[...Z]:[],filter_ip:Ne||void 0,filter_org:Me||void 0,filter_country:Ve||void 0,filter_browser:N||void 0,filter_device:k||void 0,filter_caller:te||void 0,filter_search:re||void 0,filter_enriched:R||void 0}).then(Wt=>{const bt=Wt.data;z(bt.logs_total||0),P(sn=>fe>0?[...sn,...bt.logs||[]]:bt.logs||[]),V(!1)}).catch(()=>V(!1))},[s,i,l,d,Z,X,Ne,Me,Ve,te,re,N,k,R]),We=[...Z].sort().join(",");h.useEffect(()=>{H(0),P([]),_e(0)},[s,i,l,d,We,X,Ne,Me,Ve,te,re,N,k,R]);const tt=D.filter(fe=>fe.ip_address&&!fe.org&&!fe.country).length,me=D;async function ae(fe){M(fe),await Y.entities.AssistantPageView.delete(fe),P(dt=>dt.filter(ct=>ct.id!==fe)),z(dt=>dt-1),M(null)}async function Se(){if(s){q(!0),U({done:0,total:"?"});try{const fe=await Y.functions.invoke("enrichPageViewIps",{assistant_id:s});U(fe.data),H(0),_e(0)}catch(fe){U({error:fe.message})}q(!1)}}function Le(){g(""),j(""),y(""),_(""),C(""),S(""),T(""),B("")}const He=m||x||b||w||N||k||A||R,ut=D.length<I,ze=[{key:"today",label:"Today"},{key:"yesterday",label:"Yesterday"},{key:"7d",label:"7d"},{key:"30d",label:"30d"},{key:"90d",label:"90d"},{key:"alltime",label:"All time"},{key:"custom",label:"Custom"}];return r.jsxs("div",{className:"p-6 w-full max-w-7xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[r.jsx(wt,{to:yt("PageViews"),className:"text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx(or,{className:"w-4 h-4"})}),r.jsx("div",{className:"w-9 h-9 rounded-xl bg-indigo-50 flex items-center justify-center",children:r.jsx(Bm,{className:"w-4 h-4 text-indigo-600"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Page View Logs"}),r.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[r.jsxs("p",{className:"text-sm text-gray-500",children:[I.toLocaleStr
1684ing()," total records"]}),tt>0&&r.jsxs("button",{onClick:()=>B(fe=>fe==="not_enriched"?"":"not_enriched"),title:"Filter to not-enriched IPs",className:`flex items-center gap-1 px-2 py-0.5 text-[11px] font-medium rounded-full border transition-colors ${R==="not_enriched"?"bg-amber-500 text-white border-amber-500":"bg-amber-50 text-amber-700 border-amber-200 hover:bg-amber-100"}`,children:["⚠ ",tt," not enriched"]})]})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[Z.size>0&&r.jsxs("button",{onClick:()=>ie(fe=>!fe),title:X?"Show ignored IPs":"Hide ignored IPs",className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border transition-colors ${X?"bg-orange-500 text-white border-orange-500":"bg-white text-orange-600 border-orange-200 hover:bg-orange-50"}`,children:[r.jsx($h,{className:"w-3 h-3"}),X?`Filtering ${Z.size} IPs`:`Show all (${Z.size} ignored)`]}),r.jsxs("button",{onClick:()=>ne(!0),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border bg-white text-orange-600 border-orange-200 hover:bg-orange-50 transition-colors",children:[r.jsx($h,{className:"w-3 h-3"}),"Ignore List ",Z.size>0&&r.jsx("span",{className:"bg-orange-100 text-orange-700 rounded-full px-1.5 py-0.5 text-[10px] font-bold",children:Z.size})]}),r.jsxs("button",{onClick:Se,disabled:G||!s,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg border bg-white text-indigo-600 border-indigo-200 hover:bg-indigo-50 disabled:opacity-50 transition-colors",children:[r.jsx(Rn,{className:`w-3 h-3 ${G?"animate-spin":""}`}),G?"Enriching IPs…":"Enrich IPs"]})]})]}),F&&r.jsx("div",{className:`text-xs px-3 py-2 rounded-lg border mb-4 ${F.error?"bg-red-50 border-red-200 text-red-600":"bg-emerald-50 border-emerald-200 text-emerald-700"}`,children:F.error?`Enrich failed: ${F.error}`:`Enriched ${F.enriched} records, skipped ${F.skipped} (${F.total_checked} checked).`}),r.jsxs("div",{className:"bg-white border border-gray-100 rounded-2xl px-4 py-3 shadow-sm mb-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2 flex-wrap items-center",children:[r.jsx(Yp,{className:"w-3.5 h-3.5 text-gray-400 shrink-0"}),r.jsxs("select",{value:s,onChange:fe=>a(fe.target.value),className:"border rounded-lg px-2 py-1.5 text-sm bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:"Select assistant…"}),t.map(fe=>r.jsx("option",{value:fe.id,children:fe.name},fe.id))]}),r.jsx("div",{className:"flex gap-1 flex-wrap",children:ze.map(fe=>r.jsx("button",{onClick:()=>o(fe.key),className:`px-2.5 py-1 text-xs font-medium rounded-lg border transition-colors ${i===fe.key?"bg-indigo-600 text-white border-indigo-600":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300"}`,children:fe.label},fe.key))}),i==="custom"&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx("input",{type:"date",value:l,onChange:fe=>c(fe.target.value),className:"border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("span",{className:"text-gray-400",children:"→"}),r.jsx("input",{type:"date",value:d,onChange:fe=>f(fe.target.value),className:"border rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-400"})]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap items-center",children:[r.jsx("input",{value:m,onChange:fe=>
1684g(fe.target.value),placeholder:"Search URL / IP / org…",className:"border rounded-lg px-2 py-1.5 text-xs w-48 focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("input",{value:x,onChange:fe=>j(fe.target.value),placeholder:"IP contains…",className:"border rounded-lg px-2 py-1.5 text-xs w-36 focus:outline-none focus:ring-1 focus:ring-indigo-400 font-mono"}),r.jsx("input",{value:b,onChange:fe=>y(fe.target.value),placeholder:"Org / ISP…",className:"border rounded-lg px-2 py-1.5 text-xs w-36 focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("input",{value:w,onChange:fe=>_(fe.target.value),placeholder:"Country…",className:"border rounded-lg px-2 py-1.5 text-xs w-28 focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsx("input",{value:A,onChange:fe=>T(fe.target.value),placeholder:"Caller page…",className:"border rounded-lg px-2 py-1.5 text-xs w-36 focus:outline-none focus:ring-1 focus:ring-indigo-400"}),r.jsxs("select",{value:N,onChange:fe=>C(fe.target.value),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:"All browsers"}),["Chrome","Firefox","Safari","Edge","Opera","IE","Other"].map(fe=>r.jsx("option",{children:fe},fe))]}),r.jsxs("select",{value:k,onChange:fe=>S(fe.target.value),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:"All devices"}),["desktop","mobile","tablet"].map(fe=>r.jsx("option",{value:fe,className:"capitalize",children:fe},fe))]}),r.jsxs("select",{value:R,onChange:fe=>B(fe.target.value),className:"border rounded-lg px-2 py-1.5 text-xs bg-white focus:outline-none focus:ring-1 focus:ring-indigo-400",children:[r.jsx("option",{value:"",children:"All IPs"}),r.jsx("option",{value:"enriched",children:"Enriched only"}),r.jsx("option",{value:"not_enriched",children:"Not enriched only"})]}),He&&r.jsxs("button",{onClick:Le,className:"flex items-center gap-1 px-2 py-1.5 text-xs text-orange-600 bg-orange-50 border border-orange-200 rounded-lg hover:bg-orange-100 transition-colors",children:[r.jsx(jt,{className:"w-3 h-3"})," Clear filters"]}),r.jsx("span",{className:"text-xs text-gray-400 ml-auto",children:He?`${me.length} / ${D.length} loaded`:`${D.length} / ${I} loaded`})]})]}),r.jsx("div",{className:"bg-white border rounded-2xl overflow-hidden shadow-sm",children:W&&D.length===0?r.jsx("div",{className:"py-10 text-center text-xs text-gray-400",children:"Loading…"}):r.jsxs("div",{className:"overflow-x-auto",children:[r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b bg-gray-50",children:[r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium whitespace-nowrap",children:"Date / Time"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium whitespace-nowrap",children:"Visitor"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium whitespace-nowrap",children:"Location"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium whitespace-nowrap",children:"Client"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium whitespace-nowrap",children:"Pages"}),r.jsx("th",{className:"text-left px-3 py-2 text-gray-500 font-medium whitespace-nowrap",children:"WP / User"}),r.jsx("th",{className:"px-3 py-2"})]})}),r.jsxs("tbody",{children:[me.map((fe,dt)=>r.jsxs("tr",{className:"border-b last:border-0 hover:bg-gray-50",children:[r.jsx("td",{className:"px-3 py-2 text-gray-700 whitespace-nowrap",children:fe.viewed_at?gs(new Date(fe.viewed_at),"MMM d, HH:mm"):"—"}),r.jsxs("td",{className:"px-3 py-2 min-w-[150px] max-w-[190px] align-top",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"text-gray-500 font-mono text-[10px]",children:fe.ip_address||"—"}),fe.ip_address&&r.jsx($A,{ip:fe.ip_address,ignoredIps:Z,addIp:ce,removeIp:le})]}),fe.org&&r.jsx("div",{className:"text-[10px] text-gray-400 truncate mt-0.5",title:fe.org,children:fe.org})]}),r.jsx("td",{className:"px-3 py-2 whitespace-nowrap align-top",children:fe.country||fe.city?r.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-gray-600",children:[fe.country&&r.jsx("img",{src:`https://flagcdn.com/16x12/${_Fe(fe.country)}.png`,alt:fe.country,className:"inline-block",onError:ct=>{ct.target.style.display="none"}}
1684),r.jsx("span",{children:[fe.city,fe.country].filter(Boolean).join(", ")})]}):r.jsx("span",{className:"text-gray-300 text-[11px]",children:"—"})}),r.jsxs("td",{className:"px-3 py-2 whitespace-nowrap align-top",children:[r.jsx("div",{className:"text-[11px] text-gray-600",children:[fe.browser,fe.os].filter(Boolean).join(" / ")||"—"}),r.jsx("div",{className:"text-[10px] text-gray-400 capitalize mt-0.5",children:[fe.device,fe.language].filter(Boolean).join(" · ")})]}),r.jsxs("td",{className:"px-3 py-2 min-w-[200px] max-w-[260px] align-top",children:[fe.current_url?r.jsx("a",{href:fe.current_url,target:"_blank",rel:"noopener noreferrer",title:fe.current_url,className:"block text-[10px] text-indigo-600 hover:underline truncate",children:(()=>{try{const ct=new URL(fe.current_url);return ct.pathname+(ct.search||"")}catch{return fe.current_url}})()}):null,fe.referrer?r.jsxs("a",{href:fe.referrer,target:"_blank",rel:"noopener noreferrer",title:fe.referrer,className:"block text-[10px] text-gray-400 hover:underline truncate mt-0.5",children:["↩ ",(()=>{try{const ct=new URL(fe.referrer);return ct.hostname+ct.pathname}catch{return fe.referrer}})()]}):null,!fe.current_url&&!fe.referrer&&r.jsx("span",{className:"text-gray-300 text-[10px]",children:"—"})]}),r.jsx("td",{className:"px-3 py-2 min-w-[150px] max-w-[210px] align-top",children:r.jsxs("div",{className:"space-y-0.5",children:[fe.wp_user_email?r.jsxs("div",{className:"text-[10px] text-emerald-700 truncate",title:fe.wp_user_email,children:["👤 ",fe.wp_user_email]}):fe.wp_user_id?r.jsxs("div",{className:"text-[10px] text-emerald-600 font-mono",children:["👤 ID: ",fe.wp_user_id]}):r.jsx("div",{className:"text-[10px] text-gray-300 italic",children:"not identified"}),fe.page_url?r.jsx("a",{href:fe.page_url,target:"_blank",rel:"noopener noreferrer",title:fe.page_url,className:"block text-[10px] text-indigo-500 hover:underline truncate",children:(()=>{try{return new URL(fe.page_url).pathname}catch{return fe.page_url}})()}):r.jsx("div",{className:"text-[10px] text-gray-300 italic",children:"no page_url"}),fe.gated_cookie?r.jsxs("div",{className:"text-[10px] text-purple-600",children:["🔒 ",fe.gated_cookie]}):r.jsx("div",{className:"text-[10px] text-gray-300 italic",children:"no gated cookie"}),fe.guide_cookie?r.jsxs("div",{className:"text-[10px] text-blue-600",children:["📘 ",fe.guide_cookie]}):r.jsx("div",{className:"text-[10px] text-gray-300 italic",children:"no guide cookie"})]})}),r.jsx("td",{className:"px-3 py-2 align-top",children:r.jsx("button",{onClick:()=>ae(fe.id),disabled:K===fe.id,className:"text-gray-300 hover:text-red-500 transition-colors disabled:opacity-40",title:"Delete",children:r.jsx(un,{className:"w-3.5 h-3.5"})})})]},fe.id||dt)),me.length===0&&!W&&r.jsx("tr",{children:r.jsx("td",{colSpan:7,className:"px-3 py-10 text-center text-gray-400",children:"No records match your filters."})})]})]}),ut&&r.jsx("div",{className:"px-3 py-3 border-t text-center",children:r.jsx("button",{onClick:()=>{const fe=L+rz;H(fe),_e(fe)},disabled:W,className:"text-xs text-indigo-600 hover:underline disabled:opacity-50",children:W?"Loading…":`Load more (${I-D.length} remaining)`})})]})}),ee&&r.jsx(jV,{onClose:()=>ne(!1)})]})}function YY(e,t){if(!t||!t.length)return{html:e,applied:0,skipped:0};const s=new DOMParser().parseFromString(e,"text/html");let a=0,i=0;for(const l of t){if(!l||!l.selector||!l.action){i++;continue}let c;try{c=s.querySelectorAll(l.selector)}catch{i++;continue}if(!c.length){i++;continue}for(const d of c)switch(l.action){case"remove":d.remove(),a++;break;case"replace_html":d.innerHTML=l.html||"",a++;break;case"set_text":d.textContent=l.text||"",a++;break;case"insert_before":d.insertAdjacentHTML("beforebegin",l.html||""),a++;break;case"insert_after":d.insertAdjacentHTML("afterend",l.html||""),a++;break;case"append_html":d.insertAdjacentHTML("beforeend",l.html||""),a++;break;case"prepend_html":d.insertAdjacentHTML("afterbegin",l.html||""),a++;break;case"set_attribute":l.attribute?(d.setAttribute(l.attribute,l.value||""),a++):i++;break;case"remove_attribute":l.attribute?(d.removeAttribute(l.attribute),a++):i++;break;case"add_class":l.class?(d.classList.add(l.class),a++):i++;break;case"remove_class":l.class?(d.classList.remove(l.class),a++):i++;break;default:i++;break}}return{html:(s.doctype?`<!DOCTYPE ${s.doctype.name}>
1685`:"")+s.documentElement.outerHTML,applied:a,skipped:i}}function CFe({getHtml:e,onHtmlChange:t}){const[n,s]=h.useState(""),[a,i]=h.useState(!1),[o,l]=h.useState(""),[c,d]=h.useState(""),f=typeof e=="function"?e():"",m=!!(f&&f.trim());async function g(){if(!(!n.trim()||a)){i(!0),l(""),d("");try{const x=typeof e=="function"&&e()||"",j=!!(x&&x.trim());let b;if(j){const y=`You are an HTML editor. Apply the instruction to the HTML document below.
1686Return a JSON object with an "operations" array. Each operation targets elements via a CSS "selector" and performs an "action":
1687- remove: delete the element
1688- replace_html: set its innerHTML to "html"
1689- set_text: set its textContent to "text"
1690- insert_before / insert_after: insert "html" before/after the element
1691- append_html / prepend_html: insert "html" at the end/beginning inside the element
1692- set_attribute: set "attribute" to "value"
1693- remove_attribute: remove "attribute"
1694- add_class / remove_class: add/remove "class"
1695
1696Use precise CSS selectors that exist in the document. Include only the properties each action needs. Return ONLY the JSON, no explanation.
1697
1698Instruction: ${n}
1699
1700HTML:
1701${x}`,w=await Y.integrations.Core.InvokeLLM({prompt:y,response_json_schema:{type:"object",properties:{operations:{type:"array",items:{type:"object",properties:{selector:{type:"string"},action:{type:"string"},html:{type:"string"},text:{type:"string"},attribute:{type:"string"},value:{type:"string"},class:{type:"string"}},required:["selector","action"]}}},required:["operations"]}}),_=Array.isArray(w==null?void 0:w.operations)?w.operations:[];if(!_.length){l("AI returned no operations. Try rephrasing the instruction.");return}const{html:N,applied:C,skipped:k}=YY(x,_);if(C===0){d("No elements matched the AI's selectors — try being more specific in your instruction.");return}b=N,k>0&&d(`${C} change(s) applied, ${k} skipped.`)}else{const y=`Generate a complete, standalone HTML document based on this instruction. Include full <!DOCTYPE html>, <html>, <head> with appropriate meta tags and inline CSS styles, and <body>. Make it modern and visually appealing. Return ONLY the HTML code, no explanation.
1702
1703Instruction: ${n}`,w=await Y.integrations.Core.InvokeLLM({prompt:y,response_json_schema:{type:"object",properties:{html:{type:"string"}},required:["html"]}});if(b=((w==null?void 0:w.html)||"").trim(),!b){l("AI returned empty content. Try rephrasing the instruction.");return}}t(b),s("")}catch(x){l(x.message)}finally{i(!1)}}}return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-indigo-700",children:[r.jsx(Yn,{className:"w-4 h-4"})," AI Assist"]}),o&&r.jsx("p",{className:"text-xs text-red-500",children:o}),c&&!o&&r.jsx("p",{className:"text-xs text-amber-600",children:c}),r.jsx("textarea",{value:n,onChange:x=>s(x.target.value),placeholder:m?"e.g. remove the blue header, make the button red...":"Describe the page you want to create...",rows:3,className:"w-full text-sm border border-gray-200 rounded-lg p-2 focus:ring-2 focus:ring-indigo-400 focus:outline-none resize-y"}),r.jsx("button",{onClick:g,disabled:a||!n.trim(),className:"w-full flex items-center justify-center gap-2 text-sm bg-indigo-600 text-white px-3 py-2 rounded-lg hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:a?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," ",m?"Refining…":"Generating…"]}):r.jsxs(r.Fragment,{children:[r.jsx(Yn,{className:"w-4 h-4"})," ",m?"Refine HTML":"Generate HTML"]})})]})}function EFe({onHtmlChange:e}){const[t,n]=h.useState(""),[s,a]=h.useState(!1),[i,o]=h.useState("");async function l(){if(!(!t.trim()||s)){a(!0),o("");try{const c=await Y.functions.invoke("cloneUrl",{url:t}),d=c.data||c;if(d.error){o(d.error);return}e(d.html||"")}catch(c){o(c.message)}finally{a(!1)}}}return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-indigo-700",children:[r.jsx(Na,{className:"w-4 h-4"})," Clone from URL"]}),i&&r.jsx("p",{className:"text-xs text-red-500",children:i}),r.jsx("input",{type:"url",value:t,onChange:c=>n(c.target.value),onKeyDown:c=>c.key==="Enter"&&l(),placeholder:"https://example.com/page",className:"w-full text-sm border border-gray-200 rounded-lg px-2 py-1.5 focus:ring-2 focus:ring-indigo-400 focus:outline-none"}),r.jsx("button",{onClick:l,disabled:s||!t.trim(),className:"w-full flex items-center justify-center gap-2 text-sm bg-sky-600 text-white px-3 py-2 rounded-lg hover:bg-sky-700 disabled:opacity-50 transition-colors",children:s?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," Fetching…"]}):r.jsxs(r.Fragment,{children:[r.jsx(ri,{className:"w-4 h-4"})," Clone Page"]})})]})}function AFe({getHtml:e,onHtmlChange:t}){const[n,s]=h.useState([]),[a,i]=h.useState(""),[o,l]=h.useState(!0),[c,d]=h.useState(""),[f,m]=h.useState(!1),[g,x]=h.useState(""),[j,b]=h.useState("");h.useEffect(()=>{Y.entities.Assistant.list("-updated_date",100).then(N=>s(N.filter(C=>C.assistant_key))).catch(()=>{}).finally(()=>l(!1))},[]);function y(N){const C=N.embed_page_type==="learning"?`/LearningAssistant/v2/${N.assistant_key}`:`/assistant/${N.assistant_key}`;return`${window.location.origin}${C}`}async function w(){const N=n.find(C=>C.id===a);if(N){m(!0),x(""),b("");try{const C=y(N),k=typeof e=="function"&&e()||"",S=c.trim()||"floating chat bubble fixed at bottom-right corner",A=`You are an HTML editor. Embed an assistant chat into the existing HTML document below, and adjust the page layout as the user requests.
1704
1705Assistant name: ${N.name}
1706Embed URL: ${C}
1707
1708How the user wants it embedded: ${S}
1709
1710Return a JSON object with an "operations" array. Each operation targets elements via a CSS "
1710selector" and performs an "action":
1711- remove: delete the element
1712- replace_html: set its innerHTML to "html"
1713- set_text: set its textContent to "text"
1714- insert_before / insert_after: insert "html" before/after the element
1715- append_html / prepend_html: insert "html" at the end/beginning inside the element
1716- set_attribute: set "attribute" to "value"
1717- remove_attribute: remove "attribute"
1718- add_class / remove_class: add/remove "class"
1719
1720Rules:
1721- Use precise CSS selectors that exist in the document.
1722- To embed the assistant, insert an <iframe src="${C}" ...> using the appropriate action (usually append_html on <body>, or insert_before/insert_after on a specific element).
1723- Adjust the existing layout as the user requested: add wrapper containers, change classes, restructure sections, etc. Use multiple operations if needed.
1724- Include allow="clipboard-read; clipboard-write" and a meaningful title attribute on the iframe.
1725- If the user asks for a toggle/bubble behavior, include the minimal inline <script> needed to show/hide the iframe inside the inserted "html".
1726- Include only the properties each action needs. Return ONLY the JSON, no explanation.
1727
1728HTML:
1729${k}`,T=await Y.integrations.Core.InvokeLLM({prompt:A,response_json_schema:{type:"object",properties:{operations:{type:"array",items:{type:"object",properties:{selector:{type:"string"},action:{type:"string"},html:{type:"string"},text:{type:"string"},attribute:{type:"string"},value:{type:"string"},class:{type:"string"}},required:["selector","action"]}}},required:["operations"]}}),R=Array.isArray(T==null?void 0:T.operations)?T.operations:[];if(!R.length){x("AI returned no operations. Try rephrasing the instruction.");return}const{html:B,applied:D,skipped:P}=YY(k,R);if(D===0){b("No elements matched the AI's selectors — try being more specific in your instruction.");return}t(B),P>0&&b(`${D} change(s) applied, ${P} skipped.`),i(""),d("")}catch(C){x(C.message)}finally{m(!1)}}}const _=n.find(N=>N.id===a);return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-indigo-700",children:[r.jsx(Vn,{className:"w-4 h-4"})," Embed Assistant"]}),o?r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400",children:[r.jsx(Pe,{className:"w-3 h-3 animate-spin"})," Loading assistants…"]}):n.length===0?r.jsx("p",{className:"text-xs text-gray-400",children:"No assistants with an assistant key found."}):r.jsxs(r.Fragment,{children:[r.jsxs("select",{value:a,onChange:N=>i(N.target.value),className:"w-full text-sm border border-gray-200 rounded-lg px-2 py-1.5 focus:ring-2 focus:ring-indigo-400 focus:outline-none bg-white",children:[r.jsx("option",{value:"",children:"Select an assistant…"}),n.map(N=>r.jsx("option",{value:N.id,children:N.name},N.id))]}),_&&r.jsx("p",{className:"text-xs text-gray-400 font-mono break-all bg-gray-50 rounded p-1.5",children:y(_)}),r.jsx("textarea",{value:c,onChange:N=>d(N.target.value),placeholder:"Describe how to embed it and adjust the page (e.g. floating bubble bottom-right, sidebar on the left with content shifted right, full-width banner at top)…",rows:3,className:"w-full text-sm border border-gray-200 rounded-lg p-2 focus:ring-2 focus:ring-indigo-400 focus:outline-none resize-y"}),g&&r.jsx("p",{className:"text-xs text-red-500",children:g}),j&&!g&&r.jsx("p",{className:"text-xs text-amber-600",children:j}),r.jsx("button",{onClick:w,disabled:!a||f,className:"w-full flex items-center justify-center gap-2 text-sm bg-emerald-600 text-white px-3 py-2 rounded-lg hover:bg-emerald-700 disabled:opacity-50 transition-colors",children:f?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," Generating…"]}):r.jsxs(r.Fragment,{children:[r.jsx(Yn,{className:"w-4 h-4"})," Generate & Insert Embed"]})})]})]})}function Wk(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}const sz="allow-same-origin allow-scripts allow-forms allow-popups allow-modals allow-downloads";function TFe({page:e,allPages:t,onSave:n,onBack:s}){const[a,i]=h.useState((e==null?void 0:e.title)||""),[o,l]=h.useState((e==null?void 0:e.slug)||""),[c,d]=h.useState((e==null?void 0:e.description)||""),[f,m]=h.useState((e==null?void 0:e.html_content)||""),[g,x]=h.useState(!!(e!=null&&e.html_file_url)),[j,b]=h.useState("visual"),[y,w]=h.useState(!(e!=null&&e.id)),[_,N]=h.useState(!1),[C,k]=h.useState(300),[S,A]=h.useState(""),T=h.useRef(null),[R,B]=h.useState(typeof window<"u"?window.innerHeight:800);h.useEffect(()=>{const F=()=>B(window.innerHeight);return window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[]);const D=h.useCallback(()=>Math.round((R-75)*(C/100)),[R,C]);h.useEffect(()=>{e!=null&&e.html_file_url&&(x(!0),fetch(e.html_file_url).then(F=>F.text()).then(F=>{m(F),x(!1)}).catch(()=>x(!1)))},[e==null?void 0:e.id]);function P(F){i(F),e!=null&&e.id||l(Wk(F))}function I(F){const U=t.filter(ne=>ne.id!==(e==null?void 0:e.id));if(!U.some(ne=>ne.slug===F))return F;let ee=2;for(;U.some(ne=>ne.slug===`${F}-${ee}`);)ee++;return`${F}-${ee}`}function z(){if(j==="visual"&&T.current)try{const F=T.current.contentDocument;if(F&&F.documentElement)return(F.doctype?`<!DOCTYPE ${F.doctype.name}>`:"")+F.documentElement.outerHTML}catch{}return f}
1729function L(F){if(j==="visual"&&F!=="visual"){const U=z();U&&U!==f&&m(U)}b(F)}function H(){var F;try{const U=(F=T.current)==null?void 0:F.contentDocument;U&&(U.designMode="on")}catch{}}function W(F,U){var ee,ne;try{const X=(ee=T.current)==null?void 0:ee.contentWindow,ie=(ne=T.current)==null?void 0:ne.contentDocument;if(!X||!ie)return;X.focus(),ie.execCommand(F,!1,U)}catch{}}function V(){const F=prompt("Enter URL:");F&&W("createLink",F)}function K(){const F=prompt("Enter image URL:");F&&W("insertImage",F)}async function M(){if(!a.trim()||!o.trim()){A("Title and slug are required");return}N(!0),A("");try{const F=z(),U=I(Wk(o));let ee=e==null?void 0:e.html_file_url;if(F.trim()){const ie=new File([F],`${U}.html`,{type:"text/html"}),Z=await Y.integrations.Core.UploadFile({file:ie});ee=(Z.data||Z).file_url}const ne={title:a,slug:U,description:c,html_file_url:ee},X=e!=null&&e.id?await Y.entities.EmbeddingTestPage.update(e.id,ne):await Y.entities.EmbeddingTestPage.create(ne);n(X)}catch(F){A(F.message)}finally{N(!1)}}const G=`${window.location.origin}/testpage/${Wk(o)}`;function q(F,U,ee){return r.jsx("button",{onClick:F,title:ee,className:"p-1.5 rounded text-gray-600 hover:bg-gray-200 hover:text-indigo-600 transition-colors shrink-0",children:r.jsx(U,{className:"w-4 h-4"})},ee)}return r.jsxs("div",{className:"flex flex-col h-[calc(100vh-75px)]",children:[r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b bg-white shrink-0",children:[r.jsxs("button",{onClick:s,className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-indigo-600 transition-colors shrink-0",children:[r.jsx(or,{className:"w-4 h-4"})," Back"]}),r.jsx("input",{value:a,onChange:F=>P(F.target.value),placeholder:"Test page title",className:"flex-1 min-w-0 text-sm font-medium border border-gray-200 rounded-lg px-3 py-1.5 focus:ring-2 focus:ring-indigo-400 focus:outline-none"}),r.jsx("button",{onClick:M,disabled:_||!a.trim(),className:"flex items-center gap-1.5 text-sm bg-indigo-600 text-white px-4 py-1.5 rounded-lg hover:bg-indigo-700 disabled:opacity-50 transition-colors shrink-0",children:_?r.jsxs(r.Fragment,{children:[r.jsx(Pe,{className:"w-4 h-4 animate-spin"})," Saving…"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ar,{className:"w-4 h-4"})," Save"]})}),r.jsxs("a",{href:G,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-sm text-indigo-600 border border-indigo-200 px-3 py-1.5 rounded-lg hover:bg-indigo-50 transition-colors shrink-0",children:[r.jsx(yr,{className:"w-4 h-4"})," Open"]})]}),S&&r.jsx("div",{className:"px-4 py-2 bg-red-50 text-red-600 text-xs border-b",children:S}),r.jsxs("div",{className:"border-b bg-gray-50 shrink-0",children:[r.jsxs("button",{onClick:()=>w(F=>!F),className:"w-full flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-600 hover:text-indigo-600 transition-colors",children:[r.jsx(gt,{className:`w-4 h-4 transition-transform ${y?"rotate-180":""}`}),"Tools",r.jsxs("span",{className:"flex items-center gap-1 ml-2 text-xs text-gray-400",children:[r.jsx(Yn,{className:"w-3 h-3"})," AI",r.jsx("span",{className:"text-gray-300",children:"·"}),r.jsx(Na,{className:"w-3 h-3"})," Clone",r.jsx("span",{className:"text-gray-300",children:"·"}),r.jsx(Vn,{className:"w-3 h-3"})," Embed"]})]}),y&&r.jsxs("div",{className:"px-4 pb-3 flex flex-col md:flex-row gap-3",children:[r.jsx("div",{className:"flex-1 bg-white border border-gray-200 rounded-lg p-3 min-w-0",children:r.jsx(CFe,{getHtml:z,onHtmlChange:m})}),r.jsx("div",{className:"flex-1 bg-white border border-gray-200 rounded-lg p-3 min-w-0",children:r.jsx(EFe,{onHtmlChange:m})}),r.jsx("div",{className:"flex-1 bg-white border border-gray-200 rounded-lg p-3 min-w-0",children:r.jsx(AFe,{getHtml:z,onHtmlChange:m})})]})]}),r.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b bg-white shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-sm shrink-0",children:[r.jsx("span",{className:"text-gray-400",children:"/testpage/"}),r.jsx("input",{value:o,onChange:F=>l(F.target.value),placeholder:"slug",className:"text-sm border border-gray-200 rounded px-2 py-1 
1729w-40 focus:ring-1 focus:ring-indigo-400 focus:outline-none"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 shrink-0 ml-auto",children:[r.jsx("span",{children:"Height"}),r.jsx("input",{type:"range",min:"100",max:"500",step:"50",value:C,onChange:F=>k(Number(F.target.value)),className:"w-24 accent-indigo-600"}),r.jsxs("span",{className:"w-10 tabular-nums",children:[C,"%"]})]}),r.jsxs("div",{className:"flex items-center gap-0.5 bg-gray-100 rounded-lg p-0.5",children:[r.jsxs("button",{onClick:()=>L("visual"),className:`flex items-center gap-1 px-3 py-1 text-xs rounded-md transition-all ${j==="visual"?"bg-white text-indigo-600 shadow-sm font-medium":"text-gray-500"}`,children:[r.jsx(ra,{className:"w-3 h-3"})," Visual"]}),r.jsxs("button",{onClick:()=>L("code"),className:`flex items-center gap-1 px-3 py-1 text-xs rounded-md transition-all ${j==="code"?"bg-white text-indigo-600 shadow-sm font-medium":"text-gray-500"}`,children:[r.jsx(LZ,{className:"w-3 h-3"})," Code"]}),r.jsxs("button",{onClick:()=>L("preview"),className:`flex items-center gap-1 px-3 py-1 text-xs rounded-md transition-all ${j==="preview"?"bg-white text-indigo-600 shadow-sm font-medium":"text-gray-500"}`,children:[r.jsx(Ts,{className:"w-3 h-3"})," Preview"]})]})]}),j==="visual"&&!g&&r.jsxs("div",{className:"flex items-center gap-0.5 px-4 py-1.5 border-b bg-gray-50 shrink-0 overflow-x-auto",children:[q(()=>W("bold"),Wz,"Bold"),q(()=>W("italic"),Zz,"Italic"),q(()=>W("underline"),Hte,"Underline"),r.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1 shrink-0"}),q(()=>W("formatBlock","<h1>"),hee,"Heading 1"),q(()=>W("formatBlock","<h2>"),gee,"Heading 2"),q(()=>W("formatBlock","<h3>"),yee,"Heading 3"),q(()=>W("formatBlock","<p>"),ra,"Paragraph"),r.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1 shrink-0"}),q(()=>W("insertUnorderedList"),Bm,"Bullet list"),q(()=>W("insertOrderedList"),Iee,"Numbered list"),r.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1 shrink-0"}),q(()=>W("justifyLeft"),qX,"Align left"),q(()=>W("justifyCenter"),zX,"Align center"),q(()=>W("justifyRight"),VX,"Align right"),r.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1 shrink-0"}),q(V,Qp,"Insert link"),q(K,Xz,"Insert image"),q(()=>W("removeFormat"),UZ,"Clear formatting")]}),r.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-white",children:g?r.jsxs("div",{className:"flex items-center justify-center text-gray-400 text-sm gap-2 py-20",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin"})," Loading content…"]}):r.jsxs(r.Fragment,{children:[j==="visual"&&r.jsx("iframe",{ref:T,srcDoc:f||"<!DOCTYPE html><html><head></head><body></body></html>",onLoad:H,style:{height:`${D()}px`,width:"100%"},className:"border-0",sandbox:sz,title:"Visual Editor"},"visual"),j==="code"&&r.jsx("textarea",{value:f,onChange:F=>m(F.target.value),spellCheck:!1,style:{height:`${D()}px`,width:"100%"},className:"text-xs font-mono border-0 p-3 focus:outline-none resize-none bg-gray-900 text-green-100",placeholder:"<!DOCTYPE html>..."}),j==="preview"&&r.jsx("iframe",{srcDoc:f,title:"Preview",style:{height:`${D()}px`,width:"100%"},className:"border-0",sandbox:sz},"preview")]})})]})}function PFe(){const[e]=FU(),t=e.get("id"),n=Ca(),[s,a]=h.useState(null),[i,o]=h.useState([]),[l,c]=h.useState(!0);h.useEffect(()=>{Y.entities.EmbeddingTestPage.list("-updated_date",100).then(m=>{if(o(m),t){const g=m.find(x=>x.id===t);a(g||{})}else a({})}).catch(()=>a({})).finally(()=>c(!1))},[t]);function d(){n("/EmbeddingTests")}function f(m){a(m),!t&&m.id&&n(`/EmbeddingTestEdit?id=${m.id}`,{replace:!0})}return l||!s?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"w-8 h-8 border-4 border-slate-200 border-t-indigo-600 rounded-full animate-spin"})}):r.jsx(TFe,{page:s,allPages:i,onSave:f,onBack:d},s.id||"new")}const OFe="allow-same-origin allow-scripts allow-forms allow-popups allow-modals allow-downloads";function IFe(){const e=window.location.pathname.match(/\/testpage\/([^/?#]+)/),t=e?decodeURIComponent(e[1]):null,[n,s]=h.useState(""),[a,i]=h.useState(!0),[o,l]=h.useState(""),[c,d]=h.useState(null);return h.useEffect(()=>{if(!t){l("No slug provided"),i(!1);return}(async()=>{try{const f=await Y.entities.EmbeddingTestPage.filter({slug:t});if(!f.length){l("Page not found"),i(!1);return}const m=f[0];if(d(m),m.html_file_url){const x=await(await fetch(m.html_file_url)).text();x?s(x):m.html_content?s(m.html_content):l("No HTML content found for this page")}else m.html_content?s(m.html_content):l("No HTML content found for this page")}catch(f){l(f.message||"Failed to load page")}finally{i(!1)}})()},[t]),a?r.jsxs("div",{className:"min-h-screen flex flex-col bg-white",children:[r.jsx(Gk,{}),r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsxs("div",{className:"flex items-center gap-2 text-gray-400 text-sm",children:[r.jsx(Pe,{className:"w-5 h-5 animate-spin"})," Loading content…"]})})]}):o?r.jsxs("div",{className:"min-h-screen flex flex-col bg-white",children:[r.jsx(Gk,{}),r.jsx("div",{className:"flex-1 flex items-center justify-center",children:r.jsxs("div",{className:"text-center space-y-3 max-w-md px-6",children:[r.jsx("p",{className:"text-5xl font-bold text-indigo-600",children:"404"}),r.jsx("p",{className:"text-gray-900 font-medium",children:o}),r.jsxs("p",{className:"text-sm text-gray-500",children:["Slug: ",t]})]})})]}):r.jsxs("div",{className:"min-h-screen flex flex-col bg-white",children:[r.jsx(Gk,{title:c==null?void 0:c.title}),r.jsx("iframe",{title:"Test Page",srcDoc:n,className:"flex-1 w-full border-0",sandbox:OFe})]})}function Gk({title:e}){return r.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 border-b bg-indigo-600 text-white shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2 font-semibold text-sm",children:[r.jsx("span",{className:"px-2 py-0.5 bg-white/20 rounded text-xs",children:"RAG PoC"}),r.jsx("span",{children:"Assistant Test Page"})]}),e&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-indigo-100 truncate",children:[r.jsx("span",{className:"text-indigo-300",children:"·"}),r.jsx("span",{className:"truncate",children:e})]}),r.jsxs("a",{href:window.location.href,target:"_blank",rel:"noopener noreferrer",className:"ml-auto flex items-center gap-1.5 text-xs text-indigo-100 hover:text-white border border-white/30 px-2.5 py-1 rounded-lg hover:bg-white/10 transition-colors shrink-0",children:[r.jsx(yr,{className:"w-3.5 h-3.5"})," Open"]})]})}const{Pages:JY,Layout:az,mainPage:RFe}=b4e,QY=RFe,MFe=JY[QY],Wn=({children:e,currentPageName:t})=>az?r.jsx(az,{currentPageName:t,children:e}):r.jsx(r.Fragment,{children:e});function DFe(){return r.jsx(w4e,{children:r.jsxs(Nre,{client:Lre,children:[r.jsx(Jle,{children:r.jsxs(Ule,{children:[r.jsx(on,{path:"/login",element:r.jsx(k4e,{})}),r.jsx(on,{path:"/register",element:r.jsx(z4e,{})}),r.jsx(on,{path:"/forgot-password",element:r.jsx(U4e,{})}),r.jsx(on,{path:"/reset-password",element:r.jsx(q4e,{})}),r.jsx(on,{path:"/assistant/:slug",element:r.jsx(X4e,{})}),r.jsx(on,{path:"/LearningAssistant/v2/:slug",element:r.jsx(aIe,{})}),r.jsx(on,{path:"/TranslatePage",element:r.jsx(iIe,{})}),r.jsx(on,{path:"/testpage/:slug",element:r.jsx(IFe,{})}),r.jsxs(on,{element:r.jsx(S4e,{unauthenticatedElement:r.jsx(k4,{to:"/login",replace:!0})}),children:[r.jsx(on,{path:"/",element:r.jsx(Wn,{currentPageName:QY,children:r.jsx(MFe,{})})}),Object.entries(JY).map(([e,t])=>r.jsx(on,{path:`/${e}`,element:r.jsx(Wn,{currentPageName:e,children:r.jsx(t,{})})},e)),r.jsx(on,{path:"/PromptTest",element:r.jsx(Wn,{currentPageName:"PromptTest",children:r.jsx(V4e,{})})}),r.jsx(on,{path:"/ShellTest",element:r.jsx(Wn,{currentPageName:"ShellTest",children:r.jsx(rq,{})})}),r.jsx(on,{path:"/ApiKeyManagement",element:r.jsx(Wn,{currentPageName:"ApiKeyManagement",children:r.jsx(RIe,{})})}),r.jsx(on,{path:"/TestSetDetail",element:r.jsx(Wn,{currentPageName:"TestSetDetail",children:r.jsx(EBe,{})})}),r.jsx(on,{path:"/TestCaseEdit",element:r.jsx(Wn,{currentPageName:"TestCaseEdit",children:r.jsx(TBe,{})})}),r.jsx(on,{path:"/TestResultDetail",element:r.jsx(Wn,{currentPageName:"TestResultDetail",children:r.jsx(DBe,{})})}),r.jsx(on,{path:"/TestCaseResults",element:r.jsx(Wn,{currentPageName:"TestCaseResults",children:r.jsx($Be,{})})}),r.jsx(on,{path:"/IssueReports",element:r.jsx(Wn,{currentPageName:"IssueReports",children:r.jsx(qBe,{})})}),r.jsx(on,{path:"/ChatMessages",element:r.jsx(Wn,{currentPageName:"ChatMessages",children:r.jsx(GBe,{})})}),r.jsx(on,{path:"/VectorTrace",element:r.jsx(Wn,{currentPageName:"VectorTrace",children:r.jsx(lFe,{})})}),r.jsx(on,{path:"/VectorHealthDashboard",element:r.jsx(Wn,{currentPageName:"VectorHealthDashboard",children:r.jsx(cFe,{})})}),r.jsx(on,{path:"/KbQueue",element:r.jsx(Wn,{currentPageName:"KbQueue",children:r.jsx(mFe,{})})}),r.jsx(on,{path:"/KbQueueBKP",element:r.jsx(Wn,{currentPageName:"KbQueueBKP",children:r.jsx(gFe,{})})}),r.jsx(on,{path:"/PageViews",element:r.jsx(Wn,{currentPageName:"PageViews",children:r.jsx(jFe,{})})}),r.jsx(on,{path:"/PageViewLogs",element:r.jsx(Wn,{currentPageName:"PageViewLogs",children:r.jsx(kFe,{})})}),r.jsx(on,{path:"/EmbeddingTests",element:r.jsx(Wn,{currentPageName:"EmbeddingTests",children:r.jsx(xW,{})})}),r.jsx(on,{path:"/EmbeddingTestEdit",element:r.jsx(Wn,{currentPageName:"EmbeddingTestEdit",children:r.jsx(PFe,{})})}),r.jsx(on,{path:"/SettingsV1",element:r.jsx(Wn,{currentPageName:"SettingsV1",children:r.jsx(fIe,{})})}),r.jsx(on,{path:"/SettingsPromptChain",element:r.jsx(Wn,{currentPageName:"SettingsPromptChain",children:r.jsx(pIe,{})})}),r.jsx(on,{path:"/SettingsRagChunking",element:r.jsx(Wn,{currentPageName:"SettingsRagChunking",children:r.jsx(yIe,{})})}),r.jsx(on,{path:"/SettingsKbRag",element:r.jsx(Wn,{currentPageName:"SettingsKbRag",children:r.jsx(bIe,{})})}),r.jsx(on,{path:"/SettingsAssistantDefaults",element:r.jsx(Wn,{currentPageName:"SettingsAssistantDefaults",children:r.jsx(vIe,{})})}),r.jsx(on,{path:"/SettingsShellRouting",element:r.jsx(Wn,{currentPageName:"SettingsShellRouting",children:r.jsx(wIe,{})})}),r.jsx(on,{path:"/SettingsJsonObjects",element:r.jsx(Wn,{currentPageName:"SettingsJsonObjects",children:r.jsx(jIe,{})})}),r.jsx(on,{path:"/SettingsIgnoreKeywords",element:r.jsx(Wn,{currentPageName:"SettingsIgnoreKeywords",children:r.jsx(NIe,{})})}),r.jsx(on,{path:"/SettingsIntegrations",element:r.jsx(Wn,{currentPageName:"SettingsIntegrations",children:r.jsx(SIe,{})})}),r.jsx(on,{path:"/SettingsPocusSync",element:r.jsx(k4,{to:"/KnowledgeBases",replace:!0})})]}),r.jsx(on,{path:"*",element:r.jsx(v4e,{})})]})}),r.jsx(Xne,{})]})})}DQ.createRoot(document.getElementById("root")).render(r.jsx(DFe,{}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.