Files
2026-07-28 19:10:12 +05:30

444 lines
1.7 MiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function QY(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var R8e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function es(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var DE={exports:{}},jp={};/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Z4;function ZY(){if(Z4)return jp;Z4=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,i){var s=null;if(i!==void 0&&(s=""+i),o.key!==void 0&&(s=""+o.key),"key"in o){i={};for(var a in o)a!=="key"&&(i[a]=o[a])}else i=o;return o=i.ref,{$$typeof:e,type:r,key:s,ref:o!==void 0?o:null,props:i}}return jp.Fragment=t,jp.jsx=n,jp.jsxs=n,jp}var eR;function eK(){return eR||(eR=1,DE.exports=ZY()),DE.exports}var h=eK(),IE={exports:{}},ct={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var tR;function tK(){if(tR)return ct;tR=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),g=Symbol.iterator;function y(D){return D===null||typeof D!="object"?null:(D=g&&D[g]||D["@@iterator"],typeof D=="function"?D:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function E(D,W,K){this.props=D,this.context=W,this.refs=S,this.updater=K||v}E.prototype.isReactComponent={},E.prototype.setState=function(D,W){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,W,"setState")},E.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function C(){}C.prototype=E.prototype;function _(D,W,K){this.props=D,this.context=W,this.refs=S,this.updater=K||v}var j=_.prototype=new C;j.constructor=_,x(j,E.prototype),j.isPureReactComponent=!0;var A=Array.isArray;function T(){}var k={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function V(D,W,K){var Q=K.ref;return{$$typeof:e,type:D,key:W,ref:Q!==void 0?Q:null,props:K}}function H(D,W){return V(D.type,W,D.props)}function F(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function B(D){var W={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(K){return W[K]})}var U=/\/+/g;function M(D,W){return typeof D=="object"&&D!==null&&D.key!=null?B(""+D.key):W.toString(36)}function z(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(T,T):(D.status="pending",D.then(function(W){D.status==="pending"&&(D.status="fulfilled",D.value=W)},function(W){D.status==="pending"&&(D.status="rejected",D.reason=W)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function $(D,W,K,Q,ie){var pe=typeof D;(pe==="undefined"||pe==="boolean")&&(D=null);var ue=!1;if(D===null)ue=!0;else switch(pe){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(D.$$typeof){case e:case t:ue=!0;break;case f:return ue=D._init,$(ue(D._payload),W,K,Q,ie)}}if(ue)return ie=ie(D),ue=Q===""?"."+M(D,0):Q,A(ie)?(K="",ue!=null&&(K=ue.replace(U,"$&/")+"/"),$(ie,W,K,"",function(xe){return xe})):ie!=null&&(F(ie)&&(ie=H(ie,K+(ie.key==null||D&&D.key===ie.key?"":(""+ie.key).replace(U,"$&/")+"/")+ue)),W.push(ie)),1;ue=0;var se=Q===""?".":Q+":";if(A(D))for(var me=0;me<D.length;me++)Q=D[me],pe=se+M(Q,me),ue+=$(Q,W,K,pe,ie);else if(me=y(D),typeof me=="function")for(D=me.call(D),me=0;!(Q=D.next()).done;)Q=Q.value,pe=se+M(Q,me++),ue+=$(Q,W,K,pe,ie);else if(pe==="object"){if(typeof D.then=="function")return $(z(D),W,K,Q,ie);throw W=String(D),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return ue}function L(D,W,K){if(D==null)return D;var Q=[],ie=0;return $(D,Q,"","",function(pe){return W.call(K,pe,ie++)}),Q}function P(D){if(D._status===-1){var W=D._result;W=W(),W.then(function(K){(D._status===0||D._status===-1)&&(D._status=1,D._result=K)},function(K){(D._status===0||D._status===-1)&&(D._status=2,D._result=K)}),D._status===-1&&(D._status=0,D._result=W)}if(D._status===1)return D._result.default;throw D._result}var q=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},Y={map:L,forEach:function(D,W,K){L(D,function(){W.apply(this,arguments)},K)},count:function(D){var W=0;return L(D,function(){W++}),W},toArray:function(D){return L(D,function(W){return W})||[]},only:function(D){if(!F(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return ct.Activity=p,ct.Children=Y,ct.Component=E,ct.Fragment=n,ct.Profiler=o,ct.PureComponent=_,ct.StrictMode=r,ct.Suspense=c,ct.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,ct.__COMPILER_RUNTIME={__proto__:null,c:function(D){return k.H.useMemoCache(D)}},ct.cache=function(D){return function(){return D.apply(null,arguments)}},ct.cacheSignal=function(){return null},ct.cloneElement=function(D,W,K){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var Q=x({},D.props),ie=D.key;if(W!=null)for(pe in W.key!==void 0&&(ie=""+W.key),W)!R.call(W,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&W.ref===void 0||(Q[pe]=W[pe]);var pe=arguments.length-2;if(pe===1)Q.children=K;else if(1<pe){for(var ue=Array(pe),se=0;se<pe;se++)ue[se]=arguments[se+2];Q.children=ue}return V(D.type,ie,Q)},ct.createContext=function(D){return D={$$typeof:s,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:i,_context:D},D},ct.createElement=function(D,W,K){var Q,ie={},pe=null;if(W!=null)for(Q in W.key!==void 0&&(pe=""+W.key),W)R.call(W,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(ie[Q]=W[Q]);var ue=arguments.length-2;if(ue===1)ie.children=K;else if(1<ue){for(var se=Array(ue),me=0;me<ue;me++)se[me]=arguments[me+2];ie.children=se}if(D&&D.defaultProps)for(Q in ue=D.defaultProps,ue)ie[Q]===void 0&&(ie[Q]=ue[Q]);return V(D,pe,ie)},ct.createRef=function(){return{current:null}},ct.forwardRef=function(D){return{$$typeof:a,render:D}},ct.isValidElement=F,ct.lazy=function(D){return{$$typeof:f,_payload:{_status:-1,_result:D},_init:P}},ct.memo=function(D,W){return{$$typeof:u,type:D,compare:W===void 0?null:W}},ct.startTransition=function(D){var W=k.T,K={};k.T=K;try{var Q=D(),ie=k.S;ie!==null&&ie(K,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(T,q)}catch(pe){q(pe)}finally{W!==null&&K.types!==null&&(W.types=K.types),k.T=W}},ct.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},ct.use=function(D){return k.H.use(D)},ct.useActionState=function(D,W,K){return k.H.useActionState(D,W,K)},ct.useCallback=function(D,W){return k.H.useCallback(D,W)},ct.useContext=function(D){return k.H.useContext(D)},ct.useDebugValue=function(){},ct.useDeferredValue=function(D,W){return k.H.useDeferredValue(D,W)},ct.useEffect=function(D,W){return k.H.useEffect(D,W)},ct.useEffectEvent=function(D){return k.H.useEffectEvent(D)},ct.useId=function(){return k.H.useId()},ct.useImperativeHandle=function(D,W,K){return k.H.useImperativeHandle(D,W,K)},ct.useInsertionEffect=function(D,W){return k.H.useInsertionEffect(D,W)},ct.useLayoutEffect=function(D,W){return k.H.useLayoutEffect(D,W)},ct.useMemo=function(D,W){return k.H.useMemo(D,W)},ct.useOptimistic=function(D,W){return k.H.useOptimistic(D,W)},ct.useReducer=function(D,W,K){return k.H.useReducer(D,W,K)},ct.useRef=function(D){return k.H.useRef(D)},ct.useState=function(D){return k.H.useState(D)},ct.useSyncExternalStore=function(D,W,K){return k.H.useSyncExternalStore(D,W,K)},ct.useTransition=function(){return k.H.useTransition()},ct.version="19.2.0",ct}var nR;function dc(){return nR||(nR=1,IE.exports=tK()),IE.exports}var w=dc();const Ne=es(w),fO=QY({__proto__:null,default:Ne},[w]);var LE={exports:{}},Ap={},FE={exports:{}},zE={};/**
* @license React
* scheduler.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var rR;function nK(){return rR||(rR=1,function(e){function t($,L){var P=$.length;$.push(L);e:for(;0<P;){var q=P-1>>>1,Y=$[q];if(0<o(Y,L))$[q]=L,$[P]=Y,P=q;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var L=$[0],P=$.pop();if(P!==L){$[0]=P;e:for(var q=0,Y=$.length,D=Y>>>1;q<D;){var W=2*(q+1)-1,K=$[W],Q=W+1,ie=$[Q];if(0>o(K,P))Q<Y&&0>o(ie,K)?($[q]=ie,$[Q]=P,q=Q):($[q]=K,$[W]=P,q=W);else if(Q<Y&&0>o(ie,P))$[q]=ie,$[Q]=P,q=Q;else break e}}return L}function o($,L){var P=$.sortIndex-L.sortIndex;return P!==0?P:$.id-L.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var c=[],u=[],f=1,p=null,g=3,y=!1,v=!1,x=!1,S=!1,E=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function j($){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=$)r(u),L.sortIndex=L.expirationTime,t(c,L);else break;L=n(u)}}function A($){if(x=!1,j($),!v)if(n(c)!==null)v=!0,T||(T=!0,B());else{var L=n(u);L!==null&&z(A,L.startTime-$)}}var T=!1,k=-1,R=5,V=-1;function H(){return S?!0:!(e.unstable_now()-V<R)}function F(){if(S=!1,T){var $=e.unstable_now();V=$;var L=!0;try{e:{v=!1,x&&(x=!1,C(k),k=-1),y=!0;var P=g;try{t:{for(j($),p=n(c);p!==null&&!(p.expirationTime>$&&H());){var q=p.callback;if(typeof q=="function"){p.callback=null,g=p.priorityLevel;var Y=q(p.expirationTime<=$);if($=e.unstable_now(),typeof Y=="function"){p.callback=Y,j($),L=!0;break t}p===n(c)&&r(c),j($)}else r(c);p=n(c)}if(p!==null)L=!0;else{var D=n(u);D!==null&&z(A,D.startTime-$),L=!1}}break e}finally{p=null,g=P,y=!1}L=void 0}}finally{L?B():T=!1}}}var B;if(typeof _=="function")B=function(){_(F)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,M=U.port2;U.port1.onmessage=F,B=function(){M.postMessage(null)}}else B=function(){E(F,0)};function z($,L){k=E(function(){$(e.unstable_now())},L)}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($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_next=function($){switch(g){case 1:case 2:case 3:var L=3;break;default:L=g}var P=g;g=L;try{return $()}finally{g=P}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function($,L){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var P=g;g=$;try{return L()}finally{g=P}},e.unstable_scheduleCallback=function($,L,P){var q=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?q+P:q):P=q,$){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=P+Y,$={id:f++,callback:L,priorityLevel:$,startTime:P,expirationTime:Y,sortIndex:-1},P>q?($.sortIndex=P,t(u,$),n(c)===null&&$===n(u)&&(x?(C(k),k=-1):x=!0,z(A,P-q))):($.sortIndex=Y,t(c,$),v||y||(v=!0,T||(T=!0,B()))),$},e.unstable_shouldYield=H,e.unstable_wrapCallback=function($){var L=g;return function(){var P=g;g=L;try{return $.apply(this,arguments)}finally{g=P}}}}(zE)),zE}var oR;function rK(){return oR||(oR=1,FE.exports=nK()),FE.exports}var BE={exports:{}},gr={};/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var iR;function oK(){if(iR)return gr;iR=1;var e=dc();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)u+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function i(c,u,f){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:p==null?null:""+p,children:c,containerInfo:u,implementation:f}}var s=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return gr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,gr.createPortal=function(c,u){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return i(c,u,null,f)},gr.flushSync=function(c){var u=s.T,f=r.p;try{if(s.T=null,r.p=2,c)return c()}finally{s.T=u,r.p=f,r.d.f()}},gr.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},gr.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},gr.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var f=u.as,p=a(f,u.crossOrigin),g=typeof u.integrity=="string"?u.integrity:void 0,y=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;f==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:p,integrity:g,fetchPriority:y}):f==="script"&&r.d.X(c,{crossOrigin:p,integrity:g,fetchPriority:y,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},gr.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var f=a(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},gr.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var f=u.as,p=a(f,u.crossOrigin);r.d.L(c,f,{crossOrigin:p,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},gr.preloadModule=function(c,u){if(typeof c=="string")if(u){var f=a(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},gr.requestFormReset=function(c){r.d.r(c)},gr.unstable_batchedUpdates=function(c,u){return c(u)},gr.useFormState=function(c,u,f){return s.H.useFormState(c,u,f)},gr.useFormStatus=function(){return s.H.useHostTransitionStatus()},gr.version="19.2.0",gr}var sR;function s9(){if(sR)return BE.exports;sR=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(),BE.exports=oK(),BE.exports}/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var aR;function iK(){if(aR)return Ap;aR=1;var e=rK(),t=dc(),n=s9();function r(l){var d="https://react.dev/errors/"+l;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)d+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+l+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function i(l){var d=l,m=l;if(l.alternate)for(;d.return;)d=d.return;else{l=d;do d=l,(d.flags&4098)!==0&&(m=d.return),l=d.return;while(l)}return d.tag===3?m:null}function s(l){if(l.tag===13){var d=l.memoizedState;if(d===null&&(l=l.alternate,l!==null&&(d=l.memoizedState)),d!==null)return d.dehydrated}return null}function a(l){if(l.tag===31){var d=l.memoizedState;if(d===null&&(l=l.alternate,l!==null&&(d=l.memoizedState)),d!==null)return d.dehydrated}return null}function c(l){if(i(l)!==l)throw Error(r(188))}function u(l){var d=l.alternate;if(!d){if(d=i(l),d===null)throw Error(r(188));return d!==l?null:l}for(var m=l,b=d;;){var N=m.return;if(N===null)break;var O=N.alternate;if(O===null){if(b=N.return,b!==null){m=b;continue}break}if(N.child===O.child){for(O=N.child;O;){if(O===m)return c(N),l;if(O===b)return c(N),d;O=O.sibling}throw Error(r(188))}if(m.return!==b.return)m=N,b=O;else{for(var I=!1,J=N.child;J;){if(J===m){I=!0,m=N,b=O;break}if(J===b){I=!0,b=N,m=O;break}J=J.sibling}if(!I){for(J=O.child;J;){if(J===m){I=!0,m=O,b=N;break}if(J===b){I=!0,b=O,m=N;break}J=J.sibling}if(!I)throw Error(r(189))}}if(m.alternate!==b)throw Error(r(190))}if(m.tag!==3)throw Error(r(188));return m.stateNode.current===m?l:d}function f(l){var d=l.tag;if(d===5||d===26||d===27||d===6)return l;for(l=l.child;l!==null;){if(d=f(l),d!==null)return d;l=l.sibling}return null}var p=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),_=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function B(l){return l===null||typeof l!="object"?null:(l=F&&l[F]||l["@@iterator"],typeof l=="function"?l:null)}var U=Symbol.for("react.client.reference");function M(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===U?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case x:return"Fragment";case E:return"Profiler";case S:return"StrictMode";case A:return"Suspense";case T:return"SuspenseList";case V:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case v:return"Portal";case _:return l.displayName||"Context";case C:return(l._context.displayName||"Context")+".Consumer";case j:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case k:return d=l.displayName||null,d!==null?d:M(l.type)||"Memo";case R:d=l._payload,l=l._init;try{return M(l(d))}catch{}}return null}var z=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},q=[],Y=-1;function D(l){return{current:l}}function W(l){0>Y||(l.current=q[Y],q[Y]=null,Y--)}function K(l,d){Y++,q[Y]=l.current,l.current=d}var Q=D(null),ie=D(null),pe=D(null),ue=D(null);function se(l,d){switch(K(pe,d),K(ie,l),K(Q,null),d.nodeType){case 9:case 11:l=(l=d.documentElement)&&(l=l.namespaceURI)?S4(l):0;break;default:if(l=d.tagName,d=d.namespaceURI)d=S4(d),l=E4(d,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}W(Q),K(Q,l)}function me(){W(Q),W(ie),W(pe)}function xe(l){l.memoizedState!==null&&K(ue,l);var d=Q.current,m=E4(d,l.type);d!==m&&(K(ie,l),K(Q,m))}function je(l){ie.current===l&&(W(Q),W(ie)),ue.current===l&&(W(ue),Np._currentValue=P)}var _e,Ee;function Re(l){if(_e===void 0)try{throw Error()}catch(m){var d=m.stack.trim().match(/\n( *(at )?)/);_e=d&&d[1]||"",Ee=-1<m.stack.indexOf(`
at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
`+_e+l+Ee}var Me=!1;function ze(l,d){if(!l||Me)return"";Me=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(d){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(ye){var ge=ye}Reflect.construct(l,[],Se)}else{try{Se.call()}catch(ye){ge=ye}l.call(Se.prototype)}}else{try{throw Error()}catch(ye){ge=ye}(Se=l())&&typeof Se.catch=="function"&&Se.catch(function(){})}}catch(ye){if(ye&&ge&&typeof ye.stack=="string")return[ye.stack,ge.stack]}return[null,null]}};b.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var N=Object.getOwnPropertyDescriptor(b.DetermineComponentFrameRoot,"name");N&&N.configurable&&Object.defineProperty(b.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var O=b.DetermineComponentFrameRoot(),I=O[0],J=O[1];if(I&&J){var ee=I.split(`
`),he=J.split(`
`);for(N=b=0;b<ee.length&&!ee[b].includes("DetermineComponentFrameRoot");)b++;for(;N<he.length&&!he[N].includes("DetermineComponentFrameRoot");)N++;if(b===ee.length||N===he.length)for(b=ee.length-1,N=he.length-1;1<=b&&0<=N&&ee[b]!==he[N];)N--;for(;1<=b&&0<=N;b--,N--)if(ee[b]!==he[N]){if(b!==1||N!==1)do if(b--,N--,0>N||ee[b]!==he[N]){var be=`
`+ee[b].replace(" at new "," at ");return l.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",l.displayName)),be}while(1<=b&&0<=N);break}}}finally{Me=!1,Error.prepareStackTrace=m}return(m=l?l.displayName||l.name:"")?Re(m):""}function ve(l,d){switch(l.tag){case 26:case 27:case 5:return Re(l.type);case 16:return Re("Lazy");case 13:return l.child!==d&&d!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("SuspenseList");case 0:case 15:return ze(l.type,!1);case 11:return ze(l.type.render,!1);case 1:return ze(l.type,!0);case 31:return Re("Activity");default:return""}}function Ce(l){try{var d="",m=null;do d+=ve(l,m),m=l,l=l.return;while(l);return d}catch(b){return`
Error generating stack: `+b.message+`
`+b.stack}}var Ae=Object.prototype.hasOwnProperty,G=e.unstable_scheduleCallback,re=e.unstable_cancelCallback,ne=e.unstable_shouldYield,ce=e.unstable_requestPaint,te=e.unstable_now,Z=e.unstable_getCurrentPriorityLevel,de=e.unstable_ImmediatePriority,Te=e.unstable_UserBlockingPriority,$e=e.unstable_NormalPriority,Ke=e.unstable_LowPriority,At=e.unstable_IdlePriority,yn=e.log,ls=e.unstable_setDisableYieldValue,pr=null,dn=null;function Ut(l){if(typeof yn=="function"&&ls(l),dn&&typeof dn.setStrictMode=="function")try{dn.setStrictMode(pr,l)}catch{}}var nn=Math.clz32?Math.clz32:Ku,qo=Math.log,cs=Math.LN2;function Ku(l){return l>>>=0,l===0?32:31-(qo(l)/cs|0)|0}var Ja=256,Is=262144,Ya=4194304;function Wn(l){var d=l&42;if(d!==0)return d;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Ka(l,d,m){var b=l.pendingLanes;if(b===0)return 0;var N=0,O=l.suspendedLanes,I=l.pingedLanes;l=l.warmLanes;var J=b&134217727;return J!==0?(b=J&~O,b!==0?N=Wn(b):(I&=J,I!==0?N=Wn(I):m||(m=J&~l,m!==0&&(N=Wn(m))))):(J=b&~O,J!==0?N=Wn(J):I!==0?N=Wn(I):m||(m=b&~l,m!==0&&(N=Wn(m)))),N===0?0:d!==0&&d!==N&&(d&O)===0&&(O=N&-N,m=d&-d,O>=m||O===32&&(m&4194048)!==0)?d:N}function Xa(l,d){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&d)===0}function Ih(l,d){switch(l){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Xu(){var l=Ya;return Ya<<=1,(Ya&62914560)===0&&(Ya=4194304),l}function rn(l){for(var d=[],m=0;31>m;m++)d.push(l);return d}function Cr(l,d){l.pendingLanes|=d,d!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function Ei(l,d,m,b,N,O){var I=l.pendingLanes;l.pendingLanes=m,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=m,l.entangledLanes&=m,l.errorRecoveryDisabledLanes&=m,l.shellSuspendCounter=0;var J=l.entanglements,ee=l.expirationTimes,he=l.hiddenUpdates;for(m=I&~m;0<m;){var be=31-nn(m),Se=1<<be;J[be]=0,ee[be]=-1;var ge=he[be];if(ge!==null)for(he[be]=null,be=0;be<ge.length;be++){var ye=ge[be];ye!==null&&(ye.lane&=-536870913)}m&=~Se}b!==0&&Qu(l,b,0),O!==0&&N===0&&l.tag!==0&&(l.suspendedLanes|=O&~(I&~d))}function Qu(l,d,m){l.pendingLanes|=d,l.suspendedLanes&=~d;var b=31-nn(d);l.entangledLanes|=d,l.entanglements[b]=l.entanglements[b]|1073741824|m&261930}function Ni(l,d){var m=l.entangledLanes|=d;for(l=l.entanglements;m;){var b=31-nn(m),N=1<<b;N&d|l[b]&d&&(l[b]|=d),m&=~N}}function Qa(l,d){var m=d&-d;return m=(m&42)!==0?1:Za(m),(m&(l.suspendedLanes|d))!==0?0:m}function Za(l){switch(l){case 2:l=1;break;case 8:l=4;break;case 32:l=16;break;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:l=128;break;case 268435456:l=134217728;break;default:l=0}return l}function el(l){return l&=-l,2<l?8<l?(l&134217727)!==0?32:268435456:8:2}function Ac(){var l=L.p;return l!==0?l:(l=window.event,l===void 0?32:W4(l.type))}function Zu(l,d){var m=L.p;try{return L.p=l,d()}finally{L.p=m}}var Wo=Math.random().toString(36).slice(2),Tn="__reactFiber$"+Wo,er="__reactProps$"+Wo,lt="__reactContainer$"+Wo,tr="__reactEvents$"+Wo,vo="__reactListeners$"+Wo,wy="__reactHandles$"+Wo,Sy="__reactResources$"+Wo,Tc="__reactMarker$"+Wo;function Lh(l){delete l[Tn],delete l[er],delete l[tr],delete l[vo],delete l[wy]}function tl(l){var d=l[Tn];if(d)return d;for(var m=l.parentNode;m;){if(d=m[lt]||m[Tn]){if(m=d.alternate,d.child!==null||m!==null&&m.child!==null)for(l=T4(l);l!==null;){if(m=l[Tn])return m;l=T4(l)}return d}l=m,m=l.parentNode}return null}function nl(l){if(l=l[Tn]||l[lt]){var d=l.tag;if(d===5||d===6||d===13||d===31||d===26||d===27||d===3)return l}return null}function rl(l){var d=l.tag;if(d===5||d===26||d===27||d===6)return l.stateNode;throw Error(r(33))}function ol(l){var d=l[Sy];return d||(d=l[Sy]={hoistableStyles:new Map,hoistableScripts:new Map}),d}function Dn(l){l[Tc]=!0}var Ey=new Set,Ny={};function Ls(l,d){il(l,d),il(l+"Capture",d)}function il(l,d){for(Ny[l]=d,l=0;l<d.length;l++)Ey.add(d[l])}var j1=RegExp("^[: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]*$"),Fh={},_y={};function A1(l){return Ae.call(_y,l)?!0:Ae.call(Fh,l)?!1:j1.test(l)?_y[l]=!0:(Fh[l]=!0,!1)}function ed(l,d,m){if(A1(d))if(m===null)l.removeAttribute(d);else{switch(typeof m){case"undefined":case"function":case"symbol":l.removeAttribute(d);return;case"boolean":var b=d.toLowerCase().slice(0,5);if(b!=="data-"&&b!=="aria-"){l.removeAttribute(d);return}}l.setAttribute(d,""+m)}}function td(l,d,m){if(m===null)l.removeAttribute(d);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(d);return}l.setAttribute(d,""+m)}}function _i(l,d,m,b){if(b===null)l.removeAttribute(m);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(m);return}l.setAttributeNS(d,m,""+b)}}function Hr(l){switch(typeof l){case"bigint":case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Cy(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function T1(l,d,m){var b=Object.getOwnPropertyDescriptor(l.constructor.prototype,d);if(!l.hasOwnProperty(d)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var N=b.get,O=b.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return N.call(this)},set:function(I){m=""+I,O.call(this,I)}}),Object.defineProperty(l,d,{enumerable:b.enumerable}),{getValue:function(){return m},setValue:function(I){m=""+I},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function nd(l){if(!l._valueTracker){var d=Cy(l)?"checked":"value";l._valueTracker=T1(l,d,""+l[d])}}function Oy(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var m=d.getValue(),b="";return l&&(b=Cy(l)?l.checked?"true":"false":l.value),l=b,l!==m?(d.setValue(l),!0):!1}function rd(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var $1=/[\n"\\]/g;function mr(l){return l.replace($1,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function zh(l,d,m,b,N,O,I,J){l.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?l.type=I:l.removeAttribute("type"),d!=null?I==="number"?(d===0&&l.value===""||l.value!=d)&&(l.value=""+Hr(d)):l.value!==""+Hr(d)&&(l.value=""+Hr(d)):I!=="submit"&&I!=="reset"||l.removeAttribute("value"),d!=null?od(l,I,Hr(d)):m!=null?od(l,I,Hr(m)):b!=null&&l.removeAttribute("value"),N==null&&O!=null&&(l.defaultChecked=!!O),N!=null&&(l.checked=N&&typeof N!="function"&&typeof N!="symbol"),J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"?l.name=""+Hr(J):l.removeAttribute("name")}function jy(l,d,m,b,N,O,I,J){if(O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(l.type=O),d!=null||m!=null){if(!(O!=="submit"&&O!=="reset"||d!=null)){nd(l);return}m=m!=null?""+Hr(m):"",d=d!=null?""+Hr(d):m,J||d===l.value||(l.value=d),l.defaultValue=d}b=b??N,b=typeof b!="function"&&typeof b!="symbol"&&!!b,l.checked=J?l.checked:!!b,l.defaultChecked=!!b,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(l.name=I),nd(l)}function od(l,d,m){d==="number"&&rd(l.ownerDocument)===l||l.defaultValue===""+m||(l.defaultValue=""+m)}function id(l,d,m,b){if(l=l.options,d){d={};for(var N=0;N<m.length;N++)d["$"+m[N]]=!0;for(m=0;m<l.length;m++)N=d.hasOwnProperty("$"+l[m].value),l[m].selected!==N&&(l[m].selected=N),N&&b&&(l[m].defaultSelected=!0)}else{for(m=""+Hr(m),d=null,N=0;N<l.length;N++){if(l[N].value===m){l[N].selected=!0,b&&(l[N].defaultSelected=!0);return}d!==null||l[N].disabled||(d=l[N])}d!==null&&(d.selected=!0)}}function y$(l,d,m){if(d!=null&&(d=""+Hr(d),d!==l.value&&(l.value=d),m==null)){l.defaultValue!==d&&(l.defaultValue=d);return}l.defaultValue=m!=null?""+Hr(m):""}function b$(l,d,m,b){if(d==null){if(b!=null){if(m!=null)throw Error(r(92));if(z(b)){if(1<b.length)throw Error(r(93));b=b[0]}m=b}m==null&&(m=""),d=m}m=Hr(d),l.defaultValue=m,b=l.textContent,b===m&&b!==""&&b!==null&&(l.value=b),nd(l)}function sd(l,d){if(d){var m=l.firstChild;if(m&&m===l.lastChild&&m.nodeType===3){m.nodeValue=d;return}}l.textContent=d}var GG=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function v$(l,d,m){var b=d.indexOf("--")===0;m==null||typeof m=="boolean"||m===""?b?l.setProperty(d,""):d==="float"?l.cssFloat="":l[d]="":b?l.setProperty(d,m):typeof m!="number"||m===0||GG.has(d)?d==="float"?l.cssFloat=m:l[d]=(""+m).trim():l[d]=m+"px"}function x$(l,d,m){if(d!=null&&typeof d!="object")throw Error(r(62));if(l=l.style,m!=null){for(var b in m)!m.hasOwnProperty(b)||d!=null&&d.hasOwnProperty(b)||(b.indexOf("--")===0?l.setProperty(b,""):b==="float"?l.cssFloat="":l[b]="");for(var N in d)b=d[N],d.hasOwnProperty(N)&&m[N]!==b&&v$(l,N,b)}else for(var O in d)d.hasOwnProperty(O)&&v$(l,O,d[O])}function R1(l){if(l.indexOf("-")===-1)return!1;switch(l){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 JG=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),YG=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ay(l){return YG.test(""+l)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":l}function Fs(){}var k1=null;function M1(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var ad=null,ld=null;function w$(l){var d=nl(l);if(d&&(l=d.stateNode)){var m=l[er]||null;e:switch(l=d.stateNode,d.type){case"input":if(zh(l,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name),d=m.name,m.type==="radio"&&d!=null){for(m=l;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll('input[name="'+mr(""+d)+'"][type="radio"]'),d=0;d<m.length;d++){var b=m[d];if(b!==l&&b.form===l.form){var N=b[er]||null;if(!N)throw Error(r(90));zh(b,N.value,N.defaultValue,N.defaultValue,N.checked,N.defaultChecked,N.type,N.name)}}for(d=0;d<m.length;d++)b=m[d],b.form===l.form&&Oy(b)}break e;case"textarea":y$(l,m.value,m.defaultValue);break e;case"select":d=m.value,d!=null&&id(l,!!m.multiple,d,!1)}}}var P1=!1;function S$(l,d,m){if(P1)return l(d,m);P1=!0;try{var b=l(d);return b}finally{if(P1=!1,(ad!==null||ld!==null)&&(g0(),ad&&(d=ad,l=ld,ld=ad=null,w$(d),l)))for(d=0;d<l.length;d++)w$(l[d])}}function Bh(l,d){var m=l.stateNode;if(m===null)return null;var b=m[er]||null;if(b===null)return null;m=b[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(l=l.type,b=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!b;break e;default:l=!1}if(l)return null;if(m&&typeof m!="function")throw Error(r(231,d,typeof m));return m}var zs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),D1=!1;if(zs)try{var Vh={};Object.defineProperty(Vh,"passive",{get:function(){D1=!0}}),window.addEventListener("test",Vh,Vh),window.removeEventListener("test",Vh,Vh)}catch{D1=!1}var sl=null,I1=null,Ty=null;function E$(){if(Ty)return Ty;var l,d=I1,m=d.length,b,N="value"in sl?sl.value:sl.textContent,O=N.length;for(l=0;l<m&&d[l]===N[l];l++);var I=m-l;for(b=1;b<=I&&d[m-b]===N[O-b];b++);return Ty=N.slice(l,1<b?1-b:void 0)}function $y(l){var d=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&d===13&&(l=13)):l=d,l===10&&(l=13),32<=l||l===13?l:0}function Ry(){return!0}function N$(){return!1}function qr(l){function d(m,b,N,O,I){this._reactName=m,this._targetInst=N,this.type=b,this.nativeEvent=O,this.target=I,this.currentTarget=null;for(var J in l)l.hasOwnProperty(J)&&(m=l[J],this[J]=m?m(O):O[J]);return this.isDefaultPrevented=(O.defaultPrevented!=null?O.defaultPrevented:O.returnValue===!1)?Ry:N$,this.isPropagationStopped=N$,this}return p(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=Ry)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=Ry)},persist:function(){},isPersistent:Ry}),d}var $c={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ky=qr($c),Uh=p({},$c,{view:0,detail:0}),KG=qr(Uh),L1,F1,Hh,My=p({},Uh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:B1,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Hh&&(Hh&&l.type==="mousemove"?(L1=l.screenX-Hh.screenX,F1=l.screenY-Hh.screenY):F1=L1=0,Hh=l),L1)},movementY:function(l){return"movementY"in l?l.movementY:F1}}),_$=qr(My),XG=p({},My,{dataTransfer:0}),QG=qr(XG),ZG=p({},Uh,{relatedTarget:0}),z1=qr(ZG),eJ=p({},$c,{animationName:0,elapsedTime:0,pseudoElement:0}),tJ=qr(eJ),nJ=p({},$c,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),rJ=qr(nJ),oJ=p({},$c,{data:0}),C$=qr(oJ),iJ={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sJ={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"},aJ={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lJ(l){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(l):(l=aJ[l])?!!d[l]:!1}function B1(){return lJ}var cJ=p({},Uh,{key:function(l){if(l.key){var d=iJ[l.key]||l.key;if(d!=="Unidentified")return d}return l.type==="keypress"?(l=$y(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?sJ[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:B1,charCode:function(l){return l.type==="keypress"?$y(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?$y(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),uJ=qr(cJ),dJ=p({},My,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),O$=qr(dJ),fJ=p({},Uh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:B1}),hJ=qr(fJ),pJ=p({},$c,{propertyName:0,elapsedTime:0,pseudoElement:0}),mJ=qr(pJ),gJ=p({},My,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),yJ=qr(gJ),bJ=p({},$c,{newState:0,oldState:0}),vJ=qr(bJ),xJ=[9,13,27,32],V1=zs&&"CompositionEvent"in window,qh=null;zs&&"documentMode"in document&&(qh=document.documentMode);var wJ=zs&&"TextEvent"in window&&!qh,j$=zs&&(!V1||qh&&8<qh&&11>=qh),A$=" ",T$=!1;function $$(l,d){switch(l){case"keyup":return xJ.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function R$(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var cd=!1;function SJ(l,d){switch(l){case"compositionend":return R$(d);case"keypress":return d.which!==32?null:(T$=!0,A$);case"textInput":return l=d.data,l===A$&&T$?null:l;default:return null}}function EJ(l,d){if(cd)return l==="compositionend"||!V1&&$$(l,d)?(l=E$(),Ty=I1=sl=null,cd=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return j$&&d.locale!=="ko"?null:d.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 k$(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d==="input"?!!NJ[l.type]:d==="textarea"}function M$(l,d,m,b){ad?ld?ld.push(b):ld=[b]:ad=b,d=E0(d,"onChange"),0<d.length&&(m=new ky("onChange","change",null,m,b),l.push({event:m,listeners:d}))}var Wh=null,Gh=null;function _J(l){g4(l,0)}function Py(l){var d=rl(l);if(Oy(d))return l}function P$(l,d){if(l==="change")return d}var D$=!1;if(zs){var U1;if(zs){var H1="oninput"in document;if(!H1){var I$=document.createElement("div");I$.setAttribute("oninput","return;"),H1=typeof I$.oninput=="function"}U1=H1}else U1=!1;D$=U1&&(!document.documentMode||9<document.documentMode)}function L$(){Wh&&(Wh.detachEvent("onpropertychange",F$),Gh=Wh=null)}function F$(l){if(l.propertyName==="value"&&Py(Gh)){var d=[];M$(d,Gh,l,M1(l)),S$(_J,d)}}function CJ(l,d,m){l==="focusin"?(L$(),Wh=d,Gh=m,Wh.attachEvent("onpropertychange",F$)):l==="focusout"&&L$()}function OJ(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return Py(Gh)}function jJ(l,d){if(l==="click")return Py(d)}function AJ(l,d){if(l==="input"||l==="change")return Py(d)}function TJ(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var xo=typeof Object.is=="function"?Object.is:TJ;function Jh(l,d){if(xo(l,d))return!0;if(typeof l!="object"||l===null||typeof d!="object"||d===null)return!1;var m=Object.keys(l),b=Object.keys(d);if(m.length!==b.length)return!1;for(b=0;b<m.length;b++){var N=m[b];if(!Ae.call(d,N)||!xo(l[N],d[N]))return!1}return!0}function z$(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function B$(l,d){var m=z$(l);l=0;for(var b;m;){if(m.nodeType===3){if(b=l+m.textContent.length,l<=d&&b>=d)return{node:m,offset:d-l};l=b}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=z$(m)}}function V$(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?V$(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function U$(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var d=rd(l.document);d instanceof l.HTMLIFrameElement;){try{var m=typeof d.contentWindow.location.href=="string"}catch{m=!1}if(m)l=d.contentWindow;else break;d=rd(l.document)}return d}function q1(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}var $J=zs&&"documentMode"in document&&11>=document.documentMode,ud=null,W1=null,Yh=null,G1=!1;function H$(l,d,m){var b=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;G1||ud==null||ud!==rd(b)||(b=ud,"selectionStart"in b&&q1(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),Yh&&Jh(Yh,b)||(Yh=b,b=E0(W1,"onSelect"),0<b.length&&(d=new ky("onSelect","select",null,d,m),l.push({event:d,listeners:b}),d.target=ud)))}function Rc(l,d){var m={};return m[l.toLowerCase()]=d.toLowerCase(),m["Webkit"+l]="webkit"+d,m["Moz"+l]="moz"+d,m}var dd={animationend:Rc("Animation","AnimationEnd"),animationiteration:Rc("Animation","AnimationIteration"),animationstart:Rc("Animation","AnimationStart"),transitionrun:Rc("Transition","TransitionRun"),transitionstart:Rc("Transition","TransitionStart"),transitioncancel:Rc("Transition","TransitionCancel"),transitionend:Rc("Transition","TransitionEnd")},J1={},q$={};zs&&(q$=document.createElement("div").style,"AnimationEvent"in window||(delete dd.animationend.animation,delete dd.animationiteration.animation,delete dd.animationstart.animation),"TransitionEvent"in window||delete dd.transitionend.transition);function kc(l){if(J1[l])return J1[l];if(!dd[l])return l;var d=dd[l],m;for(m in d)if(d.hasOwnProperty(m)&&m in q$)return J1[l]=d[m];return l}var W$=kc("animationend"),G$=kc("animationiteration"),J$=kc("animationstart"),RJ=kc("transitionrun"),kJ=kc("transitionstart"),MJ=kc("transitioncancel"),Y$=kc("transitionend"),K$=new Map,Y1="abort auxClick beforeToggle 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(" ");Y1.push("scrollEnd");function Ci(l,d){K$.set(l,d),Ls(d,[l])}var Dy=typeof reportError=="function"?reportError:function(l){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var d=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof l=="object"&&l!==null&&typeof l.message=="string"?String(l.message):String(l),error:l});if(!window.dispatchEvent(d))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",l);return}console.error(l)},Go=[],fd=0,K1=0;function Iy(){for(var l=fd,d=K1=fd=0;d<l;){var m=Go[d];Go[d++]=null;var b=Go[d];Go[d++]=null;var N=Go[d];Go[d++]=null;var O=Go[d];if(Go[d++]=null,b!==null&&N!==null){var I=b.pending;I===null?N.next=N:(N.next=I.next,I.next=N),b.pending=N}O!==0&&X$(m,N,O)}}function Ly(l,d,m,b){Go[fd++]=l,Go[fd++]=d,Go[fd++]=m,Go[fd++]=b,K1|=b,l.lanes|=b,l=l.alternate,l!==null&&(l.lanes|=b)}function X1(l,d,m,b){return Ly(l,d,m,b),Fy(l)}function Mc(l,d){return Ly(l,null,null,d),Fy(l)}function X$(l,d,m){l.lanes|=m;var b=l.alternate;b!==null&&(b.lanes|=m);for(var N=!1,O=l.return;O!==null;)O.childLanes|=m,b=O.alternate,b!==null&&(b.childLanes|=m),O.tag===22&&(l=O.stateNode,l===null||l._visibility&1||(N=!0)),l=O,O=O.return;return l.tag===3?(O=l.stateNode,N&&d!==null&&(N=31-nn(m),l=O.hiddenUpdates,b=l[N],b===null?l[N]=[d]:b.push(d),d.lane=m|536870912),O):null}function Fy(l){if(50<yp)throw yp=0,sE=null,Error(r(185));for(var d=l.return;d!==null;)l=d,d=l.return;return l.tag===3?l.stateNode:null}var hd={};function PJ(l,d,m,b){this.tag=l,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wo(l,d,m,b){return new PJ(l,d,m,b)}function Q1(l){return l=l.prototype,!(!l||!l.isReactComponent)}function Bs(l,d){var m=l.alternate;return m===null?(m=wo(l.tag,d,l.key,l.mode),m.elementType=l.elementType,m.type=l.type,m.stateNode=l.stateNode,m.alternate=l,l.alternate=m):(m.pendingProps=d,m.type=l.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=l.flags&65011712,m.childLanes=l.childLanes,m.lanes=l.lanes,m.child=l.child,m.memoizedProps=l.memoizedProps,m.memoizedState=l.memoizedState,m.updateQueue=l.updateQueue,d=l.dependencies,m.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},m.sibling=l.sibling,m.index=l.index,m.ref=l.ref,m.refCleanup=l.refCleanup,m}function Q$(l,d){l.flags&=65011714;var m=l.alternate;return m===null?(l.childLanes=0,l.lanes=d,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=m.childLanes,l.lanes=m.lanes,l.child=m.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=m.memoizedProps,l.memoizedState=m.memoizedState,l.updateQueue=m.updateQueue,l.type=m.type,d=m.dependencies,l.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),l}function zy(l,d,m,b,N,O){var I=0;if(b=l,typeof l=="function")Q1(l)&&(I=1);else if(typeof l=="string")I=zY(l,m,Q.current)?26:l==="html"||l==="head"||l==="body"?27:5;else e:switch(l){case V:return l=wo(31,m,d,N),l.elementType=V,l.lanes=O,l;case x:return Pc(m.children,N,O,d);case S:I=8,N|=24;break;case E:return l=wo(12,m,d,N|2),l.elementType=E,l.lanes=O,l;case A:return l=wo(13,m,d,N),l.elementType=A,l.lanes=O,l;case T:return l=wo(19,m,d,N),l.elementType=T,l.lanes=O,l;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case _:I=10;break e;case C:I=9;break e;case j:I=11;break e;case k:I=14;break e;case R:I=16,b=null;break e}I=29,m=Error(r(130,l===null?"null":typeof l,"")),b=null}return d=wo(I,m,d,N),d.elementType=l,d.type=b,d.lanes=O,d}function Pc(l,d,m,b){return l=wo(7,l,b,d),l.lanes=m,l}function Z1(l,d,m){return l=wo(6,l,null,d),l.lanes=m,l}function Z$(l){var d=wo(18,null,null,0);return d.stateNode=l,d}function eS(l,d,m){return d=wo(4,l.children!==null?l.children:[],l.key,d),d.lanes=m,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}var e3=new WeakMap;function Jo(l,d){if(typeof l=="object"&&l!==null){var m=e3.get(l);return m!==void 0?m:(d={value:l,source:d,stack:Ce(d)},e3.set(l,d),d)}return{value:l,source:d,stack:Ce(d)}}var pd=[],md=0,By=null,Kh=0,Yo=[],Ko=0,al=null,us=1,ds="";function Vs(l,d){pd[md++]=Kh,pd[md++]=By,By=l,Kh=d}function t3(l,d,m){Yo[Ko++]=us,Yo[Ko++]=ds,Yo[Ko++]=al,al=l;var b=us;l=ds;var N=32-nn(b)-1;b&=~(1<<N),m+=1;var O=32-nn(d)+N;if(30<O){var I=N-N%5;O=(b&(1<<I)-1).toString(32),b>>=I,N-=I,us=1<<32-nn(d)+N|m<<N|b,ds=O+l}else us=1<<O|m<<N|b,ds=l}function tS(l){l.return!==null&&(Vs(l,1),t3(l,1,0))}function nS(l){for(;l===By;)By=pd[--md],pd[md]=null,Kh=pd[--md],pd[md]=null;for(;l===al;)al=Yo[--Ko],Yo[Ko]=null,ds=Yo[--Ko],Yo[Ko]=null,us=Yo[--Ko],Yo[Ko]=null}function n3(l,d){Yo[Ko++]=us,Yo[Ko++]=ds,Yo[Ko++]=al,us=d.id,ds=d.overflow,al=l}var ar=null,on=null,Et=!1,ll=null,Xo=!1,rS=Error(r(519));function cl(l){var d=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xh(Jo(d,l)),rS}function r3(l){var d=l.stateNode,m=l.type,b=l.memoizedProps;switch(d[Tn]=l,d[er]=b,m){case"dialog":xt("cancel",d),xt("close",d);break;case"iframe":case"object":case"embed":xt("load",d);break;case"video":case"audio":for(m=0;m<vp.length;m++)xt(vp[m],d);break;case"source":xt("error",d);break;case"img":case"image":case"link":xt("error",d),xt("load",d);break;case"details":xt("toggle",d);break;case"input":xt("invalid",d),jy(d,b.value,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name,!0);break;case"select":xt("invalid",d);break;case"textarea":xt("invalid",d),b$(d,b.value,b.defaultValue,b.children)}m=b.children,typeof m!="string"&&typeof m!="number"&&typeof m!="bigint"||d.textContent===""+m||b.suppressHydrationWarning===!0||x4(d.textContent,m)?(b.popover!=null&&(xt("beforetoggle",d),xt("toggle",d)),b.onScroll!=null&&xt("scroll",d),b.onScrollEnd!=null&&xt("scrollend",d),b.onClick!=null&&(d.onclick=Fs),d=!0):d=!1,d||cl(l,!0)}function o3(l){for(ar=l.return;ar;)switch(ar.tag){case 5:case 31:case 13:Xo=!1;return;case 27:case 3:Xo=!0;return;default:ar=ar.return}}function gd(l){if(l!==ar)return!1;if(!Et)return o3(l),Et=!0,!1;var d=l.tag,m;if((m=d!==3&&d!==27)&&((m=d===5)&&(m=l.type,m=!(m!=="form"&&m!=="button")||wE(l.type,l.memoizedProps)),m=!m),m&&on&&cl(l),o3(l),d===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(r(317));on=A4(l)}else if(d===31){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(r(317));on=A4(l)}else d===27?(d=on,El(l.type)?(l=CE,CE=null,on=l):on=d):on=ar?Zo(l.stateNode.nextSibling):null;return!0}function Dc(){on=ar=null,Et=!1}function oS(){var l=ll;return l!==null&&(Yr===null?Yr=l:Yr.push.apply(Yr,l),ll=null),l}function Xh(l){ll===null?ll=[l]:ll.push(l)}var iS=D(null),Ic=null,Us=null;function ul(l,d,m){K(iS,d._currentValue),d._currentValue=m}function Hs(l){l._currentValue=iS.current,W(iS)}function sS(l,d,m){for(;l!==null;){var b=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,b!==null&&(b.childLanes|=d)):b!==null&&(b.childLanes&d)!==d&&(b.childLanes|=d),l===m)break;l=l.return}}function aS(l,d,m,b){var N=l.child;for(N!==null&&(N.return=l);N!==null;){var O=N.dependencies;if(O!==null){var I=N.child;O=O.firstContext;e:for(;O!==null;){var J=O;O=N;for(var ee=0;ee<d.length;ee++)if(J.context===d[ee]){O.lanes|=m,J=O.alternate,J!==null&&(J.lanes|=m),sS(O.return,m,l),b||(I=null);break e}O=J.next}}else if(N.tag===18){if(I=N.return,I===null)throw Error(r(341));I.lanes|=m,O=I.alternate,O!==null&&(O.lanes|=m),sS(I,m,l),I=null}else I=N.child;if(I!==null)I.return=N;else for(I=N;I!==null;){if(I===l){I=null;break}if(N=I.sibling,N!==null){N.return=I.return,I=N;break}I=I.return}N=I}}function yd(l,d,m,b){l=null;for(var N=d,O=!1;N!==null;){if(!O){if((N.flags&524288)!==0)O=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var I=N.alternate;if(I===null)throw Error(r(387));if(I=I.memoizedProps,I!==null){var J=N.type;xo(N.pendingProps.value,I.value)||(l!==null?l.push(J):l=[J])}}else if(N===ue.current){if(I=N.alternate,I===null)throw Error(r(387));I.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(l!==null?l.push(Np):l=[Np])}N=N.return}l!==null&&aS(d,l,m,b),d.flags|=262144}function Vy(l){for(l=l.firstContext;l!==null;){if(!xo(l.context._currentValue,l.memoizedValue))return!0;l=l.next}return!1}function Lc(l){Ic=l,Us=null,l=l.dependencies,l!==null&&(l.firstContext=null)}function lr(l){return i3(Ic,l)}function Uy(l,d){return Ic===null&&Lc(l),i3(l,d)}function i3(l,d){var m=d._currentValue;if(d={context:d,memoizedValue:m,next:null},Us===null){if(l===null)throw Error(r(308));Us=d,l.dependencies={lanes:0,firstContext:d},l.flags|=524288}else Us=Us.next=d;return m}var DJ=typeof AbortController<"u"?AbortController:function(){var l=[],d=this.signal={aborted:!1,addEventListener:function(m,b){l.push(b)}};this.abort=function(){d.aborted=!0,l.forEach(function(m){return m()})}},IJ=e.unstable_scheduleCallback,LJ=e.unstable_NormalPriority,In={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lS(){return{controller:new DJ,data:new Map,refCount:0}}function Qh(l){l.refCount--,l.refCount===0&&IJ(LJ,function(){l.controller.abort()})}var Zh=null,cS=0,bd=0,vd=null;function FJ(l,d){if(Zh===null){var m=Zh=[];cS=0,bd=fE(),vd={status:"pending",value:void 0,then:function(b){m.push(b)}}}return cS++,d.then(s3,s3),d}function s3(){if(--cS===0&&Zh!==null){vd!==null&&(vd.status="fulfilled");var l=Zh;Zh=null,bd=0,vd=null;for(var d=0;d<l.length;d++)(0,l[d])()}}function zJ(l,d){var m=[],b={status:"pending",value:null,reason:null,then:function(N){m.push(N)}};return l.then(function(){b.status="fulfilled",b.value=d;for(var N=0;N<m.length;N++)(0,m[N])(d)},function(N){for(b.status="rejected",b.reason=N,N=0;N<m.length;N++)(0,m[N])(void 0)}),b}var a3=$.S;$.S=function(l,d){H5=te(),typeof d=="object"&&d!==null&&typeof d.then=="function"&&FJ(l,d),a3!==null&&a3(l,d)};var Fc=D(null);function uS(){var l=Fc.current;return l!==null?l:Xt.pooledCache}function Hy(l,d){d===null?K(Fc,Fc.current):K(Fc,d.pool)}function l3(){var l=uS();return l===null?null:{parent:In._currentValue,pool:l}}var xd=Error(r(460)),dS=Error(r(474)),qy=Error(r(542)),Wy={then:function(){}};function c3(l){return l=l.status,l==="fulfilled"||l==="rejected"}function u3(l,d,m){switch(m=l[m],m===void 0?l.push(d):m!==d&&(d.then(Fs,Fs),d=m),d.status){case"fulfilled":return d.value;case"rejected":throw l=d.reason,f3(l),l;default:if(typeof d.status=="string")d.then(Fs,Fs);else{if(l=Xt,l!==null&&100<l.shellSuspendCounter)throw Error(r(482));l=d,l.status="pending",l.then(function(b){if(d.status==="pending"){var N=d;N.status="fulfilled",N.value=b}},function(b){if(d.status==="pending"){var N=d;N.status="rejected",N.reason=b}})}switch(d.status){case"fulfilled":return d.value;case"rejected":throw l=d.reason,f3(l),l}throw Bc=d,xd}}function zc(l){try{var d=l._init;return d(l._payload)}catch(m){throw m!==null&&typeof m=="object"&&typeof m.then=="function"?(Bc=m,xd):m}}var Bc=null;function d3(){if(Bc===null)throw Error(r(459));var l=Bc;return Bc=null,l}function f3(l){if(l===xd||l===qy)throw Error(r(483))}var wd=null,ep=0;function Gy(l){var d=ep;return ep+=1,wd===null&&(wd=[]),u3(wd,l,d)}function tp(l,d){d=d.props.ref,l.ref=d!==void 0?d:null}function Jy(l,d){throw d.$$typeof===g?Error(r(525)):(l=Object.prototype.toString.call(d),Error(r(31,l==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":l)))}function h3(l){function d(ae,oe){if(l){var fe=ae.deletions;fe===null?(ae.deletions=[oe],ae.flags|=16):fe.push(oe)}}function m(ae,oe){if(!l)return null;for(;oe!==null;)d(ae,oe),oe=oe.sibling;return null}function b(ae){for(var oe=new Map;ae!==null;)ae.key!==null?oe.set(ae.key,ae):oe.set(ae.index,ae),ae=ae.sibling;return oe}function N(ae,oe){return ae=Bs(ae,oe),ae.index=0,ae.sibling=null,ae}function O(ae,oe,fe){return ae.index=fe,l?(fe=ae.alternate,fe!==null?(fe=fe.index,fe<oe?(ae.flags|=67108866,oe):fe):(ae.flags|=67108866,oe)):(ae.flags|=1048576,oe)}function I(ae){return l&&ae.alternate===null&&(ae.flags|=67108866),ae}function J(ae,oe,fe,we){return oe===null||oe.tag!==6?(oe=Z1(fe,ae.mode,we),oe.return=ae,oe):(oe=N(oe,fe),oe.return=ae,oe)}function ee(ae,oe,fe,we){var et=fe.type;return et===x?be(ae,oe,fe.props.children,we,fe.key):oe!==null&&(oe.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===R&&zc(et)===oe.type)?(oe=N(oe,fe.props),tp(oe,fe),oe.return=ae,oe):(oe=zy(fe.type,fe.key,fe.props,null,ae.mode,we),tp(oe,fe),oe.return=ae,oe)}function he(ae,oe,fe,we){return oe===null||oe.tag!==4||oe.stateNode.containerInfo!==fe.containerInfo||oe.stateNode.implementation!==fe.implementation?(oe=eS(fe,ae.mode,we),oe.return=ae,oe):(oe=N(oe,fe.children||[]),oe.return=ae,oe)}function be(ae,oe,fe,we,et){return oe===null||oe.tag!==7?(oe=Pc(fe,ae.mode,we,et),oe.return=ae,oe):(oe=N(oe,fe),oe.return=ae,oe)}function Se(ae,oe,fe){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return oe=Z1(""+oe,ae.mode,fe),oe.return=ae,oe;if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case y:return fe=zy(oe.type,oe.key,oe.props,null,ae.mode,fe),tp(fe,oe),fe.return=ae,fe;case v:return oe=eS(oe,ae.mode,fe),oe.return=ae,oe;case R:return oe=zc(oe),Se(ae,oe,fe)}if(z(oe)||B(oe))return oe=Pc(oe,ae.mode,fe,null),oe.return=ae,oe;if(typeof oe.then=="function")return Se(ae,Gy(oe),fe);if(oe.$$typeof===_)return Se(ae,Uy(ae,oe),fe);Jy(ae,oe)}return null}function ge(ae,oe,fe,we){var et=oe!==null?oe.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return et!==null?null:J(ae,oe,""+fe,we);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case y:return fe.key===et?ee(ae,oe,fe,we):null;case v:return fe.key===et?he(ae,oe,fe,we):null;case R:return fe=zc(fe),ge(ae,oe,fe,we)}if(z(fe)||B(fe))return et!==null?null:be(ae,oe,fe,we,null);if(typeof fe.then=="function")return ge(ae,oe,Gy(fe),we);if(fe.$$typeof===_)return ge(ae,oe,Uy(ae,fe),we);Jy(ae,fe)}return null}function ye(ae,oe,fe,we,et){if(typeof we=="string"&&we!==""||typeof we=="number"||typeof we=="bigint")return ae=ae.get(fe)||null,J(oe,ae,""+we,et);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case y:return ae=ae.get(we.key===null?fe:we.key)||null,ee(oe,ae,we,et);case v:return ae=ae.get(we.key===null?fe:we.key)||null,he(oe,ae,we,et);case R:return we=zc(we),ye(ae,oe,fe,we,et)}if(z(we)||B(we))return ae=ae.get(fe)||null,be(oe,ae,we,et,null);if(typeof we.then=="function")return ye(ae,oe,fe,Gy(we),et);if(we.$$typeof===_)return ye(ae,oe,fe,Uy(oe,we),et);Jy(oe,we)}return null}function He(ae,oe,fe,we){for(var et=null,Tt=null,Ye=oe,ht=oe=0,St=null;Ye!==null&&ht<fe.length;ht++){Ye.index>ht?(St=Ye,Ye=null):St=Ye.sibling;var $t=ge(ae,Ye,fe[ht],we);if($t===null){Ye===null&&(Ye=St);break}l&&Ye&&$t.alternate===null&&d(ae,Ye),oe=O($t,oe,ht),Tt===null?et=$t:Tt.sibling=$t,Tt=$t,Ye=St}if(ht===fe.length)return m(ae,Ye),Et&&Vs(ae,ht),et;if(Ye===null){for(;ht<fe.length;ht++)Ye=Se(ae,fe[ht],we),Ye!==null&&(oe=O(Ye,oe,ht),Tt===null?et=Ye:Tt.sibling=Ye,Tt=Ye);return Et&&Vs(ae,ht),et}for(Ye=b(Ye);ht<fe.length;ht++)St=ye(Ye,ae,ht,fe[ht],we),St!==null&&(l&&St.alternate!==null&&Ye.delete(St.key===null?ht:St.key),oe=O(St,oe,ht),Tt===null?et=St:Tt.sibling=St,Tt=St);return l&&Ye.forEach(function(jl){return d(ae,jl)}),Et&&Vs(ae,ht),et}function it(ae,oe,fe,we){if(fe==null)throw Error(r(151));for(var et=null,Tt=null,Ye=oe,ht=oe=0,St=null,$t=fe.next();Ye!==null&&!$t.done;ht++,$t=fe.next()){Ye.index>ht?(St=Ye,Ye=null):St=Ye.sibling;var jl=ge(ae,Ye,$t.value,we);if(jl===null){Ye===null&&(Ye=St);break}l&&Ye&&jl.alternate===null&&d(ae,Ye),oe=O(jl,oe,ht),Tt===null?et=jl:Tt.sibling=jl,Tt=jl,Ye=St}if($t.done)return m(ae,Ye),Et&&Vs(ae,ht),et;if(Ye===null){for(;!$t.done;ht++,$t=fe.next())$t=Se(ae,$t.value,we),$t!==null&&(oe=O($t,oe,ht),Tt===null?et=$t:Tt.sibling=$t,Tt=$t);return Et&&Vs(ae,ht),et}for(Ye=b(Ye);!$t.done;ht++,$t=fe.next())$t=ye(Ye,ae,ht,$t.value,we),$t!==null&&(l&&$t.alternate!==null&&Ye.delete($t.key===null?ht:$t.key),oe=O($t,oe,ht),Tt===null?et=$t:Tt.sibling=$t,Tt=$t);return l&&Ye.forEach(function(XY){return d(ae,XY)}),Et&&Vs(ae,ht),et}function Jt(ae,oe,fe,we){if(typeof fe=="object"&&fe!==null&&fe.type===x&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case y:e:{for(var et=fe.key;oe!==null;){if(oe.key===et){if(et=fe.type,et===x){if(oe.tag===7){m(ae,oe.sibling),we=N(oe,fe.props.children),we.return=ae,ae=we;break e}}else if(oe.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===R&&zc(et)===oe.type){m(ae,oe.sibling),we=N(oe,fe.props),tp(we,fe),we.return=ae,ae=we;break e}m(ae,oe);break}else d(ae,oe);oe=oe.sibling}fe.type===x?(we=Pc(fe.props.children,ae.mode,we,fe.key),we.return=ae,ae=we):(we=zy(fe.type,fe.key,fe.props,null,ae.mode,we),tp(we,fe),we.return=ae,ae=we)}return I(ae);case v:e:{for(et=fe.key;oe!==null;){if(oe.key===et)if(oe.tag===4&&oe.stateNode.containerInfo===fe.containerInfo&&oe.stateNode.implementation===fe.implementation){m(ae,oe.sibling),we=N(oe,fe.children||[]),we.return=ae,ae=we;break e}else{m(ae,oe);break}else d(ae,oe);oe=oe.sibling}we=eS(fe,ae.mode,we),we.return=ae,ae=we}return I(ae);case R:return fe=zc(fe),Jt(ae,oe,fe,we)}if(z(fe))return He(ae,oe,fe,we);if(B(fe)){if(et=B(fe),typeof et!="function")throw Error(r(150));return fe=et.call(fe),it(ae,oe,fe,we)}if(typeof fe.then=="function")return Jt(ae,oe,Gy(fe),we);if(fe.$$typeof===_)return Jt(ae,oe,Uy(ae,fe),we);Jy(ae,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint"?(fe=""+fe,oe!==null&&oe.tag===6?(m(ae,oe.sibling),we=N(oe,fe),we.return=ae,ae=we):(m(ae,oe),we=Z1(fe,ae.mode,we),we.return=ae,ae=we),I(ae)):m(ae,oe)}return function(ae,oe,fe,we){try{ep=0;var et=Jt(ae,oe,fe,we);return wd=null,et}catch(Ye){if(Ye===xd||Ye===qy)throw Ye;var Tt=wo(29,Ye,null,ae.mode);return Tt.lanes=we,Tt.return=ae,Tt}finally{}}}var Vc=h3(!0),p3=h3(!1),dl=!1;function fS(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hS(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function fl(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function hl(l,d,m){var b=l.updateQueue;if(b===null)return null;if(b=b.shared,(Mt&2)!==0){var N=b.pending;return N===null?d.next=d:(d.next=N.next,N.next=d),b.pending=d,d=Fy(l),X$(l,null,m),d}return Ly(l,b,d,m),Fy(l)}function np(l,d,m){if(d=d.updateQueue,d!==null&&(d=d.shared,(m&4194048)!==0)){var b=d.lanes;b&=l.pendingLanes,m|=b,d.lanes=m,Ni(l,m)}}function pS(l,d){var m=l.updateQueue,b=l.alternate;if(b!==null&&(b=b.updateQueue,m===b)){var N=null,O=null;if(m=m.firstBaseUpdate,m!==null){do{var I={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};O===null?N=O=I:O=O.next=I,m=m.next}while(m!==null);O===null?N=O=d:O=O.next=d}else N=O=d;m={baseState:b.baseState,firstBaseUpdate:N,lastBaseUpdate:O,shared:b.shared,callbacks:b.callbacks},l.updateQueue=m;return}l=m.lastBaseUpdate,l===null?m.firstBaseUpdate=d:l.next=d,m.lastBaseUpdate=d}var mS=!1;function rp(){if(mS){var l=vd;if(l!==null)throw l}}function op(l,d,m,b){mS=!1;var N=l.updateQueue;dl=!1;var O=N.firstBaseUpdate,I=N.lastBaseUpdate,J=N.shared.pending;if(J!==null){N.shared.pending=null;var ee=J,he=ee.next;ee.next=null,I===null?O=he:I.next=he,I=ee;var be=l.alternate;be!==null&&(be=be.updateQueue,J=be.lastBaseUpdate,J!==I&&(J===null?be.firstBaseUpdate=he:J.next=he,be.lastBaseUpdate=ee))}if(O!==null){var Se=N.baseState;I=0,be=he=ee=null,J=O;do{var ge=J.lane&-536870913,ye=ge!==J.lane;if(ye?(wt&ge)===ge:(b&ge)===ge){ge!==0&&ge===bd&&(mS=!0),be!==null&&(be=be.next={lane:0,tag:J.tag,payload:J.payload,callback:null,next:null});e:{var He=l,it=J;ge=d;var Jt=m;switch(it.tag){case 1:if(He=it.payload,typeof He=="function"){Se=He.call(Jt,Se,ge);break e}Se=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=it.payload,ge=typeof He=="function"?He.call(Jt,Se,ge):He,ge==null)break e;Se=p({},Se,ge);break e;case 2:dl=!0}}ge=J.callback,ge!==null&&(l.flags|=64,ye&&(l.flags|=8192),ye=N.callbacks,ye===null?N.callbacks=[ge]:ye.push(ge))}else ye={lane:ge,tag:J.tag,payload:J.payload,callback:J.callback,next:null},be===null?(he=be=ye,ee=Se):be=be.next=ye,I|=ge;if(J=J.next,J===null){if(J=N.shared.pending,J===null)break;ye=J,J=ye.next,ye.next=null,N.lastBaseUpdate=ye,N.shared.pending=null}}while(!0);be===null&&(ee=Se),N.baseState=ee,N.firstBaseUpdate=he,N.lastBaseUpdate=be,O===null&&(N.shared.lanes=0),bl|=I,l.lanes=I,l.memoizedState=Se}}function m3(l,d){if(typeof l!="function")throw Error(r(191,l));l.call(d)}function g3(l,d){var m=l.callbacks;if(m!==null)for(l.callbacks=null,l=0;l<m.length;l++)m3(m[l],d)}var Sd=D(null),Yy=D(0);function y3(l,d){l=Zs,K(Yy,l),K(Sd,d),Zs=l|d.baseLanes}function gS(){K(Yy,Zs),K(Sd,Sd.current)}function yS(){Zs=Yy.current,W(Sd),W(Yy)}var So=D(null),Qo=null;function pl(l){var d=l.alternate;K($n,$n.current&1),K(So,l),Qo===null&&(d===null||Sd.current!==null||d.memoizedState!==null)&&(Qo=l)}function bS(l){K($n,$n.current),K(So,l),Qo===null&&(Qo=l)}function b3(l){l.tag===22?(K($n,$n.current),K(So,l),Qo===null&&(Qo=l)):ml()}function ml(){K($n,$n.current),K(So,So.current)}function Eo(l){W(So),Qo===l&&(Qo=null),W($n)}var $n=D(0);function Ky(l){for(var d=l;d!==null;){if(d.tag===13){var m=d.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||NE(m)||_E(m)))return d}else if(d.tag===19&&(d.memoizedProps.revealOrder==="forwards"||d.memoizedProps.revealOrder==="backwards"||d.memoizedProps.revealOrder==="unstable_legacy-backwards"||d.memoizedProps.revealOrder==="together")){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var qs=0,dt=null,Wt=null,Ln=null,Xy=!1,Ed=!1,Uc=!1,Qy=0,ip=0,Nd=null,BJ=0;function wn(){throw Error(r(321))}function vS(l,d){if(d===null)return!1;for(var m=0;m<d.length&&m<l.length;m++)if(!xo(l[m],d[m]))return!1;return!0}function xS(l,d,m,b,N,O){return qs=O,dt=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,$.H=l===null||l.memoizedState===null?t5:PS,Uc=!1,O=m(b,N),Uc=!1,Ed&&(O=x3(d,m,b,N)),v3(l),O}function v3(l){$.H=lp;var d=Wt!==null&&Wt.next!==null;if(qs=0,Ln=Wt=dt=null,Xy=!1,ip=0,Nd=null,d)throw Error(r(300));l===null||Fn||(l=l.dependencies,l!==null&&Vy(l)&&(Fn=!0))}function x3(l,d,m,b){dt=l;var N=0;do{if(Ed&&(Nd=null),ip=0,Ed=!1,25<=N)throw Error(r(301));if(N+=1,Ln=Wt=null,l.updateQueue!=null){var O=l.updateQueue;O.lastEffect=null,O.events=null,O.stores=null,O.memoCache!=null&&(O.memoCache.index=0)}$.H=n5,O=d(m,b)}while(Ed);return O}function VJ(){var l=$.H,d=l.useState()[0];return d=typeof d.then=="function"?sp(d):d,l=l.useState()[0],(Wt!==null?Wt.memoizedState:null)!==l&&(dt.flags|=1024),d}function wS(){var l=Qy!==0;return Qy=0,l}function SS(l,d,m){d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~m}function ES(l){if(Xy){for(l=l.memoizedState;l!==null;){var d=l.queue;d!==null&&(d.pending=null),l=l.next}Xy=!1}qs=0,Ln=Wt=dt=null,Ed=!1,ip=Qy=0,Nd=null}function Or(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ln===null?dt.memoizedState=Ln=l:Ln=Ln.next=l,Ln}function Rn(){if(Wt===null){var l=dt.alternate;l=l!==null?l.memoizedState:null}else l=Wt.next;var d=Ln===null?dt.memoizedState:Ln.next;if(d!==null)Ln=d,Wt=l;else{if(l===null)throw dt.alternate===null?Error(r(467)):Error(r(310));Wt=l,l={memoizedState:Wt.memoizedState,baseState:Wt.baseState,baseQueue:Wt.baseQueue,queue:Wt.queue,next:null},Ln===null?dt.memoizedState=Ln=l:Ln=Ln.next=l}return Ln}function Zy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function sp(l){var d=ip;return ip+=1,Nd===null&&(Nd=[]),l=u3(Nd,l,d),d=dt,(Ln===null?d.memoizedState:Ln.next)===null&&(d=d.alternate,$.H=d===null||d.memoizedState===null?t5:PS),l}function e0(l){if(l!==null&&typeof l=="object"){if(typeof l.then=="function")return sp(l);if(l.$$typeof===_)return lr(l)}throw Error(r(438,String(l)))}function NS(l){var d=null,m=dt.updateQueue;if(m!==null&&(d=m.memoCache),d==null){var b=dt.alternate;b!==null&&(b=b.updateQueue,b!==null&&(b=b.memoCache,b!=null&&(d={data:b.data.map(function(N){return N.slice()}),index:0})))}if(d==null&&(d={data:[],index:0}),m===null&&(m=Zy(),dt.updateQueue=m),m.memoCache=d,m=d.data[d.index],m===void 0)for(m=d.data[d.index]=Array(l),b=0;b<l;b++)m[b]=H;return d.index++,m}function Ws(l,d){return typeof d=="function"?d(l):d}function t0(l){var d=Rn();return _S(d,Wt,l)}function _S(l,d,m){var b=l.queue;if(b===null)throw Error(r(311));b.lastRenderedReducer=m;var N=l.baseQueue,O=b.pending;if(O!==null){if(N!==null){var I=N.next;N.next=O.next,O.next=I}d.baseQueue=N=O,b.pending=null}if(O=l.baseState,N===null)l.memoizedState=O;else{d=N.next;var J=I=null,ee=null,he=d,be=!1;do{var Se=he.lane&-536870913;if(Se!==he.lane?(wt&Se)===Se:(qs&Se)===Se){var ge=he.revertLane;if(ge===0)ee!==null&&(ee=ee.next={lane:0,revertLane:0,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),Se===bd&&(be=!0);else if((qs&ge)===ge){he=he.next,ge===bd&&(be=!0);continue}else Se={lane:0,revertLane:he.revertLane,gesture:null,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},ee===null?(J=ee=Se,I=O):ee=ee.next=Se,dt.lanes|=ge,bl|=ge;Se=he.action,Uc&&m(O,Se),O=he.hasEagerState?he.eagerState:m(O,Se)}else ge={lane:Se,revertLane:he.revertLane,gesture:he.gesture,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null},ee===null?(J=ee=ge,I=O):ee=ee.next=ge,dt.lanes|=Se,bl|=Se;he=he.next}while(he!==null&&he!==d);if(ee===null?I=O:ee.next=J,!xo(O,l.memoizedState)&&(Fn=!0,be&&(m=vd,m!==null)))throw m;l.memoizedState=O,l.baseState=I,l.baseQueue=ee,b.lastRenderedState=O}return N===null&&(b.lanes=0),[l.memoizedState,b.dispatch]}function CS(l){var d=Rn(),m=d.queue;if(m===null)throw Error(r(311));m.lastRenderedReducer=l;var b=m.dispatch,N=m.pending,O=d.memoizedState;if(N!==null){m.pending=null;var I=N=N.next;do O=l(O,I.action),I=I.next;while(I!==N);xo(O,d.memoizedState)||(Fn=!0),d.memoizedState=O,d.baseQueue===null&&(d.baseState=O),m.lastRenderedState=O}return[O,b]}function w3(l,d,m){var b=dt,N=Rn(),O=Et;if(O){if(m===void 0)throw Error(r(407));m=m()}else m=d();var I=!xo((Wt||N).memoizedState,m);if(I&&(N.memoizedState=m,Fn=!0),N=N.queue,AS(N3.bind(null,b,N,l),[l]),N.getSnapshot!==d||I||Ln!==null&&Ln.memoizedState.tag&1){if(b.flags|=2048,_d(9,{destroy:void 0},E3.bind(null,b,N,m,d),null),Xt===null)throw Error(r(349));O||(qs&127)!==0||S3(b,d,m)}return m}function S3(l,d,m){l.flags|=16384,l={getSnapshot:d,value:m},d=dt.updateQueue,d===null?(d=Zy(),dt.updateQueue=d,d.stores=[l]):(m=d.stores,m===null?d.stores=[l]:m.push(l))}function E3(l,d,m,b){d.value=m,d.getSnapshot=b,_3(d)&&C3(l)}function N3(l,d,m){return m(function(){_3(d)&&C3(l)})}function _3(l){var d=l.getSnapshot;l=l.value;try{var m=d();return!xo(l,m)}catch{return!0}}function C3(l){var d=Mc(l,2);d!==null&&Kr(d,l,2)}function OS(l){var d=Or();if(typeof l=="function"){var m=l;if(l=m(),Uc){Ut(!0);try{m()}finally{Ut(!1)}}}return d.memoizedState=d.baseState=l,d.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ws,lastRenderedState:l},d}function O3(l,d,m,b){return l.baseState=m,_S(l,Wt,typeof b=="function"?b:Ws)}function UJ(l,d,m,b,N){if(o0(l))throw Error(r(485));if(l=d.action,l!==null){var O={payload:N,action:l,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(I){O.listeners.push(I)}};$.T!==null?m(!0):O.isTransition=!1,b(O),m=d.pending,m===null?(O.next=d.pending=O,j3(d,O)):(O.next=m.next,d.pending=m.next=O)}}function j3(l,d){var m=d.action,b=d.payload,N=l.state;if(d.isTransition){var O=$.T,I={};$.T=I;try{var J=m(N,b),ee=$.S;ee!==null&&ee(I,J),A3(l,d,J)}catch(he){jS(l,d,he)}finally{O!==null&&I.types!==null&&(O.types=I.types),$.T=O}}else try{O=m(N,b),A3(l,d,O)}catch(he){jS(l,d,he)}}function A3(l,d,m){m!==null&&typeof m=="object"&&typeof m.then=="function"?m.then(function(b){T3(l,d,b)},function(b){return jS(l,d,b)}):T3(l,d,m)}function T3(l,d,m){d.status="fulfilled",d.value=m,$3(d),l.state=m,d=l.pending,d!==null&&(m=d.next,m===d?l.pending=null:(m=m.next,d.next=m,j3(l,m)))}function jS(l,d,m){var b=l.pending;if(l.pending=null,b!==null){b=b.next;do d.status="rejected",d.reason=m,$3(d),d=d.next;while(d!==b)}l.action=null}function $3(l){l=l.listeners;for(var d=0;d<l.length;d++)(0,l[d])()}function R3(l,d){return d}function k3(l,d){if(Et){var m=Xt.formState;if(m!==null){e:{var b=dt;if(Et){if(on){t:{for(var N=on,O=Xo;N.nodeType!==8;){if(!O){N=null;break t}if(N=Zo(N.nextSibling),N===null){N=null;break t}}O=N.data,N=O==="F!"||O==="F"?N:null}if(N){on=Zo(N.nextSibling),b=N.data==="F!";break e}}cl(b)}b=!1}b&&(d=m[0])}}return m=Or(),m.memoizedState=m.baseState=d,b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:R3,lastRenderedState:d},m.queue=b,m=Q3.bind(null,dt,b),b.dispatch=m,b=OS(!1),O=MS.bind(null,dt,!1,b.queue),b=Or(),N={state:d,dispatch:null,action:l,pending:null},b.queue=N,m=UJ.bind(null,dt,N,O,m),N.dispatch=m,b.memoizedState=l,[d,m,!1]}function M3(l){var d=Rn();return P3(d,Wt,l)}function P3(l,d,m){if(d=_S(l,d,R3)[0],l=t0(Ws)[0],typeof d=="object"&&d!==null&&typeof d.then=="function")try{var b=sp(d)}catch(I){throw I===xd?qy:I}else b=d;d=Rn();var N=d.queue,O=N.dispatch;return m!==d.memoizedState&&(dt.flags|=2048,_d(9,{destroy:void 0},HJ.bind(null,N,m),null)),[b,O,l]}function HJ(l,d){l.action=d}function D3(l){var d=Rn(),m=Wt;if(m!==null)return P3(d,m,l);Rn(),d=d.memoizedState,m=Rn();var b=m.queue.dispatch;return m.memoizedState=l,[d,b,!1]}function _d(l,d,m,b){return l={tag:l,create:m,deps:b,inst:d,next:null},d=dt.updateQueue,d===null&&(d=Zy(),dt.updateQueue=d),m=d.lastEffect,m===null?d.lastEffect=l.next=l:(b=m.next,m.next=l,l.next=b,d.lastEffect=l),l}function I3(){return Rn().memoizedState}function n0(l,d,m,b){var N=Or();dt.flags|=l,N.memoizedState=_d(1|d,{destroy:void 0},m,b===void 0?null:b)}function r0(l,d,m,b){var N=Rn();b=b===void 0?null:b;var O=N.memoizedState.inst;Wt!==null&&b!==null&&vS(b,Wt.memoizedState.deps)?N.memoizedState=_d(d,O,m,b):(dt.flags|=l,N.memoizedState=_d(1|d,O,m,b))}function L3(l,d){n0(8390656,8,l,d)}function AS(l,d){r0(2048,8,l,d)}function qJ(l){dt.flags|=4;var d=dt.updateQueue;if(d===null)d=Zy(),dt.updateQueue=d,d.events=[l];else{var m=d.events;m===null?d.events=[l]:m.push(l)}}function F3(l){var d=Rn().memoizedState;return qJ({ref:d,nextImpl:l}),function(){if((Mt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}function z3(l,d){return r0(4,2,l,d)}function B3(l,d){return r0(4,4,l,d)}function V3(l,d){if(typeof d=="function"){l=l();var m=d(l);return function(){typeof m=="function"?m():d(null)}}if(d!=null)return l=l(),d.current=l,function(){d.current=null}}function U3(l,d,m){m=m!=null?m.concat([l]):null,r0(4,4,V3.bind(null,d,l),m)}function TS(){}function H3(l,d){var m=Rn();d=d===void 0?null:d;var b=m.memoizedState;return d!==null&&vS(d,b[1])?b[0]:(m.memoizedState=[l,d],l)}function q3(l,d){var m=Rn();d=d===void 0?null:d;var b=m.memoizedState;if(d!==null&&vS(d,b[1]))return b[0];if(b=l(),Uc){Ut(!0);try{l()}finally{Ut(!1)}}return m.memoizedState=[b,d],b}function $S(l,d,m){return m===void 0||(qs&1073741824)!==0&&(wt&261930)===0?l.memoizedState=d:(l.memoizedState=m,l=W5(),dt.lanes|=l,bl|=l,m)}function W3(l,d,m,b){return xo(m,d)?m:Sd.current!==null?(l=$S(l,m,b),xo(l,d)||(Fn=!0),l):(qs&42)===0||(qs&1073741824)!==0&&(wt&261930)===0?(Fn=!0,l.memoizedState=m):(l=W5(),dt.lanes|=l,bl|=l,d)}function G3(l,d,m,b,N){var O=L.p;L.p=O!==0&&8>O?O:8;var I=$.T,J={};$.T=J,MS(l,!1,d,m);try{var ee=N(),he=$.S;if(he!==null&&he(J,ee),ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var be=zJ(ee,b);ap(l,d,be,Co(l))}else ap(l,d,b,Co(l))}catch(Se){ap(l,d,{then:function(){},status:"rejected",reason:Se},Co())}finally{L.p=O,I!==null&&J.types!==null&&(I.types=J.types),$.T=I}}function WJ(){}function RS(l,d,m,b){if(l.tag!==5)throw Error(r(476));var N=J3(l).queue;G3(l,N,d,P,m===null?WJ:function(){return Y3(l),m(b)})}function J3(l){var d=l.memoizedState;if(d!==null)return d;d={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ws,lastRenderedState:P},next:null};var m={};return d.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ws,lastRenderedState:m},next:null},l.memoizedState=d,l=l.alternate,l!==null&&(l.memoizedState=d),d}function Y3(l){var d=J3(l);d.next===null&&(d=l.alternate.memoizedState),ap(l,d.next.queue,{},Co())}function kS(){return lr(Np)}function K3(){return Rn().memoizedState}function X3(){return Rn().memoizedState}function GJ(l){for(var d=l.return;d!==null;){switch(d.tag){case 24:case 3:var m=Co();l=fl(m);var b=hl(d,l,m);b!==null&&(Kr(b,d,m),np(b,d,m)),d={cache:lS()},l.payload=d;return}d=d.return}}function JJ(l,d,m){var b=Co();m={lane:b,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},o0(l)?Z3(d,m):(m=X1(l,d,m,b),m!==null&&(Kr(m,l,b),e5(m,d,b)))}function Q3(l,d,m){var b=Co();ap(l,d,m,b)}function ap(l,d,m,b){var N={lane:b,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null};if(o0(l))Z3(d,N);else{var O=l.alternate;if(l.lanes===0&&(O===null||O.lanes===0)&&(O=d.lastRenderedReducer,O!==null))try{var I=d.lastRenderedState,J=O(I,m);if(N.hasEagerState=!0,N.eagerState=J,xo(J,I))return Ly(l,d,N,0),Xt===null&&Iy(),!1}catch{}finally{}if(m=X1(l,d,N,b),m!==null)return Kr(m,l,b),e5(m,d,b),!0}return!1}function MS(l,d,m,b){if(b={lane:2,revertLane:fE(),gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},o0(l)){if(d)throw Error(r(479))}else d=X1(l,m,b,2),d!==null&&Kr(d,l,2)}function o0(l){var d=l.alternate;return l===dt||d!==null&&d===dt}function Z3(l,d){Ed=Xy=!0;var m=l.pending;m===null?d.next=d:(d.next=m.next,m.next=d),l.pending=d}function e5(l,d,m){if((m&4194048)!==0){var b=d.lanes;b&=l.pendingLanes,m|=b,d.lanes=m,Ni(l,m)}}var lp={readContext:lr,use:e0,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useLayoutEffect:wn,useInsertionEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useSyncExternalStore:wn,useId:wn,useHostTransitionStatus:wn,useFormState:wn,useActionState:wn,useOptimistic:wn,useMemoCache:wn,useCacheRefresh:wn};lp.useEffectEvent=wn;var t5={readContext:lr,use:e0,useCallback:function(l,d){return Or().memoizedState=[l,d===void 0?null:d],l},useContext:lr,useEffect:L3,useImperativeHandle:function(l,d,m){m=m!=null?m.concat([l]):null,n0(4194308,4,V3.bind(null,d,l),m)},useLayoutEffect:function(l,d){return n0(4194308,4,l,d)},useInsertionEffect:function(l,d){n0(4,2,l,d)},useMemo:function(l,d){var m=Or();d=d===void 0?null:d;var b=l();if(Uc){Ut(!0);try{l()}finally{Ut(!1)}}return m.memoizedState=[b,d],b},useReducer:function(l,d,m){var b=Or();if(m!==void 0){var N=m(d);if(Uc){Ut(!0);try{m(d)}finally{Ut(!1)}}}else N=d;return b.memoizedState=b.baseState=N,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:N},b.queue=l,l=l.dispatch=JJ.bind(null,dt,l),[b.memoizedState,l]},useRef:function(l){var d=Or();return l={current:l},d.memoizedState=l},useState:function(l){l=OS(l);var d=l.queue,m=Q3.bind(null,dt,d);return d.dispatch=m,[l.memoizedState,m]},useDebugValue:TS,useDeferredValue:function(l,d){var m=Or();return $S(m,l,d)},useTransition:function(){var l=OS(!1);return l=G3.bind(null,dt,l.queue,!0,!1),Or().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,d,m){var b=dt,N=Or();if(Et){if(m===void 0)throw Error(r(407));m=m()}else{if(m=d(),Xt===null)throw Error(r(349));(wt&127)!==0||S3(b,d,m)}N.memoizedState=m;var O={value:m,getSnapshot:d};return N.queue=O,L3(N3.bind(null,b,O,l),[l]),b.flags|=2048,_d(9,{destroy:void 0},E3.bind(null,b,O,m,d),null),m},useId:function(){var l=Or(),d=Xt.identifierPrefix;if(Et){var m=ds,b=us;m=(b&~(1<<32-nn(b)-1)).toString(32)+m,d="_"+d+"R_"+m,m=Qy++,0<m&&(d+="H"+m.toString(32)),d+="_"}else m=BJ++,d="_"+d+"r_"+m.toString(32)+"_";return l.memoizedState=d},useHostTransitionStatus:kS,useFormState:k3,useActionState:k3,useOptimistic:function(l){var d=Or();d.memoizedState=d.baseState=l;var m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return d.queue=m,d=MS.bind(null,dt,!0,m),m.dispatch=d,[l,d]},useMemoCache:NS,useCacheRefresh:function(){return Or().memoizedState=GJ.bind(null,dt)},useEffectEvent:function(l){var d=Or(),m={impl:l};return d.memoizedState=m,function(){if((Mt&2)!==0)throw Error(r(440));return m.impl.apply(void 0,arguments)}}},PS={readContext:lr,use:e0,useCallback:H3,useContext:lr,useEffect:AS,useImperativeHandle:U3,useInsertionEffect:z3,useLayoutEffect:B3,useMemo:q3,useReducer:t0,useRef:I3,useState:function(){return t0(Ws)},useDebugValue:TS,useDeferredValue:function(l,d){var m=Rn();return W3(m,Wt.memoizedState,l,d)},useTransition:function(){var l=t0(Ws)[0],d=Rn().memoizedState;return[typeof l=="boolean"?l:sp(l),d]},useSyncExternalStore:w3,useId:K3,useHostTransitionStatus:kS,useFormState:M3,useActionState:M3,useOptimistic:function(l,d){var m=Rn();return O3(m,Wt,l,d)},useMemoCache:NS,useCacheRefresh:X3};PS.useEffectEvent=F3;var n5={readContext:lr,use:e0,useCallback:H3,useContext:lr,useEffect:AS,useImperativeHandle:U3,useInsertionEffect:z3,useLayoutEffect:B3,useMemo:q3,useReducer:CS,useRef:I3,useState:function(){return CS(Ws)},useDebugValue:TS,useDeferredValue:function(l,d){var m=Rn();return Wt===null?$S(m,l,d):W3(m,Wt.memoizedState,l,d)},useTransition:function(){var l=CS(Ws)[0],d=Rn().memoizedState;return[typeof l=="boolean"?l:sp(l),d]},useSyncExternalStore:w3,useId:K3,useHostTransitionStatus:kS,useFormState:D3,useActionState:D3,useOptimistic:function(l,d){var m=Rn();return Wt!==null?O3(m,Wt,l,d):(m.baseState=l,[l,m.queue.dispatch])},useMemoCache:NS,useCacheRefresh:X3};n5.useEffectEvent=F3;function DS(l,d,m,b){d=l.memoizedState,m=m(b,d),m=m==null?d:p({},d,m),l.memoizedState=m,l.lanes===0&&(l.updateQueue.baseState=m)}var IS={enqueueSetState:function(l,d,m){l=l._reactInternals;var b=Co(),N=fl(b);N.payload=d,m!=null&&(N.callback=m),d=hl(l,N,b),d!==null&&(Kr(d,l,b),np(d,l,b))},enqueueReplaceState:function(l,d,m){l=l._reactInternals;var b=Co(),N=fl(b);N.tag=1,N.payload=d,m!=null&&(N.callback=m),d=hl(l,N,b),d!==null&&(Kr(d,l,b),np(d,l,b))},enqueueForceUpdate:function(l,d){l=l._reactInternals;var m=Co(),b=fl(m);b.tag=2,d!=null&&(b.callback=d),d=hl(l,b,m),d!==null&&(Kr(d,l,m),np(d,l,m))}};function r5(l,d,m,b,N,O,I){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(b,O,I):d.prototype&&d.prototype.isPureReactComponent?!Jh(m,b)||!Jh(N,O):!0}function o5(l,d,m,b){l=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(m,b),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(m,b),d.state!==l&&IS.enqueueReplaceState(d,d.state,null)}function Hc(l,d){var m=d;if("ref"in d){m={};for(var b in d)b!=="ref"&&(m[b]=d[b])}if(l=l.defaultProps){m===d&&(m=p({},m));for(var N in l)m[N]===void 0&&(m[N]=l[N])}return m}function i5(l){Dy(l)}function s5(l){console.error(l)}function a5(l){Dy(l)}function i0(l,d){try{var m=l.onUncaughtError;m(d.value,{componentStack:d.stack})}catch(b){setTimeout(function(){throw b})}}function l5(l,d,m){try{var b=l.onCaughtError;b(m.value,{componentStack:m.stack,errorBoundary:d.tag===1?d.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function LS(l,d,m){return m=fl(m),m.tag=3,m.payload={element:null},m.callback=function(){i0(l,d)},m}function c5(l){return l=fl(l),l.tag=3,l}function u5(l,d,m,b){var N=m.type.getDerivedStateFromError;if(typeof N=="function"){var O=b.value;l.payload=function(){return N(O)},l.callback=function(){l5(d,m,b)}}var I=m.stateNode;I!==null&&typeof I.componentDidCatch=="function"&&(l.callback=function(){l5(d,m,b),typeof N!="function"&&(vl===null?vl=new Set([this]):vl.add(this));var J=b.stack;this.componentDidCatch(b.value,{componentStack:J!==null?J:""})})}function YJ(l,d,m,b,N){if(m.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){if(d=m.alternate,d!==null&&yd(d,m,N,!0),m=So.current,m!==null){switch(m.tag){case 31:case 13:return Qo===null?y0():m.alternate===null&&Sn===0&&(Sn=3),m.flags&=-257,m.flags|=65536,m.lanes=N,b===Wy?m.flags|=16384:(d=m.updateQueue,d===null?m.updateQueue=new Set([b]):d.add(b),cE(l,b,N)),!1;case 22:return m.flags|=65536,b===Wy?m.flags|=16384:(d=m.updateQueue,d===null?(d={transitions:null,markerInstances:null,retryQueue:new Set([b])},m.updateQueue=d):(m=d.retryQueue,m===null?d.retryQueue=new Set([b]):m.add(b)),cE(l,b,N)),!1}throw Error(r(435,m.tag))}return cE(l,b,N),y0(),!1}if(Et)return d=So.current,d!==null?((d.flags&65536)===0&&(d.flags|=256),d.flags|=65536,d.lanes=N,b!==rS&&(l=Error(r(422),{cause:b}),Xh(Jo(l,m)))):(b!==rS&&(d=Error(r(423),{cause:b}),Xh(Jo(d,m))),l=l.current.alternate,l.flags|=65536,N&=-N,l.lanes|=N,b=Jo(b,m),N=LS(l.stateNode,b,N),pS(l,N),Sn!==4&&(Sn=2)),!1;var O=Error(r(520),{cause:b});if(O=Jo(O,m),gp===null?gp=[O]:gp.push(O),Sn!==4&&(Sn=2),d===null)return!0;b=Jo(b,m),m=d;do{switch(m.tag){case 3:return m.flags|=65536,l=N&-N,m.lanes|=l,l=LS(m.stateNode,b,l),pS(m,l),!1;case 1:if(d=m.type,O=m.stateNode,(m.flags&128)===0&&(typeof d.getDerivedStateFromError=="function"||O!==null&&typeof O.componentDidCatch=="function"&&(vl===null||!vl.has(O))))return m.flags|=65536,N&=-N,m.lanes|=N,N=c5(N),u5(N,l,m,b),pS(m,N),!1}m=m.return}while(m!==null);return!1}var FS=Error(r(461)),Fn=!1;function cr(l,d,m,b){d.child=l===null?p3(d,null,m,b):Vc(d,l.child,m,b)}function d5(l,d,m,b,N){m=m.render;var O=d.ref;if("ref"in b){var I={};for(var J in b)J!=="ref"&&(I[J]=b[J])}else I=b;return Lc(d),b=xS(l,d,m,I,O,N),J=wS(),l!==null&&!Fn?(SS(l,d,N),Gs(l,d,N)):(Et&&J&&tS(d),d.flags|=1,cr(l,d,b,N),d.child)}function f5(l,d,m,b,N){if(l===null){var O=m.type;return typeof O=="function"&&!Q1(O)&&O.defaultProps===void 0&&m.compare===null?(d.tag=15,d.type=O,h5(l,d,O,b,N)):(l=zy(m.type,null,b,d,d.mode,N),l.ref=d.ref,l.return=d,d.child=l)}if(O=l.child,!GS(l,N)){var I=O.memoizedProps;if(m=m.compare,m=m!==null?m:Jh,m(I,b)&&l.ref===d.ref)return Gs(l,d,N)}return d.flags|=1,l=Bs(O,b),l.ref=d.ref,l.return=d,d.child=l}function h5(l,d,m,b,N){if(l!==null){var O=l.memoizedProps;if(Jh(O,b)&&l.ref===d.ref)if(Fn=!1,d.pendingProps=b=O,GS(l,N))(l.flags&131072)!==0&&(Fn=!0);else return d.lanes=l.lanes,Gs(l,d,N)}return zS(l,d,m,b,N)}function p5(l,d,m,b){var N=b.children,O=l!==null?l.memoizedState:null;if(l===null&&d.stateNode===null&&(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),b.mode==="hidden"){if((d.flags&128)!==0){if(O=O!==null?O.baseLanes|m:m,l!==null){for(b=d.child=l.child,N=0;b!==null;)N=N|b.lanes|b.childLanes,b=b.sibling;b=N&~O}else b=0,d.child=null;return m5(l,d,O,m,b)}if((m&536870912)!==0)d.memoizedState={baseLanes:0,cachePool:null},l!==null&&Hy(d,O!==null?O.cachePool:null),O!==null?y3(d,O):gS(),b3(d);else return b=d.lanes=536870912,m5(l,d,O!==null?O.baseLanes|m:m,m,b)}else O!==null?(Hy(d,O.cachePool),y3(d,O),ml(),d.memoizedState=null):(l!==null&&Hy(d,null),gS(),ml());return cr(l,d,N,m),d.child}function cp(l,d){return l!==null&&l.tag===22||d.stateNode!==null||(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.sibling}function m5(l,d,m,b,N){var O=uS();return O=O===null?null:{parent:In._currentValue,pool:O},d.memoizedState={baseLanes:m,cachePool:O},l!==null&&Hy(d,null),gS(),b3(d),l!==null&&yd(l,d,b,!0),d.childLanes=N,null}function s0(l,d){return d=l0({mode:d.mode,children:d.children},l.mode),d.ref=l.ref,l.child=d,d.return=l,d}function g5(l,d,m){return Vc(d,l.child,null,m),l=s0(d,d.pendingProps),l.flags|=2,Eo(d),d.memoizedState=null,l}function KJ(l,d,m){var b=d.pendingProps,N=(d.flags&128)!==0;if(d.flags&=-129,l===null){if(Et){if(b.mode==="hidden")return l=s0(d,b),d.lanes=536870912,cp(null,l);if(bS(d),(l=on)?(l=j4(l,Xo),l=l!==null&&l.data==="&"?l:null,l!==null&&(d.memoizedState={dehydrated:l,treeContext:al!==null?{id:us,overflow:ds}:null,retryLane:536870912,hydrationErrors:null},m=Z$(l),m.return=d,d.child=m,ar=d,on=null)):l=null,l===null)throw cl(d);return d.lanes=536870912,null}return s0(d,b)}var O=l.memoizedState;if(O!==null){var I=O.dehydrated;if(bS(d),N)if(d.flags&256)d.flags&=-257,d=g5(l,d,m);else if(d.memoizedState!==null)d.child=l.child,d.flags|=128,d=null;else throw Error(r(558));else if(Fn||yd(l,d,m,!1),N=(m&l.childLanes)!==0,Fn||N){if(b=Xt,b!==null&&(I=Qa(b,m),I!==0&&I!==O.retryLane))throw O.retryLane=I,Mc(l,I),Kr(b,l,I),FS;y0(),d=g5(l,d,m)}else l=O.treeContext,on=Zo(I.nextSibling),ar=d,Et=!0,ll=null,Xo=!1,l!==null&&n3(d,l),d=s0(d,b),d.flags|=4096;return d}return l=Bs(l.child,{mode:b.mode,children:b.children}),l.ref=d.ref,d.child=l,l.return=d,l}function a0(l,d){var m=d.ref;if(m===null)l!==null&&l.ref!==null&&(d.flags|=4194816);else{if(typeof m!="function"&&typeof m!="object")throw Error(r(284));(l===null||l.ref!==m)&&(d.flags|=4194816)}}function zS(l,d,m,b,N){return Lc(d),m=xS(l,d,m,b,void 0,N),b=wS(),l!==null&&!Fn?(SS(l,d,N),Gs(l,d,N)):(Et&&b&&tS(d),d.flags|=1,cr(l,d,m,N),d.child)}function y5(l,d,m,b,N,O){return Lc(d),d.updateQueue=null,m=x3(d,b,m,N),v3(l),b=wS(),l!==null&&!Fn?(SS(l,d,O),Gs(l,d,O)):(Et&&b&&tS(d),d.flags|=1,cr(l,d,m,O),d.child)}function b5(l,d,m,b,N){if(Lc(d),d.stateNode===null){var O=hd,I=m.contextType;typeof I=="object"&&I!==null&&(O=lr(I)),O=new m(b,O),d.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,O.updater=IS,d.stateNode=O,O._reactInternals=d,O=d.stateNode,O.props=b,O.state=d.memoizedState,O.refs={},fS(d),I=m.contextType,O.context=typeof I=="object"&&I!==null?lr(I):hd,O.state=d.memoizedState,I=m.getDerivedStateFromProps,typeof I=="function"&&(DS(d,m,I,b),O.state=d.memoizedState),typeof m.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(I=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),I!==O.state&&IS.enqueueReplaceState(O,O.state,null),op(d,b,O,N),rp(),O.state=d.memoizedState),typeof O.componentDidMount=="function"&&(d.flags|=4194308),b=!0}else if(l===null){O=d.stateNode;var J=d.memoizedProps,ee=Hc(m,J);O.props=ee;var he=O.context,be=m.contextType;I=hd,typeof be=="object"&&be!==null&&(I=lr(be));var Se=m.getDerivedStateFromProps;be=typeof Se=="function"||typeof O.getSnapshotBeforeUpdate=="function",J=d.pendingProps!==J,be||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(J||he!==I)&&o5(d,O,b,I),dl=!1;var ge=d.memoizedState;O.state=ge,op(d,b,O,N),rp(),he=d.memoizedState,J||ge!==he||dl?(typeof Se=="function"&&(DS(d,m,Se,b),he=d.memoizedState),(ee=dl||r5(d,m,ee,b,ge,he,I))?(be||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(d.flags|=4194308)):(typeof O.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=b,d.memoizedState=he),O.props=b,O.state=he,O.context=I,b=ee):(typeof O.componentDidMount=="function"&&(d.flags|=4194308),b=!1)}else{O=d.stateNode,hS(l,d),I=d.memoizedProps,be=Hc(m,I),O.props=be,Se=d.pendingProps,ge=O.context,he=m.contextType,ee=hd,typeof he=="object"&&he!==null&&(ee=lr(he)),J=m.getDerivedStateFromProps,(he=typeof J=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(I!==Se||ge!==ee)&&o5(d,O,b,ee),dl=!1,ge=d.memoizedState,O.state=ge,op(d,b,O,N),rp();var ye=d.memoizedState;I!==Se||ge!==ye||dl||l!==null&&l.dependencies!==null&&Vy(l.dependencies)?(typeof J=="function"&&(DS(d,m,J,b),ye=d.memoizedState),(be=dl||r5(d,m,be,b,ge,ye,ee)||l!==null&&l.dependencies!==null&&Vy(l.dependencies))?(he||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(b,ye,ee),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(b,ye,ee)),typeof O.componentDidUpdate=="function"&&(d.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof O.componentDidUpdate!="function"||I===l.memoizedProps&&ge===l.memoizedState||(d.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||I===l.memoizedProps&&ge===l.memoizedState||(d.flags|=1024),d.memoizedProps=b,d.memoizedState=ye),O.props=b,O.state=ye,O.context=ee,b=be):(typeof O.componentDidUpdate!="function"||I===l.memoizedProps&&ge===l.memoizedState||(d.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||I===l.memoizedProps&&ge===l.memoizedState||(d.flags|=1024),b=!1)}return O=b,a0(l,d),b=(d.flags&128)!==0,O||b?(O=d.stateNode,m=b&&typeof m.getDerivedStateFromError!="function"?null:O.render(),d.flags|=1,l!==null&&b?(d.child=Vc(d,l.child,null,N),d.child=Vc(d,null,m,N)):cr(l,d,m,N),d.memoizedState=O.state,l=d.child):l=Gs(l,d,N),l}function v5(l,d,m,b){return Dc(),d.flags|=256,cr(l,d,m,b),d.child}var BS={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function VS(l){return{baseLanes:l,cachePool:l3()}}function US(l,d,m){return l=l!==null?l.childLanes&~m:0,d&&(l|=_o),l}function x5(l,d,m){var b=d.pendingProps,N=!1,O=(d.flags&128)!==0,I;if((I=O)||(I=l!==null&&l.memoizedState===null?!1:($n.current&2)!==0),I&&(N=!0,d.flags&=-129),I=(d.flags&32)!==0,d.flags&=-33,l===null){if(Et){if(N?pl(d):ml(),(l=on)?(l=j4(l,Xo),l=l!==null&&l.data!=="&"?l:null,l!==null&&(d.memoizedState={dehydrated:l,treeContext:al!==null?{id:us,overflow:ds}:null,retryLane:536870912,hydrationErrors:null},m=Z$(l),m.return=d,d.child=m,ar=d,on=null)):l=null,l===null)throw cl(d);return _E(l)?d.lanes=32:d.lanes=536870912,null}var J=b.children;return b=b.fallback,N?(ml(),N=d.mode,J=l0({mode:"hidden",children:J},N),b=Pc(b,N,m,null),J.return=d,b.return=d,J.sibling=b,d.child=J,b=d.child,b.memoizedState=VS(m),b.childLanes=US(l,I,m),d.memoizedState=BS,cp(null,b)):(pl(d),HS(d,J))}var ee=l.memoizedState;if(ee!==null&&(J=ee.dehydrated,J!==null)){if(O)d.flags&256?(pl(d),d.flags&=-257,d=qS(l,d,m)):d.memoizedState!==null?(ml(),d.child=l.child,d.flags|=128,d=null):(ml(),J=b.fallback,N=d.mode,b=l0({mode:"visible",children:b.children},N),J=Pc(J,N,m,null),J.flags|=2,b.return=d,J.return=d,b.sibling=J,d.child=b,Vc(d,l.child,null,m),b=d.child,b.memoizedState=VS(m),b.childLanes=US(l,I,m),d.memoizedState=BS,d=cp(null,b));else if(pl(d),_E(J)){if(I=J.nextSibling&&J.nextSibling.dataset,I)var he=I.dgst;I=he,b=Error(r(419)),b.stack="",b.digest=I,Xh({value:b,source:null,stack:null}),d=qS(l,d,m)}else if(Fn||yd(l,d,m,!1),I=(m&l.childLanes)!==0,Fn||I){if(I=Xt,I!==null&&(b=Qa(I,m),b!==0&&b!==ee.retryLane))throw ee.retryLane=b,Mc(l,b),Kr(I,l,b),FS;NE(J)||y0(),d=qS(l,d,m)}else NE(J)?(d.flags|=192,d.child=l.child,d=null):(l=ee.treeContext,on=Zo(J.nextSibling),ar=d,Et=!0,ll=null,Xo=!1,l!==null&&n3(d,l),d=HS(d,b.children),d.flags|=4096);return d}return N?(ml(),J=b.fallback,N=d.mode,ee=l.child,he=ee.sibling,b=Bs(ee,{mode:"hidden",children:b.children}),b.subtreeFlags=ee.subtreeFlags&65011712,he!==null?J=Bs(he,J):(J=Pc(J,N,m,null),J.flags|=2),J.return=d,b.return=d,b.sibling=J,d.child=b,cp(null,b),b=d.child,J=l.child.memoizedState,J===null?J=VS(m):(N=J.cachePool,N!==null?(ee=In._currentValue,N=N.parent!==ee?{parent:ee,pool:ee}:N):N=l3(),J={baseLanes:J.baseLanes|m,cachePool:N}),b.memoizedState=J,b.childLanes=US(l,I,m),d.memoizedState=BS,cp(l.child,b)):(pl(d),m=l.child,l=m.sibling,m=Bs(m,{mode:"visible",children:b.children}),m.return=d,m.sibling=null,l!==null&&(I=d.deletions,I===null?(d.deletions=[l],d.flags|=16):I.push(l)),d.child=m,d.memoizedState=null,m)}function HS(l,d){return d=l0({mode:"visible",children:d},l.mode),d.return=l,l.child=d}function l0(l,d){return l=wo(22,l,null,d),l.lanes=0,l}function qS(l,d,m){return Vc(d,l.child,null,m),l=HS(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function w5(l,d,m){l.lanes|=d;var b=l.alternate;b!==null&&(b.lanes|=d),sS(l.return,d,m)}function WS(l,d,m,b,N,O){var I=l.memoizedState;I===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:b,tail:m,tailMode:N,treeForkCount:O}:(I.isBackwards=d,I.rendering=null,I.renderingStartTime=0,I.last=b,I.tail=m,I.tailMode=N,I.treeForkCount=O)}function S5(l,d,m){var b=d.pendingProps,N=b.revealOrder,O=b.tail;b=b.children;var I=$n.current,J=(I&2)!==0;if(J?(I=I&1|2,d.flags|=128):I&=1,K($n,I),cr(l,d,b,m),b=Et?Kh:0,!J&&l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&w5(l,m,d);else if(l.tag===19)w5(l,m,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}switch(N){case"forwards":for(m=d.child,N=null;m!==null;)l=m.alternate,l!==null&&Ky(l)===null&&(N=m),m=m.sibling;m=N,m===null?(N=d.child,d.child=null):(N=m.sibling,m.sibling=null),WS(d,!1,N,m,O,b);break;case"backwards":case"unstable_legacy-backwards":for(m=null,N=d.child,d.child=null;N!==null;){if(l=N.alternate,l!==null&&Ky(l)===null){d.child=N;break}l=N.sibling,N.sibling=m,m=N,N=l}WS(d,!0,m,null,O,b);break;case"together":WS(d,!1,null,null,void 0,b);break;default:d.memoizedState=null}return d.child}function Gs(l,d,m){if(l!==null&&(d.dependencies=l.dependencies),bl|=d.lanes,(m&d.childLanes)===0)if(l!==null){if(yd(l,d,m,!1),(m&d.childLanes)===0)return null}else return null;if(l!==null&&d.child!==l.child)throw Error(r(153));if(d.child!==null){for(l=d.child,m=Bs(l,l.pendingProps),d.child=m,m.return=d;l.sibling!==null;)l=l.sibling,m=m.sibling=Bs(l,l.pendingProps),m.return=d;m.sibling=null}return d.child}function GS(l,d){return(l.lanes&d)!==0?!0:(l=l.dependencies,!!(l!==null&&Vy(l)))}function XJ(l,d,m){switch(d.tag){case 3:se(d,d.stateNode.containerInfo),ul(d,In,l.memoizedState.cache),Dc();break;case 27:case 5:xe(d);break;case 4:se(d,d.stateNode.containerInfo);break;case 10:ul(d,d.type,d.memoizedProps.value);break;case 31:if(d.memoizedState!==null)return d.flags|=128,bS(d),null;break;case 13:var b=d.memoizedState;if(b!==null)return b.dehydrated!==null?(pl(d),d.flags|=128,null):(m&d.child.childLanes)!==0?x5(l,d,m):(pl(d),l=Gs(l,d,m),l!==null?l.sibling:null);pl(d);break;case 19:var N=(l.flags&128)!==0;if(b=(m&d.childLanes)!==0,b||(yd(l,d,m,!1),b=(m&d.childLanes)!==0),N){if(b)return S5(l,d,m);d.flags|=128}if(N=d.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),K($n,$n.current),b)break;return null;case 22:return d.lanes=0,p5(l,d,m,d.pendingProps);case 24:ul(d,In,l.memoizedState.cache)}return Gs(l,d,m)}function E5(l,d,m){if(l!==null)if(l.memoizedProps!==d.pendingProps)Fn=!0;else{if(!GS(l,m)&&(d.flags&128)===0)return Fn=!1,XJ(l,d,m);Fn=(l.flags&131072)!==0}else Fn=!1,Et&&(d.flags&1048576)!==0&&t3(d,Kh,d.index);switch(d.lanes=0,d.tag){case 16:e:{var b=d.pendingProps;if(l=zc(d.elementType),d.type=l,typeof l=="function")Q1(l)?(b=Hc(l,b),d.tag=1,d=b5(null,d,l,b,m)):(d.tag=0,d=zS(null,d,l,b,m));else{if(l!=null){var N=l.$$typeof;if(N===j){d.tag=11,d=d5(null,d,l,b,m);break e}else if(N===k){d.tag=14,d=f5(null,d,l,b,m);break e}}throw d=M(l)||l,Error(r(306,d,""))}}return d;case 0:return zS(l,d,d.type,d.pendingProps,m);case 1:return b=d.type,N=Hc(b,d.pendingProps),b5(l,d,b,N,m);case 3:e:{if(se(d,d.stateNode.containerInfo),l===null)throw Error(r(387));b=d.pendingProps;var O=d.memoizedState;N=O.element,hS(l,d),op(d,b,null,m);var I=d.memoizedState;if(b=I.cache,ul(d,In,b),b!==O.cache&&aS(d,[In],m,!0),rp(),b=I.element,O.isDehydrated)if(O={element:b,isDehydrated:!1,cache:I.cache},d.updateQueue.baseState=O,d.memoizedState=O,d.flags&256){d=v5(l,d,b,m);break e}else if(b!==N){N=Jo(Error(r(424)),d),Xh(N),d=v5(l,d,b,m);break e}else{switch(l=d.stateNode.containerInfo,l.nodeType){case 9:l=l.body;break;default:l=l.nodeName==="HTML"?l.ownerDocument.body:l}for(on=Zo(l.firstChild),ar=d,Et=!0,ll=null,Xo=!0,m=p3(d,null,b,m),d.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling}else{if(Dc(),b===N){d=Gs(l,d,m);break e}cr(l,d,b,m)}d=d.child}return d;case 26:return a0(l,d),l===null?(m=M4(d.type,null,d.pendingProps,null))?d.memoizedState=m:Et||(m=d.type,l=d.pendingProps,b=N0(pe.current).createElement(m),b[Tn]=d,b[er]=l,ur(b,m,l),Dn(b),d.stateNode=b):d.memoizedState=M4(d.type,l.memoizedProps,d.pendingProps,l.memoizedState),null;case 27:return xe(d),l===null&&Et&&(b=d.stateNode=$4(d.type,d.pendingProps,pe.current),ar=d,Xo=!0,N=on,El(d.type)?(CE=N,on=Zo(b.firstChild)):on=N),cr(l,d,d.pendingProps.children,m),a0(l,d),l===null&&(d.flags|=4194304),d.child;case 5:return l===null&&Et&&((N=b=on)&&(b=OY(b,d.type,d.pendingProps,Xo),b!==null?(d.stateNode=b,ar=d,on=Zo(b.firstChild),Xo=!1,N=!0):N=!1),N||cl(d)),xe(d),N=d.type,O=d.pendingProps,I=l!==null?l.memoizedProps:null,b=O.children,wE(N,O)?b=null:I!==null&&wE(N,I)&&(d.flags|=32),d.memoizedState!==null&&(N=xS(l,d,VJ,null,null,m),Np._currentValue=N),a0(l,d),cr(l,d,b,m),d.child;case 6:return l===null&&Et&&((l=m=on)&&(m=jY(m,d.pendingProps,Xo),m!==null?(d.stateNode=m,ar=d,on=null,l=!0):l=!1),l||cl(d)),null;case 13:return x5(l,d,m);case 4:return se(d,d.stateNode.containerInfo),b=d.pendingProps,l===null?d.child=Vc(d,null,b,m):cr(l,d,b,m),d.child;case 11:return d5(l,d,d.type,d.pendingProps,m);case 7:return cr(l,d,d.pendingProps,m),d.child;case 8:return cr(l,d,d.pendingProps.children,m),d.child;case 12:return cr(l,d,d.pendingProps.children,m),d.child;case 10:return b=d.pendingProps,ul(d,d.type,b.value),cr(l,d,b.children,m),d.child;case 9:return N=d.type._context,b=d.pendingProps.children,Lc(d),N=lr(N),b=b(N),d.flags|=1,cr(l,d,b,m),d.child;case 14:return f5(l,d,d.type,d.pendingProps,m);case 15:return h5(l,d,d.type,d.pendingProps,m);case 19:return S5(l,d,m);case 31:return KJ(l,d,m);case 22:return p5(l,d,m,d.pendingProps);case 24:return Lc(d),b=lr(In),l===null?(N=uS(),N===null&&(N=Xt,O=lS(),N.pooledCache=O,O.refCount++,O!==null&&(N.pooledCacheLanes|=m),N=O),d.memoizedState={parent:b,cache:N},fS(d),ul(d,In,N)):((l.lanes&m)!==0&&(hS(l,d),op(d,null,null,m),rp()),N=l.memoizedState,O=d.memoizedState,N.parent!==b?(N={parent:b,cache:b},d.memoizedState=N,d.lanes===0&&(d.memoizedState=d.updateQueue.baseState=N),ul(d,In,b)):(b=O.cache,ul(d,In,b),b!==N.cache&&aS(d,[In],m,!0))),cr(l,d,d.pendingProps.children,m),d.child;case 29:throw d.pendingProps}throw Error(r(156,d.tag))}function Js(l){l.flags|=4}function JS(l,d,m,b,N){if((d=(l.mode&32)!==0)&&(d=!1),d){if(l.flags|=16777216,(N&335544128)===N)if(l.stateNode.complete)l.flags|=8192;else if(K5())l.flags|=8192;else throw Bc=Wy,dS}else l.flags&=-16777217}function N5(l,d){if(d.type!=="stylesheet"||(d.state.loading&4)!==0)l.flags&=-16777217;else if(l.flags|=16777216,!F4(d))if(K5())l.flags|=8192;else throw Bc=Wy,dS}function c0(l,d){d!==null&&(l.flags|=4),l.flags&16384&&(d=l.tag!==22?Xu():536870912,l.lanes|=d,Ad|=d)}function up(l,d){if(!Et)switch(l.tailMode){case"hidden":d=l.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?l.tail=null:m.sibling=null;break;case"collapsed":m=l.tail;for(var b=null;m!==null;)m.alternate!==null&&(b=m),m=m.sibling;b===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:b.sibling=null}}function sn(l){var d=l.alternate!==null&&l.alternate.child===l.child,m=0,b=0;if(d)for(var N=l.child;N!==null;)m|=N.lanes|N.childLanes,b|=N.subtreeFlags&65011712,b|=N.flags&65011712,N.return=l,N=N.sibling;else for(N=l.child;N!==null;)m|=N.lanes|N.childLanes,b|=N.subtreeFlags,b|=N.flags,N.return=l,N=N.sibling;return l.subtreeFlags|=b,l.childLanes=m,d}function QJ(l,d,m){var b=d.pendingProps;switch(nS(d),d.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return sn(d),null;case 1:return sn(d),null;case 3:return m=d.stateNode,b=null,l!==null&&(b=l.memoizedState.cache),d.memoizedState.cache!==b&&(d.flags|=2048),Hs(In),me(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(l===null||l.child===null)&&(gd(d)?Js(d):l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,oS())),sn(d),null;case 26:var N=d.type,O=d.memoizedState;return l===null?(Js(d),O!==null?(sn(d),N5(d,O)):(sn(d),JS(d,N,null,b,m))):O?O!==l.memoizedState?(Js(d),sn(d),N5(d,O)):(sn(d),d.flags&=-16777217):(l=l.memoizedProps,l!==b&&Js(d),sn(d),JS(d,N,l,b,m)),null;case 27:if(je(d),m=pe.current,N=d.type,l!==null&&d.stateNode!=null)l.memoizedProps!==b&&Js(d);else{if(!b){if(d.stateNode===null)throw Error(r(166));return sn(d),null}l=Q.current,gd(d)?r3(d):(l=$4(N,b,m),d.stateNode=l,Js(d))}return sn(d),null;case 5:if(je(d),N=d.type,l!==null&&d.stateNode!=null)l.memoizedProps!==b&&Js(d);else{if(!b){if(d.stateNode===null)throw Error(r(166));return sn(d),null}if(O=Q.current,gd(d))r3(d);else{var I=N0(pe.current);switch(O){case 1:O=I.createElementNS("http://www.w3.org/2000/svg",N);break;case 2:O=I.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;default:switch(N){case"svg":O=I.createElementNS("http://www.w3.org/2000/svg",N);break;case"math":O=I.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;case"script":O=I.createElement("div"),O.innerHTML="<script><\/script>",O=O.removeChild(O.firstChild);break;case"select":O=typeof b.is=="string"?I.createElement("select",{is:b.is}):I.createElement("select"),b.multiple?O.multiple=!0:b.size&&(O.size=b.size);break;default:O=typeof b.is=="string"?I.createElement(N,{is:b.is}):I.createElement(N)}}O[Tn]=d,O[er]=b;e:for(I=d.child;I!==null;){if(I.tag===5||I.tag===6)O.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===d)break e;for(;I.sibling===null;){if(I.return===null||I.return===d)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}d.stateNode=O;e:switch(ur(O,N,b),N){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}b&&Js(d)}}return sn(d),JS(d,d.type,l===null?null:l.memoizedProps,d.pendingProps,m),null;case 6:if(l&&d.stateNode!=null)l.memoizedProps!==b&&Js(d);else{if(typeof b!="string"&&d.stateNode===null)throw Error(r(166));if(l=pe.current,gd(d)){if(l=d.stateNode,m=d.memoizedProps,b=null,N=ar,N!==null)switch(N.tag){case 27:case 5:b=N.memoizedProps}l[Tn]=d,l=!!(l.nodeValue===m||b!==null&&b.suppressHydrationWarning===!0||x4(l.nodeValue,m)),l||cl(d,!0)}else l=N0(l).createTextNode(b),l[Tn]=d,d.stateNode=l}return sn(d),null;case 31:if(m=d.memoizedState,l===null||l.memoizedState!==null){if(b=gd(d),m!==null){if(l===null){if(!b)throw Error(r(318));if(l=d.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(r(557));l[Tn]=d}else Dc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;sn(d),l=!1}else m=oS(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=m),l=!0;if(!l)return d.flags&256?(Eo(d),d):(Eo(d),null);if((d.flags&128)!==0)throw Error(r(558))}return sn(d),null;case 13:if(b=d.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(N=gd(d),b!==null&&b.dehydrated!==null){if(l===null){if(!N)throw Error(r(318));if(N=d.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(r(317));N[Tn]=d}else Dc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;sn(d),N=!1}else N=oS(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=N),N=!0;if(!N)return d.flags&256?(Eo(d),d):(Eo(d),null)}return Eo(d),(d.flags&128)!==0?(d.lanes=m,d):(m=b!==null,l=l!==null&&l.memoizedState!==null,m&&(b=d.child,N=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(N=b.alternate.memoizedState.cachePool.pool),O=null,b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(O=b.memoizedState.cachePool.pool),O!==N&&(b.flags|=2048)),m!==l&&m&&(d.child.flags|=8192),c0(d,d.updateQueue),sn(d),null);case 4:return me(),l===null&&gE(d.stateNode.containerInfo),sn(d),null;case 10:return Hs(d.type),sn(d),null;case 19:if(W($n),b=d.memoizedState,b===null)return sn(d),null;if(N=(d.flags&128)!==0,O=b.rendering,O===null)if(N)up(b,!1);else{if(Sn!==0||l!==null&&(l.flags&128)!==0)for(l=d.child;l!==null;){if(O=Ky(l),O!==null){for(d.flags|=128,up(b,!1),l=O.updateQueue,d.updateQueue=l,c0(d,l),d.subtreeFlags=0,l=m,m=d.child;m!==null;)Q$(m,l),m=m.sibling;return K($n,$n.current&1|2),Et&&Vs(d,b.treeForkCount),d.child}l=l.sibling}b.tail!==null&&te()>p0&&(d.flags|=128,N=!0,up(b,!1),d.lanes=4194304)}else{if(!N)if(l=Ky(O),l!==null){if(d.flags|=128,N=!0,l=l.updateQueue,d.updateQueue=l,c0(d,l),up(b,!0),b.tail===null&&b.tailMode==="hidden"&&!O.alternate&&!Et)return sn(d),null}else 2*te()-b.renderingStartTime>p0&&m!==536870912&&(d.flags|=128,N=!0,up(b,!1),d.lanes=4194304);b.isBackwards?(O.sibling=d.child,d.child=O):(l=b.last,l!==null?l.sibling=O:d.child=O,b.last=O)}return b.tail!==null?(l=b.tail,b.rendering=l,b.tail=l.sibling,b.renderingStartTime=te(),l.sibling=null,m=$n.current,K($n,N?m&1|2:m&1),Et&&Vs(d,b.treeForkCount),l):(sn(d),null);case 22:case 23:return Eo(d),yS(),b=d.memoizedState!==null,l!==null?l.memoizedState!==null!==b&&(d.flags|=8192):b&&(d.flags|=8192),b?(m&536870912)!==0&&(d.flags&128)===0&&(sn(d),d.subtreeFlags&6&&(d.flags|=8192)):sn(d),m=d.updateQueue,m!==null&&c0(d,m.retryQueue),m=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),b=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(b=d.memoizedState.cachePool.pool),b!==m&&(d.flags|=2048),l!==null&&W(Fc),null;case 24:return m=null,l!==null&&(m=l.memoizedState.cache),d.memoizedState.cache!==m&&(d.flags|=2048),Hs(In),sn(d),null;case 25:return null;case 30:return null}throw Error(r(156,d.tag))}function ZJ(l,d){switch(nS(d),d.tag){case 1:return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Hs(In),me(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 26:case 27:case 5:return je(d),null;case 31:if(d.memoizedState!==null){if(Eo(d),d.alternate===null)throw Error(r(340));Dc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 13:if(Eo(d),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(r(340));Dc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return W($n),null;case 4:return me(),null;case 10:return Hs(d.type),null;case 22:case 23:return Eo(d),yS(),l!==null&&W(Fc),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 24:return Hs(In),null;case 25:return null;default:return null}}function _5(l,d){switch(nS(d),d.tag){case 3:Hs(In),me();break;case 26:case 27:case 5:je(d);break;case 4:me();break;case 31:d.memoizedState!==null&&Eo(d);break;case 13:Eo(d);break;case 19:W($n);break;case 10:Hs(d.type);break;case 22:case 23:Eo(d),yS(),l!==null&&W(Fc);break;case 24:Hs(In)}}function dp(l,d){try{var m=d.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var N=b.next;m=N;do{if((m.tag&l)===l){b=void 0;var O=m.create,I=m.inst;b=O(),I.destroy=b}m=m.next}while(m!==N)}}catch(J){qt(d,d.return,J)}}function gl(l,d,m){try{var b=d.updateQueue,N=b!==null?b.lastEffect:null;if(N!==null){var O=N.next;b=O;do{if((b.tag&l)===l){var I=b.inst,J=I.destroy;if(J!==void 0){I.destroy=void 0,N=d;var ee=m,he=J;try{he()}catch(be){qt(N,ee,be)}}}b=b.next}while(b!==O)}}catch(be){qt(d,d.return,be)}}function C5(l){var d=l.updateQueue;if(d!==null){var m=l.stateNode;try{g3(d,m)}catch(b){qt(l,l.return,b)}}}function O5(l,d,m){m.props=Hc(l.type,l.memoizedProps),m.state=l.memoizedState;try{m.componentWillUnmount()}catch(b){qt(l,d,b)}}function fp(l,d){try{var m=l.ref;if(m!==null){switch(l.tag){case 26:case 27:case 5:var b=l.stateNode;break;case 30:b=l.stateNode;break;default:b=l.stateNode}typeof m=="function"?l.refCleanup=m(b):m.current=b}}catch(N){qt(l,d,N)}}function fs(l,d){var m=l.ref,b=l.refCleanup;if(m!==null)if(typeof b=="function")try{b()}catch(N){qt(l,d,N)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(N){qt(l,d,N)}else m.current=null}function j5(l){var d=l.type,m=l.memoizedProps,b=l.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":m.autoFocus&&b.focus();break e;case"img":m.src?b.src=m.src:m.srcSet&&(b.srcset=m.srcSet)}}catch(N){qt(l,l.return,N)}}function YS(l,d,m){try{var b=l.stateNode;wY(b,l.type,m,d),b[er]=d}catch(N){qt(l,l.return,N)}}function A5(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&El(l.type)||l.tag===4}function KS(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||A5(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&El(l.type)||l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function XS(l,d,m){var b=l.tag;if(b===5||b===6)l=l.stateNode,d?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(l,d):(d=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,d.appendChild(l),m=m._reactRootContainer,m!=null||d.onclick!==null||(d.onclick=Fs));else if(b!==4&&(b===27&&El(l.type)&&(m=l.stateNode,d=null),l=l.child,l!==null))for(XS(l,d,m),l=l.sibling;l!==null;)XS(l,d,m),l=l.sibling}function u0(l,d,m){var b=l.tag;if(b===5||b===6)l=l.stateNode,d?m.insertBefore(l,d):m.appendChild(l);else if(b!==4&&(b===27&&El(l.type)&&(m=l.stateNode),l=l.child,l!==null))for(u0(l,d,m),l=l.sibling;l!==null;)u0(l,d,m),l=l.sibling}function T5(l){var d=l.stateNode,m=l.memoizedProps;try{for(var b=l.type,N=d.attributes;N.length;)d.removeAttributeNode(N[0]);ur(d,b,m),d[Tn]=l,d[er]=m}catch(O){qt(l,l.return,O)}}var Ys=!1,zn=!1,QS=!1,$5=typeof WeakSet=="function"?WeakSet:Set,nr=null;function eY(l,d){if(l=l.containerInfo,vE=$0,l=U$(l),q1(l)){if("selectionStart"in l)var m={start:l.selectionStart,end:l.selectionEnd};else e:{m=(m=l.ownerDocument)&&m.defaultView||window;var b=m.getSelection&&m.getSelection();if(b&&b.rangeCount!==0){m=b.anchorNode;var N=b.anchorOffset,O=b.focusNode;b=b.focusOffset;try{m.nodeType,O.nodeType}catch{m=null;break e}var I=0,J=-1,ee=-1,he=0,be=0,Se=l,ge=null;t:for(;;){for(var ye;Se!==m||N!==0&&Se.nodeType!==3||(J=I+N),Se!==O||b!==0&&Se.nodeType!==3||(ee=I+b),Se.nodeType===3&&(I+=Se.nodeValue.length),(ye=Se.firstChild)!==null;)ge=Se,Se=ye;for(;;){if(Se===l)break t;if(ge===m&&++he===N&&(J=I),ge===O&&++be===b&&(ee=I),(ye=Se.nextSibling)!==null)break;Se=ge,ge=Se.parentNode}Se=ye}m=J===-1||ee===-1?null:{start:J,end:ee}}else m=null}m=m||{start:0,end:0}}else m=null;for(xE={focusedElem:l,selectionRange:m},$0=!1,nr=d;nr!==null;)if(d=nr,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,nr=l;else for(;nr!==null;){switch(d=nr,O=d.alternate,l=d.flags,d.tag){case 0:if((l&4)!==0&&(l=d.updateQueue,l=l!==null?l.events:null,l!==null))for(m=0;m<l.length;m++)N=l[m],N.ref.impl=N.nextImpl;break;case 11:case 15:break;case 1:if((l&1024)!==0&&O!==null){l=void 0,m=d,N=O.memoizedProps,O=O.memoizedState,b=m.stateNode;try{var He=Hc(m.type,N);l=b.getSnapshotBeforeUpdate(He,O),b.__reactInternalSnapshotBeforeUpdate=l}catch(it){qt(m,m.return,it)}}break;case 3:if((l&1024)!==0){if(l=d.stateNode.containerInfo,m=l.nodeType,m===9)EE(l);else if(m===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":EE(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((l&1024)!==0)throw Error(r(163))}if(l=d.sibling,l!==null){l.return=d.return,nr=l;break}nr=d.return}}function R5(l,d,m){var b=m.flags;switch(m.tag){case 0:case 11:case 15:Xs(l,m),b&4&&dp(5,m);break;case 1:if(Xs(l,m),b&4)if(l=m.stateNode,d===null)try{l.componentDidMount()}catch(I){qt(m,m.return,I)}else{var N=Hc(m.type,d.memoizedProps);d=d.memoizedState;try{l.componentDidUpdate(N,d,l.__reactInternalSnapshotBeforeUpdate)}catch(I){qt(m,m.return,I)}}b&64&&C5(m),b&512&&fp(m,m.return);break;case 3:if(Xs(l,m),b&64&&(l=m.updateQueue,l!==null)){if(d=null,m.child!==null)switch(m.child.tag){case 27:case 5:d=m.child.stateNode;break;case 1:d=m.child.stateNode}try{g3(l,d)}catch(I){qt(m,m.return,I)}}break;case 27:d===null&&b&4&&T5(m);case 26:case 5:Xs(l,m),d===null&&b&4&&j5(m),b&512&&fp(m,m.return);break;case 12:Xs(l,m);break;case 31:Xs(l,m),b&4&&P5(l,m);break;case 13:Xs(l,m),b&4&&D5(l,m),b&64&&(l=m.memoizedState,l!==null&&(l=l.dehydrated,l!==null&&(m=cY.bind(null,m),AY(l,m))));break;case 22:if(b=m.memoizedState!==null||Ys,!b){d=d!==null&&d.memoizedState!==null||zn,N=Ys;var O=zn;Ys=b,(zn=d)&&!O?Qs(l,m,(m.subtreeFlags&8772)!==0):Xs(l,m),Ys=N,zn=O}break;case 30:break;default:Xs(l,m)}}function k5(l){var d=l.alternate;d!==null&&(l.alternate=null,k5(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&Lh(d)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}var fn=null,Wr=!1;function Ks(l,d,m){for(m=m.child;m!==null;)M5(l,d,m),m=m.sibling}function M5(l,d,m){if(dn&&typeof dn.onCommitFiberUnmount=="function")try{dn.onCommitFiberUnmount(pr,m)}catch{}switch(m.tag){case 26:zn||fs(m,d),Ks(l,d,m),m.memoizedState?m.memoizedState.count--:m.stateNode&&(m=m.stateNode,m.parentNode.removeChild(m));break;case 27:zn||fs(m,d);var b=fn,N=Wr;El(m.type)&&(fn=m.stateNode,Wr=!1),Ks(l,d,m),wp(m.stateNode),fn=b,Wr=N;break;case 5:zn||fs(m,d);case 6:if(b=fn,N=Wr,fn=null,Ks(l,d,m),fn=b,Wr=N,fn!==null)if(Wr)try{(fn.nodeType===9?fn.body:fn.nodeName==="HTML"?fn.ownerDocument.body:fn).removeChild(m.stateNode)}catch(O){qt(m,d,O)}else try{fn.removeChild(m.stateNode)}catch(O){qt(m,d,O)}break;case 18:fn!==null&&(Wr?(l=fn,C4(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,m.stateNode),Id(l)):C4(fn,m.stateNode));break;case 4:b=fn,N=Wr,fn=m.stateNode.containerInfo,Wr=!0,Ks(l,d,m),fn=b,Wr=N;break;case 0:case 11:case 14:case 15:gl(2,m,d),zn||gl(4,m,d),Ks(l,d,m);break;case 1:zn||(fs(m,d),b=m.stateNode,typeof b.componentWillUnmount=="function"&&O5(m,d,b)),Ks(l,d,m);break;case 21:Ks(l,d,m);break;case 22:zn=(b=zn)||m.memoizedState!==null,Ks(l,d,m),zn=b;break;default:Ks(l,d,m)}}function P5(l,d){if(d.memoizedState===null&&(l=d.alternate,l!==null&&(l=l.memoizedState,l!==null))){l=l.dehydrated;try{Id(l)}catch(m){qt(d,d.return,m)}}}function D5(l,d){if(d.memoizedState===null&&(l=d.alternate,l!==null&&(l=l.memoizedState,l!==null&&(l=l.dehydrated,l!==null))))try{Id(l)}catch(m){qt(d,d.return,m)}}function tY(l){switch(l.tag){case 31:case 13:case 19:var d=l.stateNode;return d===null&&(d=l.stateNode=new $5),d;case 22:return l=l.stateNode,d=l._retryCache,d===null&&(d=l._retryCache=new $5),d;default:throw Error(r(435,l.tag))}}function d0(l,d){var m=tY(l);d.forEach(function(b){if(!m.has(b)){m.add(b);var N=uY.bind(null,l,b);b.then(N,N)}})}function Gr(l,d){var m=d.deletions;if(m!==null)for(var b=0;b<m.length;b++){var N=m[b],O=l,I=d,J=I;e:for(;J!==null;){switch(J.tag){case 27:if(El(J.type)){fn=J.stateNode,Wr=!1;break e}break;case 5:fn=J.stateNode,Wr=!1;break e;case 3:case 4:fn=J.stateNode.containerInfo,Wr=!0;break e}J=J.return}if(fn===null)throw Error(r(160));M5(O,I,N),fn=null,Wr=!1,O=N.alternate,O!==null&&(O.return=null),N.return=null}if(d.subtreeFlags&13886)for(d=d.child;d!==null;)I5(d,l),d=d.sibling}var Oi=null;function I5(l,d){var m=l.alternate,b=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:Gr(d,l),Jr(l),b&4&&(gl(3,l,l.return),dp(3,l),gl(5,l,l.return));break;case 1:Gr(d,l),Jr(l),b&512&&(zn||m===null||fs(m,m.return)),b&64&&Ys&&(l=l.updateQueue,l!==null&&(b=l.callbacks,b!==null&&(m=l.shared.hiddenCallbacks,l.shared.hiddenCallbacks=m===null?b:m.concat(b))));break;case 26:var N=Oi;if(Gr(d,l),Jr(l),b&512&&(zn||m===null||fs(m,m.return)),b&4){var O=m!==null?m.memoizedState:null;if(b=l.memoizedState,m===null)if(b===null)if(l.stateNode===null){e:{b=l.type,m=l.memoizedProps,N=N.ownerDocument||N;t:switch(b){case"title":O=N.getElementsByTagName("title")[0],(!O||O[Tc]||O[Tn]||O.namespaceURI==="http://www.w3.org/2000/svg"||O.hasAttribute("itemprop"))&&(O=N.createElement(b),N.head.insertBefore(O,N.querySelector("head > title"))),ur(O,b,m),O[Tn]=l,Dn(O),b=O;break e;case"link":var I=I4("link","href",N).get(b+(m.href||""));if(I){for(var J=0;J<I.length;J++)if(O=I[J],O.getAttribute("href")===(m.href==null||m.href===""?null:m.href)&&O.getAttribute("rel")===(m.rel==null?null:m.rel)&&O.getAttribute("title")===(m.title==null?null:m.title)&&O.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){I.splice(J,1);break t}}O=N.createElement(b),ur(O,b,m),N.head.appendChild(O);break;case"meta":if(I=I4("meta","content",N).get(b+(m.content||""))){for(J=0;J<I.length;J++)if(O=I[J],O.getAttribute("content")===(m.content==null?null:""+m.content)&&O.getAttribute("name")===(m.name==null?null:m.name)&&O.getAttribute("property")===(m.property==null?null:m.property)&&O.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&O.getAttribute("charset")===(m.charSet==null?null:m.charSet)){I.splice(J,1);break t}}O=N.createElement(b),ur(O,b,m),N.head.appendChild(O);break;default:throw Error(r(468,b))}O[Tn]=l,Dn(O),b=O}l.stateNode=b}else L4(N,l.type,l.stateNode);else l.stateNode=D4(N,b,l.memoizedProps);else O!==b?(O===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):O.count--,b===null?L4(N,l.type,l.stateNode):D4(N,b,l.memoizedProps)):b===null&&l.stateNode!==null&&YS(l,l.memoizedProps,m.memoizedProps)}break;case 27:Gr(d,l),Jr(l),b&512&&(zn||m===null||fs(m,m.return)),m!==null&&b&4&&YS(l,l.memoizedProps,m.memoizedProps);break;case 5:if(Gr(d,l),Jr(l),b&512&&(zn||m===null||fs(m,m.return)),l.flags&32){N=l.stateNode;try{sd(N,"")}catch(He){qt(l,l.return,He)}}b&4&&l.stateNode!=null&&(N=l.memoizedProps,YS(l,N,m!==null?m.memoizedProps:N)),b&1024&&(QS=!0);break;case 6:if(Gr(d,l),Jr(l),b&4){if(l.stateNode===null)throw Error(r(162));b=l.memoizedProps,m=l.stateNode;try{m.nodeValue=b}catch(He){qt(l,l.return,He)}}break;case 3:if(O0=null,N=Oi,Oi=_0(d.containerInfo),Gr(d,l),Oi=N,Jr(l),b&4&&m!==null&&m.memoizedState.isDehydrated)try{Id(d.containerInfo)}catch(He){qt(l,l.return,He)}QS&&(QS=!1,L5(l));break;case 4:b=Oi,Oi=_0(l.stateNode.containerInfo),Gr(d,l),Jr(l),Oi=b;break;case 12:Gr(d,l),Jr(l);break;case 31:Gr(d,l),Jr(l),b&4&&(b=l.updateQueue,b!==null&&(l.updateQueue=null,d0(l,b)));break;case 13:Gr(d,l),Jr(l),l.child.flags&8192&&l.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(h0=te()),b&4&&(b=l.updateQueue,b!==null&&(l.updateQueue=null,d0(l,b)));break;case 22:N=l.memoizedState!==null;var ee=m!==null&&m.memoizedState!==null,he=Ys,be=zn;if(Ys=he||N,zn=be||ee,Gr(d,l),zn=be,Ys=he,Jr(l),b&8192)e:for(d=l.stateNode,d._visibility=N?d._visibility&-2:d._visibility|1,N&&(m===null||ee||Ys||zn||qc(l)),m=null,d=l;;){if(d.tag===5||d.tag===26){if(m===null){ee=m=d;try{if(O=ee.stateNode,N)I=O.style,typeof I.setProperty=="function"?I.setProperty("display","none","important"):I.display="none";else{J=ee.stateNode;var Se=ee.memoizedProps.style,ge=Se!=null&&Se.hasOwnProperty("display")?Se.display:null;J.style.display=ge==null||typeof ge=="boolean"?"":(""+ge).trim()}}catch(He){qt(ee,ee.return,He)}}}else if(d.tag===6){if(m===null){ee=d;try{ee.stateNode.nodeValue=N?"":ee.memoizedProps}catch(He){qt(ee,ee.return,He)}}}else if(d.tag===18){if(m===null){ee=d;try{var ye=ee.stateNode;N?O4(ye,!0):O4(ee.stateNode,!1)}catch(He){qt(ee,ee.return,He)}}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===l)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break e;for(;d.sibling===null;){if(d.return===null||d.return===l)break e;m===d&&(m=null),d=d.return}m===d&&(m=null),d.sibling.return=d.return,d=d.sibling}b&4&&(b=l.updateQueue,b!==null&&(m=b.retryQueue,m!==null&&(b.retryQueue=null,d0(l,m))));break;case 19:Gr(d,l),Jr(l),b&4&&(b=l.updateQueue,b!==null&&(l.updateQueue=null,d0(l,b)));break;case 30:break;case 21:break;default:Gr(d,l),Jr(l)}}function Jr(l){var d=l.flags;if(d&2){try{for(var m,b=l.return;b!==null;){if(A5(b)){m=b;break}b=b.return}if(m==null)throw Error(r(160));switch(m.tag){case 27:var N=m.stateNode,O=KS(l);u0(l,O,N);break;case 5:var I=m.stateNode;m.flags&32&&(sd(I,""),m.flags&=-33);var J=KS(l);u0(l,J,I);break;case 3:case 4:var ee=m.stateNode.containerInfo,he=KS(l);XS(l,he,ee);break;default:throw Error(r(161))}}catch(be){qt(l,l.return,be)}l.flags&=-3}d&4096&&(l.flags&=-4097)}function L5(l){if(l.subtreeFlags&1024)for(l=l.child;l!==null;){var d=l;L5(d),d.tag===5&&d.flags&1024&&d.stateNode.reset(),l=l.sibling}}function Xs(l,d){if(d.subtreeFlags&8772)for(d=d.child;d!==null;)R5(l,d.alternate,d),d=d.sibling}function qc(l){for(l=l.child;l!==null;){var d=l;switch(d.tag){case 0:case 11:case 14:case 15:gl(4,d,d.return),qc(d);break;case 1:fs(d,d.return);var m=d.stateNode;typeof m.componentWillUnmount=="function"&&O5(d,d.return,m),qc(d);break;case 27:wp(d.stateNode);case 26:case 5:fs(d,d.return),qc(d);break;case 22:d.memoizedState===null&&qc(d);break;case 30:qc(d);break;default:qc(d)}l=l.sibling}}function Qs(l,d,m){for(m=m&&(d.subtreeFlags&8772)!==0,d=d.child;d!==null;){var b=d.alternate,N=l,O=d,I=O.flags;switch(O.tag){case 0:case 11:case 15:Qs(N,O,m),dp(4,O);break;case 1:if(Qs(N,O,m),b=O,N=b.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch(he){qt(b,b.return,he)}if(b=O,N=b.updateQueue,N!==null){var J=b.stateNode;try{var ee=N.shared.hiddenCallbacks;if(ee!==null)for(N.shared.hiddenCallbacks=null,N=0;N<ee.length;N++)m3(ee[N],J)}catch(he){qt(b,b.return,he)}}m&&I&64&&C5(O),fp(O,O.return);break;case 27:T5(O);case 26:case 5:Qs(N,O,m),m&&b===null&&I&4&&j5(O),fp(O,O.return);break;case 12:Qs(N,O,m);break;case 31:Qs(N,O,m),m&&I&4&&P5(N,O);break;case 13:Qs(N,O,m),m&&I&4&&D5(N,O);break;case 22:O.memoizedState===null&&Qs(N,O,m),fp(O,O.return);break;case 30:break;default:Qs(N,O,m)}d=d.sibling}}function ZS(l,d){var m=null;l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),l=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(l=d.memoizedState.cachePool.pool),l!==m&&(l!=null&&l.refCount++,m!=null&&Qh(m))}function eE(l,d){l=null,d.alternate!==null&&(l=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==l&&(d.refCount++,l!=null&&Qh(l))}function ji(l,d,m,b){if(d.subtreeFlags&10256)for(d=d.child;d!==null;)F5(l,d,m,b),d=d.sibling}function F5(l,d,m,b){var N=d.flags;switch(d.tag){case 0:case 11:case 15:ji(l,d,m,b),N&2048&&dp(9,d);break;case 1:ji(l,d,m,b);break;case 3:ji(l,d,m,b),N&2048&&(l=null,d.alternate!==null&&(l=d.alternate.memoizedState.cache),d=d.memoizedState.cache,d!==l&&(d.refCount++,l!=null&&Qh(l)));break;case 12:if(N&2048){ji(l,d,m,b),l=d.stateNode;try{var O=d.memoizedProps,I=O.id,J=O.onPostCommit;typeof J=="function"&&J(I,d.alternate===null?"mount":"update",l.passiveEffectDuration,-0)}catch(ee){qt(d,d.return,ee)}}else ji(l,d,m,b);break;case 31:ji(l,d,m,b);break;case 13:ji(l,d,m,b);break;case 23:break;case 22:O=d.stateNode,I=d.alternate,d.memoizedState!==null?O._visibility&2?ji(l,d,m,b):hp(l,d):O._visibility&2?ji(l,d,m,b):(O._visibility|=2,Cd(l,d,m,b,(d.subtreeFlags&10256)!==0||!1)),N&2048&&ZS(I,d);break;case 24:ji(l,d,m,b),N&2048&&eE(d.alternate,d);break;default:ji(l,d,m,b)}}function Cd(l,d,m,b,N){for(N=N&&((d.subtreeFlags&10256)!==0||!1),d=d.child;d!==null;){var O=l,I=d,J=m,ee=b,he=I.flags;switch(I.tag){case 0:case 11:case 15:Cd(O,I,J,ee,N),dp(8,I);break;case 23:break;case 22:var be=I.stateNode;I.memoizedState!==null?be._visibility&2?Cd(O,I,J,ee,N):hp(O,I):(be._visibility|=2,Cd(O,I,J,ee,N)),N&&he&2048&&ZS(I.alternate,I);break;case 24:Cd(O,I,J,ee,N),N&&he&2048&&eE(I.alternate,I);break;default:Cd(O,I,J,ee,N)}d=d.sibling}}function hp(l,d){if(d.subtreeFlags&10256)for(d=d.child;d!==null;){var m=l,b=d,N=b.flags;switch(b.tag){case 22:hp(m,b),N&2048&&ZS(b.alternate,b);break;case 24:hp(m,b),N&2048&&eE(b.alternate,b);break;default:hp(m,b)}d=d.sibling}}var pp=8192;function Od(l,d,m){if(l.subtreeFlags&pp)for(l=l.child;l!==null;)z5(l,d,m),l=l.sibling}function z5(l,d,m){switch(l.tag){case 26:Od(l,d,m),l.flags&pp&&l.memoizedState!==null&&BY(m,Oi,l.memoizedState,l.memoizedProps);break;case 5:Od(l,d,m);break;case 3:case 4:var b=Oi;Oi=_0(l.stateNode.containerInfo),Od(l,d,m),Oi=b;break;case 22:l.memoizedState===null&&(b=l.alternate,b!==null&&b.memoizedState!==null?(b=pp,pp=16777216,Od(l,d,m),pp=b):Od(l,d,m));break;default:Od(l,d,m)}}function B5(l){var d=l.alternate;if(d!==null&&(l=d.child,l!==null)){d.child=null;do d=l.sibling,l.sibling=null,l=d;while(l!==null)}}function mp(l){var d=l.deletions;if((l.flags&16)!==0){if(d!==null)for(var m=0;m<d.length;m++){var b=d[m];nr=b,U5(b,l)}B5(l)}if(l.subtreeFlags&10256)for(l=l.child;l!==null;)V5(l),l=l.sibling}function V5(l){switch(l.tag){case 0:case 11:case 15:mp(l),l.flags&2048&&gl(9,l,l.return);break;case 3:mp(l);break;case 12:mp(l);break;case 22:var d=l.stateNode;l.memoizedState!==null&&d._visibility&2&&(l.return===null||l.return.tag!==13)?(d._visibility&=-3,f0(l)):mp(l);break;default:mp(l)}}function f0(l){var d=l.deletions;if((l.flags&16)!==0){if(d!==null)for(var m=0;m<d.length;m++){var b=d[m];nr=b,U5(b,l)}B5(l)}for(l=l.child;l!==null;){switch(d=l,d.tag){case 0:case 11:case 15:gl(8,d,d.return),f0(d);break;case 22:m=d.stateNode,m._visibility&2&&(m._visibility&=-3,f0(d));break;default:f0(d)}l=l.sibling}}function U5(l,d){for(;nr!==null;){var m=nr;switch(m.tag){case 0:case 11:case 15:gl(8,m,d);break;case 23:case 22:if(m.memoizedState!==null&&m.memoizedState.cachePool!==null){var b=m.memoizedState.cachePool.pool;b!=null&&b.refCount++}break;case 24:Qh(m.memoizedState.cache)}if(b=m.child,b!==null)b.return=m,nr=b;else e:for(m=l;nr!==null;){b=nr;var N=b.sibling,O=b.return;if(k5(b),b===m){nr=null;break e}if(N!==null){N.return=O,nr=N;break e}nr=O}}}var nY={getCacheForType:function(l){var d=lr(In),m=d.data.get(l);return m===void 0&&(m=l(),d.data.set(l,m)),m},cacheSignal:function(){return lr(In).controller.signal}},rY=typeof WeakMap=="function"?WeakMap:Map,Mt=0,Xt=null,vt=null,wt=0,Ht=0,No=null,yl=!1,jd=!1,tE=!1,Zs=0,Sn=0,bl=0,Wc=0,nE=0,_o=0,Ad=0,gp=null,Yr=null,rE=!1,h0=0,H5=0,p0=1/0,m0=null,vl=null,Gn=0,xl=null,Td=null,ea=0,oE=0,iE=null,q5=null,yp=0,sE=null;function Co(){return(Mt&2)!==0&&wt!==0?wt&-wt:$.T!==null?fE():Ac()}function W5(){if(_o===0)if((wt&536870912)===0||Et){var l=Is;Is<<=1,(Is&3932160)===0&&(Is=262144),_o=l}else _o=536870912;return l=So.current,l!==null&&(l.flags|=32),_o}function Kr(l,d,m){(l===Xt&&(Ht===2||Ht===9)||l.cancelPendingCommit!==null)&&($d(l,0),wl(l,wt,_o,!1)),Cr(l,m),((Mt&2)===0||l!==Xt)&&(l===Xt&&((Mt&2)===0&&(Wc|=m),Sn===4&&wl(l,wt,_o,!1)),hs(l))}function G5(l,d,m){if((Mt&6)!==0)throw Error(r(327));var b=!m&&(d&127)===0&&(d&l.expiredLanes)===0||Xa(l,d),N=b?sY(l,d):lE(l,d,!0),O=b;do{if(N===0){jd&&!b&&wl(l,d,0,!1);break}else{if(m=l.current.alternate,O&&!oY(m)){N=lE(l,d,!1),O=!1;continue}if(N===2){if(O=d,l.errorRecoveryDisabledLanes&O)var I=0;else I=l.pendingLanes&-536870913,I=I!==0?I:I&536870912?536870912:0;if(I!==0){d=I;e:{var J=l;N=gp;var ee=J.current.memoizedState.isDehydrated;if(ee&&($d(J,I).flags|=256),I=lE(J,I,!1),I!==2){if(tE&&!ee){J.errorRecoveryDisabledLanes|=O,Wc|=O,N=4;break e}O=Yr,Yr=N,O!==null&&(Yr===null?Yr=O:Yr.push.apply(Yr,O))}N=I}if(O=!1,N!==2)continue}}if(N===1){$d(l,0),wl(l,d,0,!0);break}e:{switch(b=l,O=N,O){case 0:case 1:throw Error(r(345));case 4:if((d&4194048)!==d)break;case 6:wl(b,d,_o,!yl);break e;case 2:Yr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((d&62914560)===d&&(N=h0+300-te(),10<N)){if(wl(b,d,_o,!yl),Ka(b,0,!0)!==0)break e;ea=d,b.timeoutHandle=N4(J5.bind(null,b,m,Yr,m0,rE,d,_o,Wc,Ad,yl,O,"Throttled",-0,0),N);break e}J5(b,m,Yr,m0,rE,d,_o,Wc,Ad,yl,O,null,-0,0)}}break}while(!0);hs(l)}function J5(l,d,m,b,N,O,I,J,ee,he,be,Se,ge,ye){if(l.timeoutHandle=-1,Se=d.subtreeFlags,Se&8192||(Se&16785408)===16785408){Se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fs},z5(d,O,Se);var He=(O&62914560)===O?h0-te():(O&4194048)===O?H5-te():0;if(He=VY(Se,He),He!==null){ea=O,l.cancelPendingCommit=He(n4.bind(null,l,d,O,m,b,N,I,J,ee,be,Se,null,ge,ye)),wl(l,O,I,!he);return}}n4(l,d,O,m,b,N,I,J,ee)}function oY(l){for(var d=l;;){var m=d.tag;if((m===0||m===11||m===15)&&d.flags&16384&&(m=d.updateQueue,m!==null&&(m=m.stores,m!==null)))for(var b=0;b<m.length;b++){var N=m[b],O=N.getSnapshot;N=N.value;try{if(!xo(O(),N))return!1}catch{return!1}}if(m=d.child,d.subtreeFlags&16384&&m!==null)m.return=d,d=m;else{if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function wl(l,d,m,b){d&=~nE,d&=~Wc,l.suspendedLanes|=d,l.pingedLanes&=~d,b&&(l.warmLanes|=d),b=l.expirationTimes;for(var N=d;0<N;){var O=31-nn(N),I=1<<O;b[O]=-1,N&=~I}m!==0&&Qu(l,m,d)}function g0(){return(Mt&6)===0?(bp(0),!1):!0}function aE(){if(vt!==null){if(Ht===0)var l=vt.return;else l=vt,Us=Ic=null,ES(l),wd=null,ep=0,l=vt;for(;l!==null;)_5(l.alternate,l),l=l.return;vt=null}}function $d(l,d){var m=l.timeoutHandle;m!==-1&&(l.timeoutHandle=-1,NY(m)),m=l.cancelPendingCommit,m!==null&&(l.cancelPendingCommit=null,m()),ea=0,aE(),Xt=l,vt=m=Bs(l.current,null),wt=d,Ht=0,No=null,yl=!1,jd=Xa(l,d),tE=!1,Ad=_o=nE=Wc=bl=Sn=0,Yr=gp=null,rE=!1,(d&8)!==0&&(d|=d&32);var b=l.entangledLanes;if(b!==0)for(l=l.entanglements,b&=d;0<b;){var N=31-nn(b),O=1<<N;d|=l[N],b&=~O}return Zs=d,Iy(),m}function Y5(l,d){dt=null,$.H=lp,d===xd||d===qy?(d=d3(),Ht=3):d===dS?(d=d3(),Ht=4):Ht=d===FS?8:d!==null&&typeof d=="object"&&typeof d.then=="function"?6:1,No=d,vt===null&&(Sn=1,i0(l,Jo(d,l.current)))}function K5(){var l=So.current;return l===null?!0:(wt&4194048)===wt?Qo===null:(wt&62914560)===wt||(wt&536870912)!==0?l===Qo:!1}function X5(){var l=$.H;return $.H=lp,l===null?lp:l}function Q5(){var l=$.A;return $.A=nY,l}function y0(){Sn=4,yl||(wt&4194048)!==wt&&So.current!==null||(jd=!0),(bl&134217727)===0&&(Wc&134217727)===0||Xt===null||wl(Xt,wt,_o,!1)}function lE(l,d,m){var b=Mt;Mt|=2;var N=X5(),O=Q5();(Xt!==l||wt!==d)&&(m0=null,$d(l,d)),d=!1;var I=Sn;e:do try{if(Ht!==0&&vt!==null){var J=vt,ee=No;switch(Ht){case 8:aE(),I=6;break e;case 3:case 2:case 9:case 6:So.current===null&&(d=!0);var he=Ht;if(Ht=0,No=null,Rd(l,J,ee,he),m&&jd){I=0;break e}break;default:he=Ht,Ht=0,No=null,Rd(l,J,ee,he)}}iY(),I=Sn;break}catch(be){Y5(l,be)}while(!0);return d&&l.shellSuspendCounter++,Us=Ic=null,Mt=b,$.H=N,$.A=O,vt===null&&(Xt=null,wt=0,Iy()),I}function iY(){for(;vt!==null;)Z5(vt)}function sY(l,d){var m=Mt;Mt|=2;var b=X5(),N=Q5();Xt!==l||wt!==d?(m0=null,p0=te()+500,$d(l,d)):jd=Xa(l,d);e:do try{if(Ht!==0&&vt!==null){d=vt;var O=No;t:switch(Ht){case 1:Ht=0,No=null,Rd(l,d,O,1);break;case 2:case 9:if(c3(O)){Ht=0,No=null,e4(d);break}d=function(){Ht!==2&&Ht!==9||Xt!==l||(Ht=7),hs(l)},O.then(d,d);break e;case 3:Ht=7;break e;case 4:Ht=5;break e;case 7:c3(O)?(Ht=0,No=null,e4(d)):(Ht=0,No=null,Rd(l,d,O,7));break;case 5:var I=null;switch(vt.tag){case 26:I=vt.memoizedState;case 5:case 27:var J=vt;if(I?F4(I):J.stateNode.complete){Ht=0,No=null;var ee=J.sibling;if(ee!==null)vt=ee;else{var he=J.return;he!==null?(vt=he,b0(he)):vt=null}break t}}Ht=0,No=null,Rd(l,d,O,5);break;case 6:Ht=0,No=null,Rd(l,d,O,6);break;case 8:aE(),Sn=6;break e;default:throw Error(r(462))}}aY();break}catch(be){Y5(l,be)}while(!0);return Us=Ic=null,$.H=b,$.A=N,Mt=m,vt!==null?0:(Xt=null,wt=0,Iy(),Sn)}function aY(){for(;vt!==null&&!ne();)Z5(vt)}function Z5(l){var d=E5(l.alternate,l,Zs);l.memoizedProps=l.pendingProps,d===null?b0(l):vt=d}function e4(l){var d=l,m=d.alternate;switch(d.tag){case 15:case 0:d=y5(m,d,d.pendingProps,d.type,void 0,wt);break;case 11:d=y5(m,d,d.pendingProps,d.type.render,d.ref,wt);break;case 5:ES(d);default:_5(m,d),d=vt=Q$(d,Zs),d=E5(m,d,Zs)}l.memoizedProps=l.pendingProps,d===null?b0(l):vt=d}function Rd(l,d,m,b){Us=Ic=null,ES(d),wd=null,ep=0;var N=d.return;try{if(YJ(l,N,d,m,wt)){Sn=1,i0(l,Jo(m,l.current)),vt=null;return}}catch(O){if(N!==null)throw vt=N,O;Sn=1,i0(l,Jo(m,l.current)),vt=null;return}d.flags&32768?(Et||b===1?l=!0:jd||(wt&536870912)!==0?l=!1:(yl=l=!0,(b===2||b===9||b===3||b===6)&&(b=So.current,b!==null&&b.tag===13&&(b.flags|=16384))),t4(d,l)):b0(d)}function b0(l){var d=l;do{if((d.flags&32768)!==0){t4(d,yl);return}l=d.return;var m=QJ(d.alternate,d,Zs);if(m!==null){vt=m;return}if(d=d.sibling,d!==null){vt=d;return}vt=d=l}while(d!==null);Sn===0&&(Sn=5)}function t4(l,d){do{var m=ZJ(l.alternate,l);if(m!==null){m.flags&=32767,vt=m;return}if(m=l.return,m!==null&&(m.flags|=32768,m.subtreeFlags=0,m.deletions=null),!d&&(l=l.sibling,l!==null)){vt=l;return}vt=l=m}while(l!==null);Sn=6,vt=null}function n4(l,d,m,b,N,O,I,J,ee){l.cancelPendingCommit=null;do v0();while(Gn!==0);if((Mt&6)!==0)throw Error(r(327));if(d!==null){if(d===l.current)throw Error(r(177));if(O=d.lanes|d.childLanes,O|=K1,Ei(l,m,O,I,J,ee),l===Xt&&(vt=Xt=null,wt=0),Td=d,xl=l,ea=m,oE=O,iE=N,q5=b,(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?(l.callbackNode=null,l.callbackPriority=0,dY($e,function(){return a4(),null})):(l.callbackNode=null,l.callbackPriority=0),b=(d.flags&13878)!==0,(d.subtreeFlags&13878)!==0||b){b=$.T,$.T=null,N=L.p,L.p=2,I=Mt,Mt|=4;try{eY(l,d,m)}finally{Mt=I,L.p=N,$.T=b}}Gn=1,r4(),o4(),i4()}}function r4(){if(Gn===1){Gn=0;var l=xl,d=Td,m=(d.flags&13878)!==0;if((d.subtreeFlags&13878)!==0||m){m=$.T,$.T=null;var b=L.p;L.p=2;var N=Mt;Mt|=4;try{I5(d,l);var O=xE,I=U$(l.containerInfo),J=O.focusedElem,ee=O.selectionRange;if(I!==J&&J&&J.ownerDocument&&V$(J.ownerDocument.documentElement,J)){if(ee!==null&&q1(J)){var he=ee.start,be=ee.end;if(be===void 0&&(be=he),"selectionStart"in J)J.selectionStart=he,J.selectionEnd=Math.min(be,J.value.length);else{var Se=J.ownerDocument||document,ge=Se&&Se.defaultView||window;if(ge.getSelection){var ye=ge.getSelection(),He=J.textContent.length,it=Math.min(ee.start,He),Jt=ee.end===void 0?it:Math.min(ee.end,He);!ye.extend&&it>Jt&&(I=Jt,Jt=it,it=I);var ae=B$(J,it),oe=B$(J,Jt);if(ae&&oe&&(ye.rangeCount!==1||ye.anchorNode!==ae.node||ye.anchorOffset!==ae.offset||ye.focusNode!==oe.node||ye.focusOffset!==oe.offset)){var fe=Se.createRange();fe.setStart(ae.node,ae.offset),ye.removeAllRanges(),it>Jt?(ye.addRange(fe),ye.extend(oe.node,oe.offset)):(fe.setEnd(oe.node,oe.offset),ye.addRange(fe))}}}}for(Se=[],ye=J;ye=ye.parentNode;)ye.nodeType===1&&Se.push({element:ye,left:ye.scrollLeft,top:ye.scrollTop});for(typeof J.focus=="function"&&J.focus(),J=0;J<Se.length;J++){var we=Se[J];we.element.scrollLeft=we.left,we.element.scrollTop=we.top}}$0=!!vE,xE=vE=null}finally{Mt=N,L.p=b,$.T=m}}l.current=d,Gn=2}}function o4(){if(Gn===2){Gn=0;var l=xl,d=Td,m=(d.flags&8772)!==0;if((d.subtreeFlags&8772)!==0||m){m=$.T,$.T=null;var b=L.p;L.p=2;var N=Mt;Mt|=4;try{R5(l,d.alternate,d)}finally{Mt=N,L.p=b,$.T=m}}Gn=3}}function i4(){if(Gn===4||Gn===3){Gn=0,ce();var l=xl,d=Td,m=ea,b=q5;(d.subtreeFlags&10256)!==0||(d.flags&10256)!==0?Gn=5:(Gn=0,Td=xl=null,s4(l,l.pendingLanes));var N=l.pendingLanes;if(N===0&&(vl=null),el(m),d=d.stateNode,dn&&typeof dn.onCommitFiberRoot=="function")try{dn.onCommitFiberRoot(pr,d,void 0,(d.current.flags&128)===128)}catch{}if(b!==null){d=$.T,N=L.p,L.p=2,$.T=null;try{for(var O=l.onRecoverableError,I=0;I<b.length;I++){var J=b[I];O(J.value,{componentStack:J.stack})}}finally{$.T=d,L.p=N}}(ea&3)!==0&&v0(),hs(l),N=l.pendingLanes,(m&261930)!==0&&(N&42)!==0?l===sE?yp++:(yp=0,sE=l):yp=0,bp(0)}}function s4(l,d){(l.pooledCacheLanes&=d)===0&&(d=l.pooledCache,d!=null&&(l.pooledCache=null,Qh(d)))}function v0(){return r4(),o4(),i4(),a4()}function a4(){if(Gn!==5)return!1;var l=xl,d=oE;oE=0;var m=el(ea),b=$.T,N=L.p;try{L.p=32>m?32:m,$.T=null,m=iE,iE=null;var O=xl,I=ea;if(Gn=0,Td=xl=null,ea=0,(Mt&6)!==0)throw Error(r(331));var J=Mt;if(Mt|=4,V5(O.current),F5(O,O.current,I,m),Mt=J,bp(0,!1),dn&&typeof dn.onPostCommitFiberRoot=="function")try{dn.onPostCommitFiberRoot(pr,O)}catch{}return!0}finally{L.p=N,$.T=b,s4(l,d)}}function l4(l,d,m){d=Jo(m,d),d=LS(l.stateNode,d,2),l=hl(l,d,2),l!==null&&(Cr(l,2),hs(l))}function qt(l,d,m){if(l.tag===3)l4(l,l,m);else for(;d!==null;){if(d.tag===3){l4(d,l,m);break}else if(d.tag===1){var b=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(vl===null||!vl.has(b))){l=Jo(m,l),m=c5(2),b=hl(d,m,2),b!==null&&(u5(m,b,d,l),Cr(b,2),hs(b));break}}d=d.return}}function cE(l,d,m){var b=l.pingCache;if(b===null){b=l.pingCache=new rY;var N=new Set;b.set(d,N)}else N=b.get(d),N===void 0&&(N=new Set,b.set(d,N));N.has(m)||(tE=!0,N.add(m),l=lY.bind(null,l,d,m),d.then(l,l))}function lY(l,d,m){var b=l.pingCache;b!==null&&b.delete(d),l.pingedLanes|=l.suspendedLanes&m,l.warmLanes&=~m,Xt===l&&(wt&m)===m&&(Sn===4||Sn===3&&(wt&62914560)===wt&&300>te()-h0?(Mt&2)===0&&$d(l,0):nE|=m,Ad===wt&&(Ad=0)),hs(l)}function c4(l,d){d===0&&(d=Xu()),l=Mc(l,d),l!==null&&(Cr(l,d),hs(l))}function cY(l){var d=l.memoizedState,m=0;d!==null&&(m=d.retryLane),c4(l,m)}function uY(l,d){var m=0;switch(l.tag){case 31:case 13:var b=l.stateNode,N=l.memoizedState;N!==null&&(m=N.retryLane);break;case 19:b=l.stateNode;break;case 22:b=l.stateNode._retryCache;break;default:throw Error(r(314))}b!==null&&b.delete(d),c4(l,m)}function dY(l,d){return G(l,d)}var x0=null,kd=null,uE=!1,w0=!1,dE=!1,Sl=0;function hs(l){l!==kd&&l.next===null&&(kd===null?x0=kd=l:kd=kd.next=l),w0=!0,uE||(uE=!0,hY())}function bp(l,d){if(!dE&&w0){dE=!0;do for(var m=!1,b=x0;b!==null;){if(l!==0){var N=b.pendingLanes;if(N===0)var O=0;else{var I=b.suspendedLanes,J=b.pingedLanes;O=(1<<31-nn(42|l)+1)-1,O&=N&~(I&~J),O=O&201326741?O&201326741|1:O?O|2:0}O!==0&&(m=!0,h4(b,O))}else O=wt,O=Ka(b,b===Xt?O:0,b.cancelPendingCommit!==null||b.timeoutHandle!==-1),(O&3)===0||Xa(b,O)||(m=!0,h4(b,O));b=b.next}while(m);dE=!1}}function fY(){u4()}function u4(){w0=uE=!1;var l=0;Sl!==0&&EY()&&(l=Sl);for(var d=te(),m=null,b=x0;b!==null;){var N=b.next,O=d4(b,d);O===0?(b.next=null,m===null?x0=N:m.next=N,N===null&&(kd=m)):(m=b,(l!==0||(O&3)!==0)&&(w0=!0)),b=N}Gn!==0&&Gn!==5||bp(l),Sl!==0&&(Sl=0)}function d4(l,d){for(var m=l.suspendedLanes,b=l.pingedLanes,N=l.expirationTimes,O=l.pendingLanes&-62914561;0<O;){var I=31-nn(O),J=1<<I,ee=N[I];ee===-1?((J&m)===0||(J&b)!==0)&&(N[I]=Ih(J,d)):ee<=d&&(l.expiredLanes|=J),O&=~J}if(d=Xt,m=wt,m=Ka(l,l===d?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),b=l.callbackNode,m===0||l===d&&(Ht===2||Ht===9)||l.cancelPendingCommit!==null)return b!==null&&b!==null&&re(b),l.callbackNode=null,l.callbackPriority=0;if((m&3)===0||Xa(l,m)){if(d=m&-m,d===l.callbackPriority)return d;switch(b!==null&&re(b),el(m)){case 2:case 8:m=Te;break;case 32:m=$e;break;case 268435456:m=At;break;default:m=$e}return b=f4.bind(null,l),m=G(m,b),l.callbackPriority=d,l.callbackNode=m,d}return b!==null&&b!==null&&re(b),l.callbackPriority=2,l.callbackNode=null,2}function f4(l,d){if(Gn!==0&&Gn!==5)return l.callbackNode=null,l.callbackPriority=0,null;var m=l.callbackNode;if(v0()&&l.callbackNode!==m)return null;var b=wt;return b=Ka(l,l===Xt?b:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),b===0?null:(G5(l,b,d),d4(l,te()),l.callbackNode!=null&&l.callbackNode===m?f4.bind(null,l):null)}function h4(l,d){if(v0())return null;G5(l,d,!0)}function hY(){_Y(function(){(Mt&6)!==0?G(de,fY):u4()})}function fE(){if(Sl===0){var l=bd;l===0&&(l=Ja,Ja<<=1,(Ja&261888)===0&&(Ja=256)),Sl=l}return Sl}function p4(l){return l==null||typeof l=="symbol"||typeof l=="boolean"?null:typeof l=="function"?l:Ay(""+l)}function m4(l,d){var m=d.ownerDocument.createElement("input");return m.name=d.name,m.value=d.value,l.id&&m.setAttribute("form",l.id),d.parentNode.insertBefore(m,d),l=new FormData(l),m.parentNode.removeChild(m),l}function pY(l,d,m,b,N){if(d==="submit"&&m&&m.stateNode===N){var O=p4((N[er]||null).action),I=b.submitter;I&&(d=(d=I[er]||null)?p4(d.formAction):I.getAttribute("formAction"),d!==null&&(O=d,I=null));var J=new ky("action","action",null,b,N);l.push({event:J,listeners:[{instance:null,listener:function(){if(b.defaultPrevented){if(Sl!==0){var ee=I?m4(N,I):new FormData(N);RS(m,{pending:!0,data:ee,method:N.method,action:O},null,ee)}}else typeof O=="function"&&(J.preventDefault(),ee=I?m4(N,I):new FormData(N),RS(m,{pending:!0,data:ee,method:N.method,action:O},O,ee))},currentTarget:N}]})}}for(var hE=0;hE<Y1.length;hE++){var pE=Y1[hE],mY=pE.toLowerCase(),gY=pE[0].toUpperCase()+pE.slice(1);Ci(mY,"on"+gY)}Ci(W$,"onAnimationEnd"),Ci(G$,"onAnimationIteration"),Ci(J$,"onAnimationStart"),Ci("dblclick","onDoubleClick"),Ci("focusin","onFocus"),Ci("focusout","onBlur"),Ci(RJ,"onTransitionRun"),Ci(kJ,"onTransitionStart"),Ci(MJ,"onTransitionCancel"),Ci(Y$,"onTransitionEnd"),il("onMouseEnter",["mouseout","mouseover"]),il("onMouseLeave",["mouseout","mouseover"]),il("onPointerEnter",["pointerout","pointerover"]),il("onPointerLeave",["pointerout","pointerover"]),Ls("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ls("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ls("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ls("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ls("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ls("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vp="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(" "),yY=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(vp));function g4(l,d){d=(d&4)!==0;for(var m=0;m<l.length;m++){var b=l[m],N=b.event;b=b.listeners;e:{var O=void 0;if(d)for(var I=b.length-1;0<=I;I--){var J=b[I],ee=J.instance,he=J.currentTarget;if(J=J.listener,ee!==O&&N.isPropagationStopped())break e;O=J,N.currentTarget=he;try{O(N)}catch(be){Dy(be)}N.currentTarget=null,O=ee}else for(I=0;I<b.length;I++){if(J=b[I],ee=J.instance,he=J.currentTarget,J=J.listener,ee!==O&&N.isPropagationStopped())break e;O=J,N.currentTarget=he;try{O(N)}catch(be){Dy(be)}N.currentTarget=null,O=ee}}}}function xt(l,d){var m=d[tr];m===void 0&&(m=d[tr]=new Set);var b=l+"__bubble";m.has(b)||(y4(d,l,2,!1),m.add(b))}function mE(l,d,m){var b=0;d&&(b|=4),y4(m,l,b,d)}var S0="_reactListening"+Math.random().toString(36).slice(2);function gE(l){if(!l[S0]){l[S0]=!0,Ey.forEach(function(m){m!=="selectionchange"&&(yY.has(m)||mE(m,!1,l),mE(m,!0,l))});var d=l.nodeType===9?l:l.ownerDocument;d===null||d[S0]||(d[S0]=!0,mE("selectionchange",!1,d))}}function y4(l,d,m,b){switch(W4(d)){case 2:var N=qY;break;case 8:N=WY;break;default:N=$E}m=N.bind(null,d,m,l),N=void 0,!D1||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(N=!0),b?N!==void 0?l.addEventListener(d,m,{capture:!0,passive:N}):l.addEventListener(d,m,!0):N!==void 0?l.addEventListener(d,m,{passive:N}):l.addEventListener(d,m,!1)}function yE(l,d,m,b,N){var O=b;if((d&1)===0&&(d&2)===0&&b!==null)e:for(;;){if(b===null)return;var I=b.tag;if(I===3||I===4){var J=b.stateNode.containerInfo;if(J===N)break;if(I===4)for(I=b.return;I!==null;){var ee=I.tag;if((ee===3||ee===4)&&I.stateNode.containerInfo===N)return;I=I.return}for(;J!==null;){if(I=tl(J),I===null)return;if(ee=I.tag,ee===5||ee===6||ee===26||ee===27){b=O=I;continue e}J=J.parentNode}}b=b.return}S$(function(){var he=O,be=M1(m),Se=[];e:{var ge=K$.get(l);if(ge!==void 0){var ye=ky,He=l;switch(l){case"keypress":if($y(m)===0)break e;case"keydown":case"keyup":ye=uJ;break;case"focusin":He="focus",ye=z1;break;case"focusout":He="blur",ye=z1;break;case"beforeblur":case"afterblur":ye=z1;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ye=_$;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=QG;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=hJ;break;case W$:case G$:case J$:ye=tJ;break;case Y$:ye=mJ;break;case"scroll":case"scrollend":ye=KG;break;case"wheel":ye=yJ;break;case"copy":case"cut":case"paste":ye=rJ;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=O$;break;case"toggle":case"beforetoggle":ye=vJ}var it=(d&4)!==0,Jt=!it&&(l==="scroll"||l==="scrollend"),ae=it?ge!==null?ge+"Capture":null:ge;it=[];for(var oe=he,fe;oe!==null;){var we=oe;if(fe=we.stateNode,we=we.tag,we!==5&&we!==26&&we!==27||fe===null||ae===null||(we=Bh(oe,ae),we!=null&&it.push(xp(oe,we,fe))),Jt)break;oe=oe.return}0<it.length&&(ge=new ye(ge,He,null,m,be),Se.push({event:ge,listeners:it}))}}if((d&7)===0){e:{if(ge=l==="mouseover"||l==="pointerover",ye=l==="mouseout"||l==="pointerout",ge&&m!==k1&&(He=m.relatedTarget||m.fromElement)&&(tl(He)||He[lt]))break e;if((ye||ge)&&(ge=be.window===be?be:(ge=be.ownerDocument)?ge.defaultView||ge.parentWindow:window,ye?(He=m.relatedTarget||m.toElement,ye=he,He=He?tl(He):null,He!==null&&(Jt=i(He),it=He.tag,He!==Jt||it!==5&&it!==27&&it!==6)&&(He=null)):(ye=null,He=he),ye!==He)){if(it=_$,we="onMouseLeave",ae="onMouseEnter",oe="mouse",(l==="pointerout"||l==="pointerover")&&(it=O$,we="onPointerLeave",ae="onPointerEnter",oe="pointer"),Jt=ye==null?ge:rl(ye),fe=He==null?ge:rl(He),ge=new it(we,oe+"leave",ye,m,be),ge.target=Jt,ge.relatedTarget=fe,we=null,tl(be)===he&&(it=new it(ae,oe+"enter",He,m,be),it.target=fe,it.relatedTarget=Jt,we=it),Jt=we,ye&&He)t:{for(it=bY,ae=ye,oe=He,fe=0,we=ae;we;we=it(we))fe++;we=0;for(var et=oe;et;et=it(et))we++;for(;0<fe-we;)ae=it(ae),fe--;for(;0<we-fe;)oe=it(oe),we--;for(;fe--;){if(ae===oe||oe!==null&&ae===oe.alternate){it=ae;break t}ae=it(ae),oe=it(oe)}it=null}else it=null;ye!==null&&b4(Se,ge,ye,it,!1),He!==null&&Jt!==null&&b4(Se,Jt,He,it,!0)}}e:{if(ge=he?rl(he):window,ye=ge.nodeName&&ge.nodeName.toLowerCase(),ye==="select"||ye==="input"&&ge.type==="file")var Tt=P$;else if(k$(ge))if(D$)Tt=AJ;else{Tt=OJ;var Ye=CJ}else ye=ge.nodeName,!ye||ye.toLowerCase()!=="input"||ge.type!=="checkbox"&&ge.type!=="radio"?he&&R1(he.elementType)&&(Tt=P$):Tt=jJ;if(Tt&&(Tt=Tt(l,he))){M$(Se,Tt,m,be);break e}Ye&&Ye(l,ge,he),l==="focusout"&&he&&ge.type==="number"&&he.memoizedProps.value!=null&&od(ge,"number",ge.value)}switch(Ye=he?rl(he):window,l){case"focusin":(k$(Ye)||Ye.contentEditable==="true")&&(ud=Ye,W1=he,Yh=null);break;case"focusout":Yh=W1=ud=null;break;case"mousedown":G1=!0;break;case"contextmenu":case"mouseup":case"dragend":G1=!1,H$(Se,m,be);break;case"selectionchange":if($J)break;case"keydown":case"keyup":H$(Se,m,be)}var ht;if(V1)e:{switch(l){case"compositionstart":var St="onCompositionStart";break e;case"compositionend":St="onCompositionEnd";break e;case"compositionupdate":St="onCompositionUpdate";break e}St=void 0}else cd?$$(l,m)&&(St="onCompositionEnd"):l==="keydown"&&m.keyCode===229&&(St="onCompositionStart");St&&(j$&&m.locale!=="ko"&&(cd||St!=="onCompositionStart"?St==="onCompositionEnd"&&cd&&(ht=E$()):(sl=be,I1="value"in sl?sl.value:sl.textContent,cd=!0)),Ye=E0(he,St),0<Ye.length&&(St=new C$(St,l,null,m,be),Se.push({event:St,listeners:Ye}),ht?St.data=ht:(ht=R$(m),ht!==null&&(St.data=ht)))),(ht=wJ?SJ(l,m):EJ(l,m))&&(St=E0(he,"onBeforeInput"),0<St.length&&(Ye=new C$("onBeforeInput","beforeinput",null,m,be),Se.push({event:Ye,listeners:St}),Ye.data=ht)),pY(Se,l,he,m,be)}g4(Se,d)})}function xp(l,d,m){return{instance:l,listener:d,currentTarget:m}}function E0(l,d){for(var m=d+"Capture",b=[];l!==null;){var N=l,O=N.stateNode;if(N=N.tag,N!==5&&N!==26&&N!==27||O===null||(N=Bh(l,m),N!=null&&b.unshift(xp(l,N,O)),N=Bh(l,d),N!=null&&b.push(xp(l,N,O))),l.tag===3)return b;l=l.return}return[]}function bY(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5&&l.tag!==27);return l||null}function b4(l,d,m,b,N){for(var O=d._reactName,I=[];m!==null&&m!==b;){var J=m,ee=J.alternate,he=J.stateNode;if(J=J.tag,ee!==null&&ee===b)break;J!==5&&J!==26&&J!==27||he===null||(ee=he,N?(he=Bh(m,O),he!=null&&I.unshift(xp(m,he,ee))):N||(he=Bh(m,O),he!=null&&I.push(xp(m,he,ee)))),m=m.return}I.length!==0&&l.push({event:d,listeners:I})}var vY=/\r\n?/g,xY=/\u0000|\uFFFD/g;function v4(l){return(typeof l=="string"?l:""+l).replace(vY,`
`).replace(xY,"")}function x4(l,d){return d=v4(d),v4(l)===d}function Gt(l,d,m,b,N,O){switch(m){case"children":typeof b=="string"?d==="body"||d==="textarea"&&b===""||sd(l,b):(typeof b=="number"||typeof b=="bigint")&&d!=="body"&&sd(l,""+b);break;case"className":td(l,"class",b);break;case"tabIndex":td(l,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":td(l,m,b);break;case"style":x$(l,b,O);break;case"data":if(d!=="object"){td(l,"data",b);break}case"src":case"href":if(b===""&&(d!=="a"||m!=="href")){l.removeAttribute(m);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){l.removeAttribute(m);break}b=Ay(""+b),l.setAttribute(m,b);break;case"action":case"formAction":if(typeof b=="function"){l.setAttribute(m,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof O=="function"&&(m==="formAction"?(d!=="input"&&Gt(l,d,"name",N.name,N,null),Gt(l,d,"formEncType",N.formEncType,N,null),Gt(l,d,"formMethod",N.formMethod,N,null),Gt(l,d,"formTarget",N.formTarget,N,null)):(Gt(l,d,"encType",N.encType,N,null),Gt(l,d,"method",N.method,N,null),Gt(l,d,"target",N.target,N,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){l.removeAttribute(m);break}b=Ay(""+b),l.setAttribute(m,b);break;case"onClick":b!=null&&(l.onclick=Fs);break;case"onScroll":b!=null&&xt("scroll",l);break;case"onScrollEnd":b!=null&&xt("scrollend",l);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(r(61));if(m=b.__html,m!=null){if(N.children!=null)throw Error(r(60));l.innerHTML=m}}break;case"multiple":l.multiple=b&&typeof b!="function"&&typeof b!="symbol";break;case"muted":l.muted=b&&typeof b!="function"&&typeof b!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(b==null||typeof b=="function"||typeof b=="boolean"||typeof b=="symbol"){l.removeAttribute("xlink:href");break}m=Ay(""+b),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":b!=null&&typeof b!="function"&&typeof b!="symbol"?l.setAttribute(m,""+b):l.removeAttribute(m);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":b&&typeof b!="function"&&typeof b!="symbol"?l.setAttribute(m,""):l.removeAttribute(m);break;case"capture":case"download":b===!0?l.setAttribute(m,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?l.setAttribute(m,b):l.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?l.setAttribute(m,b):l.removeAttribute(m);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?l.removeAttribute(m):l.setAttribute(m,b);break;case"popover":xt("beforetoggle",l),xt("toggle",l),ed(l,"popover",b);break;case"xlinkActuate":_i(l,"http://www.w3.org/1999/xlink","xlink:actuate",b);break;case"xlinkArcrole":_i(l,"http://www.w3.org/1999/xlink","xlink:arcrole",b);break;case"xlinkRole":_i(l,"http://www.w3.org/1999/xlink","xlink:role",b);break;case"xlinkShow":_i(l,"http://www.w3.org/1999/xlink","xlink:show",b);break;case"xlinkTitle":_i(l,"http://www.w3.org/1999/xlink","xlink:title",b);break;case"xlinkType":_i(l,"http://www.w3.org/1999/xlink","xlink:type",b);break;case"xmlBase":_i(l,"http://www.w3.org/XML/1998/namespace","xml:base",b);break;case"xmlLang":_i(l,"http://www.w3.org/XML/1998/namespace","xml:lang",b);break;case"xmlSpace":_i(l,"http://www.w3.org/XML/1998/namespace","xml:space",b);break;case"is":ed(l,"is",b);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&(m=JG.get(m)||m,ed(l,m,b))}}function bE(l,d,m,b,N,O){switch(m){case"style":x$(l,b,O);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(r(61));if(m=b.__html,m!=null){if(N.children!=null)throw Error(r(60));l.innerHTML=m}}break;case"children":typeof b=="string"?sd(l,b):(typeof b=="number"||typeof b=="bigint")&&sd(l,""+b);break;case"onScroll":b!=null&&xt("scroll",l);break;case"onScrollEnd":b!=null&&xt("scrollend",l);break;case"onClick":b!=null&&(l.onclick=Fs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ny.hasOwnProperty(m))e:{if(m[0]==="o"&&m[1]==="n"&&(N=m.endsWith("Capture"),d=m.slice(2,N?m.length-7:void 0),O=l[er]||null,O=O!=null?O[m]:null,typeof O=="function"&&l.removeEventListener(d,O,N),typeof b=="function")){typeof O!="function"&&O!==null&&(m in l?l[m]=null:l.hasAttribute(m)&&l.removeAttribute(m)),l.addEventListener(d,b,N);break e}m in l?l[m]=b:b===!0?l.setAttribute(m,""):ed(l,m,b)}}}function ur(l,d,m){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":xt("error",l),xt("load",l);var b=!1,N=!1,O;for(O in m)if(m.hasOwnProperty(O)){var I=m[O];if(I!=null)switch(O){case"src":b=!0;break;case"srcSet":N=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,d));default:Gt(l,d,O,I,m,null)}}N&&Gt(l,d,"srcSet",m.srcSet,m,null),b&&Gt(l,d,"src",m.src,m,null);return;case"input":xt("invalid",l);var J=O=I=N=null,ee=null,he=null;for(b in m)if(m.hasOwnProperty(b)){var be=m[b];if(be!=null)switch(b){case"name":N=be;break;case"type":I=be;break;case"checked":ee=be;break;case"defaultChecked":he=be;break;case"value":O=be;break;case"defaultValue":J=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(r(137,d));break;default:Gt(l,d,b,be,m,null)}}jy(l,O,J,ee,he,I,N,!1);return;case"select":xt("invalid",l),b=I=O=null;for(N in m)if(m.hasOwnProperty(N)&&(J=m[N],J!=null))switch(N){case"value":O=J;break;case"defaultValue":I=J;break;case"multiple":b=J;default:Gt(l,d,N,J,m,null)}d=O,m=I,l.multiple=!!b,d!=null?id(l,!!b,d,!1):m!=null&&id(l,!!b,m,!0);return;case"textarea":xt("invalid",l),O=N=b=null;for(I in m)if(m.hasOwnProperty(I)&&(J=m[I],J!=null))switch(I){case"value":b=J;break;case"defaultValue":N=J;break;case"children":O=J;break;case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(91));break;default:Gt(l,d,I,J,m,null)}b$(l,b,N,O);return;case"option":for(ee in m)if(m.hasOwnProperty(ee)&&(b=m[ee],b!=null))switch(ee){case"selected":l.selected=b&&typeof b!="function"&&typeof b!="symbol";break;default:Gt(l,d,ee,b,m,null)}return;case"dialog":xt("beforetoggle",l),xt("toggle",l),xt("cancel",l),xt("close",l);break;case"iframe":case"object":xt("load",l);break;case"video":case"audio":for(b=0;b<vp.length;b++)xt(vp[b],l);break;case"image":xt("error",l),xt("load",l);break;case"details":xt("toggle",l);break;case"embed":case"source":case"link":xt("error",l),xt("load",l);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(he in m)if(m.hasOwnProperty(he)&&(b=m[he],b!=null))switch(he){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,d));default:Gt(l,d,he,b,m,null)}return;default:if(R1(d)){for(be in m)m.hasOwnProperty(be)&&(b=m[be],b!==void 0&&bE(l,d,be,b,m,void 0));return}}for(J in m)m.hasOwnProperty(J)&&(b=m[J],b!=null&&Gt(l,d,J,b,m,null))}function wY(l,d,m,b){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var N=null,O=null,I=null,J=null,ee=null,he=null,be=null;for(ye in m){var Se=m[ye];if(m.hasOwnProperty(ye)&&Se!=null)switch(ye){case"checked":break;case"value":break;case"defaultValue":ee=Se;default:b.hasOwnProperty(ye)||Gt(l,d,ye,null,b,Se)}}for(var ge in b){var ye=b[ge];if(Se=m[ge],b.hasOwnProperty(ge)&&(ye!=null||Se!=null))switch(ge){case"type":O=ye;break;case"name":N=ye;break;case"checked":he=ye;break;case"defaultChecked":be=ye;break;case"value":I=ye;break;case"defaultValue":J=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(r(137,d));break;default:ye!==Se&&Gt(l,d,ge,ye,b,Se)}}zh(l,I,J,ee,he,be,O,N);return;case"select":ye=I=J=ge=null;for(O in m)if(ee=m[O],m.hasOwnProperty(O)&&ee!=null)switch(O){case"value":break;case"multiple":ye=ee;default:b.hasOwnProperty(O)||Gt(l,d,O,null,b,ee)}for(N in b)if(O=b[N],ee=m[N],b.hasOwnProperty(N)&&(O!=null||ee!=null))switch(N){case"value":ge=O;break;case"defaultValue":J=O;break;case"multiple":I=O;default:O!==ee&&Gt(l,d,N,O,b,ee)}d=J,m=I,b=ye,ge!=null?id(l,!!m,ge,!1):!!b!=!!m&&(d!=null?id(l,!!m,d,!0):id(l,!!m,m?[]:"",!1));return;case"textarea":ye=ge=null;for(J in m)if(N=m[J],m.hasOwnProperty(J)&&N!=null&&!b.hasOwnProperty(J))switch(J){case"value":break;case"children":break;default:Gt(l,d,J,null,b,N)}for(I in b)if(N=b[I],O=m[I],b.hasOwnProperty(I)&&(N!=null||O!=null))switch(I){case"value":ge=N;break;case"defaultValue":ye=N;break;case"children":break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:N!==O&&Gt(l,d,I,N,b,O)}y$(l,ge,ye);return;case"option":for(var He in m)if(ge=m[He],m.hasOwnProperty(He)&&ge!=null&&!b.hasOwnProperty(He))switch(He){case"selected":l.selected=!1;break;default:Gt(l,d,He,null,b,ge)}for(ee in b)if(ge=b[ee],ye=m[ee],b.hasOwnProperty(ee)&&ge!==ye&&(ge!=null||ye!=null))switch(ee){case"selected":l.selected=ge&&typeof ge!="function"&&typeof ge!="symbol";break;default:Gt(l,d,ee,ge,b,ye)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var it in m)ge=m[it],m.hasOwnProperty(it)&&ge!=null&&!b.hasOwnProperty(it)&&Gt(l,d,it,null,b,ge);for(he in b)if(ge=b[he],ye=m[he],b.hasOwnProperty(he)&&ge!==ye&&(ge!=null||ye!=null))switch(he){case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(r(137,d));break;default:Gt(l,d,he,ge,b,ye)}return;default:if(R1(d)){for(var Jt in m)ge=m[Jt],m.hasOwnProperty(Jt)&&ge!==void 0&&!b.hasOwnProperty(Jt)&&bE(l,d,Jt,void 0,b,ge);for(be in b)ge=b[be],ye=m[be],!b.hasOwnProperty(be)||ge===ye||ge===void 0&&ye===void 0||bE(l,d,be,ge,b,ye);return}}for(var ae in m)ge=m[ae],m.hasOwnProperty(ae)&&ge!=null&&!b.hasOwnProperty(ae)&&Gt(l,d,ae,null,b,ge);for(Se in b)ge=b[Se],ye=m[Se],!b.hasOwnProperty(Se)||ge===ye||ge==null&&ye==null||Gt(l,d,Se,ge,b,ye)}function w4(l){switch(l){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function SY(){if(typeof performance.getEntriesByType=="function"){for(var l=0,d=0,m=performance.getEntriesByType("resource"),b=0;b<m.length;b++){var N=m[b],O=N.transferSize,I=N.initiatorType,J=N.duration;if(O&&J&&w4(I)){for(I=0,J=N.responseEnd,b+=1;b<m.length;b++){var ee=m[b],he=ee.startTime;if(he>J)break;var be=ee.transferSize,Se=ee.initiatorType;be&&w4(Se)&&(ee=ee.responseEnd,I+=be*(ee<J?1:(J-he)/(ee-he)))}if(--b,d+=8*(O+I)/(N.duration/1e3),l++,10<l)break}}if(0<l)return d/l/1e6}return navigator.connection&&(l=navigator.connection.downlink,typeof l=="number")?l:5}var vE=null,xE=null;function N0(l){return l.nodeType===9?l:l.ownerDocument}function S4(l){switch(l){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function E4(l,d){if(l===0)switch(d){case"svg":return 1;case"math":return 2;default:return 0}return l===1&&d==="foreignObject"?0:l}function wE(l,d){return l==="textarea"||l==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.children=="bigint"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var SE=null;function EY(){var l=window.event;return l&&l.type==="popstate"?l===SE?!1:(SE=l,!0):(SE=null,!1)}var N4=typeof setTimeout=="function"?setTimeout:void 0,NY=typeof clearTimeout=="function"?clearTimeout:void 0,_4=typeof Promise=="function"?Promise:void 0,_Y=typeof queueMicrotask=="function"?queueMicrotask:typeof _4<"u"?function(l){return _4.resolve(null).then(l).catch(CY)}:N4;function CY(l){setTimeout(function(){throw l})}function El(l){return l==="head"}function C4(l,d){var m=d,b=0;do{var N=m.nextSibling;if(l.removeChild(m),N&&N.nodeType===8)if(m=N.data,m==="/$"||m==="/&"){if(b===0){l.removeChild(N),Id(d);return}b--}else if(m==="$"||m==="$?"||m==="$~"||m==="$!"||m==="&")b++;else if(m==="html")wp(l.ownerDocument.documentElement);else if(m==="head"){m=l.ownerDocument.head,wp(m);for(var O=m.firstChild;O;){var I=O.nextSibling,J=O.nodeName;O[Tc]||J==="SCRIPT"||J==="STYLE"||J==="LINK"&&O.rel.toLowerCase()==="stylesheet"||m.removeChild(O),O=I}}else m==="body"&&wp(l.ownerDocument.body);m=N}while(m);Id(d)}function O4(l,d){var m=l;l=0;do{var b=m.nextSibling;if(m.nodeType===1?d?(m._stashedDisplay=m.style.display,m.style.display="none"):(m.style.display=m._stashedDisplay||"",m.getAttribute("style")===""&&m.removeAttribute("style")):m.nodeType===3&&(d?(m._stashedText=m.nodeValue,m.nodeValue=""):m.nodeValue=m._stashedText||""),b&&b.nodeType===8)if(m=b.data,m==="/$"){if(l===0)break;l--}else m!=="$"&&m!=="$?"&&m!=="$~"&&m!=="$!"||l++;m=b}while(m)}function EE(l){var d=l.firstChild;for(d&&d.nodeType===10&&(d=d.nextSibling);d;){var m=d;switch(d=d.nextSibling,m.nodeName){case"HTML":case"HEAD":case"BODY":EE(m),Lh(m);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(m.rel.toLowerCase()==="stylesheet")continue}l.removeChild(m)}}function OY(l,d,m,b){for(;l.nodeType===1;){var N=m;if(l.nodeName.toLowerCase()!==d.toLowerCase()){if(!b&&(l.nodeName!=="INPUT"||l.type!=="hidden"))break}else if(b){if(!l[Tc])switch(d){case"meta":if(!l.hasAttribute("itemprop"))break;return l;case"link":if(O=l.getAttribute("rel"),O==="stylesheet"&&l.hasAttribute("data-precedence"))break;if(O!==N.rel||l.getAttribute("href")!==(N.href==null||N.href===""?null:N.href)||l.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin)||l.getAttribute("title")!==(N.title==null?null:N.title))break;return l;case"style":if(l.hasAttribute("data-precedence"))break;return l;case"script":if(O=l.getAttribute("src"),(O!==(N.src==null?null:N.src)||l.getAttribute("type")!==(N.type==null?null:N.type)||l.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin))&&O&&l.hasAttribute("async")&&!l.hasAttribute("itemprop"))break;return l;default:return l}}else if(d==="input"&&l.type==="hidden"){var O=N.name==null?null:""+N.name;if(N.type==="hidden"&&l.getAttribute("name")===O)return l}else return l;if(l=Zo(l.nextSibling),l===null)break}return null}function jY(l,d,m){if(d==="")return null;for(;l.nodeType!==3;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!m||(l=Zo(l.nextSibling),l===null))return null;return l}function j4(l,d){for(;l.nodeType!==8;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!d||(l=Zo(l.nextSibling),l===null))return null;return l}function NE(l){return l.data==="$?"||l.data==="$~"}function _E(l){return l.data==="$!"||l.data==="$?"&&l.ownerDocument.readyState!=="loading"}function AY(l,d){var m=l.ownerDocument;if(l.data==="$~")l._reactRetry=d;else if(l.data!=="$?"||m.readyState!=="loading")d();else{var b=function(){d(),m.removeEventListener("DOMContentLoaded",b)};m.addEventListener("DOMContentLoaded",b),l._reactRetry=b}}function Zo(l){for(;l!=null;l=l.nextSibling){var d=l.nodeType;if(d===1||d===3)break;if(d===8){if(d=l.data,d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"||d==="F!"||d==="F")break;if(d==="/$"||d==="/&")return null}}return l}var CE=null;function A4(l){l=l.nextSibling;for(var d=0;l;){if(l.nodeType===8){var m=l.data;if(m==="/$"||m==="/&"){if(d===0)return Zo(l.nextSibling);d--}else m!=="$"&&m!=="$!"&&m!=="$?"&&m!=="$~"&&m!=="&"||d++}l=l.nextSibling}return null}function T4(l){l=l.previousSibling;for(var d=0;l;){if(l.nodeType===8){var m=l.data;if(m==="$"||m==="$!"||m==="$?"||m==="$~"||m==="&"){if(d===0)return l;d--}else m!=="/$"&&m!=="/&"||d++}l=l.previousSibling}return null}function $4(l,d,m){switch(d=N0(m),l){case"html":if(l=d.documentElement,!l)throw Error(r(452));return l;case"head":if(l=d.head,!l)throw Error(r(453));return l;case"body":if(l=d.body,!l)throw Error(r(454));return l;default:throw Error(r(451))}}function wp(l){for(var d=l.attributes;d.length;)l.removeAttributeNode(d[0]);Lh(l)}var ei=new Map,R4=new Set;function _0(l){return typeof l.getRootNode=="function"?l.getRootNode():l.nodeType===9?l:l.ownerDocument}var ta=L.d;L.d={f:TY,r:$Y,D:RY,C:kY,L:MY,m:PY,X:IY,S:DY,M:LY};function TY(){var l=ta.f(),d=g0();return l||d}function $Y(l){var d=nl(l);d!==null&&d.tag===5&&d.type==="form"?Y3(d):ta.r(l)}var Md=typeof document>"u"?null:document;function k4(l,d,m){var b=Md;if(b&&typeof d=="string"&&d){var N=mr(d);N='link[rel="'+l+'"][href="'+N+'"]',typeof m=="string"&&(N+='[crossorigin="'+m+'"]'),R4.has(N)||(R4.add(N),l={rel:l,crossOrigin:m,href:d},b.querySelector(N)===null&&(d=b.createElement("link"),ur(d,"link",l),Dn(d),b.head.appendChild(d)))}}function RY(l){ta.D(l),k4("dns-prefetch",l,null)}function kY(l,d){ta.C(l,d),k4("preconnect",l,d)}function MY(l,d,m){ta.L(l,d,m);var b=Md;if(b&&l&&d){var N='link[rel="preload"][as="'+mr(d)+'"]';d==="image"&&m&&m.imageSrcSet?(N+='[imagesrcset="'+mr(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(N+='[imagesizes="'+mr(m.imageSizes)+'"]')):N+='[href="'+mr(l)+'"]';var O=N;switch(d){case"style":O=Pd(l);break;case"script":O=Dd(l)}ei.has(O)||(l=p({rel:"preload",href:d==="image"&&m&&m.imageSrcSet?void 0:l,as:d},m),ei.set(O,l),b.querySelector(N)!==null||d==="style"&&b.querySelector(Sp(O))||d==="script"&&b.querySelector(Ep(O))||(d=b.createElement("link"),ur(d,"link",l),Dn(d),b.head.appendChild(d)))}}function PY(l,d){ta.m(l,d);var m=Md;if(m&&l){var b=d&&typeof d.as=="string"?d.as:"script",N='link[rel="modulepreload"][as="'+mr(b)+'"][href="'+mr(l)+'"]',O=N;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":O=Dd(l)}if(!ei.has(O)&&(l=p({rel:"modulepreload",href:l},d),ei.set(O,l),m.querySelector(N)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(Ep(O)))return}b=m.createElement("link"),ur(b,"link",l),Dn(b),m.head.appendChild(b)}}}function DY(l,d,m){ta.S(l,d,m);var b=Md;if(b&&l){var N=ol(b).hoistableStyles,O=Pd(l);d=d||"default";var I=N.get(O);if(!I){var J={loading:0,preload:null};if(I=b.querySelector(Sp(O)))J.loading=5;else{l=p({rel:"stylesheet",href:l,"data-precedence":d},m),(m=ei.get(O))&&OE(l,m);var ee=I=b.createElement("link");Dn(ee),ur(ee,"link",l),ee._p=new Promise(function(he,be){ee.onload=he,ee.onerror=be}),ee.addEventListener("load",function(){J.loading|=1}),ee.addEventListener("error",function(){J.loading|=2}),J.loading|=4,C0(I,d,b)}I={type:"stylesheet",instance:I,count:1,state:J},N.set(O,I)}}}function IY(l,d){ta.X(l,d);var m=Md;if(m&&l){var b=ol(m).hoistableScripts,N=Dd(l),O=b.get(N);O||(O=m.querySelector(Ep(N)),O||(l=p({src:l,async:!0},d),(d=ei.get(N))&&jE(l,d),O=m.createElement("script"),Dn(O),ur(O,"link",l),m.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},b.set(N,O))}}function LY(l,d){ta.M(l,d);var m=Md;if(m&&l){var b=ol(m).hoistableScripts,N=Dd(l),O=b.get(N);O||(O=m.querySelector(Ep(N)),O||(l=p({src:l,async:!0,type:"module"},d),(d=ei.get(N))&&jE(l,d),O=m.createElement("script"),Dn(O),ur(O,"link",l),m.head.appendChild(O)),O={type:"script",instance:O,count:1,state:null},b.set(N,O))}}function M4(l,d,m,b){var N=(N=pe.current)?_0(N):null;if(!N)throw Error(r(446));switch(l){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(d=Pd(m.href),m=ol(N).hoistableStyles,b=m.get(d),b||(b={type:"style",instance:null,count:0,state:null},m.set(d,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){l=Pd(m.href);var O=ol(N).hoistableStyles,I=O.get(l);if(I||(N=N.ownerDocument||N,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},O.set(l,I),(O=N.querySelector(Sp(l)))&&!O._p&&(I.instance=O,I.state.loading=5),ei.has(l)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},ei.set(l,m),O||FY(N,l,m,I.state))),d&&b===null)throw Error(r(528,""));return I}if(d&&b!==null)throw Error(r(529,""));return null;case"script":return d=m.async,m=m.src,typeof m=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=Dd(m),m=ol(N).hoistableScripts,b=m.get(d),b||(b={type:"script",instance:null,count:0,state:null},m.set(d,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,l))}}function Pd(l){return'href="'+mr(l)+'"'}function Sp(l){return'link[rel="stylesheet"]['+l+"]"}function P4(l){return p({},l,{"data-precedence":l.precedence,precedence:null})}function FY(l,d,m,b){l.querySelector('link[rel="preload"][as="style"]['+d+"]")?b.loading=1:(d=l.createElement("link"),b.preload=d,d.addEventListener("load",function(){return b.loading|=1}),d.addEventListener("error",function(){return b.loading|=2}),ur(d,"link",m),Dn(d),l.head.appendChild(d))}function Dd(l){return'[src="'+mr(l)+'"]'}function Ep(l){return"script[async]"+l}function D4(l,d,m){if(d.count++,d.instance===null)switch(d.type){case"style":var b=l.querySelector('style[data-href~="'+mr(m.href)+'"]');if(b)return d.instance=b,Dn(b),b;var N=p({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return b=(l.ownerDocument||l).createElement("style"),Dn(b),ur(b,"style",N),C0(b,m.precedence,l),d.instance=b;case"stylesheet":N=Pd(m.href);var O=l.querySelector(Sp(N));if(O)return d.state.loading|=4,d.instance=O,Dn(O),O;b=P4(m),(N=ei.get(N))&&OE(b,N),O=(l.ownerDocument||l).createElement("link"),Dn(O);var I=O;return I._p=new Promise(function(J,ee){I.onload=J,I.onerror=ee}),ur(O,"link",b),d.state.loading|=4,C0(O,m.precedence,l),d.instance=O;case"script":return O=Dd(m.src),(N=l.querySelector(Ep(O)))?(d.instance=N,Dn(N),N):(b=m,(N=ei.get(O))&&(b=p({},m),jE(b,N)),l=l.ownerDocument||l,N=l.createElement("script"),Dn(N),ur(N,"link",b),l.head.appendChild(N),d.instance=N);case"void":return null;default:throw Error(r(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(b=d.instance,d.state.loading|=4,C0(b,m.precedence,l));return d.instance}function C0(l,d,m){for(var b=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),N=b.length?b[b.length-1]:null,O=N,I=0;I<b.length;I++){var J=b[I];if(J.dataset.precedence===d)O=J;else if(O!==N)break}O?O.parentNode.insertBefore(l,O.nextSibling):(d=m.nodeType===9?m.head:m,d.insertBefore(l,d.firstChild))}function OE(l,d){l.crossOrigin==null&&(l.crossOrigin=d.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=d.referrerPolicy),l.title==null&&(l.title=d.title)}function jE(l,d){l.crossOrigin==null&&(l.crossOrigin=d.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=d.referrerPolicy),l.integrity==null&&(l.integrity=d.integrity)}var O0=null;function I4(l,d,m){if(O0===null){var b=new Map,N=O0=new Map;N.set(m,b)}else N=O0,b=N.get(m),b||(b=new Map,N.set(m,b));if(b.has(l))return b;for(b.set(l,null),m=m.getElementsByTagName(l),N=0;N<m.length;N++){var O=m[N];if(!(O[Tc]||O[Tn]||l==="link"&&O.getAttribute("rel")==="stylesheet")&&O.namespaceURI!=="http://www.w3.org/2000/svg"){var I=O.getAttribute(d)||"";I=l+I;var J=b.get(I);J?J.push(O):b.set(I,[O])}}return b}function L4(l,d,m){l=l.ownerDocument||l,l.head.insertBefore(m,d==="title"?l.querySelector("head > title"):null)}function zY(l,d,m){if(m===1||d.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return l=d.disabled,typeof d.precedence=="string"&&l==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function F4(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function BY(l,d,m,b){if(m.type==="stylesheet"&&(typeof b.media!="string"||matchMedia(b.media).matches!==!1)&&(m.state.loading&4)===0){if(m.instance===null){var N=Pd(b.href),O=d.querySelector(Sp(N));if(O){d=O._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(l.count++,l=j0.bind(l),d.then(l,l)),m.state.loading|=4,m.instance=O,Dn(O);return}O=d.ownerDocument||d,b=P4(b),(N=ei.get(N))&&OE(b,N),O=O.createElement("link"),Dn(O);var I=O;I._p=new Promise(function(J,ee){I.onload=J,I.onerror=ee}),ur(O,"link",b),m.instance=O}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(m,d),(d=m.state.preload)&&(m.state.loading&3)===0&&(l.count++,m=j0.bind(l),d.addEventListener("load",m),d.addEventListener("error",m))}}var AE=0;function VY(l,d){return l.stylesheets&&l.count===0&&T0(l,l.stylesheets),0<l.count||0<l.imgCount?function(m){var b=setTimeout(function(){if(l.stylesheets&&T0(l,l.stylesheets),l.unsuspend){var O=l.unsuspend;l.unsuspend=null,O()}},6e4+d);0<l.imgBytes&&AE===0&&(AE=62500*SY());var N=setTimeout(function(){if(l.waitingForImages=!1,l.count===0&&(l.stylesheets&&T0(l,l.stylesheets),l.unsuspend)){var O=l.unsuspend;l.unsuspend=null,O()}},(l.imgBytes>AE?50:800)+d);return l.unsuspend=m,function(){l.unsuspend=null,clearTimeout(b),clearTimeout(N)}}:null}function j0(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)T0(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var A0=null;function T0(l,d){l.stylesheets=null,l.unsuspend!==null&&(l.count++,A0=new Map,d.forEach(UY,l),A0=null,j0.call(l))}function UY(l,d){if(!(d.state.loading&4)){var m=A0.get(l);if(m)var b=m.get(null);else{m=new Map,A0.set(l,m);for(var N=l.querySelectorAll("link[data-precedence],style[data-precedence]"),O=0;O<N.length;O++){var I=N[O];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(m.set(I.dataset.precedence,I),b=I)}b&&m.set(null,b)}N=d.instance,I=N.getAttribute("data-precedence"),O=m.get(I)||b,O===b&&m.set(null,N),m.set(I,N),this.count++,b=j0.bind(this),N.addEventListener("load",b),N.addEventListener("error",b),O?O.parentNode.insertBefore(N,O.nextSibling):(l=l.nodeType===9?l.head:l,l.insertBefore(N,l.firstChild)),d.state.loading|=4}}var Np={$$typeof:_,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function HY(l,d,m,b,N,O,I,J,ee){this.tag=1,this.containerInfo=l,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=rn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rn(0),this.hiddenUpdates=rn(null),this.identifierPrefix=b,this.onUncaughtError=N,this.onCaughtError=O,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ee,this.incompleteTransitions=new Map}function z4(l,d,m,b,N,O,I,J,ee,he,be,Se){return l=new HY(l,d,m,I,ee,he,be,Se,J),d=1,O===!0&&(d|=24),O=wo(3,null,null,d),l.current=O,O.stateNode=l,d=lS(),d.refCount++,l.pooledCache=d,d.refCount++,O.memoizedState={element:b,isDehydrated:m,cache:d},fS(O),l}function B4(l){return l?(l=hd,l):hd}function V4(l,d,m,b,N,O){N=B4(N),b.context===null?b.context=N:b.pendingContext=N,b=fl(d),b.payload={element:m},O=O===void 0?null:O,O!==null&&(b.callback=O),m=hl(l,b,d),m!==null&&(Kr(m,l,d),np(m,l,d))}function U4(l,d){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var m=l.retryLane;l.retryLane=m!==0&&m<d?m:d}}function TE(l,d){U4(l,d),(l=l.alternate)&&U4(l,d)}function H4(l){if(l.tag===13||l.tag===31){var d=Mc(l,67108864);d!==null&&Kr(d,l,67108864),TE(l,67108864)}}function q4(l){if(l.tag===13||l.tag===31){var d=Co();d=Za(d);var m=Mc(l,d);m!==null&&Kr(m,l,d),TE(l,d)}}var $0=!0;function qY(l,d,m,b){var N=$.T;$.T=null;var O=L.p;try{L.p=2,$E(l,d,m,b)}finally{L.p=O,$.T=N}}function WY(l,d,m,b){var N=$.T;$.T=null;var O=L.p;try{L.p=8,$E(l,d,m,b)}finally{L.p=O,$.T=N}}function $E(l,d,m,b){if($0){var N=RE(b);if(N===null)yE(l,d,b,R0,m),G4(l,b);else if(JY(N,l,d,m,b))b.stopPropagation();else if(G4(l,b),d&4&&-1<GY.indexOf(l)){for(;N!==null;){var O=nl(N);if(O!==null)switch(O.tag){case 3:if(O=O.stateNode,O.current.memoizedState.isDehydrated){var I=Wn(O.pendingLanes);if(I!==0){var J=O;for(J.pendingLanes|=2,J.entangledLanes|=2;I;){var ee=1<<31-nn(I);J.entanglements[1]|=ee,I&=~ee}hs(O),(Mt&6)===0&&(p0=te()+500,bp(0))}}break;case 31:case 13:J=Mc(O,2),J!==null&&Kr(J,O,2),g0(),TE(O,2)}if(O=RE(b),O===null&&yE(l,d,b,R0,m),O===N)break;N=O}N!==null&&b.stopPropagation()}else yE(l,d,b,null,m)}}function RE(l){return l=M1(l),kE(l)}var R0=null;function kE(l){if(R0=null,l=tl(l),l!==null){var d=i(l);if(d===null)l=null;else{var m=d.tag;if(m===13){if(l=s(d),l!==null)return l;l=null}else if(m===31){if(l=a(d),l!==null)return l;l=null}else if(m===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;l=null}else d!==l&&(l=null)}}return R0=l,null}function W4(l){switch(l){case"beforetoggle":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"invalid":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Z()){case de:return 2;case Te:return 8;case $e:case Ke:return 32;case At:return 268435456;default:return 32}default:return 32}}var ME=!1,Nl=null,_l=null,Cl=null,_p=new Map,Cp=new Map,Ol=[],GY="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".split(" ");function G4(l,d){switch(l){case"focusin":case"focusout":Nl=null;break;case"dragenter":case"dragleave":_l=null;break;case"mouseover":case"mouseout":Cl=null;break;case"pointerover":case"pointerout":_p.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cp.delete(d.pointerId)}}function Op(l,d,m,b,N,O){return l===null||l.nativeEvent!==O?(l={blockedOn:d,domEventName:m,eventSystemFlags:b,nativeEvent:O,targetContainers:[N]},d!==null&&(d=nl(d),d!==null&&H4(d)),l):(l.eventSystemFlags|=b,d=l.targetContainers,N!==null&&d.indexOf(N)===-1&&d.push(N),l)}function JY(l,d,m,b,N){switch(d){case"focusin":return Nl=Op(Nl,l,d,m,b,N),!0;case"dragenter":return _l=Op(_l,l,d,m,b,N),!0;case"mouseover":return Cl=Op(Cl,l,d,m,b,N),!0;case"pointerover":var O=N.pointerId;return _p.set(O,Op(_p.get(O)||null,l,d,m,b,N)),!0;case"gotpointercapture":return O=N.pointerId,Cp.set(O,Op(Cp.get(O)||null,l,d,m,b,N)),!0}return!1}function J4(l){var d=tl(l.target);if(d!==null){var m=i(d);if(m!==null){if(d=m.tag,d===13){if(d=s(m),d!==null){l.blockedOn=d,Zu(l.priority,function(){q4(m)});return}}else if(d===31){if(d=a(m),d!==null){l.blockedOn=d,Zu(l.priority,function(){q4(m)});return}}else if(d===3&&m.stateNode.current.memoizedState.isDehydrated){l.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}l.blockedOn=null}function k0(l){if(l.blockedOn!==null)return!1;for(var d=l.targetContainers;0<d.length;){var m=RE(l.nativeEvent);if(m===null){m=l.nativeEvent;var b=new m.constructor(m.type,m);k1=b,m.target.dispatchEvent(b),k1=null}else return d=nl(m),d!==null&&H4(d),l.blockedOn=m,!1;d.shift()}return!0}function Y4(l,d,m){k0(l)&&m.delete(d)}function YY(){ME=!1,Nl!==null&&k0(Nl)&&(Nl=null),_l!==null&&k0(_l)&&(_l=null),Cl!==null&&k0(Cl)&&(Cl=null),_p.forEach(Y4),Cp.forEach(Y4)}function M0(l,d){l.blockedOn===d&&(l.blockedOn=null,ME||(ME=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,YY)))}var P0=null;function K4(l){P0!==l&&(P0=l,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){P0===l&&(P0=null);for(var d=0;d<l.length;d+=3){var m=l[d],b=l[d+1],N=l[d+2];if(typeof b!="function"){if(kE(b||m)===null)continue;break}var O=nl(m);O!==null&&(l.splice(d,3),d-=3,RS(O,{pending:!0,data:N,method:m.method,action:b},b,N))}}))}function Id(l){function d(ee){return M0(ee,l)}Nl!==null&&M0(Nl,l),_l!==null&&M0(_l,l),Cl!==null&&M0(Cl,l),_p.forEach(d),Cp.forEach(d);for(var m=0;m<Ol.length;m++){var b=Ol[m];b.blockedOn===l&&(b.blockedOn=null)}for(;0<Ol.length&&(m=Ol[0],m.blockedOn===null);)J4(m),m.blockedOn===null&&Ol.shift();if(m=(l.ownerDocument||l).$$reactFormReplay,m!=null)for(b=0;b<m.length;b+=3){var N=m[b],O=m[b+1],I=N[er]||null;if(typeof O=="function")I||K4(m);else if(I){var J=null;if(O&&O.hasAttribute("formAction")){if(N=O,I=O[er]||null)J=I.formAction;else if(kE(N)!==null)continue}else J=I.action;typeof J=="function"?m[b+1]=J:(m.splice(b,3),b-=3),K4(m)}}}function X4(){function l(O){O.canIntercept&&O.info==="react-transition"&&O.intercept({handler:function(){return new Promise(function(I){return N=I})},focusReset:"manual",scroll:"manual"})}function d(){N!==null&&(N(),N=null),b||setTimeout(m,20)}function m(){if(!b&&!navigation.transition){var O=navigation.currentEntry;O&&O.url!=null&&navigation.navigate(O.url,{state:O.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var b=!1,N=null;return navigation.addEventListener("navigate",l),navigation.addEventListener("navigatesuccess",d),navigation.addEventListener("navigateerror",d),setTimeout(m,100),function(){b=!0,navigation.removeEventListener("navigate",l),navigation.removeEventListener("navigatesuccess",d),navigation.removeEventListener("navigateerror",d),N!==null&&(N(),N=null)}}}function PE(l){this._internalRoot=l}D0.prototype.render=PE.prototype.render=function(l){var d=this._internalRoot;if(d===null)throw Error(r(409));var m=d.current,b=Co();V4(m,b,l,d,null,null)},D0.prototype.unmount=PE.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var d=l.containerInfo;V4(l.current,2,null,l,null,null),g0(),d[lt]=null}};function D0(l){this._internalRoot=l}D0.prototype.unstable_scheduleHydration=function(l){if(l){var d=Ac();l={blockedOn:null,target:l,priority:d};for(var m=0;m<Ol.length&&d!==0&&d<Ol[m].priority;m++);Ol.splice(m,0,l),m===0&&J4(l)}};var Q4=t.version;if(Q4!=="19.2.0")throw Error(r(527,Q4,"19.2.0"));L.findDOMNode=function(l){var d=l._reactInternals;if(d===void 0)throw typeof l.render=="function"?Error(r(188)):(l=Object.keys(l).join(","),Error(r(268,l)));return l=u(d),l=l!==null?f(l):null,l=l===null?null:l.stateNode,l};var KY={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var I0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!I0.isDisabled&&I0.supportsFiber)try{pr=I0.inject(KY),dn=I0}catch{}}return Ap.createRoot=function(l,d){if(!o(l))throw Error(r(299));var m=!1,b="",N=i5,O=s5,I=a5;return d!=null&&(d.unstable_strictMode===!0&&(m=!0),d.identifierPrefix!==void 0&&(b=d.identifierPrefix),d.onUncaughtError!==void 0&&(N=d.onUncaughtError),d.onCaughtError!==void 0&&(O=d.onCaughtError),d.onRecoverableError!==void 0&&(I=d.onRecoverableError)),d=z4(l,1,!1,null,null,m,b,null,N,O,I,X4),l[lt]=d.current,gE(l),new PE(d)},Ap.hydrateRoot=function(l,d,m){if(!o(l))throw Error(r(299));var b=!1,N="",O=i5,I=s5,J=a5,ee=null;return m!=null&&(m.unstable_strictMode===!0&&(b=!0),m.identifierPrefix!==void 0&&(N=m.identifierPrefix),m.onUncaughtError!==void 0&&(O=m.onUncaughtError),m.onCaughtError!==void 0&&(I=m.onCaughtError),m.onRecoverableError!==void 0&&(J=m.onRecoverableError),m.formState!==void 0&&(ee=m.formState)),d=z4(l,1,!0,d,m??null,b,N,ee,O,I,J,X4),d.context=B4(null),m=d.current,b=Co(),b=Za(b),N=fl(b),N.callback=null,hl(m,N,b),m=b,d.current.lanes=m,Cr(d,m),hs(d),l[lt]=d.current,gE(l),new D0(d)},Ap.version="19.2.0",Ap}var lR;function sK(){if(lR)return LE.exports;lR=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(),LE.exports=iK(),LE.exports}var aK=sK(),xs=function(){return xs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},xs.apply(this,arguments)};function a9(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function lK(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var $b="right-scroll-bar-position",Rb="width-before-scroll-bar",cK="with-scroll-bars-hidden",uK="--removed-body-scroll-bar-size";function VE(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function dK(e,t){var n=w.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var fK=typeof window<"u"?w.useLayoutEffect:w.useEffect,cR=new WeakMap;function hK(e,t){var n=dK(null,function(r){return e.forEach(function(o){return VE(o,r)})});return fK(function(){var r=cR.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||VE(a,null)}),i.forEach(function(a){o.has(a)||VE(a,s)})}cR.set(n,e)},[e]),n}function pK(e){return e}function mK(e,t){t===void 0&&(t=pK);var n=[],r=!1,o={read:function(){if(r)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 s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var c=function(){var f=s;s=[],f.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(f){s.push(f),u()},filter:function(f){return s=s.filter(f),n}}}};return o}function gK(e){e===void 0&&(e={});var t=mK(null);return t.options=xs({async:!0,ssr:!1},e),t}var l9=function(e){var t=e.sideCar,n=a9(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return w.createElement(r,xs({},n))};l9.isSideCarExport=!0;function yK(e,t){return e.useMedium(t),l9}var c9=gK(),UE=function(){},Nx=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:UE,onWheelCapture:UE,onTouchMoveCapture:UE}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,p=e.shards,g=e.sideCar,y=e.noIsolation,v=e.inert,x=e.allowPinchZoom,S=e.as,E=S===void 0?"div":S,C=e.gapMode,_=a9(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=g,A=hK([n,t]),T=xs(xs({},_),o);return w.createElement(w.Fragment,null,f&&w.createElement(j,{sideCar:c9,removeScrollBar:u,shards:p,noIsolation:y,inert:v,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:C}),s?w.cloneElement(w.Children.only(a),xs(xs({},T),{ref:A})):w.createElement(E,xs({},T,{className:c,ref:A}),a))});Nx.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nx.classNames={fullWidth:Rb,zeroRight:$b};var bK=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vK(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=bK();return t&&e.setAttribute("nonce",t),e}function xK(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function wK(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var SK=function(){var e=0,t=null;return{add:function(n){e==0&&(t=vK())&&(xK(t,n),wK(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},EK=function(){var e=SK();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},u9=function(){var e=EK(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},NK={left:0,top:0,right:0,gap:0},HE=function(e){return parseInt(e||"",10)||0},_K=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[HE(n),HE(r),HE(o)]},CK=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return NK;var t=_K(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},OK=u9(),mf="data-scroll-locked",jK=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
.`.concat(cK,` {
overflow: hidden `).concat(r,`;
padding-right: `).concat(a,"px ").concat(r,`;
}
body[`).concat(mf,`] {
overflow: hidden `).concat(r,`;
overscroll-behavior: contain;
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
padding-left: `.concat(o,`px;
padding-top: `).concat(i,`px;
padding-right: `).concat(s,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(a,"px ").concat(r,`;
`),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
}
.`).concat($b,` {
right: `).concat(a,"px ").concat(r,`;
}
.`).concat(Rb,` {
margin-right: `).concat(a,"px ").concat(r,`;
}
.`).concat($b," .").concat($b,` {
right: 0 `).concat(r,`;
}
.`).concat(Rb," .").concat(Rb,` {
margin-right: 0 `).concat(r,`;
}
body[`).concat(mf,`] {
`).concat(uK,": ").concat(a,`px;
}
`)},uR=function(){var e=parseInt(document.body.getAttribute(mf)||"0",10);return isFinite(e)?e:0},AK=function(){w.useEffect(function(){return document.body.setAttribute(mf,(uR()+1).toString()),function(){var e=uR()-1;e<=0?document.body.removeAttribute(mf):document.body.setAttribute(mf,e.toString())}},[])},TK=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;AK();var i=w.useMemo(function(){return CK(o)},[o]);return w.createElement(OK,{styles:jK(i,!t,o,n?"":"!important")})},KN=!1;if(typeof window<"u")try{var L0=Object.defineProperty({},"passive",{get:function(){return KN=!0,!0}});window.addEventListener("test",L0,L0),window.removeEventListener("test",L0,L0)}catch{KN=!1}var Ld=KN?{passive:!1}:!1,$K=function(e){return e.tagName==="TEXTAREA"},d9=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!$K(e)&&n[t]==="visible")},RK=function(e){return d9(e,"overflowY")},kK=function(e){return d9(e,"overflowX")},dR=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=f9(e,r);if(o){var i=h9(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},MK=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},PK=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},f9=function(e,t){return e==="v"?RK(t):kK(t)},h9=function(e,t){return e==="v"?MK(t):PK(t)},DK=function(e,t){return e==="h"&&t==="rtl"?-1:1},IK=function(e,t,n,r,o){var i=DK(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,c=t.contains(a),u=!1,f=s>0,p=0,g=0;do{var y=h9(e,a),v=y[0],x=y[1],S=y[2],E=x-S-i*v;(v||E)&&f9(e,a)&&(p+=E,g+=v),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(f&&Math.abs(p)<1||!f&&Math.abs(g)<1)&&(u=!0),u},F0=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},fR=function(e){return[e.deltaX,e.deltaY]},hR=function(e){return e&&"current"in e?e.current:e},LK=function(e,t){return e[0]===t[0]&&e[1]===t[1]},FK=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},zK=0,Fd=[];function BK(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),o=w.useState(zK++)[0],i=w.useState(u9)[0],s=w.useRef(e);w.useEffect(function(){s.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var x=lK([e.lockRef.current],(e.shards||[]).map(hR),!0).filter(Boolean);return x.forEach(function(S){return S.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),x.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=w.useCallback(function(x,S){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!s.current.allowPinchZoom;var E=F0(x),C=n.current,_="deltaX"in x?x.deltaX:C[0]-E[0],j="deltaY"in x?x.deltaY:C[1]-E[1],A,T=x.target,k=Math.abs(_)>Math.abs(j)?"h":"v";if("touches"in x&&k==="h"&&T.type==="range")return!1;var R=dR(k,T);if(!R)return!0;if(R?A=k:(A=k==="v"?"h":"v",R=dR(k,T)),!R)return!1;if(!r.current&&"changedTouches"in x&&(_||j)&&(r.current=A),!A)return!0;var V=r.current||A;return IK(V,S,x,V==="h"?_:j)},[]),c=w.useCallback(function(x){var S=x;if(!(!Fd.length||Fd[Fd.length-1]!==i)){var E="deltaY"in S?fR(S):F0(S),C=t.current.filter(function(A){return A.name===S.type&&(A.target===S.target||S.target===A.shadowParent)&&LK(A.delta,E)})[0];if(C&&C.should){S.cancelable&&S.preventDefault();return}if(!C){var _=(s.current.shards||[]).map(hR).filter(Boolean).filter(function(A){return A.contains(S.target)}),j=_.length>0?a(S,_[0]):!s.current.noIsolation;j&&S.cancelable&&S.preventDefault()}}},[]),u=w.useCallback(function(x,S,E,C){var _={name:x,delta:S,target:E,should:C,shadowParent:VK(E)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(j){return j!==_})},1)},[]),f=w.useCallback(function(x){n.current=F0(x),r.current=void 0},[]),p=w.useCallback(function(x){u(x.type,fR(x),x.target,a(x,e.lockRef.current))},[]),g=w.useCallback(function(x){u(x.type,F0(x),x.target,a(x,e.lockRef.current))},[]);w.useEffect(function(){return Fd.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:g}),document.addEventListener("wheel",c,Ld),document.addEventListener("touchmove",c,Ld),document.addEventListener("touchstart",f,Ld),function(){Fd=Fd.filter(function(x){return x!==i}),document.removeEventListener("wheel",c,Ld),document.removeEventListener("touchmove",c,Ld),document.removeEventListener("touchstart",f,Ld)}},[]);var y=e.removeScrollBar,v=e.inert;return w.createElement(w.Fragment,null,v?w.createElement(i,{styles:FK(o)}):null,y?w.createElement(TK,{gapMode:e.gapMode}):null)}function VK(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const UK=yK(c9,BK);var rv=w.forwardRef(function(e,t){return w.createElement(Nx,xs({},e,{ref:t,sideCar:UK}))});rv.classNames=Nx.classNames;function Es(e){return Object.keys(e)}function qE(e){return e&&typeof e=="object"&&!Array.isArray(e)}function hO(e,t){const n={...e},r=t;return qE(e)&&qE(t)&&Object.keys(t).forEach(o=>{qE(r[o])&&o in e?n[o]=hO(n[o],r[o]):n[o]=r[o]}),n}function HK(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function qK(e){return typeof e!="string"||!e.includes("var(--mantine-scale)")?e:e.match(/^calc\((.*?)\)$/)?.[1].split("*")[0].trim()}function WK(e){const t=qK(e);return typeof t=="number"?t:typeof t=="string"?t.includes("calc")||t.includes("var")?t:t.includes("px")?Number(t.replace("px","")):t.includes("rem")?Number(t.replace("rem",""))*16:t.includes("em")?Number(t.replace("em",""))*16:Number(t):NaN}function WE(e){return e==="0rem"?"0rem":`calc(${e} * var(--mantine-scale))`}function p9(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r==="0")return`0${e}`;if(typeof r=="number"){const o=`${r/16}${e}`;return t?WE(o):o}if(typeof r=="string"){if(r===""||r.startsWith("calc(")||r.startsWith("clamp(")||r.includes("rgba("))return r;if(r.includes(","))return r.split(",").map(i=>n(i)).join(",");if(r.includes(" "))return r.split(" ").map(i=>n(i)).join(" ");if(r.includes(e))return t?WE(r):r;const o=r.replace("px","");if(!Number.isNaN(Number(o))){const i=`${Number(o)/16}${e}`;return t?WE(i):i}}return r}return n}const Oe=p9("rem",{shouldScale:!0}),pR=p9("em");function pO(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function m9(e){if(typeof e=="number")return!0;if(typeof e=="string"){if(e.startsWith("calc(")||e.startsWith("var(")||e.includes(" ")&&e.trim()!=="")return!0;const t=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return e.trim().split(/\s+/).every(r=>t.test(r))}return!1}function fc(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==w.Fragment:!1}function Pa(e){const t=w.createContext(null);return[({children:o,value:i})=>h.jsx(t.Provider,{value:i,children:o}),()=>{const o=w.useContext(t);if(o===null)throw new Error(e);return o}]}function Lu(e=null){const t=w.createContext(e);return[({children:o,value:i})=>h.jsx(t.Provider,{value:i,children:o}),()=>w.useContext(t)]}function mR(e,t){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(t);return`${e}-${n}`}}function ov(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function GK(e,t,n){for(let r=e-1;r>=0;r-=1)if(!t[r].disabled)return r;if(n){for(let r=t.length-1;r>-1;r-=1)if(!t[r].disabled)return r}return e}function JK(e,t,n){for(let r=e+1;r<t.length;r+=1)if(!t[r].disabled)return r;if(n){for(let r=0;r<t.length;r+=1)if(!t[r].disabled)return r}return e}function YK(e,t,n){return ov(e,n)===ov(t,n)}function g9({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:o=!1,dir:i="rtl",orientation:s}){return a=>{n?.(a);const c=Array.from(ov(a.currentTarget,e)?.querySelectorAll(t)||[]).filter(v=>YK(a.currentTarget,v,e)),u=c.findIndex(v=>a.currentTarget===v),f=JK(u,c,r),p=GK(u,c,r),g=i==="rtl"?p:f,y=i==="rtl"?f:p;switch(a.key){case"ArrowRight":{s==="horizontal"&&(a.stopPropagation(),a.preventDefault(),c[g].focus(),o&&c[g].click());break}case"ArrowLeft":{s==="horizontal"&&(a.stopPropagation(),a.preventDefault(),c[y].focus(),o&&c[y].click());break}case"ArrowUp":{s==="vertical"&&(a.stopPropagation(),a.preventDefault(),c[p].focus(),o&&c[p].click());break}case"ArrowDown":{s==="vertical"&&(a.stopPropagation(),a.preventDefault(),c[f].focus(),o&&c[f].click());break}case"Home":{a.stopPropagation(),a.preventDefault(),!c[0].disabled&&c[0].focus();break}case"End":{a.stopPropagation(),a.preventDefault();const v=c.length-1;!c[v].disabled&&c[v].focus();break}}}}const KK={app:100,modal:200,popover:300,overlay:400,max:9999};function ts(e){return KK[e]}const XN=()=>{};function XK(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||XN:n=>{n.key==="Escape"&&(e(n),t.onTrigger?.())}}function jt(e,t="size",n=!0){if(e!==void 0)return m9(e)?n?Oe(e):e:`var(--${t}-${e})`}function mO(e){return jt(e,"mantine-spacing")}function Qn(e){return e===void 0?"var(--mantine-radius-default)":jt(e,"mantine-radius")}function zr(e){return jt(e,"mantine-font-size")}function gO(e){if(e)return jt(e,"mantine-shadow",!1)}function Ss(e,t){return n=>{e?.(n),t?.(n)}}function QK(e,t,n){return n?Array.from(ov(n,t)?.querySelectorAll(e)||[]).findIndex(r=>r===n):null}function ZK(){const[e,t]=w.useState(-1);return[e,{setHovered:t,resetHovered:()=>t(-1)}]}function ya(e,t,n){return t===void 0&&n===void 0?e:t!==void 0&&n===void 0?Math.max(e,t):Math.min(t===void 0&&n!==void 0?e:Math.max(e,t),n)}function Yl(e="mantine-"){return`${e}${Math.random().toString(36).slice(2,11)}`}function eX(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;const n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let o=0;o<r;o+=1){const i=n[o];if(!(i in t)||e[i]!==t[i]&&!(Number.isNaN(e[i])&&Number.isNaN(t[i])))return!1}return!0}function ru(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>t.current?.(...n),[])}function Og(e,t){const n=typeof t=="number"?t:t.delay,r=typeof t=="number"?!1:t.flushOnUnmount,o=ru(e),i=w.useRef(0),s=w.useRef(()=>{}),a=Object.assign(w.useCallback((...c)=>{window.clearTimeout(i.current);const u=()=>{i.current!==0&&(i.current=0,o(...c))};s.current=u,a.flush=u,i.current=window.setTimeout(u,n)},[o,n]),{flush:s.current});return w.useEffect(()=>()=>{window.clearTimeout(i.current),r&&a.flush()},[a,r]),a}const gR=["mousedown","touchstart"];function jg(e,t,n){const r=w.useRef(null);return w.useEffect(()=>{const o=i=>{const{target:s}=i??{};if(Array.isArray(n)){const a=s?.hasAttribute("data-ignore-outside-clicks")||!document.body.contains(s)&&s.tagName!=="HTML";n.every(u=>!!u&&!i.composedPath().includes(u))&&!a&&e()}else r.current&&!r.current.contains(s)&&e()};return(t||gR).forEach(i=>document.addEventListener(i,o)),()=>{(t||gR).forEach(i=>document.removeEventListener(i,o))}},[r,e,n]),r}function tX({timeout:e=2e3}={}){const[t,n]=w.useState(null),[r,o]=w.useState(!1),[i,s]=w.useState(null),a=f=>{window.clearTimeout(i),s(window.setTimeout(()=>o(!1),e)),o(f)};return{copy:f=>{"clipboard"in navigator?navigator.clipboard.writeText(f).then(()=>a(!0)).catch(p=>n(p)):n(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{o(!1),n(null),window.clearTimeout(i)},error:t,copied:r}}function nX(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function rX(e,t){return typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function oX(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=w.useState(n?t:rX(e)),i=w.useRef(null);return w.useEffect(()=>{if("matchMedia"in window)return i.current=window.matchMedia(e),o(i.current.matches),nX(i.current,s=>o(s.matches))},[e]),r}const rh=typeof document<"u"?w.useLayoutEffect:w.useEffect;function _a(e,t){const n=w.useRef(!1);w.useEffect(()=>()=>{n.current=!1},[]),w.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function y9({opened:e,shouldReturnFocus:t=!0}){const n=w.useRef(null),r=()=>{n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&n.current?.focus({preventScroll:!0})};return _a(()=>{let o=-1;const i=s=>{s.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",i),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",i)}},[e,t]),r}const iX=/input|select|textarea|button|object/,b9="a, input, select, textarea, button, object, [tabindex]";function sX(e){return e.style.display==="none"}function aX(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(sX(n))return!1;n=n.parentNode}return!0}function v9(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function QN(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(v9(e));return(iX.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&aX(e)}function x9(e){const t=v9(e);return(Number.isNaN(t)||t>=0)&&QN(e)}function lX(e){return Array.from(e.querySelectorAll(b9)).filter(x9)}function cX(e,t){const n=lX(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();let i=r===o.activeElement||e===o.activeElement;const s=o.activeElement;if(s.tagName==="INPUT"&&s.getAttribute("type")==="radio"&&(i=n.filter(f=>f.getAttribute("type")==="radio"&&f.getAttribute("name")===s.getAttribute("name")).includes(r)),!i)return;t.preventDefault();const c=n[t.shiftKey?n.length-1:0];c&&c.focus()}function _x(e=!0){const t=w.useRef(null),n=o=>{let i=o.querySelector("[data-autofocus]");if(!i){const s=Array.from(o.querySelectorAll(b9));i=s.find(x9)||s.find(QN)||null,!i&&QN(o)&&(i=o)}i&&i.focus({preventScroll:!0})},r=w.useCallback(o=>{e&&o!==null&&t.current!==o&&(o?(setTimeout(()=>{o.getRootNode()&&n(o)}),t.current=o):t.current=null)},[e]);return w.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>n(t.current));const o=i=>{i.key==="Tab"&&t.current&&cX(t.current,i)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e]),r}const uX=e=>(e+1)%1e6;function dX(){const[,e]=w.useReducer(uX,0);return e}const fX=Ne.useId||(()=>{});function hX(){const e=fX();return e?`mantine-${e.replace(/:/g,"")}`:""}function gi(e){const t=hX(),[n,r]=w.useState(t);return rh(()=>{r(Yl())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function ZN(e,t,n){w.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function iv(e,t){if(typeof e=="function")return e(t);typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function pX(...e){const t=new Map;return n=>{if(e.forEach(r=>{const o=iv(r,n);o&&t.set(r,o)}),t.size>0)return()=>{e.forEach(r=>{const o=t.get(r);o?o():iv(r,null)}),t.clear()}}}function jn(...e){return w.useCallback(pX(...e),e)}function mX(e,t,n="ltr"){const r=w.useRef(null),o=w.useRef(!1),i=w.useRef(!1),s=w.useRef(0),[a,c]=w.useState(!1);return w.useEffect(()=>{o.current=!0},[]),w.useEffect(()=>{const u=r.current,f=({x:_,y:j})=>{cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{if(o.current&&u){u.style.userSelect="none";const A=u.getBoundingClientRect();if(A.width&&A.height){const T=ya((_-A.left)/A.width,0,1);e({x:n==="ltr"?T:1-T,y:ya((j-A.top)/A.height,0,1)})}}})},p=()=>{document.addEventListener("mousemove",S),document.addEventListener("mouseup",v),document.addEventListener("touchmove",C),document.addEventListener("touchend",v)},g=()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",v),document.removeEventListener("touchmove",C),document.removeEventListener("touchend",v)},y=()=>{!i.current&&o.current&&(i.current=!0,typeof t?.onScrubStart=="function"&&t.onScrubStart(),c(!0),p())},v=()=>{i.current&&o.current&&(i.current=!1,c(!1),g(),setTimeout(()=>{typeof t?.onScrubEnd=="function"&&t.onScrubEnd()},0))},x=_=>{y(),_.preventDefault(),S(_)},S=_=>f({x:_.clientX,y:_.clientY}),E=_=>{_.cancelable&&_.preventDefault(),y(),C(_)},C=_=>{_.cancelable&&_.preventDefault(),f({x:_.changedTouches[0].clientX,y:_.changedTouches[0].clientY})};return u?.addEventListener("mousedown",x),u?.addEventListener("touchstart",E,{passive:!1}),()=>{u&&(u.removeEventListener("mousedown",x),u.removeEventListener("touchstart",E))}},[n,e]),{ref:r,active:a}}function ho({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,i]=w.useState(t!==void 0?t:n),s=(a,...c)=>{i(a),r?.(a,...c)};return e!==void 0?[e,r,!0]:[o,s,!1]}function yO(e,t){return oX("(prefers-reduced-motion: reduce)",e,t)}function gX(e,t){if(!e||!t)return!1;if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!eX(e[n],t[n]))return!1;return!0}function yX(e){const t=w.useRef([]),n=w.useRef(0);return gX(t.current,e)||(t.current=e,n.current+=1),[n.current]}function bX(e,t){w.useEffect(e,yX(t))}function w9(e=[!1,!0]){const[[t],n]=w.useReducer((r,o)=>{const i=o instanceof Function?o(r[0]):o,s=Math.abs(r.indexOf(i));return r.slice(s).concat(r.slice(0,s))},e);return[t,n]}const yR={passive:!0};function vX(){const[e,t]=w.useState({width:0,height:0}),n=w.useCallback(()=>{t({width:window.innerWidth||0,height:window.innerHeight||0})},[]);return ZN("resize",n,yR),ZN("orientationchange",n,yR),w.useEffect(n,[]),e}const xX={" ":"space",ArrowLeft:"arrowleft",ArrowRight:"arrowright",ArrowUp:"arrowup",ArrowDown:"arrowdown",Escape:"esc",Esc:"esc",Enter:"enter",Tab:"tab",Backspace:"backspace",Delete:"delete",Insert:"insert",Home:"home",End:"end",PageUp:"pageup",PageDown:"pagedown","+":"plus","-":"minus","*":"asterisk","/":"slash"};function z0(e){const t=e.replace("Key","").toLowerCase();return xX[e]||t}function wX(e){const t=e.toLowerCase().split("+").map(i=>i.trim()),n={alt:t.includes("alt"),ctrl:t.includes("ctrl"),meta:t.includes("meta"),mod:t.includes("mod"),shift:t.includes("shift"),plus:t.includes("[plus]")},r=["alt","ctrl","meta","shift","mod"],o=t.find(i=>!r.includes(i));return{...n,key:o==="[plus]"?"+":o}}function SX(e,t,n){const{alt:r,ctrl:o,meta:i,mod:s,shift:a,key:c}=e,{altKey:u,ctrlKey:f,metaKey:p,shiftKey:g,key:y,code:v}=t;if(r!==u)return!1;if(s){if(!f&&!p)return!1}else if(o!==f||i!==p)return!1;return a!==g?!1:!!(c&&(n?z0(v)===z0(c):z0(y??v)===z0(c)))}function S9(e,t){return n=>SX(wX(e),n,t)}function EX(e){return t=>{const n="nativeEvent"in t?t.nativeEvent:t;e.forEach(([r,o,i={preventDefault:!0,usePhysicalKeys:!1}])=>{S9(r,i.usePhysicalKeys)(n)&&(i.preventDefault&&t.preventDefault(),o(n))})}}function NX(e,t,n=!1){return e.target instanceof HTMLElement?(n||!e.target.isContentEditable)&&!t.includes(e.target.tagName):!0}function bO(e,t=["INPUT","TEXTAREA","SELECT"],n=!1){w.useEffect(()=>{const r=o=>{e.forEach(([i,s,a={preventDefault:!0,usePhysicalKeys:!1}])=>{S9(i,a.usePhysicalKeys)(o)&&NX(o,t,n)&&(a.preventDefault&&o.preventDefault(),s(o))})};return document.documentElement.addEventListener("keydown",r),()=>document.documentElement.removeEventListener("keydown",r)},[e])}function oh(e=!1,t){const{onOpen:n,onClose:r}={},[o,i]=w.useState(e),s=w.useCallback(()=>{i(u=>u||(n?.(),!0))},[n]),a=w.useCallback(()=>{i(u=>u&&(r?.(),!1))},[r]),c=w.useCallback(()=>{o?a():s()},[a,s,o]);return[o,{open:s,close:a,toggle:c}]}function _X(e,t,n={autoInvoke:!1}){const r=w.useRef(null),o=w.useCallback((...s)=>{r.current||(r.current=window.setTimeout(()=>{e(s),r.current=null},t))},[t]),i=w.useCallback(()=>{r.current&&(window.clearTimeout(r.current),r.current=null)},[]);return w.useEffect(()=>(n.autoInvoke&&o(),i),[i,o]),{start:o,clear:i}}function CX(e){const t=w.useRef(void 0);return w.useEffect(()=>{t.current=e},[e]),t.current}function OX(){const e=w.useRef(null),[t,n]=w.useState(!1);return{ref:w.useCallback(o=>{typeof IntersectionObserver<"u"&&(o&&!e.current?e.current=new IntersectionObserver(i=>n(i.some(s=>s.isIntersecting))):e.current?.disconnect(),o?e.current?.observe(o):n(!1))},[]),inViewport:t}}function jX(e,t,n){const r=w.useRef(null),o=w.useRef(null);return w.useEffect(()=>{const i=typeof n=="function"?n():n;return(i||o.current)&&(r.current=new MutationObserver(e),r.current.observe(i||o.current,t)),()=>{r.current?.disconnect()}},[e,t]),o}function AX(){const[e,t]=w.useState(!1);return w.useEffect(()=>t(!0),[]),e}function TX(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function $X(e){function t(r){const o=Object.keys(r).reduce((i,s)=>(i[`${e}:${s}`]=a=>r[s](a.detail),i),{});rh(()=>(Object.keys(o).forEach(i=>{window.removeEventListener(i,o[i]),window.addEventListener(i,o[i])}),()=>Object.keys(o).forEach(i=>{window.removeEventListener(i,o[i])})),[o])}function n(r){return(...o)=>TX(`${e}:${String(r)}`,o[0])}return[t,n]}var RX={};function E9(){return typeof process<"u"&&RX?"production":"development"}function bR(e,t){return t.length===0?e:t.reduce((n,r)=>Math.abs(r-e)<Math.abs(n-e)?r:n)}function Cx(e){const t=Ne.version;return typeof Ne.version!="string"||t.startsWith("18.")?e?.ref:e?.props?.ref}function N9(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=N9(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function pn(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=N9(e))&&(r&&(r+=" "),r+=t);return r}const kX={};function MX(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,o])=>{t[r]?t[r]=pn(t[r],o):t[r]=o})}),t}function Ox({theme:e,classNames:t,props:n,stylesCtx:r}){const i=(Array.isArray(t)?t:[t]).map(s=>typeof s=="function"?s(e,n,r):s||kX);return MX(i)}function sv({theme:e,styles:t,props:n,stylesCtx:r}){return(Array.isArray(t)?t:[t]).reduce((i,s)=>typeof s=="function"?{...i,...s(e,n,r)}:{...i,...s},{})}const _9=w.createContext(null);function hc(){const e=w.useContext(_9);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function PX(){return hc().cssVariablesResolver}function DX(){return hc().classNamesPrefix}function vO(){return hc().getStyleNonce}function IX(){return hc().withStaticClasses}function LX(){return hc().headless}function FX(){return hc().stylesTransform?.sx}function zX(){return hc().stylesTransform?.styles}function C9(){return hc().env||"default"}function BX(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function VX(e){let t=e.replace("#","");if(t.length===3){const s=t.split("");t=[s[0],s[0],s[1],s[1],s[2],s[2]].join("")}if(t.length===8){const s=parseInt(t.slice(6,8),16)/255;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:s}}const n=parseInt(t,16),r=n>>16&255,o=n>>8&255,i=n&255;return{r,g:o,b:i,a:1}}function UX(e){const[t,n,r,o]=e.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:t,g:n,b:r,a:o===void 0?1:o}}function HX(e){const t=/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i,n=e.match(t);if(!n)return{r:0,g:0,b:0,a:1};const r=parseInt(n[1],10),o=parseInt(n[2],10)/100,i=parseInt(n[3],10)/100,s=n[5]?parseFloat(n[5]):void 0,a=(1-Math.abs(2*i-1))*o,c=r/60,u=a*(1-Math.abs(c%2-1)),f=i-a/2;let p,g,y;return c>=0&&c<1?(p=a,g=u,y=0):c>=1&&c<2?(p=u,g=a,y=0):c>=2&&c<3?(p=0,g=a,y=u):c>=3&&c<4?(p=0,g=u,y=a):c>=4&&c<5?(p=u,g=0,y=a):(p=a,g=0,y=u),{r:Math.round((p+f)*255),g:Math.round((g+f)*255),b:Math.round((y+f)*255),a:s||1}}function xO(e){return BX(e)?VX(e):e.startsWith("rgb")?UX(e):e.startsWith("hsl")?HX(e):{r:0,g:0,b:0,a:1}}function B0(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:r,b:o,a:i}=xO(e),s=1-t,a=c=>Math.round(c*s);return`rgba(${a(n)}, ${a(r)}, ${a(o)}, ${i})`}function Om(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function GE(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function qX(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function WX(e){if(e.startsWith("oklch("))return(qX(e)||0)/100;const{r:t,g:n,b:r}=xO(e),o=t/255,i=n/255,s=r/255,a=GE(o),c=GE(i),u=GE(s);return .2126*a+.7152*c+.0722*u}function Tp(e,t=.179){return e.startsWith("var(")?!1:WX(e)>t}function pc({color:e,theme:t,colorScheme:n}){if(typeof e!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof e}`);if(e==="bright")return{color:e,value:n==="dark"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:Tp(n==="dark"?t.white:t.black,t.luminanceThreshold),variable:"--mantine-color-bright"};if(e==="dimmed")return{color:e,value:n==="dark"?t.colors.dark[2]:t.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:Tp(n==="dark"?t.colors.dark[2]:t.colors.gray[6],t.luminanceThreshold),variable:"--mantine-color-dimmed"};if(e==="white"||e==="black")return{color:e,value:e==="white"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:Tp(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[r,o]=e.split("."),i=o?Number(o):void 0,s=r in t.colors;if(s){const a=i!==void 0?t.colors[r][i]:t.colors[r][Om(t,n||"light")];return{color:r,value:a,shade:i,isThemeColor:s,isLight:Tp(a,t.luminanceThreshold),variable:o?`--mantine-color-${r}-${i}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:s,isLight:Tp(e,t.luminanceThreshold),shade:i,variable:void 0}}function Sr(e,t){const n=pc({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function vR(e,t){const n={from:e?.from||t.defaultGradient.from,to:e?.to||t.defaultGradient.to,deg:e?.deg??t.defaultGradient.deg??0},r=Sr(n.from,t),o=Sr(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${o} 100%)`}function gs(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(")){const i=(1-t)*100;return`color-mix(in srgb, ${e}, transparent ${i}%)`}if(e.startsWith("oklch"))return e.includes("/")?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(")",` / ${t})`);const{r:n,g:r,b:o}=xO(e);return`rgba(${n}, ${r}, ${o}, ${t})`}const zd=gs,GX=({color:e,theme:t,variant:n,gradient:r,autoContrast:o})=>{const i=pc({color:e,theme:t}),s=typeof o=="boolean"?o:t.autoContrast;if(n==="filled"){const a=s&&i.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return i.isThemeColor?i.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:a,border:`${Oe(1)} solid transparent`}:{background:`var(--mantine-color-${i.color}-${i.shade})`,hover:`var(--mantine-color-${i.color}-${i.shade===9?8:i.shade+1})`,color:a,border:`${Oe(1)} solid transparent`}:{background:e,hover:B0(e,.1),color:a,border:`${Oe(1)} solid transparent`}}if(n==="light"){if(i.isThemeColor){if(i.shade===void 0)return{background:`var(--mantine-color-${e}-light)`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${Oe(1)} solid transparent`};const a=t.colors[i.color][i.shade];return{background:gs(a,.1),hover:gs(a,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${Oe(1)} solid transparent`}}return{background:gs(e,.1),hover:gs(e,.12),color:e,border:`${Oe(1)} solid transparent`}}if(n==="outline")return i.isThemeColor?i.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${Oe(1)} solid var(--mantine-color-${e}-outline)`}:{background:"transparent",hover:gs(t.colors[i.color][i.shade],.05),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${Oe(1)} solid var(--mantine-color-${i.color}-${i.shade})`}:{background:"transparent",hover:gs(e,.05),color:e,border:`${Oe(1)} solid ${e}`};if(n==="subtle"){if(i.isThemeColor){if(i.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${Oe(1)} solid transparent`};const a=t.colors[i.color][i.shade];return{background:"transparent",hover:gs(a,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${Oe(1)} solid transparent`}}return{background:"transparent",hover:gs(e,.12),color:e,border:`${Oe(1)} solid transparent`}}return n==="transparent"?i.isThemeColor?i.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${e}-light-color)`,border:`${Oe(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${Oe(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${Oe(1)} solid transparent`}:n==="white"?i.isThemeColor?i.shade===void 0?{background:"var(--mantine-color-white)",hover:B0(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${Oe(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:B0(t.white,.01),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${Oe(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:B0(t.white,.01),color:e,border:`${Oe(1)} solid transparent`}:n==="gradient"?{background:vR(r,t),hover:vR(r,t),color:"var(--mantine-color-white)",border:"none"}:n==="default"?{background:"var(--mantine-color-default)",hover:"var(--mantine-color-default-hover)",color:"var(--mantine-color-default-color)",border:`${Oe(1)} solid var(--mantine-color-default-border)`}:{}},JX={dark:["#C9C9C9","#b8b8b8","#828282","#696969","#424242","#3b3b3b","#2e2e2e","#242424","#1f1f1f","#141414"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},xR="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",wO={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:JX,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:GX,autoContrast:!1,luminanceThreshold:.3,fontFamily:xR,fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",respectReducedMotion:!1,cursorType:"default",defaultGradient:{from:"blue",to:"cyan",deg:45},defaultRadius:"sm",activeClassName:"mantine-active",focusClassName:"",headings:{fontFamily:xR,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:Oe(34),lineHeight:"1.3"},h2:{fontSize:Oe(26),lineHeight:"1.35"},h3:{fontSize:Oe(22),lineHeight:"1.4"},h4:{fontSize:Oe(18),lineHeight:"1.45"},h5:{fontSize:Oe(16),lineHeight:"1.5"},h6:{fontSize:Oe(14),lineHeight:"1.5"}}},fontSizes:{xs:Oe(12),sm:Oe(14),md:Oe(16),lg:Oe(18),xl:Oe(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:Oe(2),sm:Oe(4),md:Oe(8),lg:Oe(16),xl:Oe(32)},spacing:{xs:Oe(10),sm:Oe(12),md:Oe(16),lg:Oe(20),xl:Oe(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${Oe(1)} ${Oe(3)} rgba(0, 0, 0, 0.05), 0 ${Oe(1)} ${Oe(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${Oe(1)} ${Oe(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${Oe(10)} ${Oe(15)} ${Oe(-5)}, rgba(0, 0, 0, 0.04) 0 ${Oe(7)} ${Oe(7)} ${Oe(-5)}`,md:`0 ${Oe(1)} ${Oe(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${Oe(20)} ${Oe(25)} ${Oe(-5)}, rgba(0, 0, 0, 0.04) 0 ${Oe(10)} ${Oe(10)} ${Oe(-5)}`,lg:`0 ${Oe(1)} ${Oe(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${Oe(28)} ${Oe(23)} ${Oe(-7)}, rgba(0, 0, 0, 0.04) 0 ${Oe(12)} ${Oe(12)} ${Oe(-7)}`,xl:`0 ${Oe(1)} ${Oe(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${Oe(36)} ${Oe(28)} ${Oe(-7)}, rgba(0, 0, 0, 0.04) 0 ${Oe(17)} ${Oe(17)} ${Oe(-7)}`},other:{},components:{}};function wR(e){return e==="auto"||e==="dark"||e==="light"}function YX({key:e="mantine-color-scheme-value"}={}){let t;return{get:n=>{if(typeof window>"u")return n;try{const r=window.localStorage.getItem(e);return wR(r)?r:n}catch{return n}},set:n=>{try{window.localStorage.setItem(e,n)}catch(r){console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.",r)}},subscribe:n=>{t=r=>{r.storageArea===window.localStorage&&r.key===e&&wR(r.newValue)&&n(r.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}const KX="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more https://mantine.dev/theming/colors/#primary-color",SR="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function JE(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function ER(e){if(!(e.primaryColor in e.colors))throw new Error(KX);if(typeof e.primaryShade=="object"&&(!JE(e.primaryShade.dark)||!JE(e.primaryShade.light)))throw new Error(SR);if(typeof e.primaryShade=="number"&&!JE(e.primaryShade))throw new Error(SR)}function XX(e,t){if(!t)return ER(e),e;const n=hO(e,t);return t.fontFamily&&!t.headings?.fontFamily&&(n.headings.fontFamily=t.fontFamily),ER(n),n}const SO=w.createContext(null),QX=()=>w.useContext(SO)||wO;function zo(){const e=w.useContext(SO);if(!e)throw new Error("@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app");return e}function O9({theme:e,children:t,inherit:n=!0}){const r=QX(),o=w.useMemo(()=>XX(n?r:wO,e),[e,r,n]);return h.jsx(SO.Provider,{value:o,children:t})}O9.displayName="@mantine/core/MantineThemeProvider";function ZX(){const e=zo(),t=vO(),n=Es(e.breakpoints).reduce((r,o)=>{const i=e.breakpoints[o].includes("px"),s=WK(e.breakpoints[o]),a=i?`${s-.1}px`:pR(s-.1),c=i?`${s}px`:pR(s);return`${r}@media (max-width: ${a}) {.mantine-visible-from-${o} {display: none !important;}}@media (min-width: ${c}) {.mantine-hidden-from-${o} {display: none !important;}}`},"");return h.jsx("style",{"data-mantine-styles":"classes",nonce:t?.(),dangerouslySetInnerHTML:{__html:n}})}function YE(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function $p(e,t){return(Array.isArray(e)?e:[e]).reduce((r,o)=>`${o}{${r}}`,t)}function eQ(e,t){const n=YE(e.variables),r=n?$p(t,n):"",o=YE(e.dark),i=YE(e.light),s=o?$p(t===":host"?`${t}([data-mantine-color-scheme="dark"])`:`${t}[data-mantine-color-scheme="dark"]`,o):"",a=i?$p(t===":host"?`${t}([data-mantine-color-scheme="light"])`:`${t}[data-mantine-color-scheme="light"]`,i):"";return`${r}${s}${a}`}function Ag({color:e,theme:t,autoContrast:n}){return(typeof n=="boolean"?n:t.autoContrast)&&pc({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function NR(e,t){return Ag({color:e.colors[e.primaryColor][Om(e,t)],theme:e,autoContrast:null})}function V0({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:o=!0}){if(!e.colors[t])return{};if(n==="light"){const a=Om(e,"light"),c={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${a===9?8:a+1})`,[`--mantine-color-${r}-light`]:zd(e.colors[t][a],.1),[`--mantine-color-${r}-light-hover`]:zd(e.colors[t][a],.12),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-outline-hover`]:zd(e.colors[t][a],.05)};return o?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...c}:c}const i=Om(e,"dark"),s={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${i})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${i===9?8:i+1})`,[`--mantine-color-${r}-light`]:zd(e.colors[t][Math.max(0,i-2)],.15),[`--mantine-color-${r}-light-hover`]:zd(e.colors[t][Math.max(0,i-2)],.2),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${Math.max(i-5,0)})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(i-4,0)})`,[`--mantine-color-${r}-outline-hover`]:zd(e.colors[t][Math.max(i-4,0)],.05)};return o?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...s}:s}function tQ(e){return!!e&&typeof e=="object"&&"mantine-virtual-color"in e}function Bd(e,t,n){Es(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const j9=e=>{const t=Om(e,"light"),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:Oe(e.defaultRadius),r={variables:{"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-color-scheme":"light dark","--mantine-webkit-font-smoothing":e.fontSmoothing?"antialiased":"unset","--mantine-moz-font-smoothing":e.fontSmoothing?"grayscale":"unset","--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-primary-color-contrast":NR(e,"light"),"--mantine-color-bright":"var(--mantine-color-black)","--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":"var(--mantine-color-red-6)","--mantine-color-placeholder":"var(--mantine-color-gray-5)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":"var(--mantine-color-white)","--mantine-color-default-hover":"var(--mantine-color-gray-0)","--mantine-color-default-color":"var(--mantine-color-black)","--mantine-color-default-border":"var(--mantine-color-gray-4)","--mantine-color-dimmed":"var(--mantine-color-gray-6)"},dark:{"--mantine-primary-color-contrast":NR(e,"dark"),"--mantine-color-bright":"var(--mantine-color-white)","--mantine-color-text":"var(--mantine-color-dark-0)","--mantine-color-body":"var(--mantine-color-dark-7)","--mantine-color-error":"var(--mantine-color-red-8)","--mantine-color-placeholder":"var(--mantine-color-dark-3)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":"var(--mantine-color-dark-6)","--mantine-color-default-hover":"var(--mantine-color-dark-5)","--mantine-color-default-color":"var(--mantine-color-white)","--mantine-color-default-border":"var(--mantine-color-dark-4)","--mantine-color-dimmed":"var(--mantine-color-dark-2)"}};Bd(r.variables,e.breakpoints,"breakpoint"),Bd(r.variables,e.spacing,"spacing"),Bd(r.variables,e.fontSizes,"font-size"),Bd(r.variables,e.lineHeights,"line-height"),Bd(r.variables,e.shadows,"shadow"),Bd(r.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((i,s)=>{r.variables[`--mantine-primary-color-${s}`]=`var(--mantine-color-${e.primaryColor}-${s})`}),Es(e.colors).forEach(i=>{const s=e.colors[i];if(tQ(s)){Object.assign(r.light,V0({theme:e,name:s.name,color:s.light,colorScheme:"light",withColorValues:!0})),Object.assign(r.dark,V0({theme:e,name:s.name,color:s.dark,colorScheme:"dark",withColorValues:!0}));return}s.forEach((a,c)=>{r.variables[`--mantine-color-${i}-${c}`]=a}),Object.assign(r.light,V0({theme:e,color:i,colorScheme:"light",withColorValues:!1})),Object.assign(r.dark,V0({theme:e,color:i,colorScheme:"dark",withColorValues:!1}))});const o=e.headings.sizes;return Es(o).forEach(i=>{r.variables[`--mantine-${i}-font-size`]=o[i].fontSize,r.variables[`--mantine-${i}-line-height`]=o[i].lineHeight,r.variables[`--mantine-${i}-font-weight`]=o[i].fontWeight||e.headings.fontWeight}),r};function nQ({theme:e,generator:t}){const n=j9(e),r=t?.(e);return r?hO(n,r):n}const KE=j9(wO);function rQ(e){const t={variables:{},light:{},dark:{}};return Es(e.variables).forEach(n=>{KE.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),Es(e.light).forEach(n=>{KE.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),Es(e.dark).forEach(n=>{KE.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function oQ(e){return`
${e}[data-mantine-color-scheme="dark"] { --mantine-color-scheme: dark; }
${e}[data-mantine-color-scheme="light"] { --mantine-color-scheme: light; }
`}function A9({cssVariablesSelector:e,deduplicateCssVariables:t}){const n=zo(),r=vO(),o=PX(),i=nQ({theme:n,generator:o}),s=e===":root"&&t,a=s?rQ(i):i,c=eQ(a,e);return c?h.jsx("style",{"data-mantine-styles":!0,nonce:r?.(),dangerouslySetInnerHTML:{__html:`${c}${s?"":oQ(e)}`}}):null}A9.displayName="@mantine/CssVariables";function iQ(){const e=console.error;console.error=(...t)=>{t.length>1&&typeof t[0]=="string"&&t[0].toLowerCase().includes("extra attributes from the server")&&typeof t[1]=="string"&&t[1].toLowerCase().includes("data-mantine-color-scheme")||e(...t)}}function Vd(e,t){const n=typeof window<"u"&&"matchMedia"in window&&window.matchMedia("(prefers-color-scheme: dark)")?.matches,r=e!=="auto"?e:n?"dark":"light";t()?.setAttribute("data-mantine-color-scheme",r)}function sQ({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){const o=w.useRef(null),[i,s]=w.useState(()=>e.get(t)),a=r||i,c=w.useCallback(f=>{r||(Vd(f,n),s(f),e.set(f))},[e.set,a,r]),u=w.useCallback(()=>{s(t),Vd(t,n),e.clear()},[e.clear,t]);return w.useEffect(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),rh(()=>{Vd(e.get(t),n)},[]),w.useEffect(()=>{if(r)return Vd(r,n),()=>{};r===void 0&&Vd(i,n),typeof window<"u"&&"matchMedia"in window&&(o.current=window.matchMedia("(prefers-color-scheme: dark)"));const f=p=>{i==="auto"&&Vd(p.matches?"dark":"light",n)};return o.current?.addEventListener("change",f),()=>o.current?.removeEventListener("change",f)},[i,r]),{colorScheme:a,setColorScheme:c,clearColorScheme:u}}function aQ({respectReducedMotion:e,getRootElement:t}){rh(()=>{e&&t()?.setAttribute("data-respect-reduced-motion","true")},[e])}iQ();function T9({theme:e,children:t,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:o=!0,deduplicateCssVariables:i=!0,withCssVariables:s=!0,cssVariablesSelector:a=":root",classNamesPrefix:c="mantine",colorSchemeManager:u=YX(),defaultColorScheme:f="light",getRootElement:p=()=>document.documentElement,cssVariablesResolver:g,forceColorScheme:y,stylesTransform:v,env:x}){const{colorScheme:S,setColorScheme:E,clearColorScheme:C}=sQ({defaultColorScheme:f,forceColorScheme:y,manager:u,getRootElement:p});return aQ({respectReducedMotion:e?.respectReducedMotion||!1,getRootElement:p}),h.jsx(_9.Provider,{value:{colorScheme:S,setColorScheme:E,clearColorScheme:C,getRootElement:p,classNamesPrefix:c,getStyleNonce:n,cssVariablesResolver:g,cssVariablesSelector:a,withStaticClasses:r,stylesTransform:v,env:x},children:h.jsxs(O9,{theme:e,children:[s&&h.jsx(A9,{cssVariablesSelector:a,deduplicateCssVariables:i}),o&&h.jsx(ZX,{}),t]})})}T9.displayName="@mantine/core/MantineProvider";function ih({classNames:e,styles:t,props:n,stylesCtx:r}){const o=zo();return{resolvedClassNames:Ox({theme:o,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:sv({theme:o,styles:t,props:n,stylesCtx:r||void 0})}}const lQ={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function cQ({theme:e,options:t,unstyled:n}){return pn(t?.focusable&&!n&&(e.focusClassName||lQ[e.focusRing]),t?.active&&!n&&e.activeClassName)}function uQ({selector:e,stylesCtx:t,options:n,props:r,theme:o}){return Ox({theme:o,classNames:n?.classNames,props:n?.props||r,stylesCtx:t})[e]}function _R({selector:e,stylesCtx:t,theme:n,classNames:r,props:o}){return Ox({theme:n,classNames:r,props:o,stylesCtx:t})[e]}function dQ({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function fQ({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function hQ({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(o=>`${t}-${o}-${n}`)}function pQ({themeName:e,theme:t,selector:n,props:r,stylesCtx:o}){return e.map(i=>Ox({theme:t,classNames:t.components[i]?.classNames,props:r,stylesCtx:o})?.[n])}function mQ({options:e,classes:t,selector:n,unstyled:r}){return e?.variant&&!r?t[`${n}--${e.variant}`]:void 0}function gQ({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:o,classNames:i,classes:s,unstyled:a,className:c,rootSelector:u,props:f,stylesCtx:p,withStaticClasses:g,headless:y,transformedStyles:v}){return pn(cQ({theme:e,options:t,unstyled:a||y}),pQ({theme:e,themeName:n,selector:r,props:f,stylesCtx:p}),mQ({options:t,classes:s,selector:r,unstyled:a}),_R({selector:r,stylesCtx:p,theme:e,classNames:i,props:f}),_R({selector:r,stylesCtx:p,theme:e,classNames:v,props:f}),uQ({selector:r,stylesCtx:p,options:t,props:f,theme:e}),dQ({rootSelector:u,selector:r,className:c}),fQ({selector:r,classes:s,unstyled:a||y}),g&&!y&&hQ({themeName:n,classNamesPrefix:o,selector:r,withStaticClass:t?.withStaticClass}),t?.className)}function yQ({theme:e,themeName:t,props:n,stylesCtx:r,selector:o}){return t.map(i=>sv({theme:e,styles:e.components[i]?.styles,props:n,stylesCtx:r})[o]).reduce((i,s)=>({...i,...s}),{})}function e_({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...e_({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function bQ(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],...pO(n[r])}}),t),{})}function vQ({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:o,selector:i,themeName:s,headless:a}){return bQ([a?{}:t?.(n,r,o),...s.map(c=>n.components?.[c]?.vars?.(n,r,o)),e?.(n,r,o)])?.[i]}function xQ({theme:e,themeName:t,selector:n,options:r,props:o,stylesCtx:i,rootSelector:s,styles:a,style:c,vars:u,varsResolver:f,headless:p,withStylesTransform:g}){return{...!g&&yQ({theme:e,themeName:t,props:o,stylesCtx:i,selector:n}),...!g&&sv({theme:e,styles:a,props:o,stylesCtx:i})[n],...!g&&sv({theme:e,styles:r?.styles,props:r?.props||o,stylesCtx:i})[n],...vQ({theme:e,props:o,stylesCtx:i,vars:u,varsResolver:f,selector:n,themeName:t,headless:p}),...s===n?e_({style:c,theme:e}):null,...e_({style:r?.style,theme:e})}}function wQ({props:e,stylesCtx:t,themeName:n}){const r=zo(),o=zX()?.();return{getTransformedStyles:s=>o?[...s.map(c=>o(c,{props:e,theme:r,ctx:t})),...n.map(c=>o(r.components[c]?.styles,{props:e,theme:r,ctx:t}))].filter(Boolean):[],withStylesTransform:!!o}}function gt({name:e,classes:t,props:n,stylesCtx:r,className:o,style:i,rootSelector:s="root",unstyled:a,classNames:c,styles:u,vars:f,varsResolver:p}){const g=zo(),y=DX(),v=IX(),x=LX(),S=(Array.isArray(e)?e:[e]).filter(_=>_),{withStylesTransform:E,getTransformedStyles:C}=wQ({props:n,stylesCtx:r,themeName:S});return(_,j)=>({className:gQ({theme:g,options:j,themeName:S,selector:_,classNamesPrefix:y,classNames:c,classes:t,unstyled:a,className:o,rootSelector:s,props:n,stylesCtx:r,withStaticClasses:v,headless:x,transformedStyles:C([j?.styles,u])}),style:xQ({theme:g,themeName:S,selector:_,options:j,props:n,stylesCtx:r,rootSelector:s,styles:u,style:i,vars:f,varsResolver:p,headless:x,withStylesTransform:E})})}function EO(e,t){return typeof e=="boolean"?e:t.autoContrast}function Pe(e,t,n){const r=zo(),o=r.components[e]?.defaultProps,i=typeof o=="function"?o(r):o;return{...t,...i,...pO(n)}}function XE(e){return Es(e).reduce((t,n)=>e[n]!==void 0?`${t}${HK(n)}:${e[n]};`:t,"").trim()}function SQ({selector:e,styles:t,media:n,container:r}){const o=t?XE(t):"",i=Array.isArray(n)?n.map(a=>`@media${a.query}{${e}{${XE(a.styles)}}}`):[],s=Array.isArray(r)?r.map(a=>`@container ${a.query}{${e}{${XE(a.styles)}}}`):[];return`${o?`${e}{${o}}`:""}${i.join("")}${s.join("")}`.trim()}function EQ(e){const t=vO();return h.jsx("style",{"data-mantine-styles":"inline",nonce:t?.(),dangerouslySetInnerHTML:{__html:SQ(e)}})}function sh(e){const{m:t,mx:n,my:r,mt:o,mb:i,ml:s,mr:a,me:c,ms:u,p:f,px:p,py:g,pt:y,pb:v,pl:x,pr:S,pe:E,ps:C,bd:_,bg:j,c:A,opacity:T,ff:k,fz:R,fw:V,lts:H,ta:F,lh:B,fs:U,tt:M,td:z,w:$,miw:L,maw:P,h:q,mih:Y,mah:D,bgsz:W,bgp:K,bgr:Q,bga:ie,pos:pe,top:ue,left:se,bottom:me,right:xe,inset:je,display:_e,flex:Ee,hiddenFrom:Re,visibleFrom:Me,lightHidden:ze,darkHidden:ve,sx:Ce,...Ae}=e;return{styleProps:pO({m:t,mx:n,my:r,mt:o,mb:i,ml:s,mr:a,me:c,ms:u,p:f,px:p,py:g,pt:y,pb:v,pl:x,pr:S,pe:E,ps:C,bd:_,bg:j,c:A,opacity:T,ff:k,fz:R,fw:V,lts:H,ta:F,lh:B,fs:U,tt:M,td:z,w:$,miw:L,maw:P,h:q,mih:Y,mah:D,bgsz:W,bgp:K,bgr:Q,bga:ie,pos:pe,top:ue,left:se,bottom:me,right:xe,inset:je,display:_e,flex:Ee,hiddenFrom:Re,visibleFrom:Me,lightHidden:ze,darkHidden:ve,sx:Ce}),rest:Ae}}const NQ={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},ms:{type:"spacing",property:"marginInlineStart"},me:{type:"spacing",property:"marginInlineEnd"},mx:{type:"spacing",property:"marginInline"},my:{type:"spacing",property:"marginBlock"},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},ps:{type:"spacing",property:"paddingInlineStart"},pe:{type:"spacing",property:"paddingInlineEnd"},px:{type:"spacing",property:"paddingInline"},py:{type:"spacing",property:"paddingBlock"},bd:{type:"border",property:"border"},bg:{type:"color",property:"background"},c:{type:"textColor",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"fontFamily",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"lineHeight",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"size",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"},flex:{type:"identity",property:"flex"}};function NO(e,t){const n=pc({color:e,theme:t});return n.color==="dimmed"?"var(--mantine-color-dimmed)":n.color==="bright"?"var(--mantine-color-bright)":n.variable?`var(${n.variable})`:n.color}function _Q(e,t){const n=pc({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:NO(e,t)}function CQ(e,t){if(typeof e=="number")return Oe(e);if(typeof e=="string"){const[n,r,...o]=e.split(" ").filter(s=>s.trim()!=="");let i=`${Oe(n)}`;return r&&(i+=` ${r}`),o.length>0&&(i+=` ${NO(o.join(" "),t)}`),i.trim()}return e}const CR={text:"var(--mantine-font-family)",mono:"var(--mantine-font-family-monospace)",monospace:"var(--mantine-font-family-monospace)",heading:"var(--mantine-font-family-headings)",headings:"var(--mantine-font-family-headings)"};function OQ(e){return typeof e=="string"&&e in CR?CR[e]:e}const jQ=["h1","h2","h3","h4","h5","h6"];function AQ(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="string"&&jQ.includes(e)?`var(--mantine-${e}-font-size)`:typeof e=="number"||typeof e=="string"?Oe(e):e}function TQ(e){return e}const $Q=["h1","h2","h3","h4","h5","h6"];function RQ(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:typeof e=="string"&&$Q.includes(e)?`var(--mantine-${e}-line-height)`:e}function kQ(e){return typeof e=="number"?Oe(e):e}function MQ(e,t){if(typeof e=="number")return Oe(e);if(typeof e=="string"){const n=e.replace("-","");if(!(n in t.spacing))return Oe(e);const r=`--mantine-spacing-${n}`;return e.startsWith("-")?`calc(var(${r}) * -1)`:`var(${r})`}return e}const QE={color:NO,textColor:_Q,fontSize:AQ,spacing:MQ,identity:TQ,size:kQ,lineHeight:RQ,fontFamily:OQ,border:CQ};function OR(e){return e.replace("(min-width: ","").replace("em)","")}function PQ({media:e,...t}){const r=Object.keys(e).sort((o,i)=>Number(OR(o))-Number(OR(i))).map(o=>({query:o,styles:e[o]}));return{...t,media:r}}function DQ(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function IQ(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function LQ(e){return typeof e=="object"&&e!==null?Es(e).filter(t=>t!=="base"):[]}function FQ(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function zQ({styleProps:e,data:t,theme:n}){return PQ(Es(e).reduce((r,o)=>{if(o==="hiddenFrom"||o==="visibleFrom"||o==="sx")return r;const i=t[o],s=Array.isArray(i.property)?i.property:[i.property],a=IQ(e[o]);if(!DQ(e[o]))return s.forEach(u=>{r.inlineStyles[u]=QE[i.type](a,n)}),r;r.hasResponsiveStyles=!0;const c=LQ(e[o]);return s.forEach(u=>{a&&(r.styles[u]=QE[i.type](a,n)),c.forEach(f=>{const p=`(min-width: ${n.breakpoints[f]})`;r.media[p]={...r.media[p],[u]:QE[i.type](FQ(e[o],f),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function BQ(){return`__m__-${w.useId().replace(/:/g,"")}`}function $9(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...$9(r,t)}),{}):typeof e=="function"?e(t):e??{}}function R9(e){return e.startsWith("data-")?e:`data-${e}`}function VQ(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[R9(n)]=e[n]),t},{})}function k9(e){return e?typeof e=="string"?{[R9(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...k9(n)}),{}):VQ(e):null}function t_(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...t_(r,t)}),{}):typeof e=="function"?e(t):e??{}}function UQ({theme:e,style:t,vars:n,styleProps:r}){const o=t_(t,e),i=t_(n,e);return{...o,...i,...r}}const M9=w.forwardRef(({component:e,style:t,__vars:n,className:r,variant:o,mod:i,size:s,hiddenFrom:a,visibleFrom:c,lightHidden:u,darkHidden:f,renderRoot:p,__size:g,...y},v)=>{const x=zo(),S=e||"div",{styleProps:E,rest:C}=sh(y),j=FX()?.()?.(E.sx),A=BQ(),T=zQ({styleProps:E,theme:x,data:NQ}),k={ref:v,style:UQ({theme:x,style:t,vars:n,styleProps:T.inlineStyles}),className:pn(r,j,{[A]:T.hasResponsiveStyles,"mantine-light-hidden":u,"mantine-dark-hidden":f,[`mantine-hidden-from-${a}`]:a,[`mantine-visible-from-${c}`]:c}),"data-variant":o,"data-size":m9(s)?void 0:s||void 0,size:g,...k9(i),...C};return h.jsxs(h.Fragment,{children:[T.hasResponsiveStyles&&h.jsx(EQ,{selector:`.${A}`,styles:T.styles,media:T.media}),typeof p=="function"?p(k):h.jsx(S,{...k})]})});M9.displayName="@mantine/core/Box";const Fe=M9;function P9(e){return e}function HQ(e){const t=e;return n=>{const r=w.forwardRef((o,i)=>h.jsx(t,{...n,...o,ref:i}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r}}function Ue(e){const t=w.forwardRef(e);return t.extend=P9,t.withProps=n=>{const r=w.forwardRef((o,i)=>h.jsx(t,{...n,...o,ref:i}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t}function mc(e){const t=w.forwardRef(e);return t.withProps=n=>{const r=w.forwardRef((o,i)=>h.jsx(t,{...n,...o,ref:i}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t.extend=P9,t}const qQ=w.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function gc(){return w.useContext(qQ)}var Tg=s9();const sf=es(Tg);function jx(){return typeof window<"u"}function ah(e){return D9(e)?(e.nodeName||"").toLowerCase():"#document"}function lo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rs(e){var t;return(t=(D9(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function D9(e){return jx()?e instanceof Node||e instanceof lo(e).Node:!1}function cn(e){return jx()?e instanceof Element||e instanceof lo(e).Element:!1}function Do(e){return jx()?e instanceof HTMLElement||e instanceof lo(e).HTMLElement:!1}function n_(e){return!jx()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof lo(e).ShadowRoot}function $g(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=fi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function WQ(e){return["table","td","th"].includes(ah(e))}function Ax(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function _O(e){const t=Tx(),n=cn(e)?fi(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function GQ(e){let t=Ca(e);for(;Do(t)&&!nc(t);){if(_O(t))return t;if(Ax(t))return null;t=Ca(t)}return null}function Tx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function nc(e){return["html","body","#document"].includes(ah(e))}function fi(e){return lo(e).getComputedStyle(e)}function $x(e){return cn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ca(e){if(ah(e)==="html")return e;const t=e.assignedSlot||e.parentNode||n_(e)&&e.host||Rs(e);return n_(t)?t.host:t}function I9(e){const t=Ca(e);return nc(t)?e.ownerDocument?e.ownerDocument.body:e.body:Do(t)&&$g(t)?t:I9(t)}function ba(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=I9(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=lo(o);if(i){const a=r_(s);return t.concat(s,s.visualViewport||[],$g(o)?o:[],a&&n?ba(a):[])}return t.concat(o,ba(o,[],n))}function r_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jR(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function jm(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&n_(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function L9(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function F9(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function JQ(e){return XQ()?!1:!AR()&&e.width===0&&e.height===0||AR()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function YQ(){return/apple/i.test(navigator.vendor)}function AR(){const e=/android/i;return e.test(L9())||e.test(F9())}function KQ(){return L9().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function XQ(){return F9().includes("jsdom/")}function o_(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function QQ(e){return"nativeEvent"in e}function ZQ(e){return e.matches("html,body")}function uu(e){return e?.ownerDocument||document}function ZE(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Kd(e){return"composedPath"in e?e.composedPath()[0]:e.target}const eZ="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function tZ(e){return Do(e)&&e.matches(eZ)}const Yi=Math.min,xr=Math.max,av=Math.round,U0=Math.floor,Ns=e=>({x:e,y:e}),nZ={left:"right",right:"left",bottom:"top",top:"bottom"},rZ={start:"end",end:"start"};function i_(e,t,n){return xr(e,Yi(t,n))}function Oa(e,t){return typeof e=="function"?e(t):e}function Ki(e){return e.split("-")[0]}function lh(e){return e.split("-")[1]}function CO(e){return e==="x"?"y":"x"}function OO(e){return e==="y"?"height":"width"}function ja(e){return["top","bottom"].includes(Ki(e))?"y":"x"}function jO(e){return CO(ja(e))}function oZ(e,t,n){n===void 0&&(n=!1);const r=lh(e),o=jO(e),i=OO(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=lv(s)),[s,lv(s)]}function iZ(e){const t=lv(e);return[s_(e),t,s_(t)]}function s_(e){return e.replace(/start|end/g,t=>rZ[t])}function sZ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function aZ(e,t,n,r){const o=lh(e);let i=sZ(Ki(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(s_)))),i}function lv(e){return e.replace(/left|right|bottom|top/g,t=>nZ[t])}function lZ(e){return{top:0,right:0,bottom:0,left:0,...e}}function AO(e){return typeof e!="number"?lZ(e):{top:e,right:e,bottom:e,left:e}}function Cf(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function TR(e,t,n){let{reference:r,floating:o}=e;const i=ja(t),s=jO(t),a=OO(s),c=Ki(t),u=i==="y",f=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,g=r[a]/2-o[a]/2;let y;switch(c){case"top":y={x:f,y:r.y-o.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-o.width,y:p};break;default:y={x:r.x,y:r.y}}switch(lh(t)){case"start":y[s]-=g*(n&&u?-1:1);break;case"end":y[s]+=g*(n&&u?-1:1);break}return y}const cZ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=TR(u,r,c),g=r,y={},v=0;for(let x=0;x<a.length;x++){const{name:S,fn:E}=a[x],{x:C,y:_,data:j,reset:A}=await E({x:f,y:p,initialPlacement:r,placement:g,strategy:o,middlewareData:y,rects:u,platform:s,elements:{reference:e,floating:t}});f=C??f,p=_??p,y={...y,[S]:{...y[S],...j}},A&&v<=50&&(v++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(u=A.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):A.rects),{x:f,y:p}=TR(u,g,c)),x=-1)}return{x:f,y:p,placement:g,strategy:o,middlewareData:y}};async function TO(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:g=!1,padding:y=0}=Oa(t,e),v=AO(y),S=a[g?p==="floating"?"reference":"floating":p],E=Cf(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(S)))==null||n?S:S.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:c})),C=p==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),j=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},A=Cf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:_,strategy:c}):C);return{top:(E.top-A.top+v.top)/j.y,bottom:(A.bottom-E.bottom+v.bottom)/j.y,left:(E.left-A.left+v.left)/j.x,right:(A.right-E.right+v.right)/j.x}}const uZ=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:f=0}=Oa(e,t)||{};if(u==null)return{};const p=AO(f),g={x:n,y:r},y=jO(o),v=OO(y),x=await s.getDimensions(u),S=y==="y",E=S?"top":"left",C=S?"bottom":"right",_=S?"clientHeight":"clientWidth",j=i.reference[v]+i.reference[y]-g[y]-i.floating[v],A=g[y]-i.reference[y],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let k=T?T[_]:0;(!k||!await(s.isElement==null?void 0:s.isElement(T)))&&(k=a.floating[_]||i.floating[v]);const R=j/2-A/2,V=k/2-x[v]/2-1,H=Yi(p[E],V),F=Yi(p[C],V),B=H,U=k-x[v]-F,M=k/2-x[v]/2+R,z=i_(B,M,U),$=!c.arrow&&lh(o)!=null&&M!==z&&i.reference[v]/2-(M<B?H:F)-x[v]/2<0,L=$?M<B?M-B:M-U:0;return{[y]:g[y]+L,data:{[y]:z,centerOffset:M-z-L,...$&&{alignmentOffset:L}},reset:$}}}),dZ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:x=!0,...S}=Oa(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const E=Ki(o),C=ja(a),_=Ki(a)===a,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),A=g||(_||!x?[lv(a)]:iZ(a)),T=v!=="none";!g&&T&&A.push(...aZ(a,x,v,j));const k=[a,...A],R=await TO(t,S),V=[];let H=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&V.push(R[E]),p){const M=oZ(o,s,j);V.push(R[M[0]],R[M[1]])}if(H=[...H,{placement:o,overflows:V}],!V.every(M=>M<=0)){var F,B;const M=(((F=i.flip)==null?void 0:F.index)||0)+1,z=k[M];if(z)return{data:{index:M,overflows:H},reset:{placement:z}};let $=(B=H.filter(L=>L.overflows[0]<=0).sort((L,P)=>L.overflows[1]-P.overflows[1])[0])==null?void 0:B.placement;if(!$)switch(y){case"bestFit":{var U;const L=(U=H.filter(P=>{if(T){const q=ja(P.placement);return q===C||q==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(q=>q>0).reduce((q,Y)=>q+Y,0)]).sort((P,q)=>P[1]-q[1])[0])==null?void 0:U[0];L&&($=L);break}case"initialPlacement":$=a;break}if(o!==$)return{reset:{placement:$}}}return{}}}};function z9(e){const t=Yi(...e.map(i=>i.left)),n=Yi(...e.map(i=>i.top)),r=xr(...e.map(i=>i.right)),o=xr(...e.map(i=>i.bottom));return{x:t,y:n,width:r-t,height:o-n}}function fZ(e){const t=e.slice().sort((o,i)=>o.y-i.y),n=[];let r=null;for(let o=0;o<t.length;o++){const i=t[o];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(o=>Cf(z9(o)))}const hZ=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:s}=t,{padding:a=2,x:c,y:u}=Oa(e,t),f=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),p=fZ(f),g=Cf(z9(f)),y=AO(a);function v(){if(p.length===2&&p[0].left>p[1].right&&c!=null&&u!=null)return p.find(S=>c>S.left-y.left&&c<S.right+y.right&&u>S.top-y.top&&u<S.bottom+y.bottom)||g;if(p.length>=2){if(ja(n)==="y"){const H=p[0],F=p[p.length-1],B=Ki(n)==="top",U=H.top,M=F.bottom,z=B?H.left:F.left,$=B?H.right:F.right,L=$-z,P=M-U;return{top:U,bottom:M,left:z,right:$,width:L,height:P,x:z,y:U}}const S=Ki(n)==="left",E=xr(...p.map(H=>H.right)),C=Yi(...p.map(H=>H.left)),_=p.filter(H=>S?H.left===C:H.right===E),j=_[0].top,A=_[_.length-1].bottom,T=C,k=E,R=k-T,V=A-j;return{top:j,bottom:A,left:T,right:k,width:R,height:V,x:T,y:j}}return g}const x=await i.getElementRects({reference:{getBoundingClientRect:v},floating:r.floating,strategy:s});return o.reference.x!==x.reference.x||o.reference.y!==x.reference.y||o.reference.width!==x.reference.width||o.reference.height!==x.reference.height?{reset:{rects:x}}:{}}}};async function pZ(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Ki(n),a=lh(n),c=ja(n)==="y",u=["left","top"].includes(s)?-1:1,f=i&&c?-1:1,p=Oa(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(y=a==="end"?v*-1:v),c?{x:y*f,y:g*u}:{x:g*u,y:y*f}}const mZ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await pZ(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},gZ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:S=>{let{x:E,y:C}=S;return{x:E,y:C}}},...c}=Oa(e,t),u={x:n,y:r},f=await TO(t,c),p=ja(Ki(o)),g=CO(p);let y=u[g],v=u[p];if(i){const S=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=y+f[S],_=y-f[E];y=i_(C,y,_)}if(s){const S=p==="y"?"top":"left",E=p==="y"?"bottom":"right",C=v+f[S],_=v-f[E];v=i_(C,v,_)}const x=a.fn({...t,[g]:y,[p]:v});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[g]:i,[p]:s}}}}}},yZ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Oa(e,t),f={x:n,y:r},p=ja(o),g=CO(p);let y=f[g],v=f[p];const x=Oa(a,t),S=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const _=g==="y"?"height":"width",j=i.reference[g]-i.floating[_]+S.mainAxis,A=i.reference[g]+i.reference[_]-S.mainAxis;y<j?y=j:y>A&&(y=A)}if(u){var E,C;const _=g==="y"?"width":"height",j=["top","left"].includes(Ki(o)),A=i.reference[p]-i.floating[_]+(j&&((E=s.offset)==null?void 0:E[p])||0)+(j?0:S.crossAxis),T=i.reference[p]+i.reference[_]+(j?0:((C=s.offset)==null?void 0:C[p])||0)-(j?S.crossAxis:0);v<A?v=A:v>T&&(v=T)}return{[g]:y,[p]:v}}}},bZ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:c=()=>{},...u}=Oa(e,t),f=await TO(t,u),p=Ki(o),g=lh(o),y=ja(o)==="y",{width:v,height:x}=i.floating;let S,E;p==="top"||p==="bottom"?(S=p,E=g===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(E=p,S=g==="end"?"top":"bottom");const C=x-f.top-f.bottom,_=v-f.left-f.right,j=Yi(x-f[S],C),A=Yi(v-f[E],_),T=!t.middlewareData.shift;let k=j,R=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=C),T&&!g){const H=xr(f.left,0),F=xr(f.right,0),B=xr(f.top,0),U=xr(f.bottom,0);y?R=v-2*(H!==0||F!==0?H+F:xr(f.left,f.right)):k=x-2*(B!==0||U!==0?B+U:xr(f.top,f.bottom))}await c({...t,availableWidth:R,availableHeight:k});const V=await s.getDimensions(a.floating);return v!==V.width||x!==V.height?{reset:{rects:!0}}:{}}}};function B9(e){const t=fi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Do(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=av(n)!==i||av(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function $O(e){return cn(e)?e:e.contextElement}function gf(e){const t=$O(e);if(!Do(t))return Ns(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=B9(t);let s=(i?av(n.width):n.width)/r,a=(i?av(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const vZ=Ns(0);function V9(e){const t=lo(e);return!Tx()||!t.visualViewport?vZ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xZ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==lo(e)?!1:t}function Eu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=$O(e);let s=Ns(1);t&&(r?cn(r)&&(s=gf(r)):s=gf(e));const a=xZ(i,n,r)?V9(i):Ns(0);let c=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,f=o.width/s.x,p=o.height/s.y;if(i){const g=lo(i),y=r&&cn(r)?lo(r):r;let v=g,x=r_(v);for(;x&&r&&y!==v;){const S=gf(x),E=x.getBoundingClientRect(),C=fi(x),_=E.left+(x.clientLeft+parseFloat(C.paddingLeft))*S.x,j=E.top+(x.clientTop+parseFloat(C.paddingTop))*S.y;c*=S.x,u*=S.y,f*=S.x,p*=S.y,c+=_,u+=j,v=lo(x),x=r_(v)}}return Cf({width:f,height:p,x:c,y:u})}function RO(e,t){const n=$x(e).scrollLeft;return t?t.left+n:Eu(Rs(e)).left+n}function U9(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:RO(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function wZ(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Rs(r),a=t?Ax(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Ns(1);const f=Ns(0),p=Do(r);if((p||!p&&!i)&&((ah(r)!=="body"||$g(s))&&(c=$x(r)),Do(r))){const y=Eu(r);u=gf(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=s&&!p&&!i?U9(s,c,!0):Ns(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+g.x,y:n.y*u.y-c.scrollTop*u.y+f.y+g.y}}function SZ(e){return Array.from(e.getClientRects())}function EZ(e){const t=Rs(e),n=$x(e),r=e.ownerDocument.body,o=xr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=xr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+RO(e);const a=-n.scrollTop;return fi(r).direction==="rtl"&&(s+=xr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function NZ(e,t){const n=lo(e),r=Rs(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const u=Tx();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function _Z(e,t){const n=Eu(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Do(e)?gf(e):Ns(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:a,x:c,y:u}}function $R(e,t,n){let r;if(t==="viewport")r=NZ(e,n);else if(t==="document")r=EZ(Rs(e));else if(cn(t))r=_Z(t,n);else{const o=V9(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Cf(r)}function H9(e,t){const n=Ca(e);return n===t||!cn(n)||nc(n)?!1:fi(n).position==="fixed"||H9(n,t)}function CZ(e,t){const n=t.get(e);if(n)return n;let r=ba(e,[],!1).filter(a=>cn(a)&&ah(a)!=="body"),o=null;const i=fi(e).position==="fixed";let s=i?Ca(e):e;for(;cn(s)&&!nc(s);){const a=fi(s),c=_O(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||$g(s)&&!c&&H9(e,s))?r=r.filter(f=>f!==s):o=a,s=Ca(s)}return t.set(e,r),r}function OZ(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Ax(t)?[]:CZ(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,f)=>{const p=$R(t,f,o);return u.top=xr(p.top,u.top),u.right=Yi(p.right,u.right),u.bottom=Yi(p.bottom,u.bottom),u.left=xr(p.left,u.left),u},$R(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function jZ(e){const{width:t,height:n}=B9(e);return{width:t,height:n}}function AZ(e,t,n){const r=Do(t),o=Rs(t),i=n==="fixed",s=Eu(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Ns(0);if(r||!r&&!i)if((ah(t)!=="body"||$g(o))&&(a=$x(t)),r){const g=Eu(t,!0,i,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else o&&(c.x=RO(o));const u=o&&!r&&!i?U9(o,a):Ns(0),f=s.left+a.scrollLeft-c.x-u.x,p=s.top+a.scrollTop-c.y-u.y;return{x:f,y:p,width:s.width,height:s.height}}function e2(e){return fi(e).position==="static"}function RR(e,t){if(!Do(e)||fi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rs(e)===n&&(n=n.ownerDocument.body),n}function q9(e,t){const n=lo(e);if(Ax(e))return n;if(!Do(e)){let o=Ca(e);for(;o&&!nc(o);){if(cn(o)&&!e2(o))return o;o=Ca(o)}return n}let r=RR(e,t);for(;r&&WQ(r)&&e2(r);)r=RR(r,t);return r&&nc(r)&&e2(r)&&!_O(r)?n:r||GQ(e)||n}const TZ=async function(e){const t=this.getOffsetParent||q9,n=this.getDimensions,r=await n(e.floating);return{reference:AZ(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $Z(e){return fi(e).direction==="rtl"}const RZ={convertOffsetParentRelativeRectToViewportRelativeRect:wZ,getDocumentElement:Rs,getClippingRect:OZ,getOffsetParent:q9,getElementRects:TZ,getClientRects:SZ,getDimensions:jZ,getScale:gf,isElement:cn,isRTL:$Z};function W9(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function kZ(e,t){let n=null,r;const o=Rs(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:f,top:p,width:g,height:y}=u;if(a||t(),!g||!y)return;const v=U0(p),x=U0(o.clientWidth-(f+g)),S=U0(o.clientHeight-(p+y)),E=U0(f),_={rootMargin:-v+"px "+-x+"px "+-S+"px "+-E+"px",threshold:xr(0,Yi(1,c))||1};let j=!0;function A(T){const k=T[0].intersectionRatio;if(k!==c){if(!j)return s();k?s(!1,k):r=setTimeout(()=>{s(!1,1e-7)},1e3)}k===1&&!W9(u,e.getBoundingClientRect())&&s(),j=!1}try{n=new IntersectionObserver(A,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(A,_)}n.observe(e)}return s(!0),i}function MZ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=$O(e),f=o||i?[...u?ba(u):[],...ba(t)]:[];f.forEach(E=>{o&&E.addEventListener("scroll",n,{passive:!0}),i&&E.addEventListener("resize",n)});const p=u&&a?kZ(u,n):null;let g=-1,y=null;s&&(y=new ResizeObserver(E=>{let[C]=E;C&&C.target===u&&y&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=y)==null||_.observe(t)})),n()}),u&&!c&&y.observe(u),y.observe(t));let v,x=c?Eu(e):null;c&&S();function S(){const E=Eu(e);x&&!W9(x,E)&&n(),x=E,v=requestAnimationFrame(S)}return n(),()=>{var E;f.forEach(C=>{o&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),p?.(),(E=y)==null||E.disconnect(),y=null,c&&cancelAnimationFrame(v)}}const PZ=mZ,DZ=gZ,IZ=dZ,LZ=bZ,kR=uZ,FZ=hZ,zZ=yZ,BZ=(e,t,n)=>{const r=new Map,o={platform:RZ,...n},i={...o.platform,_c:r};return cZ(e,t,{...o,platform:i})};var kb=typeof document<"u"?w.useLayoutEffect:w.useEffect;function cv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cv(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!cv(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function G9(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function MR(e,t){const n=G9(e);return Math.round(t*n)/n}function t2(e){const t=w.useRef(e);return kb(()=>{t.current=e}),t}function VZ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[f,p]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=w.useState(r);cv(g,r)||y(r);const[v,x]=w.useState(null),[S,E]=w.useState(null),C=w.useCallback(P=>{P!==T.current&&(T.current=P,x(P))},[]),_=w.useCallback(P=>{P!==k.current&&(k.current=P,E(P))},[]),j=i||v,A=s||S,T=w.useRef(null),k=w.useRef(null),R=w.useRef(f),V=c!=null,H=t2(c),F=t2(o),B=t2(u),U=w.useCallback(()=>{if(!T.current||!k.current)return;const P={placement:t,strategy:n,middleware:g};F.current&&(P.platform=F.current),BZ(T.current,k.current,P).then(q=>{const Y={...q,isPositioned:B.current!==!1};M.current&&!cv(R.current,Y)&&(R.current=Y,Tg.flushSync(()=>{p(Y)}))})},[g,t,n,F,B]);kb(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p(P=>({...P,isPositioned:!1})))},[u]);const M=w.useRef(!1);kb(()=>(M.current=!0,()=>{M.current=!1}),[]),kb(()=>{if(j&&(T.current=j),A&&(k.current=A),j&&A){if(H.current)return H.current(j,A,U);U()}},[j,A,U,H,V]);const z=w.useMemo(()=>({reference:T,floating:k,setReference:C,setFloating:_}),[C,_]),$=w.useMemo(()=>({reference:j,floating:A}),[j,A]),L=w.useMemo(()=>{const P={position:n,left:0,top:0};if(!$.floating)return P;const q=MR($.floating,f.x),Y=MR($.floating,f.y);return a?{...P,transform:"translate("+q+"px, "+Y+"px)",...G9($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:Y}},[n,a,$.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:U,refs:z,elements:$,floatingStyles:L}),[f,U,z,$,L])}const UZ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?kR({element:r.current,padding:o}).fn(n):{}:r?kR({element:r,padding:o}).fn(n):{}}}},J9=(e,t)=>({...PZ(e),options:[e,t]}),kO=(e,t)=>({...DZ(e),options:[e,t]}),PR=(e,t)=>({...zZ(e),options:[e,t]}),uv=(e,t)=>({...IZ(e),options:[e,t]}),HZ=(e,t)=>({...LZ(e),options:[e,t]}),am=(e,t)=>({...FZ(e),options:[e,t]}),Y9=(e,t)=>({...UZ(e),options:[e,t]});function qZ(e){return w.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})},e)}const K9={...fO},WZ=K9.useInsertionEffect,GZ=WZ||(e=>e());function da(e){const t=w.useRef(()=>{});return GZ(()=>{t.current=e}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var _s=typeof document<"u"?w.useLayoutEffect:w.useEffect;let DR=!1,JZ=0;const IR=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+JZ++;function YZ(){const[e,t]=w.useState(()=>DR?IR():void 0);return _s(()=>{e==null&&t(IR())},[]),w.useEffect(()=>{DR=!0},[]),e}const KZ=K9.useId,X9=KZ||YZ;function XZ(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const QZ=w.createContext(null),ZZ=w.createContext(null),MO=()=>{var e;return((e=w.useContext(QZ))==null?void 0:e.id)||null},PO=()=>w.useContext(ZZ);function DO(e){return"data-floating-ui-"+e}function n2(e){const t=w.useRef(e);return _s(()=>{t.current=e}),t}const LR=DO("safe-polygon");function Mb(e,t,n){return n&&!o_(n)?0:typeof e=="number"?e:e?.[t]}function eee(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:s}=e,{enabled:a=!0,delay:c=0,handleClose:u=null,mouseOnly:f=!1,restMs:p=0,move:g=!0}=t,y=PO(),v=MO(),x=n2(u),S=n2(c),E=n2(n),C=w.useRef(),_=w.useRef(-1),j=w.useRef(),A=w.useRef(-1),T=w.useRef(!0),k=w.useRef(!1),R=w.useRef(()=>{}),V=w.useRef(!1),H=w.useCallback(()=>{var L;const P=(L=o.current.openEvent)==null?void 0:L.type;return P?.includes("mouse")&&P!=="mousedown"},[o]);w.useEffect(()=>{if(!a)return;function L(P){let{open:q}=P;q||(clearTimeout(_.current),clearTimeout(A.current),T.current=!0,V.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[a,i]),w.useEffect(()=>{if(!a||!x.current||!n)return;function L(q){H()&&r(!1,q,"hover")}const P=uu(s.floating).documentElement;return P.addEventListener("mouseleave",L),()=>{P.removeEventListener("mouseleave",L)}},[s.floating,n,r,a,x,H]);const F=w.useCallback(function(L,P,q){P===void 0&&(P=!0),q===void 0&&(q="hover");const Y=Mb(S.current,"close",C.current);Y&&!j.current?(clearTimeout(_.current),_.current=window.setTimeout(()=>r(!1,L,q),Y)):P&&(clearTimeout(_.current),r(!1,L,q))},[S,r]),B=da(()=>{R.current(),j.current=void 0}),U=da(()=>{if(k.current){const L=uu(s.floating).body;L.style.pointerEvents="",L.removeAttribute(LR),k.current=!1}}),M=da(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);w.useEffect(()=>{if(!a)return;function L(D){if(clearTimeout(_.current),T.current=!1,f&&!o_(C.current)||p>0&&!Mb(S.current,"open"))return;const W=Mb(S.current,"open",C.current);W?_.current=window.setTimeout(()=>{E.current||r(!0,D,"hover")},W):n||r(!0,D,"hover")}function P(D){if(M())return;R.current();const W=uu(s.floating);if(clearTimeout(A.current),V.current=!1,x.current&&o.current.floatingContext){n||clearTimeout(_.current),j.current=x.current({...o.current.floatingContext,tree:y,x:D.clientX,y:D.clientY,onClose(){U(),B(),M()||F(D,!0,"safe-polygon")}});const Q=j.current;W.addEventListener("mousemove",Q),R.current=()=>{W.removeEventListener("mousemove",Q)};return}(C.current==="touch"?!jm(s.floating,D.relatedTarget):!0)&&F(D)}function q(D){M()||o.current.floatingContext&&(x.current==null||x.current({...o.current.floatingContext,tree:y,x:D.clientX,y:D.clientY,onClose(){U(),B(),M()||F(D)}})(D))}if(cn(s.domReference)){var Y;const D=s.domReference;return n&&D.addEventListener("mouseleave",q),(Y=s.floating)==null||Y.addEventListener("mouseleave",q),g&&D.addEventListener("mousemove",L,{once:!0}),D.addEventListener("mouseenter",L),D.addEventListener("mouseleave",P),()=>{var W;n&&D.removeEventListener("mouseleave",q),(W=s.floating)==null||W.removeEventListener("mouseleave",q),g&&D.removeEventListener("mousemove",L),D.removeEventListener("mouseenter",L),D.removeEventListener("mouseleave",P)}}},[s,a,e,f,p,g,F,B,U,r,n,E,y,S,x,o,M]),_s(()=>{var L;if(a&&n&&(L=x.current)!=null&&L.__options.blockPointerEvents&&H()){k.current=!0;const q=s.floating;if(cn(s.domReference)&&q){var P;const Y=uu(s.floating).body;Y.setAttribute(LR,"");const D=s.domReference,W=y==null||(P=y.nodesRef.current.find(K=>K.id===v))==null||(P=P.context)==null?void 0:P.elements.floating;return W&&(W.style.pointerEvents=""),Y.style.pointerEvents="none",D.style.pointerEvents="auto",q.style.pointerEvents="auto",()=>{Y.style.pointerEvents="",D.style.pointerEvents="",q.style.pointerEvents=""}}}},[a,n,v,s,y,x,H]),_s(()=>{n||(C.current=void 0,V.current=!1,B(),U())},[n,B,U]),w.useEffect(()=>()=>{B(),clearTimeout(_.current),clearTimeout(A.current),U()},[a,s.domReference,B,U]);const z=w.useMemo(()=>{function L(P){C.current=P.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(P){const{nativeEvent:q}=P;function Y(){!T.current&&!E.current&&r(!0,q,"hover")}f&&!o_(C.current)||n||p===0||V.current&&P.movementX**2+P.movementY**2<2||(clearTimeout(A.current),C.current==="touch"?Y():(V.current=!0,A.current=window.setTimeout(Y,p)))}}},[f,r,n,E,p]),$=w.useMemo(()=>({onMouseEnter(){clearTimeout(_.current)},onMouseLeave(L){M()||F(L.nativeEvent,!1)}}),[F,M]);return w.useMemo(()=>a?{reference:z,floating:$}:{},[a,z,$])}const a_=()=>{},Q9=w.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:a_,setState:a_,isInstantPhase:!1}),tee=()=>w.useContext(Q9);function nee(e){const{children:t,delay:n,timeoutMs:r=0}=e,[o,i]=w.useReducer((c,u)=>({...c,...u}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),s=w.useRef(null),a=w.useCallback(c=>{i({currentId:c})},[]);return _s(()=>{o.currentId?s.current===null?s.current=o.currentId:o.isInstantPhase||i({isInstantPhase:!0}):(o.isInstantPhase&&i({isInstantPhase:!1}),s.current=null)},[o.currentId,o.isInstantPhase]),w.createElement(Q9.Provider,{value:w.useMemo(()=>({...o,setState:i,setCurrentId:a}),[o,a])},t)}function ree(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,floatingId:o}=e,{id:i,enabled:s=!0}=t,a=i??o,c=tee(),{currentId:u,setCurrentId:f,initialDelay:p,setState:g,timeoutMs:y}=c;return _s(()=>{s&&u&&(g({delay:{open:1,close:Mb(p,"close")}}),u!==a&&r(!1))},[s,a,r,g,u,p]),_s(()=>{function v(){r(!1),g({delay:p,currentId:null})}if(s&&u&&!n&&u===a){if(y){const x=window.setTimeout(v,y);return()=>{clearTimeout(x)}}v()}},[s,n,g,u,a,r,p,y]),_s(()=>{s&&(f===a_||!n||f(a))},[s,n,f,a]),c}function r2(e,t){let n=e.filter(o=>{var i;return o.parentId===t&&((i=o.context)==null?void 0:i.open)}),r=n;for(;r.length;)r=e.filter(o=>{var i;return(i=r)==null?void 0:i.some(s=>{var a;return o.parentId===s.id&&((a=o.context)==null?void 0:a.open)})}),n=n.concat(r);return n}const oee="data-floating-ui-focusable",iee={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},see={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},FR=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function aee(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:u="pointerdown",referencePress:f=!1,referencePressEvent:p="pointerdown",ancestorScroll:g=!1,bubbles:y,capture:v}=t,x=PO(),S=da(typeof c=="function"?c:()=>!1),E=typeof c=="function"?S:c,C=w.useRef(!1),_=w.useRef(!1),{escapeKey:j,outsidePress:A}=FR(y),{escapeKey:T,outsidePress:k}=FR(v),R=w.useRef(!1),V=da(z=>{var $;if(!n||!s||!a||z.key!=="Escape"||R.current)return;const L=($=i.current.floatingContext)==null?void 0:$.nodeId,P=x?r2(x.nodesRef.current,L):[];if(!j&&(z.stopPropagation(),P.length>0)){let q=!0;if(P.forEach(Y=>{var D;if((D=Y.context)!=null&&D.open&&!Y.context.dataRef.current.__escapeKeyBubbles){q=!1;return}}),!q)return}r(!1,QQ(z)?z.nativeEvent:z,"escape-key")}),H=da(z=>{var $;const L=()=>{var P;V(z),(P=Kd(z))==null||P.removeEventListener("keydown",L)};($=Kd(z))==null||$.addEventListener("keydown",L)}),F=da(z=>{var $;const L=C.current;C.current=!1;const P=_.current;if(_.current=!1,u==="click"&&P||L||typeof E=="function"&&!E(z))return;const q=Kd(z),Y="["+DO("inert")+"]",D=uu(o.floating).querySelectorAll(Y);let W=cn(q)?q:null;for(;W&&!nc(W);){const pe=Ca(W);if(nc(pe)||!cn(pe))break;W=pe}if(D.length&&cn(q)&&!ZQ(q)&&!jm(q,o.floating)&&Array.from(D).every(pe=>!jm(W,pe)))return;if(Do(q)&&M){const pe=q.clientWidth>0&&q.scrollWidth>q.clientWidth,ue=q.clientHeight>0&&q.scrollHeight>q.clientHeight;let se=ue&&z.offsetX>q.clientWidth;if(ue&&fi(q).direction==="rtl"&&(se=z.offsetX<=q.offsetWidth-q.clientWidth),se||pe&&z.offsetY>q.clientHeight)return}const K=($=i.current.floatingContext)==null?void 0:$.nodeId,Q=x&&r2(x.nodesRef.current,K).some(pe=>{var ue;return ZE(z,(ue=pe.context)==null?void 0:ue.elements.floating)});if(ZE(z,o.floating)||ZE(z,o.domReference)||Q)return;const ie=x?r2(x.nodesRef.current,K):[];if(ie.length>0){let pe=!0;if(ie.forEach(ue=>{var se;if((se=ue.context)!=null&&se.open&&!ue.context.dataRef.current.__outsidePressBubbles){pe=!1;return}}),!pe)return}r(!1,z,"outside-press")}),B=da(z=>{var $;const L=()=>{var P;F(z),(P=Kd(z))==null||P.removeEventListener(u,L)};($=Kd(z))==null||$.addEventListener(u,L)});w.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=j,i.current.__outsidePressBubbles=A;let z=-1;function $(D){r(!1,D,"ancestor-scroll")}function L(){window.clearTimeout(z),R.current=!0}function P(){z=window.setTimeout(()=>{R.current=!1},Tx()?5:0)}const q=uu(o.floating);a&&(q.addEventListener("keydown",T?H:V,T),q.addEventListener("compositionstart",L),q.addEventListener("compositionend",P)),E&&q.addEventListener(u,k?B:F,k);let Y=[];return g&&(cn(o.domReference)&&(Y=ba(o.domReference)),cn(o.floating)&&(Y=Y.concat(ba(o.floating))),!cn(o.reference)&&o.reference&&o.reference.contextElement&&(Y=Y.concat(ba(o.reference.contextElement)))),Y=Y.filter(D=>{var W;return D!==((W=q.defaultView)==null?void 0:W.visualViewport)}),Y.forEach(D=>{D.addEventListener("scroll",$,{passive:!0})}),()=>{a&&(q.removeEventListener("keydown",T?H:V,T),q.removeEventListener("compositionstart",L),q.removeEventListener("compositionend",P)),E&&q.removeEventListener(u,k?B:F,k),Y.forEach(D=>{D.removeEventListener("scroll",$)}),window.clearTimeout(z)}},[i,o,a,E,u,n,r,g,s,j,A,V,T,H,F,k,B]),w.useEffect(()=>{C.current=!1},[E,u]);const U=w.useMemo(()=>({onKeyDown:V,[iee[p]]:z=>{f&&r(!1,z.nativeEvent,"reference-press")}}),[V,r,f,p]),M=w.useMemo(()=>({onKeyDown:V,onMouseDown(){_.current=!0},onMouseUp(){_.current=!0},[see[u]]:()=>{C.current=!0}}),[V,u]);return w.useMemo(()=>s?{reference:U,floating:M}:{},[s,U,M])}function lee(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=X9(),i=w.useRef({}),[s]=w.useState(()=>XZ()),a=MO()!=null,[c,u]=w.useState(r.reference),f=da((y,v,x)=>{i.current.openEvent=y?v:void 0,s.emit("openchange",{open:y,event:v,reason:x,nested:a}),n?.(y,v,x)}),p=w.useMemo(()=>({setPositionReference:u}),[]),g=w.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return w.useMemo(()=>({dataRef:i,open:t,onOpenChange:f,elements:g,events:s,floatingId:o,refs:p}),[t,f,g,s,o,p])}function IO(e){e===void 0&&(e={});const{nodeId:t}=e,n=lee({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=w.useState(null),[a,c]=w.useState(null),f=o?.domReference||i,p=w.useRef(null),g=PO();_s(()=>{f&&(p.current=f)},[f]);const y=VZ({...e,elements:{...o,...a&&{reference:a}}}),v=w.useCallback(_=>{const j=cn(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),contextElement:_}:_;c(j),y.refs.setReference(j)},[y.refs]),x=w.useCallback(_=>{(cn(_)||_===null)&&(p.current=_,s(_)),(cn(y.refs.reference.current)||y.refs.reference.current===null||_!==null&&!cn(_))&&y.refs.setReference(_)},[y.refs]),S=w.useMemo(()=>({...y.refs,setReference:x,setPositionReference:v,domReference:p}),[y.refs,x,v]),E=w.useMemo(()=>({...y.elements,domReference:f}),[y.elements,f]),C=w.useMemo(()=>({...y,...r,refs:S,elements:E,nodeId:t}),[y,S,E,t,r]);return _s(()=>{r.dataRef.current.floatingContext=C;const _=g?.nodesRef.current.find(j=>j.id===t);_&&(_.context=C)}),w.useMemo(()=>({...y,context:C,refs:S,elements:E}),[y,S,E,C])}function cee(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:s}=e,{enabled:a=!0,visibleOnly:c=!0}=t,u=w.useRef(!1),f=w.useRef(),p=w.useRef(!0);w.useEffect(()=>{if(!a)return;const y=lo(s.domReference);function v(){!n&&Do(s.domReference)&&s.domReference===jR(uu(s.domReference))&&(u.current=!0)}function x(){p.current=!0}return y.addEventListener("blur",v),y.addEventListener("keydown",x,!0),()=>{y.removeEventListener("blur",v),y.removeEventListener("keydown",x,!0)}},[s.domReference,n,a]),w.useEffect(()=>{if(!a)return;function y(v){let{reason:x}=v;(x==="reference-press"||x==="escape-key")&&(u.current=!0)}return o.on("openchange",y),()=>{o.off("openchange",y)}},[o,a]),w.useEffect(()=>()=>{clearTimeout(f.current)},[]);const g=w.useMemo(()=>({onPointerDown(y){JQ(y.nativeEvent)||(p.current=!1)},onMouseLeave(){u.current=!1},onFocus(y){if(u.current)return;const v=Kd(y.nativeEvent);if(c&&cn(v))try{if(YQ()&&KQ())throw Error();if(!v.matches(":focus-visible"))return}catch{if(!p.current&&!tZ(v))return}r(!0,y.nativeEvent,"focus")},onBlur(y){u.current=!1;const v=y.relatedTarget,x=y.nativeEvent,S=cn(v)&&v.hasAttribute(DO("focus-guard"))&&v.getAttribute("data-type")==="outside";f.current=window.setTimeout(()=>{var E;const C=jR(s.domReference?s.domReference.ownerDocument:document);!v&&C===s.domReference||jm((E=i.current.floatingContext)==null?void 0:E.refs.floating.current,C)||jm(s.domReference,C)||S||r(!1,x,"focus")})}}),[i,s.domReference,r,c]);return w.useMemo(()=>a?{reference:g}:{},[a,g])}const zR="active",BR="selected";function o2(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[zR]:s,[BR]:a,...c}=e;i=c}return{...n==="floating"&&{tabIndex:-1,[oee]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(c=>{let[u,f]=c;if(!(o&&[zR,BR].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof f=="function"){var p;(p=r.get(u))==null||p.push(f),s[u]=function(){for(var g,y=arguments.length,v=new Array(y),x=0;x<y;x++)v[x]=arguments[x];return(g=r.get(u))==null?void 0:g.map(S=>S(...v)).find(S=>S!==void 0)}}}else s[u]=f}),s),{})}}function uee(e){e===void 0&&(e=[]);const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),r=e.map(a=>a?.item),o=w.useCallback(a=>o2(a,e,"reference"),t),i=w.useCallback(a=>o2(a,e,"floating"),n),s=w.useCallback(a=>o2(a,e,"item"),r);return w.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const dee=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function fee(e,t){var n;t===void 0&&(t={});const{open:r,floatingId:o}=e,{enabled:i=!0,role:s="dialog"}=t,a=(n=dee.get(s))!=null?n:s,c=X9(),f=MO()!=null,p=w.useMemo(()=>a==="tooltip"||s==="label"?{["aria-"+(s==="label"?"labelledby":"describedby")]:r?o:void 0}:{"aria-expanded":r?"true":"false","aria-haspopup":a==="alertdialog"?"dialog":a,"aria-controls":r?o:void 0,...a==="listbox"&&{role:"combobox"},...a==="menu"&&{id:c},...a==="menu"&&f&&{role:"menuitem"},...s==="select"&&{"aria-autocomplete":"none"},...s==="combobox"&&{"aria-autocomplete":"list"}},[a,o,f,r,c,s]),g=w.useMemo(()=>{const v={id:o,...a&&{role:a}};return a==="tooltip"||s==="label"?v:{...v,...a==="menu"&&{"aria-labelledby":c}}},[a,o,c,s]),y=w.useCallback(v=>{let{active:x,selected:S}=v;const E={role:"option",...x&&{id:o+"-option"}};switch(s){case"select":return{...E,"aria-selected":x&&S};case"combobox":return{...E,...x&&{"aria-selected":!0}}}return{}},[o,s]);return w.useMemo(()=>i?{reference:p,floating:g,item:y}:{},[i,p,g,y])}const[hee,yi]=Pa("ScrollArea.Root component was not found in tree");function Of(e,t){const n=ru(t);rh(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const pee=w.forwardRef((e,t)=>{const{style:n,...r}=e,o=yi(),[i,s]=w.useState(0),[a,c]=w.useState(0),u=!!(i&&a);return Of(o.scrollbarX,()=>{const f=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(f),c(f)}),Of(o.scrollbarY,()=>{const f=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(f),s(f)}),u?h.jsx("div",{...r,ref:t,style:{...n,width:i,height:a}}):null}),mee=w.forwardRef((e,t)=>{const n=yi(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?h.jsx(pee,{...e,ref:t}):null}),gee={scrollHideDelay:1e3,type:"hover"},Z9=w.forwardRef((e,t)=>{const n=Pe("ScrollAreaRoot",gee,e),{type:r,scrollHideDelay:o,scrollbars:i,...s}=n,[a,c]=w.useState(null),[u,f]=w.useState(null),[p,g]=w.useState(null),[y,v]=w.useState(null),[x,S]=w.useState(null),[E,C]=w.useState(0),[_,j]=w.useState(0),[A,T]=w.useState(!1),[k,R]=w.useState(!1),V=jn(t,H=>c(H));return h.jsx(hee,{value:{type:r,scrollHideDelay:o,scrollArea:a,viewport:u,onViewportChange:f,content:p,onContentChange:g,scrollbarX:y,onScrollbarXChange:v,scrollbarXEnabled:A,onScrollbarXEnabledChange:T,scrollbarY:x,onScrollbarYChange:S,scrollbarYEnabled:k,onScrollbarYEnabledChange:R,onCornerWidthChange:C,onCornerHeightChange:j},children:h.jsx(Fe,{...s,ref:V,__vars:{"--sa-corner-width":i!=="xy"?"0px":`${E}px`,"--sa-corner-height":i!=="xy"?"0px":`${_}px`}})})});Z9.displayName="@mantine/core/ScrollAreaRoot";function e8(e,t){const n=e/t;return Number.isNaN(n)?0:n}function Rx(e){const t=e8(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function t8(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function yee(e,[t,n]){return Math.min(n,Math.max(t,e))}function VR(e,t,n="ltr"){const r=Rx(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,c=n==="ltr"?[0,s]:[s*-1,0],u=yee(e,c);return t8([0,s],[0,a])(u)}function bee(e,t,n,r="ltr"){const o=Rx(n),i=o/2,s=t||i,a=o-s,c=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,f=n.content-n.viewport,p=r==="ltr"?[0,f]:[f*-1,0];return t8([c,u],p)(e)}function n8(e,t){return e>0&&e<t}function Ul(e){return e?parseInt(e,10):0}function vu(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e?.(r),(n===!1||!r.defaultPrevented)&&t?.(r)}}const[vee,r8]=Pa("ScrollAreaScrollbar was not found in tree"),o8=w.forwardRef((e,t)=>{const{sizes:n,hasThumb:r,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:s,onThumbPositionChange:a,onDragScroll:c,onWheelScroll:u,onResize:f,...p}=e,g=yi(),[y,v]=w.useState(null),x=jn(t,R=>v(R)),S=w.useRef(null),E=w.useRef(""),{viewport:C}=g,_=n.content-n.viewport,j=ru(u),A=ru(a),T=Og(f,10),k=R=>{if(S.current){const V=R.clientX-S.current.left,H=R.clientY-S.current.top;c({x:V,y:H})}};return w.useEffect(()=>{const R=V=>{const H=V.target;y?.contains(H)&&j(V,_)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[C,y,_,j]),w.useEffect(A,[n,A]),Of(y,T),Of(g.content,T),h.jsx(vee,{value:{scrollbar:y,hasThumb:r,onThumbChange:ru(o),onThumbPointerUp:ru(i),onThumbPositionChange:A,onThumbPointerDown:ru(s)},children:h.jsx("div",{...p,ref:x,"data-mantine-scrollbar":!0,style:{position:"absolute",...p.style},onPointerDown:vu(e.onPointerDown,R=>{R.preventDefault(),R.button===0&&(R.target.setPointerCapture(R.pointerId),S.current=y.getBoundingClientRect(),E.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",k(R))}),onPointerMove:vu(e.onPointerMove,k),onPointerUp:vu(e.onPointerUp,R=>{const V=R.target;V.hasPointerCapture(R.pointerId)&&(R.preventDefault(),V.releasePointerCapture(R.pointerId))}),onLostPointerCapture:()=>{document.body.style.webkitUserSelect=E.current,S.current=null}})})}),i8=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=yi(),[a,c]=w.useState(),u=w.useRef(null),f=jn(t,u,s.onScrollbarXChange);return w.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),h.jsx(o8,{"data-orientation":"horizontal",...i,ref:f,sizes:n,style:{...o,"--sa-thumb-width":`${Rx(n)}px`},onThumbPointerDown:p=>e.onThumbPointerDown(p.x),onDragScroll:p=>e.onDragScroll(p.x),onWheelScroll:(p,g)=>{if(s.viewport){const y=s.viewport.scrollLeft+p.deltaX;e.onWheelScroll(y),n8(y,g)&&p.preventDefault()}},onResize:()=>{u.current&&s.viewport&&a&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Ul(a.paddingLeft),paddingEnd:Ul(a.paddingRight)}})}})});i8.displayName="@mantine/core/ScrollAreaScrollbarX";const s8=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=yi(),[a,c]=w.useState(),u=w.useRef(null),f=jn(t,u,s.onScrollbarYChange);return w.useEffect(()=>{u.current&&c(window.getComputedStyle(u.current))},[]),h.jsx(o8,{...i,"data-orientation":"vertical",ref:f,sizes:n,style:{"--sa-thumb-height":`${Rx(n)}px`,...o},onThumbPointerDown:p=>e.onThumbPointerDown(p.y),onDragScroll:p=>e.onDragScroll(p.y),onWheelScroll:(p,g)=>{if(s.viewport){const y=s.viewport.scrollTop+p.deltaY;e.onWheelScroll(y),n8(y,g)&&p.preventDefault()}},onResize:()=>{u.current&&s.viewport&&a&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Ul(a.paddingTop),paddingEnd:Ul(a.paddingBottom)}})}})});s8.displayName="@mantine/core/ScrollAreaScrollbarY";const kx=w.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:o}=gc(),i=yi(),s=w.useRef(null),a=w.useRef(0),[c,u]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=e8(c.viewport,c.content),p={...r,sizes:c,onSizesChange:u,hasThumb:f>0&&f<1,onThumbChange:y=>{s.current=y},onThumbPointerUp:()=>{a.current=0},onThumbPointerDown:y=>{a.current=y}},g=(y,v)=>bee(y,a.current,c,v);return n==="horizontal"?h.jsx(i8,{...p,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const y=i.viewport.scrollLeft,v=VR(y,c,o);s.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollLeft=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollLeft=g(y,o))}}):n==="vertical"?h.jsx(s8,{...p,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const y=i.viewport.scrollTop,v=VR(y,c);c.scrollbar.size===0?s.current.style.setProperty("--thumb-opacity","0"):s.current.style.setProperty("--thumb-opacity","1"),s.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollTop=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollTop=g(y))}}):null});kx.displayName="@mantine/core/ScrollAreaScrollbarVisible";const LO=w.forwardRef((e,t)=>{const n=yi(),{forceMount:r,...o}=e,[i,s]=w.useState(!1),a=e.orientation==="horizontal",c=Og(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,f=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?u:f)}},10);return Of(n.viewport,c),Of(n.content,c),r||i?h.jsx(kx,{"data-state":i?"visible":"hidden",...o,ref:t}):null});LO.displayName="@mantine/core/ScrollAreaScrollbarAuto";const a8=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=yi(),[i,s]=w.useState(!1);return w.useEffect(()=>{const{scrollArea:a}=o;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},f=()=>{c=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",f)}}},[o.scrollArea,o.scrollHideDelay]),n||i?h.jsx(LO,{"data-state":i?"visible":"hidden",...r,ref:t}):null});a8.displayName="@mantine/core/ScrollAreaScrollbarHover";const xee=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=yi(),i=e.orientation==="horizontal",[s,a]=w.useState("hidden"),c=Og(()=>a("idle"),100);return w.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>a("hidden"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,o.scrollHideDelay]),w.useEffect(()=>{const{viewport:u}=o,f=i?"scrollLeft":"scrollTop";if(u){let p=u[f];const g=()=>{const y=u[f];p!==y&&(a("scrolling"),c()),p=y};return u.addEventListener("scroll",g),()=>u.removeEventListener("scroll",g)}},[o.viewport,i,c]),n||s!=="hidden"?h.jsx(kx,{"data-state":s==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:vu(e.onPointerEnter,()=>a("interacting")),onPointerLeave:vu(e.onPointerLeave,()=>a("idle"))}):null}),l_=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=yi(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return w.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?h.jsx(a8,{...r,ref:t,forceMount:n}):o.type==="scroll"?h.jsx(xee,{...r,ref:t,forceMount:n}):o.type==="auto"?h.jsx(LO,{...r,ref:t,forceMount:n}):o.type==="always"?h.jsx(kx,{...r,ref:t}):null});l_.displayName="@mantine/core/ScrollAreaScrollbar";function wee(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)}const l8=w.forwardRef((e,t)=>{const{style:n,...r}=e,o=yi(),i=r8(),{onThumbPositionChange:s}=i,a=jn(t,f=>i.onThumbChange(f)),c=w.useRef(void 0),u=Og(()=>{c.current&&(c.current(),c.current=void 0)},100);return w.useEffect(()=>{const{viewport:f}=o;if(f){const p=()=>{if(u(),!c.current){const g=wee(f,s);c.current=g,s()}};return s(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[o.viewport,u,s]),h.jsx("div",{"data-state":i.hasThumb?"visible":"hidden",...r,ref:a,style:{width:"var(--sa-thumb-width)",height:"var(--sa-thumb-height)",...n},onPointerDownCapture:vu(e.onPointerDownCapture,f=>{const g=f.target.getBoundingClientRect(),y=f.clientX-g.left,v=f.clientY-g.top;i.onThumbPointerDown({x:y,y:v})}),onPointerUp:vu(e.onPointerUp,i.onThumbPointerUp)})});l8.displayName="@mantine/core/ScrollAreaThumb";const c_=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=r8();return n||o.hasThumb?h.jsx(l8,{ref:t,...r}):null});c_.displayName="@mantine/core/ScrollAreaThumb";const c8=w.forwardRef(({children:e,style:t,...n},r)=>{const o=yi(),i=jn(r,o.onViewportChange);return h.jsx(Fe,{...n,ref:i,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t},children:h.jsx("div",{style:{minWidth:"100%"},ref:o.onContentChange,children:e})})});c8.displayName="@mantine/core/ScrollAreaViewport";var FO={root:"m_d57069b5",viewport:"m_c0783ff9",viewportInner:"m_f8f631dd",scrollbar:"m_c44ba933",thumb:"m_d8b5e363",corner:"m_21657268"};const u8={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},See=(e,{scrollbarSize:t,overscrollBehavior:n})=>({root:{"--scrollarea-scrollbar-size":Oe(t),"--scrollarea-over-scroll-behavior":n}}),ch=Ue((e,t)=>{const n=Pe("ScrollArea",u8,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,scrollbarSize:c,vars:u,type:f,scrollHideDelay:p,viewportProps:g,viewportRef:y,onScrollPositionChange:v,children:x,offsetScrollbars:S,scrollbars:E,onBottomReached:C,onTopReached:_,overscrollBehavior:j,...A}=n,[T,k]=w.useState(!1),[R,V]=w.useState(!1),[H,F]=w.useState(!1),B=gt({name:"ScrollArea",props:n,classes:FO,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:u,varsResolver:See}),U=w.useRef(null),M=qZ([y,U]);return w.useEffect(()=>{if(!U.current||S!=="present")return;const z=U.current,$=new ResizeObserver(()=>{const{scrollHeight:L,clientHeight:P,scrollWidth:q,clientWidth:Y}=z;V(L>P),F(q>Y)});return $.observe(z),()=>$.disconnect()},[U,S]),h.jsxs(Z9,{type:f==="never"?"always":f,scrollHideDelay:p,ref:t,scrollbars:E,...B("root"),...A,children:[h.jsx(c8,{...g,...B("viewport",{style:g?.style}),ref:M,"data-offset-scrollbars":S===!0?"xy":S||void 0,"data-scrollbars":E||void 0,"data-horizontal-hidden":S==="present"&&!H?"true":void 0,"data-vertical-hidden":S==="present"&&!R?"true":void 0,onScroll:z=>{g?.onScroll?.(z),v?.({x:z.currentTarget.scrollLeft,y:z.currentTarget.scrollTop});const{scrollTop:$,scrollHeight:L,clientHeight:P}=z.currentTarget;$-(L-P)>=-.6&&C?.(),$===0&&_?.()},children:x}),(E==="xy"||E==="x")&&h.jsx(l_,{...B("scrollbar"),orientation:"horizontal","data-hidden":f==="never"||S==="present"&&!H?!0:void 0,forceMount:!0,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),children:h.jsx(c_,{...B("thumb")})}),(E==="xy"||E==="y")&&h.jsx(l_,{...B("scrollbar"),orientation:"vertical","data-hidden":f==="never"||S==="present"&&!R?!0:void 0,forceMount:!0,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),children:h.jsx(c_,{...B("thumb")})}),h.jsx(mee,{...B("corner"),"data-hovered":T||void 0,"data-hidden":f==="never"||void 0})]})});ch.displayName="@mantine/core/ScrollArea";const zO=Ue((e,t)=>{const{children:n,classNames:r,styles:o,scrollbarSize:i,scrollHideDelay:s,type:a,dir:c,offsetScrollbars:u,viewportRef:f,onScrollPositionChange:p,unstyled:g,variant:y,viewportProps:v,scrollbars:x,style:S,vars:E,onBottomReached:C,onTopReached:_,...j}=Pe("ScrollAreaAutosize",u8,e);return h.jsx(Fe,{...j,ref:t,style:[{display:"flex",overflow:"auto"},S],children:h.jsx(Fe,{style:{display:"flex",flexDirection:"column",flex:1},children:h.jsx(ch,{classNames:r,styles:o,scrollHideDelay:s,scrollbarSize:i,type:a,dir:c,offsetScrollbars:u,viewportRef:f,onScrollPositionChange:p,unstyled:g,variant:y,viewportProps:v,vars:E,scrollbars:x,onBottomReached:C,onTopReached:_,children:n})})})});ch.classes=FO;zO.displayName="@mantine/core/ScrollAreaAutosize";zO.classes=FO;ch.Autosize=zO;var d8={root:"m_87cf2631"};const Eee={__staticSelector:"UnstyledButton"},Aa=mc((e,t)=>{const n=Pe("UnstyledButton",Eee,e),{className:r,component:o="button",__staticSelector:i,unstyled:s,classNames:a,styles:c,style:u,...f}=n,p=gt({name:i,props:n,classes:d8,className:r,style:u,classNames:a,styles:c,unstyled:s});return h.jsx(Fe,{...p("root",{focusable:!0}),component:o,ref:t,type:o==="button"?"button":void 0,...f})});Aa.classes=d8;Aa.displayName="@mantine/core/UnstyledButton";var f8={root:"m_515a97f8"};const Nee={},BO=Ue((e,t)=>{const n=Pe("VisuallyHidden",Nee,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,...u}=n,f=gt({name:"VisuallyHidden",classes:f8,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a});return h.jsx(Fe,{component:"span",ref:t,...f("root"),...u})});BO.classes=f8;BO.displayName="@mantine/core/VisuallyHidden";var h8={root:"m_1b7284a3"};const _ee={},Cee=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:Qn(t),"--paper-shadow":gO(n)}}),VO=mc((e,t)=>{const n=Pe("Paper",_ee,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,withBorder:c,vars:u,radius:f,shadow:p,variant:g,mod:y,...v}=n,x=gt({name:"Paper",props:n,classes:h8,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:u,varsResolver:Cee});return h.jsx(Fe,{ref:t,mod:[{"data-with-border":c},y],...x("root"),variant:g,...v})});VO.classes=h8;VO.displayName="@mantine/core/Paper";function p8(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}function UR(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function HR(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const Oee={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function jee({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:i,arrowY:s,dir:a}){const[c,u="center"]=e.split("-"),f={width:t,height:t,transform:"rotate(45deg)",position:"absolute",[Oee[c]]:r},p=-t/2;return c==="left"?{...f,...UR(u,s,n,o),right:p,borderLeftColor:"transparent",borderBottomColor:"transparent",clipPath:"polygon(100% 0, 0 0, 100% 100%)"}:c==="right"?{...f,...UR(u,s,n,o),left:p,borderRightColor:"transparent",borderTopColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 100%)"}:c==="top"?{...f,...HR(u,i,n,o,a),bottom:p,borderTopColor:"transparent",borderLeftColor:"transparent",clipPath:"polygon(0 100%, 100% 100%, 100% 0)"}:c==="bottom"?{...f,...HR(u,i,n,o,a),top:p,borderBottomColor:"transparent",borderRightColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 0)"}:{}}const UO=w.forwardRef(({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,visible:i,arrowX:s,arrowY:a,style:c,...u},f)=>{const{dir:p}=gc();return i?h.jsx("div",{...u,ref:f,style:{...c,...jee({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,dir:p,arrowX:s,arrowY:a})}}):null});UO.displayName="@mantine/core/FloatingArrow";var m8={root:"m_9814e45f"};const Aee={zIndex:ts("modal")},Tee=(e,{gradient:t,color:n,backgroundOpacity:r,blur:o,radius:i,zIndex:s})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&gs(n||"#000",r??.6)||void 0,"--overlay-filter":o?`blur(${Oe(o)})`:void 0,"--overlay-radius":i===void 0?void 0:Qn(i),"--overlay-z-index":s?.toString()}}),Mx=mc((e,t)=>{const n=Pe("Overlay",Aee,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,fixed:u,center:f,children:p,radius:g,zIndex:y,gradient:v,blur:x,color:S,backgroundOpacity:E,mod:C,..._}=n,j=gt({name:"Overlay",props:n,classes:m8,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Tee});return h.jsx(Fe,{ref:t,...j("root"),mod:[{center:f,fixed:u},C],..._,children:p})});Mx.classes=m8;Mx.displayName="@mantine/core/Overlay";function i2(e){const t=document.createElement("div");return t.setAttribute("data-portal","true"),typeof e.className=="string"&&t.classList.add(...e.className.split(" ").filter(Boolean)),typeof e.style=="object"&&Object.assign(t.style,e.style),typeof e.id=="string"&&t.setAttribute("id",e.id),t}function $ee({target:e,reuseTargetNode:t,...n}){if(e)return typeof e=="string"?document.querySelector(e)||i2(n):e;if(t){const r=document.querySelector("[data-mantine-shared-portal-node]");if(r)return r;const o=i2(n);return o.setAttribute("data-mantine-shared-portal-node","true"),document.body.appendChild(o),o}return i2(n)}const Ree={},g8=Ue((e,t)=>{const{children:n,target:r,reuseTargetNode:o,...i}=Pe("Portal",Ree,e),[s,a]=w.useState(!1),c=w.useRef(null);return rh(()=>(a(!0),c.current=$ee({target:r,reuseTargetNode:o,...i}),iv(t,c.current),!r&&!o&&c.current&&document.body.appendChild(c.current),()=>{!r&&!o&&c.current&&document.body.removeChild(c.current)}),[r]),!s||!c.current?null:Tg.createPortal(h.jsx(h.Fragment,{children:n}),c.current)});g8.displayName="@mantine/core/Portal";const Fu=Ue(({withinPortal:e=!0,children:t,...n},r)=>C9()==="test"||!e?h.jsx(h.Fragment,{children:t}):h.jsx(g8,{ref:r,...n,children:t}));Fu.displayName="@mantine/core/OptionalPortal";const Rp=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${e==="bottom"?10:-10}px)`},transitionProperty:"transform, opacity"}),H0={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},"fade-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(30px)"},transitionProperty:"opacity, transform"},"fade-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-30px)"},transitionProperty:"opacity, transform"},"fade-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(30px)"},transitionProperty:"opacity, transform"},"fade-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-30px)"},transitionProperty:"opacity, transform"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(-20px) skew(-10deg, -5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(20px) skew(-10deg, -5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(-5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:{...Rp("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...Rp("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...Rp("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...Rp("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...Rp("top"),common:{transformOrigin:"top right"}}},qR={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function kee({transition:e,state:t,duration:n,timingFunction:r}){const o={WebkitBackfaceVisibility:"hidden",willChange:"transform, opacity",transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in H0?{transitionProperty:H0[e].transitionProperty,...o,...H0[e].common,...H0[e][qR[t]]}:{}:{transitionProperty:e.transitionProperty,...o,...e.common,...e[qR[t]]}}function Mee({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:i,onEntered:s,onExited:a,enterDelay:c,exitDelay:u}){const f=zo(),p=yO(),g=f.respectReducedMotion?p:!1,[y,v]=w.useState(g?0:e),[x,S]=w.useState(r?"entered":"exited"),E=w.useRef(-1),C=w.useRef(-1),_=w.useRef(-1);function j(){window.clearTimeout(E.current),window.clearTimeout(C.current),cancelAnimationFrame(_.current)}const A=k=>{j();const R=k?o:i,V=k?s:a,H=g?0:k?e:t;v(H),H===0?(typeof R=="function"&&R(),typeof V=="function"&&V(),S(k?"entered":"exited")):_.current=requestAnimationFrame(()=>{sf.flushSync(()=>{S(k?"pre-entering":"pre-exiting")}),_.current=requestAnimationFrame(()=>{typeof R=="function"&&R(),S(k?"entering":"exiting"),E.current=window.setTimeout(()=>{typeof V=="function"&&V(),S(k?"entered":"exited")},H)})})},T=k=>{if(j(),typeof(k?c:u)!="number"){A(k);return}C.current=window.setTimeout(()=>{A(k)},k?c:u)};return _a(()=>{T(r)},[r]),w.useEffect(()=>()=>{j()},[]),{transitionDuration:y,transitionStatus:x,transitionTimingFunction:n||"ease"}}function yc({keepMounted:e,transition:t="fade",duration:n=250,exitDuration:r=n,mounted:o,children:i,timingFunction:s="ease",onExit:a,onEntered:c,onEnter:u,onExited:f,enterDelay:p,exitDelay:g}){const y=C9(),{transitionDuration:v,transitionStatus:x,transitionTimingFunction:S}=Mee({mounted:o,exitDuration:r,duration:n,timingFunction:s,onExit:a,onEntered:c,onEnter:u,onExited:f,enterDelay:p,exitDelay:g});return v===0||y==="test"?o?h.jsx(h.Fragment,{children:i({})}):e?i({display:"none"}):null:x==="exited"?e?i({display:"none"}):null:h.jsx(h.Fragment,{children:i(kee({transition:t,duration:v,state:x,timingFunction:S}))})}yc.displayName="@mantine/core/Transition";const[Pee,y8]=Pa("Popover component was not found in the tree");function Px({children:e,active:t=!0,refProp:n="ref",innerRef:r}){const o=_x(t),i=jn(o,r);return fc(e)?w.cloneElement(e,{[n]:i}):e}function b8(e){return h.jsx(BO,{tabIndex:-1,"data-autofocus":!0,...e})}Px.displayName="@mantine/core/FocusTrap";b8.displayName="@mantine/core/FocusTrapInitialFocus";Px.InitialFocus=b8;var v8={dropdown:"m_38a85659",arrow:"m_a31dc6c1",overlay:"m_3d7bc908"};const Dee={},HO=Ue((e,t)=>{const n=Pe("PopoverDropdown",Dee,e),{className:r,style:o,vars:i,children:s,onKeyDownCapture:a,variant:c,classNames:u,styles:f,...p}=n,g=y8(),y=y9({opened:g.opened,shouldReturnFocus:g.returnFocus}),v=g.withRoles?{"aria-labelledby":g.getTargetId(),id:g.getDropdownId(),role:"dialog",tabIndex:-1}:{},x=jn(t,g.floating);return g.disabled?null:h.jsx(Fu,{...g.portalProps,withinPortal:g.withinPortal,children:h.jsx(yc,{mounted:g.opened,...g.transitionProps,transition:g.transitionProps?.transition||"fade",duration:g.transitionProps?.duration??150,keepMounted:g.keepMounted,exitDuration:typeof g.transitionProps?.exitDuration=="number"?g.transitionProps.exitDuration:g.transitionProps?.duration,children:S=>h.jsx(Px,{active:g.trapFocus&&g.opened,innerRef:x,children:h.jsxs(Fe,{...v,...p,variant:c,onKeyDownCapture:XK(()=>{g.onClose?.(),g.onDismiss?.()},{active:g.closeOnEscape,onTrigger:y,onKeyDown:a}),"data-position":g.placement,"data-fixed":g.floatingStrategy==="fixed"||void 0,...g.getStyles("dropdown",{className:r,props:n,classNames:u,styles:f,style:[{...S,zIndex:g.zIndex,top:g.y??0,left:g.x??0,width:g.width==="target"?void 0:Oe(g.width)},g.resolvedStyles.dropdown,f?.dropdown,o]}),children:[s,h.jsx(UO,{ref:g.arrowRef,arrowX:g.arrowX,arrowY:g.arrowY,visible:g.withArrow,position:g.placement,arrowSize:g.arrowSize,arrowRadius:g.arrowRadius,arrowOffset:g.arrowOffset,arrowPosition:g.arrowPosition,...g.getStyles("arrow",{props:n,classNames:u,styles:f})})]})})})})});HO.classes=v8;HO.displayName="@mantine/core/PopoverDropdown";const Iee={refProp:"ref",popupType:"dialog"},x8=Ue((e,t)=>{const{children:n,refProp:r,popupType:o,...i}=Pe("PopoverTarget",Iee,e);if(!fc(n))throw new Error("Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const s=i,a=y8(),c=jn(a.reference,Cx(n),t),u=a.withRoles?{"aria-haspopup":o,"aria-expanded":a.opened,"aria-controls":a.getDropdownId(),id:a.getTargetId()}:{};return w.cloneElement(n,{...s,...u,...a.targetProps,className:pn(a.targetProps.className,s.className,n.props.className),[r]:c,...a.controlled?null:{onClick:a.onToggle}})});x8.displayName="@mantine/core/PopoverTarget";function w8({opened:e,floating:t,position:n,positionDependencies:r}){const[o,i]=w.useState(0);w.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current&&e)return MZ(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),_a(()=>{t.update()},r),_a(()=>{i(s=>s+1)},[e])}function Lee(e){if(e===void 0)return{shift:!0,flip:!0};const t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Fee(e,t){const n=Lee(e.middlewares),r=[J9(e.offset)];return n.shift&&r.push(kO(typeof n.shift=="boolean"?{limiter:PR(),padding:5}:{limiter:PR(),padding:5,...n.shift})),n.flip&&r.push(typeof n.flip=="boolean"?uv():uv(n.flip)),n.inline&&r.push(typeof n.inline=="boolean"?am():am(n.inline)),r.push(Y9({element:e.arrowRef,padding:e.arrowOffset})),(n.size||e.width==="target")&&r.push(HZ({...typeof n.size=="boolean"?{}:n.size,apply({rects:o,availableWidth:i,availableHeight:s,...a}){const u=t().refs.floating.current?.style??{};n.size&&(typeof n.size=="object"&&n.size.apply?n.size.apply({rects:o,availableWidth:i,availableHeight:s,...a}):Object.assign(u,{maxWidth:`${i}px`,maxHeight:`${s}px`})),e.width==="target"&&Object.assign(u,{width:`${o.reference.width}px`})}})),r}function zee(e){const[t,n]=ho({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=w.useRef(t),o=()=>{t&&!e.disabled&&n(!1)},i=()=>!e.disabled&&n(!t),s=IO({strategy:e.strategy,placement:e.position,middleware:Fee(e,()=>s)});return w8({opened:t,position:e.position,positionDependencies:e.positionDependencies||[],floating:s}),_a(()=>{e.onPositionChange?.(s.placement)},[s.placement]),_a(()=>{t!==r.current&&(t?e.onOpen?.():e.onClose?.()),r.current=t},[t,e.onClose,e.onOpen]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:o,onToggle:i}}const Bee={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:ts("popover"),__staticSelector:"Popover",width:"max-content"},Vee=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:Qn(t),"--popover-shadow":gO(n)}});function co(e){const t=Pe("Popover",Bee,e),{children:n,position:r,offset:o,onPositionChange:i,positionDependencies:s,opened:a,transitionProps:c,onExitTransitionEnd:u,onEnterTransitionEnd:f,width:p,middlewares:g,withArrow:y,arrowSize:v,arrowOffset:x,arrowRadius:S,arrowPosition:E,unstyled:C,classNames:_,styles:j,closeOnClickOutside:A,withinPortal:T,portalProps:k,closeOnEscape:R,clickOutsideEvents:V,trapFocus:H,onClose:F,onDismiss:B,onOpen:U,onChange:M,zIndex:z,radius:$,shadow:L,id:P,defaultOpened:q,__staticSelector:Y,withRoles:D,disabled:W,returnFocus:K,variant:Q,keepMounted:ie,vars:pe,floatingStrategy:ue,withOverlay:se,overlayProps:me,...xe}=t,je=gt({name:Y,props:t,classes:v8,classNames:_,styles:j,unstyled:C,rootSelector:"dropdown",vars:pe,varsResolver:Vee}),{resolvedStyles:_e}=ih({classNames:_,styles:j,props:t}),Ee=w.useRef(null),[Re,Me]=w.useState(null),[ze,ve]=w.useState(null),{dir:Ce}=gc(),Ae=gi(P),G=zee({middlewares:g,width:p,position:p8(Ce,r),offset:typeof o=="number"?o+(y?v/2:0):o,arrowRef:Ee,arrowOffset:x,onPositionChange:i,positionDependencies:s,opened:a,defaultOpened:q,onChange:M,onOpen:U,onClose:F,onDismiss:B,strategy:ue,disabled:W});jg(()=>{A&&(G.onClose(),B?.())},V,[Re,ze]);const re=w.useCallback(Z=>{Me(Z),G.floating.refs.setReference(Z)},[G.floating.refs.setReference]),ne=w.useCallback(Z=>{ve(Z),G.floating.refs.setFloating(Z)},[G.floating.refs.setFloating]),ce=w.useCallback(()=>{c?.onExited?.(),u?.()},[c?.onExited,u]),te=w.useCallback(()=>{c?.onEntered?.(),f?.()},[c?.onEntered,f]);return h.jsxs(Pee,{value:{returnFocus:K,disabled:W,controlled:G.controlled,reference:re,floating:ne,x:G.floating.x,y:G.floating.y,arrowX:G.floating?.middlewareData?.arrow?.x,arrowY:G.floating?.middlewareData?.arrow?.y,opened:G.opened,arrowRef:Ee,transitionProps:{...c,onExited:ce,onEntered:te},width:p,withArrow:y,arrowSize:v,arrowOffset:x,arrowRadius:S,arrowPosition:E,placement:G.floating.placement,trapFocus:H,withinPortal:T,portalProps:k,zIndex:z,radius:$,shadow:L,closeOnEscape:R,onDismiss:B,onClose:G.onClose,onToggle:G.onToggle,getTargetId:()=>`${Ae}-target`,getDropdownId:()=>`${Ae}-dropdown`,withRoles:D,targetProps:xe,__staticSelector:Y,classNames:_,styles:j,unstyled:C,variant:Q,keepMounted:ie,getStyles:je,resolvedStyles:_e,floatingStrategy:ue},children:[n,se&&h.jsx(yc,{transition:"fade",mounted:G.opened,duration:c?.duration||250,exitDuration:c?.exitDuration||250,children:Z=>h.jsx(Fu,{withinPortal:T,children:h.jsx(Mx,{...me,...je("overlay",{className:me?.className,style:[Z,me?.style]})})})})]})}co.Target=x8;co.Dropdown=HO;co.displayName="@mantine/core/Popover";co.extend=e=>e;var zi={root:"m_5ae2e3c",barsLoader:"m_7a2bd4cd",bar:"m_870bb79","bars-loader-animation":"m_5d2b3b9d",dotsLoader:"m_4e3f22d7",dot:"m_870c4af","loader-dots-animation":"m_aac34a1",ovalLoader:"m_b34414df","oval-loader-animation":"m_f8e89c4b"};const S8=w.forwardRef(({className:e,...t},n)=>h.jsxs(Fe,{component:"span",className:pn(zi.barsLoader,e),...t,ref:n,children:[h.jsx("span",{className:zi.bar}),h.jsx("span",{className:zi.bar}),h.jsx("span",{className:zi.bar})]}));S8.displayName="@mantine/core/Bars";const E8=w.forwardRef(({className:e,...t},n)=>h.jsxs(Fe,{component:"span",className:pn(zi.dotsLoader,e),...t,ref:n,children:[h.jsx("span",{className:zi.dot}),h.jsx("span",{className:zi.dot}),h.jsx("span",{className:zi.dot})]}));E8.displayName="@mantine/core/Dots";const N8=w.forwardRef(({className:e,...t},n)=>h.jsx(Fe,{component:"span",className:pn(zi.ovalLoader,e),...t,ref:n}));N8.displayName="@mantine/core/Oval";const _8={bars:S8,oval:N8,dots:E8},Uee={loaders:_8,type:"oval"},Hee=(e,{size:t,color:n})=>({root:{"--loader-size":jt(t,"loader-size"),"--loader-color":n?Sr(n,e):void 0}}),Rg=Ue((e,t)=>{const n=Pe("Loader",Uee,e),{size:r,color:o,type:i,vars:s,className:a,style:c,classNames:u,styles:f,unstyled:p,loaders:g,variant:y,children:v,...x}=n,S=gt({name:"Loader",props:n,classes:zi,className:a,style:c,classNames:u,styles:f,unstyled:p,vars:s,varsResolver:Hee});return v?h.jsx(Fe,{...S("root"),ref:t,...x,children:v}):h.jsx(Fe,{...S("root"),ref:t,component:g[i],variant:y,size:r,...x})});Rg.defaultLoaders=_8;Rg.classes=zi;Rg.displayName="@mantine/core/Loader";const C8=w.forwardRef(({size:e="var(--cb-icon-size, 70%)",style:t,...n},r)=>h.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:e,height:e},ref:r,...n,children:h.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}));C8.displayName="@mantine/core/CloseIcon";var O8={root:"m_86a44da5","root--subtle":"m_220c80f2"};const qee={variant:"subtle"},Wee=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":jt(t,"cb-size"),"--cb-radius":n===void 0?void 0:Qn(n),"--cb-icon-size":Oe(r)}}),uh=mc((e,t)=>{const n=Pe("CloseButton",qee,e),{iconSize:r,children:o,vars:i,radius:s,className:a,classNames:c,style:u,styles:f,unstyled:p,"data-disabled":g,disabled:y,variant:v,icon:x,mod:S,__staticSelector:E,...C}=n,_=gt({name:E||"CloseButton",props:n,className:a,style:u,classes:O8,classNames:c,styles:f,unstyled:p,vars:i,varsResolver:Wee});return h.jsxs(Aa,{ref:t,...C,unstyled:p,variant:v,disabled:y,mod:[{disabled:y||g},S],..._("root",{variant:v,active:!y&&!g}),children:[x||h.jsx(C8,{}),o]})});uh.classes=O8;uh.displayName="@mantine/core/CloseButton";function Gee(e){return w.Children.toArray(e).filter(Boolean)}var j8={root:"m_4081bf90"};const Jee={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},Yee=(e,{grow:t,preventGrowOverflow:n,gap:r,align:o,justify:i,wrap:s},{childWidth:a})=>({root:{"--group-child-width":t&&n?a:void 0,"--group-gap":mO(r),"--group-align":o,"--group-justify":i,"--group-wrap":s}}),qO=Ue((e,t)=>{const n=Pe("Group",Jee,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,children:c,gap:u,align:f,justify:p,wrap:g,grow:y,preventGrowOverflow:v,vars:x,variant:S,__size:E,mod:C,..._}=n,j=Gee(c),A=j.length,T=mO(u??"md"),R={childWidth:`calc(${100/A}% - (${T} - ${T} / ${A}))`},V=gt({name:"Group",props:n,stylesCtx:R,className:o,style:i,classes:j8,classNames:r,styles:s,unstyled:a,vars:x,varsResolver:Yee});return h.jsx(Fe,{...V("root"),ref:t,variant:S,mod:[{grow:y},C],size:E,..._,children:j})});qO.classes=j8;qO.displayName="@mantine/core/Group";const[Kee,Da]=Pa("ModalBase component was not found in tree");function Xee({opened:e,transitionDuration:t}){const[n,r]=w.useState(e),o=w.useRef(-1),s=yO()?0:t;return w.useEffect(()=>(e?(r(!0),window.clearTimeout(o.current)):s===0?r(!1):o.current=window.setTimeout(()=>r(!1),s),()=>window.clearTimeout(o.current)),[e,s]),n}function Qee({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:o,onClose:i,returnFocus:s}){const a=gi(e),[c,u]=w.useState(!1),[f,p]=w.useState(!1),g=typeof t?.duration=="number"?t?.duration:200,y=Xee({opened:n,transitionDuration:g});return ZN("keydown",v=>{v.key==="Escape"&&o&&!v.isComposing&&n&&v.target?.getAttribute("data-mantine-stop-propagation")!=="true"&&i()},{capture:!0}),y9({opened:n,shouldReturnFocus:r&&s}),{_id:a,titleMounted:c,bodyMounted:f,shouldLockScroll:y,setTitleMounted:u,setBodyMounted:p}}const A8=w.forwardRef(({keepMounted:e,opened:t,onClose:n,id:r,transitionProps:o,onExitTransitionEnd:i,onEnterTransitionEnd:s,trapFocus:a,closeOnEscape:c,returnFocus:u,closeOnClickOutside:f,withinPortal:p,portalProps:g,lockScroll:y,children:v,zIndex:x,shadow:S,padding:E,__vars:C,unstyled:_,removeScrollProps:j,...A},T)=>{const{_id:k,titleMounted:R,bodyMounted:V,shouldLockScroll:H,setTitleMounted:F,setBodyMounted:B}=Qee({id:r,transitionProps:o,opened:t,trapFocus:a,closeOnEscape:c,onClose:n,returnFocus:u}),{key:U,...M}=j||{};return h.jsx(Fu,{...g,withinPortal:p,children:h.jsx(Kee,{value:{opened:t,onClose:n,closeOnClickOutside:f,onExitTransitionEnd:i,onEnterTransitionEnd:s,transitionProps:{...o,keepMounted:e},getTitleId:()=>`${k}-title`,getBodyId:()=>`${k}-body`,titleMounted:R,bodyMounted:V,setTitleMounted:F,setBodyMounted:B,trapFocus:a,closeOnEscape:c,zIndex:x,unstyled:_},children:h.jsx(rv,{enabled:H&&y,...M,children:h.jsx(Fe,{ref:T,...A,__vars:{...C,"--mb-z-index":(x||ts("modal")).toString(),"--mb-shadow":gO(S),"--mb-padding":mO(E)},children:v})},U)})})});A8.displayName="@mantine/core/ModalBase";function Zee(){const e=Da();return w.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var jf={title:"m_615af6c9",header:"m_b5489c3c",inner:"m_60c222c7",content:"m_fd1ab0aa",close:"m_606cb269",body:"m_5df29311"};const T8=w.forwardRef(({className:e,...t},n)=>{const r=Zee(),o=Da();return h.jsx(Fe,{ref:n,...t,id:r,className:pn({[jf.body]:!o.unstyled},e)})});T8.displayName="@mantine/core/ModalBaseBody";const $8=w.forwardRef(({className:e,onClick:t,...n},r)=>{const o=Da();return h.jsx(uh,{ref:r,...n,onClick:i=>{o.onClose(),t?.(i)},className:pn({[jf.close]:!o.unstyled},e),unstyled:o.unstyled})});$8.displayName="@mantine/core/ModalBaseCloseButton";const R8=w.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:o,...i},s)=>{const a=Da();return h.jsx(yc,{mounted:a.opened,transition:"pop",...a.transitionProps,onExited:()=>{a.onExitTransitionEnd?.(),a.transitionProps?.onExited?.()},onEntered:()=>{a.onEnterTransitionEnd?.(),a.transitionProps?.onEntered?.()},...e,children:c=>h.jsx("div",{...n,className:pn({[jf.inner]:!a.unstyled},n.className),children:h.jsx(Px,{active:a.opened&&a.trapFocus,innerRef:s,children:h.jsx(VO,{...i,component:"section",role:"dialog",tabIndex:-1,"aria-modal":!0,"aria-describedby":a.bodyMounted?a.getBodyId():void 0,"aria-labelledby":a.titleMounted?a.getTitleId():void 0,style:[o,c],className:pn({[jf.content]:!a.unstyled},t),unstyled:a.unstyled,children:i.children})})})})});R8.displayName="@mantine/core/ModalBaseContent";const k8=w.forwardRef(({className:e,...t},n)=>{const r=Da();return h.jsx(Fe,{component:"header",ref:n,className:pn({[jf.header]:!r.unstyled},e),...t})});k8.displayName="@mantine/core/ModalBaseHeader";const ete={duration:200,timingFunction:"ease",transition:"fade"};function tte(e){const t=Da();return{...ete,...t.transitionProps,...e}}const M8=w.forwardRef(({onClick:e,transitionProps:t,style:n,visible:r,...o},i)=>{const s=Da(),a=tte(t);return h.jsx(yc,{mounted:r!==void 0?r:s.opened,...a,transition:"fade",children:c=>h.jsx(Mx,{ref:i,fixed:!0,style:[n,c],zIndex:s.zIndex,unstyled:s.unstyled,onClick:u=>{e?.(u),s.closeOnClickOutside&&s.onClose()},...o})})});M8.displayName="@mantine/core/ModalBaseOverlay";function nte(){const e=Da();return w.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const P8=w.forwardRef(({className:e,...t},n)=>{const r=nte(),o=Da();return h.jsx(Fe,{component:"h2",ref:n,className:pn({[jf.title]:!o.unstyled},e),...t,id:r})});P8.displayName="@mantine/core/ModalBaseTitle";function rte({children:e}){return h.jsx(h.Fragment,{children:e})}const[ote,ite]=Lu({size:"sm"}),ste={},D8=Ue((e,t)=>{const n=Pe("InputClearButton",ste,e),{size:r,variant:o,vars:i,classNames:s,styles:a,...c}=n,u=ite(),{resolvedClassNames:f,resolvedStyles:p}=ih({classNames:s,styles:a,props:n});return h.jsx(uh,{variant:o||"transparent",ref:t,size:r||u?.size||"sm",classNames:f,styles:p,__staticSelector:"InputClearButton",...c})});D8.displayName="@mantine/core/InputClearButton";const[ate,dh]=Lu({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0});var bi={wrapper:"m_6c018570",input:"m_8fb7ebe7",section:"m_82577fc2",placeholder:"m_88bacfd0",root:"m_46b77525",label:"m_8fdc1311",required:"m_78a94662",error:"m_8f816625",description:"m_fe47ce59"};const WR={},lte=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${zr(t)} - ${Oe(2)})`}}),Dx=Ue((e,t)=>{const n=Pe("InputDescription",WR,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,size:u,__staticSelector:f,__inheritStyles:p=!0,variant:g,...y}=Pe("InputDescription",WR,n),v=dh(),x=gt({name:["InputWrapper",f],props:n,classes:bi,className:o,style:i,classNames:r,styles:s,unstyled:a,rootSelector:"description",vars:c,varsResolver:lte}),S=p&&v?.getStyles||x;return h.jsx(Fe,{component:"p",ref:t,variant:g,size:u,...S("description",v?.getStyles?{className:o,style:i}:void 0),...y})});Dx.classes=bi;Dx.displayName="@mantine/core/InputDescription";const cte={},ute=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${zr(t)} - ${Oe(2)})`}}),Ix=Ue((e,t)=>{const n=Pe("InputError",cte,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,size:u,__staticSelector:f,__inheritStyles:p=!0,variant:g,...y}=n,v=gt({name:["InputWrapper",f],props:n,classes:bi,className:o,style:i,classNames:r,styles:s,unstyled:a,rootSelector:"error",vars:c,varsResolver:ute}),x=dh(),S=p&&x?.getStyles||v;return h.jsx(Fe,{component:"p",ref:t,variant:g,size:u,...S("error",x?.getStyles?{className:o,style:i}:void 0),...y})});Ix.classes=bi;Ix.displayName="@mantine/core/InputError";const GR={labelElement:"label"},dte=(e,{size:t})=>({label:{"--input-label-size":zr(t),"--input-asterisk-color":void 0}}),Lx=Ue((e,t)=>{const n=Pe("InputLabel",GR,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,labelElement:u,size:f,required:p,htmlFor:g,onMouseDown:y,children:v,__staticSelector:x,variant:S,mod:E,...C}=Pe("InputLabel",GR,n),_=gt({name:["InputWrapper",x],props:n,classes:bi,className:o,style:i,classNames:r,styles:s,unstyled:a,rootSelector:"label",vars:c,varsResolver:dte}),j=dh(),A=j?.getStyles||_;return h.jsxs(Fe,{...A("label",j?.getStyles?{className:o,style:i}:void 0),component:u,variant:S,size:f,ref:t,htmlFor:u==="label"?g:void 0,mod:[{required:p},E],onMouseDown:T=>{y?.(T),!T.defaultPrevented&&T.detail>1&&T.preventDefault()},...C,children:[v,p&&h.jsx("span",{...A("required"),"aria-hidden":!0,children:" *"})]})});Lx.classes=bi;Lx.displayName="@mantine/core/InputLabel";const JR={},WO=Ue((e,t)=>{const n=Pe("InputPlaceholder",JR,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,__staticSelector:u,variant:f,error:p,mod:g,...y}=Pe("InputPlaceholder",JR,n),v=gt({name:["InputPlaceholder",u],props:n,classes:bi,className:o,style:i,classNames:r,styles:s,unstyled:a,rootSelector:"placeholder"});return h.jsx(Fe,{...v("placeholder"),mod:[{error:!!p},g],component:"span",variant:f,ref:t,...y})});WO.classes=bi;WO.displayName="@mantine/core/InputPlaceholder";function fte(e,{hasDescription:t,hasError:n}){const r=e.findIndex(c=>c==="input"),o=e.slice(0,r),i=e.slice(r+1),s=t&&o.includes("description")||n&&o.includes("error");return{offsetBottom:t&&i.includes("description")||n&&i.includes("error"),offsetTop:s}}const hte={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},pte=(e,{size:t})=>({label:{"--input-label-size":zr(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${zr(t)} - ${Oe(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${zr(t)} - ${Oe(2)})`}}),GO=Ue((e,t)=>{const n=Pe("InputWrapper",hte,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,size:u,variant:f,__staticSelector:p,inputContainer:g,inputWrapperOrder:y,label:v,error:x,description:S,labelProps:E,descriptionProps:C,errorProps:_,labelElement:j,children:A,withAsterisk:T,id:k,required:R,__stylesApiProps:V,mod:H,...F}=n,B=gt({name:["InputWrapper",p],props:V||n,classes:bi,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:pte}),U={size:u,variant:f,__staticSelector:p},M=gi(k),z=typeof T=="boolean"?T:R,$=_?.id||`${M}-error`,L=C?.id||`${M}-description`,P=M,q=!!x&&typeof x!="boolean",Y=!!S,D=`${q?$:""} ${Y?L:""}`,W=D.trim().length>0?D.trim():void 0,K=E?.id||`${M}-label`,Q=v&&h.jsx(Lx,{labelElement:j,id:K,htmlFor:P,required:z,...U,...E,children:v},"label"),ie=Y&&h.jsx(Dx,{...C,...U,size:C?.size||U.size,id:C?.id||L,children:S},"description"),pe=h.jsx(w.Fragment,{children:g(A)},"input"),ue=q&&w.createElement(Ix,{..._,...U,size:_?.size||U.size,key:"error",id:_?.id||$},x),se=y.map(me=>{switch(me){case"label":return Q;case"input":return pe;case"description":return ie;case"error":return ue;default:return null}});return h.jsx(ate,{value:{getStyles:B,describedBy:W,inputId:P,labelId:K,...fte(y,{hasDescription:Y,hasError:q})},children:h.jsx(Fe,{ref:t,variant:f,size:u,mod:[{error:!!x},H],...B("root"),...F,children:se})})});GO.classes=bi;GO.displayName="@mantine/core/InputWrapper";const mte={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0},gte=(e,t,n)=>({wrapper:{"--input-margin-top":n.offsetTop?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-margin-bottom":n.offsetBottom?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-height":jt(t.size,"input-height"),"--input-fz":zr(t.size),"--input-radius":t.radius===void 0?void 0:Qn(t.radius),"--input-left-section-width":t.leftSectionWidth!==void 0?Oe(t.leftSectionWidth):void 0,"--input-right-section-width":t.rightSectionWidth!==void 0?Oe(t.rightSectionWidth):void 0,"--input-padding-y":t.multiline?jt(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),Lt=mc((e,t)=>{const n=Pe("Input",mte,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,required:c,__staticSelector:u,__stylesApiProps:f,size:p,wrapperProps:g,error:y,disabled:v,leftSection:x,leftSectionProps:S,leftSectionWidth:E,rightSection:C,rightSectionProps:_,rightSectionWidth:j,rightSectionPointerEvents:A,leftSectionPointerEvents:T,variant:k,vars:R,pointer:V,multiline:H,radius:F,id:B,withAria:U,withErrorStyles:M,mod:z,inputSize:$,__clearSection:L,__clearable:P,__defaultRightSection:q,...Y}=n,{styleProps:D,rest:W}=sh(Y),K=dh(),Q={offsetBottom:K?.offsetBottom,offsetTop:K?.offsetTop},ie=gt({name:["Input",u],props:f||n,classes:bi,className:o,style:i,classNames:r,styles:s,unstyled:a,stylesCtx:Q,rootSelector:"wrapper",vars:R,varsResolver:gte}),pe=U?{required:c,disabled:v,"aria-invalid":!!y,"aria-describedby":K?.describedBy,id:K?.inputId||B}:{},ue=C||P&&L||q;return h.jsx(ote,{value:{size:p||"sm"},children:h.jsxs(Fe,{...ie("wrapper"),...D,...g,mod:[{error:!!y&&M,pointer:V,disabled:v,multiline:H,"data-with-right-section":!!ue,"data-with-left-section":!!x},z],variant:k,size:p,children:[x&&h.jsx("div",{...S,"data-position":"left",...ie("section",{className:S?.className,style:S?.style}),children:x}),h.jsx(Fe,{component:"input",...W,...pe,ref:t,required:c,mod:{disabled:v,error:!!y&&M},variant:k,__size:$,...ie("input")}),ue&&h.jsx("div",{..._,"data-position":"right",...ie("section",{className:_?.className,style:_?.style}),children:ue})]})})});Lt.classes=bi;Lt.Wrapper=GO;Lt.Label=Lx;Lt.Error=Ix;Lt.Description=Dx;Lt.Placeholder=WO;Lt.ClearButton=D8;Lt.displayName="@mantine/core/Input";function yte(e,t,n){const r=Pe(e,t,n),{label:o,description:i,error:s,required:a,classNames:c,styles:u,className:f,unstyled:p,__staticSelector:g,__stylesApiProps:y,errorProps:v,labelProps:x,descriptionProps:S,wrapperProps:E,id:C,size:_,style:j,inputContainer:A,inputWrapperOrder:T,withAsterisk:k,variant:R,vars:V,mod:H,...F}=r,{styleProps:B,rest:U}=sh(F),M={label:o,description:i,error:s,required:a,classNames:c,className:f,__staticSelector:g,__stylesApiProps:y||r,errorProps:v,labelProps:x,descriptionProps:S,unstyled:p,styles:u,size:_,style:j,inputContainer:A,inputWrapperOrder:T,withAsterisk:k,variant:R,id:C,mod:H,...E};return{...U,classNames:c,styles:u,unstyled:p,wrapperProps:{...M,...B},inputProps:{required:a,classNames:c,styles:u,unstyled:p,size:_,__staticSelector:g,__stylesApiProps:y||r,error:s,variant:R,id:C}}}const bte={__staticSelector:"InputBase",withAria:!0},vi=mc((e,t)=>{const{inputProps:n,wrapperProps:r,...o}=yte("InputBase",bte,e);return h.jsx(Lt.Wrapper,{...r,children:h.jsx(Lt,{...n,...o,ref:t})})});vi.classes={...Lt.classes,...Lt.Wrapper.classes};vi.displayName="@mantine/core/InputBase";function vte(e,t){if(!t||!e)return!1;let n=t.parentNode;for(;n!=null;){if(n===e)return!0;n=n.parentNode}return!1}function xte({target:e,parent:t,ref:n,displayAfterTransitionEnd:r}){const o=w.useRef(-1),[i,s]=w.useState(!1),[a,c]=w.useState(typeof r=="boolean"?r:!1),u=()=>{if(!e||!t||!n.current)return;const y=e.getBoundingClientRect(),v=t.getBoundingClientRect(),x=window.getComputedStyle(e),S=window.getComputedStyle(t),E=Ul(x.borderTopWidth)+Ul(S.borderTopWidth),C=Ul(x.borderLeftWidth)+Ul(S.borderLeftWidth),_={top:y.top-v.top-E,left:y.left-v.left-C,width:y.width,height:y.height};n.current.style.transform=`translateY(${_.top}px) translateX(${_.left}px)`,n.current.style.width=`${_.width}px`,n.current.style.height=`${_.height}px`},f=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration="0ms"),u(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration="")},30)},p=w.useRef(null),g=w.useRef(null);return w.useEffect(()=>{if(u(),e)return p.current=new ResizeObserver(f),p.current.observe(e),t&&(g.current=new ResizeObserver(f),g.current.observe(t)),()=>{p.current?.disconnect(),g.current?.disconnect()}},[t,e]),w.useEffect(()=>{if(t){const y=v=>{vte(v.target,t)&&(f(),c(!1))};return t.addEventListener("transitionend",y),()=>{t.removeEventListener("transitionend",y)}}},[t]),_X(()=>{E9()!=="test"&&s(!0)},20,{autoInvoke:!0}),jX(y=>{y.forEach(v=>{v.type==="attributes"&&v.attributeName==="dir"&&f()})},{attributes:!0,attributeFilter:["dir"]},()=>document.documentElement),{initialized:i,hidden:a}}var I8={root:"m_96b553a6"};const wte={},Ste=(e,{transitionDuration:t})=>({root:{"--transition-duration":typeof t=="number"?`${t}ms`:t}}),JO=Ue((e,t)=>{const n=Pe("FloatingIndicator",wte,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,target:u,parent:f,transitionDuration:p,mod:g,displayAfterTransitionEnd:y,...v}=n,x=gt({name:"FloatingIndicator",classes:I8,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Ste}),S=w.useRef(null),{initialized:E,hidden:C}=xte({target:u,parent:f,ref:S,displayAfterTransitionEnd:y}),_=jn(t,S);return!u||!f?null:h.jsx(Fe,{ref:_,mod:[{initialized:E,hidden:C},g],...x("root"),...v})});JO.displayName="@mantine/core/FloatingIndicator";JO.classes=I8;function L8(e){return typeof e=="string"?{value:e,label:e}:"value"in e&&!("label"in e)?{value:e.value,label:e.value,disabled:e.disabled}:typeof e=="number"?{value:e.toString(),label:e.toString()}:"group"in e?{group:e.group,items:e.items.map(t=>L8(t))}:e}function F8(e){return e?e.map(t=>L8(t)):[]}function YO(e){return e.reduce((t,n)=>"group"in n?{...t,...YO(n.items)}:(t[n.value]=n,t),{})}var po={dropdown:"m_88b62a41",search:"m_985517d8",options:"m_b2821a6e",option:"m_92253aa5",empty:"m_2530cd1d",header:"m_858f94bd",footer:"m_82b967cb",group:"m_254f3e4f",groupLabel:"m_2bb2e9e5",chevron:"m_2943220b",optionsDropdownOption:"m_390b5f4",optionsDropdownCheckIcon:"m_8ee53fc2"};const Ete={error:null},Nte=(e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":jt(t,"combobox-chevron-size"),"--combobox-chevron-color":n?Sr(n,e):void 0}}),KO=Ue((e,t)=>{const n=Pe("ComboboxChevron",Ete,e),{size:r,error:o,style:i,className:s,classNames:a,styles:c,unstyled:u,vars:f,mod:p,...g}=n,y=gt({name:"ComboboxChevron",classes:po,props:n,style:i,className:s,classNames:a,styles:c,unstyled:u,vars:f,varsResolver:Nte,rootSelector:"chevron"});return h.jsx(Fe,{component:"svg",...g,...y("chevron"),size:r,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:o},p],ref:t,children:h.jsx("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})});KO.classes=po;KO.displayName="@mantine/core/ComboboxChevron";const[_te,xi]=Pa("Combobox component was not found in tree"),z8=w.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...o},i)=>h.jsx(Lt.ClearButton,{ref:i,tabIndex:-1,"aria-hidden":!0,...o,onMouseDown:s=>{s.preventDefault(),t?.(s)},onClick:s=>{r(),n?.(s)}}));z8.displayName="@mantine/core/ComboboxClearButton";const Cte={},XO=Ue((e,t)=>{const{classNames:n,styles:r,className:o,style:i,hidden:s,...a}=Pe("ComboboxDropdown",Cte,e),c=xi();return h.jsx(co.Dropdown,{...a,ref:t,role:"presentation","data-hidden":s||void 0,...c.getStyles("dropdown",{className:o,style:i,classNames:n,styles:r})})});XO.classes=po;XO.displayName="@mantine/core/ComboboxDropdown";const Ote={refProp:"ref"},B8=Ue((e,t)=>{const{children:n,refProp:r}=Pe("ComboboxDropdownTarget",Ote,e);if(xi(),!fc(n))throw new Error("Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return h.jsx(co.Target,{ref:t,refProp:r,children:n})});B8.displayName="@mantine/core/ComboboxDropdownTarget";const jte={},QO=Ue((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...a}=Pe("ComboboxEmpty",jte,e),c=xi();return h.jsx(Fe,{ref:t,...c.getStyles("empty",{className:r,classNames:n,styles:i,style:o}),...a})});QO.classes=po;QO.displayName="@mantine/core/ComboboxEmpty";function ZO({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:o,autoComplete:i}){const s=xi(),[a,c]=w.useState(null),u=p=>{if(e?.(p),!s.readOnly&&t){if(p.nativeEvent.isComposing)return;if(p.nativeEvent.code==="ArrowDown"&&(p.preventDefault(),s.store.dropdownOpened?c(s.store.selectNextOption()):(s.store.openDropdown("keyboard"),c(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),p.nativeEvent.code==="ArrowUp"&&(p.preventDefault(),s.store.dropdownOpened?c(s.store.selectPreviousOption()):(s.store.openDropdown("keyboard"),c(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),p.nativeEvent.code==="Enter"||p.nativeEvent.code==="NumpadEnter"){if(p.nativeEvent.keyCode===229)return;const g=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&g!==-1?(p.preventDefault(),s.store.clickSelectedOption()):o==="button"&&(p.preventDefault(),s.store.openDropdown("keyboard"))}p.key==="Escape"&&s.store.closeDropdown("keyboard"),p.nativeEvent.code==="Space"&&o==="button"&&(p.preventDefault(),s.store.toggleDropdown("keyboard"))}};return{...n?{"aria-haspopup":"listbox","aria-expanded":r&&!!(s.store.listId&&s.store.dropdownOpened)||void 0,"aria-controls":s.store.dropdownOpened?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&a||void 0,autoComplete:i,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},onKeyDown:u}}const Ate={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},V8=Ue((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:a,autoComplete:c,...u}=Pe("ComboboxEventsTarget",Ate,e);if(!fc(n))throw new Error("Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const f=xi(),p=ZO({targetType:a,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown,autoComplete:c});return w.cloneElement(n,{...p,...u,[r]:jn(t,f.store.targetRef,Cx(n))})});V8.displayName="@mantine/core/ComboboxEventsTarget";const Tte={},ej=Ue((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...a}=Pe("ComboboxFooter",Tte,e),c=xi();return h.jsx(Fe,{ref:t,...c.getStyles("footer",{className:r,classNames:n,style:o,styles:i}),...a,onMouseDown:u=>{u.preventDefault()}})});ej.classes=po;ej.displayName="@mantine/core/ComboboxFooter";const $te={},tj=Ue((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,children:a,label:c,...u}=Pe("ComboboxGroup",$te,e),f=xi();return h.jsxs(Fe,{ref:t,...f.getStyles("group",{className:r,classNames:n,style:o,styles:i}),...u,children:[c&&h.jsx("div",{...f.getStyles("groupLabel",{classNames:n,styles:i}),children:c}),a]})});tj.classes=po;tj.displayName="@mantine/core/ComboboxGroup";const Rte={},nj=Ue((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...a}=Pe("ComboboxHeader",Rte,e),c=xi();return h.jsx(Fe,{ref:t,...c.getStyles("header",{className:r,classNames:n,style:o,styles:i}),...a,onMouseDown:u=>{u.preventDefault()}})});nj.classes=po;nj.displayName="@mantine/core/ComboboxHeader";function U8({value:e,valuesDivider:t=",",...n}){return h.jsx("input",{type:"hidden",value:Array.isArray(e)?e.join(t):e||"",...n})}U8.displayName="@mantine/core/ComboboxHiddenInput";const kte={},rj=Ue((e,t)=>{const n=Pe("ComboboxOption",kte,e),{classNames:r,className:o,style:i,styles:s,vars:a,onClick:c,id:u,active:f,onMouseDown:p,onMouseOver:g,disabled:y,selected:v,mod:x,...S}=n,E=xi(),C=w.useId(),_=u||C;return h.jsx(Fe,{...E.getStyles("option",{className:o,classNames:r,styles:s,style:i}),...S,ref:t,id:_,mod:["combobox-option",{"combobox-active":f,"combobox-disabled":y,"combobox-selected":v},x],role:"option",onClick:j=>{y?j.preventDefault():(E.onOptionSubmit?.(n.value,n),c?.(j))},onMouseDown:j=>{j.preventDefault(),p?.(j)},onMouseOver:j=>{E.resetSelectionOnOptionHover&&E.store.resetSelectedOption(),g?.(j)}})});rj.classes=po;rj.displayName="@mantine/core/ComboboxOption";const Mte={},oj=Ue((e,t)=>{const n=Pe("ComboboxOptions",Mte,e),{classNames:r,className:o,style:i,styles:s,id:a,onMouseDown:c,labelledBy:u,...f}=n,p=xi(),g=gi(a);return w.useEffect(()=>{p.store.setListId(g)},[g]),h.jsx(Fe,{ref:t,...p.getStyles("options",{className:o,style:i,classNames:r,styles:s}),...f,id:g,role:"listbox","aria-labelledby":u,onMouseDown:y=>{y.preventDefault(),c?.(y)}})});oj.classes=po;oj.displayName="@mantine/core/ComboboxOptions";const Pte={withAriaAttributes:!0,withKeyboardNavigation:!0},ij=Ue((e,t)=>{const n=Pe("ComboboxSearch",Pte,e),{classNames:r,styles:o,unstyled:i,vars:s,withAriaAttributes:a,onKeyDown:c,withKeyboardNavigation:u,size:f,...p}=n,g=xi(),y=g.getStyles("search"),v=ZO({targetType:"input",withAriaAttributes:a,withKeyboardNavigation:u,withExpandedAttribute:!1,onKeyDown:c,autoComplete:"off"});return h.jsx(Lt,{ref:jn(t,g.store.searchRef),classNames:[{input:y.className},r],styles:[{input:y.style},o],size:f||g.size,...v,...p,__staticSelector:"Combobox"})});ij.classes=po;ij.displayName="@mantine/core/ComboboxSearch";const Dte={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},H8=Ue((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:a,autoComplete:c,...u}=Pe("ComboboxTarget",Dte,e);if(!fc(n))throw new Error("Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const f=xi(),p=ZO({targetType:a,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown,autoComplete:c}),g=w.cloneElement(n,{...p,...u});return h.jsx(co.Target,{ref:jn(t,f.store.targetRef),children:g})});H8.displayName="@mantine/core/ComboboxTarget";function Ite(e,t,n){for(let r=e-1;r>=0;r-=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r;if(n){for(let r=t.length-1;r>-1;r-=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r}return e}function Lte(e,t,n){for(let r=e+1;r<t.length;r+=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r;if(n){for(let r=0;r<t.length;r+=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r}return e}function Fte(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function sj({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:o,loop:i=!0,scrollBehavior:s="instant"}={}){const[a,c]=ho({value:t,defaultValue:e,finalValue:!1,onChange:n}),u=w.useRef(null),f=w.useRef(-1),p=w.useRef(null),g=w.useRef(null),y=w.useRef(-1),v=w.useRef(-1),x=w.useRef(-1),S=w.useCallback(($="unknown")=>{a||(c(!0),o?.($))},[c,o,a]),E=w.useCallback(($="unknown")=>{a&&(c(!1),r?.($))},[c,r,a]),C=w.useCallback(($="unknown")=>{a?E($):S($)},[E,S,a]),_=w.useCallback(()=>{const $=document.querySelector(`#${u.current} [data-combobox-selected]`);$?.removeAttribute("data-combobox-selected"),$?.removeAttribute("aria-selected")},[]),j=w.useCallback($=>{const P=document.getElementById(u.current)?.querySelectorAll("[data-combobox-option]");if(!P)return null;const q=$>=P.length?0:$<0?P.length-1:$;return f.current=q,P?.[q]&&!P[q].hasAttribute("data-combobox-disabled")?(_(),P[q].setAttribute("data-combobox-selected","true"),P[q].setAttribute("aria-selected","true"),P[q].scrollIntoView({block:"nearest",behavior:s}),P[q].id):null},[s,_]),A=w.useCallback(()=>{const $=document.querySelector(`#${u.current} [data-combobox-active]`);if($){const L=document.querySelectorAll(`#${u.current} [data-combobox-option]`),P=Array.from(L).findIndex(q=>q===$);return j(P)}return j(0)},[j]),T=w.useCallback(()=>j(Lte(f.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[j,i]),k=w.useCallback(()=>j(Ite(f.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[j,i]),R=w.useCallback(()=>j(Fte(document.querySelectorAll(`#${u.current} [data-combobox-option]`))),[j]),V=w.useCallback(($="selected",L)=>{x.current=window.setTimeout(()=>{const P=document.querySelectorAll(`#${u.current} [data-combobox-option]`),q=Array.from(P).findIndex(Y=>Y.hasAttribute(`data-combobox-${$}`));f.current=q,L?.scrollIntoView&&P[q]?.scrollIntoView({block:"nearest",behavior:s})},0)},[]),H=w.useCallback(()=>{f.current=-1,_()},[_]),F=w.useCallback(()=>{document.querySelectorAll(`#${u.current} [data-combobox-option]`)?.[f.current]?.click()},[]),B=w.useCallback($=>{u.current=$},[]),U=w.useCallback(()=>{y.current=window.setTimeout(()=>p.current.focus(),0)},[]),M=w.useCallback(()=>{v.current=window.setTimeout(()=>g.current.focus(),0)},[]),z=w.useCallback(()=>f.current,[]);return w.useEffect(()=>()=>{window.clearTimeout(y.current),window.clearTimeout(v.current),window.clearTimeout(x.current)},[]),{dropdownOpened:a,openDropdown:S,closeDropdown:E,toggleDropdown:C,selectedOptionIndex:f.current,getSelectedOptionIndex:z,selectOption:j,selectFirstOption:R,selectActiveOption:A,selectNextOption:T,selectPreviousOption:k,resetSelectedOption:H,updateSelectedOptionIndex:V,listId:u.current,setListId:B,clickSelectedOption:F,searchRef:p,focusSearchInput:U,targetRef:g,focusTarget:M}}const zte={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0}},Bte=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":zr(t),"--combobox-option-padding":jt(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:Oe(n),"--combobox-option-fz":zr(t),"--combobox-option-padding":jt(t,"combobox-option-padding")}});function Ct(e){const t=Pe("Combobox",zte,e),{classNames:n,styles:r,unstyled:o,children:i,store:s,vars:a,onOptionSubmit:c,onClose:u,size:f,dropdownPadding:p,resetSelectionOnOptionHover:g,__staticSelector:y,readOnly:v,...x}=t,S=sj(),E=s||S,C=gt({name:y||"Combobox",classes:po,props:t,classNames:n,styles:r,unstyled:o,vars:a,varsResolver:Bte}),_=()=>{u?.(),E.closeDropdown()};return h.jsx(_te,{value:{getStyles:C,store:E,onOptionSubmit:c,size:f,resetSelectionOnOptionHover:g,readOnly:v},children:h.jsx(co,{opened:E.dropdownOpened,...x,onChange:j=>!j&&_(),withRoles:!1,unstyled:o,children:i})})}const Vte=e=>e;Ct.extend=Vte;Ct.classes=po;Ct.displayName="@mantine/core/Combobox";Ct.Target=H8;Ct.Dropdown=XO;Ct.Options=oj;Ct.Option=rj;Ct.Search=ij;Ct.Empty=QO;Ct.Chevron=KO;Ct.Footer=ej;Ct.Header=nj;Ct.EventsTarget=V8;Ct.DropdownTarget=B8;Ct.Group=tj;Ct.ClearButton=z8;Ct.HiddenInput=U8;var q8={root:"m_5f75b09e",body:"m_5f6e695e",labelWrapper:"m_d3ea56bb",label:"m_8ee546b8",description:"m_328f68c0",error:"m_8e8a99cc"};const Ute=q8,aj=w.forwardRef(({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:o,unstyled:i,children:s,label:a,description:c,id:u,disabled:f,error:p,size:g,labelPosition:y="left",bodyElement:v="div",labelElement:x="label",variant:S,style:E,vars:C,mod:_,...j},A)=>{const T=gt({name:e,props:t,className:n,style:E,classes:q8,classNames:r,styles:o,unstyled:i});return h.jsx(Fe,{...T("root"),ref:A,__vars:{"--label-fz":zr(g),"--label-lh":jt(g,"label-lh")},mod:[{"label-position":y},_],variant:S,size:g,...j,children:h.jsxs(Fe,{component:v,htmlFor:v==="label"?u:void 0,...T("body"),children:[s,h.jsxs("div",{...T("labelWrapper"),"data-disabled":f||void 0,children:[a&&h.jsx(Fe,{component:x,htmlFor:x==="label"?u:void 0,...T("label"),"data-disabled":f||void 0,children:a}),c&&h.jsx(Lt.Description,{size:g,__inheritStyles:!1,...T("description"),children:c}),p&&typeof p!="boolean"&&h.jsx(Lt.Error,{size:g,__inheritStyles:!1,...T("error"),children:p})]})]})})});aj.displayName="@mantine/core/InlineInput";function W8({children:e,role:t}){const n=dh();return n?h.jsx("div",{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):h.jsx(h.Fragment,{children:e})}function Hte({size:e,style:t,...n}){const r=e!==void 0?{width:Oe(e),height:Oe(e),...t}:t;return h.jsx("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n,children:h.jsx("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function Af(e){return"group"in e}function G8({options:e,search:t,limit:n}){const r=t.trim().toLowerCase(),o=[];for(let i=0;i<e.length;i+=1){const s=e[i];if(o.length===n)return o;Af(s)&&o.push({group:s.group,items:G8({options:s.items,search:t,limit:n-o.length})}),Af(s)||s.label.toLowerCase().includes(r)&&o.push(s)}return o}function qte(e){if(e.length===0)return!0;for(const t of e)if(!("group"in t)||t.items.length>0)return!1;return!0}function J8(e,t=new Set){if(Array.isArray(e))for(const n of e)if(Af(n))J8(n.items,t);else{if(typeof n.value>"u")throw new Error("[@mantine/core] Each option must have value property");if(typeof n.value!="string")throw new Error(`[@mantine/core] Option value must be a string, other data formats are not supported, got ${typeof n.value}`);if(t.has(n.value))throw new Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function Wte(e,t){return Array.isArray(e)?e.includes(t):e===t}function Y8({data:e,withCheckIcon:t,value:n,checkIconPosition:r,unstyled:o,renderOption:i}){if(!Af(e)){const a=Wte(n,e.value),c=t&&a&&h.jsx(Hte,{className:po.optionsDropdownCheckIcon}),u=h.jsxs(h.Fragment,{children:[r==="left"&&c,h.jsx("span",{children:e.label}),r==="right"&&c]});return h.jsx(Ct.Option,{value:e.value,disabled:e.disabled,className:pn({[po.optionsDropdownOption]:!o}),"data-reverse":r==="right"||void 0,"data-checked":a||void 0,"aria-selected":a,active:a,children:typeof i=="function"?i({option:e,checked:a}):u})}const s=e.items.map(a=>h.jsx(Y8,{data:a,value:n,unstyled:o,withCheckIcon:t,checkIconPosition:r,renderOption:i},a.value));return h.jsx(Ct.Group,{label:e.group,children:s})}function K8({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:o,limit:i,maxDropdownHeight:s,withScrollArea:a=!0,filterOptions:c=!0,withCheckIcon:u=!1,value:f,checkIconPosition:p,nothingFoundMessage:g,unstyled:y,labelId:v,renderOption:x,scrollAreaProps:S,"aria-label":E}){J8(e);const _=typeof o=="string"?(r||G8)({options:e,search:c?o:"",limit:i??1/0}):e,j=qte(_),A=_.map(T=>h.jsx(Y8,{data:T,withCheckIcon:u,value:f,checkIconPosition:p,unstyled:y,renderOption:x},Af(T)?T.group:T.value));return h.jsx(Ct.Dropdown,{hidden:t||n&&j,"data-composed":!0,children:h.jsxs(Ct.Options,{labelledBy:v,"aria-label":E,children:[a?h.jsx(ch.Autosize,{mah:s??220,type:"scroll",scrollbarSize:"var(--combobox-padding)",offsetScrollbars:"y",...S,children:A}):A,j&&g&&h.jsx(Ct.Empty,{children:g})]})})}var fh={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844",groupSection:"m_70be2a01"};const YR={orientation:"horizontal"},Gte=(e,{borderWidth:t})=>({group:{"--button-border-width":Oe(t)}}),lj=Ue((e,t)=>{const n=Pe("ButtonGroup",YR,e),{className:r,style:o,classNames:i,styles:s,unstyled:a,orientation:c,vars:u,borderWidth:f,variant:p,mod:g,...y}=Pe("ButtonGroup",YR,e),v=gt({name:"ButtonGroup",props:n,classes:fh,className:r,style:o,classNames:i,styles:s,unstyled:a,vars:u,varsResolver:Gte,rootSelector:"group"});return h.jsx(Fe,{...v("group"),ref:t,variant:p,mod:[{"data-orientation":c},g],role:"group",...y})});lj.classes=fh;lj.displayName="@mantine/core/ButtonGroup";const KR={},Jte=(e,{radius:t,color:n,gradient:r,variant:o,autoContrast:i,size:s})=>{const a=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:i});return{groupSection:{"--section-height":jt(s,"section-height"),"--section-padding-x":jt(s,"section-padding-x"),"--section-fz":s?.includes("compact")?zr(s.replace("compact-","")):zr(s),"--section-radius":t===void 0?void 0:Qn(t),"--section-bg":n||o?a.background:void 0,"--section-color":a.color,"--section-bd":n||o?a.border:void 0}}},cj=Ue((e,t)=>{const n=Pe("ButtonGroupSection",KR,e),{className:r,style:o,classNames:i,styles:s,unstyled:a,vars:c,variant:u,gradient:f,radius:p,autoContrast:g,...y}=Pe("ButtonGroupSection",KR,e),v=gt({name:"ButtonGroupSection",props:n,classes:fh,className:r,style:o,classNames:i,styles:s,unstyled:a,vars:c,varsResolver:Jte,rootSelector:"groupSection"});return h.jsx(Fe,{...v("groupSection"),ref:t,variant:u,...y})});cj.classes=fh;cj.displayName="@mantine/core/ButtonGroupSection";const Yte={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${Oe(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},Kte={},Xte=(e,{radius:t,color:n,gradient:r,variant:o,size:i,justify:s,autoContrast:a})=>{const c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:a});return{root:{"--button-justify":s,"--button-height":jt(i,"button-height"),"--button-padding-x":jt(i,"button-padding-x"),"--button-fz":i?.includes("compact")?zr(i.replace("compact-","")):zr(i),"--button-radius":t===void 0?void 0:Qn(t),"--button-bg":n||o?c.background:void 0,"--button-hover":n||o?c.hover:void 0,"--button-color":c.color,"--button-bd":n||o?c.border:void 0,"--button-hover-color":n||o?c.hoverColor:void 0}}},Nu=mc((e,t)=>{const n=Pe("Button",Kte,e),{style:r,vars:o,className:i,color:s,disabled:a,children:c,leftSection:u,rightSection:f,fullWidth:p,variant:g,radius:y,loading:v,loaderProps:x,gradient:S,classNames:E,styles:C,unstyled:_,"data-disabled":j,autoContrast:A,mod:T,...k}=n,R=gt({name:"Button",props:n,classes:fh,className:i,style:r,classNames:E,styles:C,unstyled:_,vars:o,varsResolver:Xte}),V=!!u,H=!!f;return h.jsxs(Aa,{ref:t,...R("root",{active:!a&&!v&&!j}),unstyled:_,variant:g,disabled:a||v,mod:[{disabled:a||j,loading:v,block:p,"with-left-section":V,"with-right-section":H},T],...k,children:[h.jsx(yc,{mounted:!!v,transition:Yte,duration:150,children:F=>h.jsx(Fe,{component:"span",...R("loader",{style:F}),"aria-hidden":!0,children:h.jsx(Rg,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...x})})}),h.jsxs("span",{...R("inner"),children:[u&&h.jsx(Fe,{component:"span",...R("section"),mod:{position:"left"},children:u}),h.jsx(Fe,{component:"span",mod:{loading:v},...R("label"),children:c}),f&&h.jsx(Fe,{component:"span",...R("section"),mod:{position:"right"},children:f})]})]})});Nu.classes=fh;Nu.displayName="@mantine/core/Button";Nu.Group=lj;Nu.GroupSection=cj;function Qte({open:e,close:t,openDelay:n,closeDelay:r}){const o=w.useRef(-1),i=w.useRef(-1),s=()=>{window.clearTimeout(o.current),window.clearTimeout(i.current)},a=()=>{s(),n===0||n===void 0?e():o.current=window.setTimeout(e,n)},c=()=>{s(),r===0||r===void 0?t():i.current=window.setTimeout(t,r)};return w.useEffect(()=>s,[]),{openDropdown:a,closeDropdown:c}}function Tf(){return Tf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tf.apply(null,arguments)}function uj(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Zte=w.useLayoutEffect,ene=function(t){var n=Ne.useRef(t);return Zte(function(){n.current=t}),n},XR=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},tne=function(t,n){var r=Ne.useRef();return Ne.useCallback(function(o){t.current=o,r.current&&XR(r.current,null),r.current=n,n&&XR(n,o)},[n])},QR={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},nne=function(t){Object.keys(QR).forEach(function(n){t.style.setProperty(n,QR[n],"important")})},ZR=nne,jr=null,ek=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function rne(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),jr||(jr=document.createElement("textarea"),jr.setAttribute("tabindex","-1"),jr.setAttribute("aria-hidden","true"),ZR(jr)),jr.parentNode===null&&document.body.appendChild(jr);var o=e.paddingSize,i=e.borderSize,s=e.sizingStyle,a=s.boxSizing;Object.keys(s).forEach(function(g){var y=g;jr.style[y]=s[y]}),ZR(jr),jr.value=t;var c=ek(jr,e);jr.value=t,c=ek(jr,e),jr.value="x";var u=jr.scrollHeight-o,f=u*n;a==="border-box"&&(f=f+o+i),c=Math.max(f,c);var p=u*r;return a==="border-box"&&(p=p+o+i),c=Math.min(p,c),[c,u]}var tk=function(){},one=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},ine=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],sne=!!document.documentElement.currentStyle,ane=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=one(ine,n),o=r.boxSizing;if(o==="")return null;sne&&o==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),s=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:s}},lne=ane;function dj(e,t,n){var r=ene(n);w.useLayoutEffect(function(){var o=function(s){return r.current(s)};if(e)return e.addEventListener(t,o),function(){return e.removeEventListener(t,o)}},[])}var cne=function(t,n){dj(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},une=function(t){dj(window,"resize",t)},dne=function(t){dj(document.fonts,"loadingdone",t)},fne=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],hne=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,i=t.minRows,s=t.onChange,a=s===void 0?tk:s,c=t.onHeightChange,u=c===void 0?tk:c,f=uj(t,fne),p=f.value!==void 0,g=w.useRef(null),y=tne(g,n),v=w.useRef(0),x=w.useRef(),S=function(){var _=g.current,j=r&&x.current?x.current:lne(_);if(j){x.current=j;var A=rne(j,_.value||_.placeholder||"x",i,o),T=A[0],k=A[1];v.current!==T&&(v.current=T,_.style.setProperty("height",T+"px","important"),u(T,{rowHeight:k}))}},E=function(_){p||S(),a(_)};return w.useLayoutEffect(S),cne(g,function(){if(!p){var C=g.current.value;requestAnimationFrame(function(){var _=g.current;_&&C!==_.value&&S()})}}),une(S),dne(S),w.createElement("textarea",Tf({},f,{onChange:E,ref:y}))},pne=w.forwardRef(hne);const mne={},kg=Ue((e,t)=>{const{autosize:n,maxRows:r,minRows:o,__staticSelector:i,resize:s,...a}=Pe("Textarea",mne,e),c=n&&E9()!=="test",u=c?{maxRows:r,minRows:o}:{};return h.jsx(vi,{component:c?pne:"textarea",ref:t,...a,__staticSelector:i||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,__vars:{"--input-resize":s},...u})});kg.classes=vi.classes;kg.displayName="@mantine/core/Textarea";const[gne,Mg]=Pa("Menu component was not found in the tree");var hh={dropdown:"m_dc9b7c9f",label:"m_9bfac126",divider:"m_efdf90cb",item:"m_99ac2aa1",itemLabel:"m_5476e0d3",itemSection:"m_8b75e504"};const yne={},fj=Ue((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...a}=Pe("MenuDivider",yne,e),c=Mg();return h.jsx(Fe,{ref:t,...c.getStyles("divider",{className:r,style:o,styles:i,classNames:n}),...a})});fj.classes=hh;fj.displayName="@mantine/core/MenuDivider";const bne={},hj=Ue((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,onMouseEnter:a,onMouseLeave:c,onKeyDown:u,children:f,...p}=Pe("MenuDropdown",bne,e),g=w.useRef(null),y=Mg(),v=Ss(u,E=>{(E.key==="ArrowUp"||E.key==="ArrowDown")&&(E.preventDefault(),g.current?.querySelectorAll("[data-menu-item]:not(:disabled)")[0]?.focus())}),x=Ss(a,()=>(y.trigger==="hover"||y.trigger==="click-hover")&&y.openDropdown()),S=Ss(c,()=>(y.trigger==="hover"||y.trigger==="click-hover")&&y.closeDropdown());return h.jsxs(co.Dropdown,{...p,onMouseEnter:x,onMouseLeave:S,role:"menu","aria-orientation":"vertical",ref:jn(t,g),...y.getStyles("dropdown",{className:r,style:o,styles:i,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:v,children:[y.withInitialFocusPlaceholder&&h.jsx("div",{tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),f]})});hj.classes=hh;hj.displayName="@mantine/core/MenuDropdown";const vne={},pj=mc((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,color:a,closeMenuOnClick:c,leftSection:u,rightSection:f,children:p,disabled:g,"data-disabled":y,...v}=Pe("MenuItem",vne,e),x=Mg(),S=zo(),{dir:E}=gc(),C=w.useRef(null),_=x.getItemIndex(C.current),j=v,A=Ss(j.onMouseLeave,()=>x.setHovered(-1)),T=Ss(j.onMouseEnter,()=>x.setHovered(x.getItemIndex(C.current))),k=Ss(j.onClick,()=>{y||(typeof c=="boolean"?c&&x.closeDropdownImmediately():x.closeOnItemClick&&x.closeDropdownImmediately())}),R=Ss(j.onFocus,()=>x.setHovered(x.getItemIndex(C.current))),V=a?S.variantColorResolver({color:a,theme:S,variant:"light"}):void 0,H=a?pc({color:a,theme:S}):null;return h.jsxs(Aa,{...v,unstyled:x.unstyled,tabIndex:x.menuItemTabIndex,onFocus:R,...x.getStyles("item",{className:r,style:o,styles:i,classNames:n}),ref:jn(C,t),role:"menuitem",disabled:g,"data-menu-item":!0,"data-disabled":g||y||void 0,"data-hovered":x.hovered===_?!0:void 0,"data-mantine-stop-propagation":!0,onMouseEnter:T,onMouseLeave:A,onClick:k,onKeyDown:g9({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:x.loop,dir:E,orientation:"vertical",onKeyDown:j.onKeyDown}),__vars:{"--menu-item-color":H?.isThemeColor&&H?.shade===void 0?`var(--mantine-color-${H.color}-6)`:V?.color,"--menu-item-hover":V?.hover},children:[u&&h.jsx("div",{...x.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"left",children:u}),p&&h.jsx("div",{...x.getStyles("itemLabel",{styles:i,classNames:n}),children:p}),f&&h.jsx("div",{...x.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"right",children:f})]})});pj.classes=hh;pj.displayName="@mantine/core/MenuItem";const xne={},mj=Ue((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...a}=Pe("MenuLabel",xne,e),c=Mg();return h.jsx(Fe,{ref:t,...c.getStyles("label",{className:r,style:o,styles:i,classNames:n}),...a})});mj.classes=hh;mj.displayName="@mantine/core/MenuLabel";const wne={refProp:"ref"},X8=w.forwardRef((e,t)=>{const{children:n,refProp:r,...o}=Pe("MenuTarget",wne,e);if(!fc(n))throw new Error("Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const i=Mg(),s=n.props,a=Ss(s.onClick,()=>{i.trigger==="click"?i.toggleDropdown():i.trigger==="click-hover"&&(i.setOpenedViaClick(!0),i.opened||i.openDropdown())}),c=Ss(s.onMouseEnter,()=>(i.trigger==="hover"||i.trigger==="click-hover")&&i.openDropdown()),u=Ss(s.onMouseLeave,()=>{(i.trigger==="hover"||i.trigger==="click-hover"&&!i.openedViaClick)&&i.closeDropdown()});return h.jsx(co.Target,{refProp:r,popupType:"menu",ref:t,...o,children:w.cloneElement(n,{onClick:a,onMouseEnter:c,onMouseLeave:u,"data-expanded":i.opened?!0:void 0})})});X8.displayName="@mantine/core/MenuTarget";const Sne={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function Lr(e){const t=Pe("Menu",Sne,e),{children:n,onOpen:r,onClose:o,opened:i,defaultOpened:s,trapFocus:a,onChange:c,closeOnItemClick:u,loop:f,closeOnEscape:p,trigger:g,openDelay:y,closeDelay:v,classNames:x,styles:S,unstyled:E,variant:C,vars:_,menuItemTabIndex:j,keepMounted:A,withInitialFocusPlaceholder:T,...k}=t,R=gt({name:"Menu",classes:hh,props:t,classNames:x,styles:S,unstyled:E}),[V,{setHovered:H,resetHovered:F}]=ZK(),[B,U]=ho({value:i,defaultValue:s,finalValue:!1,onChange:c}),[M,z]=w.useState(!1),$=()=>{U(!1),z(!1),B&&o?.()},L=()=>{U(!0),!B&&r?.()},P=()=>{B?$():L()},{openDropdown:q,closeDropdown:Y}=Qte({open:L,close:$,closeDelay:v,openDelay:y}),D=Q=>QK("[data-menu-item]","[data-menu-dropdown]",Q),{resolvedClassNames:W,resolvedStyles:K}=ih({classNames:x,styles:S,props:t});return _a(()=>{F()},[B]),h.jsx(gne,{value:{getStyles:R,opened:B,toggleDropdown:P,getItemIndex:D,hovered:V,setHovered:H,openedViaClick:M,setOpenedViaClick:z,closeOnItemClick:u,closeDropdown:g==="click"?$:Y,openDropdown:g==="click"?L:q,closeDropdownImmediately:$,loop:f,trigger:g,unstyled:E,menuItemTabIndex:j,withInitialFocusPlaceholder:T},children:h.jsx(co,{...k,opened:B,onChange:P,defaultOpened:s,trapFocus:A?!1:a,closeOnEscape:p,__staticSelector:"Menu",classNames:W,styles:K,unstyled:E,variant:C,keepMounted:A,children:n})})}Lr.extend=e=>e;Lr.withProps=HQ(Lr);Lr.classes=hh;Lr.displayName="@mantine/core/Menu";Lr.Item=pj;Lr.Label=mj;Lr.Dropdown=hj;Lr.Target=X8;Lr.Divider=fj;const[Ene,ph]=Pa("Modal component was not found in tree");var Ia={root:"m_9df02822",content:"m_54c44539",inner:"m_1f958f16",header:"m_d0e2b9cd"};const Nne={},Fx=Ue((e,t)=>{const n=Pe("ModalBody",Nne,e),{classNames:r,className:o,style:i,styles:s,vars:a,...c}=n,u=ph();return h.jsx(T8,{ref:t,...u.getStyles("body",{classNames:r,style:i,styles:s,className:o}),...c})});Fx.classes=Ia;Fx.displayName="@mantine/core/ModalBody";const _ne={},zx=Ue((e,t)=>{const n=Pe("ModalCloseButton",_ne,e),{classNames:r,className:o,style:i,styles:s,vars:a,...c}=n,u=ph();return h.jsx($8,{ref:t,...u.getStyles("close",{classNames:r,style:i,styles:s,className:o}),...c})});zx.classes=Ia;zx.displayName="@mantine/core/ModalCloseButton";const Cne={},Bx=Ue((e,t)=>{const n=Pe("ModalContent",Cne,e),{classNames:r,className:o,style:i,styles:s,vars:a,children:c,__hidden:u,...f}=n,p=ph(),g=p.scrollAreaComponent||rte;return h.jsx(R8,{...p.getStyles("content",{className:o,style:i,styles:s,classNames:r}),innerProps:p.getStyles("inner",{className:o,style:i,styles:s,classNames:r}),"data-full-screen":p.fullScreen||void 0,"data-modal-content":!0,"data-hidden":u||void 0,ref:t,...f,children:h.jsx(g,{style:{maxHeight:p.fullScreen?"100dvh":`calc(100dvh - (${Oe(p.yOffset)} * 2))`},children:c})})});Bx.classes=Ia;Bx.displayName="@mantine/core/ModalContent";const One={},Vx=Ue((e,t)=>{const n=Pe("ModalHeader",One,e),{classNames:r,className:o,style:i,styles:s,vars:a,...c}=n,u=ph();return h.jsx(k8,{ref:t,...u.getStyles("header",{classNames:r,style:i,styles:s,className:o}),...c})});Vx.classes=Ia;Vx.displayName="@mantine/core/ModalHeader";const jne={},Ux=Ue((e,t)=>{const n=Pe("ModalOverlay",jne,e),{classNames:r,className:o,style:i,styles:s,vars:a,...c}=n,u=ph();return h.jsx(M8,{ref:t,...u.getStyles("overlay",{classNames:r,style:i,styles:s,className:o}),...c})});Ux.classes=Ia;Ux.displayName="@mantine/core/ModalOverlay";const Ane={__staticSelector:"Modal",closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:ts("modal"),transitionProps:{duration:200,transition:"fade-down"},yOffset:"5dvh"},Tne=(e,{radius:t,size:n,yOffset:r,xOffset:o})=>({root:{"--modal-radius":t===void 0?void 0:Qn(t),"--modal-size":jt(n,"modal-size"),"--modal-y-offset":Oe(r),"--modal-x-offset":Oe(o)}}),Hx=Ue((e,t)=>{const n=Pe("ModalRoot",Ane,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,yOffset:u,scrollAreaComponent:f,radius:p,fullScreen:g,centered:y,xOffset:v,__staticSelector:x,...S}=n,E=gt({name:x,classes:Ia,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Tne});return h.jsx(Ene,{value:{yOffset:u,scrollAreaComponent:f,getStyles:E,fullScreen:g},children:h.jsx(A8,{ref:t,...E("root"),"data-full-screen":g||void 0,"data-centered":y||void 0,"data-offset-scrollbars":f===ch.Autosize||void 0,unstyled:a,...S})})});Hx.classes=Ia;Hx.displayName="@mantine/core/ModalRoot";const[$ne,Rne]=Lu();function Q8({children:e}){const[t,n]=w.useState([]),[r,o]=w.useState(ts("modal"));return h.jsx($ne,{value:{stack:t,addModal:(i,s)=>{n(a=>[...new Set([...a,i])]),o(a=>typeof s=="number"&&typeof a=="number"?Math.max(a,s):a)},removeModal:i=>n(s=>s.filter(a=>a!==i)),getZIndex:i=>`calc(${r} + ${t.indexOf(i)} + 1)`,currentId:t[t.length-1],maxZIndex:r},children:e})}Q8.displayName="@mantine/core/ModalStack";const kne={},qx=Ue((e,t)=>{const n=Pe("ModalTitle",kne,e),{classNames:r,className:o,style:i,styles:s,vars:a,...c}=n,u=ph();return h.jsx(P8,{ref:t,...u.getStyles("title",{classNames:r,style:i,styles:s,className:o}),...c})});qx.classes=Ia;qx.displayName="@mantine/core/ModalTitle";const Mne={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:ts("modal"),transitionProps:{duration:200,transition:"fade-down"},withOverlay:!0,withCloseButton:!0},Bo=Ue((e,t)=>{const{title:n,withOverlay:r,overlayProps:o,withCloseButton:i,closeButtonProps:s,children:a,radius:c,opened:u,stackId:f,zIndex:p,...g}=Pe("Modal",Mne,e),y=Rne(),v=!!n||i,x=y&&f?{closeOnEscape:y.currentId===f,trapFocus:y.currentId===f,zIndex:y.getZIndex(f)}:{},S=r===!1?!1:f&&y?y.currentId===f:u;return w.useEffect(()=>{y&&f&&(u?y.addModal(f,p||ts("modal")):y.removeModal(f))},[u,f,p]),h.jsxs(Hx,{ref:t,radius:c,opened:u,zIndex:y&&f?y.getZIndex(f):p,...g,...x,children:[r&&h.jsx(Ux,{visible:S,transitionProps:y&&f?{duration:0}:void 0,...o}),h.jsxs(Bx,{radius:c,__hidden:y&&f&&u?f!==y.currentId:!1,children:[v&&h.jsxs(Vx,{children:[n&&h.jsx(qx,{children:n}),i&&h.jsx(zx,{...s})]}),h.jsx(Fx,{children:a})]})]})});Bo.classes=Ia;Bo.displayName="@mantine/core/Modal";Bo.Root=Hx;Bo.Overlay=Ux;Bo.Content=Bx;Bo.Body=Fx;Bo.Header=Vx;Bo.Title=qx;Bo.CloseButton=zx;Bo.Stack=Q8;const[Pne,gj]=Lu(),[Dne,Ine]=Lu();var Wx={root:"m_7cda1cd6","root--default":"m_44da308b","root--contrast":"m_e3a01f8",label:"m_1e0e6180",remove:"m_ae386778",group:"m_1dcfd90b"};const Lne={},Fne=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?jt(t):jt(n,"pg-gap")}}),yj=Ue((e,t)=>{const n=Pe("PillGroup",Lne,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,size:u,disabled:f,...p}=n,y=gj()?.size||u||void 0,v=gt({name:"PillGroup",classes:Wx,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Fne,stylesCtx:{size:y},rootSelector:"group"});return h.jsx(Dne,{value:{size:y,disabled:f},children:h.jsx(Fe,{ref:t,size:y,...v("group"),...p})})});yj.classes=Wx;yj.displayName="@mantine/core/PillGroup";const zne={variant:"default"},Bne=(e,{radius:t},{size:n})=>({root:{"--pill-fz":jt(n,"pill-fz"),"--pill-height":jt(n,"pill-height"),"--pill-radius":t===void 0?void 0:Qn(t)}}),Am=Ue((e,t)=>{const n=Pe("Pill",zne,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,variant:u,children:f,withRemoveButton:p,onRemove:g,removeButtonProps:y,radius:v,size:x,disabled:S,mod:E,...C}=n,_=Ine(),j=gj(),A=x||_?.size||void 0,T=j?.variant==="filled"?"contrast":u||"default",k=gt({name:"Pill",classes:Wx,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Bne,stylesCtx:{size:A}});return h.jsxs(Fe,{component:"span",ref:t,variant:T,size:A,...k("root",{variant:T}),mod:[{"with-remove":p&&!S,disabled:S||_?.disabled},E],...C,children:[h.jsx("span",{...k("label"),children:f}),p&&h.jsx(uh,{variant:"transparent",radius:v,tabIndex:-1,"aria-hidden":!0,unstyled:a,...y,...k("remove",{className:y?.className,style:y?.style}),onMouseDown:R=>{R.preventDefault(),R.stopPropagation(),y?.onMouseDown?.(R)},onClick:R=>{R.stopPropagation(),g?.(),y?.onClick?.(R)}})]})});Am.classes=Wx;Am.displayName="@mantine/core/Pill";Am.Group=yj;var Z8={field:"m_45c4369d"};const Vne={type:"visible"},bj=Ue((e,t)=>{const n=Pe("PillsInputField",Vne,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,type:u,disabled:f,id:p,pointer:g,mod:y,...v}=n,x=gj(),S=dh(),E=gt({name:"PillsInputField",classes:Z8,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,rootSelector:"field"}),C=f||x?.disabled;return h.jsx(Fe,{component:"input",ref:jn(t,x?.fieldRef),"data-type":u,disabled:C,mod:[{disabled:C,pointer:g},y],...E("field"),...v,id:S?.inputId||p,"aria-invalid":x?.hasError,"aria-describedby":S?.describedBy,type:"text",onMouseDown:_=>!g&&_.stopPropagation()})});bj.classes=Z8;bj.displayName="@mantine/core/PillsInputField";const Une={},dv=Ue((e,t)=>{const n=Pe("PillsInput",Une,e),{children:r,onMouseDown:o,onClick:i,size:s,disabled:a,__staticSelector:c,error:u,variant:f,...p}=n,g=w.useRef(null);return h.jsx(Pne,{value:{fieldRef:g,size:s,disabled:a,hasError:!!u,variant:f},children:h.jsx(vi,{size:s,error:u,variant:f,component:"div",ref:t,onMouseDown:y=>{y.preventDefault(),o?.(y),g.current?.focus()},onClick:y=>{y.preventDefault(),y.currentTarget.closest("fieldset")?.disabled||(g.current?.focus(),i?.(y))},...p,multiline:!0,disabled:a,__staticSelector:c||"PillsInput",withAria:!1,children:r})})});dv.displayName="@mantine/core/PillsInput";dv.Field=bj;var eL={root:"m_a513464",icon:"m_a4ceffb",loader:"m_b0920b15",body:"m_a49ed24",title:"m_3feedf16",description:"m_3d733a3a",closeButton:"m_919a4d88"};const Hne={withCloseButton:!0},qne=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:Qn(t),"--notification-color":n?Sr(n,e):void 0}}),vj=Ue((e,t)=>{const n=Pe("Notification",Hne,e),{className:r,color:o,radius:i,loading:s,withCloseButton:a,withBorder:c,title:u,icon:f,children:p,onClose:g,closeButtonProps:y,classNames:v,style:x,styles:S,unstyled:E,variant:C,vars:_,mod:j,loaderProps:A,role:T,...k}=n,R=gt({name:"Notification",classes:eL,props:n,className:r,style:x,classNames:v,styles:S,unstyled:E,vars:_,varsResolver:qne});return h.jsxs(Fe,{...R("root"),mod:[{"data-with-icon":!!f||s,"data-with-border":c},j],ref:t,variant:C,role:T||"alert",...k,children:[f&&!s&&h.jsx("div",{...R("icon"),children:f}),s&&h.jsx(Rg,{size:28,color:o,...A,...R("loader")}),h.jsxs("div",{...R("body"),children:[u&&h.jsx("div",{...R("title"),children:u}),h.jsx(Fe,{...R("description"),mod:{"data-with-title":!!u},children:p})]}),a&&h.jsx(uh,{iconSize:16,color:"gray",...y,unstyled:E,onClick:g,...R("closeButton")})]})});vj.classes=eL;vj.displayName="@mantine/core/Notification";function tL(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}var Tm;(function(e){e.event="event",e.props="prop"})(Tm||(Tm={}));function zl(){}function Wne(e){var t,n=void 0;return function(){for(var r=[],o=arguments.length;o--;)r[o]=arguments[o];return t&&r.length===t.length&&r.every(function(i,s){return i===t[s]})||(t=r,n=e.apply(void 0,r)),n}}function $m(e){return!!(e||"").match(/\d/)}function yf(e){return e==null}function Gne(e){return typeof e=="number"&&isNaN(e)}function nL(e){return yf(e)||Gne(e)||typeof e=="number"&&!isFinite(e)}function rL(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Jne(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Yne(e,t,n){var r=Jne(n),o=e.search(/[1-9]/);return o=o===-1?e.length:o,e.substring(0,o)+e.substring(o,e.length).replace(r,"$1"+t)}function Kne(e){var t=w.useRef(e);t.current=e;var n=w.useRef(function(){for(var r=[],o=arguments.length;o--;)r[o]=arguments[o];return t.current.apply(t,r)});return n.current}function xj(e,t){t===void 0&&(t=!0);var n=e[0]==="-",r=n&&t;e=e.replace("-","");var o=e.split("."),i=o[0],s=o[1]||"";return{beforeDecimal:i,afterDecimal:s,hasNegation:n,addNegation:r}}function Xne(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var n=e.split("."),r=n[0].replace(/^0+/,"")||"0",o=n[1]||"";return(t?"-":"")+r+(o?"."+o:"")}function oL(e,t,n){for(var r="",o=n?"0":"",i=0;i<=t-1;i++)r+=e[i]||o;return r}function nk(e,t){return Array(t+1).join(e)}function iL(e){var t=e+"",n=t[0]==="-"?"-":"";n&&(t=t.substring(1));var r=t.split(/[eE]/g),o=r[0],i=r[1];if(i=Number(i),!i)return n+o;o=o.replace(".","");var s=1+i,a=o.length;return s<0?o="0."+nk("0",Math.abs(s))+o:s>=a?o=o+nk("0",s-a):o=(o.substring(0,s)||"0")+"."+o.substring(s),n+o}function rk(e,t,n){if(["","-"].indexOf(e)!==-1)return e;var r=(e.indexOf(".")!==-1||n)&&t,o=xj(e),i=o.beforeDecimal,s=o.afterDecimal,a=o.hasNegation,c=parseFloat("0."+(s||"0")),u=s.length<=t?"0."+s:c.toFixed(t),f=u.split("."),p=i;i&&Number(f[0])&&(p=i.split("").reverse().reduce(function(x,S,E){return x.length>E?(Number(x[0])+Number(S)).toString()+x.substring(1,x.length):S+x},f[0]));var g=oL(f[1]||"",t,n),y=a?"-":"",v=r?".":"";return""+y+p+v+g}function ou(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var sL=Wne(function(e,t){for(var n=0,r=0,o=e.length,i=t.length;e[n]===t[n]&&n<o;)n++;for(;e[o-1-r]===t[i-1-r]&&i-r>n&&o-r>n;)r++;return{from:{start:n,end:o-r},to:{start:n,end:i-r}}}),Qne=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function Zne(e,t,n){return Math.min(Math.max(e,t),n)}function s2(e){return Math.max(e.selectionStart,e.selectionEnd)}function ere(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function tre(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function nre(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,o=e.formattedValueIndex;return t[r]===n[o]}function rre(e,t,n,r,o,i,s){s===void 0&&(s=nre);var a=o.findIndex(function(j){return j}),c=e.slice(0,a);!t&&!n.startsWith(c)&&(t=c,n=c+n,r=r+c.length);for(var u=n.length,f=e.length,p={},g=new Array(u),y=0;y<u;y++){g[y]=-1;for(var v=0,x=f;v<x;v++){var S=s({currentValue:n,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:v});if(S&&p[v]!==!0){g[y]=v,p[v]=!0;break}}}for(var E=r;E<u&&(g[E]===-1||!i(n[E]));)E++;var C=E===u||g[E]===-1?f:g[E];for(E=r-1;E>0&&g[E]===-1;)E--;var _=E===-1||g[E]===-1?0:g[E]+1;return _>C?C:r-_<C-r?_:C}function ok(e,t,n,r){var o=e.length;if(t=Zne(t,0,o),r==="left"){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=o&&!n[t];)t++;t>o&&(t=n.lastIndexOf(!0))}return t===-1&&(t=o),t}function ore(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;n<r;n++)t[n]=!!($m(e[n])||$m(e[n-1]));return t}function aL(e,t,n,r,o,i){i===void 0&&(i=zl);var s=Kne(function(v,x){var S,E;return nL(v)?(E="",S=""):typeof v=="number"||x?(E=typeof v=="number"?iL(v):v,S=r(E)):(E=o(v,void 0),S=r(E)),{formattedValue:S,numAsString:E}}),a=w.useState(function(){return s(yf(e)?t:e,n)}),c=a[0],u=a[1],f=function(v,x){v.formattedValue!==c.formattedValue&&u({formattedValue:v.formattedValue,numAsString:v.value}),i(v,x)},p=e,g=n;yf(e)&&(p=c.numAsString,g=!0);var y=s(p,g);return w.useMemo(function(){u(y)},[y.formattedValue]),[c,f]}function ire(e){return e.replace(/[^0-9]/g,"")}function sre(e){return e}function are(e){var t=e.type;t===void 0&&(t="text");var n=e.displayType;n===void 0&&(n="input");var r=e.customInput,o=e.renderText,i=e.getInputRef,s=e.format;s===void 0&&(s=sre);var a=e.removeFormatting;a===void 0&&(a=ire);var c=e.defaultValue,u=e.valueIsNumericString,f=e.onValueChange,p=e.isAllowed,g=e.onChange;g===void 0&&(g=zl);var y=e.onKeyDown;y===void 0&&(y=zl);var v=e.onMouseUp;v===void 0&&(v=zl);var x=e.onFocus;x===void 0&&(x=zl);var S=e.onBlur;S===void 0&&(S=zl);var E=e.value,C=e.getCaretBoundary;C===void 0&&(C=ore);var _=e.isValidInputCharacter;_===void 0&&(_=$m);var j=e.isCharacterSame,A=tL(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),T=aL(E,c,!!u,s,a,f),k=T[0],R=k.formattedValue,V=k.numAsString,H=T[1],F=w.useRef(),B=w.useRef({formattedValue:R,numAsString:V}),U=function(ve,Ce){B.current={formattedValue:ve.formattedValue,numAsString:ve.value},H(ve,Ce)},M=w.useState(!1),z=M[0],$=M[1],L=w.useRef(null),P=w.useRef({setCaretTimeout:null,focusTimeout:null});w.useEffect(function(){return $(!0),function(){clearTimeout(P.current.setCaretTimeout),clearTimeout(P.current.focusTimeout)}},[]);var q=s,Y=function(ve,Ce){var Ae=parseFloat(Ce);return{formattedValue:ve,value:Ce,floatValue:isNaN(Ae)?void 0:Ae}},D=function(ve,Ce,Ae){ve.selectionStart===0&&ve.selectionEnd===ve.value.length||(ou(ve,Ce),P.current.setCaretTimeout=setTimeout(function(){ve.value===Ae&&ve.selectionStart!==Ce&&ou(ve,Ce)},0))},W=function(ve,Ce,Ae){return ok(ve,Ce,C(ve),Ae)},K=function(ve,Ce,Ae){var G=C(Ce),re=rre(Ce,R,ve,Ae,G,_,j);return re=ok(Ce,re,G),re},Q=function(ve){var Ce=ve.formattedValue;Ce===void 0&&(Ce="");var Ae=ve.input,G=ve.source,re=ve.event,ne=ve.numAsString,ce;if(Ae){var te=ve.inputValue||Ae.value,Z=s2(Ae);Ae.value=Ce,ce=K(te,Ce,Z),ce!==void 0&&D(Ae,ce,Ce)}Ce!==R&&U(Y(Ce,ne),{event:re,source:G})};w.useEffect(function(){var ve=B.current,Ce=ve.formattedValue,Ae=ve.numAsString;(R!==Ce||V!==Ae)&&U(Y(R,V),{event:void 0,source:Tm.props})},[R,V]);var ie=L.current?s2(L.current):void 0,pe=typeof window<"u"?w.useLayoutEffect:w.useEffect;pe(function(){var ve=L.current;if(R!==B.current.formattedValue&&ve){var Ce=K(B.current.formattedValue,R,ie);ve.value=R,D(ve,Ce,R)}},[R]);var ue=function(ve,Ce,Ae){var G=Ce.target,re=F.current?Qne(F.current,G.selectionEnd):sL(R,ve),ne=Object.assign(Object.assign({},re),{lastValue:R}),ce=a(ve,ne),te=q(ce);if(ce=a(te,void 0),p&&!p(Y(te,ce))){var Z=Ce.target,de=s2(Z),Te=K(ve,R,de);return Z.value=R,D(Z,Te,R),!1}return Q({formattedValue:te,numAsString:ce,inputValue:ve,event:Ce,source:Ae,input:Ce.target}),!0},se=function(ve,Ce){Ce===void 0&&(Ce=0);var Ae=ve.selectionStart,G=ve.selectionEnd;F.current={selectionStart:Ae,selectionEnd:G+Ce}},me=function(ve){var Ce=ve.target,Ae=Ce.value,G=ue(Ae,ve,Tm.event);G&&g(ve),F.current=void 0},xe=function(ve){var Ce=ve.target,Ae=ve.key,G=Ce.selectionStart,re=Ce.selectionEnd,ne=Ce.value;ne===void 0&&(ne="");var ce;Ae==="ArrowLeft"||Ae==="Backspace"?ce=Math.max(G-1,0):Ae==="ArrowRight"?ce=Math.min(G+1,ne.length):Ae==="Delete"&&(ce=G);var te=0;Ae==="Delete"&&G===re&&(te=1);var Z=Ae==="ArrowLeft"||Ae==="ArrowRight";if(ce===void 0||G!==re&&!Z){y(ve),se(Ce,te);return}var de=ce;if(Z){var Te=Ae==="ArrowLeft"?"left":"right";de=W(ne,ce,Te),de!==ce&&ve.preventDefault()}else Ae==="Delete"&&!_(ne[ce])?de=W(ne,ce,"right"):Ae==="Backspace"&&!_(ne[ce])&&(de=W(ne,ce,"left"));de!==ce&&D(Ce,de,ne),y(ve),se(Ce,te)},je=function(ve){var Ce=ve.target,Ae=function(){var G=Ce.selectionStart,re=Ce.selectionEnd,ne=Ce.value;if(ne===void 0&&(ne=""),G===re){var ce=W(ne,G);ce!==G&&D(Ce,ce,ne)}};Ae(),requestAnimationFrame(function(){Ae()}),v(ve),se(Ce)},_e=function(ve){ve.persist&&ve.persist();var Ce=ve.target,Ae=ve.currentTarget;L.current=Ce,P.current.focusTimeout=setTimeout(function(){var G=Ce.selectionStart,re=Ce.selectionEnd,ne=Ce.value;ne===void 0&&(ne="");var ce=W(ne,G);ce!==G&&!(G===0&&re===ne.length)&&D(Ce,ce,ne),x(Object.assign(Object.assign({},ve),{currentTarget:Ae}))},0)},Ee=function(ve){L.current=null,clearTimeout(P.current.focusTimeout),clearTimeout(P.current.setCaretTimeout),S(ve)},Re=z&&ere()?"numeric":void 0,Me=Object.assign({inputMode:Re},A,{type:t,value:R,onChange:me,onKeyDown:xe,onMouseUp:je,onFocus:_e,onBlur:Ee});if(n==="text")return o?Ne.createElement(Ne.Fragment,null,o(R,A)||null):Ne.createElement("span",Object.assign({},A,{ref:i}),R);if(r){var ze=r;return Ne.createElement(ze,Object.assign({},Me,{ref:i}))}return Ne.createElement("input",Object.assign({},Me,{ref:i}))}function ik(e,t){var n=t.decimalScale,r=t.fixedDecimalScale,o=t.prefix;o===void 0&&(o="");var i=t.suffix;i===void 0&&(i="");var s=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=Gx(t),u=c.thousandSeparator,f=c.decimalSeparator,p=n!==0&&e.indexOf(".")!==-1||n&&r,g=xj(e,s),y=g.beforeDecimal,v=g.afterDecimal,x=g.addNegation;return n!==void 0&&(v=oL(v,n,!!r)),u&&(y=Yne(y,u,a)),o&&(y=o+y),i&&(v=v+i),x&&(y="-"+y),e=y+(p&&f||"")+v,e}function Gx(e){var t=e.decimalSeparator;t===void 0&&(t=".");var n=e.thousandSeparator,r=e.allowedDecimalSeparators;return n===!0&&(n=","),r||(r=[t,"."]),{decimalSeparator:t,thousandSeparator:n,allowedDecimalSeparators:r}}function lre(e,t){e===void 0&&(e="");var n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),o=n.test(e),i=r.test(e);return e=e.replace(/-/g,""),o&&!i&&t&&(e="-"+e),e}function cre(e,t){return new RegExp("(^-)|[0-9]|"+rL(e),"g")}function ure(e,t,n){return e===""?!0:!t?.match(/\d/)&&!n?.match(/\d/)&&typeof e=="string"&&!isNaN(Number(e))}function dre(e,t,n){var r;t===void 0&&(t=tre(e));var o=n.allowNegative,i=n.prefix;i===void 0&&(i="");var s=n.suffix;s===void 0&&(s="");var a=n.decimalScale,c=t.from,u=t.to,f=u.start,p=u.end,g=Gx(n),y=g.allowedDecimalSeparators,v=g.decimalSeparator,x=e[p]===v;if($m(e)&&(e===i||e===s)&&t.lastValue==="")return e;if(p-f===1&&y.indexOf(e[f])!==-1){var S=a===0?"":v;e=e.substring(0,f)+S+e.substring(f+1,e.length)}var E=function(L,P,q){var Y=!1,D=!1;i.startsWith("-")?Y=!1:L.startsWith("--")?(Y=!1,D=!0):s.startsWith("-")&&L.length===s.length?Y=!1:L[0]==="-"&&(Y=!0);var W=Y?1:0;return D&&(W=2),W&&(L=L.substring(W),P-=W,q-=W),{value:L,start:P,end:q,hasNegation:Y}},C=E(e,f,p),_=C.hasNegation;r=C,e=r.value,f=r.start,p=r.end;var j=E(t.lastValue,c.start,c.end),A=j.start,T=j.end,k=j.value,R=e.substring(f,p);e.length&&k.length&&(A>k.length-s.length||T<i.length)&&!(R&&s.startsWith(R))&&(e=k);var V=0;e.startsWith(i)?V+=i.length:f<i.length&&(V=f),e=e.substring(V),p-=V;var H=e.length,F=e.length-s.length;e.endsWith(s)?H=F:(p>F||p>e.length-s.length)&&(H=p),e=e.substring(0,H),e=lre(_?"-"+e:e,o),e=(e.match(cre(v))||[]).join("");var B=e.indexOf(v);e=e.replace(new RegExp(rL(v),"g"),function(L,P){return P===B?".":""});var U=xj(e,o),M=U.beforeDecimal,z=U.afterDecimal,$=U.addNegation;return u.end-u.start<c.end-c.start&&M===""&&x&&!parseFloat(z)&&(e=$?"-":""),e}function fre(e,t){var n=t.prefix;n===void 0&&(n="");var r=t.suffix;r===void 0&&(r="");var o=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";o.fill(!1,0,n.length+(i?1:0));var s=e.length;return o.fill(!1,s-r.length+1,s+1),o}function hre(e){var t=Gx(e),n=t.thousandSeparator,r=t.decimalSeparator,o=e.prefix;o===void 0&&(o="");var i=e.allowNegative;if(i===void 0&&(i=!0),n===r)throw new Error(`
Decimal separator can't be same as thousand separator.
thousandSeparator: `+n+` (thousandSeparator = {true} is same as thousandSeparator = ",")
decimalSeparator: `+r+` (default value for decimalSeparator is .)
`);return o.startsWith("-")&&i&&(console.error(`
Prefix can't start with '-' when allowNegative is true.
prefix: `+o+`
allowNegative: `+i+`
`),i=!1),Object.assign(Object.assign({},e),{allowNegative:i})}function pre(e){e=hre(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,o=e.onKeyDown;o===void 0&&(o=zl);var i=e.onBlur;i===void 0&&(i=zl);var s=e.thousandSeparator,a=e.decimalScale,c=e.fixedDecimalScale,u=e.prefix;u===void 0&&(u="");var f=e.defaultValue,p=e.value,g=e.valueIsNumericString,y=e.onValueChange,v=tL(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),x=Gx(e),S=x.decimalSeparator,E=x.allowedDecimalSeparators,C=function($){return ik($,e)},_=function($,L){return dre($,L,e)},j=yf(p)?f:p,A=g??ure(j,u,t);yf(p)?yf(f)||(A=A||typeof f=="number"):A=A||typeof p=="number";var T=function($){return nL($)?$:(typeof $=="number"&&($=iL($)),A&&typeof a=="number"?rk($,a,!!c):$)},k=aL(T(p),T(f),!!A,C,_,y),R=k[0],V=R.numAsString,H=R.formattedValue,F=k[1],B=function($){var L=$.target,P=$.key,q=L.selectionStart,Y=L.selectionEnd,D=L.value;if(D===void 0&&(D=""),(P==="Backspace"||P==="Delete")&&Y<u.length){$.preventDefault();return}if(q!==Y){o($);return}P==="Backspace"&&D[0]==="-"&&q===u.length+1&&n&&ou(L,1),a&&c&&(P==="Backspace"&&D[q-1]===S?(ou(L,q-1),$.preventDefault()):P==="Delete"&&D[q]===S&&$.preventDefault()),E?.includes(P)&&D[q]===S&&ou(L,q+1);var W=s===!0?",":s;P==="Backspace"&&D[q-1]===W&&ou(L,q-1),P==="Delete"&&D[q]===W&&ou(L,q+1),o($)},U=function($){var L=V;if(L.match(/\d/g)||(L=""),r||(L=Xne(L)),c&&a&&(L=rk(L,a,c)),L!==V){var P=ik(L,e);F({formattedValue:P,value:L,floatValue:parseFloat(L)},{event:$,source:Tm.event})}i($)},M=function($){return $===S?!0:$m($)},z=function($){var L=$.currentValue,P=$.lastValue,q=$.formattedValue,Y=$.currentValueIndex,D=$.formattedValueIndex,W=L[Y],K=q[D],Q=sL(P,L),ie=Q.to,pe=function(ue){return _(ue).indexOf(".")+u.length};return p===0&&c&&a&&L[ie.start]===S&&pe(L)<Y&&pe(q)>D?!1:Y>=ie.start&&Y<ie.end&&E&&E.includes(W)&&K===S?!0:W===K};return Object.assign(Object.assign({},v),{value:H,valueIsNumericString:!1,isValidInputCharacter:M,isCharacterSame:z,onValueChange:F,format:C,removeFormatting:_,getCaretBoundary:function($){return fre($,e)},onKeyDown:B,onBlur:U})}function mre(e){var t=pre(e);return Ne.createElement(are,Object.assign({},t))}function sk({direction:e,style:t,...n}){return h.jsx("svg",{style:{width:"var(--ni-chevron-size)",height:"var(--ni-chevron-size)",transform:e==="up"?"rotate(180deg)":void 0,...t},viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:h.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}var u_={root:"m_e2f5cd4e",controls:"m_95e17d22",control:"m_80b4b171"};const gre=/^(0\.0*|-0(\.0*)?)$/,yre=/^-?0\d+(\.\d+)?\.?$/;function d_(e){return typeof e=="string"&&e!==""&&!Number.isNaN(Number(e))}function a2(e){return typeof e=="number"?e<Number.MAX_SAFE_INTEGER:e===""||d_(e)&&Number(e)<Number.MAX_SAFE_INTEGER}function bre(e){return e.toString().replace(".","").length}function vre(e,t){return(typeof e=="number"?e<Number.MAX_SAFE_INTEGER:!Number.isNaN(Number(e)))&&!Number.isNaN(e)&&bre(t)<14&&t!==""}function ak(e,t,n){if(e===void 0)return!0;const r=t===void 0||e>=t,o=n===void 0||e<=n;return r&&o}const xre={step:1,clampBehavior:"blur",allowDecimal:!0,allowNegative:!0,withKeyboardEvents:!0,allowLeadingZeros:!0,trimLeadingZeroesOnBlur:!0,startValue:0},wre=(e,{size:t})=>({controls:{"--ni-chevron-size":jt(t,"ni-chevron-size")}});function Sre(e,t,n){const r=e.toString().replace(/^0+/,""),o=parseFloat(r);return Number.isNaN(o)?r:o>Number.MAX_SAFE_INTEGER?t!==void 0?String(t):r:ya(o,n,t)}const Jx=Ue((e,t)=>{const n=Pe("NumberInput",xre,e),{className:r,classNames:o,styles:i,unstyled:s,vars:a,onChange:c,onValueChange:u,value:f,defaultValue:p,max:g,min:y,step:v,hideControls:x,rightSection:S,isAllowed:E,clampBehavior:C,onBlur:_,allowDecimal:j,decimalScale:A,onKeyDown:T,onKeyDownCapture:k,handlersRef:R,startValue:V,disabled:H,rightSectionPointerEvents:F,allowNegative:B,readOnly:U,size:M,rightSectionWidth:z,stepHoldInterval:$,stepHoldDelay:L,allowLeadingZeros:P,withKeyboardEvents:q,trimLeadingZeroesOnBlur:Y,...D}=n,W=gt({name:"NumberInput",classes:u_,props:n,classNames:o,styles:i,unstyled:s,vars:a,varsResolver:wre}),{resolvedClassNames:K,resolvedStyles:Q}=ih({classNames:o,styles:i,props:n}),[ie,pe]=ho({value:f,defaultValue:p,finalValue:"",onChange:c}),ue=L!==void 0&&$!==void 0,se=w.useRef(null),me=w.useRef(null),xe=w.useRef(0),je=(te,Z)=>{Z.source==="event"&&pe(vre(te.floatValue,te.value)&&!gre.test(te.value)&&!(P&&yre.test(te.value))?te.floatValue:te.value),u?.(te,Z)},_e=te=>{const Z=String(te).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return Z?Math.max(0,(Z[1]?Z[1].length:0)-(Z[2]?+Z[2]:0)):0},Ee=te=>{se.current&&typeof te<"u"&&se.current.setSelectionRange(te,te)},Re=w.useRef(XN);Re.current=()=>{if(!a2(ie))return;let te;const Z=_e(ie),de=_e(v),Te=Math.max(Z,de),$e=10**Te;if(!d_(ie)&&(typeof ie!="number"||Number.isNaN(ie)))te=ya(V,y,g);else if(g!==void 0){const At=(Math.round(Number(ie)*$e)+Math.round(v*$e))/$e;te=At<=g?At:g}else te=(Math.round(Number(ie)*$e)+Math.round(v*$e))/$e;const Ke=te.toFixed(Te);pe(parseFloat(Ke)),u?.({floatValue:parseFloat(Ke),formattedValue:Ke,value:Ke},{source:"increment"}),setTimeout(()=>Ee(se.current?.value.length),0)};const Me=w.useRef(XN);Me.current=()=>{if(!a2(ie))return;let te;const Z=y!==void 0?y:B?Number.MIN_SAFE_INTEGER:0,de=_e(ie),Te=_e(v),$e=Math.max(de,Te),Ke=10**$e;if(!d_(ie)&&typeof ie!="number"||Number.isNaN(ie))te=ya(V,Z,g);else{const yn=(Math.round(Number(ie)*Ke)-Math.round(v*Ke))/Ke;te=Z!==void 0&&yn<Z?Z:yn}const At=te.toFixed($e);pe(parseFloat(At)),u?.({floatValue:parseFloat(At),formattedValue:At,value:At},{source:"decrement"}),setTimeout(()=>Ee(se.current?.value.length),0)};const ze=te=>{T?.(te),!(U||!q)&&(te.key==="ArrowUp"&&(te.preventDefault(),Re.current()),te.key==="ArrowDown"&&(te.preventDefault(),Me.current()))},ve=te=>{if(k?.(te),te.key==="Backspace"){const Z=se.current;Z.selectionStart===0&&Z.selectionStart===Z.selectionEnd&&(te.preventDefault(),window.setTimeout(()=>Ee(0),0))}},Ce=te=>{let Z=ie;C==="blur"&&typeof Z=="number"&&(Z=ya(Z,y,g)),Y&&typeof Z=="string"&&_e(Z)<15&&(Z=Sre(Z,g,y)),ie!==Z&&pe(Z),_?.(te)};iv(R,{increment:Re.current,decrement:Me.current});const Ae=te=>{te?Re.current():Me.current(),xe.current+=1},G=te=>{if(Ae(te),ue){const Z=typeof $=="number"?$:$(xe.current);me.current=window.setTimeout(()=>G(te),Z)}},re=(te,Z)=>{te.preventDefault(),se.current?.focus(),Ae(Z),ue&&(me.current=window.setTimeout(()=>G(Z),L))},ne=()=>{me.current&&window.clearTimeout(me.current),me.current=null,xe.current=0},ce=h.jsxs("div",{...W("controls"),children:[h.jsx(Aa,{...W("control"),tabIndex:-1,"aria-hidden":!0,disabled:H||typeof ie=="number"&&g!==void 0&&ie>=g,mod:{direction:"up"},onMouseDown:te=>te.preventDefault(),onPointerDown:te=>{re(te,!0)},onPointerUp:ne,onPointerLeave:ne,children:h.jsx(sk,{direction:"up"})}),h.jsx(Aa,{...W("control"),tabIndex:-1,"aria-hidden":!0,disabled:H||typeof ie=="number"&&y!==void 0&&ie<=y,mod:{direction:"down"},onMouseDown:te=>te.preventDefault(),onPointerDown:te=>{re(te,!1)},onPointerUp:ne,onPointerLeave:ne,children:h.jsx(sk,{direction:"down"})})]});return h.jsx(vi,{component:mre,allowNegative:B,className:pn(u_.root,r),size:M,...D,readOnly:U,disabled:H,value:ie,getInputRef:jn(t,se),onValueChange:je,rightSection:x||U||!a2(ie)?S:S||ce,classNames:K,styles:Q,unstyled:s,__staticSelector:"NumberInput",decimalScale:j?A:0,onKeyDown:ze,onKeyDownCapture:ve,rightSectionPointerEvents:F??(H?"none":void 0),rightSectionWidth:z??`var(--ni-right-section-width-${M||"sm"})`,allowLeadingZeros:P,onBlur:Ce,isAllowed:te=>C==="strict"?E?E(te)&&ak(te.floatValue,y,g):ak(te.floatValue,y,g):E?E(te):!0})});Jx.classes={...vi.classes,...u_};Jx.displayName="@mantine/core/NumberInput";const[Ere,lL]=Lu(),[Nre,_re]=Lu();var cL={card:"m_9dc8ae12"};const Cre={withBorder:!0},Ore=(e,{radius:t})=>({card:{"--card-radius":Qn(t)}}),wj=Ue((e,t)=>{const n=Pe("RadioCard",Cre,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,checked:u,mod:f,withBorder:p,value:g,onClick:y,name:v,onKeyDown:x,...S}=n,E=gt({name:"RadioCard",classes:cL,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Ore,rootSelector:"card"}),{dir:C}=gc(),_=lL(),j=typeof u=="boolean"?u:_?.value===g||!1,A=v||_?.name,T=k=>{if(x?.(k),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(k.nativeEvent.code)){k.preventDefault();const R=Array.from(document.querySelectorAll(`[role="radio"][name="${A||"__mantine"}"]`)),V=R.findIndex(B=>B===k.target),H=V+1>=R.length?0:V+1,F=V-1<0?R.length-1:V-1;k.nativeEvent.code==="ArrowDown"&&(R[H].focus(),R[H].click()),k.nativeEvent.code==="ArrowUp"&&(R[F].focus(),R[F].click()),k.nativeEvent.code==="ArrowLeft"&&(R[C==="ltr"?F:H].focus(),R[C==="ltr"?F:H].click()),k.nativeEvent.code==="ArrowRight"&&(R[C==="ltr"?H:F].focus(),R[C==="ltr"?H:F].click())}};return h.jsx(Nre,{value:{checked:j},children:h.jsx(Aa,{ref:t,mod:[{"with-border":p,checked:j},f],...E("card"),...S,role:"radio","aria-checked":j,name:A,onClick:k=>{y?.(k),_?.onChange(g||"")},onKeyDown:T})})});wj.displayName="@mantine/core/RadioCard";wj.classes=cL;const jre={},Yx=Ue((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:a,name:c,readOnly:u,...f}=Pe("RadioGroup",jre,e),p=gi(c),[g,y]=ho({value:n,defaultValue:r,finalValue:"",onChange:o}),v=x=>!u&&y(typeof x=="string"?x:x.currentTarget.value);return h.jsx(Ere,{value:{value:g,onChange:v,size:i,name:p},children:h.jsx(Lt.Wrapper,{size:i,ref:t,...s,...f,labelElement:"div",__staticSelector:"RadioGroup",children:h.jsx(W8,{role:"radiogroup",children:a})})})});Yx.classes=Lt.Wrapper.classes;Yx.displayName="@mantine/core/RadioGroup";function uL({size:e,style:t,...n}){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:Oe(e),height:Oe(e),...t},"aria-hidden":!0,...n,children:h.jsx("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"})})}var dL={indicator:"m_717d7ff6",icon:"m_3e4da632","indicator--outline":"m_2980836c"};const Are={icon:uL},Tre=(e,{radius:t,color:n,size:r,iconColor:o,variant:i,autoContrast:s})=>{const a=pc({color:n||e.primaryColor,theme:e}),c=a.isThemeColor&&a.shade===void 0?`var(--mantine-color-${a.color}-outline)`:a.color;return{indicator:{"--radio-size":jt(r,"radio-size"),"--radio-radius":t===void 0?void 0:Qn(t),"--radio-color":i==="outline"?c:Sr(n,e),"--radio-icon-size":jt(r,"radio-icon-size"),"--radio-icon-color":o?Sr(o,e):EO(s,e)?Ag({color:n,theme:e,autoContrast:s}):void 0}}},Sj=Ue((e,t)=>{const n=Pe("RadioIndicator",Are,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,icon:u,radius:f,color:p,iconColor:g,autoContrast:y,checked:v,mod:x,variant:S,disabled:E,...C}=n,_=u,j=gt({name:"RadioIndicator",classes:dL,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Tre,rootSelector:"indicator"}),A=_re(),T=typeof v=="boolean"?v:A?.checked||!1;return h.jsx(Fe,{ref:t,...j("indicator",{variant:S}),variant:S,mod:[{checked:T,disabled:E},x],...C,children:h.jsx(_,{...j("icon")})})});Sj.displayName="@mantine/core/RadioIndicator";Sj.classes=dL;var fL={root:"m_f3f1af94",inner:"m_89c4f5e4",icon:"m_f3ed6b2b",radio:"m_8a3dbb89","radio--outline":"m_1bfe9d39"};const $re={labelPosition:"right"},Rre=(e,{size:t,radius:n,color:r,iconColor:o,variant:i,autoContrast:s})=>{const a=pc({color:r||e.primaryColor,theme:e}),c=a.isThemeColor&&a.shade===void 0?`var(--mantine-color-${a.color}-outline)`:a.color;return{root:{"--radio-size":jt(t,"radio-size"),"--radio-radius":n===void 0?void 0:Qn(n),"--radio-color":i==="outline"?c:Sr(r,e),"--radio-icon-color":o?Sr(o,e):EO(s,e)?Ag({color:r,theme:e,autoContrast:s}):void 0,"--radio-icon-size":jt(t,"radio-icon-size")}}},Os=Ue((e,t)=>{const n=Pe("Radio",$re,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,id:u,size:f,label:p,labelPosition:g,description:y,error:v,radius:x,color:S,variant:E,disabled:C,wrapperProps:_,icon:j=uL,rootRef:A,iconColor:T,onChange:k,mod:R,...V}=n,H=gt({name:"Radio",classes:fL,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Rre}),F=lL(),B=F?.size??f,U=n.size?f:B,{styleProps:M,rest:z}=sh(V),$=gi(u),L=F?{checked:F.value===z.value,name:z.name??F.name,onChange:P=>{F.onChange(P),k?.(P)}}:{};return h.jsx(aj,{...H("root"),__staticSelector:"Radio",__stylesApiProps:n,id:$,size:U,labelPosition:g,label:p,description:y,error:v,disabled:C,classNames:r,styles:s,unstyled:a,"data-checked":L.checked||void 0,variant:E,ref:A,mod:R,...M,..._,children:h.jsxs(Fe,{...H("inner"),mod:{"label-position":g},children:[h.jsx(Fe,{...H("radio",{focusable:!0,variant:E}),onChange:k,...z,...L,component:"input",mod:{error:!!v},ref:t,id:$,disabled:C,type:"radio"}),h.jsx(j,{...H("icon"),"aria-hidden":!0})]})})});Os.classes=fL;Os.displayName="@mantine/core/Radio";Os.Group=Yx;Os.Card=wj;Os.Indicator=Sj;const kre={duration:100,transition:"fade"};function Mre(e,t){return{...kre,...t,...e}}function Pre({offset:e,position:t,defaultOpened:n}){const[r,o]=w.useState(n),i=w.useRef(null),{x:s,y:a,elements:c,refs:u,update:f,placement:p}=IO({placement:t,middleware:[kO({crossAxis:!0,padding:5,rootBoundary:"document"})]}),g=p.includes("right")?e:t.includes("left")?e*-1:0,y=p.includes("bottom")?e:t.includes("top")?e*-1:0,v=w.useCallback(({clientX:x,clientY:S})=>{u.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x,y:S,left:x+g,top:S+y,right:x,bottom:S}}})},[c.reference]);return w.useEffect(()=>{if(u.floating.current){const x=i.current;x.addEventListener("mousemove",v);const S=ba(u.floating.current);return S.forEach(E=>{E.addEventListener("scroll",f)}),()=>{x.removeEventListener("mousemove",v),S.forEach(E=>{E.removeEventListener("scroll",f)})}}},[c.reference,u.floating.current,f,v,r]),{handleMouseMove:v,x:s,y:a,opened:r,setOpened:o,boundaryRef:i,floating:u.setFloating}}var Kx={tooltip:"m_1b3c8819",arrow:"m_f898399f"};const Dre={refProp:"ref",withinPortal:!0,offset:10,defaultOpened:!1,position:"right",zIndex:ts("popover")},Ire=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:Qn(t),"--tooltip-bg":n?Sr(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),Ej=Ue((e,t)=>{const n=Pe("TooltipFloating",Dre,e),{children:r,refProp:o,withinPortal:i,style:s,className:a,classNames:c,styles:u,unstyled:f,radius:p,color:g,label:y,offset:v,position:x,multiline:S,zIndex:E,disabled:C,defaultOpened:_,variant:j,vars:A,portalProps:T,...k}=n,R=zo(),V=gt({name:"TooltipFloating",props:n,classes:Kx,className:a,style:s,classNames:c,styles:u,unstyled:f,rootSelector:"tooltip",vars:A,varsResolver:Ire}),{handleMouseMove:H,x:F,y:B,opened:U,boundaryRef:M,floating:z,setOpened:$}=Pre({offset:v,position:x,defaultOpened:_});if(!fc(r))throw new Error("[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const L=jn(M,Cx(r),t),P=r.props,q=D=>{P.onMouseEnter?.(D),H(D),$(!0)},Y=D=>{P.onMouseLeave?.(D),$(!1)};return h.jsxs(h.Fragment,{children:[h.jsx(Fu,{...T,withinPortal:i,children:h.jsx(Fe,{...k,...V("tooltip",{style:{...$9(s,R),zIndex:E,display:!C&&U?"block":"none",top:(B&&Math.round(B))??"",left:(F&&Math.round(F))??""}}),variant:j,ref:z,mod:{multiline:S},children:y})}),w.cloneElement(r,{...P,[o]:L,onMouseEnter:q,onMouseLeave:Y})]})});Ej.classes=Kx;Ej.displayName="@mantine/core/TooltipFloating";const hL=w.createContext(!1),Lre=hL.Provider,Fre=()=>w.useContext(hL),zre={openDelay:0,closeDelay:0};function Nj(e){const{openDelay:t,closeDelay:n,children:r}=Pe("TooltipGroup",zre,e);return h.jsx(Lre,{value:!0,children:h.jsx(nee,{delay:{open:t,close:n},children:r})})}Nj.displayName="@mantine/core/TooltipGroup";Nj.extend=e=>e;function Bre(e){if(e===void 0)return{shift:!0,flip:!0};const t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function Vre(e){const t=Bre(e.middlewares),n=[J9(e.offset)];return t.shift&&n.push(kO(typeof t.shift=="boolean"?{padding:8}:{padding:8,...t.shift})),t.flip&&n.push(typeof t.flip=="boolean"?uv():uv(t.flip)),n.push(Y9({element:e.arrowRef,padding:e.arrowOffset})),t.inline?n.push(typeof t.inline=="boolean"?am():am(t.inline)):e.inline&&n.push(am()),n}function Ure(e){const[t,n]=w.useState(e.defaultOpened),o=typeof e.opened=="boolean"?e.opened:t,i=Fre(),s=gi(),a=w.useCallback(T=>{n(T),T&&C(s)},[s]),{x:c,y:u,context:f,refs:p,update:g,placement:y,middlewareData:{arrow:{x:v,y:x}={}}}=IO({strategy:e.strategy,placement:e.position,open:o,onOpenChange:a,middleware:Vre(e)}),{delay:S,currentId:E,setCurrentId:C}=ree(f,{id:s}),{getReferenceProps:_,getFloatingProps:j}=uee([eee(f,{enabled:e.events?.hover,delay:i?S:{open:e.openDelay,close:e.closeDelay},mouseOnly:!e.events?.touch}),cee(f,{enabled:e.events?.focus,visibleOnly:!0}),fee(f,{role:"tooltip"}),aee(f,{enabled:typeof e.opened>"u"})]);w8({opened:o,position:e.position,positionDependencies:e.positionDependencies,floating:{refs:p,update:g}}),_a(()=>{e.onPositionChange?.(y)},[y]);const A=o&&E&&E!==s;return{x:c,y:u,arrowX:v,arrowY:x,reference:p.setReference,floating:p.setFloating,getFloatingProps:j,getReferenceProps:_,isGroupPhase:A,opened:o,placement:y}}const lk={position:"top",refProp:"ref",withinPortal:!0,inline:!1,defaultOpened:!1,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:"side",offset:5,transitionProps:{duration:100,transition:"fade"},events:{hover:!0,focus:!1,touch:!1},zIndex:ts("popover"),positionDependencies:[],middlewares:{flip:!0,shift:!0,inline:!1}},Hre=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:Qn(t),"--tooltip-bg":n?Sr(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),ns=Ue((e,t)=>{const n=Pe("Tooltip",lk,e),{children:r,position:o,refProp:i,label:s,openDelay:a,closeDelay:c,onPositionChange:u,opened:f,defaultOpened:p,withinPortal:g,radius:y,color:v,classNames:x,styles:S,unstyled:E,style:C,className:_,withArrow:j,arrowSize:A,arrowOffset:T,arrowRadius:k,arrowPosition:R,offset:V,transitionProps:H,multiline:F,events:B,zIndex:U,disabled:M,positionDependencies:z,onClick:$,onMouseEnter:L,onMouseLeave:P,inline:q,variant:Y,keepMounted:D,vars:W,portalProps:K,mod:Q,floatingStrategy:ie,middlewares:pe,...ue}=Pe("Tooltip",lk,n),{dir:se}=gc(),me=w.useRef(null),xe=Ure({position:p8(se,o),closeDelay:c,openDelay:a,onPositionChange:u,opened:f,defaultOpened:p,events:B,arrowRef:me,arrowOffset:T,offset:typeof V=="number"?V+(j?A/2:0):V,positionDependencies:[...z,r],inline:q,strategy:ie,middlewares:pe}),je=gt({name:"Tooltip",props:n,classes:Kx,className:_,style:C,classNames:x,styles:S,unstyled:E,rootSelector:"tooltip",vars:W,varsResolver:Hre});if(!fc(r))throw new Error("[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const _e=jn(xe.reference,Cx(r),t),Ee=Mre(H,{duration:100,transition:"fade"}),Re=r.props;return h.jsxs(h.Fragment,{children:[h.jsx(Fu,{...K,withinPortal:g,children:h.jsx(yc,{...Ee,keepMounted:D,mounted:!M&&!!xe.opened,duration:xe.isGroupPhase?10:Ee.duration,children:Me=>h.jsxs(Fe,{...ue,"data-fixed":ie==="fixed"||void 0,variant:Y,mod:[{multiline:F},Q],...xe.getFloatingProps({ref:xe.floating,className:je("tooltip").className,style:{...je("tooltip").style,...Me,zIndex:U,top:xe.y??0,left:xe.x??0}}),children:[s,h.jsx(UO,{ref:me,arrowX:xe.arrowX,arrowY:xe.arrowY,visible:j,position:xe.placement,arrowSize:A,arrowOffset:T,arrowRadius:k,arrowPosition:R,...je("arrow")})]})})}),w.cloneElement(r,xe.getReferenceProps({onClick:$,onMouseEnter:L,onMouseLeave:P,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,className:pn(_,Re.className),...Re,[i]:_e}))]})});ns.classes=Kx;ns.displayName="@mantine/core/Tooltip";ns.Floating=Ej;ns.Group=Nj;var pL={root:"m_cf365364",indicator:"m_9e182ccd",label:"m_1738fcb2",input:"m_1714d588",control:"m_69686b9b",innerLabel:"m_78882f40"};const qre={withItemsBorders:!0},Wre=(e,{radius:t,color:n,transitionDuration:r,size:o,transitionTimingFunction:i})=>({root:{"--sc-radius":t===void 0?void 0:Qn(t),"--sc-color":n?Sr(n,e):void 0,"--sc-shadow":n?void 0:"var(--mantine-shadow-xs)","--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":i,"--sc-padding":jt(o,"sc-padding"),"--sc-font-size":zr(o)}}),bc=Ue((e,t)=>{const n=Pe("SegmentedControl",qre,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,data:u,value:f,defaultValue:p,onChange:g,size:y,name:v,disabled:x,readOnly:S,fullWidth:E,orientation:C,radius:_,color:j,transitionDuration:A,transitionTimingFunction:T,variant:k,autoContrast:R,withItemsBorders:V,mod:H,...F}=n,B=gt({name:"SegmentedControl",props:n,classes:pL,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Wre}),U=zo(),M=u.map(se=>typeof se=="string"?{label:se,value:se}:se),z=AX(),[$,L]=w.useState(Yl()),[P,q]=w.useState(null),[Y,D]=w.useState({}),W=(se,me)=>{Y[me]=se,D(Y)},[K,Q]=ho({value:f,defaultValue:p,finalValue:Array.isArray(u)?M.find(se=>!se.disabled)?.value??u[0]?.value??null:null,onChange:g}),ie=gi(v),pe=M.map(se=>w.createElement(Fe,{...B("control"),mod:{active:K===se.value,orientation:C},key:se.value},w.createElement("input",{...B("input"),disabled:x||se.disabled,type:"radio",name:ie,value:se.value,id:`${ie}-${se.value}`,checked:K===se.value,onChange:()=>!S&&Q(se.value),"data-focus-ring":U.focusRing,key:`${se.value}-input`}),w.createElement(Fe,{component:"label",...B("label"),mod:{active:K===se.value&&!(x||se.disabled),disabled:x||se.disabled,"read-only":S},htmlFor:`${ie}-${se.value}`,ref:me=>W(me,se.value),__vars:{"--sc-label-color":j!==void 0?Ag({color:j,theme:U,autoContrast:R}):void 0},key:`${se.value}-label`},h.jsx("span",{...B("innerLabel"),children:se.label})))),ue=jn(t,se=>q(se));return bX(()=>{L(Yl())},[u.length]),u.length===0?null:h.jsxs(Fe,{...B("root"),variant:k,size:y,ref:ue,mod:[{"full-width":E,orientation:C,initialized:z,"with-items-borders":V},H],...F,role:"radiogroup","data-disabled":x,children:[typeof K=="string"&&h.jsx(JO,{target:Y[K],parent:P,component:"span",transitionDuration:"var(--sc-transition-duration)",...B("indicator")},$),pe]})});bc.classes=pL;bc.displayName="@mantine/core/SegmentedControl";const Gre={searchable:!1,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:"left"},Xx=Ue((e,t)=>{const n=Pe("Select",Gre,e),{classNames:r,styles:o,unstyled:i,vars:s,dropdownOpened:a,defaultDropdownOpened:c,onDropdownClose:u,onDropdownOpen:f,onFocus:p,onBlur:g,onClick:y,onChange:v,data:x,value:S,defaultValue:E,selectFirstOptionOnChange:C,onOptionSubmit:_,comboboxProps:j,readOnly:A,disabled:T,filter:k,limit:R,withScrollArea:V,maxDropdownHeight:H,size:F,searchable:B,rightSection:U,checkIconPosition:M,withCheckIcon:z,nothingFoundMessage:$,name:L,form:P,searchValue:q,defaultSearchValue:Y,onSearchChange:D,allowDeselect:W,error:K,rightSectionPointerEvents:Q,id:ie,clearable:pe,clearButtonProps:ue,hiddenInputProps:se,renderOption:me,onClear:xe,autoComplete:je,scrollAreaProps:_e,__defaultRightSection:Ee,__clearSection:Re,__clearable:Me,chevronColor:ze,...ve}=n,Ce=w.useMemo(()=>F8(x),[x]),Ae=w.useMemo(()=>YO(Ce),[Ce]),G=gi(ie),[re,ne,ce]=ho({value:S,defaultValue:E,finalValue:null,onChange:v}),te=typeof re=="string"?Ae[re]:void 0,Z=CX(te),[de,Te,$e]=ho({value:q,defaultValue:Y,finalValue:te?te.label:"",onChange:D}),Ke=sj({opened:a,defaultOpened:c,onDropdownOpen:()=>{f?.(),Ke.updateSelectedOptionIndex("active",{scrollIntoView:!0})},onDropdownClose:()=>{u?.(),Ke.resetSelectedOption()}}),At=Ut=>{Te(Ut),Ke.resetSelectedOption()},{resolvedClassNames:yn,resolvedStyles:ls}=ih({props:n,styles:o,classNames:r});w.useEffect(()=>{C&&Ke.selectFirstOption()},[C,de]),w.useEffect(()=>{S===null&&At(""),typeof S=="string"&&te&&(Z?.value!==te.value||Z?.label!==te.label)&&At(te.label)},[S,te]),w.useEffect(()=>{!ce&&!$e&&At(typeof re=="string"&&Ae[re]?.label||"")},[x,re]);const pr=h.jsx(Ct.ClearButton,{...ue,onClear:()=>{ne(null,null),At(""),xe?.()}}),dn=pe&&!!re&&!T&&!A;return h.jsxs(h.Fragment,{children:[h.jsxs(Ct,{store:Ke,__staticSelector:"Select",classNames:yn,styles:ls,unstyled:i,readOnly:A,onOptionSubmit:Ut=>{_?.(Ut);const nn=W&&Ae[Ut].value===re?null:Ae[Ut],qo=nn?nn.value:null;qo!==re&&ne(qo,nn),!ce&&At(typeof qo=="string"&&nn?.label||""),Ke.closeDropdown()},size:F,...j,children:[h.jsx(Ct.Target,{targetType:B?"input":"button",autoComplete:je,children:h.jsx(vi,{id:G,ref:t,__defaultRightSection:h.jsx(Ct.Chevron,{size:F,error:K,unstyled:i,color:ze}),__clearSection:pr,__clearable:dn,rightSection:U,rightSectionPointerEvents:Q||(dn?"all":"none"),...ve,size:F,__staticSelector:"Select",disabled:T,readOnly:A||!B,value:de,onChange:Ut=>{At(Ut.currentTarget.value),Ke.openDropdown(),C&&Ke.selectFirstOption()},onFocus:Ut=>{B&&Ke.openDropdown(),p?.(Ut)},onBlur:Ut=>{B&&Ke.closeDropdown(),At(re!=null&&Ae[re]?.label||""),g?.(Ut)},onClick:Ut=>{B?Ke.openDropdown():Ke.toggleDropdown(),y?.(Ut)},classNames:yn,styles:ls,unstyled:i,pointer:!B,error:K})}),h.jsx(K8,{data:Ce,hidden:A||T,filter:k,search:de,limit:R,hiddenWhenEmpty:!$,withScrollArea:V,maxDropdownHeight:H,filterOptions:B&&te?.label!==de,value:re,checkIconPosition:M,withCheckIcon:z,nothingFoundMessage:$,unstyled:i,labelId:ve.label?`${G}-label`:void 0,"aria-label":ve.label?void 0:ve["aria-label"],renderOption:me,scrollAreaProps:_e})]}),h.jsx(Ct.HiddenInput,{value:re,name:L,form:P,disabled:T,...se})]})});Xx.classes={...vi.classes,...Ct.classes};Xx.displayName="@mantine/core/Select";const[Jre,Qx]=Pa("SliderProvider was not found in tree"),mL=w.forwardRef(({size:e,disabled:t,variant:n,color:r,thumbSize:o,radius:i,...s},a)=>{const{getStyles:c}=Qx();return h.jsx(Fe,{tabIndex:-1,variant:n,size:e,ref:a,...c("root"),...s})});mL.displayName="@mantine/core/SliderRoot";const gL=w.forwardRef(({max:e,min:t,value:n,position:r,label:o,dragging:i,onMouseDown:s,onKeyDownCapture:a,labelTransitionProps:c,labelAlwaysOn:u,thumbLabel:f,onFocus:p,onBlur:g,showLabelOnHover:y,isHovered:v,children:x=null,disabled:S},E)=>{const{getStyles:C}=Qx(),[_,j]=w.useState(!1),A=u||i||_||y&&v;return h.jsxs(Fe,{tabIndex:0,role:"slider","aria-label":f,"aria-valuemax":e,"aria-valuemin":t,"aria-valuenow":n,ref:E,__vars:{"--slider-thumb-offset":`${r}%`},...C("thumb",{focusable:!0}),mod:{dragging:i,disabled:S},onFocus:T=>{j(!0),typeof p=="function"&&p(T)},onBlur:T=>{j(!1),typeof g=="function"&&g(T)},onTouchStart:s,onMouseDown:s,onKeyDownCapture:a,onClick:T=>T.stopPropagation(),children:[x,h.jsx(yc,{mounted:o!=null&&!!A,transition:"fade",duration:0,...c,children:T=>h.jsx("div",{...C("label",{style:T}),children:o})})]})});gL.displayName="@mantine/core/SliderThumb";function yL({value:e,min:t,max:n}){const r=(e-t)/(n-t)*100;return Math.min(Math.max(r,0),100)}function Yre({mark:e,offset:t,value:n,inverted:r=!1}){return r?typeof t=="number"&&e.value<=t||e.value>=n:typeof t=="number"?e.value>=t&&e.value<=n:e.value<=n}function bL({marks:e,min:t,max:n,disabled:r,value:o,offset:i,inverted:s}){const{getStyles:a}=Qx();if(!e)return null;const c=e.map((u,f)=>w.createElement(Fe,{...a("markWrapper"),__vars:{"--mark-offset":`${yL({value:u.value,min:t,max:n})}%`},key:f},h.jsx(Fe,{...a("mark"),mod:{filled:Yre({mark:u,value:o,offset:i,inverted:s}),disabled:r}}),u.label&&h.jsx("div",{...a("markLabel"),children:u.label})));return h.jsx("div",{children:c})}bL.displayName="@mantine/core/SliderMarks";function vL({filled:e,children:t,offset:n,disabled:r,marksOffset:o,inverted:i,containerProps:s,...a}){const{getStyles:c}=Qx();return h.jsx(Fe,{...c("trackContainer"),mod:{disabled:r},...s,children:h.jsxs(Fe,{...c("track"),mod:{inverted:i,disabled:r},children:[h.jsx(Fe,{mod:{inverted:i,disabled:r},__vars:{"--slider-bar-width":`calc(${e}% + var(--slider-size))`,"--slider-bar-offset":`calc(${n}% - var(--slider-size))`},...c("bar")}),t,h.jsx(bL,{...a,offset:o,disabled:r,inverted:i})]})})}vL.displayName="@mantine/core/SliderTrack";function Kre({value:e,containerWidth:t,min:n,max:r,step:o,precision:i}){const a=(t?Math.min(Math.max(e,0),t)/t:e)*(r-n),c=(a!==0?Math.round(a/o)*o:0)+n,u=Math.max(c,n);return i!==void 0?Number(u.toFixed(i)):u}function q0(e,t){return parseFloat(e.toFixed(t))}function Xre(e){if(!e)return 0;const t=e.toString().split(".");return t.length>1?t[1].length:0}function l2(e,t){const r=[...t].sort((o,i)=>o.value-i.value).find(o=>o.value>e);return r?r.value:e}function c2(e,t){const r=[...t].sort((o,i)=>i.value-o.value).find(o=>o.value<e);return r?r.value:e}function ck(e){const t=[...e].sort((n,r)=>n.value-r.value);return t.length>0?t[0].value:0}function uk(e){const t=[...e].sort((n,r)=>n.value-r.value);return t.length>0?t[t.length-1].value:100}var xL={root:"m_dd36362e",label:"m_c9357328",thumb:"m_c9a9a60a",trackContainer:"m_a8645c2",track:"m_c9ade57f",bar:"m_38aeed47",markWrapper:"m_b7b0423a",mark:"m_dd33bc19",markLabel:"m_68c77a5b"};const Qre={radius:"xl",min:0,max:100,step:1,marks:[],label:e=>e,labelTransitionProps:{transition:"fade",duration:0},labelAlwaysOn:!1,thumbLabel:"",showLabelOnHover:!0,disabled:!1,scale:e=>e},Zre=(e,{size:t,color:n,thumbSize:r,radius:o})=>({root:{"--slider-size":jt(t,"slider-size"),"--slider-color":n?Sr(n,e):void 0,"--slider-radius":o===void 0?void 0:Qn(o),"--slider-thumb-size":r!==void 0?Oe(r):"calc(var(--slider-size) * 2)"}}),_j=Ue((e,t)=>{const n=Pe("Slider",Qre,e),{classNames:r,styles:o,value:i,onChange:s,onChangeEnd:a,size:c,min:u,max:f,step:p,precision:g,defaultValue:y,name:v,marks:x,label:S,labelTransitionProps:E,labelAlwaysOn:C,thumbLabel:_,showLabelOnHover:j,thumbChildren:A,disabled:T,unstyled:k,scale:R,inverted:V,className:H,style:F,vars:B,hiddenInputProps:U,restrictToMarks:M,thumbProps:z,...$}=n,L=gt({name:"Slider",props:n,classes:xL,classNames:r,className:H,styles:o,style:F,vars:B,varsResolver:Zre,unstyled:k}),{dir:P}=gc(),[q,Y]=w.useState(!1),[D,W]=ho({value:typeof i=="number"?ya(i,u,f):i,defaultValue:typeof y=="number"?ya(y,u,f):y,finalValue:ya(0,u,f),onChange:s}),K=w.useRef(D),Q=w.useRef(a);w.useEffect(()=>{Q.current=a},[a]);const ie=w.useRef(null),pe=w.useRef(null),ue=yL({value:D,min:u,max:f}),se=R(D),me=typeof S=="function"?S(se):S,xe=g??Xre(p),je=w.useCallback(({x:ve})=>{if(!T){const Ce=Kre({value:ve,min:u,max:f,step:p,precision:xe});W(M&&x?.length?bR(Ce,x.map(Ae=>Ae.value)):Ce),K.current=Ce}},[T,u,f,p,xe,W,x,M]),_e=w.useCallback(()=>{if(!T&&Q.current){const ve=M&&x?.length?bR(K.current,x.map(Ce=>Ce.value)):K.current;Q.current(ve)}},[T,x,M]),{ref:Ee,active:Re}=mX(je,{onScrubEnd:_e},P),Me=w.useCallback(ve=>{!T&&Q.current&&Q.current(ve)},[T]),ze=ve=>{if(!T)switch(ve.key){case"ArrowUp":{if(ve.preventDefault(),pe.current?.focus(),M&&x){const Ae=l2(D,x);W(Ae),Me(Ae);break}const Ce=q0(Math.min(Math.max(D+p,u),f),xe);W(Ce),Me(Ce);break}case"ArrowRight":{if(ve.preventDefault(),pe.current?.focus(),M&&x){const Ae=P==="rtl"?c2(D,x):l2(D,x);W(Ae),Me(Ae);break}const Ce=q0(Math.min(Math.max(P==="rtl"?D-p:D+p,u),f),xe);W(Ce),Me(Ce);break}case"ArrowDown":{if(ve.preventDefault(),pe.current?.focus(),M&&x){const Ae=c2(D,x);W(Ae),Me(Ae);break}const Ce=q0(Math.min(Math.max(D-p,u),f),xe);W(Ce),Me(Ce);break}case"ArrowLeft":{if(ve.preventDefault(),pe.current?.focus(),M&&x){const Ae=P==="rtl"?l2(D,x):c2(D,x);W(Ae),Me(Ae);break}const Ce=q0(Math.min(Math.max(P==="rtl"?D+p:D-p,u),f),xe);W(Ce),Me(Ce);break}case"Home":{if(ve.preventDefault(),pe.current?.focus(),M&&x){W(ck(x)),Me(ck(x));break}W(u),Me(u);break}case"End":{if(ve.preventDefault(),pe.current?.focus(),M&&x){W(uk(x)),Me(uk(x));break}W(f),Me(f);break}}};return h.jsx(Jre,{value:{getStyles:L},children:h.jsxs(mL,{...$,ref:jn(t,ie),onKeyDownCapture:ze,onMouseDownCapture:()=>ie.current?.focus(),size:c,disabled:T,children:[h.jsx(vL,{inverted:V,offset:0,filled:ue,marks:x,min:u,max:f,value:se,disabled:T,containerProps:{ref:Ee,onMouseEnter:j?()=>Y(!0):void 0,onMouseLeave:j?()=>Y(!1):void 0},children:h.jsx(gL,{max:f,min:u,value:se,position:ue,dragging:Re,label:me,ref:pe,labelTransitionProps:E,labelAlwaysOn:C,thumbLabel:_,showLabelOnHover:j,isHovered:q,disabled:T,...z,children:A})}),h.jsx("input",{type:"hidden",name:v,value:se,...U})]})})});_j.classes=xL;_j.displayName="@mantine/core/Slider";const wL=w.createContext(null),eoe=wL.Provider,toe=()=>w.useContext(wL),noe={},Cj=Ue((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:a,readOnly:c,...u}=Pe("SwitchGroup",noe,e),[f,p]=ho({value:n,defaultValue:r,finalValue:[],onChange:o}),g=y=>{const v=y.currentTarget.value;!c&&p(f.includes(v)?f.filter(x=>x!==v):[...f,v])};return h.jsx(eoe,{value:{value:f,onChange:g,size:i},children:h.jsx(Lt.Wrapper,{size:i,ref:t,...s,...u,labelElement:"div",__staticSelector:"SwitchGroup",children:h.jsx(W8,{role:"group",children:a})})})});Cj.classes=Lt.Wrapper.classes;Cj.displayName="@mantine/core/SwitchGroup";var SL={root:"m_5f93f3bb",input:"m_926b4011",track:"m_9307d992",thumb:"m_93039a1d",trackLabel:"m_8277e082"};const roe={labelPosition:"right"},ooe=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:Qn(t),"--switch-height":jt(r,"switch-height"),"--switch-width":jt(r,"switch-width"),"--switch-thumb-size":jt(r,"switch-thumb-size"),"--switch-label-font-size":jt(r,"switch-label-font-size"),"--switch-track-label-padding":jt(r,"switch-track-label-padding"),"--switch-color":n?Sr(n,e):void 0}}),vc=Ue((e,t)=>{const n=Pe("Switch",roe,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,color:u,label:f,offLabel:p,onLabel:g,id:y,size:v,radius:x,wrapperProps:S,thumbIcon:E,checked:C,defaultChecked:_,onChange:j,labelPosition:A,description:T,error:k,disabled:R,variant:V,rootRef:H,mod:F,...B}=n,U=toe(),M=v||U?.size,z=gt({name:"Switch",props:n,classes:SL,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:ooe}),{styleProps:$,rest:L}=sh(B),P=gi(y),q=U?{checked:U.value.includes(L.value),onChange:U.onChange}:{},[Y,D]=ho({value:q.checked??C,defaultValue:_,finalValue:!1});return h.jsxs(aj,{...z("root"),__staticSelector:"Switch",__stylesApiProps:n,id:P,size:M,labelPosition:A,label:f,description:T,error:k,disabled:R,bodyElement:"label",labelElement:"span",classNames:r,styles:s,unstyled:a,"data-checked":q.checked||C||void 0,variant:V,ref:H,mod:F,...$,...S,children:[h.jsx("input",{...L,disabled:R,checked:Y,"data-checked":q.checked||C||void 0,onChange:W=>{U?q.onChange?.(W):j?.(W),D(W.currentTarget.checked)},id:P,ref:t,type:"checkbox",role:"switch",...z("input")}),h.jsxs(Fe,{"aria-hidden":"true",component:"span",mod:{error:k,"label-position":A,"without-labels":!g&&!p},...z("track"),children:[h.jsx(Fe,{component:"span",mod:"reduce-motion",...z("thumb"),children:E}),h.jsx("span",{...z("trackLabel"),children:Y?g:p})]})]})});vc.classes={...SL,...Ute};vc.displayName="@mantine/core/Switch";vc.Group=Cj;const[ioe,Oj]=Pa("Tabs component was not found in the tree");var Pg={root:"m_89d60db1","list--default":"m_576c9d4",list:"m_89d33d6d",panel:"m_b0c91715",tab:"m_4ec4dce6",tabSection:"m_fc420b1f","tab--default":"m_539e827b","list--outline":"m_6772fbd5","tab--outline":"m_b59ab47c","tab--pills":"m_c3381914"};const soe={},jj=Ue((e,t)=>{const n=Pe("TabsList",soe,e),{children:r,className:o,grow:i,justify:s,classNames:a,styles:c,style:u,mod:f,...p}=n,g=Oj();return h.jsx(Fe,{...p,...g.getStyles("list",{className:o,style:u,classNames:a,styles:c,props:n,variant:g.variant}),ref:t,role:"tablist",variant:g.variant,mod:[{grow:i,orientation:g.orientation,placement:g.orientation==="vertical"&&g.placement,inverted:g.inverted},f],"aria-orientation":g.orientation,__vars:{"--tabs-justify":s},children:r})});jj.classes=Pg;jj.displayName="@mantine/core/TabsList";const aoe={},Aj=Ue((e,t)=>{const n=Pe("TabsPanel",aoe,e),{children:r,className:o,value:i,classNames:s,styles:a,style:c,mod:u,keepMounted:f,...p}=n,g=Oj(),y=g.value===i,v=g.keepMounted||f||y?r:null;return h.jsx(Fe,{...p,...g.getStyles("panel",{className:o,classNames:s,styles:a,style:[c,y?void 0:{display:"none"}],props:n}),ref:t,mod:[{orientation:g.orientation},u],role:"tabpanel",id:g.getPanelId(i),"aria-labelledby":g.getTabId(i),children:v})});Aj.classes=Pg;Aj.displayName="@mantine/core/TabsPanel";const loe={},Tj=Ue((e,t)=>{const n=Pe("TabsTab",loe,e),{className:r,children:o,rightSection:i,leftSection:s,value:a,onClick:c,onKeyDown:u,disabled:f,color:p,style:g,classNames:y,styles:v,vars:x,mod:S,tabIndex:E,...C}=n,_=zo(),{dir:j}=gc(),A=Oj(),T=a===A.value,k=V=>{A.onChange(A.allowTabDeactivation&&a===A.value?null:a),c?.(V)},R={classNames:y,styles:v,props:n};return h.jsxs(Aa,{...C,...A.getStyles("tab",{className:r,style:g,variant:A.variant,...R}),disabled:f,unstyled:A.unstyled,variant:A.variant,mod:[{active:T,disabled:f,orientation:A.orientation,inverted:A.inverted,placement:A.orientation==="vertical"&&A.placement},S],ref:t,role:"tab",id:A.getTabId(a),"aria-selected":T,tabIndex:E!==void 0?E:T||A.value===null?0:-1,"aria-controls":A.getPanelId(a),onClick:k,__vars:{"--tabs-color":p?Sr(p,_):void 0},onKeyDown:g9({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:A.activateTabWithKeyboard,loop:A.loop,orientation:A.orientation||"horizontal",dir:j,onKeyDown:u}),children:[s&&h.jsx("span",{...A.getStyles("tabSection",R),"data-position":"left",children:s}),o&&h.jsx("span",{...A.getStyles("tabLabel",R),children:o}),i&&h.jsx("span",{...A.getStyles("tabSection",R),"data-position":"right",children:i})]})});Tj.classes=Pg;Tj.displayName="@mantine/core/TabsTab";const dk="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",coe={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},uoe=(e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":Qn(t),"--tabs-color":Sr(n,e),"--tabs-text-color":EO(r,e)?Ag({color:n,theme:e,autoContrast:r}):void 0}}),xn=Ue((e,t)=>{const n=Pe("Tabs",coe,e),{defaultValue:r,value:o,onChange:i,orientation:s,children:a,loop:c,id:u,activateTabWithKeyboard:f,allowTabDeactivation:p,variant:g,color:y,radius:v,inverted:x,placement:S,keepMounted:E,classNames:C,styles:_,unstyled:j,className:A,style:T,vars:k,autoContrast:R,mod:V,...H}=n,F=gi(u),[B,U]=ho({value:o,defaultValue:r,finalValue:null,onChange:i}),M=gt({name:"Tabs",props:n,classes:Pg,className:A,style:T,classNames:C,styles:_,unstyled:j,vars:k,varsResolver:uoe});return h.jsx(ioe,{value:{placement:S,value:B,orientation:s,id:F,loop:c,activateTabWithKeyboard:f,getTabId:mR(`${F}-tab`,dk),getPanelId:mR(`${F}-panel`,dk),onChange:U,allowTabDeactivation:p,variant:g,color:y,radius:v,inverted:x,keepMounted:E,unstyled:j,getStyles:M},children:h.jsx(Fe,{ref:t,id:F,variant:g,mod:[{orientation:s,inverted:s==="horizontal"&&x,placement:s==="vertical"&&S},V],...M("root"),...H,children:a})})});xn.classes=Pg;xn.displayName="@mantine/core/Tabs";xn.Tab=Tj;xn.Panel=Aj;xn.List=jj;function doe({data:e,value:t}){const n=t.map(o=>o.trim().toLowerCase());return e.reduce((o,i)=>(Af(i)?o.push({group:i.group,items:i.items.filter(s=>n.indexOf(s.label.toLowerCase().trim())===-1)}):n.indexOf(i.label.toLowerCase().trim())===-1&&o.push(i),o),[])}function foe(e,t){return e?t.split(new RegExp(`[${e.join("")}]`)).map(n=>n.trim()).filter(n=>n!==""):[t]}function fk({splitChars:e,allowDuplicates:t,maxTags:n,value:r,currentTags:o}){const i=foe(e,r),s=t?[...o,...i]:[...new Set([...o,...i])];return n?s.slice(0,n):s}const hoe={maxTags:1/0,allowDuplicates:!1,acceptValueOnBlur:!0,splitChars:[","],hiddenInputValuesDivider:","},$j=Ue((e,t)=>{const n=Pe("TagsInput",hoe,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,size:u,value:f,defaultValue:p,onChange:g,onKeyDown:y,maxTags:v,allowDuplicates:x,onDuplicate:S,variant:E,data:C,dropdownOpened:_,defaultDropdownOpened:j,onDropdownOpen:A,onDropdownClose:T,selectFirstOptionOnChange:k,onOptionSubmit:R,comboboxProps:V,filter:H,limit:F,withScrollArea:B,maxDropdownHeight:U,searchValue:M,defaultSearchValue:z,onSearchChange:$,readOnly:L,disabled:P,splitChars:q,onFocus:Y,onBlur:D,onPaste:W,radius:K,rightSection:Q,rightSectionWidth:ie,rightSectionPointerEvents:pe,rightSectionProps:ue,leftSection:se,leftSectionWidth:me,leftSectionPointerEvents:xe,leftSectionProps:je,inputContainer:_e,inputWrapperOrder:Ee,withAsterisk:Re,required:Me,labelProps:ze,descriptionProps:ve,errorProps:Ce,wrapperProps:Ae,description:G,label:re,error:ne,withErrorStyles:ce,name:te,form:Z,id:de,clearable:Te,clearButtonProps:$e,hiddenInputProps:Ke,hiddenInputValuesDivider:At,mod:yn,renderOption:ls,onRemove:pr,onClear:dn,scrollAreaProps:Ut,acceptValueOnBlur:nn,...qo}=n,cs=gi(de),Ku=F8(C),Ja=YO(Ku),Is=w.useRef(null),Ya=jn(Is,t),Wn=sj({opened:_,defaultOpened:j,onDropdownOpen:A,onDropdownClose:()=>{T?.(),Wn.resetSelectedOption()}}),{styleProps:Ka,rest:{type:Xa,autoComplete:Ih,...Xu}}=sh(qo),[rn,Cr]=ho({value:f,defaultValue:p,finalValue:[],onChange:g}),[Ei,Qu]=ho({value:M,defaultValue:z,finalValue:"",onChange:$}),Ni=lt=>{Qu(lt),Wn.resetSelectedOption()},Qa=gt({name:"TagsInput",classes:{},props:n,classNames:r,styles:s,unstyled:a}),{resolvedClassNames:Za,resolvedStyles:el}=ih({props:n,styles:s,classNames:r}),Ac=lt=>{const tr=rn.some(vo=>vo.toLowerCase()===lt.toLowerCase());tr&&S?.(lt),(!tr||tr&&x)&&rn.length<v&&(R?.(lt),Ni(""),lt.length>0&&Cr([...rn,lt]))},Zu=lt=>{if(y?.(lt),lt.isPropagationStopped())return;const tr=Ei.trim(),{length:vo}=tr;if(q.includes(lt.key)&&vo>0&&(Cr(fk({splitChars:q,allowDuplicates:x,maxTags:v,value:Ei,currentTags:rn})),Ni(""),lt.preventDefault()),lt.key==="Enter"&&vo>0&&!lt.nativeEvent.isComposing){if(lt.preventDefault(),!!document.querySelector(`#${Wn.listId} [data-combobox-option][data-combobox-selected]`))return;Ac(tr)}lt.key==="Backspace"&&vo===0&&rn.length>0&&!lt.nativeEvent.isComposing&&(pr?.(rn[rn.length-1]),Cr(rn.slice(0,rn.length-1)))},Wo=lt=>{if(W?.(lt),lt.preventDefault(),lt.clipboardData){const tr=lt.clipboardData.getData("text/plain");Cr(fk({splitChars:q,allowDuplicates:x,maxTags:v,value:`${Ei}${tr}`,currentTags:rn})),Ni("")}},Tn=rn.map((lt,tr)=>h.jsx(Am,{withRemoveButton:!L,onRemove:()=>{const vo=rn.slice();vo.splice(tr,1),Cr(vo),pr?.(lt)},unstyled:a,disabled:P,...Qa("pill"),children:lt},`${lt}-${tr}`));w.useEffect(()=>{k&&Wn.selectFirstOption()},[k,rn,Ei]);const er=h.jsx(Ct.ClearButton,{...$e,onClear:()=>{Cr([]),Ni(""),Is.current?.focus(),Wn.openDropdown(),dn?.()}});return h.jsxs(h.Fragment,{children:[h.jsxs(Ct,{store:Wn,classNames:Za,styles:el,unstyled:a,size:u,readOnly:L,__staticSelector:"TagsInput",onOptionSubmit:lt=>{R?.(lt),Ni(""),rn.length<v&&Cr([...rn,Ja[lt].label]),Wn.resetSelectedOption()},...V,children:[h.jsx(Ct.DropdownTarget,{children:h.jsx(dv,{...Ka,__staticSelector:"TagsInput",classNames:Za,styles:el,unstyled:a,size:u,className:o,style:i,variant:E,disabled:P,radius:K,rightSection:Q,__clearSection:er,__clearable:Te&&rn.length>0&&!P&&!L,rightSectionWidth:ie,rightSectionPointerEvents:pe,rightSectionProps:ue,leftSection:se,leftSectionWidth:me,leftSectionPointerEvents:xe,leftSectionProps:je,inputContainer:_e,inputWrapperOrder:Ee,withAsterisk:Re,required:Me,labelProps:ze,descriptionProps:ve,errorProps:Ce,wrapperProps:Ae,description:G,label:re,error:ne,withErrorStyles:ce,__stylesApiProps:{...n,multiline:!0},id:cs,mod:yn,children:h.jsxs(Am.Group,{disabled:P,unstyled:a,...Qa("pillsList"),children:[Tn,h.jsx(Ct.EventsTarget,{autoComplete:Ih,children:h.jsx(dv.Field,{...Xu,ref:Ya,...Qa("inputField"),unstyled:a,onKeyDown:Zu,onFocus:lt=>{Y?.(lt),Wn.openDropdown()},onBlur:lt=>{D?.(lt),nn&&Ac(Ei),Wn.closeDropdown()},onPaste:Wo,value:Ei,onChange:lt=>Ni(lt.currentTarget.value),required:Me&&rn.length===0,disabled:P,readOnly:L,id:cs})})]})})}),h.jsx(K8,{data:doe({data:Ku,value:rn}),hidden:L||P,filter:H,search:Ei,limit:F,hiddenWhenEmpty:!0,withScrollArea:B,maxDropdownHeight:U,unstyled:a,labelId:re?`${cs}-label`:void 0,"aria-label":re?void 0:qo["aria-label"],renderOption:ls,scrollAreaProps:Ut})]}),h.jsx(Ct.HiddenInput,{name:te,form:Z,value:rn,valuesDivider:At,disabled:P,...Ke})]})});$j.classes={...vi.classes,...Ct.classes};$j.displayName="@mantine/core/TagsInput";const poe={},_n=Ue((e,t)=>{const n=Pe("TextInput",poe,e);return h.jsx(vi,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});_n.classes=vi.classes;_n.displayName="@mantine/core/TextInput";function moe(e){let t=e,n=!1;const r=new Set;return{getState(){return t},updateState(o){t=typeof o=="function"?o(t):o},setState(o){this.updateState(o),r.forEach(i=>i(t))},initialize(o){n||(t=o,n=!0)},subscribe(o){return r.add(o),()=>r.delete(o)}}}function goe(e){return w.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}function yoe(e,t,n){const r=[],o=[],i={};for(const s of e){const a=s.position||t;i[a]=i[a]||0,i[a]+=1,i[a]<=n?o.push(s):r.push(s)}return{notifications:o,queue:r}}const boe=()=>moe({notifications:[],queue:[],defaultPosition:"bottom-right",limit:5}),zu=boe(),voe=(e=zu)=>goe(e);function mh(e,t){const n=e.getState(),r=t([...n.notifications,...n.queue]),o=yoe(r,n.defaultPosition,n.limit);e.setState({notifications:o.notifications,queue:o.queue,limit:n.limit,defaultPosition:n.defaultPosition})}function xoe(e,t=zu){const n=e.id||Yl();return mh(t,r=>e.id&&r.some(o=>o.id===e.id)?r:[...r,{...e,id:n}]),n}function EL(e,t=zu){return mh(t,n=>n.filter(r=>r.id===e?(r.onClose?.(r),!1):!0)),e}function woe(e,t=zu){return mh(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function Soe(e=zu){mh(e,()=>[])}function Eoe(e=zu){mh(e,t=>t.slice(0,e.getState().limit))}const ci={show:xoe,hide:EL,update:woe,clean:Soe,cleanQueue:Eoe,updateState:mh};function f_(e,t){return f_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},f_(e,t)}function NL(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,f_(e,t)}const hk={disabled:!1},fv=Ne.createContext(null);var Noe=function(t){return t.scrollTop},Zp="unmounted",Xc="exited",Qc="entering",Xd="entered",h_="exiting",La=function(e){NL(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=o,a=s&&!s.isMounting?r.enter:r.appear,c;return i.appearStatus=null,r.in?a?(c=Xc,i.appearStatus=Qc):c=Xd:r.unmountOnExit||r.mountOnEnter?c=Zp:c=Xc,i.state={status:c},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var s=o.in;return s&&i.status===Zp?{status:Xc}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var s=this.state.status;this.props.in?s!==Qc&&s!==Xd&&(i=Qc):(s===Qc||s===Xd)&&(i=h_)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,s,a;return i=s=a=o,o!=null&&typeof o!="number"&&(i=o.exit,s=o.enter,a=o.appear!==void 0?o.appear:s),{exit:i,enter:s,appear:a}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===Qc){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:sf.findDOMNode(this);s&&Noe(s)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Xc&&this.setState({status:Zp})},n.performEnter=function(o){var i=this,s=this.props.enter,a=this.context?this.context.isMounting:o,c=this.props.nodeRef?[a]:[sf.findDOMNode(this),a],u=c[0],f=c[1],p=this.getTimeouts(),g=a?p.appear:p.enter;if(!o&&!s||hk.disabled){this.safeSetState({status:Xd},function(){i.props.onEntered(u)});return}this.props.onEnter(u,f),this.safeSetState({status:Qc},function(){i.props.onEntering(u,f),i.onTransitionEnd(g,function(){i.safeSetState({status:Xd},function(){i.props.onEntered(u,f)})})})},n.performExit=function(){var o=this,i=this.props.exit,s=this.getTimeouts(),a=this.props.nodeRef?void 0:sf.findDOMNode(this);if(!i||hk.disabled){this.safeSetState({status:Xc},function(){o.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:h_},function(){o.props.onExiting(a),o.onTransitionEnd(s.exit,function(){o.safeSetState({status:Xc},function(){o.props.onExited(a)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,s=!0;return this.nextCallback=function(a){s&&(s=!1,i.nextCallback=null,o(a))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var s=this.props.nodeRef?this.props.nodeRef.current:sf.findDOMNode(this),a=o==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],u=c[0],f=c[1];this.props.addEndListener(u,f)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===Zp)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var a=uj(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Ne.createElement(fv.Provider,{value:null},typeof s=="function"?s(o,a):Ne.cloneElement(Ne.Children.only(s),a))},t}(Ne.Component);La.contextType=fv;La.propTypes={};function Ud(){}La.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Ud,onEntering:Ud,onEntered:Ud,onExit:Ud,onExiting:Ud,onExited:Ud};La.UNMOUNTED=Zp;La.EXITED=Xc;La.ENTERING=Qc;La.ENTERED=Xd;La.EXITING=h_;function _oe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rj(e,t){var n=function(i){return t&&w.isValidElement(i)?t(i):i},r=Object.create(null);return e&&w.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function Coe(e,t){e=e||{},t=t||{};function n(f){return f in t?t[f]:e[f]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var s,a={};for(var c in t){if(r[c])for(s=0;s<r[c].length;s++){var u=r[c][s];a[r[c][s]]=n(u)}a[c]=n(c)}for(s=0;s<o.length;s++)a[o[s]]=n(o[s]);return a}function du(e,t,n){return n[t]!=null?n[t]:e.props[t]}function Ooe(e,t){return Rj(e.children,function(n){return w.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:du(n,"appear",e),enter:du(n,"enter",e),exit:du(n,"exit",e)})})}function joe(e,t,n){var r=Rj(e.children),o=Coe(t,r);return Object.keys(o).forEach(function(i){var s=o[i];if(w.isValidElement(s)){var a=i in t,c=i in r,u=t[i],f=w.isValidElement(u)&&!u.props.in;c&&(!a||f)?o[i]=w.cloneElement(s,{onExited:n.bind(null,s),in:!0,exit:du(s,"exit",e),enter:du(s,"enter",e)}):!c&&a&&!f?o[i]=w.cloneElement(s,{in:!1}):c&&a&&w.isValidElement(u)&&(o[i]=w.cloneElement(s,{onExited:n.bind(null,s),in:u.props.in,exit:du(s,"exit",e),enter:du(s,"enter",e)}))}}),o}var Aoe=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Toe={component:"div",childFactory:function(t){return t}},Il=function(e){NL(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=i.handleExited.bind(_oe(i));return i.state={contextValue:{isMounting:!0},handleExited:s,firstRender:!0},i}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(o,i){var s=i.children,a=i.handleExited,c=i.firstRender;return{children:c?Ooe(o,a):joe(o,s,a),firstRender:!1}},n.handleExited=function(o,i){var s=Rj(this.props.children);o.key in s||(o.props.onExited&&o.props.onExited(i),this.mounted&&this.setState(function(a){var c=Tf({},a.children);return delete c[o.key],{children:c}}))},n.render=function(){var o=this.props,i=o.component,s=o.childFactory,a=uj(o,["component","childFactory"]),c=this.state.contextValue,u=Aoe(this.state.children).map(s);return delete a.appear,delete a.enter,delete a.exit,i===null?Ne.createElement(fv.Provider,{value:c},u):Ne.createElement(fv.Provider,{value:c},Ne.createElement(i,a,u))},t}(Ne.Component);Il.propTypes={};Il.defaultProps=Toe;const _L=["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right"];function $oe(e,t){return e.reduce((n,r)=>(n[r.position||t].push(r),n),_L.reduce((n,r)=>(n[r]=[],n),{}))}const pk={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},Roe={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function koe({state:e,maxHeight:t,position:n,transitionDuration:r}){const[o,i]=n.split("-"),s=i==="center"?`${o}-center`:i,a={opacity:0,maxHeight:t,transform:pk[s],transitionDuration:`${r}ms, ${r}ms, ${r}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height"},c={opacity:1,transform:Roe[s]},u={opacity:0,maxHeight:0,transform:pk[s]};return{...a,...{entering:c,entered:c,exiting:u,exited:u}[e]}}function Moe(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const CL=w.forwardRef(({data:e,onHide:t,autoClose:n,...r},o)=>{const{autoClose:i,message:s,...a}=e,c=Moe(n,e.autoClose),u=w.useRef(-1),f=()=>window.clearTimeout(u.current),p=()=>{t(e.id),f()},g=()=>{typeof c=="number"&&(u.current=window.setTimeout(p,c))};return w.useEffect(()=>{e.onOpen?.(e)},[]),w.useEffect(()=>(g(),f),[c]),h.jsx(vj,{...r,...a,onClose:p,ref:o,onMouseEnter:f,onMouseLeave:g,children:s})});CL.displayName="@mantine/notifications/NotificationContainer";var OL={root:"m_b37d9ac7",notification:"m_5ed0edd0"};const Poe=La,Doe={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:ts("overlay"),store:zu,withinPortal:!0},Ioe=(e,{zIndex:t,containerWidth:n})=>({root:{"--notifications-z-index":t?.toString(),"--notifications-container-width":Oe(n)}}),ks=Ue((e,t)=>{const n=Pe("Notifications",Doe,e),{classNames:r,className:o,style:i,styles:s,unstyled:a,vars:c,position:u,autoClose:f,transitionDuration:p,containerWidth:g,notificationMaxHeight:y,limit:v,zIndex:x,store:S,portalProps:E,withinPortal:C,..._}=n,j=zo(),A=voe(S),T=dX(),k=yO(),R=w.useRef({}),V=w.useRef(0),F=(j.respectReducedMotion?k:!1)?1:p,B=gt({name:"Notifications",classes:OL,props:n,className:o,style:i,classNames:r,styles:s,unstyled:a,vars:c,varsResolver:Ioe});w.useEffect(()=>{S?.updateState(z=>({...z,limit:v||5,defaultPosition:u}))},[v,u]),_a(()=>{A.notifications.length>V.current&&setTimeout(()=>T(),0),V.current=A.notifications.length},[A.notifications]);const U=$oe(A.notifications,u),M=_L.reduce((z,$)=>(z[$]=U[$].map(({style:L,...P})=>h.jsx(Poe,{timeout:F,onEnter:()=>R.current[P.id].offsetHeight,nodeRef:{current:R.current[P.id]},children:q=>h.jsx(CL,{ref:Y=>{R.current[P.id]=Y},data:P,onHide:Y=>EL(Y,S),autoClose:f,...B("notification",{style:{...koe({state:q,position:$,transitionDuration:F,maxHeight:y}),...L}})})},P.id)),z),{});return h.jsxs(Fu,{withinPortal:C,...E,children:[h.jsx(Fe,{...B("root"),"data-position":"top-center",ref:t,..._,children:h.jsx(Il,{children:M["top-center"]})}),h.jsx(Fe,{...B("root"),"data-position":"top-left",..._,children:h.jsx(Il,{children:M["top-left"]})}),h.jsx(Fe,{...B("root",{className:rv.classNames.fullWidth}),"data-position":"top-right",..._,children:h.jsx(Il,{children:M["top-right"]})}),h.jsx(Fe,{...B("root",{className:rv.classNames.fullWidth}),"data-position":"bottom-right",..._,children:h.jsx(Il,{children:M["bottom-right"]})}),h.jsx(Fe,{...B("root"),"data-position":"bottom-left",..._,children:h.jsx(Il,{children:M["bottom-left"]})}),h.jsx(Fe,{...B("root"),"data-position":"bottom-center",..._,children:h.jsx(Il,{children:M["bottom-center"]})})]})});ks.classes=OL;ks.displayName="@mantine/notifications/Notifications";ks.show=ci.show;ks.hide=ci.hide;ks.update=ci.update;ks.clean=ci.clean;ks.cleanQueue=ci.cleanQueue;ks.updateState=ci.updateState;var Pb={exports:{}},Loe=Pb.exports,mk;function Foe(){return mk||(mk=1,function(e,t){(function(n,r){e.exports=r()})(Loe,function(){var n=1e3,r=6e4,o=36e5,i="millisecond",s="second",a="minute",c="hour",u="day",f="week",p="month",g="quarter",y="year",v="date",x="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,E=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var z=["th","st","nd","rd"],$=M%100;return"["+M+(z[($-20)%10]||z[$]||z[0])+"]"}},_=function(M,z,$){var L=String(M);return!L||L.length>=z?M:""+Array(z+1-L.length).join($)+M},j={s:_,z:function(M){var z=-M.utcOffset(),$=Math.abs(z),L=Math.floor($/60),P=$%60;return(z<=0?"+":"-")+_(L,2,"0")+":"+_(P,2,"0")},m:function M(z,$){if(z.date()<$.date())return-M($,z);var L=12*($.year()-z.year())+($.month()-z.month()),P=z.clone().add(L,p),q=$-P<0,Y=z.clone().add(L+(q?-1:1),p);return+(-(L+($-P)/(q?P-Y:Y-P))||0)},a:function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},p:function(M){return{M:p,y,w:f,d:u,D:v,h:c,m:a,s,ms:i,Q:g}[M]||String(M||"").toLowerCase().replace(/s$/,"")},u:function(M){return M===void 0}},A="en",T={};T[A]=C;var k="$isDayjsObject",R=function(M){return M instanceof B||!(!M||!M[k])},V=function M(z,$,L){var P;if(!z)return A;if(typeof z=="string"){var q=z.toLowerCase();T[q]&&(P=q),$&&(T[q]=$,P=q);var Y=z.split("-");if(!P&&Y.length>1)return M(Y[0])}else{var D=z.name;T[D]=z,P=D}return!L&&P&&(A=P),P||!L&&A},H=function(M,z){if(R(M))return M.clone();var $=typeof z=="object"?z:{};return $.date=M,$.args=arguments,new B($)},F=j;F.l=V,F.i=R,F.w=function(M,z){return H(M,{locale:z.$L,utc:z.$u,x:z.$x,$offset:z.$offset})};var B=function(){function M($){this.$L=V($.locale,null,!0),this.parse($),this.$x=this.$x||$.x||{},this[k]=!0}var z=M.prototype;return z.parse=function($){this.$d=function(L){var P=L.date,q=L.utc;if(P===null)return new Date(NaN);if(F.u(P))return new Date;if(P instanceof Date)return new Date(P);if(typeof P=="string"&&!/Z$/i.test(P)){var Y=P.match(S);if(Y){var D=Y[2]-1||0,W=(Y[7]||"0").substring(0,3);return q?new Date(Date.UTC(Y[1],D,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,W)):new Date(Y[1],D,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,W)}}return new Date(P)}($),this.init()},z.init=function(){var $=this.$d;this.$y=$.getFullYear(),this.$M=$.getMonth(),this.$D=$.getDate(),this.$W=$.getDay(),this.$H=$.getHours(),this.$m=$.getMinutes(),this.$s=$.getSeconds(),this.$ms=$.getMilliseconds()},z.$utils=function(){return F},z.isValid=function(){return this.$d.toString()!==x},z.isSame=function($,L){var P=H($);return this.startOf(L)<=P&&P<=this.endOf(L)},z.isAfter=function($,L){return H($)<this.startOf(L)},z.isBefore=function($,L){return this.endOf(L)<H($)},z.$g=function($,L,P){return F.u($)?this[L]:this.set(P,$)},z.unix=function(){return Math.floor(this.valueOf()/1e3)},z.valueOf=function(){return this.$d.getTime()},z.startOf=function($,L){var P=this,q=!!F.u(L)||L,Y=F.p($),D=function(me,xe){var je=F.w(P.$u?Date.UTC(P.$y,xe,me):new Date(P.$y,xe,me),P);return q?je:je.endOf(u)},W=function(me,xe){return F.w(P.toDate()[me].apply(P.toDate("s"),(q?[0,0,0,0]:[23,59,59,999]).slice(xe)),P)},K=this.$W,Q=this.$M,ie=this.$D,pe="set"+(this.$u?"UTC":"");switch(Y){case y:return q?D(1,0):D(31,11);case p:return q?D(1,Q):D(0,Q+1);case f:var ue=this.$locale().weekStart||0,se=(K<ue?K+7:K)-ue;return D(q?ie-se:ie+(6-se),Q);case u:case v:return W(pe+"Hours",0);case c:return W(pe+"Minutes",1);case a:return W(pe+"Seconds",2);case s:return W(pe+"Milliseconds",3);default:return this.clone()}},z.endOf=function($){return this.startOf($,!1)},z.$set=function($,L){var P,q=F.p($),Y="set"+(this.$u?"UTC":""),D=(P={},P[u]=Y+"Date",P[v]=Y+"Date",P[p]=Y+"Month",P[y]=Y+"FullYear",P[c]=Y+"Hours",P[a]=Y+"Minutes",P[s]=Y+"Seconds",P[i]=Y+"Milliseconds",P)[q],W=q===u?this.$D+(L-this.$W):L;if(q===p||q===y){var K=this.clone().set(v,1);K.$d[D](W),K.init(),this.$d=K.set(v,Math.min(this.$D,K.daysInMonth())).$d}else D&&this.$d[D](W);return this.init(),this},z.set=function($,L){return this.clone().$set($,L)},z.get=function($){return this[F.p($)]()},z.add=function($,L){var P,q=this;$=Number($);var Y=F.p(L),D=function(Q){var ie=H(q);return F.w(ie.date(ie.date()+Math.round(Q*$)),q)};if(Y===p)return this.set(p,this.$M+$);if(Y===y)return this.set(y,this.$y+$);if(Y===u)return D(1);if(Y===f)return D(7);var W=(P={},P[a]=r,P[c]=o,P[s]=n,P)[Y]||1,K=this.$d.getTime()+$*W;return F.w(K,this)},z.subtract=function($,L){return this.add(-1*$,L)},z.format=function($){var L=this,P=this.$locale();if(!this.isValid())return P.invalidDate||x;var q=$||"YYYY-MM-DDTHH:mm:ssZ",Y=F.z(this),D=this.$H,W=this.$m,K=this.$M,Q=P.weekdays,ie=P.months,pe=P.meridiem,ue=function(xe,je,_e,Ee){return xe&&(xe[je]||xe(L,q))||_e[je].slice(0,Ee)},se=function(xe){return F.s(D%12||12,xe,"0")},me=pe||function(xe,je,_e){var Ee=xe<12?"AM":"PM";return _e?Ee.toLowerCase():Ee};return q.replace(E,function(xe,je){return je||function(_e){switch(_e){case"YY":return String(L.$y).slice(-2);case"YYYY":return F.s(L.$y,4,"0");case"M":return K+1;case"MM":return F.s(K+1,2,"0");case"MMM":return ue(P.monthsShort,K,ie,3);case"MMMM":return ue(ie,K);case"D":return L.$D;case"DD":return F.s(L.$D,2,"0");case"d":return String(L.$W);case"dd":return ue(P.weekdaysMin,L.$W,Q,2);case"ddd":return ue(P.weekdaysShort,L.$W,Q,3);case"dddd":return Q[L.$W];case"H":return String(D);case"HH":return F.s(D,2,"0");case"h":return se(1);case"hh":return se(2);case"a":return me(D,W,!0);case"A":return me(D,W,!1);case"m":return String(W);case"mm":return F.s(W,2,"0");case"s":return String(L.$s);case"ss":return F.s(L.$s,2,"0");case"SSS":return F.s(L.$ms,3,"0");case"Z":return Y}return null}(xe)||Y.replace(":","")})},z.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},z.diff=function($,L,P){var q,Y=this,D=F.p(L),W=H($),K=(W.utcOffset()-this.utcOffset())*r,Q=this-W,ie=function(){return F.m(Y,W)};switch(D){case y:q=ie()/12;break;case p:q=ie();break;case g:q=ie()/3;break;case f:q=(Q-K)/6048e5;break;case u:q=(Q-K)/864e5;break;case c:q=Q/o;break;case a:q=Q/r;break;case s:q=Q/n;break;default:q=Q}return P?q:F.a(q)},z.daysInMonth=function(){return this.endOf(p).$D},z.$locale=function(){return T[this.$L]},z.locale=function($,L){if(!$)return this.$L;var P=this.clone(),q=V($,L,!0);return q&&(P.$L=q),P},z.clone=function(){return F.w(this.$d,this)},z.toDate=function(){return new Date(this.valueOf())},z.toJSON=function(){return this.isValid()?this.toISOString():null},z.toISOString=function(){return this.$d.toISOString()},z.toString=function(){return this.$d.toUTCString()},M}(),U=B.prototype;return H.prototype=U,[["$ms",i],["$s",s],["$m",a],["$H",c],["$W",u],["$M",p],["$y",y],["$D",v]].forEach(function(M){U[M[1]]=function(z){return this.$g(z,M[0],M[1])}}),H.extend=function(M,z){return M.$i||(M(z,B,H),M.$i=!0),H},H.locale=V,H.isDayjs=R,H.unix=function(M){return H(1e3*M)},H.en=T[A],H.Ls=T,H.p={},H})}(Pb)),Pb.exports}var zoe=Foe();const hv=es(zoe);var Db={exports:{}},Boe=Db.exports,gk;function Voe(){return gk||(gk=1,function(e,t){(function(n,r){e.exports=r()})(Boe,function(){var n="week",r="year";return function(o,i,s){var a=i.prototype;a.week=function(c){if(c===void 0&&(c=null),c!==null)return this.add(7*(c-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var f=s(this).startOf(r).add(1,r).date(u),p=s(this).endOf(n);if(f.isBefore(p))return 1}var g=s(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),y=this.diff(g,n,!0);return y<0?s(this).startOf("week").week():Math.ceil(y)},a.weeks=function(c){return c===void 0&&(c=null),this.week(c)}}})}(Db)),Db.exports}var Uoe=Voe();const Hoe=es(Uoe);hv.extend(Hoe);function jL(e){return hv(e).format("YYYY-MM-DD HH:mm:ss")}var W0={exports:{}},yk;function qoe(){if(yk)return W0.exports;yk=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e,blackBright:e,redBright:e,greenBright:e,yellowBright:e,blueBright:e,magentaBright:e,cyanBright:e,whiteBright:e,bgBlackBright:e,bgRedBright:e,bgGreenBright:e,bgYellowBright:e,bgBlueBright:e,bgMagentaBright:e,bgCyanBright:e,bgWhiteBright:e}};return W0.exports=t(),W0.exports.createColors=t,W0.exports}var Woe=qoe();const ri=es(Woe);var Goe={};const p_=(e,t)=>typeof e=="string"?[1,"1","true"].includes(e):!!(e||t);function ir(){try{return p_(0)}catch{return!1}}function Joe(){try{return"0.20.0"}catch{return"0.0.0"}}const Yoe={cli_log_level:{key:"BKND_CLI_LOG_LEVEL",validate:e=>{if(typeof e=="string"&&["log","info","warn","error","debug"].includes(e.toLowerCase()))return e.toLowerCase()}},cli_create_ref:{key:"BKND_CLI_CREATE_REF",validate:e=>typeof e=="string"?e:void 0},cli_telemetry:{key:"BKND_CLI_TELEMETRY",validate:e=>{if(!(typeof e>"u"))return p_(e,!0)}},modules_debug:{key:"BKND_MODULES_DEBUG",validate:p_}},AL=(e,t,n)=>{try{const r=n?.source??Goe,o=Yoe[e],i=r[o.key],s=o.validate(i);if(typeof s<"u")return n?.onValid?.(s),s;n?.onFallback?.(i)}catch{}return t};function Koe(){try{const e=process||{},t=e.argv||[],n=e.env||{};return!(n.NO_COLOR||t.includes("--no-color"))&&(!!n.FORCE_COLOR||t.includes("--color")||e.platform==="win32"||(e.stdout||{}).isTTY&&n.TERM!=="dumb"||!!n.CI)}catch{return!1}}const kj={critical:{prefix:"CRT",color:ri.red,args_color:ri.red,original:console.error},error:{prefix:"ERR",color:ri.red,args_color:ri.red,original:console.error},warn:{prefix:"WRN",color:ri.yellow,args_color:ri.yellow,original:console.warn},info:{prefix:"INF",color:ri.cyan,original:console.info},log:{prefix:"LOG",color:ri.dim,args_color:ri.dim,original:console.log},debug:{prefix:"DBG",color:ri.yellow,args_color:ri.dim,original:console.debug}};function Xoe(e,t){const n=Koe(),r=kj[e],o=r.color(`[${r.prefix}]`),i=t.map(s=>"args_color"in r&&n&&typeof s=="string"?r.args_color(s):s);return r.original(o,ri.gray(jL()),...i)}const TL=AL("cli_log_level","log"),Gc=globalThis.__consoleConfig??={level:TL,enabled:!0},bk=Object.keys(kj),rt=new Proxy(Gc,{get:(e,t)=>{switch(t){case"original":return console;case"disable":return()=>{Gc.enabled=!1};case"enable":return()=>{Gc.enabled=!0};case"setLevel":return o=>{Gc.level=o};case"resetLevel":return()=>{Gc.level=TL}}if(!Gc.enabled)return()=>null;const n=bk.indexOf(Gc.level),r=bk.indexOf(t);return t in kj&&r<=n?(...o)=>Xoe(t,o):()=>null}});function Qoe(){return(navigator.userAgent.indexOf("Opera")||navigator.userAgent.indexOf("OPR"))!==-1?"Opera":navigator.userAgent.indexOf("Edg")!==-1?"Edge":navigator.userAgent.indexOf("Chrome")!==-1?"Chrome":navigator.userAgent.indexOf("Safari")!==-1?"Safari":navigator.userAgent.indexOf("Firefox")!==-1?"Firefox":navigator.userAgent.indexOf("MSIE")!==-1||document.documentMode?"IE":"unknown"}function Io(e){return!e||e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function Zoe(e,t=" "){return!e||e.length===0?e:e.split(t).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(t)}function $L(e,t=!1){const o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+(t?"!@#$%^&*()_+{}:\"<>?|[];',./`~":"");let i="";for(let s=0;s<e;s++)i+=o[Math.floor(Math.random()*o.length)];return i}function $f(e){return!e||e.length===0?e:e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function m_(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function eie(e){return/^[a-z]+(_[a-z]+)*$/.test(e)?"snake_case":/^[A-Z][a-zA-Z]*$/.test(e)?"PascalCase":/^[a-z][a-zA-Z]*$/.test(e)?"camelCase":/^[a-z]+(-[a-z]+)*$/.test(e)?"kebab-case":/^[A-Z]+(_[A-Z]+)*$/.test(e)?"SCREAMING_SNAKE_CASE":"unknown"}function tie(e){switch(eie(e)){case"snake_case":return $f(e);case"PascalCase":return u2(m_(e));case"camelCase":return Io(u2(m_(e)));case"kebab-case":return u2(e);case"SCREAMING_SNAKE_CASE":return $f(e.toLowerCase());case"unknown":return Io(e)}}function Ta(e){return tie(e)}function u2(e){return e.split("-").map(Io).join(" ")}function Dg(e,t=" "){return Zoe($f(e),t)}function nie(e,t){return t instanceof RegExp?t.test(e):typeof t=="string"&&t.startsWith("/")?new RegExp(t).test(e):typeof t=="string"?e.startsWith(t):!1}function rie(e,t=50,n="..."){return e.length<=t?e:e.substring(0,t)+n}function $a(e){return Object.prototype.toString.call(e)==="[object Object]"}function _u(e){return e!==null&&typeof e=="object"}function mo(e,t){const n=new Set(t),r={};for(const[o,i]of Object.entries(e))n.has(o)||(r[o]=i);return r}function Rm(e,t){const n=new Set(t),r={};for(const[o,i]of Object.entries(e))n.has(o)&&(r[o]=i);return r}function g_(e,t=[]){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(n=>g_(n,t)):Object.keys(e).reduce((n,r)=>{const o=t.includes(r)?r:m_(r);return n[o]=g_(e[r],t),n},{})}function RL(e,t){const n={};for(const r in e)t.some(i=>r.includes(i))||(typeof e[r]=="object"&&e[r]!==null&&!Array.isArray(e[r])?n[r]=RL(e[r],t):n[r]=e[r]);return n}function Vt(e,t){const n={};for(const[r,o]of Object.entries(e)){const i=t(o,r);typeof i<"u"&&(n[r]=i)}return n}const Zx=Vt;function kL(e,t=""){let n=[];for(const r in e){const o=t?`${t}.${r}`:r;n.push(o),typeof e[r]=="object"&&e[r]!==null&&(n=n.concat(kL(e[r],o)))}return n}function ML(e){let t=1;for(const n in e)if(typeof e[n]=="object"){const r=ML(e[n])+1;t=Math.max(r,t)}return t}function oie(e,t){function n(r,o){if($a(r)){if(o>t)return;const i={};for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=n(r[s],o+1));return i}return Array.isArray(r)?r.map(i=>n(i,o)):r}return n(e,1)}function km(e){return e&&Object.entries(e).reduce((t,[n,r])=>{if(r&&Array.isArray(r)&&r.some(o=>typeof o=="object")){const o=r.map(km);o.length>0&&(t[n]=o)}else if(r&&typeof r=="object"&&!Array.isArray(r)){const o=km(r);Object.keys(o).length>0&&(t[n]=o)}else r!==""&&r!==null&&r!==void 0&&(t[n]=r);return t},{})}function PL(e,...t){for(const n of t)for(const[r,o]of Object.entries(n))o!==void 0&&(!$a(o)&&!Array.isArray(o)||Array.isArray(o)&&!Array.isArray(e[r])?e[r]=o:_u(e[r])?PL(e[r],o):e[r]=o);return e}function DL(e,t,n){for(const[r,o]of Object.entries(t)){const i=n(e[r],o,r,e,t);if(i!==void 0){e[r]=i;continue}o!==void 0&&(!$a(o)&&!Array.isArray(o)||Array.isArray(o)&&!Array.isArray(e[r])?e[r]=o:_u(e[r])?DL(e[r],o,n):e[r]=o)}return e}function va(e,t){const n=o=>{if(o!==Object(o))return"primitive";if(Array.isArray(o))return"array";if(o instanceof Map)return"map";if(o!=null&&[null,Object.prototype].includes(Object.getPrototypeOf(o)))return"plainObject";if(o instanceof Function)return"function";throw new Error(`deeply comparing an instance of type ${e.constructor?.name} is not supported.`)},r=n(e);if(r!==n(t))return!1;if(r==="primitive")return e===t||Number.isNaN(e)&&Number.isNaN(t);if(r==="array")return e.length===t.length&&e.every((o,i)=>va(o,t[i]));if(r==="map")return e.size===t.size&&[...e].every(([o,i])=>t.has(o)&&va(i,t.get(o)));if(r==="plainObject"){const o=new Map(Object.entries(e)),i=new Map(Object.entries(t));return o.size===i.size&&[...o].every(([s,a])=>i.has(s)&&va(a,i.get(s)))}else{if(r==="function")return e.toString()===t.toString();throw new Error("Unreachable")}}function Bn(e,t,n=void 0){const r=typeof t=="string"?t.split(/[.\[\]\"]+/).filter(o=>o):t;if(r.length===0)return e;try{const[o,...i]=r;return!o||!(o in e)?n:Bn(e[o],i,n)}catch{if(typeof n<"u")return n;throw new Error(`Invalid path: ${r.join(".")}`)}}function y_(e,t=0,n=0){const r=t?`
`:"",o=c=>t?" ".repeat(t*c):"",i=o(n+1),s=o(n);if(e===null)return"null";if(e===void 0)return"undefined";const a=typeof e;if(a==="string")return JSON.stringify(e);if(a==="number"||a==="boolean")return String(e);if(Array.isArray(e)){const c=e.map(u=>y_(u,t,n+1)).join(", "+(t?r+i:""));return"["+(t&&e.length?r+i:"")+c+(t&&e.length?r+s:"")+"]"}if(a==="object"){const c=Object.entries(e).map(([f,p])=>(/^[A-Za-z_$][\w$]*$/.test(f)?f:JSON.stringify(f))+": "+y_(p,t,n+1)),u=c.join(", "+(t?r+i:""));return"{"+(t&&c.length?r+i:"")+u+(t&&c.length?r+s:"")+"}"}throw new TypeError(`Unsupported data type: ${a}`)}function IL(e,t){return t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}function Qd(e){if(Object.isFrozen(e))return e;const t=Reflect.ownKeys(e);for(const n of t){const r=e[n];(r&&typeof r=="object"||typeof r=="function")&&Qd(r)}return Object.freeze(e)}function iie(e){return Object.keys(e).every(t=>Number.isInteger(Number(t)))?Object.values(e):e}function b_(e,t,n,r){if(typeof e=="string"){const o=e.match(t);if(o&&o[0]===e&&o[1]){const i=o[1],s=Bn(n,i,null);return s!==null?s:r!==void 0?r:e}if(t.test(e))return e.replace(t,(i,s)=>{const a=Bn(n,s,null);return a!==null?String(a):r!==void 0?String(r):i})}return Array.isArray(e)?e.map(o=>b_(o,t,n,r)):e&&typeof e=="object"?Object.entries(e).reduce((o,[i,s])=>(o[i]=b_(s,t,n,r),o),{}):e}const Mj={video:["mp4","webm"],audio:["ogg"],image:["jpeg","png","gif","webp","bmp","tiff","avif","heic","heif"],text:["html","css","mdx","yaml","vcard","csv","vtt"],application:["zip","toml","json","json5","pdf","xml"],font:["woff","woff2","ttf","otf"]},pt={vnd:"vnd.openxmlformats-officedocument",z:"application/x-7z-compressed",t:(e="plain")=>`text/${e}`,a:(e="octet-stream")=>`application/${e}`,i:e=>`image/${e}`,v:e=>`video/${e}`,au:e=>`audio/${e}`},Pj=new Map([["7z",pt.z],["7zip",pt.z],["txt",pt.t()],["ai",pt.a("postscript")],["apk",pt.a("vnd.android.package-archive")],["doc",pt.a("msword")],["docx",`${pt.vnd}.wordprocessingml.document`],["eps",pt.a("postscript")],["epub",pt.a("epub+zip")],["ini",pt.t()],["ico",pt.i("vnd.microsoft.icon")],["jar",pt.a("java-archive")],["jsonld",pt.a("ld+json")],["jpg",pt.i("jpeg")],["js",pt.t("javascript")],["log",pt.t()],["m3u",pt.au("x-mpegurl")],["m3u8",pt.a("vnd.apple.mpegurl")],["manifest",pt.t("cache-manifest")],["md",pt.t("markdown")],["mkv",pt.v("x-matroska")],["mp3",pt.au("mpeg")],["mobi",pt.a("x-mobipocket-ebook")],["ppt",pt.a("powerpoint")],["pptx",`${pt.vnd}.presentationml.presentation`],["qt",pt.v("quicktime")],["svg",pt.i("svg+xml")],["tif",pt.i("tiff")],["tsv",pt.t("tab-separated-values")],["tgz",pt.a("x-tar")],["text",pt.t()],["vcd",pt.a("x-cdlink")],["vcs",pt.t("x-vcalendar")],["wav",pt.au("vnd.wav")],["webmanifest",pt.a("manifest+json")],["xls",pt.a("vnd.ms-excel")],["xlsx",`${pt.vnd}.spreadsheetml.sheet`],["yml",pt.t("yaml")]]);function LL(e){try{const t=e.split(".").pop();if(!t)return pt.a();for(const[n,r]of Object.entries(Mj))if(r.includes(t))return`${n}/${t}`;return Pj.get(t)}catch{return pt.a()}}function sie(e,t=[]){const n=e.toLowerCase();if(t.includes(n))return!1;if(Object.entries(Mj).flatMap(([r,o])=>o.map(i=>`${r}/${i}`)).includes(n))return!0;for(const[r,o]of Pj.entries())if(o===n&&!t.includes(r))return!0;return!1}function FL(e){const t=e.toLowerCase();for(const[n,r]of Object.entries(Mj))for(const o of r)if(t===`${n}/${o}`)return o;for(const[n,r]of Pj.entries())if(r===t)return n;return""}var aie={deno:"Deno",bun:"Bun",workerd:"Cloudflare-Workers",node:"Node.js"},zL=()=>{const e=globalThis;if(typeof navigator<"u"&&typeof navigator.userAgent=="string"){for(const[n,r]of Object.entries(aie))if(lie(r))return n}return typeof e?.EdgeRuntime=="string"?"edge-light":e?.fastly!==void 0?"fastly":e?.process?.release?.name==="node"?"node":"other"},lie=e=>navigator.userAgent.startsWith(e);function cie(){const e=globalThis;return e?.process?.env?.NEXT_RUNTIME==="nodejs"?"nextjs":e?.process?.env?.NEXT_RUNTIME==="edge"?"nextjs-edge":typeof window<"u"&&window.__NEXT_DATA__?"nextjs-client":zL()}const vk={redirects_non_fq:!0};function uie(e){return cie().startsWith("nextjs")&&(vk.redirects_non_fq=!1),vk[e]}function Hl(e,t){if(!e)throw new Error(t)}function die(e,t){try{return e(),!1}catch(n){if(t){if(n instanceof t)return!0;throw n}return!0}}function fie(e){let t="";typeof e=="string"?t=e:e instanceof Headers?t=e.get("Content-Disposition")||"":e instanceof Request&&(t=e.headers.get("Content-Disposition")||"");const n=t.match(/filename\*?=(?:UTF-8'')?("?)([^";]+)\1/);return n?n[2]:void 0}function hie(e){return typeof e=="object"&&e!==null&&typeof e.getReader=="function"}function ew(e){return typeof e=="object"&&e!==null&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"}function xc(e){return ew(e)&&typeof e.name=="string"&&typeof e.lastModified=="number"}function pie(e){return typeof e=="object"&&e!==null&&Object.prototype.toString.call(e)==="[object ArrayBuffer]"}function mie(e){return typeof e=="object"&&e!==null&&ArrayBuffer.isView(e)}const gie={"89504E47":"image/png",FFD8FF:"image/jpeg",47494638:"image/gif","49492A00":"image/tiff","4D4D002A":"image/tiff","52494646????57454250":"image/webp","504B0304":"application/zip",25504446:"application/pdf","00000020667479706D70":"video/mp4","000001BA":"video/mpeg","000001B3":"video/mpeg","1A45DFA3":"video/webm","4F676753":"audio/ogg",494433:"audio/mpeg",FFF1:"audio/aac",FFF9:"audio/aac","52494646????41564920":"audio/wav","52494646????57415645":"audio/wave","52494646????415550":"audio/aiff"};async function yie(e){if(!e)return;let t;if(hie(e)){const r=e.getReader(),{value:o}=await r.read();if(!o)return;t=new Uint8Array(o)}else if(ew(e)||xc(e))t=new Uint8Array(await e.slice(0,12).arrayBuffer());else if(pie(e))t=new Uint8Array(e);else if(mie(e))t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);else if(typeof e=="string")t=new TextEncoder().encode(e);else return;const n=Array.from(t.slice(0,12)).map(r=>r.toString(16).padStart(2,"0").toUpperCase()).join("");for(const[r,o]of Object.entries(gie))if(new RegExp("^"+r.replace(/\?\?/g,"..")).test(n))return o}async function d2(e){const t=e.req.header("Content-Type")??"application/octet-stream";if(t?.startsWith("multipart/form-data")||t?.startsWith("application/x-www-form-urlencoded"))try{const n=await e.req.formData();if([...n.values()].length>0){const r=[...n.values()][0];return await xk(r)}}catch(n){rt.warn("Error parsing form data",n)}else try{const n=await e.req.blob();if(xc(n))return n;if(ew(n))return await xk(n,{name:fie(e.req.raw),type:t})}catch(n){rt.warn("Error parsing blob",n)}throw new Error("No file found in request")}async function bie(e,t){const n=xc(e),r=n?e.type:t;Hl(r&&typeof r=="string"&&r.startsWith("image/"),"type must be image/*");const o=n?await e.arrayBuffer():e;Hl(o.byteLength>=128,"Buffer must be at least 128 bytes");const i=new DataView(o);if(r==="image/jpeg"){let s=2;for(;s<i.byteLength;){const a=i.getUint16(s);if(s+=2,a===65472||a===65474)return{width:i.getUint16(s+5),height:i.getUint16(s+3)};s+=i.getUint16(s)}}else{if(r==="image/png")return{width:i.getUint32(16),height:i.getUint32(20)};if(r==="image/gif")return{width:i.getUint16(6),height:i.getUint16(8)};if(r==="image/tiff"){const s=i.getUint16(0)===18761,a=i.getUint32(4,s),c=i.getUint32(a+18,s),u=i.getUint32(a+10,s);return{width:c,height:u}}}throw new Error("Unsupported image format")}async function xk(e,t={}){if(xc(e))return e;if(!ew(e))throw new Error("Not a Blob");const n=sie(t.type,["application/octet-stream"])?t.type:await yie(e),r=n?FL(n):"",o=t.name||[$L(16),r].filter(Boolean).join(".");return new File([e],o,{type:n||LL(o),lastModified:Date.now()})}function vie(e,t){const n=Array.isArray(t)?t.join(","):t;if(!n||!n.trim())return!0;if(!xc(e))throw new Error("Given file is not a File instance");const r=e.name.toLowerCase(),o=(e.type||"").trim().toLowerCase();return n.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean).some(s=>{if(s.startsWith("."))return r.endsWith(s);if(s.indexOf("/")!==-1){const[c,u]=s.split("/");if(u==="*"){if(!o)return!1;const[f]=o.split("/");return f===c}else return o.startsWith(s)}return!1})}function xie(e){return e?{...Object.fromEntries(e.entries())}:{}}function wie(e,t){const n=xie(e),r={};for(const o of t)n[o]&&(r[o]=n[o]);return r}function Sie(e,t){const n=new Headers;for(const r of t)e.has(r)&&n.set(r,e.get(r));return n}function tw(e,t){let n="";function r(o){return t?.encode?encodeURIComponent(o):o}for(const o in e){let i=e[o];if(i!==void 0)if(Array.isArray(i))for(let s=0;s<i.length;s++)n.length>0&&(n+="&"),n+=`${r(o)}=${r(i[s])}`;else typeof i=="object"&&(i=JSON.stringify(i)),n.length>0&&(n+="&"),n+=`${r(o)}=${r(i)}`}return(t?.prefix||"")+n}function Eie(e){function t(s){if(!s)return"";const a=decodeURIComponent(s);if(a==="false")return!1;if(a==="true")return!0;try{return JSON.parse(a)}catch{return+a*0===0?+a:a}}let n,r;const o={},i=e.split("&");for(;n=i.shift();)n=n.split("="),r=n.shift(),o[r]!==void 0?o[r]=[].concat(o[r],t(n.shift())):o[r]=t(n.shift());return o}var Qt=(e=>(e[e.CONTINUE=100]="CONTINUE",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.ALREADY_REPORTED=208]="ALREADY_REPORTED",e[e.IM_USED=226]="IM_USED",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.FOUND=302]="FOUND",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",e[e.URI_TOO_LONG=414]="URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.TOO_EARLY=425]="TOO_EARLY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.LOOP_DETECTED=508]="LOOP_DETECTED",e[e.NOT_EXTENDED=510]="NOT_EXTENDED",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED",e))(Qt||{});const BL=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Nie=BL+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",_ie="["+BL+"]["+Nie+"]*",Cie=new RegExp("^"+_ie+"$");function VL(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const i=r.length;for(let s=0;s<i;s++)o.push(r[s]);n.push(o),r=t.exec(e)}return n}const nw=function(e){const t=Cie.exec(e);return!(t===null||typeof t>"u")};function Oie(e){return typeof e<"u"}const jie={allowBooleanAttributes:!1,unpairedTags:[]};function Aie(e,t){t=Object.assign({},jie,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=Sk(e,i),i.err)return i}else if(e[i]==="<"){let s=i;if(i++,e[i]==="!"){i=Ek(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let c="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
`&&e[i]!=="\r";i++)c+=e[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!Iie(c)){let p;return c.trim().length===0?p="Invalid space after '<'.":p="Tag '"+c+"' is an invalid name.",Mn("InvalidTag",p,Rr(e,i))}const u=Rie(e,i);if(u===!1)return Mn("InvalidAttr","Attributes for '"+c+"' have open quote.",Rr(e,i));let f=u.value;if(i=u.index,f[f.length-1]==="/"){const p=i-f.length;f=f.substring(0,f.length-1);const g=Nk(f,t);if(g===!0)r=!0;else return Mn(g.err.code,g.err.msg,Rr(e,p+g.err.line))}else if(a)if(u.tagClosed){if(f.trim().length>0)return Mn("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Rr(e,s));if(n.length===0)return Mn("InvalidTag","Closing tag '"+c+"' has not been opened.",Rr(e,s));{const p=n.pop();if(c!==p.tagName){let g=Rr(e,p.tagStartPos);return Mn("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+g.line+", col "+g.col+") instead of closing tag '"+c+"'.",Rr(e,s))}n.length==0&&(o=!0)}}else return Mn("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Rr(e,i));else{const p=Nk(f,t);if(p!==!0)return Mn(p.err.code,p.err.msg,Rr(e,i-f.length+p.err.line));if(o===!0)return Mn("InvalidXml","Multiple possible root nodes found.",Rr(e,i));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:s}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=Ek(e,i);continue}else if(e[i+1]==="?"){if(i=Sk(e,++i),i.err)return i}else break;else if(e[i]==="&"){const p=Pie(e,i);if(p==-1)return Mn("InvalidChar","char '&' is not expected.",Rr(e,i));i=p}else if(o===!0&&!wk(e[i]))return Mn("InvalidXml","Extra text at the end",Rr(e,i));e[i]==="<"&&i--}}else{if(wk(e[i]))continue;return Mn("InvalidChar","char '"+e[i]+"' is not expected.",Rr(e,i))}if(r){if(n.length==1)return Mn("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",Rr(e,n[0].tagStartPos));if(n.length>0)return Mn("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Mn("InvalidXml","Start tag expected.",1);return!0}function wk(e){return e===" "||e===" "||e===`
`||e==="\r"}function Sk(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return Mn("InvalidXml","XML declaration allowed only at the start of the document.",Rr(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Ek(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const Tie='"',$ie="'";function Rie(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===Tie||e[t]===$ie)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const kie=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Nk(e,t){const n=VL(e,kie),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Mn("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",kp(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Mn("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",kp(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Mn("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",kp(n[o]));const i=n[o][2];if(!Die(i))return Mn("InvalidAttr","Attribute '"+i+"' is an invalid name.",kp(n[o]));if(!r.hasOwnProperty(i))r[i]=1;else return Mn("InvalidAttr","Attribute '"+i+"' is repeated.",kp(n[o]))}return!0}function Mie(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function Pie(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Mie(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function Mn(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Die(e){return nw(e)}function Iie(e){return nw(e)}function Rr(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function kp(e){return e.startIndex+e[1].length}const Lie={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1},Fie=function(e){return Object.assign({},Lie,e)};let pv;typeof Symbol!="function"?pv="@@xmlMetadata":pv=Symbol("XML Node Metadata");class iu{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][pv]={startIndex:n})}static getMetaDataSymbol(){return pv}}class zie{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const r={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let o=1,i=!1,s=!1,a="";for(;n<t.length;n++)if(t[n]==="<"&&!s){if(i&&Jc(t,"!ENTITY",n)){n+=7;let c,u;[c,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(r[c]={regx:RegExp(`&${c};`,"g"),val:u})}else if(i&&Jc(t,"!ELEMENT",n)){n+=8;const{index:c}=this.readElementExp(t,n+1);n=c}else if(i&&Jc(t,"!ATTLIST",n))n+=8;else if(i&&Jc(t,"!NOTATION",n)){n+=9;const{index:c}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=c}else if(Jc(t,"!--",n))s=!0;else throw new Error("Invalid DOCTYPE");o++,a=""}else if(t[n]===">"){if(s?t[n-1]==="-"&&t[n-2]==="-"&&(s=!1,o--):o--,o===0)break}else t[n]==="["?i=!0:a+=t[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=Xr(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(Mp(r),n=Xr(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let o="";return[n,o]=this.readIdentifierVal(t,n,"entity"),n--,[r,o,n]}readNotationExp(t,n){n=Xr(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&Mp(r),n=Xr(t,n);const o=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=Xr(t,n);let i=null,s=null;if(o==="PUBLIC")[n,i]=this.readIdentifierVal(t,n,"publicIdentifier"),n=Xr(t,n),(t[n]==='"'||t[n]==="'")&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:i,systemIdentifier:s,index:--n}}readIdentifierVal(t,n,r){let o="";const i=t[n];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);for(n++;n<t.length&&t[n]!==i;)o+=t[n],n++;if(t[n]!==i)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=Xr(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!nw(r))throw new Error(`Invalid element name: "${r}"`);n=Xr(t,n);let o="";if(t[n]==="E"&&Jc(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Jc(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)o+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:r,contentModel:o.trim(),index:n}}readAttlistExp(t,n){n=Xr(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;Mp(r),n=Xr(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!Mp(o))throw new Error(`Invalid attribute name: "${o}"`);n=Xr(t,n);let i="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(i="NOTATION",n+=8,n=Xr(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let a=[];for(;n<t.length&&t[n]!==")";){let c="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)c+=t[n],n++;if(c=c.trim(),!Mp(c))throw new Error(`Invalid notation name: "${c}"`);a.push(c),t[n]==="|"&&(n++,n=Xr(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,i+=" ("+a.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)i+=t[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(i.toUpperCase()))throw new Error(`Invalid attribute type: "${i}"`)}n=Xr(t,n);let s="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(s="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(s="#IMPLIED",n+=7):[n,s]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:i,defaultValue:s,index:n}}}const Xr=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Jc(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Mp(e){if(nw(e))return e;throw new Error(`Invalid entity name ${e}`)}const Bie=/^[-+]?0x[a-fA-F0-9]+$/,Vie=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Uie={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Hie(e,t={}){if(t=Object.assign({},Uie,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&Bie.test(n))return Jie(n,16);if(n.search(/.+[eE].+/)!==-1)return Wie(e,n,t);{const r=Vie.exec(n);if(r){const o=r[1]||"",i=r[2];let s=Gie(r[3]);const a=o?e[i.length+1]===".":e[i.length]===".";if(!t.leadingZeros&&(i.length>1||i.length===1&&!a))return e;{const c=Number(n),u=String(c);if(c===0)return c;if(u.search(/[eE]/)!==-1)return t.eNotation?c:e;if(n.indexOf(".")!==-1)return u==="0"||u===s||u===`${o}${s}`?c:e;let f=i?s:n;return i?f===u||o+f===u?c:e:f===u||f===o+u?c:e}}else return e}}const qie=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Wie(e,t,n){if(!n.eNotation)return e;const r=t.match(qie);if(r){let o=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",s=r[2],a=o?e[s.length+1]===i:e[s.length]===i;return s.length>1&&a?e:s.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(t):n.leadingZeros&&!a?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function Gie(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function Jie(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Yie(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class Kie{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,16))}},this.addExternalEntities=Xie,this.parseXml=nse,this.parseTextData=Qie,this.resolveNameSpace=Zie,this.buildAttributesMap=tse,this.isItStopNode=sse,this.replaceEntitiesValue=ose,this.readStopNodeData=lse,this.saveTextToParentTag=ise,this.addChild=rse,this.ignoreAttributesFn=Yie(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function Xie(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function Qie(e,t,n,r,o,i,s){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,o,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?x_(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?x_(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Zie(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const ese=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function tse(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=VL(e,ese),o=r.length,i={};for(let s=0;s<o;s++){const a=this.resolveNameSpace(r[s][1]);if(this.ignoreAttributesFn(a,t))continue;let c=r[s][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);const f=this.options.attributeValueProcessor(a,c,t);f==null?i[u]=c:typeof f!=typeof c||f!==c?i[u]=f:i[u]=x_(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[u]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const s={};return s[this.options.attributesGroupName]=i,s}return i}}const nse=function(e){e=e.replace(/\r\n?/g,`
`);const t=new iu("!xml");let n=t,r="",o="";const i=new zie(this.options.processEntities);for(let s=0;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="/"){const c=fu(e,">",s,"Closing Tag is not closed.");let u=e.substring(s+2,c).trim();if(this.options.removeNSPrefix){const g=u.indexOf(":");g!==-1&&(u=u.substr(g+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(r=this.saveTextToParentTag(r,n,o));const f=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let p=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(p=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=o.lastIndexOf("."),o=o.substring(0,p),n=this.tagsNodeStack.pop(),r="",s=c}else if(e[s+1]==="?"){let c=v_(e,s,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){const u=new iu(c.tagName);u.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(u[":@"]=this.buildAttributesMap(c.tagExp,o,c.tagName)),this.addChild(n,u,o,s)}s=c.closeIndex+1}else if(e.substr(s+1,3)==="!--"){const c=fu(e,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(s+4,c-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}s=c}else if(e.substr(s+1,2)==="!D"){const c=i.readDocType(e,s);this.docTypeEntities=c.entities,s=c.i}else if(e.substr(s+1,2)==="!["){const c=fu(e,"]]>",s,"CDATA is not closed.")-2,u=e.substring(s+9,c);r=this.saveTextToParentTag(r,n,o);let f=this.parseTextData(u,n.tagname,o,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,f),s=c+2}else{let c=v_(e,s,this.options.removeNSPrefix),u=c.tagName;const f=c.rawTagName;let p=c.tagExp,g=c.attrExpPresent,y=c.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,o,!1));const v=n;v&&this.options.unpairedTags.indexOf(v.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==t.tagname&&(o+=o?"."+u:u);const x=s;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,u)){let S="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),p=u):p=p.substr(0,p.length-1),s=c.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)s=c.closeIndex;else{const C=this.readStopNodeData(e,f,y+1);if(!C)throw new Error(`Unexpected end of ${f}`);s=C.i,S=C.tagContent}const E=new iu(u);u!==p&&g&&(E[":@"]=this.buildAttributesMap(p,o,u)),S&&(S=this.parseTextData(S,u,o,!0,g,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),E.add(this.options.textNodeName,S),this.addChild(n,E,o,x)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),p=u):p=p.substr(0,p.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const S=new iu(u);u!==p&&g&&(S[":@"]=this.buildAttributesMap(p,o,u)),this.addChild(n,S,o,x),o=o.substr(0,o.lastIndexOf("."))}else{const S=new iu(u);this.tagsNodeStack.push(n),u!==p&&g&&(S[":@"]=this.buildAttributesMap(p,o,u)),this.addChild(n,S,o,x),n=S}r="",s=y}}else r+=e[s];return t.child};function rse(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),e.addChild(t,r))}const ose=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function ise(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function sse(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function ase(e,t,n=">"){let r,o="";for(let i=t;i<e.length;i++){let s=e[i];if(r)s===r&&(r="");else if(s==='"'||s==="'")r=s;else if(s===n[0])if(n[1]){if(e[i+1]===n[1])return{data:o,index:i}}else return{data:o,index:i};else s===" "&&(s=" ");o+=s}}function fu(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function v_(e,t,n,r=">"){const o=ase(e,t+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let c=i,u=!0;a!==-1&&(c=i.substring(0,a),i=i.substring(a+1).trimStart());const f=c;if(n){const p=c.indexOf(":");p!==-1&&(c=c.substr(p+1),u=c!==o.data.substr(p+1))}return{tagName:c,tagExp:i,closeIndex:s,attrExpPresent:u,rawTagName:f}}function lse(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const i=fu(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=fu(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=fu(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=fu(e,"]]>",n,"StopNode is not closed.")-2;else{const i=v_(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,n=i.closeIndex)}}function x_(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:Hie(e,n)}else return Oie(e)?e:""}const f2=iu.getMetaDataSymbol();function cse(e,t){return UL(e,t)}function UL(e,t,n){let r;const o={};for(let i=0;i<e.length;i++){const s=e[i],a=use(s);let c="";if(n===void 0?c=a:c=n+"."+a,a===t.textNodeName)r===void 0?r=s[a]:r+=""+s[a];else{if(a===void 0)continue;if(s[a]){let u=UL(s[a],t,c);const f=fse(u,t);s[f2]!==void 0&&(u[f2]=s[f2]),s[":@"]?dse(u,s[":@"],c,t):Object.keys(u).length===1&&u[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?u=u[t.textNodeName]:Object.keys(u).length===0&&(t.alwaysCreateTextNode?u[t.textNodeName]="":u=""),o[a]!==void 0&&o.hasOwnProperty(a)?(Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(u)):t.isArray(a,c,f)?o[a]=[u]:o[a]=u}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function use(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function dse(e,t,n,r){if(t){const o=Object.keys(t),i=o.length;for(let s=0;s<i;s++){const a=o[s];r.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function fse(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class hse{constructor(t){this.externalEntities={},this.options=Fie(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const i=Aie(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new Kie(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:cse(o,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return iu.getMetaDataSymbol()}}function pse(e){return new hse().parse(e)}const mse=["SHA-1","SHA-256","SHA-384","SHA-512"];async function _k(e,t,n,r){if(!mse.includes(e))throw new Error(`Invalid hash algorithm: ${e}`);const o=new TextEncoder().encode((n??"")+t+(r??"")),i=await crypto.subtle.digest(e,o);return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("")}const HL={sha256:async(e,t,n)=>_k("SHA-256",e,t,n),sha1:async(e,t,n)=>_k("SHA-1",e,t,n)};function gse(e){const t=new Uint8Array(e);return crypto.getRandomValues(t),Array.from(t,n=>String.fromCharCode(33+n%94)).join("")}const dr=[];for(let e=0;e<256;++e)dr.push((e+256).toString(16).slice(1));function qL(e,t=0){return(dr[e[t+0]]+dr[e[t+1]]+dr[e[t+2]]+dr[e[t+3]]+"-"+dr[e[t+4]]+dr[e[t+5]]+"-"+dr[e[t+6]]+dr[e[t+7]]+"-"+dr[e[t+8]]+dr[e[t+9]]+"-"+dr[e[t+10]]+dr[e[t+11]]+dr[e[t+12]]+dr[e[t+13]]+dr[e[t+14]]+dr[e[t+15]]).toLowerCase()}let h2;const yse=new Uint8Array(16);function WL(){if(!h2){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");h2=crypto.getRandomValues.bind(crypto)}return h2(yse)}const bse=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ck={randomUUID:bse};function vse(e,t,n){e=e||{};const r=e.random??e.rng?.()??WL();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,qL(r)}function xse(e,t,n){return Ck.randomUUID&&!e?Ck.randomUUID():vse(e)}const p2={};function wse(e,t,n){let r;{const o=Date.now(),i=WL();Sse(p2,o,i),r=Ese(i,p2.msecs,p2.seq,t,n)}return t??qL(r)}function Sse(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function Ese(e,t,n,r,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!r)r=new Uint8Array(16),o=0;else if(o<0||o+16>r.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);return t??=Date.now(),n??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],r[o++]=t/1099511627776&255,r[o++]=t/4294967296&255,r[o++]=t/16777216&255,r[o++]=t/65536&255,r[o++]=t/256&255,r[o++]=t&255,r[o++]=112|n>>>28&15,r[o++]=n>>>20&255,r[o++]=128|n>>>14&63,r[o++]=n>>>6&255,r[o++]=n<<2&255|e[10]&3,r[o++]=e[11],r[o++]=e[12],r[o++]=e[13],r[o++]=e[14],r[o++]=e[15],r}function Nse(){return xse()}function _se(){return wse()}function GL(e,t,n){const r=Math.min(t,n),o=Math.max(t,n);return Math.max(r,Math.min(e,o))}function Ok(e){return e==null?0:typeof e=="number"?e:Number.parseInt(e,10)}const rw={fileSize:(e,t=2)=>{if(e===0)return"0 B";const n=1024,r=t<0?0:t,o=["B","KB","MB","GB","TB"],i=Math.floor(Math.log(e)/Math.log(n));return Number.parseFloat((e/n**i).toFixed(r))+" "+o[i]}};let Br=class extends Error{code=Qt.BAD_REQUEST;name="Exception";_context=void 0;constructor(t,n){super(t),n&&(this.code=n)}context(t){return this._context=t,this}toJSON(){return{error:this.message,type:this.name,context:this._context}}};class af extends Error{constructor(t,n,r){super(t),this.details=n,this.type=r}static with(t,n,r){throw new af(t,n,r)}toJSON(){return{type:this.type??"unknown",message:this.message,details:this.details}}}var w_=(e=[],t="")=>"/"+[t,...e.map(n=>String(n).replace(/\./g,"/"))].filter(Boolean).join("/"),JL=e=>e.split("/").slice(1);function Cse(e,t,n=void 0){let r=typeof t=="string"?JL(t):w_(t);return ow(e,r,n)}function ow(e,t,n=void 0){let r=typeof t=="string"?t.split(/[.\[\]\"]+/).filter(o=>o):t;if(r.length===0)return e;try{let[o,...i]=r;return!o||!(o in e)?n:ow(e[o],i,n)}catch{if(typeof n<"u")return n;throw new Error(`Invalid path: ${r.join(".")}`)}}var Zt=(e={},t,n,r)=>({valid:!1,errors:[...e.errors??[],{keywordLocation:w_([...e.keywordPath??[],t]),instanceLocation:w_(e.instancePath),error:typeof n=="string"?n:`Invalid value for ${t}`,data:r}]}),Qe=()=>({valid:!0,errors:[]}),gh=(e,t,n)=>{let r=Array.isArray(t)?t:[t],o=n?Array.isArray(n)?n:[n]:[];return{...e,keywordPath:[...e.keywordPath??[],...r],instancePath:o?[...e.instancePath??[],...o]:e.instancePath}},Ib=(e={})=>({...e,errors:[]}),Cu=class extends Error{constructor(e){super(`Expected ${e}`)}},Ose=class extends Error{constructor(t,n){super(`${t??"Invalid raw schema"}: ${JSON.stringify(n)}`),this.schema=n}},jse=class extends Error{constructor(e,t){super(`${e}, got: 'type "${typeof t}": ${JSON.stringify(t)}'`),this.value=t}},Mr=Symbol.for("jsonv-ts:schema");function Ase(e){return e===null}function Xn(e){return!Array.isArray(e)&&typeof e=="object"&&e!==null}function Tse(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ms(e){return typeof e=="string"}function Fa(e){return typeof e=="number"}function $se(e){return typeof e=="number"&&Number.isInteger(e)}function Dj(e){return typeof e=="boolean"}function wc(e){return Array.isArray(e)}function Rse(e){return typeof e!="boolean"}function kse(e){return e!==void 0&&Rse(e)&&"type"in e}function Lo(e){return e!==void 0&&Xn(e)&&Mr in e}function YL(e){return Lo(e)&&typeof e.toJSON()=="boolean"}function Mse(e,t,n){if(!e)throw new jse(t,n)}function KL(e){return Ms(e)?e.normalize("NFC"):e}function Mm(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=e.length;if(r!==t.length)return!1;for(let o=0;o<r;o++)if(!Mm(e[o],t[o]))return!1;return!0}if(n==="object"){if(!e||!t)return e===t;let r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(let i of r)if(!Mm(e[i],t[i]))return!1;return!0}return e===t}function Pse(e,t){return t.reduce((n,r)=>(r in e&&(n[r]=e[r]),n),{})}function XL(e){try{return structuredClone(e)}catch{return e}}var Ij=class{constructor(e){this.root=e,this.cache=new Map}cache;hasRef(e,t){return t!==void 0&&"$ref"in e&&Ms(e.$ref)}resolve(e){let t=this.cache.get(e);if(!t){if(t=Cse(this.root,e),!Lo(t))throw new Error(`ref not found: ${e}`);if("$ref"in t&&t.$ref===e)throw new Error(`ref loop: ${e}`);this.cache.set(e,t)}return t}};function Dse(e,t,n={}){let r=t;try{r=structuredClone(t)}catch{r=JSON.parse(JSON.stringify(t))}let o={resolver:n.resolver||new Ij(e),depth:n.depth||0,dropUnknown:n.dropUnknown??!1};return o.resolver.hasRef(e,r)?o.resolver.resolve(e.$ref).coerce(r,{...o,depth:o.depth+1}):r}var Ise=({type:e},t,n={})=>{if(e===void 0||t===void 0)return Qe();let r,o={string:Ms,number:Fa,integer:$se,object:Xn,array:wc,boolean:Dj,null:Ase};if(Array.isArray(e)){for(let i of e){if(!(i in o))throw new Cu(`Unknown type: ${i}`);if(o[i](t))return Qe()}r=`Expected one of: ${e.join(", ")}`}else{if(!(e in o))throw new Cu(`Unknown type: ${e}`);o[e](t)||(r=`Expected ${e}`)}return r?Zt(n,"type",r,t):Qe()},Lse=({const:e},t,n={})=>Mm(e,t)?Qe():Zt(n,"const",`Expected const: ${e}`,t),Fse=({enum:e=[]},t,n={})=>e.some(r=>Mm(r,t))?Qe():Zt(n,"enum",`Expected enum: ${JSON.stringify(e)}`,t);function iw(e,t,n={}){return e.map(r=>r.validate(t,Ib(n)).valid?r:void 0).filter(Boolean)}var zse=({anyOf:e=[]},t,n={})=>iw(e,t,n).length>0?Qe():Zt(n,"anyOf","Expected at least one to match",t),Bse=({oneOf:e=[]},t,n={})=>iw(e,t).length===1?Qe():Zt(n,"oneOf","Expected exactly one to match",t),Vse=({allOf:e=[]},t,n={})=>iw(e,t,n).length===e.length?Qe():Zt(n,"allOf","Expected all to match",t),Use=({not:e},t,n={})=>t===void 0?Qe():Lo(e)&&e.validate(t,n).valid?Zt(n,"not","Expected not to match",t):Qe(),Hse=({if:e,then:t,else:n},r,o={})=>{if(e&&(t||n)){if(e.validate(r,Ib(o)).valid)return t?t.validate(r,Ib(o)):Qe();if(n)return n.validate(r,Ib(o))}return Qe()},qse=({pattern:e=""},t,n={})=>{if(!Ms(t))return Qe();if(e instanceof RegExp){if(e.test(t))return Qe()}else if(new RegExp(e,"u").test(t))return Qe();return Zt(n,"pattern",`Expected string matching pattern ${e}`,t)},Wse=({minLength:e=0},t,n={})=>Ms(t)?[...KL(t)].length>=e?Qe():Zt(n,"minLength",`Expected string with minimum length of ${e}`,t):Qe(),Gse=({maxLength:e=0},t,n={})=>Ms(t)?[...KL(t)].length<=e?Qe():Zt(n,"maxLength",`Expected string with maximum length of ${e}`,t):Qe(),Jse=({multipleOf:e=0},t,n={})=>{if(!Fa(t))return Qe();if(!(Number.isFinite(t)&&Number.isFinite(e))||e<=0)throw new Cu("number");let r=t/e,o=Number.EPSILON*Math.max(1,Math.abs(r));return Math.abs(r-Math.round(r))<=o?Qe():Zt(n,"multipleOf",`Expected number being a multiple of ${e}`,t)},Yse=({maximum:e=0},t,n={})=>!Fa(t)||t<=e?Qe():Zt(n,"maximum",`Expected number less than or equal to ${e}`,t),Kse=({exclusiveMaximum:e=0},t,n={})=>!Fa(t)||t<e?Qe():Zt(n,"exclusiveMaximum",`Expected number less than ${e}`,t),Xse=({minimum:e=0},t,n={})=>!Fa(t)||t>=e?Qe():Zt(n,"minimum",`Expected number greater than or equal to ${e}`,t),Qse=({exclusiveMinimum:e=0},t,n={})=>!Fa(t)||t>e?Qe():Zt(n,"exclusiveMinimum",`Expected number greater than ${e}`,t),Zse=({properties:e={}},t,n={})=>{if(!Xn(t))return Qe();for(let[r,o]of Object.entries(t)){let i=e[r];if(!Lo(i))continue;let s=i.validate(o,gh(n,["properties",r],r));if(!s.valid)return s}return Qe()},eae=({properties:e={},additionalProperties:t,patternProperties:n},r,o={})=>{if(!Xn(r))return Qe();if(!Lo(t))throw new Cu("additionalProperties must be a boolean or a managed schema");let i=Object.keys(e),s=Xn(n)?Object.keys(r).filter(c=>Object.keys(n).some(u=>new RegExp(u).test(c))):[],a=Object.keys(r).filter(c=>!i.includes(c)&&!s.includes(c));if(a.length>0){if(YL(t)){if(t.toJSON()===!0)return Qe();let c=a.reduce((u,f)=>(u[f]=r[f],u),{});return Zt(o,"additionalProperties","Additional properties are not allowed",c)}else if(Lo(t))for(let c of a){let u=t.validate(r[c],gh(o,["additionalProperties"],c));if(!u.valid)return u}}return Qe()},tae=({dependentRequired:e},t,n={})=>{if(!Xn(t))return Qe();let r=Object.keys(t).filter(o=>typeof t[o]!="function");if(Xn(e)){for(let[o,i]of Object.entries(e))if(r.includes(o)){for(let s of i)if(!r.includes(s))return Zt(n,"dependentRequired",`Expected dependent required property ${s}`,t)}}return Qe()},nae=({required:e=[]},t,n={})=>{if(!Xn(t))return Qe();let r=Object.keys(t).filter(o=>typeof t[o]!="function");return e.every(o=>r.includes(o))?Qe():Zt(n,"required",`Expected object with required properties ${e.join(", ")}`,t)},rae=({dependentSchemas:e},t,n={})=>{if(!Xn(t))return Qe();let r=Object.keys(t).filter(o=>typeof t[o]!="function");if(Xn(e)){for(let[o,i]of Object.entries(e))if(r.includes(o)){let s=i.validate(t,n);if(!s.valid)return s}}return Qe()},oae=({minProperties:e=0},t,n={})=>Xn(t)?Object.keys(t).length>=e?Qe():Zt(n,"minProperties",`Expected object with at least ${e} properties`,t):Qe(),iae=({maxProperties:e=0},t,n={})=>!Xn(t)||Object.keys(t).length<=e?Qe():Zt(n,"maxProperties",`Expected object with at most ${e} properties`,t),sae=({patternProperties:e={}},t,n={})=>{if(!Xn(t))return Qe();if(!Xn(e))throw new Cu("patternProperties must be an object");for(let[r,o]of Object.entries(t))for(let[i,s]of Object.entries(e))if(new RegExp(i,"u").test(r)){let a=s.validate(o,gh(n,["patternProperties"],r));if(!a.valid)return a}return Qe()},aae=({propertyNames:e},t,n={})=>{if(!Xn(t)||e===void 0)return Qe();if(!Lo(e))throw new Cu("propertyNames must be a managed schema");for(let r of Object.keys(t)){let o=e.validate(r,gh(n,["propertyNames"],r));if(!o.valid)return o}return Qe()},lae=({items:e,prefixItems:t=[]},n,r={})=>{if(!wc(n)||e===void 0)return Qe();if(!Lo(e))throw new Cu("items must be a managed schema");for(let[o,i]of n.slice(t.length).entries()){let s=e.validate(i,gh(r,["items"],String(o)));if(!s.valid)return s}return Qe()},cae=({minItems:e=0},t,n={})=>!wc(t)||t.length>=e?Qe():Zt(n,"minItems",`Expected array with at least ${e} items`,t),uae=({maxItems:e=0},t,n={})=>!wc(t)||t.length<=e?Qe():Zt(n,"maxItems",`Expected array with at most ${e} items`,t),dae=({uniqueItems:e=!1},t,n={})=>{if(!wc(t)||!e)return Qe();for(let r=0;r<t.length;r++){let o=t[r];for(let i=0;i<t.length;i++){if(r===i)continue;let s=t[i];if(Mm(o,s))return Zt(n,"uniqueItems",`Duplicated items at index ${r} and ${i}`,t)}}return Qe()},fae=({contains:e,minContains:t,maxContains:n},r,o={})=>{if(!Lo(e))throw new Error("contains must be a managed schema");if(!wc(r))return Qe();let i=r.filter(s=>e.validate(s).valid).length;return i<(t??1)?Zt(o,t?"minContains":"contains",`Expected array to contain at least ${t??1}, but found ${i}`,r):n!==void 0&&i>n?Zt(o,"maxContains",`Expected array to contain at most ${n}, but found ${i}`,r):Qe()},hae=({prefixItems:e=[]},t,n={})=>{if(!wc(t))return Qe();for(let r=0;r<t.length;r++){let o=e[r]?.validate(t[r],gh(n,String(r),String(r)));if(o&&o?.valid!==!0)return o}return Qe()},jk={email:e=>{if(e.length>318)return!1;if(/^[a-z0-9!#$%&'*+/=?^_`{|}~-]{1,20}(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]{1,21}){0,2}@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,60}[a-z0-9])?){0,3}$/i.test(e))return!0;if(!e.includes("@")||/(^\.|^"|\.@|\.\.)/.test(e))return!1;let[t,n,...r]=e.split("@");return!t||!n||r.length!==0||t.length>64||n.length>253||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},hostname:e=>e.length>(e.endsWith(".")?254:253)?!1:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.?$/i.test(e),date:e=>{if(e.length!==10)return!1;if(e[5]==="0"&&e[6]==="2"){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)$/.test(e))return!0;let t=e.match(/^(\d\d\d\d)-02-29$/);if(!t)return!1;let n=Number(t[1]);return n%16===0||n%4===0&&n%25!==0}return e.endsWith("31")?/^\d\d\d\d-(?:0[13578]|1[02])-31$/.test(e):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)$/.test(e)},time:e=>{if(e.length>27||!/^(?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)?$/i.test(e))return!1;if(!/:60/.test(e))return!0;let t=e.match(/([0-9.]+|[^0-9.])/g);if(!t)return!1;let n=Number(t[0])*60+Number(t[2]);return t[5]==="+"?n+=24*60-Number(t[6]||0)*60-Number(t[8]||0):t[5]==="-"&&(n+=Number(t[6]||0)*60+Number(t[8]||0)),n%(24*60)===23*60+59},"date-time":e=>{if(e.length>38)return!1;let t=/^\d\d\d\d-(?:0[1-9]|1[0-2])-(?:[0-2]\d|3[01])[t\s](?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)$/i,n=e[5]==="0"&&e[6]==="2";if(n&&e[8]==="3"||!t.test(e))return!1;if(e[17]==="6"){let r=e.slice(11).match(/([0-9.]+|[^0-9.])/g);if(!r)return!1;let o=Number(r[0])*60+Number(r[2]);if(r[5]==="+"?o+=24*60-Number(r[6]||0)*60-Number(r[8]||0):r[5]==="-"&&(o+=Number(r[6]||0)*60+Number(r[8]||0)),o%(24*60)!==23*60+59)return!1}if(n){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)/.test(e))return!0;let r=e.match(/^(\d\d\d\d)-02-29/);if(!r)return!1;let o=Number(r[1]??0);return o%16===0||o%4===0&&o%25!==0}return e[8]==="3"&&e[9]==="1"?/^\d\d\d\d-(?:0[13578]|1[02])-31/.test(e):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)/.test(e)},ipv4:e=>e.length<=15&&/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)$/.test(e),ipv6:e=>{if(e.length>45||e.length<2)return!1;let t=0,n=0,r=0,o=!1,i=!1,s=0,a=!0;for(let u=0;u<e.length;u++){let f=e.charCodeAt(u);if(u===1&&s===58&&f!==58)return!1;if(f>=48&&f<=57){if(++r>4)return!1}else if(f===46){if(t>6||n>=3||r===0||i)return!1;n++,r=0}else if(f===58){if(n>0||t>=7)return!1;if(s===58){if(o)return!1;o=!0}else u===0&&(a=!1);t++,r=0,i=!1}else if(f>=97&&f<=102||f>=65&&f<=70){if(n>0||++r>4)return!1;i=!0}else return!1;s=f}if(t<2||n>0&&(n!==3||r===0))return!1;if(o&&e.length===2)return!0;if(n>0&&!/(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/.test(e))return!1;let c=n>0?6:7;return o?(a||r>0)&&t<c:t===c&&a&&r>0},uri:e=>/^[a-z][a-z0-9+\-.]*:(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/?(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i.test(e),"uri-reference":e=>/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/?(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)?(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i.test(e),"uri-template":e=>/^(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i.test(e),"json-pointer":e=>/^(?:|\/(?:[^~]|~0|~1)*)$/.test(e),"relative-json-pointer":e=>/^(?:0|[1-9][0-9]*)(?:|#|\/(?:[^~]|~0|~1)*)$/.test(e),uuid:e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e),duration:e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e)),regex:e=>{if(/[^\\]\\Z/.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}},binary:()=>!0,password:()=>!0},pae=({format:e},t,n={})=>!Ms(t)||!e?Qe():jk[e]?jk[e](t)?Qe():Zt(n,"format",`Expected format: ${e}`,t):Qe(),m2={type:Ise,const:Lse,enum:Fse,allOf:Vse,anyOf:zse,oneOf:Bse,not:Use,minLength:Wse,maxLength:Gse,pattern:qse,format:pae,minimum:Xse,exclusiveMinimum:Qse,maximum:Yse,exclusiveMaximum:Kse,multipleOf:Jse,required:nae,dependentRequired:tae,dependentSchemas:rae,minProperties:oae,maxProperties:iae,propertyNames:aae,properties:Zse,patternProperties:sae,additionalProperties:eae,minItems:cae,maxItems:uae,uniqueItems:dae,contains:fae,prefixItems:hae,items:lae,if:Hse};function mae(e,t,n={}){let r={keywordPath:n.keywordPath||[],instancePath:n.instancePath||[],coerce:n.coerce||!1,errors:n.errors||[],shortCircuit:n.shortCircuit||!1,ignoreUnsupported:n.ignoreUnsupported||!1,resolver:n.resolver||e.getResolver?.()||new Ij(e),depth:n.depth?n.depth+1:0,skipClone:n.skipClone||!1},o;if(n?.coerce&&e.coerce){let i=e.coerce(t,{resolver:r.resolver,depth:r.depth});o=r.skipClone?i:structuredClone(i)}else o=r.skipClone?t:structuredClone(t);if(n.ignoreUnsupported!==!0){let i=["$defs"];for(let s of i)if(e[s])throw new Error(`${s} not implemented`)}if(r.resolver.hasRef(e,o)){let i=r.resolver.resolve(e.$ref).validate(o,{...r,errors:[]});i.valid||r.errors.push(...i.errors)}else{let i={keywordPath:r.keywordPath,instancePath:r.instancePath,coerce:r.coerce,errors:[],shortCircuit:r.shortCircuit,ignoreUnsupported:r.ignoreUnsupported,resolver:r.resolver,depth:r.depth};for(let s in e)if(s==="type"&&e.type!==void 0){if(o!==void 0){let a=m2[s];if(a){i.errors=[];let c=a(e,o,i);if(!c.valid){if(n.shortCircuit)return c;r.errors.push(...c.errors)}}}}else if(s in m2&&e[s]!==void 0){if(o===void 0)continue;let a=m2[s];if(a){i.errors=[];let c=a(e,o,i);if(!c.valid){if(n.shortCircuit)return c;r.errors.push(...c.errors)}}}}return{valid:r.errors.length===0,errors:r.errors}}var Sc=class{"~standard";[Mr];_resolver;type;$id;$ref;$schema;title;description;readOnly;writeOnly;$comment;examples;constructor(t,n){let{type:r,validate:o,coerce:i,template:s,...a}=t||{};Object.assign(this,{type:r},a),this[Mr]={raw:t,optional:!1,overrides:n},this["~standard"]={version:1,vendor:"jsonv-ts",validate:c=>{let u=this.validate(c);return u.valid?{value:c}:{issues:u.errors.map(f=>({message:f.error,path:JL(f.instanceLocation)}))}}}}template(t,n){let r=this,o=t;if(r.const!==void 0?o=r.const:o===void 0&&(r.default!==void 0&&(o=r.default),n?.withExtendedOptional&&r.enum!==void 0&&(o=r.enum[0])),n?.withOptional!==!0&&o===void 0&&this.isOptional())return o;if(this[Mr].raw?.template){let s=this[Mr].raw.template(o,n);s!==void 0&&(o=s)}let i=this[Mr].overrides?.template?.(o,n);return i!==void 0&&(o=i),o}validate(t,n){let r={keywordPath:n?.keywordPath||[],instancePath:n?.instancePath||[],coerce:n?.coerce||!1,errors:n?.errors||[],shortCircuit:n?.shortCircuit||!1,ignoreUnsupported:n?.ignoreUnsupported||!1,resolver:n?.resolver||this.getResolver(),depth:n?.depth?n.depth+1:0,skipClone:n?.skipClone??!0},o=this[Mr].raw?.validate;if(o!==void 0){let i=o(t,r);if(!i.valid)return i}return mae(this,t,r)}coerce(t,n){let r={...n,resolver:n?.resolver||this.getResolver(),depth:n?.depth?n.depth+1:0,dropUnknown:n?.dropUnknown??!1},o=this[Mr].raw?.coerce;if(o!==void 0)return o(t,r);let i=this[Mr].overrides?.coerce?.(t,r)??t;return Dse(this,i,r)}optional(){return this[Mr].optional=!0,this}isOptional(){return this[Mr].optional}getResolver(){return this._resolver||(this._resolver=new Ij(this)),this._resolver}children(t){return[]}*walk({instancePath:t=[],keywordPath:n=[],data:r,maxDepth:o=Number.POSITIVE_INFINITY,...i}={}){let s=t.length===0&&r?XL(r):r;if(i.includeSelf!==!1&&(yield new Ig(this,{instancePath:t,keywordPath:n,data:s,...i})),!(t.length>=o))for(let a of this.children(i)){let c=[...t,...a.instancePath];yield*a.schema.walk({...i,data:s,maxDepth:o,instancePath:c,keywordPath:[...n,...a.keywordPath]})}}*[Symbol.iterator](t){for(let n of this.walk(t))yield n}toJSON(){let{toJSON:t,"~standard":n,_resolver:r,...o}=this;return JSON.parse(JSON.stringify(o))}},Ig=class{constructor(t,n={}){this.schema=t,this.instancePath=n.instancePath||[],this.keywordPath=n.keywordPath||[],this.depth=this.instancePath.length;try{if(n.data!==void 0){let r=ow(n.data,this.instancePath);t.validate(r).valid&&(this.data=r)}}catch{}}instancePath;keywordPath;data;depth;appendInstancePath(t){return this.instancePath=[...this.instancePath,...t],this}appendKeywordPath(t){return this.keywordPath=[...this.keywordPath,...t],this}setData(t){return this.data=t,this}};function sw(e,t,n){return new class extends Sc{type=e}(t,n)}var gae=class extends Sc{constructor(e){super(),this.bool=e}toJSON(){return this.bool}validate(e,t){return this.bool?Qe():Zt(t,"","Always fails",e)}};function S_(e){return new gae(e)}var Xi=e=>sw(e?.type,e),ui=(e,t)=>sw(void 0,{...t,const:e}),Lj=class extends Sc{type="object";properties;required;constructor(e,t){let n=[];for(let[o,i]of Object.entries(e||{}))Mse(Lo(i),"properties must be managed schemas",i),i[Mr].optional||n.push(o);let r=t?.additionalProperties===!1?S_(!1):t?.additionalProperties;n=n.length>0?n:void 0,super({...t,additionalProperties:r,properties:e,required:n},{template:(o,i)=>{let s=structuredClone(Xn(o)?o:{}),a={...s};if(this.properties)for(let[c,u]of Object.entries(this.properties)){let f=ow(s,c);if(u.isOptional()&&i?.withOptional!==!0&&f===void 0&&o===void 0)continue;let p=u.template(f,i);p!==void 0&&(a[c]=p)}if(!(Object.keys(a).length===0&&!i?.withExtendedOptional))return a},coerce:(o,i)=>{let s=Object.keys(this.properties),a=XL(o),c=s.length>0&&Object.values(this.properties).every(f=>!f[Mr].optional);if(Tse(a)&&(i?.dropUnknown===!0||c)&&(a=Pse(a,s)),typeof a=="string"&&a.match(/^\{/)&&(a=JSON.parse(a)),typeof a!="object"||a===null)return;if(this.properties)for(let[f,p]of Object.entries(this.properties)){let g=a[f];g!==void 0&&(a[f]=p.coerce(g,i))}let u=this.additionalProperties;if(i?.dropUnknown!==!0&&(!u||u.validate(null).valid)){let f=Xn(o)?o:{},p=Object.keys(f).filter(g=>!s.includes(g));for(let g of p)a[g]=u?u.coerce(f[g],i):f[g]}return a}}),this.properties=e,this.required=n}strict(){return this.additionalProperties=S_(!1),this[Mr].raw.additionalProperties=!1,this}partial(){for(let[,e]of Object.entries(this.properties))e[Mr].optional=!0;return this.required=void 0,this}children(e){let t=[];for(let[n,r]of Object.entries(this.properties)){let o=new Ig(r,e);o.appendInstancePath([n]),o.appendKeywordPath(["properties",n]),t.push(o)}return t}},ke=(e,t)=>new Lj(e,t),Ve=(e,t)=>ke(e,t).strict(),QL=(e,t)=>ke(e,t).partial(),Fj=class extends Sc{type="object";additionalProperties;constructor(t,n){super({...n,additionalProperties:t},{template:(r,o)=>o?.withExtendedOptional&&(r===void 0||!Xn(r))?{}:r}),this.additionalProperties=t}children(t){let n=[],r=new Ig(this.additionalProperties,t);return r.appendKeywordPath(["additionalProperties"]),n.push(r),n}},Ou=(e,t)=>new Fj(e,t),ZL=class extends Sc{type="string";constructor(e){super(e,{template:(t,n)=>n?.withExtendedOptional&&(t===void 0||!Ms(t))?"":t,coerce:t=>Fa(t)?String(t):t})}toJSON(){let{pattern:e,"~standard":t,_resolver:n,...r}=this;return JSON.parse(JSON.stringify({...r,pattern:e instanceof RegExp?e.source:e}))}},le=e=>new ZL(e),e7=(e,t,n)=>sw(e,n,{template:(r,o)=>o?.withExtendedOptional&&(r===void 0||!Fa(r))?n?.minimum??0:r,coerce:r=>{if(Ms(r)){let o=t.parseFn(r);if(!Number.isNaN(o))return o}return r}}),bt=e=>e7("number",{parseFn:Number},e),yae=e=>e7("integer",{parseFn:Number.parseInt},e),t7=class extends Sc{constructor(e,t={}){super({...t,items:e},{template:n=>n===void 0||!Array.isArray(n)?[]:n,coerce:(n,r)=>{try{let o=typeof n=="string"?JSON.parse(n):n;if(!Array.isArray(o))return;if(Lo(this.items))for(let[i,s]of o.entries())o[i]=this.items.coerce(s,r);return o}catch{}return n}}),this.items=e,this.items=e}type="array";children(e){let t=[];if(this.items){let n=new Ig(this.items,e);n.appendKeywordPath(["items"]),t.push(n)}return t}},un=(e,t)=>new t7(e,t),at=e=>sw("boolean",e,{template:(t,n)=>n?.withExtendedOptional&&(t===void 0||!Dj(t))?!1:t,coerce:t=>{if(Ms(t)&&["true","false","1","0"].includes(t))return t==="true"||t==="1";if(Fa(t)){if(t===1)return!0;if(t===0)return!1}return t}}),G0=Symbol.for("unionType"),n7=class extends Sc{[G0];constructor(e,t,n){super({...n,[t]:e},{coerce:(r,o)=>{let i=n?.coerce;if(i!==void 0)return i.bind(this)(r,o);let s=iw(e,r,{ignoreUnsupported:!0,resolver:o?.resolver,coerce:!0});return s.length>0?s[0].coerce(r,o):r}}),this[G0]=t}get schemas(){return this[this[G0]]}children(e){let t=[];for(let[n,r]of this.schemas.entries()){let o=new Ig(r,e);o.appendKeywordPath([this[G0],n]),t.push(o)}return t}},Rt=(e,t)=>new n7(e,"anyOf",t),bae=(e,t)=>new n7(e,"oneOf",t);function Ak(e,t){return Array.isArray(e)?e.map(t):e!==void 0?[t(e)]:[]}function Tk(e,t,n=r=>r){return Object.fromEntries(Object.entries(e).map(([r,o])=>[r,n(t(o,r),r)]))}function Pi(e){if(Dj(e))return S_(e);let t=structuredClone(e);if(!Xn(t))throw new Ose("non-object schemas cannot be converted to a schema",t);"properties"in t&&t.properties&&(t.properties=Tk(t.properties,(i,s)=>{try{return Pi(i)}catch(a){throw new Error(`Couldn't schemaize property "${s}": ${String(a)}`)}},(i,s)=>"required"in t&&Array.isArray(t.required)&&t.required.includes(s)?i:i.optional()));let n=["patternProperties","dependentSchemas","$defs"];for(let i of n)i in t&&t[i]&&(t[i]=Tk(t[i],Pi));let r=["additionalProperties","items","prefixItems","propertyNames","contains","not","if","then","else"];for(let i of r)i in t&&typeof t[i]<"u"&&(wc(t[i])?t[i]=Ak(t[i],Pi):t[i]=Pi(t[i]));let o=["anyOf","oneOf","allOf"];for(let i of o)if(i in t){let{[i]:s}=t;t[i]=Ak(s,Pi)}if(kse(t))switch(t.type){case"string":return le(t);case"number":return bt(t);case"integer":return yae(t);case"boolean":return at(t);case"object":{let{properties:i,...s}=t;return ke(i,s)}case"array":{let{items:i,...s}=t;return un(i,s)}}return Xi(t)}var E_=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),g2=e=>typeof globalThis.structuredClone=="function"?globalThis.structuredClone(e):JSON.parse(JSON.stringify(e)),vae=["maximum","exclusiveMaximum","maxLength","maxItems","maxProperties"],xae=["minimum","exclusiveMinimum","minLength","minItems","minProperties"];function wae(){return{type(e){let t=e.map(n=>Array.isArray(n)?new Set(n):new Set([n])).reduce((n,r)=>n?new Set([...n].filter(o=>r.has(o))):new Set(r));if(!t.size)throw new Error('Incompatible "type" in allOf');return t.size===1?[...t][0]:[...t]},enum(e){let t=e.map(n=>new Set(n)).reduce((n,r)=>new Set([...n].filter(o=>r.has(o))));if(!t.size)throw new Error('Incompatible "enum" in allOf');return[...t]},required(e){return[...new Set(e.flat())]},properties(e,t,n){return e.reduce((r,o)=>n(r,o),{})},patternProperties(e,t,n){return e.reduce((r,o)=>n(r,o),{})},$defs(e,t,n){return e.reduce((r,o)=>n(r,o),{})},definitions(e,t,n){return e.reduce((r,o)=>n(r,o),{})},...Object.fromEntries(vae.map(e=>[e,t=>Math.min(...t)])),...Object.fromEntries(xae.map(e=>[e,t=>Math.max(...t)]))}}function Sae(e){let t={...wae(),...e.resolvers};function n(r,o){if(Array.isArray(r)&&Array.isArray(o))return[...new Set([...r,...o])];if(E_(r)&&E_(o)){let i={...r};for(let[s,a]of Object.entries(o))if(s in i){let c=t[s];i[s]=c?c([i[s],a],s,n):g2(a)}else i[s]=g2(a);return i}return g2(o)}return n}var Eae=e=>e===!0||e===!1?e:null;function Nae(e,t={}){let n=t.deep!==!1,r=Sae(t);function o(i){if(Array.isArray(i))return i.map(o);if(!E_(i))return i;if(Array.isArray(i.allOf)){let a=i.allOf.map(o);if(a.some(y=>y===!1))return!1;let c=a.filter(y=>y!==!0);if(!c.length)return!0;let u=c.reduce((y,v)=>r(y,v),{}),f=Eae(u);if(f!==null)return f;let p={...i};delete p.allOf;let g=r(u,n?o(p):p);return n?o(g):g}let s={};for(let[a,c]of Object.entries(i))s[a]=o(c);return s}return o(e)}var _ae=(e,t)=>{let n=JSON.parse(JSON.stringify({...t,allOf:e}));return Pi(Nae(n))},Cae=e=>e(new Sc({$ref:"#",coerce:(t,n)=>{let r=n?.resolver?.resolve("#");if(!Lo(r))throw new Error("Ref not found: #");return r.coerce(t,n)}}));function $k(e){return typeof e=="string"?`"${e}"`:e===null?"null":String(e)}var r7=e=>e.description?`/**
* ${e.description}
*/
`:"";function Rk(e,t,n={}){let{type:r,export:o,...i}=n,s=t??e.title??"Schema",a=r==="interface"?`interface ${s} `:`type ${s} = `;return`${r7(e)}${o?"export ":""}${a}${o7(e,i)}`}function o7(e,t={}){let n={indent:t.indent??" ",currentIndent:t.currentIndent??0,fallback:t.fallback??"unknown",generateChild:t.generateChild??o7};if(!Lo(e))return n.fallback;let r=(i,s=0)=>i.split(`
`).map(a=>n.indent.repeat(s)+a).join(`
`),o=n.currentIndent;if(e instanceof Lj){let i=e.properties;return Object.keys(i).length===0?"{}":r(`{
`)+Object.entries(i).map(([s,a])=>{let c=a.isOptional()?"?":"";return r(`${r7(a)}${s}${c}: ${n.generateChild(a,n)}`,o+1)}).join(`,
`)+`
`+r("}",o)}else{if(e instanceof Fj)return`Record<string, ${n.generateChild(e.additionalProperties,n)}>`;if(e instanceof t7)return n.generateChild(e.items)+"[]";if("anyOf"in e&&Array.isArray(e.anyOf))return e.anyOf.map(i=>n.generateChild(i)).join(" | ");if("oneOf"in e&&Array.isArray(e.oneOf))return e.oneOf.map(i=>n.generateChild(i)).join(" | ");if(YL(e))return e.toJSON()?"any":"never"}return"const"in e&&typeof e.const<"u"?$k(e.const):"enum"in e&&typeof e.enum<"u"?e.enum.map(i=>$k(i)).join(" | ")??n.fallback:e.type??n.fallback}var i7=e=>{const t=e.split("/");return t[0]===""&&t.shift(),t},Oae=e=>{const{groups:t,path:n}=jae(e),r=i7(n);return Aae(r,t)},jae=e=>{const t=[];return e=e.replace(/\{[^}]+\}/g,(n,r)=>{const o=`@${r}`;return t.push([o,n]),o}),{groups:t,path:e}},Aae=(e,t)=>{for(let n=t.length-1;n>=0;n--){const[r]=t[n];for(let o=e.length-1;o>=0;o--)if(e[o].includes(r)){e[o]=e[o].replace(r,t[n][1]);break}}return e},J0={},Tae=(e,t)=>{if(e==="*")return"*";const n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){const r=`${e}#${t}`;return J0[r]||(n[2]?J0[r]=t&&t[0]!==":"&&t[0]!=="*"?[r,n[1],new RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:J0[r]=[e,n[1],!0]),J0[r]}return null},aw=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return t(n)}catch{return n}})}},$ae=e=>aw(e,decodeURI),s7=e=>{const t=e.url,n=t.indexOf("/",t.indexOf(":")+4);let r=n;for(;r<t.length;r++){const o=t.charCodeAt(r);if(o===37){const i=t.indexOf("?",r),s=t.slice(n,i===-1?void 0:i);return $ae(s.includes("%25")?s.replace(/%25/g,"%2525"):s)}else if(o===63)break}return t.slice(n,r)},Rae=e=>{const t=s7(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},Zd=(e,t,...n)=>(n.length&&(t=Zd(t,...n)),`${e?.[0]==="/"?"":"/"}${e}${t==="/"?"":`${e?.at(-1)==="/"?"":"/"}${t?.[0]==="/"?t.slice(1):t}`}`),a7=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;const t=e.split("/"),n=[];let r="";return t.forEach(o=>{if(o!==""&&!/\:/.test(o))r+="/"+o;else if(/\:/.test(o))if(/\?/.test(o)){n.length===0&&r===""?n.push("/"):n.push(r);const i=o.replace("?","");r+="/"+i,n.push(r)}else r+="/"+o}),n.filter((o,i,s)=>s.indexOf(o)===i)},y2=e=>/[%+]/.test(e)?(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),e.indexOf("%")!==-1?aw(e,zj):e):e,l7=(e,t,n)=>{let r;if(!n&&t&&!/[%+]/.test(t)){let s=e.indexOf(`?${t}`,8);for(s===-1&&(s=e.indexOf(`&${t}`,8));s!==-1;){const a=e.charCodeAt(s+t.length+1);if(a===61){const c=s+t.length+2,u=e.indexOf("&",c);return y2(e.slice(c,u===-1?void 0:u))}else if(a==38||isNaN(a))return"";s=e.indexOf(`&${t}`,s+1)}if(r=/[%+]/.test(e),!r)return}const o={};r??=/[%+]/.test(e);let i=e.indexOf("?",8);for(;i!==-1;){const s=e.indexOf("&",i+1);let a=e.indexOf("=",i);a>s&&s!==-1&&(a=-1);let c=e.slice(i+1,a===-1?s===-1?void 0:s:a);if(r&&(c=y2(c)),i=s,c==="")continue;let u;a===-1?u="":(u=e.slice(a+1,s===-1?void 0:s),r&&(u=y2(u))),n?(o[c]&&Array.isArray(o[c])||(o[c]=[]),o[c].push(u)):o[c]??=u}return t?o[t]:o},kae=l7,Mae=(e,t)=>l7(e,t,!0),zj=decodeURIComponent,Bj={name:"HMAC",hash:"SHA-256"},c7=async e=>{const t=typeof e=="string"?new TextEncoder().encode(e):e;return await crypto.subtle.importKey("raw",t,Bj,!1,["sign","verify"])},Pae=async(e,t)=>{const n=await c7(t),r=await crypto.subtle.sign(Bj.name,n,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(r)))},Dae=async(e,t,n)=>{try{const r=atob(e),o=new Uint8Array(r.length);for(let i=0,s=r.length;i<s;i++)o[i]=r.charCodeAt(i);return await crypto.subtle.verify(Bj,n,o,new TextEncoder().encode(t))}catch{return!1}},Iae=/^[\w!#$%&'*.^`|~+-]+$/,Lae=/^[ !#-:<-[\]-~]*$/,N_=(e,t)=>{if(t&&e.indexOf(t)===-1)return{};const n=e.trim().split(";"),r={};for(let o of n){o=o.trim();const i=o.indexOf("=");if(i===-1)continue;const s=o.substring(0,i).trim();if(t&&t!==s||!Iae.test(s))continue;let a=o.substring(i+1).trim();if(a.startsWith('"')&&a.endsWith('"')&&(a=a.slice(1,-1)),Lae.test(a)&&(r[s]=a.indexOf("%")!==-1?aw(a,zj):a,t))break}return r},kk=async(e,t,n)=>{const r={},o=await c7(t);for(const[i,s]of Object.entries(N_(e,n))){const a=s.lastIndexOf(".");if(a<1)continue;const c=s.substring(0,a),u=s.substring(a+1);if(u.length!==44||!u.endsWith("="))continue;const f=await Dae(u,c,o);r[i]=f?c:!1}return r},u7=(e,t,n={})=>{let r=`${e}=${t}`;if(e.startsWith("__Secure-")&&!n.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!n.secure)throw new Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw new Error("__Host- Cookie must not have Domain attributes")}if(n&&typeof n.maxAge=="number"&&n.maxAge>=0){if(n.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host"&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw new Error("Partitioned Cookie must have Secure attributes");r+="; Partitioned"}return r},b2=(e,t,n)=>(t=encodeURIComponent(t),u7(e,t,n)),Lb=async(e,t,n,r={})=>{const o=await Pae(t,n);return t=`${t}.${o}`,t=encodeURIComponent(t),u7(e,t,r)},d7=(e,t,n)=>{const r=e.req.raw.headers.get("Cookie");if(typeof t=="string"){if(!r)return;let i=t;return n==="secure"?i="__Secure-"+t:n==="host"&&(i="__Host-"+t),N_(r,i)[i]}return r?N_(r):{}},f7=async(e,t,n,r)=>{const o=e.req.raw.headers.get("Cookie");if(typeof n=="string"){if(!o)return;let s=n;return(await kk(o,t,s))[s]}return o?await kk(o,t):{}},Fae=(e,t,n)=>{let r;return n?.prefix==="secure"?r=b2("__Secure-"+e,t,{path:"/",...n,secure:!0}):n?.prefix==="host"?r=b2("__Host-"+e,t,{...n,path:"/",secure:!0,domain:void 0}):r=b2(e,t,{path:"/",...n}),r},h7=(e,t,n,r)=>{const o=Fae(t,n,r);e.header("Set-Cookie",o,{append:!0})},zae=async(e,t,n,r)=>{let o;return r?.prefix==="secure"?o=await Lb("__Secure-"+e,t,n,{path:"/",...r,secure:!0}):r?.prefix==="host"?o=await Lb("__Host-"+e,t,n,{...r,path:"/",secure:!0,domain:void 0}):o=await Lb(e,t,n,{path:"/",...r}),o},p7=async(e,t,n,r,o)=>{const i=await zae(t,n,r,o);e.header("set-cookie",i,{append:!0})},Bae=(e,t,n)=>{const r=d7(e,t,n?.prefix);return h7(e,t,"",{...n,maxAge:0}),r},Mk=class extends Error{res;status;constructor(e=500,t){super(t?.message,{cause:t?.cause}),this.res=t?.res,this.status=e}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}},Vae=(e,t)=>new Response(e,{headers:{"Content-Type":t}}).formData(),Uae=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/,Hae=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/,qae=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/,Wae=(e,t)=>async(n,r)=>{let o={};const i=n.req.header("Content-Type");switch(e){case"json":if(!i||!Uae.test(i))break;try{o=await n.req.json()}catch{const a="Malformed JSON in request body";throw new Mk(400,{message:a})}break;case"form":{if(!i||!(Hae.test(i)||qae.test(i)))break;let a;if(n.req.bodyCache.formData)a=await n.req.bodyCache.formData;else try{const u=await n.req.arrayBuffer();a=await Vae(u,i),n.req.bodyCache.formData=a}catch(u){let f="Malformed FormData request.";throw f+=u instanceof Error?` ${u.message}`:` ${String(u)}`,new Mk(400,{message:f})}const c={};a.forEach((u,f)=>{f.endsWith("[]")?(c[f]??=[]).push(u):Array.isArray(c[f])?c[f].push(u):f in c?c[f]=[c[f],u]:c[f]=u}),o=c;break}case"query":o=Object.fromEntries(Object.entries(n.req.queries()).map(([a,c])=>c.length===1?[a,c[0]]:[a,c]));break;case"param":o=n.req.param();break;case"header":o=n.req.header();break;case"cookie":o=d7(n);break}const s=await t(o,n);return s instanceof Response?s:(n.req.addValidatedData(e,s),await r())},Gae=Symbol.for("jsonv"),m7=(e,t)=>Object.assign(e,{[Gae]:t}),Ft=(e,t,n,r)=>{let o=Wae(e,async(i,s)=>{let a=n?.coerce!==!1?t.coerce(i,{dropUnknown:n?.dropUnknown}):i,c=t.validate(a);return c.valid?a:s.json({...c,schema:t},400)});return m7(o,{type:"parameters",skip:n?.skipOpenAPI,value:{target:e,schema:t}})},Jae={query:"query",param:"path",header:"header",cookie:"cookie"};function Yae(e,t){let n=Jae[t];return{parameters:Object.entries(e.properties).map(([r,o])=>({name:r,in:n,required:e.required?.includes(r)||void 0,description:o?.description||void 0,schema:structuredClone(o.toJSON())}))}}var zt=e=>m7(async(t,n)=>{await n()},{type:"route-doc",value:e??{}}),Pp={ConnectionClosed:{code:-32e3,message:"Connection closed"},RequestTimeout:{code:-32001,message:"Request timeout"},ParseError:{code:-32700,message:"Parse error"},InvalidRequest:{code:-32600,message:"Invalid request"},MethodNotFound:{code:-32601,message:"Method not found"},InvalidParams:{code:-32602,message:"Invalid params"},InternalError:{code:-32603,message:"Internal error",statusCode:500}},Kae=class extends Error{constructor(e,t,n){super(n??Pp[e].message),this.code=e,this.data=t}jsonrpc="2.0";id;static get codes(){return Object.fromEntries(Object.entries(Pp).map(([e,t])=>[e,e]))}setId(e){return this.id=e,this}get statusCode(){return Pp[this.code]?.statusCode??400}toJSON(){return{jsonrpc:this.jsonrpc,id:this.id,error:{code:Pp[this.code].code,message:this.message,data:this.data}}}toString(){return`MCP Error (${Pp[this.code].code} ${this.code}): ${this.message}`}},Xae=ke({}),g7=ke({jsonrpc:le({const:"2.0"}),id:bae([le(),bt()]).optional()});ke({...g7.properties,method:le(),params:Xi().optional()});ke({...g7.properties,result:Xae.optional(),error:ke({}).optional()});ke({title:le(),readOnlyHint:at(),destructiveHint:at({default:!0}),idempotentHint:at(),openWorldHint:at({default:!0})}).partial().strict();var ql=class{constructor(e,t,n){this.name=e,this.config=t,this.handler=n}async call(e,t,n){if(this.config?.inputSchema){let r=this.config.inputSchema.validate(e);if(!r.valid)throw new Kae("InvalidParams",{method:this.name,errors:r.errors,given:e,schema:this.config.inputSchema.toJSON()},"Invalid tool parameters")}return await this.handler(e,{context:t,raw:n,text:r=>({type:"text",text:r}),json:r=>({type:"text",text:JSON.stringify(r)})})}toJSON(){return{name:this.name,title:this.config?.title,description:this.config?.description,inputSchema:this.config?.inputSchema?.toJSON()??{type:"object"},outputSchema:this.config?.outputSchema?.toJSON(),annotations:Object.keys(this.config?.annotations??{}).length>0?this.config?.annotations:void 0,_meta:this.config?._meta}}};Ve({name:le(),version:le()});var Qae={emergency:"error",alert:"error",critical:"error",error:"error",warning:"warn",notice:"log",info:"info",debug:"debug"},Zae=Object.keys(Qae),ele="2025-06-18",tle=class{constructor(e){this.config=e}id=1;sessionId;async request(e,t){let n={jsonrpc:"2.0",id:this.id++,method:e,params:t},r=new Headers({"Content-Type":"application/json",Accept:"application/json"});this.config.headers&&Object.entries(this.config.headers).forEach(([i,s])=>{r.set(i,s)}),this.sessionId&&r.set("Mcp-Session-Id",this.sessionId);let o=await(this.config.fetch??fetch)(this.config.url,{method:"POST",headers:r,body:JSON.stringify(n)});if(!o.ok)throw new Error(`HTTP ${o.status} ${o.statusText}`);this.sessionId||(this.sessionId=o.headers.get("Mcp-Session-Id")??void 0);try{let i=await o.json();if(i.jsonrpc!=="2.0")throw new Error("Invalid JSON-RPC version");return i.result}catch(i){throw console.error(i),i}}async connect(){return this.request("initialize",{protocolVersion:ele,capabilities:{},clientInfo:{name:this.config.name,version:this.config.version}})}async ping(){return this.request("ping",{})}async setLoggingLevel(e){return this.request("logging/setLevel",{level:e})}async listResources(){return this.request("resources/list",{})}async listResourceTemplates(){return this.request("resources/templates/list",{})}async readResource(e){return this.request("resources/read",e)}async callTool(e){return this.request("tools/call",e)}async listTools(){return this.request("tools/list",{})}},nle=Symbol("mcp-feature"),eo=(e,t={})=>Object.assign(async(n,r)=>{await r()},{[nle]:{type:"tool",tool:{name:e,config:t}}});class rle extends ZL{}const Pm=e=>new rle(e),__=Symbol("bknd-validation-mark");function ole(e){const t=structuredClone(e);return y7(t,!1),t}function y7(e,t=!0){try{if(typeof e=="object"&&e!==null&&!Array.isArray(e)){t?e[__]=!0:delete e[__];for(const n in e)typeof e[n]=="object"&&e[n]!==null&&y7(e[n],t)}}catch{}}function ile(e){return typeof e!="object"||e===null?!1:e[__]===!0}const ju=le({pattern:"^[a-zA-Z_][a-zA-Z0-9_]*$",minLength:2,maxLength:150});class yh extends Br{constructor(t,n,r=[]){super(`Invalid schema given for ${JSON.stringify(n,null,2)}
Error: ${JSON.stringify(r[0],null,2)}
Schema: ${JSON.stringify(t.toJSON(),null,2)}`),this.schema=t,this.value=n,this.errors=r}name="InvalidSchemaError";code=Qt.UNPROCESSABLE_ENTITY;first(){return this.errors[0]}firstToString(){const t=this.first();return`${t.error} at ${t.instanceLocation}`}}const b7=e=>{const t=e.toJSON();return Pi(t)};function Cn(e,t,n){if(!n?.forceParse&&!n?.coerce&&ile(t))return t;const r=n?.clone?b7(e):e;let o=n?.coerce!==!1?r.coerce(t,{dropUnknown:n?.coerceDropUnknown??!1}):t;n?.withDefaults!==!1&&(o=r.template(o,{withOptional:!0,withExtendedOptional:n?.withExtendedDefaults??!1}));const i=e.validate(o,{shortCircuit:!0,ignoreUnsupported:!0});if(!i.valid)if(n?.onError)n.onError(i.errors);else throw new yh(r,t,i.errors);return o}function $i(e){return["string","number","boolean"].includes(typeof e)}function sle(e){return[!0,!1,0,1].includes(e)}class ale{constructor(t,n,r){this.key=t,this.valid=n,this.validate=r}expect}function hn(e,t,n){return Hl(typeof e=="string","key must be a string"),Hl(e[0]==="$","key must start with '$'"),Hl(typeof t=="function","valid must be a function"),Hl(typeof n=="function","validate must be a function"),new ale(e,t,n)}function v7(e,t){const n=e.find(r=>r.key===t);if(!n)throw new Error(`Expression does not exist: "${t}"`);return n}const Pk="$or";function Vj(e,t,n=[]){Hl(typeof e=="object","$query must be an object");const r=t.map(c=>c.key),o=Object.keys(e??{}),i=[Pk],s={};if(o.some(c=>c.startsWith("$")&&!i.includes(c)))throw new Error(`Invalid key '${o}'. Keys must not start with '$'.`);if(n.length>0&&o.some(c=>i.includes(c)))throw new Error(`Operand ${Pk} can only appear at the top level.`);function a(c,u,f=[]){if(v7(t,c).valid(u)===!1)throw new Error(`Given value at "${[...f,c].join(".")}" is invalid, got "${JSON.stringify(u)}"`)}for(const[c,u]of Object.entries(e))if(u!==void 0)if(c==="$or")Hl($a(u),"$or must be an object"),s.$or=Vj(u,t,[...n,c]);else if($i(u))a("$eq",u,n),s[c]={$eq:u};else if($a(u)){const f=Object.keys(u).filter(p=>!r.includes(p));if(f.length===0){s[c]={};for(const[p,g]of Object.entries(u))a(p,g,[...n,c]),s[c][p]=g}else throw new Error(`Invalid key(s) at "${c}": ${f.join(", ")}. Expected expression key: ${r.join(", ")}.`)}else throw new Error(`Invalid value at "${[...n,c].join(".")}", got "${JSON.stringify(u)}"`);return s}function Dk(e,t,n){const r=n.convert?Vj(e,t):e,o={$and:[],$or:[],keys:new Set},{$or:i,...s}=r;function a(c,u,f,p=[]){const g=v7(t,c);if(!g)throw new Error(`Expression does not exist: "${c}"`);if(!g.valid(u))throw new Error(`Invalid value at "${[...p,c].join(".")}", got "${JSON.stringify(u)}"`);return g.validate(u,f,n.exp_ctx)}for(const[c,u]of Object.entries(s))if(u!==void 0)for(const[f,p]of Object.entries(u)){const g=n.value_is_kv?c:Bn(n.object,c);o.$and.push(a(f,p,g,[c])),o.keys.add(c)}for(const[c,u]of Object.entries(i??{})){const f=n.value_is_kv?c:Bn(n.object,c);for(const[p,g]of Object.entries(u))o.$or.push(a(p,g,f,[c])),o.keys.add(c)}return o}function lle(e){const t={$and:void 0,$or:void 0};return t.$and=e.$and.every(n=>!!n),t.$or=e.$or.some(n=>!!n),!!t.$and||!!t.$or}function x7(e){if(!e.some(t=>t.key==="$eq"))throw new Error("'$eq' expression is required");return{convert:t=>Vj(t,e),build:(t,n)=>Dk(t,e,n),validate:(t,n)=>{const r=Dk(t,e,n);return lle(r)},expressions:e,expressionKeys:e.map(t=>t.key)}}const cle=[hn("$eq",e=>$i(e),(e,t)=>e===t),hn("$ne",e=>$i(e),(e,t)=>e!==t),hn("$like",e=>$i(e),(e,t)=>{switch(typeof t){case"string":return t.includes(e);case"number":return t===Number(e);case"boolean":return t===!!e;default:return!1}}),hn("$regex",e=>e instanceof RegExp?!0:typeof e=="string",(e,t)=>e instanceof RegExp?e.test(t):typeof e=="string"?new RegExp(e).test(t):!1),hn("$isnull",e=>!0,(e,t)=>e?t===null:t!==null),hn("$notnull",e=>!0,(e,t)=>e?t!==null:t===null),hn("$in",e=>Array.isArray(e),(e,t)=>e.includes(t)),hn("$notin",e=>Array.isArray(e),(e,t)=>!e.includes(t)),hn("$gt",e=>typeof e=="number",(e,t)=>t>e),hn("$gte",e=>typeof e=="number",(e,t)=>t>=e),hn("$lt",e=>typeof e=="number",(e,t)=>t<e),hn("$lte",e=>typeof e=="number",(e,t)=>t<=e),hn("$between",e=>Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"),(e,t)=>e[0]<=t&&t<=e[1])],ule=x7(cle),Ik=(e,t)=>ule.validate(e,{object:t,convert:!0});class dle extends Br{constructor(t,n,r){super(`Permission "${t.name}" not granted`),this.permission=t,this.policy=n,this.description=r}name="PermissionsException";code=Qt.FORBIDDEN;toJSON(){return{...super.toJSON(),description:this.description,permission:this.permission.name,policy:this.policy?.toJSON()}}}let Ur=class{_returning;static slug="untitled-event";params;returned=!1;validate(t){throw new fle(this,t)}clone(t){const n=new this.constructor(t);return n.returned=!0,n}constructor(t){this.params=t}};class lw extends Error{constructor(t,n){super(`Expected "${t}", got "${n}"`)}}class fle extends Error{constructor(t,n){super(`Event "${t.constructor.slug}" returned without validation`),this.data=n}}class hle{mode="async";event;handler;once=!1;id;constructor(t,n,r="async",o){this.event=t,this.handler=n,this.mode=r,this.id=o}}class Lg{constructor(t,n){this.options=n,t&&this.registerEvents(t),n?.listeners?.forEach(r=>this.addListener(r))}events=[];listeners=[];enabled=!0;asyncs=[];enable(){return this.enabled=!0,this}disable(){return this.enabled=!1,this}clearEvents(){return this.events=[],this}clearAll(){return this.clearEvents(),this.listeners=[],this}getListeners(){return[...this.listeners]}get Events(){return new Proxy(this,{get:(t,n)=>this.events.find(r=>r.slug===n)})}eventExists(t){let n;return typeof t=="string"?n=t:n=t.constructor?.slug??t.slug,!!this.events.find(r=>n===r.slug)}throwIfEventNotRegistered(t){if(!this.eventExists(t)){const n=t.constructor?.slug??t.slug??t;throw new Error(`Event "${n}" not registered`)}}registerEvent(t,n=!1){if(this.eventExists(t)){if(n)return this;throw new Error(`Event "${t.name}" already registered.`)}return this.events.push(t),this}registerEvents(t){return(typeof t=="object"?Object.values(t):t).forEach(r=>this.registerEvent(r,!0)),this}addListener(t){return this.throwIfEventNotRegistered(t.event),t.id&&this.listeners.find(r=>r.id===t.id)?(rt.debug(`Listener with id "${t.id}" already exists.`),this):(this.listeners.push(t),this)}createEventListener(t,n,r="async"){const o=typeof t=="string"?this.events.find(a=>a.slug===t):t,i=typeof r=="string"?{mode:r}:r,s=new hle(o,n,i.mode);i.once&&(s.once=!0),i.id&&(s.id=`${o.slug}-${i.id}`),this.addListener(s)}onEvent(t,n,r){this.createEventListener(t,n,r)}on(t,n,r){this.createEventListener(t,n,r)}onAny(t,n){this.events.forEach(r=>this.onEvent(r,t,n))}collectAsyncs(t){this.asyncs.push(...t)}async executeAsyncs(t=n=>Promise.all(n)){if(this.asyncs.length===0)return;const n=[...this.asyncs];this.asyncs=[],await t(n.map(r=>r()))}async emit(t){const n=t.constructor.slug;if(!this.enabled)return rt.debug("EventManager disabled, not emitting",n),t;if(!this.eventExists(t))throw new Error(`Event "${n}" not registered`);const r=[],o=[];this.listeners=this.listeners.filter(s=>s.event.slug!==n?!0:(s.mode==="sync"?r.push(s):o.push(async()=>{try{await s.handler(t,s.event.slug)}catch(a){this.options?.onError?this.options.onError(t,a):rt.error("Error executing async listener",s,a)}}),!s.once)),this.collectAsyncs(o);let i=t;for(const s of r)try{const a=await s.handler(i,s.event.slug);if(typeof a<"u"){const c=i.validate(a);if(c&&c.constructor.slug===n){if(!c.returned)throw new Error(`Returned event ${c.constructor.slug} must be marked as returned.`);i=c}}}catch(a){if(a instanceof lw)this.options?.onInvalidReturn?.(i,a),rt.warn(`Invalid return of event listener for "${n}": ${a.message}`);else if(this.options?.onError)this.options.onError(i,a);else throw a}return i}}function mv(e){return typeof e>"u"||e===void 0}function hi(e){return typeof e=="string"}function Uj(e){return typeof e=="number"}function w7(e){return typeof e=="boolean"}function S7(e){return e===null}function E7(e){return typeof e=="bigint"}function Bu(e){return typeof e=="function"}function Fg(e){return typeof e=="object"&&e!==null}function X(e){return Object.freeze(e)}function Y0(e){return rc(e)?e:[e]}function rc(e){return Array.isArray(e)}const uo=X({is(e){return e.kind==="IdentifierNode"},create(e){return X({kind:"IdentifierNode",name:e})}}),C_=X({is(e){return e.kind==="SchemableIdentifierNode"},create(e){return X({kind:"SchemableIdentifierNode",identifier:uo.create(e)})},createWithSchema(e,t){return X({kind:"SchemableIdentifierNode",schema:uo.create(e),identifier:uo.create(t)})}}),Ec=X({is(e){return e.kind==="AliasNode"},create(e,t){return X({kind:"AliasNode",node:e,alias:t})}}),Wl=X({is(e){return e.kind==="TableNode"},create(e){return X({kind:"TableNode",table:C_.create(e)})},createWithSchema(e,t){return X({kind:"TableNode",table:C_.createWithSchema(e,t)})}});function Vo(e){return Fg(e)&&Bu(e.toOperationNode)}function N7(e){return Fg(e)&&"expressionType"in e&&Vo(e)}function ple(e){return Fg(e)&&"expression"in e&&hi(e.alias)&&Vo(e)}const na=X({is(e){return e.kind==="SelectModifierNode"},create(e,t){return X({kind:"SelectModifierNode",modifier:e,of:t})},createWithExpression(e){return X({kind:"SelectModifierNode",rawModifier:e})}}),oc=X({is(e){return e.kind==="AndNode"},create(e,t){return X({kind:"AndNode",left:e,right:t})}}),bh=X({is(e){return e.kind==="OrNode"},create(e,t){return X({kind:"OrNode",left:e,right:t})}}),v2=X({is(e){return e.kind==="OnNode"},create(e){return X({kind:"OnNode",on:e})},cloneWithOperation(e,t,n){return X({...e,on:t==="And"?oc.create(e.on,n):bh.create(e.on,n)})}}),xu=X({is(e){return e.kind==="JoinNode"},create(e,t){return X({kind:"JoinNode",joinType:e,table:t,on:void 0})},createWithOn(e,t,n){return X({kind:"JoinNode",joinType:e,table:t,on:v2.create(n)})},cloneWithOn(e,t){return X({...e,on:e.on?v2.cloneWithOperation(e.on,"And",t):v2.create(t)})}}),Rf=X({is(e){return e.kind==="BinaryOperationNode"},create(e,t,n){return X({kind:"BinaryOperationNode",leftOperand:e,operator:t,rightOperand:n})}}),mle=["=","==","!=","<>",">",">=","<","<=","in","not in","is","is not","like","not like","match","ilike","not ilike","@>","<@","^@","&&","?","?&","?|","!<","!>","<=>","!~","~","~*","!~*","@@","@@@","!!","<->","regexp","is distinct from","is not distinct from"],gle=["+","-","*","/","%","^","&","|","#","<<",">>"],_7=["->","->>"],yle=[...mle,...gle,"&&","||"],ble=["exists","not exists"],vle=["not","-",...ble],xle=[...yle,..._7,...vle,"between","between symmetric"],Au=X({is(e){return e.kind==="OperatorNode"},create(e){return X({kind:"OperatorNode",operator:e})}});function Lk(e){return hi(e)&&_7.includes(e)}const Hj=X({is(e){return e.kind==="ColumnNode"},create(e){return X({kind:"ColumnNode",column:uo.create(e)})}}),C7=X({is(e){return e.kind==="SelectAllNode"},create(){return X({kind:"SelectAllNode"})}}),cw=X({is(e){return e.kind==="ReferenceNode"},create(e,t){return X({kind:"ReferenceNode",table:t,column:e})},createSelectAll(e){return X({kind:"ReferenceNode",table:e,column:C7.create()})}});function O7(e){return Fg(e)&&Vo(e)&&hi(e.dynamicReference)}const fa=X({is(e){return e.kind==="OrderByItemNode"},create(e,t){return X({kind:"OrderByItemNode",orderBy:e,direction:t})},cloneWith(e,t){return X({...e,...t})}}),Dr=X({is(e){return e.kind==="RawNode"},create(e,t){return X({kind:"RawNode",sqlFragments:X(e),parameters:X(t)})},createWithSql(e){return Dr.create([e],[])},createWithChild(e){return Dr.create(["",""],[e])},createWithChildren(e){return Dr.create(new Array(e.length+1).fill(""),e)}}),wle={is(e){return e.kind==="CollateNode"},create(e){return X({kind:"CollateNode",collation:uo.create(e)})}};class su{#e;constructor(t){this.#e=X(t)}desc(){return new su({node:fa.cloneWith(this.#e.node,{direction:Dr.createWithSql("desc")})})}asc(){return new su({node:fa.cloneWith(this.#e.node,{direction:Dr.createWithSql("asc")})})}nullsLast(){return new su({node:fa.cloneWith(this.#e.node,{nulls:"last"})})}nullsFirst(){return new su({node:fa.cloneWith(this.#e.node,{nulls:"first"})})}collate(t){return new su({node:fa.cloneWith(this.#e.node,{collation:wle.create(t)})})}toOperationNode(){return this.#e.node}}const Fk=new Set;function uw(e){Fk.has(e)||(Fk.add(e),console.log(e))}function Sle(e){return e==="asc"||e==="desc"}function gv(e){if(e.length===2)return[x2(e[0],e[1])];if(e.length===1){const[t]=e;return Array.isArray(t)?(uw("orderBy(array) is deprecated, use multiple orderBy calls instead."),t.map(n=>x2(n))):[x2(t)]}throw new Error(`Invalid number of arguments at order by! expected 1-2, received ${e.length}`)}function x2(e,t){const n=Ele(e);if(fa.is(n)){if(t)throw new Error("Cannot specify direction twice!");return n}return j7(n,t)}function Ele(e){if(pw(e))return hw(e);if(O7(e))return e.toOperationNode();const[t,n]=e.split(" ");return n?(uw("`orderBy('column asc')` is deprecated. Use `orderBy('column', 'asc')` instead."),j7(ic(t),n)):ic(e)}function j7(e,t){if(typeof t=="string"){if(!Sle(t))throw new Error(`Invalid order by direction: ${t}`);return fa.create(e,Dr.createWithSql(t))}if(N7(t))return uw("`orderBy(..., expr)` is deprecated. Use `orderBy(..., 'asc')` or `orderBy(..., (ob) => ...)` instead."),fa.create(e,t.toOperationNode());const n=fa.create(e);return t?t(new su({node:n})).toOperationNode():n}const yv=X({is(e){return e.kind==="JSONReferenceNode"},create(e,t){return X({kind:"JSONReferenceNode",reference:e,traversal:t})},cloneWithTraversal(e,t){return X({...e,traversal:t})}}),A7=X({is(e){return e.kind==="JSONOperatorChainNode"},create(e){return X({kind:"JSONOperatorChainNode",operator:e,values:X([])})},cloneWithValue(e,t){return X({...e,values:X([...e.values,t])})}}),lm=X({is(e){return e.kind==="JSONPathNode"},create(e){return X({kind:"JSONPathNode",inOperator:e,pathLegs:X([])})},cloneWithLeg(e,t){return X({...e,pathLegs:X([...e.pathLegs,t])})}});function Nle(e){return hi(e)?ic(e):e.toOperationNode()}function Dm(e){return rc(e)?e.map(t=>ii(t)):[ii(e)]}function ii(e){return pw(e)?hw(e):Nle(e)}function _le(e,t){const n=ic(e);if(Lk(t))return yv.create(n,A7.create(Au.create(t)));const r=t.slice(0,-1);if(Lk(r))return yv.create(n,lm.create(Au.create(r)));throw new Error(`Invalid JSON operator: ${t}`)}function ic(e){const t=".";if(!e.includes(t))return cw.create(Hj.create(e));const n=e.split(t).map(T7);if(n.length===3)return Ole(n);if(n.length===2)return jle(n);throw new Error(`invalid column reference ${e}`)}function Cle(e){const t=" as ";if(e.includes(t)){const[n,r]=e.split(t).map(T7);return Ec.create(ic(n),uo.create(r))}else return ic(e)}function Ole(e){const[t,n,r]=e;return cw.create(Hj.create(r),Wl.createWithSchema(t,n))}function jle(e){const[t,n]=e;return cw.create(Hj.create(n),Wl.create(t))}function T7(e){return e.trim()}const Ale=X({is(e){return e.kind==="PrimitiveValueListNode"},create(e){return X({kind:"PrimitiveValueListNode",values:X([...e])})}}),Tle=X({is(e){return e.kind==="ValueListNode"},create(e){return X({kind:"ValueListNode",values:X(e)})}}),sc=X({is(e){return e.kind==="ValueNode"},create(e){return X({kind:"ValueNode",value:e})},createImmediate(e){return X({kind:"ValueNode",value:e,immediate:!0})}});function $le(e){return rc(e)?Rle(e):Ir(e)}function Ir(e){return pw(e)?hw(e):sc.create(e)}function qj(e){return Uj(e)||w7(e)||S7(e)}function Wj(e){if(!qj(e))throw new Error(`unsafe immediate value ${JSON.stringify(e)}`);return sc.createImmediate(e)}function Rle(e){return e.some(pw)?Tle.create(e.map(t=>Ir(t))):Ale.create(e)}const Im=X({is(e){return e.kind==="ParensNode"},create(e){return X({kind:"ParensNode",node:e})}});function Qi(e){if(e.length===3)return Gj(e[0],e[1],e[2]);if(e.length===1)return Ir(e[0]);throw new Error(`invalid arguments: ${JSON.stringify(e)}`)}function Gj(e,t,n){return kle(t)&&$7(n)?Rf.create(ii(e),j_(t),sc.createImmediate(n)):Rf.create(ii(e),j_(t),$le(n))}function Lm(e,t,n){return Rf.create(ii(e),j_(t),ii(n))}function zk(e,t){return O_(Object.entries(e).filter(([,n])=>!mv(n)).map(([n,r])=>Gj(n,$7(r)?"is":"=",r)),t)}function O_(e,t,n=!0){const r=t==="and"?oc.create:bh.create;if(e.length===0)return Rf.create(sc.createImmediate(1),Au.create("="),sc.createImmediate(t==="and"?1:0));let o=Bk(e[0]);for(let i=1;i<e.length;++i)o=r(o,Bk(e[i]));return e.length>1&&n?Im.create(o):o}function kle(e){return e==="is"||e==="is not"}function $7(e){return S7(e)||w7(e)}function j_(e){if(hi(e)&&xle.includes(e))return Au.create(e);if(Vo(e))return e.toOperationNode();throw new Error(`invalid operator ${JSON.stringify(e)}`)}function Bk(e){return Vo(e)?e.toOperationNode():e}const kf=X({is(e){return e.kind==="OrderByNode"},create(e){return X({kind:"OrderByNode",items:X([...e])})},cloneWithItems(e,t){return X({...e,items:X([...e.items,...t])})}}),Vk=X({is(e){return e.kind==="PartitionByNode"},create(e){return X({kind:"PartitionByNode",items:X(e)})},cloneWithItems(e,t){return X({...e,items:X([...e.items,...t])})}}),A_=X({is(e){return e.kind==="OverNode"},create(){return X({kind:"OverNode"})},cloneWithOrderByItems(e,t){return X({...e,orderBy:e.orderBy?kf.cloneWithItems(e.orderBy,t):kf.create(t)})},cloneWithPartitionByItems(e,t){return X({...e,partitionBy:e.partitionBy?Vk.cloneWithItems(e.partitionBy,t):Vk.create(t)})}}),bv=X({is(e){return e.kind==="FromNode"},create(e){return X({kind:"FromNode",froms:X(e)})},cloneWithFroms(e,t){return X({...e,froms:X([...e.froms,...t])})}}),Uk=X({is(e){return e.kind==="GroupByNode"},create(e){return X({kind:"GroupByNode",items:X(e)})},cloneWithItems(e,t){return X({...e,items:X([...e.items,...t])})}}),Hk=X({is(e){return e.kind==="HavingNode"},create(e){return X({kind:"HavingNode",having:e})},cloneWithOperation(e,t,n){return X({...e,having:t==="And"?oc.create(e.having,n):bh.create(e.having,n)})}}),Mle=X({is(e){return e.kind==="InsertQueryNode"},create(e,t,n){return X({kind:"InsertQueryNode",into:e,...t&&{with:t},replace:n})},createWithoutInto(){return X({kind:"InsertQueryNode"})},cloneWith(e,t){return X({...e,...t})}}),R7=X({is(e){return e.kind==="ListNode"},create(e){return X({kind:"ListNode",items:X(e)})}}),Ple=X({is(e){return e.kind==="UpdateQueryNode"},create(e,t){return X({kind:"UpdateQueryNode",table:e.length===1?e[0]:R7.create(e),...t&&{with:t}})},createWithoutTable(){return X({kind:"UpdateQueryNode"})},cloneWithFromItems(e,t){return X({...e,from:e.from?bv.cloneWithFroms(e.from,t):bv.create(t)})},cloneWithUpdates(e,t){return X({...e,updates:e.updates?X([...e.updates,...t]):t})},cloneWithLimit(e,t){return X({...e,limit:t})}}),qk=X({is(e){return e.kind==="UsingNode"},create(e){return X({kind:"UsingNode",tables:X(e)})},cloneWithTables(e,t){return X({...e,tables:X([...e.tables,...t])})}}),Dle=X({is(e){return e.kind==="DeleteQueryNode"},create(e,t){return X({kind:"DeleteQueryNode",from:bv.create(e),...t&&{with:t}})},cloneWithOrderByItems:(e,t)=>En.cloneWithOrderByItems(e,t),cloneWithoutOrderBy:e=>En.cloneWithoutOrderBy(e),cloneWithLimit(e,t){return X({...e,limit:t})},cloneWithoutLimit(e){return X({...e,limit:void 0})},cloneWithUsing(e,t){return X({...e,using:e.using!==void 0?qk.cloneWithTables(e.using,t):qk.create(t)})}}),lf=X({is(e){return e.kind==="WhereNode"},create(e){return X({kind:"WhereNode",where:e})},cloneWithOperation(e,t,n){return X({...e,where:t==="And"?oc.create(e.where,n):bh.create(e.where,n)})}}),Wk=X({is(e){return e.kind==="ReturningNode"},create(e){return X({kind:"ReturningNode",selections:X(e)})},cloneWithSelections(e,t){return X({...e,selections:e.selections?X([...e.selections,...t]):X(t)})}}),Ile=X({is(e){return e.kind==="ExplainNode"},create(e,t){return X({kind:"ExplainNode",format:e,options:t})}}),dw=X({is(e){return e.kind==="WhenNode"},create(e){return X({kind:"WhenNode",condition:e})},cloneWithResult(e,t){return X({...e,result:t})}}),Lle=X({is(e){return e.kind==="MergeQueryNode"},create(e,t){return X({kind:"MergeQueryNode",into:e,...t&&{with:t}})},cloneWithUsing(e,t){return X({...e,using:t})},cloneWithWhen(e,t){return X({...e,whens:e.whens?X([...e.whens,t]):X([t])})},cloneWithThen(e,t){return X({...e,whens:e.whens?X([...e.whens.slice(0,-1),dw.cloneWithResult(e.whens[e.whens.length-1],t)]):void 0})}}),Gk=X({is(e){return e.kind==="OutputNode"},create(e){return X({kind:"OutputNode",selections:X(e)})},cloneWithSelections(e,t){return X({...e,selections:e.selections?X([...e.selections,...t]):X(t)})}}),En=X({is(e){return vn.is(e)||Mle.is(e)||Ple.is(e)||Dle.is(e)||Lle.is(e)},cloneWithEndModifier(e,t){return X({...e,endModifiers:e.endModifiers?X([...e.endModifiers,t]):X([t])})},cloneWithWhere(e,t){return X({...e,where:e.where?lf.cloneWithOperation(e.where,"And",t):lf.create(t)})},cloneWithJoin(e,t){return X({...e,joins:e.joins?X([...e.joins,t]):X([t])})},cloneWithReturning(e,t){return X({...e,returning:e.returning?Wk.cloneWithSelections(e.returning,t):Wk.create(t)})},cloneWithoutReturning(e){return X({...e,returning:void 0})},cloneWithoutWhere(e){return X({...e,where:void 0})},cloneWithExplain(e,t,n){return X({...e,explain:Ile.create(t,n?.toOperationNode())})},cloneWithTop(e,t){return X({...e,top:t})},cloneWithOutput(e,t){return X({...e,output:e.output?Gk.cloneWithSelections(e.output,t):Gk.create(t)})},cloneWithOrderByItems(e,t){return X({...e,orderBy:e.orderBy?kf.cloneWithItems(e.orderBy,t):kf.create(t)})},cloneWithoutOrderBy(e){return X({...e,orderBy:void 0})}}),vn=X({is(e){return e.kind==="SelectQueryNode"},create(e){return X({kind:"SelectQueryNode",...e&&{with:e}})},createFrom(e,t){return X({kind:"SelectQueryNode",from:bv.create(e),...t&&{with:t}})},cloneWithSelections(e,t){return X({...e,selections:e.selections?X([...e.selections,...t]):X(t)})},cloneWithDistinctOn(e,t){return X({...e,distinctOn:e.distinctOn?X([...e.distinctOn,...t]):X(t)})},cloneWithFrontModifier(e,t){return X({...e,frontModifiers:e.frontModifiers?X([...e.frontModifiers,t]):X([t])})},cloneWithOrderByItems:(e,t)=>En.cloneWithOrderByItems(e,t),cloneWithGroupByItems(e,t){return X({...e,groupBy:e.groupBy?Uk.cloneWithItems(e.groupBy,t):Uk.create(t)})},cloneWithLimit(e,t){return X({...e,limit:t})},cloneWithOffset(e,t){return X({...e,offset:t})},cloneWithFetch(e,t){return X({...e,fetch:t})},cloneWithHaving(e,t){return X({...e,having:e.having?Hk.cloneWithOperation(e.having,"And",t):Hk.create(t)})},cloneWithSetOperations(e,t){return X({...e,setOperations:e.setOperations?X([...e.setOperations,...t]):X([...t])})},cloneWithoutSelections(e){return X({...e,selections:[]})},cloneWithoutLimit(e){return X({...e,limit:void 0})},cloneWithoutOffset(e){return X({...e,offset:void 0})},cloneWithoutOrderBy:e=>En.cloneWithoutOrderBy(e),cloneWithoutGroupBy(e){return X({...e,groupBy:void 0})}});let Fle=class Fb{#e;constructor(t){this.#e=X(t)}on(...t){return new Fb({...this.#e,joinNode:xu.cloneWithOn(this.#e.joinNode,Qi(t))})}onRef(t,n,r){return new Fb({...this.#e,joinNode:xu.cloneWithOn(this.#e.joinNode,Lm(t,n,r))})}onTrue(){return new Fb({...this.#e,joinNode:xu.cloneWithOn(this.#e.joinNode,Dr.createWithSql("true"))})}$call(t){return t(this)}toOperationNode(){return this.#e.joinNode}};const zle=X({is(e){return e.kind==="PartitionByItemNode"},create(e){return X({kind:"PartitionByItemNode",partitionBy:e})}});function Ble(e){return Dm(e).map(zle.create)}class cm{#e;constructor(t){this.#e=X(t)}orderBy(...t){return new cm({overNode:A_.cloneWithOrderByItems(this.#e.overNode,gv(t))})}clearOrderBy(){return new cm({overNode:En.cloneWithoutOrderBy(this.#e.overNode)})}partitionBy(t){return new cm({overNode:A_.cloneWithPartitionByItems(this.#e.overNode,Ble(t))})}$call(t){return t(this)}toOperationNode(){return this.#e.overNode}}const um=X({is(e){return e.kind==="SelectionNode"},create(e){return X({kind:"SelectionNode",selection:e})},createSelectAll(){return X({kind:"SelectionNode",selection:C7.create()})},createSelectAllFromTable(e){return X({kind:"SelectionNode",selection:cw.createSelectAll(e)})}});function k7(e){return Bu(e)?k7(e(fw())):rc(e)?e.map(t=>Jk(t)):[Jk(e)]}function Jk(e){return hi(e)?um.create(Cle(e)):O7(e)?um.create(e.toOperationNode()):um.create(I7(e))}function M7(e){return e?Array.isArray(e)?e.map(Yk):[Yk(e)]:[um.createSelectAll()]}function Yk(e){if(hi(e))return um.createSelectAllFromTable(Bi(e));throw new Error(`invalid value selectAll expression: ${JSON.stringify(e)}`)}class Vle extends Error{node;constructor(t){super("no result"),this.node=t}}function Ule(e){return Object.prototype.hasOwnProperty.call(e,"prototype")}const Hle=X({is(e){return e.kind==="TopNode"},create(e,t){return X({kind:"TopNode",expression:e,modifiers:t})}});function qle(e,t){if(!Uj(e)&&!E7(e))throw new Error(`Invalid top expression: ${e}`);if(!mv(t)&&!Wle(t))throw new Error(`Invalid top modifiers: ${t}`);return Hle.create(e,t)}function Wle(e){return e==="percent"||e==="with ties"||e==="percent with ties"}const Gle=X({is(e){return e.kind==="LimitNode"},create(e){return X({kind:"LimitNode",limit:e})}}),Kk=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"];function Jle(e){let t="";for(let n=0;n<e;++n)t+=Yle();return t}function Yle(){return Kk[~~(Math.random()*Kk.length)]}function sa(){return new Kle}class Kle{#e;get queryId(){return this.#e===void 0&&(this.#e=Jle(8)),this.#e}}class Xle{nodeStack=[];#e=X({AliasNode:this.transformAlias.bind(this),ColumnNode:this.transformColumn.bind(this),IdentifierNode:this.transformIdentifier.bind(this),SchemableIdentifierNode:this.transformSchemableIdentifier.bind(this),RawNode:this.transformRaw.bind(this),ReferenceNode:this.transformReference.bind(this),SelectQueryNode:this.transformSelectQuery.bind(this),SelectionNode:this.transformSelection.bind(this),TableNode:this.transformTable.bind(this),FromNode:this.transformFrom.bind(this),SelectAllNode:this.transformSelectAll.bind(this),AndNode:this.transformAnd.bind(this),OrNode:this.transformOr.bind(this),ValueNode:this.transformValue.bind(this),ValueListNode:this.transformValueList.bind(this),PrimitiveValueListNode:this.transformPrimitiveValueList.bind(this),ParensNode:this.transformParens.bind(this),JoinNode:this.transformJoin.bind(this),OperatorNode:this.transformOperator.bind(this),WhereNode:this.transformWhere.bind(this),InsertQueryNode:this.transformInsertQuery.bind(this),DeleteQueryNode:this.transformDeleteQuery.bind(this),ReturningNode:this.transformReturning.bind(this),CreateTableNode:this.transformCreateTable.bind(this),AddColumnNode:this.transformAddColumn.bind(this),ColumnDefinitionNode:this.transformColumnDefinition.bind(this),DropTableNode:this.transformDropTable.bind(this),DataTypeNode:this.transformDataType.bind(this),OrderByNode:this.transformOrderBy.bind(this),OrderByItemNode:this.transformOrderByItem.bind(this),GroupByNode:this.transformGroupBy.bind(this),GroupByItemNode:this.transformGroupByItem.bind(this),UpdateQueryNode:this.transformUpdateQuery.bind(this),ColumnUpdateNode:this.transformColumnUpdate.bind(this),LimitNode:this.transformLimit.bind(this),OffsetNode:this.transformOffset.bind(this),OnConflictNode:this.transformOnConflict.bind(this),OnDuplicateKeyNode:this.transformOnDuplicateKey.bind(this),CreateIndexNode:this.transformCreateIndex.bind(this),DropIndexNode:this.transformDropIndex.bind(this),ListNode:this.transformList.bind(this),PrimaryKeyConstraintNode:this.transformPrimaryKeyConstraint.bind(this),UniqueConstraintNode:this.transformUniqueConstraint.bind(this),ReferencesNode:this.transformReferences.bind(this),CheckConstraintNode:this.transformCheckConstraint.bind(this),WithNode:this.transformWith.bind(this),CommonTableExpressionNode:this.transformCommonTableExpression.bind(this),CommonTableExpressionNameNode:this.transformCommonTableExpressionName.bind(this),HavingNode:this.transformHaving.bind(this),CreateSchemaNode:this.transformCreateSchema.bind(this),DropSchemaNode:this.transformDropSchema.bind(this),AlterTableNode:this.transformAlterTable.bind(this),DropColumnNode:this.transformDropColumn.bind(this),RenameColumnNode:this.transformRenameColumn.bind(this),AlterColumnNode:this.transformAlterColumn.bind(this),ModifyColumnNode:this.transformModifyColumn.bind(this),AddConstraintNode:this.transformAddConstraint.bind(this),DropConstraintNode:this.transformDropConstraint.bind(this),RenameConstraintNode:this.transformRenameConstraint.bind(this),ForeignKeyConstraintNode:this.transformForeignKeyConstraint.bind(this),CreateViewNode:this.transformCreateView.bind(this),RefreshMaterializedViewNode:this.transformRefreshMaterializedView.bind(this),DropViewNode:this.transformDropView.bind(this),GeneratedNode:this.transformGenerated.bind(this),DefaultValueNode:this.transformDefaultValue.bind(this),OnNode:this.transformOn.bind(this),ValuesNode:this.transformValues.bind(this),SelectModifierNode:this.transformSelectModifier.bind(this),CreateTypeNode:this.transformCreateType.bind(this),DropTypeNode:this.transformDropType.bind(this),ExplainNode:this.transformExplain.bind(this),DefaultInsertValueNode:this.transformDefaultInsertValue.bind(this),AggregateFunctionNode:this.transformAggregateFunction.bind(this),OverNode:this.transformOver.bind(this),PartitionByNode:this.transformPartitionBy.bind(this),PartitionByItemNode:this.transformPartitionByItem.bind(this),SetOperationNode:this.transformSetOperation.bind(this),BinaryOperationNode:this.transformBinaryOperation.bind(this),UnaryOperationNode:this.transformUnaryOperation.bind(this),UsingNode:this.transformUsing.bind(this),FunctionNode:this.transformFunction.bind(this),CaseNode:this.transformCase.bind(this),WhenNode:this.transformWhen.bind(this),JSONReferenceNode:this.transformJSONReference.bind(this),JSONPathNode:this.transformJSONPath.bind(this),JSONPathLegNode:this.transformJSONPathLeg.bind(this),JSONOperatorChainNode:this.transformJSONOperatorChain.bind(this),TupleNode:this.transformTuple.bind(this),MergeQueryNode:this.transformMergeQuery.bind(this),MatchedNode:this.transformMatched.bind(this),AddIndexNode:this.transformAddIndex.bind(this),CastNode:this.transformCast.bind(this),FetchNode:this.transformFetch.bind(this),TopNode:this.transformTop.bind(this),OutputNode:this.transformOutput.bind(this),OrActionNode:this.transformOrAction.bind(this),CollateNode:this.transformCollate.bind(this)});transformNode(t,n){if(!t)return t;this.nodeStack.push(t);const r=this.transformNodeImpl(t,n);return this.nodeStack.pop(),X(r)}transformNodeImpl(t,n){return this.#e[t.kind](t,n)}transformNodeList(t,n){return t&&X(t.map(r=>this.transformNode(r,n)))}transformSelectQuery(t,n){return{kind:"SelectQueryNode",from:this.transformNode(t.from,n),selections:this.transformNodeList(t.selections,n),distinctOn:this.transformNodeList(t.distinctOn,n),joins:this.transformNodeList(t.joins,n),groupBy:this.transformNode(t.groupBy,n),orderBy:this.transformNode(t.orderBy,n),where:this.transformNode(t.where,n),frontModifiers:this.transformNodeList(t.frontModifiers,n),endModifiers:this.transformNodeList(t.endModifiers,n),limit:this.transformNode(t.limit,n),offset:this.transformNode(t.offset,n),with:this.transformNode(t.with,n),having:this.transformNode(t.having,n),explain:this.transformNode(t.explain,n),setOperations:this.transformNodeList(t.setOperations,n),fetch:this.transformNode(t.fetch,n),top:this.transformNode(t.top,n)}}transformSelection(t,n){return{kind:"SelectionNode",selection:this.transformNode(t.selection,n)}}transformColumn(t,n){return{kind:"ColumnNode",column:this.transformNode(t.column,n)}}transformAlias(t,n){return{kind:"AliasNode",node:this.transformNode(t.node,n),alias:this.transformNode(t.alias,n)}}transformTable(t,n){return{kind:"TableNode",table:this.transformNode(t.table,n)}}transformFrom(t,n){return{kind:"FromNode",froms:this.transformNodeList(t.froms,n)}}transformReference(t,n){return{kind:"ReferenceNode",column:this.transformNode(t.column,n),table:this.transformNode(t.table,n)}}transformAnd(t,n){return{kind:"AndNode",left:this.transformNode(t.left,n),right:this.transformNode(t.right,n)}}transformOr(t,n){return{kind:"OrNode",left:this.transformNode(t.left,n),right:this.transformNode(t.right,n)}}transformValueList(t,n){return{kind:"ValueListNode",values:this.transformNodeList(t.values,n)}}transformParens(t,n){return{kind:"ParensNode",node:this.transformNode(t.node,n)}}transformJoin(t,n){return{kind:"JoinNode",joinType:t.joinType,table:this.transformNode(t.table,n),on:this.transformNode(t.on,n)}}transformRaw(t,n){return{kind:"RawNode",sqlFragments:X([...t.sqlFragments]),parameters:this.transformNodeList(t.parameters,n)}}transformWhere(t,n){return{kind:"WhereNode",where:this.transformNode(t.where,n)}}transformInsertQuery(t,n){return{kind:"InsertQueryNode",into:this.transformNode(t.into,n),columns:this.transformNodeList(t.columns,n),values:this.transformNode(t.values,n),returning:this.transformNode(t.returning,n),onConflict:this.transformNode(t.onConflict,n),onDuplicateKey:this.transformNode(t.onDuplicateKey,n),endModifiers:this.transformNodeList(t.endModifiers,n),with:this.transformNode(t.with,n),ignore:t.ignore,orAction:this.transformNode(t.orAction,n),replace:t.replace,explain:this.transformNode(t.explain,n),defaultValues:t.defaultValues,top:this.transformNode(t.top,n),output:this.transformNode(t.output,n)}}transformValues(t,n){return{kind:"ValuesNode",values:this.transformNodeList(t.values,n)}}transformDeleteQuery(t,n){return{kind:"DeleteQueryNode",from:this.transformNode(t.from,n),using:this.transformNode(t.using,n),joins:this.transformNodeList(t.joins,n),where:this.transformNode(t.where,n),returning:this.transformNode(t.returning,n),endModifiers:this.transformNodeList(t.endModifiers,n),with:this.transformNode(t.with,n),orderBy:this.transformNode(t.orderBy,n),limit:this.transformNode(t.limit,n),explain:this.transformNode(t.explain,n),top:this.transformNode(t.top,n),output:this.transformNode(t.output,n)}}transformReturning(t,n){return{kind:"ReturningNode",selections:this.transformNodeList(t.selections,n)}}transformCreateTable(t,n){return{kind:"CreateTableNode",table:this.transformNode(t.table,n),columns:this.transformNodeList(t.columns,n),constraints:this.transformNodeList(t.constraints,n),temporary:t.temporary,ifNotExists:t.ifNotExists,onCommit:t.onCommit,frontModifiers:this.transformNodeList(t.frontModifiers,n),endModifiers:this.transformNodeList(t.endModifiers,n),selectQuery:this.transformNode(t.selectQuery,n)}}transformColumnDefinition(t,n){return{kind:"ColumnDefinitionNode",column:this.transformNode(t.column,n),dataType:this.transformNode(t.dataType,n),references:this.transformNode(t.references,n),primaryKey:t.primaryKey,autoIncrement:t.autoIncrement,unique:t.unique,notNull:t.notNull,unsigned:t.unsigned,defaultTo:this.transformNode(t.defaultTo,n),check:this.transformNode(t.check,n),generated:this.transformNode(t.generated,n),frontModifiers:this.transformNodeList(t.frontModifiers,n),endModifiers:this.transformNodeList(t.endModifiers,n),nullsNotDistinct:t.nullsNotDistinct,identity:t.identity,ifNotExists:t.ifNotExists}}transformAddColumn(t,n){return{kind:"AddColumnNode",column:this.transformNode(t.column,n)}}transformDropTable(t,n){return{kind:"DropTableNode",table:this.transformNode(t.table,n),ifExists:t.ifExists,cascade:t.cascade}}transformOrderBy(t,n){return{kind:"OrderByNode",items:this.transformNodeList(t.items,n)}}transformOrderByItem(t,n){return{kind:"OrderByItemNode",orderBy:this.transformNode(t.orderBy,n),direction:this.transformNode(t.direction,n),collation:this.transformNode(t.collation,n),nulls:t.nulls}}transformGroupBy(t,n){return{kind:"GroupByNode",items:this.transformNodeList(t.items,n)}}transformGroupByItem(t,n){return{kind:"GroupByItemNode",groupBy:this.transformNode(t.groupBy,n)}}transformUpdateQuery(t,n){return{kind:"UpdateQueryNode",table:this.transformNode(t.table,n),from:this.transformNode(t.from,n),joins:this.transformNodeList(t.joins,n),where:this.transformNode(t.where,n),updates:this.transformNodeList(t.updates,n),returning:this.transformNode(t.returning,n),endModifiers:this.transformNodeList(t.endModifiers,n),with:this.transformNode(t.with,n),explain:this.transformNode(t.explain,n),limit:this.transformNode(t.limit,n),top:this.transformNode(t.top,n),output:this.transformNode(t.output,n),orderBy:this.transformNode(t.orderBy,n)}}transformColumnUpdate(t,n){return{kind:"ColumnUpdateNode",column:this.transformNode(t.column,n),value:this.transformNode(t.value,n)}}transformLimit(t,n){return{kind:"LimitNode",limit:this.transformNode(t.limit,n)}}transformOffset(t,n){return{kind:"OffsetNode",offset:this.transformNode(t.offset,n)}}transformOnConflict(t,n){return{kind:"OnConflictNode",columns:this.transformNodeList(t.columns,n),constraint:this.transformNode(t.constraint,n),indexExpression:this.transformNode(t.indexExpression,n),indexWhere:this.transformNode(t.indexWhere,n),updates:this.transformNodeList(t.updates,n),updateWhere:this.transformNode(t.updateWhere,n),doNothing:t.doNothing}}transformOnDuplicateKey(t,n){return{kind:"OnDuplicateKeyNode",updates:this.transformNodeList(t.updates,n)}}transformCreateIndex(t,n){return{kind:"CreateIndexNode",name:this.transformNode(t.name,n),table:this.transformNode(t.table,n),columns:this.transformNodeList(t.columns,n),unique:t.unique,using:this.transformNode(t.using,n),ifNotExists:t.ifNotExists,where:this.transformNode(t.where,n),nullsNotDistinct:t.nullsNotDistinct}}transformList(t,n){return{kind:"ListNode",items:this.transformNodeList(t.items,n)}}transformDropIndex(t,n){return{kind:"DropIndexNode",name:this.transformNode(t.name,n),table:this.transformNode(t.table,n),ifExists:t.ifExists,cascade:t.cascade}}transformPrimaryKeyConstraint(t,n){return{kind:"PrimaryKeyConstraintNode",columns:this.transformNodeList(t.columns,n),name:this.transformNode(t.name,n),deferrable:t.deferrable,initiallyDeferred:t.initiallyDeferred}}transformUniqueConstraint(t,n){return{kind:"UniqueConstraintNode",columns:this.transformNodeList(t.columns,n),name:this.transformNode(t.name,n),nullsNotDistinct:t.nullsNotDistinct,deferrable:t.deferrable,initiallyDeferred:t.initiallyDeferred}}transformForeignKeyConstraint(t,n){return{kind:"ForeignKeyConstraintNode",columns:this.transformNodeList(t.columns,n),references:this.transformNode(t.references,n),name:this.transformNode(t.name,n),onDelete:t.onDelete,onUpdate:t.onUpdate,deferrable:t.deferrable,initiallyDeferred:t.initiallyDeferred}}transformSetOperation(t,n){return{kind:"SetOperationNode",operator:t.operator,expression:this.transformNode(t.expression,n),all:t.all}}transformReferences(t,n){return{kind:"ReferencesNode",table:this.transformNode(t.table,n),columns:this.transformNodeList(t.columns,n),onDelete:t.onDelete,onUpdate:t.onUpdate}}transformCheckConstraint(t,n){return{kind:"CheckConstraintNode",expression:this.transformNode(t.expression,n),name:this.transformNode(t.name,n)}}transformWith(t,n){return{kind:"WithNode",expressions:this.transformNodeList(t.expressions,n),recursive:t.recursive}}transformCommonTableExpression(t,n){return{kind:"CommonTableExpressionNode",name:this.transformNode(t.name,n),materialized:t.materialized,expression:this.transformNode(t.expression,n)}}transformCommonTableExpressionName(t,n){return{kind:"CommonTableExpressionNameNode",table:this.transformNode(t.table,n),columns:this.transformNodeList(t.columns,n)}}transformHaving(t,n){return{kind:"HavingNode",having:this.transformNode(t.having,n)}}transformCreateSchema(t,n){return{kind:"CreateSchemaNode",schema:this.transformNode(t.schema,n),ifNotExists:t.ifNotExists}}transformDropSchema(t,n){return{kind:"DropSchemaNode",schema:this.transformNode(t.schema,n),ifExists:t.ifExists,cascade:t.cascade}}transformAlterTable(t,n){return{kind:"AlterTableNode",table:this.transformNode(t.table,n),renameTo:this.transformNode(t.renameTo,n),setSchema:this.transformNode(t.setSchema,n),columnAlterations:this.transformNodeList(t.columnAlterations,n),addConstraint:this.transformNode(t.addConstraint,n),dropConstraint:this.transformNode(t.dropConstraint,n),renameConstraint:this.transformNode(t.renameConstraint,n),addIndex:this.transformNode(t.addIndex,n),dropIndex:this.transformNode(t.dropIndex,n)}}transformDropColumn(t,n){return{kind:"DropColumnNode",column:this.transformNode(t.column,n)}}transformRenameColumn(t,n){return{kind:"RenameColumnNode",column:this.transformNode(t.column,n),renameTo:this.transformNode(t.renameTo,n)}}transformAlterColumn(t,n){return{kind:"AlterColumnNode",column:this.transformNode(t.column,n),dataType:this.transformNode(t.dataType,n),dataTypeExpression:this.transformNode(t.dataTypeExpression,n),setDefault:this.transformNode(t.setDefault,n),dropDefault:t.dropDefault,setNotNull:t.setNotNull,dropNotNull:t.dropNotNull}}transformModifyColumn(t,n){return{kind:"ModifyColumnNode",column:this.transformNode(t.column,n)}}transformAddConstraint(t,n){return{kind:"AddConstraintNode",constraint:this.transformNode(t.constraint,n)}}transformDropConstraint(t,n){return{kind:"DropConstraintNode",constraintName:this.transformNode(t.constraintName,n),ifExists:t.ifExists,modifier:t.modifier}}transformRenameConstraint(t,n){return{kind:"RenameConstraintNode",oldName:this.transformNode(t.oldName,n),newName:this.transformNode(t.newName,n)}}transformCreateView(t,n){return{kind:"CreateViewNode",name:this.transformNode(t.name,n),temporary:t.temporary,orReplace:t.orReplace,ifNotExists:t.ifNotExists,materialized:t.materialized,columns:this.transformNodeList(t.columns,n),as:this.transformNode(t.as,n)}}transformRefreshMaterializedView(t,n){return{kind:"RefreshMaterializedViewNode",name:this.transformNode(t.name,n),concurrently:t.concurrently,withNoData:t.withNoData}}transformDropView(t,n){return{kind:"DropViewNode",name:this.transformNode(t.name,n),ifExists:t.ifExists,materialized:t.materialized,cascade:t.cascade}}transformGenerated(t,n){return{kind:"GeneratedNode",byDefault:t.byDefault,always:t.always,identity:t.identity,stored:t.stored,expression:this.transformNode(t.expression,n)}}transformDefaultValue(t,n){return{kind:"DefaultValueNode",defaultValue:this.transformNode(t.defaultValue,n)}}transformOn(t,n){return{kind:"OnNode",on:this.transformNode(t.on,n)}}transformSelectModifier(t,n){return{kind:"SelectModifierNode",modifier:t.modifier,rawModifier:this.transformNode(t.rawModifier,n),of:this.transformNodeList(t.of,n)}}transformCreateType(t,n){return{kind:"CreateTypeNode",name:this.transformNode(t.name,n),enum:this.transformNode(t.enum,n)}}transformDropType(t,n){return{kind:"DropTypeNode",name:this.transformNode(t.name,n),ifExists:t.ifExists}}transformExplain(t,n){return{kind:"ExplainNode",format:t.format,options:this.transformNode(t.options,n)}}transformSchemableIdentifier(t,n){return{kind:"SchemableIdentifierNode",schema:this.transformNode(t.schema,n),identifier:this.transformNode(t.identifier,n)}}transformAggregateFunction(t,n){return{kind:"AggregateFunctionNode",func:t.func,aggregated:this.transformNodeList(t.aggregated,n),distinct:t.distinct,orderBy:this.transformNode(t.orderBy,n),withinGroup:this.transformNode(t.withinGroup,n),filter:this.transformNode(t.filter,n),over:this.transformNode(t.over,n)}}transformOver(t,n){return{kind:"OverNode",orderBy:this.transformNode(t.orderBy,n),partitionBy:this.transformNode(t.partitionBy,n)}}transformPartitionBy(t,n){return{kind:"PartitionByNode",items:this.transformNodeList(t.items,n)}}transformPartitionByItem(t,n){return{kind:"PartitionByItemNode",partitionBy:this.transformNode(t.partitionBy,n)}}transformBinaryOperation(t,n){return{kind:"BinaryOperationNode",leftOperand:this.transformNode(t.leftOperand,n),operator:this.transformNode(t.operator,n),rightOperand:this.transformNode(t.rightOperand,n)}}transformUnaryOperation(t,n){return{kind:"UnaryOperationNode",operator:this.transformNode(t.operator,n),operand:this.transformNode(t.operand,n)}}transformUsing(t,n){return{kind:"UsingNode",tables:this.transformNodeList(t.tables,n)}}transformFunction(t,n){return{kind:"FunctionNode",func:t.func,arguments:this.transformNodeList(t.arguments,n)}}transformCase(t,n){return{kind:"CaseNode",value:this.transformNode(t.value,n),when:this.transformNodeList(t.when,n),else:this.transformNode(t.else,n),isStatement:t.isStatement}}transformWhen(t,n){return{kind:"WhenNode",condition:this.transformNode(t.condition,n),result:this.transformNode(t.result,n)}}transformJSONReference(t,n){return{kind:"JSONReferenceNode",reference:this.transformNode(t.reference,n),traversal:this.transformNode(t.traversal,n)}}transformJSONPath(t,n){return{kind:"JSONPathNode",inOperator:this.transformNode(t.inOperator,n),pathLegs:this.transformNodeList(t.pathLegs,n)}}transformJSONPathLeg(t,n){return{kind:"JSONPathLegNode",type:t.type,value:t.value}}transformJSONOperatorChain(t,n){return{kind:"JSONOperatorChainNode",operator:this.transformNode(t.operator,n),values:this.transformNodeList(t.values,n)}}transformTuple(t,n){return{kind:"TupleNode",values:this.transformNodeList(t.values,n)}}transformMergeQuery(t,n){return{kind:"MergeQueryNode",into:this.transformNode(t.into,n),using:this.transformNode(t.using,n),whens:this.transformNodeList(t.whens,n),with:this.transformNode(t.with,n),top:this.transformNode(t.top,n),endModifiers:this.transformNodeList(t.endModifiers,n),output:this.transformNode(t.output,n),returning:this.transformNode(t.returning,n)}}transformMatched(t,n){return{kind:"MatchedNode",not:t.not,bySource:t.bySource}}transformAddIndex(t,n){return{kind:"AddIndexNode",name:this.transformNode(t.name,n),columns:this.transformNodeList(t.columns,n),unique:t.unique,using:this.transformNode(t.using,n),ifNotExists:t.ifNotExists}}transformCast(t,n){return{kind:"CastNode",expression:this.transformNode(t.expression,n),dataType:this.transformNode(t.dataType,n)}}transformFetch(t,n){return{kind:"FetchNode",rowCount:this.transformNode(t.rowCount,n),modifier:t.modifier}}transformTop(t,n){return{kind:"TopNode",expression:t.expression,modifiers:t.modifiers}}transformOutput(t,n){return{kind:"OutputNode",selections:this.transformNodeList(t.selections,n)}}transformDataType(t,n){return t}transformSelectAll(t,n){return t}transformIdentifier(t,n){return t}transformValue(t,n){return t}transformPrimitiveValueList(t,n){return t}transformOperator(t,n){return t}transformDefaultInsertValue(t,n){return t}transformOrAction(t,n){return t}transformCollate(t,n){return t}}const Qle=X({AlterTableNode:!0,CreateIndexNode:!0,CreateSchemaNode:!0,CreateTableNode:!0,CreateTypeNode:!0,CreateViewNode:!0,RefreshMaterializedViewNode:!0,DeleteQueryNode:!0,DropIndexNode:!0,DropSchemaNode:!0,DropTableNode:!0,DropTypeNode:!0,DropViewNode:!0,InsertQueryNode:!0,RawNode:!0,SelectQueryNode:!0,UpdateQueryNode:!0,MergeQueryNode:!0}),Zle={json_agg:!0,to_json:!0};class ece extends Xle{#e;#t=new Set;#n=new Set;constructor(t){super(),this.#e=t}transformNodeImpl(t,n){if(!this.#r(t))return super.transformNodeImpl(t,n);const r=this.#a(t);for(const s of r)this.#n.add(s);const o=this.#o(t);for(const s of o)this.#t.add(s);const i=super.transformNodeImpl(t,n);for(const s of o)this.#t.delete(s);for(const s of r)this.#n.delete(s);return i}transformSchemableIdentifier(t,n){const r=super.transformSchemableIdentifier(t,n);return r.schema||!this.#t.has(t.identifier.name)?r:{...r,schema:uo.create(this.#e)}}transformReferences(t,n){const r=super.transformReferences(t,n);return r.table.table.schema?r:{...r,table:Wl.createWithSchema(this.#e,r.table.table.identifier.name)}}transformAggregateFunction(t,n){return{...super.transformAggregateFunction({...t,aggregated:[]},n),aggregated:this.#i(t,n,"aggregated")}}transformFunction(t,n){return{...super.transformFunction({...t,arguments:[]},n),arguments:this.#i(t,n,"arguments")}}#i(t,n,r){return Zle[t.func]?t[r].map(o=>!Wl.is(o)||o.table.schema?this.transformNode(o,n):{...o,table:this.transformIdentifier(o.table.identifier,n)}):this.transformNodeList(t[r],n)}#r(t){return t.kind in Qle}#o(t){const n=new Set;if("name"in t&&t.name&&C_.is(t.name)&&this.#l(t.name,n),"from"in t&&t.from)for(const r of t.from.froms)this.#s(r,n);if("into"in t&&t.into&&this.#s(t.into,n),"table"in t&&t.table&&this.#s(t.table,n),"joins"in t&&t.joins)for(const r of t.joins)this.#s(r.table,n);return"using"in t&&t.using&&(xu.is(t.using)?this.#s(t.using.table,n):this.#s(t.using,n)),n}#a(t){const n=new Set;return"with"in t&&t.with&&this.#c(t.with,n),n}#s(t,n){if(Wl.is(t))this.#l(t.table,n);else if(Ec.is(t)&&Wl.is(t.node))this.#l(t.node.table,n);else if(R7.is(t))for(const r of t.items)this.#s(r,n)}#l(t,n){const r=t.identifier.name;!this.#t.has(r)&&!this.#n.has(r)&&n.add(r)}#c(t,n){for(const r of t.expressions){const o=r.name.table.table.identifier.name;this.#n.has(o)||n.add(o)}}}class tce{#e;constructor(t){this.#e=new ece(t)}transformQuery(t){return this.#e.transformNode(t.node,t.queryId)}async transformResult(t){return t.result}}class Xk{#e;#t;#n;constructor(){this.#e=new Promise((t,n)=>{this.#n=n,this.#t=t})}get promise(){return this.#e}resolve=t=>{this.#t&&this.#t(t)};reject=t=>{this.#n&&this.#n(t)}}async function nce(e){const t=new Xk,n=new Xk;return e.provideConnection(async r=>(t.resolve(r),await n.promise)).catch(r=>t.reject(r)),X({connection:await t.promise,release:n.resolve})}const rce=X([]);class oce{#e;constructor(t=rce){this.#e=t}get plugins(){return this.#e}transformQuery(t,n){for(const r of this.#e){const o=r.transformQuery({node:t,queryId:n});if(o.kind===t.kind)t=o;else throw new Error(["KyselyPlugin.transformQuery must return a node","of the same kind that was given to it.",`The plugin was given a ${t.kind}`,`but it returned a ${o.kind}`].join(" "))}return t}async executeQuery(t){return await this.provideConnection(async n=>{const r=await n.executeQuery(t);return"numUpdatedOrDeletedRows"in r&&uw("kysely:warning: outdated driver/plugin detected! `QueryResult.numUpdatedOrDeletedRows` has been replaced with `QueryResult.numAffectedRows`."),await this.#t(r,t.queryId)})}async*stream(t,n){const{connection:r,release:o}=await nce(this);try{for await(const i of r.streamQuery(t,n))yield await this.#t(i,t.queryId)}finally{o()}}async#t(t,n){for(const r of this.#e)t=await r.transformResult({result:t,queryId:n});return t}}class cf extends oce{get adapter(){throw new Error("this query cannot be compiled to SQL")}compileQuery(){throw new Error("this query cannot be compiled to SQL")}provideConnection(){throw new Error("this query cannot be executed")}withConnectionProvider(){throw new Error("this query cannot have a connection provider")}withPlugin(t){return new cf([...this.plugins,t])}withPlugins(t){return new cf([...this.plugins,...t])}withPluginAtFront(t){return new cf([t,...this.plugins])}withoutPlugins(){return new cf([])}}const P7=new cf;function ice(e,t){return new Fle({joinNode:xu.create(e,zm(t))})}function sce(){return new cm({overNode:A_.create()})}function ace(e,t){if(t.length===3)return cce(e,t[0],t[1],t[2]);if(t.length===2)return lce(e,t[0],t[1]);if(t.length===1)return uce(e,t[0]);throw new Error("not implemented")}function lce(e,t,n){return n(ice(e,t)).toOperationNode()}function cce(e,t,n,r){return xu.createWithOn(e,zm(t),Lm(n,"=",r))}function uce(e,t){return xu.create(e,zm(t))}const dce=X({is(e){return e.kind==="OffsetNode"},create(e){return X({kind:"OffsetNode",offset:e})}}),fce=X({is(e){return e.kind==="GroupByItemNode"},create(e){return X({kind:"GroupByItemNode",groupBy:e})}});function hce(e){return e=Bu(e)?e(fw()):e,Dm(e).map(fce.create)}const pce=X({is(e){return e.kind==="SetOperationNode"},create(e,t,n){return X({kind:"SetOperationNode",operator:e,expression:t,all:n})}});function Hd(e,t,n){return Bu(t)&&(t=t(Yj())),rc(t)||(t=[t]),t.map(r=>pce.create(e,hw(r),n))}class Yt{#e;constructor(t){this.#e=t}get expressionType(){}as(t){return new Jj(this,t)}or(...t){return new vv(bh.create(this.#e,Qi(t)))}and(...t){return new xv(oc.create(this.#e,Qi(t)))}$castTo(){return new Yt(this.#e)}$notNull(){return new Yt(this.#e)}toOperationNode(){return this.#e}}class Jj{#e;#t;constructor(t,n){this.#e=t,this.#t=n}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return Ec.create(this.#e.toOperationNode(),Vo(this.#t)?this.#t.toOperationNode():uo.create(this.#t))}}class vv{#e;constructor(t){this.#e=t}get expressionType(){}as(t){return new Jj(this,t)}or(...t){return new vv(bh.create(this.#e,Qi(t)))}$castTo(){return new vv(this.#e)}toOperationNode(){return Im.create(this.#e)}}class xv{#e;constructor(t){this.#e=t}get expressionType(){}as(t){return new Jj(this,t)}and(...t){return new xv(oc.create(this.#e,Qi(t)))}$castTo(){return new xv(this.#e)}toOperationNode(){return Im.create(this.#e)}}const mce={is(e){return e.kind==="FetchNode"},create(e,t){return{kind:"FetchNode",rowCount:sc.create(e),modifier:t}}};function gce(e,t){if(!Uj(e)&&!E7(e))throw new Error(`Invalid fetch row count: ${e}`);if(!yce(t))throw new Error(`Invalid fetch modifier: ${t}`);return mce.create(e,t)}function yce(e){return e==="only"||e==="with ties"}class ut{#e;constructor(t){this.#e=X(t)}get expressionType(){}get isSelectQueryBuilder(){return!0}where(...t){return new ut({...this.#e,queryNode:En.cloneWithWhere(this.#e.queryNode,Qi(t))})}whereRef(t,n,r){return new ut({...this.#e,queryNode:En.cloneWithWhere(this.#e.queryNode,Lm(t,n,r))})}having(...t){return new ut({...this.#e,queryNode:vn.cloneWithHaving(this.#e.queryNode,Qi(t))})}havingRef(t,n,r){return new ut({...this.#e,queryNode:vn.cloneWithHaving(this.#e.queryNode,Lm(t,n,r))})}select(t){return new ut({...this.#e,queryNode:vn.cloneWithSelections(this.#e.queryNode,k7(t))})}distinctOn(t){return new ut({...this.#e,queryNode:vn.cloneWithDistinctOn(this.#e.queryNode,Dm(t))})}modifyFront(t){return new ut({...this.#e,queryNode:vn.cloneWithFrontModifier(this.#e.queryNode,na.createWithExpression(t.toOperationNode()))})}modifyEnd(t){return new ut({...this.#e,queryNode:En.cloneWithEndModifier(this.#e.queryNode,na.createWithExpression(t.toOperationNode()))})}distinct(){return new ut({...this.#e,queryNode:vn.cloneWithFrontModifier(this.#e.queryNode,na.create("Distinct"))})}forUpdate(t){return new ut({...this.#e,queryNode:En.cloneWithEndModifier(this.#e.queryNode,na.create("ForUpdate",t?Y0(t).map(Bi):void 0))})}forShare(t){return new ut({...this.#e,queryNode:En.cloneWithEndModifier(this.#e.queryNode,na.create("ForShare",t?Y0(t).map(Bi):void 0))})}forKeyShare(t){return new ut({...this.#e,queryNode:En.cloneWithEndModifier(this.#e.queryNode,na.create("ForKeyShare",t?Y0(t).map(Bi):void 0))})}forNoKeyUpdate(t){return new ut({...this.#e,queryNode:En.cloneWithEndModifier(this.#e.queryNode,na.create("ForNoKeyUpdate",t?Y0(t).map(Bi):void 0))})}skipLocked(){return new ut({...this.#e,queryNode:En.cloneWithEndModifier(this.#e.queryNode,na.create("SkipLocked"))})}noWait(){return new ut({...this.#e,queryNode:En.cloneWithEndModifier(this.#e.queryNode,na.create("NoWait"))})}selectAll(t){return new ut({...this.#e,queryNode:vn.cloneWithSelections(this.#e.queryNode,M7(t))})}innerJoin(...t){return this.#t("InnerJoin",t)}leftJoin(...t){return this.#t("LeftJoin",t)}rightJoin(...t){return this.#t("RightJoin",t)}fullJoin(...t){return this.#t("FullJoin",t)}crossJoin(...t){return this.#t("CrossJoin",t)}innerJoinLateral(...t){return this.#t("LateralInnerJoin",t)}leftJoinLateral(...t){return this.#t("LateralLeftJoin",t)}crossJoinLateral(...t){return this.#t("LateralCrossJoin",t)}crossApply(...t){return this.#t("CrossApply",t)}outerApply(...t){return this.#t("OuterApply",t)}#t(t,n){return new ut({...this.#e,queryNode:En.cloneWithJoin(this.#e.queryNode,ace(t,n))})}orderBy(...t){return new ut({...this.#e,queryNode:En.cloneWithOrderByItems(this.#e.queryNode,gv(t))})}groupBy(t){return new ut({...this.#e,queryNode:vn.cloneWithGroupByItems(this.#e.queryNode,hce(t))})}limit(t){return new ut({...this.#e,queryNode:vn.cloneWithLimit(this.#e.queryNode,Gle.create(Ir(t)))})}offset(t){return new ut({...this.#e,queryNode:vn.cloneWithOffset(this.#e.queryNode,dce.create(Ir(t)))})}fetch(t,n="only"){return new ut({...this.#e,queryNode:vn.cloneWithFetch(this.#e.queryNode,gce(t,n))})}top(t,n){return new ut({...this.#e,queryNode:En.cloneWithTop(this.#e.queryNode,qle(t,n))})}union(t){return new ut({...this.#e,queryNode:vn.cloneWithSetOperations(this.#e.queryNode,Hd("union",t,!1))})}unionAll(t){return new ut({...this.#e,queryNode:vn.cloneWithSetOperations(this.#e.queryNode,Hd("union",t,!0))})}intersect(t){return new ut({...this.#e,queryNode:vn.cloneWithSetOperations(this.#e.queryNode,Hd("intersect",t,!1))})}intersectAll(t){return new ut({...this.#e,queryNode:vn.cloneWithSetOperations(this.#e.queryNode,Hd("intersect",t,!0))})}except(t){return new ut({...this.#e,queryNode:vn.cloneWithSetOperations(this.#e.queryNode,Hd("except",t,!1))})}exceptAll(t){return new ut({...this.#e,queryNode:vn.cloneWithSetOperations(this.#e.queryNode,Hd("except",t,!0))})}as(t){return new vce(this,t)}clearSelect(){return new ut({...this.#e,queryNode:vn.cloneWithoutSelections(this.#e.queryNode)})}clearWhere(){return new ut({...this.#e,queryNode:En.cloneWithoutWhere(this.#e.queryNode)})}clearLimit(){return new ut({...this.#e,queryNode:vn.cloneWithoutLimit(this.#e.queryNode)})}clearOffset(){return new ut({...this.#e,queryNode:vn.cloneWithoutOffset(this.#e.queryNode)})}clearOrderBy(){return new ut({...this.#e,queryNode:En.cloneWithoutOrderBy(this.#e.queryNode)})}clearGroupBy(){return new ut({...this.#e,queryNode:vn.cloneWithoutGroupBy(this.#e.queryNode)})}$call(t){return t(this)}$if(t,n){return t?n(this):new ut({...this.#e})}$castTo(){return new ut(this.#e)}$narrowType(){return new ut(this.#e)}$assertType(){return new ut(this.#e)}$asTuple(){return new Yt(this.toOperationNode())}$asScalar(){return new Yt(this.toOperationNode())}withPlugin(t){return new ut({...this.#e,executor:this.#e.executor.withPlugin(t)})}toOperationNode(){return this.#e.executor.transformQuery(this.#e.queryNode,this.#e.queryId)}compile(){return this.#e.executor.compileQuery(this.toOperationNode(),this.#e.queryId)}async execute(){const t=this.compile();return(await this.#e.executor.executeQuery(t)).rows}async executeTakeFirst(){const[t]=await this.execute();return t}async executeTakeFirstOrThrow(t=Vle){const n=await this.executeTakeFirst();if(n===void 0)throw Ule(t)?new t(this.toOperationNode()):t(this.toOperationNode());return n}async*stream(t=100){const n=this.compile(),r=this.#e.executor.stream(n,t);for await(const o of r)yield*o.rows}async explain(t,n){return await new ut({...this.#e,queryNode:En.cloneWithExplain(this.#e.queryNode,t,n)}).execute()}}function bce(e){return new ut(e)}class vce{#e;#t;constructor(t,n){this.#e=t,this.#t=n}get expression(){return this.#e}get alias(){return this.#t}get isAliasedSelectQueryBuilder(){return!0}toOperationNode(){return Ec.create(this.#e.toOperationNode(),uo.create(this.#t))}}const Bl=X({is(e){return e.kind==="AggregateFunctionNode"},create(e,t=[]){return X({kind:"AggregateFunctionNode",func:e,aggregated:t})},cloneWithDistinct(e){return X({...e,distinct:!0})},cloneWithOrderBy(e,t,n=!1){const r=n?"withinGroup":"orderBy";return X({...e,[r]:e[r]?kf.cloneWithItems(e[r],t):kf.create(t)})},cloneWithFilter(e,t){return X({...e,filter:e.filter?lf.cloneWithOperation(e.filter,"And",t):lf.create(t)})},cloneWithOrFilter(e,t){return X({...e,filter:e.filter?lf.cloneWithOperation(e.filter,"Or",t):lf.create(t)})},cloneWithOver(e,t){return X({...e,over:t})}}),Qk=X({is(e){return e.kind==="FunctionNode"},create(e,t){return X({kind:"FunctionNode",func:e,arguments:t})}});class jo{#e;constructor(t){this.#e=X(t)}get expressionType(){}as(t){return new xce(this,t)}distinct(){return new jo({...this.#e,aggregateFunctionNode:Bl.cloneWithDistinct(this.#e.aggregateFunctionNode)})}orderBy(...t){return new jo({...this.#e,aggregateFunctionNode:En.cloneWithOrderByItems(this.#e.aggregateFunctionNode,gv(t))})}clearOrderBy(){return new jo({...this.#e,aggregateFunctionNode:En.cloneWithoutOrderBy(this.#e.aggregateFunctionNode)})}withinGroupOrderBy(...t){return new jo({...this.#e,aggregateFunctionNode:Bl.cloneWithOrderBy(this.#e.aggregateFunctionNode,gv(t),!0)})}filterWhere(...t){return new jo({...this.#e,aggregateFunctionNode:Bl.cloneWithFilter(this.#e.aggregateFunctionNode,Qi(t))})}filterWhereRef(t,n,r){return new jo({...this.#e,aggregateFunctionNode:Bl.cloneWithFilter(this.#e.aggregateFunctionNode,Lm(t,n,r))})}over(t){const n=sce();return new jo({...this.#e,aggregateFunctionNode:Bl.cloneWithOver(this.#e.aggregateFunctionNode,(t?t(n):n).toOperationNode())})}$call(t){return t(this)}$castTo(){return new jo(this.#e)}$notNull(){return new jo(this.#e)}toOperationNode(){return this.#e.aggregateFunctionNode}}class xce{#e;#t;constructor(t,n){this.#e=t,this.#t=n}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return Ec.create(this.#e.toOperationNode(),uo.create(this.#t))}}function wce(){const e=(n,r)=>new Yt(Qk.create(n,Dm(r??[]))),t=(n,r)=>new jo({aggregateFunctionNode:Bl.create(n,r?Dm(r):void 0)});return Object.assign(e,{agg:t,avg(n){return t("avg",[n])},coalesce(...n){return e("coalesce",n)},count(n){return t("count",[n])},countAll(n){return new jo({aggregateFunctionNode:Bl.create("count",M7(n))})},max(n){return t("max",[n])},min(n){return t("min",[n])},sum(n){return t("sum",[n])},any(n){return e("any",[n])},jsonAgg(n){return new jo({aggregateFunctionNode:Bl.create("json_agg",[hi(n)?Bi(n):n.toOperationNode()])})},toJson(n){return new Yt(Qk.create("to_json",[hi(n)?Bi(n):n.toOperationNode()]))}})}const Sce=X({is(e){return e.kind==="UnaryOperationNode"},create(e,t){return X({kind:"UnaryOperationNode",operator:e,operand:t})}});function Ece(e,t){return Sce.create(Au.create(e),ii(t))}const ma=X({is(e){return e.kind==="CaseNode"},create(e){return X({kind:"CaseNode",value:e})},cloneWithWhen(e,t){return X({...e,when:X(e.when?[...e.when,t]:[t])})},cloneWithThen(e,t){return X({...e,when:e.when?X([...e.when.slice(0,-1),dw.cloneWithResult(e.when[e.when.length-1],t)]):void 0})},cloneWith(e,t){return X({...e,...t})}});class Nce{#e;constructor(t){this.#e=X(t)}when(...t){return new D7({...this.#e,node:ma.cloneWithWhen(this.#e.node,dw.create(Qi(t)))})}}class D7{#e;constructor(t){this.#e=X(t)}then(t){return new _ce({...this.#e,node:ma.cloneWithThen(this.#e.node,qj(t)?Wj(t):Ir(t))})}}class _ce{#e;constructor(t){this.#e=X(t)}when(...t){return new D7({...this.#e,node:ma.cloneWithWhen(this.#e.node,dw.create(Qi(t)))})}else(t){return new Cce({...this.#e,node:ma.cloneWith(this.#e.node,{else:qj(t)?Wj(t):Ir(t)})})}end(){return new Yt(ma.cloneWith(this.#e.node,{isStatement:!1}))}endCase(){return new Yt(ma.cloneWith(this.#e.node,{isStatement:!0}))}}class Cce{#e;constructor(t){this.#e=X(t)}end(){return new Yt(ma.cloneWith(this.#e.node,{isStatement:!1}))}endCase(){return new Yt(ma.cloneWith(this.#e.node,{isStatement:!0}))}}const Zk=X({is(e){return e.kind==="JSONPathLegNode"},create(e,t){return X({kind:"JSONPathLegNode",type:e,value:t})}});class T_{#e;constructor(t){this.#e=t}at(t){return this.#t("ArrayLocation",t)}key(t){return this.#t("Member",t)}#t(t,n){return yv.is(this.#e)?new Fm(yv.cloneWithTraversal(this.#e,lm.is(this.#e.traversal)?lm.cloneWithLeg(this.#e.traversal,Zk.create(t,n)):A7.cloneWithValue(this.#e.traversal,sc.createImmediate(n)))):new Fm(lm.cloneWithLeg(this.#e,Zk.create(t,n)))}}class Fm extends T_{#e;constructor(t){super(t),this.#e=t}get expressionType(){}as(t){return new Oce(this,t)}$castTo(){return new Fm(this.#e)}$notNull(){return new Fm(this.#e)}toOperationNode(){return this.#e}}class Oce{#e;#t;constructor(t,n){this.#e=t,this.#t=n}get expression(){return this.#e}get alias(){return this.#t}toOperationNode(){return Ec.create(this.#e.toOperationNode(),Vo(this.#t)?this.#t.toOperationNode():uo.create(this.#t))}}const eM=X({is(e){return e.kind==="TupleNode"},create(e){return X({kind:"TupleNode",values:X(e)})}}),jce=["varchar","char","text","integer","int2","int4","int8","smallint","bigint","boolean","real","double precision","float4","float8","decimal","numeric","binary","bytea","date","datetime","time","timetz","timestamp","timestamptz","serial","bigserial","uuid","json","jsonb","blob","varbinary","int4range","int4multirange","int8range","int8multirange","numrange","nummultirange","tsrange","tsmultirange","tstzrange","tstzmultirange","daterange","datemultirange"],Ace=[/^varchar\(\d+\)$/,/^char\(\d+\)$/,/^decimal\(\d+, \d+\)$/,/^numeric\(\d+, \d+\)$/,/^binary\(\d+\)$/,/^datetime\(\d+\)$/,/^time\(\d+\)$/,/^timetz\(\d+\)$/,/^timestamp\(\d+\)$/,/^timestamptz\(\d+\)$/,/^varbinary\(\d+\)$/],Tce=X({is(e){return e.kind==="DataTypeNode"},create(e){return X({kind:"DataTypeNode",dataType:e})}});function $ce(e){return!!(jce.includes(e)||Ace.some(t=>t.test(e)))}function Rce(e){if(Vo(e))return e.toOperationNode();if($ce(e))return Tce.create(e);throw new Error(`invalid column data type ${JSON.stringify(e)}`)}const kce=X({is(e){return e.kind==="CastNode"},create(e,t){return X({kind:"CastNode",expression:e,dataType:t})}});function Yj(e=P7){function t(o,i,s){return new Yt(Gj(o,i,s))}function n(o,i){return new Yt(Ece(o,i))}const r=Object.assign(t,{fn:void 0,eb:void 0,selectFrom(o){return bce({queryId:sa(),executor:e,queryNode:vn.createFrom(Pce(o))})},case(o){return new Nce({node:ma.create(mv(o)?void 0:ii(o))})},ref(o,i){return mv(i)?new Yt(ic(o)):new T_(_le(o,i))},jsonPath(){return new T_(lm.create())},table(o){return new Yt(Bi(o))},val(o){return new Yt(Ir(o))},refTuple(...o){return new Yt(eM.create(o.map(ii)))},tuple(...o){return new Yt(eM.create(o.map(Ir)))},lit(o){return new Yt(Wj(o))},unary:n,not(o){return n("not",o)},exists(o){return n("exists",o)},neg(o){return n("-",o)},between(o,i,s){return new Yt(Rf.create(ii(o),Au.create("between"),oc.create(Ir(i),Ir(s))))},betweenSymmetric(o,i,s){return new Yt(Rf.create(ii(o),Au.create("between symmetric"),oc.create(Ir(i),Ir(s))))},and(o){return rc(o)?new Yt(O_(o,"and")):new Yt(zk(o,"and"))},or(o){return rc(o)?new Yt(O_(o,"or")):new Yt(zk(o,"or"))},parens(...o){const i=Qi(o);return Im.is(i)?new Yt(i):new Yt(Im.create(i))},cast(o,i){return new Yt(kce.create(ii(o),Rce(i)))},withSchema(o){return Yj(e.withPluginAtFront(new tce(o)))}});return r.fn=wce(),r.eb=r,r}function fw(e){return Yj()}function hw(e){if(Vo(e))return e.toOperationNode();if(Bu(e))return e(fw()).toOperationNode();throw new Error(`invalid expression: ${JSON.stringify(e)}`)}function I7(e){if(Vo(e))return e.toOperationNode();if(Bu(e))return e(fw()).toOperationNode();throw new Error(`invalid aliased expression: ${JSON.stringify(e)}`)}function pw(e){return N7(e)||ple(e)||Bu(e)}function Mce(e){return Fg(e)&&Vo(e)&&hi(e.table)&&hi(e.alias)}function Pce(e){return rc(e)?e.map(t=>zm(t)):[zm(e)]}function zm(e){return hi(e)?Dce(e):Mce(e)?e.toOperationNode():I7(e)}function Dce(e){const t=" as ";if(e.includes(t)){const[n,r]=e.split(t).map(L7);return Ec.create(Bi(n),uo.create(r))}else return Bi(e)}function Bi(e){const t=".";if(e.includes(t)){const[n,r]=e.split(t).map(L7);return Wl.createWithSchema(n,r)}else return Wl.create(e)}function L7(e){return e.trim()}class dm{#e;constructor(t){this.#e=X(t)}get expressionType(){}get isRawBuilder(){return!0}as(t){return new Ice(this,t)}$castTo(){return new dm({...this.#e})}$notNull(){return new dm(this.#e)}withPlugin(t){return new dm({...this.#e,plugins:this.#e.plugins!==void 0?X([...this.#e.plugins,t]):X([t])})}toOperationNode(){return this.#n(this.#t())}compile(t){return this.#i(this.#t(t))}async execute(t){const n=this.#t(t);return n.executeQuery(this.#i(n))}#t(t){const n=t!==void 0?t.getExecutor():P7;return this.#e.plugins!==void 0?n.withPlugins(this.#e.plugins):n}#n(t){return t.transformQuery(this.#e.rawNode,this.#e.queryId)}#i(t){return t.compileQuery(this.#n(t),this.#e.queryId)}}function Al(e){return new dm(e)}class Ice{#e;#t;constructor(t,n){this.#e=t,this.#t=n}get expression(){return this.#e}get alias(){return this.#t}get rawBuilder(){return this.#e}toOperationNode(){return Ec.create(this.#e.toOperationNode(),Vo(this.#t)?this.#t.toOperationNode():uo.create(this.#t))}}const Bm=Object.assign((e,...t)=>Al({queryId:sa(),rawNode:Dr.create(e,t?.map(tM)??[])}),{ref(e){return Al({queryId:sa(),rawNode:Dr.createWithChild(ic(e))})},val(e){return Al({queryId:sa(),rawNode:Dr.createWithChild(Ir(e))})},value(e){return this.val(e)},table(e){return Al({queryId:sa(),rawNode:Dr.createWithChild(Bi(e))})},id(...e){const t=new Array(e.length+1).fill(".");return t[0]="",t[t.length-1]="",Al({queryId:sa(),rawNode:Dr.create(t,e.map(uo.create))})},lit(e){return Al({queryId:sa(),rawNode:Dr.createWithChild(sc.createImmediate(e))})},literal(e){return this.lit(e)},raw(e){return Al({queryId:sa(),rawNode:Dr.createWithSql(e)})},join(e,t=Bm`, `){const n=new Array(Math.max(2*e.length-1,0)),r=t.toOperationNode();for(let o=0;o<e.length;++o)n[2*o]=tM(e[o]),o!==e.length-1&&(n[2*o+1]=r);return Al({queryId:sa(),rawNode:Dr.createWithChildren(n)})}});function tM(e){return Vo(e)?e.toOperationNode():Ir(e)}class Lce{plugins;constructor(t=[]){this.plugins=new Set(t)}async transformResultRows(t){let n=t;for(const r of this.plugins)n=(await r.transformResult({queryId:"1",result:{rows:n}})).rows;return n}}const nM=["text","integer","real","blob","date","datetime","timestamp","boolean","json"],rM=Symbol.for("bknd:connection");class F7{constructor(t,n={},r=[]){this.fn=n,this.plugins=r,this.kysely=t,this[rM]=!0,this.pluginRunner=new Lce(r)}initialized=!1;pluginRunner;supported={batching:!1,softscans:!0};kysely;client;async init(){this.initialized=!0}static isConnection(t){return t?t[rM]===!0:!1}getIntrospector(){return this.kysely.introspection}supports(t){return this.supported[t]??!1}async ping(){return(await Bm`SELECT 1`.execute(this.kysely)).rows.length>0}async transformResultRows(t){return await this.pluginRunner.transformResultRows(t)}async executeQueries(...t){return Promise.all(t.map(async n=>await this.kysely.executeQuery(n)))}async executeQuery(t){return(await this.executeQueries(t))[0]}getCompiled(...t){return t.map(n=>"compile"in n?n.compile():n)}async withTransformedRows(t,n){return await Promise.all(t.map(async r=>{const o=n??"rows",{[o]:i,...s}=r;return{...s,rows:await this.transformResultRows(i)}}))}validateFieldSpecType(t){if(!nM.includes(t))throw new Error(`Invalid field type "${t}". Allowed types are: ${nM.join(", ")}`);return!0}toDriver(t,n){return t}fromDriver(t,n){return t}async close(){}}class Fce extends Br{name="UnableToConnectException";code=Qt.INTERNAL_SERVER_ERROR}class ua extends Br{name="InvalidSearchParamsException";code=Qt.UNPROCESSABLE_ENTITY}class zce extends Br{name="TransformRetrieveFailedException";code=Qt.UNPROCESSABLE_ENTITY}class fo extends Br{name="TransformPersistFailedException";code=Qt.UNPROCESSABLE_ENTITY;static invalidType(t,n,r){const o=typeof r=="object"?JSON.stringify(r):r,i=`Property "${t}" must be of type "${n}", "${o}" of type "${typeof r}" given.`;return new fo(i)}static required(t){return new fo(`Property "${t}" is required`)}}class Bce extends Br{constructor(t,n,r){console.error("InvalidFieldConfigException",{given:n,error:r.first()}),super(`Invalid Field config given for field "${t.name}": ${r.firstToString()}`),this.given=n}name="InvalidFieldConfigException";code=Qt.BAD_REQUEST}class Vce extends Br{name="EntityNotDefinedException";code=Qt.BAD_REQUEST;constructor(t){t?super(`Entity "${typeof t!="string"?t.name:t}" not defined`):super("Cannot find an entity that is undefined")}}class Uce extends Ur{static slug="mutator-insert-before";validate(t){const{entity:n}=this.params;if(!n.isValidData(t,"create"))throw rt.warn("MutatorInsertBefore.validate: invalid",{entity:n.name,data:t}),new lw("EntityData","invalid");return this.clone({entity:n,data:t})}}class Hce extends Ur{static slug="mutator-insert-after"}class qce extends Ur{static slug="mutator-update-before";validate(t){const{entity:n,entityId:r}=this.params;if(!n.isValidData(t,"update"))throw rt.warn("MutatorUpdateBefore.validate: invalid",{entity:n.name,entityId:r,data:t}),new lw("EntityData","invalid");return this.clone({entityId:r,entity:n,data:t})}}class Wce extends Ur{static slug="mutator-update-after"}class Gce extends Ur{static slug="mutator-delete-before"}class z7 extends Ur{static slug="mutator-delete-after"}const wv={MutatorInsertBefore:Uce,MutatorInsertAfter:Hce,MutatorUpdateBefore:qce,MutatorUpdateAfter:Wce,MutatorDeleteBefore:Gce,MutatorDeleteAfter:z7};class Jce extends Ur{static slug="repository-find-one-before"}class Yce extends Ur{static slug="repository-find-one-after"}class Kce extends Ur{static slug="repository-find-many-before";static another="one"}class Xce extends Ur{static slug="repository-find-many-after"}const B7={RepositoryFindOneBefore:Jce,RepositoryFindOneAfter:Yce,RepositoryFindManyBefore:Kce,RepositoryFindManyAfter:Xce};class V7{_relations=[];constructor(t){this._relations=t}get all(){return this._relations}exists(t){return this._relations.some(n=>n.source.entity.name===t.source.entity.name&&n.target.entity.name===t.target.entity.name&&n.type===t.type)}relationsOf(t){return this._relations.filter(n=>n.visibleFrom("source")&&n.source.entity.name===t.name||n.visibleFrom("target")&&n.target.entity.name===t.name)}sourceRelationsOf(t){return this._relations.filter(n=>n.source.entity.name===t.name)}targetRelationsOf(t){return this._relations.filter(n=>n.visibleFrom("target")&&n.target.entity.name===t.name)}listableRelationsOf(t){return this.relationsOf(t).filter(n=>n.isListableFor(t))}relationOf(t,n){return this.relationsOf(t).find(r=>r.target.entity.name===t.name&&r.source.reference===n||r.source.entity.name===t.name&&r.target.reference===n)}hasRelations(t){return this.relationsOf(t).length>0}relatedEntitiesOf(t){return this.relationsOf(t).map(n=>n.other(t).entity)}relationReferencesOf(t){return this.relationsOf(t).map(n=>n.other(t).reference)}}const Qce=["create","read","update","delete"],Zce=["create","read","update","delete","form","table","submit"],oM=!0,iM=!1,rs=Ve({label:le(),description:le(),required:at({default:!1}),fillable:Rt([at({title:"Boolean"}),un(le({enum:Qce}),{title:"Context",uniqueItems:!0})]),hidden:Rt([at({title:"Boolean"}),un(le({enum:Zce}),{title:"Context",uniqueItems:!0})]),virtual:at(),default_value:Xi()}).partial();let os=class{_required;_type;name;type="field";config;constructor(t,n){this.name=t,this._type,this._required;try{this.config=Cn(this.getSchema(),n||{})}catch(r){throw r instanceof yh?new Bce(this,n,r):r}}getType(){return this.type}schema(){return Object.freeze({name:this.name,type:"text",nullable:!0,dflt:void 0})}hasDefault(){return this.config.default_value!==void 0}getDefault(){return this.config?.default_value}isFillable(t){return Array.isArray(this.config.fillable)?t?this.config.fillable.includes(t):oM:this.config.fillable??oM}isHidden(t){return Array.isArray(this.config.hidden)?t?this.config.hidden.includes(t):iM:this.config.hidden??iM}isRequired(){return this.config?.required??!1}isVirtual(){return this.config.virtual??!1}getLabel(t){return this.config.label?this.config.label:t?.fallback!==!1?$f(this.name):void 0}getDescription(){return this.config.description}getValue(t,n){return t}getHtmlConfig(){return{element:"input",props:{type:"text"}}}isValid(t,n){return typeof t<"u"?this.isFillable(n):n==="create"?!this.isRequired():!0}transformRetrieve(t){return t}async transformPersist(t,n,r){if(this.nullish(t)){if(this.isRequired()&&!this.hasDefault())throw fo.required(this.name);return this.getDefault()}return t}toSchemaWrapIfRequired(t){return this.isRequired()?t:t.optional()}nullish(t){return t==null}toJsonSchema(){return this.toSchemaWrapIfRequired(Xi())}toType(){return{required:this.isRequired(),comment:this.getDescription(),type:"any"}}toJSON(){return{type:this.type,config:this.config}}};const U7=Ve({default_value:at(),...mo(rs.properties,["default_value"])}).partial();class H7 extends os{type="boolean";getSchema(){return U7}getValue(t,n){switch(n){case"table":return t?"Yes":"No";default:return t}}schema(){return Object.freeze({...super.schema(),type:"boolean"})}getHtmlConfig(){return{...super.getHtmlConfig(),element:"boolean"}}transformRetrieve(t){return typeof t>"u"||t===null?this.isRequired()?!1:this.hasDefault()?this.getDefault():null:typeof t=="string"?t==="1":!!t}async transformPersist(t,n,r){const o=await super.transformPersist(t,n,r);if(this.nullish(o))return this.isRequired()?!!this.config.default_value:void 0;if(typeof o=="number")return o!==0;if(typeof o!="boolean")throw fo.invalidType(this.name,"boolean",o);return o}toJsonSchema(){return this.toSchemaWrapIfRequired(at({default:this.getDefault()}))}toType(){return{...super.toType(),type:"boolean"}}}const q7=Ve({type:le({enum:["date","datetime","week"],default:"date"}),timezone:le(),min_date:le(),max_date:le(),...rs.properties}).partial();class $_ extends os{type="date";getSchema(){return q7}schema(){return Object.freeze({...super.schema(),type:this.config.type==="datetime"?"datetime":"date"})}getHtmlConfig(){const t=this.config.type==="datetime"?"datetime-local":this.config.type;return{...super.getHtmlConfig(),element:"date",props:{type:t}}}parseDateFromString(t){if(this.config.type==="week"&&t.includes("-W")){const[n,r]=t.split("-W").map(o=>Number.parseInt(o,10));return hv().year(n).week(r).toDate()}return new Date(t)}getValue(t,n){if(t===null||!t)return;const r=this.parseDateFromString(t);if(n==="submit")try{return r.toISOString()}catch{return}if(this.config.type==="week")try{return`${r.getFullYear()}-W${hv(r).week()}`}catch(o){rt.warn("DateField.getValue:week error",t,String(o));return}try{const i=new Date().getTimezoneOffset(),s=new Date(r.getTime()-i*6e4);return this.formatDate(s)}catch(o){rt.warn("DateField.getValue error",this.config.type,t,String(o));return}}formatDate(t){switch(this.config.type){case"datetime":return t.toISOString().split(".")[0].replace("T"," ");default:return t.toISOString().split("T")[0]}}transformRetrieve(t){const n=super.transformRetrieve(t);if(n===null)return null;try{return new Date(n)}catch{return null}}async transformPersist(t,n,r){const o=await super.transformPersist(t,n,r);if(this.nullish(o))return o;switch(this.config.type){case"date":case"week":return new Date(o).toISOString().split("T")[0];default:return new Date(o).toISOString()}}toJsonSchema(){return this.toSchemaWrapIfRequired(le({default:this.getDefault()}))}toType(){return{...super.toType(),type:"Date | string"}}}const W7=Ve({default_value:le(),options:Rt([ke({type:ui("strings"),values:un(le())}),ke({type:ui("objects"),values:un(ke({label:le(),value:le()}))})]),...mo(rs.properties,["default_value"])}).partial();class G7 extends os{type="enum";constructor(t,n){if(super(t,n),this.config.default_value&&!this.isValidValue(this.config.default_value))throw new Error(`Default value "${this.config.default_value}" is not a valid option`)}getSchema(){return W7}getOptions(){const t=this.config?.options??{type:"strings",values:[]};return t.type==="strings"?t.values?.map(n=>({label:n,value:n})):t?.values}isValidValue(t){return this.getOptions().map(r=>r.value).includes(t)}getValue(t,n){if(!this.isValidValue(t))return this.hasDefault()?this.getDefault():null;switch(n){case"table":return this.getOptions().find(r=>r.value===t)?.label??t}return t}transformRetrieve(t){const n=super.transformRetrieve(t);return n===null&&this.hasDefault()?this.getDefault():this.isValidValue(n)?n:this.hasDefault()?this.getDefault():null}async transformPersist(t,n,r){const o=await super.transformPersist(t,n,r);if(this.nullish(o))return o;if(!this.isValidValue(o))throw new fo(`Field "${this.name}" must be one of the following values: ${this.getOptions().map(i=>i.value).join(", ")}`);return o}toJsonSchema(){const n=(this.config?.options??{values:[]}).values?.map(r=>typeof r=="string"?r:r.value)??[];return this.toSchemaWrapIfRequired(le({enum:n,default:this.getDefault()}))}toType(){const t=this.getOptions().map(({value:n})=>typeof n=="string"?`"${n}"`:n);return{...super.toType(),type:t.length>0?t.join(" | "):"string"}}}const J7=Ve({default_value:Xi(),...mo(rs.properties,["default_value"])}).partial();class Y7 extends os{type="json";getSchema(){return J7}transformRetrieve(t){const n=super.transformRetrieve(t);return n===null&&this.hasDefault()?this.getDefault():this.isSerialized(n)?JSON.parse(n):n}isSerializable(t){try{const n=JSON.stringify(t);if(n===JSON.stringify(JSON.parse(n)))return!0}catch{}return!1}isSerialized(t){try{if(typeof t=="string")return t===JSON.stringify(JSON.parse(t))}catch{}return!1}isValid(t){return this.isSerializable(t)}getValue(t,n){switch(n){case"table":return t===null?null:JSON.stringify(t);case"submit":if(!t||typeof t=="string"&&t.length===0)return null;if(typeof t=="object")return t;try{return JSON.parse(t)}catch{return t}}return t}async transformPersist(t,n,r){const o=await super.transformPersist(t,n,r);if(this.nullish(o))return o;if(!this.isSerializable(o))throw new fo(`Field "${this.name}" must be serializable to JSON.`);return this.isSerialized(o)?o:JSON.stringify(o)}toType(){return{...super.toType(),type:"any"}}}function fm(e,t){const n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;const r=e.length;if(r!==t.length)return!1;for(let o=0;o<r;o++)if(!fm(e[o],t[o]))return!1;return!0}if(n==="object"){if(!e||!t)return e===t;const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(const s of r)if(!fm(e[s],t[s]))return!1;return!0}return e===t}function Ti(e){return encodeURI(eue(e))}function eue(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}const tue={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},nue={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},rue={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};let oue=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function hu(e,t=Object.create(null),n=oue,r=""){if(e&&typeof e=="object"&&!Array.isArray(e)){const i=e.$id||e.id;if(i){const s=new URL(i,n.href);s.hash.length>1?t[s.href]=e:(s.hash="",r===""?n=s:hu(e,t,n))}}else if(e!==!0&&e!==!1)return t;const o=n.href+(r?"#"+r:"");if(t[o]!==void 0)throw new Error(`Duplicate schema URI "${o}".`);if(t[o]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:o}),e.$ref&&e.__absolute_ref__===void 0){const i=new URL(e.$ref,n.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:i.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){const i=new URL(e.$recursiveRef,n.href);i.hash=i.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:i.href})}if(e.$anchor){const i=new URL("#"+e.$anchor,n.href);t[i.href]=e}for(let i in e){if(rue[i])continue;const s=`${r}/${Ti(i)}`,a=e[i];if(Array.isArray(a)){if(tue[i]){const c=a.length;for(let u=0;u<c;u++)hu(a[u],t,n,`${s}/${u}`)}}else if(nue[i])for(let c in a)hu(a[c],t,n,`${s}/${Ti(c)}`);else hu(a,t,n,s)}return t}const iue=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,sue=[0,31,28,31,30,31,30,31,31,30,31,30,31],aue=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,lue=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,cue=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,uue=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,due=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,fue=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,hue=/^(?:\/(?:[^~/]|~0|~1)*)*$/,pue=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,mue=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,gue=e=>{if(e[0]==='"')return!1;const[t,n,...r]=e.split("@");return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(".").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},yue=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,bue=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,vue=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function ps(e){return e.test.bind(e)}const sM={date:K7,time:X7.bind(void 0,!1),"date-time":Sue,duration:vue,uri:_ue,"uri-reference":ps(cue),"uri-template":ps(uue),url:ps(due),email:gue,hostname:ps(lue),ipv4:ps(yue),ipv6:ps(bue),regex:Oue,uuid:ps(fue),"json-pointer":ps(hue),"json-pointer-uri-fragment":ps(pue),"relative-json-pointer":ps(mue)};function xue(e){return e%4===0&&(e%100!==0||e%400===0)}function K7(e){const t=e.match(iue);if(!t)return!1;const n=+t[1],r=+t[2],o=+t[3];return r>=1&&r<=12&&o>=1&&o<=(r==2&&xue(n)?29:sue[r])}function X7(e,t){const n=t.match(aue);if(!n)return!1;const r=+n[1],o=+n[2],i=+n[3],s=!!n[5];return(r<=23&&o<=59&&i<=59||r==23&&o==59&&i==60)&&(!e||s)}const wue=/t|\s/i;function Sue(e){const t=e.split(wue);return t.length==2&&K7(t[0])&&X7(!0,t[1])}const Eue=/\/|:/,Nue=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _ue(e){return Eue.test(e)&&Nue.test(e)}const Cue=/[^\\]\\Z/;function Oue(e){if(Cue.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}function jue(e){let t=0,n=e.length,r=0,o;for(;r<n;)t++,o=e.charCodeAt(r++),o>=55296&&o<=56319&&r<n&&(o=e.charCodeAt(r),(o&64512)==56320&&r++);return t}function bn(e,t,n="2019-09",r=hu(t),o=!0,i=null,s="#",a="#",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:"false",keywordLocation:s,error:"False boolean schema."}]};const u=typeof e;let f;switch(u){case"boolean":case"number":case"string":f=u;break;case"object":e===null?f="null":Array.isArray(e)?f="array":f="object";break;default:throw new Error(`Instances of "${u}" type are not supported.`)}const{$ref:p,$recursiveRef:g,$recursiveAnchor:y,type:v,const:x,enum:S,required:E,not:C,anyOf:_,allOf:j,oneOf:A,if:T,then:k,else:R,format:V,properties:H,patternProperties:F,additionalProperties:B,unevaluatedProperties:U,minProperties:M,maxProperties:z,propertyNames:$,dependentRequired:L,dependentSchemas:P,dependencies:q,prefixItems:Y,items:D,additionalItems:W,unevaluatedItems:K,contains:Q,minContains:ie,maxContains:pe,minItems:ue,maxItems:se,uniqueItems:me,minimum:xe,maximum:je,exclusiveMinimum:_e,exclusiveMaximum:Ee,multipleOf:Re,minLength:Me,maxLength:ze,pattern:ve,__absolute_ref__:Ce,__absolute_recursive_ref__:Ae}=t,G=[];if(y===!0&&i===null&&(i=t),g==="#"){const ne=i===null?r[Ae]:i,ce=`${a}/$recursiveRef`,te=bn(e,i===null?t:i,n,r,o,ne,s,ce,c);te.valid||G.push({instanceLocation:s,keyword:"$recursiveRef",keywordLocation:ce,error:"A subschema had errors."},...te.errors)}if(p!==void 0){const ce=r[Ce||p];if(ce===void 0){let de=`Unresolved $ref "${p}".`;throw Ce&&Ce!==p&&(de+=` Absolute URI "${Ce}".`),de+=`
Known schemas:
- ${Object.keys(r).join(`
- `)}`,new Error(de)}const te=`${a}/$ref`,Z=bn(e,ce,n,r,o,i,s,te,c);if(Z.valid||G.push({instanceLocation:s,keyword:"$ref",keywordLocation:te,error:"A subschema had errors."},...Z.errors),n==="4"||n==="7")return{valid:G.length===0,errors:G}}if(Array.isArray(v)){let ne=v.length,ce=!1;for(let te=0;te<ne;te++)if(f===v[te]||v[te]==="integer"&&f==="number"&&e%1===0&&e===e){ce=!0;break}ce||G.push({instanceLocation:s,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${f}" is invalid. Expected "${v.join('", "')}".`})}else v==="integer"?(f!=="number"||e%1||e!==e)&&G.push({instanceLocation:s,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${f}" is invalid. Expected "${v}".`}):v!==void 0&&f!==v&&G.push({instanceLocation:s,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${f}" is invalid. Expected "${v}".`});if(x!==void 0&&(f==="object"||f==="array"?fm(e,x)||G.push({instanceLocation:s,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(x)}.`}):e!==x&&G.push({instanceLocation:s,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(x)}.`})),S!==void 0&&(f==="object"||f==="array"?S.some(ne=>fm(e,ne))||G.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(S)}.`}):S.some(ne=>e===ne)||G.push({instanceLocation:s,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(S)}.`})),C!==void 0){const ne=`${a}/not`;bn(e,C,n,r,o,i,s,ne).valid&&G.push({instanceLocation:s,keyword:"not",keywordLocation:ne,error:'Instance matched "not" schema.'})}let re=[];if(_!==void 0){const ne=`${a}/anyOf`,ce=G.length;let te=!1;for(let Z=0;Z<_.length;Z++){const de=_[Z],Te=Object.create(c),$e=bn(e,de,n,r,o,y===!0?i:null,s,`${ne}/${Z}`,Te);G.push(...$e.errors),te=te||$e.valid,$e.valid&&re.push(Te)}te?G.length=ce:G.splice(ce,0,{instanceLocation:s,keyword:"anyOf",keywordLocation:ne,error:"Instance does not match any subschemas."})}if(j!==void 0){const ne=`${a}/allOf`,ce=G.length;let te=!0;for(let Z=0;Z<j.length;Z++){const de=j[Z],Te=Object.create(c),$e=bn(e,de,n,r,o,y===!0?i:null,s,`${ne}/${Z}`,Te);G.push(...$e.errors),te=te&&$e.valid,$e.valid&&re.push(Te)}te?G.length=ce:G.splice(ce,0,{instanceLocation:s,keyword:"allOf",keywordLocation:ne,error:"Instance does not match every subschema."})}if(A!==void 0){const ne=`${a}/oneOf`,ce=G.length,te=A.filter((Z,de)=>{const Te=Object.create(c),$e=bn(e,Z,n,r,o,y===!0?i:null,s,`${ne}/${de}`,Te);return G.push(...$e.errors),$e.valid&&re.push(Te),$e.valid}).length;te===1?G.length=ce:G.splice(ce,0,{instanceLocation:s,keyword:"oneOf",keywordLocation:ne,error:`Instance does not match exactly one subschema (${te} matches).`})}if((f==="object"||f==="array")&&Object.assign(c,...re),T!==void 0){const ne=`${a}/if`;if(bn(e,T,n,r,o,i,s,ne,c).valid){if(k!==void 0){const te=bn(e,k,n,r,o,i,s,`${a}/then`,c);te.valid||G.push({instanceLocation:s,keyword:"if",keywordLocation:ne,error:'Instance does not match "then" schema.'},...te.errors)}}else if(R!==void 0){const te=bn(e,R,n,r,o,i,s,`${a}/else`,c);te.valid||G.push({instanceLocation:s,keyword:"if",keywordLocation:ne,error:'Instance does not match "else" schema.'},...te.errors)}}if(f==="object"){if(E!==void 0)for(const Z of E)Z in e||G.push({instanceLocation:s,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${Z}".`});const ne=Object.keys(e);if(M!==void 0&&ne.length<M&&G.push({instanceLocation:s,keyword:"minProperties",keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${M} properties.`}),z!==void 0&&ne.length>z&&G.push({instanceLocation:s,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${z} properties.`}),$!==void 0){const Z=`${a}/propertyNames`;for(const de in e){const Te=`${s}/${Ti(de)}`,$e=bn(de,$,n,r,o,i,Te,Z);$e.valid||G.push({instanceLocation:s,keyword:"propertyNames",keywordLocation:Z,error:`Property name "${de}" does not match schema.`},...$e.errors)}}if(L!==void 0){const Z=`${a}/dependantRequired`;for(const de in L)if(de in e){const Te=L[de];for(const $e of Te)$e in e||G.push({instanceLocation:s,keyword:"dependentRequired",keywordLocation:Z,error:`Instance has "${de}" but does not have "${$e}".`})}}if(P!==void 0)for(const Z in P){const de=`${a}/dependentSchemas`;if(Z in e){const Te=bn(e,P[Z],n,r,o,i,s,`${de}/${Ti(Z)}`,c);Te.valid||G.push({instanceLocation:s,keyword:"dependentSchemas",keywordLocation:de,error:`Instance has "${Z}" but does not match dependant schema.`},...Te.errors)}}if(q!==void 0){const Z=`${a}/dependencies`;for(const de in q)if(de in e){const Te=q[de];if(Array.isArray(Te))for(const $e of Te)$e in e||G.push({instanceLocation:s,keyword:"dependencies",keywordLocation:Z,error:`Instance has "${de}" but does not have "${$e}".`});else{const $e=bn(e,Te,n,r,o,i,s,`${Z}/${Ti(de)}`);$e.valid||G.push({instanceLocation:s,keyword:"dependencies",keywordLocation:Z,error:`Instance has "${de}" but does not match dependant schema.`},...$e.errors)}}}const ce=Object.create(null);let te=!1;if(H!==void 0){const Z=`${a}/properties`;for(const de in H){if(!(de in e))continue;const Te=`${s}/${Ti(de)}`,$e=bn(e[de],H[de],n,r,o,i,Te,`${Z}/${Ti(de)}`);if($e.valid)c[de]=ce[de]=!0;else if(te=o,G.push({instanceLocation:s,keyword:"properties",keywordLocation:Z,error:`Property "${de}" does not match schema.`},...$e.errors),te)break}}if(!te&&F!==void 0){const Z=`${a}/patternProperties`;for(const de in F){const Te=new RegExp(de,"u"),$e=F[de];for(const Ke in e){if(!Te.test(Ke))continue;const At=`${s}/${Ti(Ke)}`,yn=bn(e[Ke],$e,n,r,o,i,At,`${Z}/${Ti(de)}`);yn.valid?c[Ke]=ce[Ke]=!0:(te=o,G.push({instanceLocation:s,keyword:"patternProperties",keywordLocation:Z,error:`Property "${Ke}" matches pattern "${de}" but does not match associated schema.`},...yn.errors))}}}if(!te&&B!==void 0){const Z=`${a}/additionalProperties`;for(const de in e){if(ce[de])continue;const Te=`${s}/${Ti(de)}`,$e=bn(e[de],B,n,r,o,i,Te,Z);$e.valid?c[de]=!0:(te=o,G.push({instanceLocation:s,keyword:"additionalProperties",keywordLocation:Z,error:`Property "${de}" does not match additional properties schema.`},...$e.errors))}}else if(!te&&U!==void 0){const Z=`${a}/unevaluatedProperties`;for(const de in e)if(!c[de]){const Te=`${s}/${Ti(de)}`,$e=bn(e[de],U,n,r,o,i,Te,Z);$e.valid?c[de]=!0:G.push({instanceLocation:s,keyword:"unevaluatedProperties",keywordLocation:Z,error:`Property "${de}" does not match unevaluated properties schema.`},...$e.errors)}}}else if(f==="array"){se!==void 0&&e.length>se&&G.push({instanceLocation:s,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${e.length} > ${se}).`}),ue!==void 0&&e.length<ue&&G.push({instanceLocation:s,keyword:"minItems",keywordLocation:`${a}/minItems`,error:`Array has too few items (${e.length} < ${ue}).`});const ne=e.length;let ce=0,te=!1;if(Y!==void 0){const Z=`${a}/prefixItems`,de=Math.min(Y.length,ne);for(;ce<de;ce++){const Te=bn(e[ce],Y[ce],n,r,o,i,`${s}/${ce}`,`${Z}/${ce}`);if(c[ce]=!0,!Te.valid&&(te=o,G.push({instanceLocation:s,keyword:"prefixItems",keywordLocation:Z,error:"Items did not match schema."},...Te.errors),te))break}}if(D!==void 0){const Z=`${a}/items`;if(Array.isArray(D)){const de=Math.min(D.length,ne);for(;ce<de;ce++){const Te=bn(e[ce],D[ce],n,r,o,i,`${s}/${ce}`,`${Z}/${ce}`);if(c[ce]=!0,!Te.valid&&(te=o,G.push({instanceLocation:s,keyword:"items",keywordLocation:Z,error:"Items did not match schema."},...Te.errors),te))break}}else for(;ce<ne;ce++){const de=bn(e[ce],D,n,r,o,i,`${s}/${ce}`,Z);if(c[ce]=!0,!de.valid&&(te=o,G.push({instanceLocation:s,keyword:"items",keywordLocation:Z,error:"Items did not match schema."},...de.errors),te))break}if(!te&&W!==void 0){const de=`${a}/additionalItems`;for(;ce<ne;ce++){const Te=bn(e[ce],W,n,r,o,i,`${s}/${ce}`,de);c[ce]=!0,Te.valid||(te=o,G.push({instanceLocation:s,keyword:"additionalItems",keywordLocation:de,error:"Items did not match additional items schema."},...Te.errors))}}}if(Q!==void 0)if(ne===0&&ie===void 0)G.push({instanceLocation:s,keyword:"contains",keywordLocation:`${a}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(ie!==void 0&&ne<ie)G.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array has less items (${ne}) than minContains (${ie}).`});else{const Z=`${a}/contains`,de=G.length;let Te=0;for(let $e=0;$e<ne;$e++){const Ke=bn(e[$e],Q,n,r,o,i,`${s}/${$e}`,Z);Ke.valid?(c[$e]=!0,Te++):G.push(...Ke.errors)}Te>=(ie||0)&&(G.length=de),ie===void 0&&pe===void 0&&Te===0?G.splice(de,0,{instanceLocation:s,keyword:"contains",keywordLocation:Z,error:"Array does not contain item matching schema."}):ie!==void 0&&Te<ie?G.push({instanceLocation:s,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array must contain at least ${ie} items matching schema. Only ${Te} items were found.`}):pe!==void 0&&Te>pe&&G.push({instanceLocation:s,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${pe} items matching schema. ${Te} items were found.`})}if(!te&&K!==void 0){const Z=`${a}/unevaluatedItems`;for(ce;ce<ne;ce++){if(c[ce])continue;const de=bn(e[ce],K,n,r,o,i,`${s}/${ce}`,Z);c[ce]=!0,de.valid||G.push({instanceLocation:s,keyword:"unevaluatedItems",keywordLocation:Z,error:"Items did not match unevaluated items schema."},...de.errors)}}if(me)for(let Z=0;Z<ne;Z++){const de=e[Z],Te=typeof de=="object"&&de!==null;for(let $e=0;$e<ne;$e++){if(Z===$e)continue;const Ke=e[$e];(de===Ke||Te&&(typeof Ke=="object"&&Ke!==null)&&fm(de,Ke))&&(G.push({instanceLocation:s,keyword:"uniqueItems",keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${Z} and ${$e}.`}),Z=Number.MAX_SAFE_INTEGER,$e=Number.MAX_SAFE_INTEGER)}}}else if(f==="number"){if(n==="4"?(xe!==void 0&&(_e===!0&&e<=xe||e<xe)&&G.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${_e?"or equal to ":""} ${xe}.`}),je!==void 0&&(Ee===!0&&e>=je||e>je)&&G.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${Ee?"or equal to ":""} ${je}.`})):(xe!==void 0&&e<xe&&G.push({instanceLocation:s,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${xe}.`}),je!==void 0&&e>je&&G.push({instanceLocation:s,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${je}.`}),_e!==void 0&&e<=_e&&G.push({instanceLocation:s,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${e} is less than ${_e}.`}),Ee!==void 0&&e>=Ee&&G.push({instanceLocation:s,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${e} is greater than or equal to ${Ee}.`})),Re!==void 0){const ne=e%Re;Math.abs(0-ne)>=11920929e-14&&Math.abs(Re-ne)>=11920929e-14&&G.push({instanceLocation:s,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${e} is not a multiple of ${Re}.`})}}else if(f==="string"){const ne=Me===void 0&&ze===void 0?0:jue(e);Me!==void 0&&ne<Me&&G.push({instanceLocation:s,keyword:"minLength",keywordLocation:`${a}/minLength`,error:`String is too short (${ne} < ${Me}).`}),ze!==void 0&&ne>ze&&G.push({instanceLocation:s,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${ne} > ${ze}).`}),ve!==void 0&&!new RegExp(ve,"u").test(e)&&G.push({instanceLocation:s,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."}),V!==void 0&&sM[V]&&!sM[V](e)&&G.push({instanceLocation:s,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${V}".`})}return{valid:G.length===0,errors:G}}class Aue{schema;draft;shortCircuit;lookup;constructor(t,n="2019-09",r=!0){this.schema=t,this.draft=n,this.shortCircuit=r,this.lookup=hu(t)}validate(t){return bn(t,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(t,n){n&&(t={...t,$id:n}),hu(t,this.lookup)}}const Q7=Ve({schema:Xi({type:"object"}),ui_schema:Xi({type:"object"}),default_from_schema:at(),...rs.properties}).partial();class Z7 extends os{type="jsonschema";validator;constructor(t,n){super(t,n);const r=this.getJsonSchema();this.validator=new Aue(typeof r=="object"?JSON.parse(JSON.stringify(r)):{})}getSchema(){return Q7}getJsonSchema(){return this.config?.schema}getJsonUiSchema(){return this.config.ui_schema??{}}isValid(t,n="update"){return super.isValid(t,n)?!this.isRequired()&&(!t||typeof t!="object")?!0:this.validator.validate(t).valid:!1}getValue(t,n){switch(n){case"form":return t===null?"":t;case"table":return t===null?null:JSON.stringify(t)}return t}transformRetrieve(t){const n=super.transformRetrieve(t);if(n===null){if(this.config.default_from_schema)try{return Pi(this.getJsonSchema()).template()}catch{return null}else if(this.hasDefault())return this.getDefault()}return n}async transformPersist(t,n,r){const o=await super.transformPersist(t,n,r);if(this.nullish(o))return o;if(!this.isValid(o))throw new fo(this.name,o);return!o||typeof o!="object"?this.getDefault():JSON.stringify(o)}toJsonSchema(){const t=this.getJsonSchema()??{type:"object"};return this.toSchemaWrapIfRequired(Pi({default:this.getDefault(),...t}))}toType(){return{...super.toType(),import:[{package:"json-schema-to-ts",name:"FromSchema"}],type:`FromSchema<${y_(this.getJsonSchema(),2,1)}>`}}}const eF=Ve({default_value:bt(),minimum:bt(),maximum:bt(),exclusiveMinimum:bt(),exclusiveMaximum:bt(),multipleOf:bt(),...mo(rs.properties,["default_value"])}).partial();class tF extends os{type="number";getSchema(){return eF}getHtmlConfig(){return{element:"input",props:{type:"number",pattern:"d*",inputMode:"numeric"}}}schema(){return Object.freeze({...super.schema(),type:"integer"})}getValue(t,n){if(typeof t>"u"||t===null)return null;switch(n){case"submit":return Number.parseInt(t,10)}return t}async transformPersist(t,n,r){const o=await super.transformPersist(t,n,r);if(!this.nullish(o)&&typeof o!="number")throw fo.invalidType(this.name,"number",o);if(this.config.maximum&&o>this.config.maximum)throw new fo(`Field "${this.name}" cannot be greater than ${this.config.maximum}`);if(this.config.minimum&&o<this.config.minimum)throw new fo(`Field "${this.name}" cannot be less than ${this.config.minimum}`);return o}toJsonSchema(){return this.toSchemaWrapIfRequired(bt({default:this.getDefault(),minimum:this.config?.minimum,maximum:this.config?.maximum,exclusiveMinimum:this.config?.exclusiveMinimum,exclusiveMaximum:this.config?.exclusiveMaximum,multipleOf:this.config?.multipleOf}))}toType(){return{...super.toType(),type:"number"}}}const nF={data:{default_primary_field:"id"}},Kj=["integer","uuid"],rF=Ve({format:le({enum:Kj,default:"integer"}),required:at({default:!1}),...mo(rs.properties,["required"])}).partial();class Vm extends os{type="primary";constructor(t=nF.data.default_primary_field,n){super(t,{...n,fillable:!1,required:!1})}isRequired(){return!1}getSchema(){return rF}get format(){return this.config.format??"integer"}get fieldType(){return this.format==="integer"?"integer":"text"}schema(){return Object.freeze({type:this.fieldType,name:this.name,primary:!0,nullable:!1})}getNewValue(){if(this.format==="uuid")return _se()}async transformPersist(t){throw new Error("PrimaryField: This function should not be called")}toJsonSchema(){return this.toSchemaWrapIfRequired(this.format==="integer"?bt({writeOnly:void 0}):le({writeOnly:void 0}))}toType(){const t=this.format==="integer"?"number":"string";return{...super.toType(),required:!0,import:[{package:"kysely",name:"Generated"}],type:`Generated<${t}>`}}}const oF=Ve({default_value:le(),minLength:bt(),maxLength:bt(),pattern:le(),html_config:QL({element:le(),props:Ou(Rt([le({title:"String"}),bt({title:"Number"})]))}),...mo(rs.properties,["default_value"])}).partial();class Sv extends os{type="text";getSchema(){return oF}getHtmlConfig(){return this.config.html_config?this.config.html_config:super.getHtmlConfig()}transformRetrieve(t){const n=super.transformRetrieve(t);return this.config.maxLength?n.substring(0,this.config.maxLength):this.isRequired()?n?n.toString():"":n}async transformPersist(t,n,r){let o=await super.transformPersist(t,n,r);if(this.nullish(o))return o;if(o!==null&&typeof o!="string"&&(o=String(o)),this.config.maxLength&&o?.length>this.config.maxLength)throw new fo(`Field "${this.name}" must be at most ${this.config.maxLength} character(s)`);if(this.config.minLength&&o?.length<this.config.minLength)throw new fo(`Field "${this.name}" must be at least ${this.config.minLength} character(s)`);if(this.config.pattern&&o&&!new RegExp(this.config.pattern).test(o))throw new fo(`Field "${this.name}" must match the pattern ${this.config.pattern}`);return o}toJsonSchema(){return this.toSchemaWrapIfRequired(le({default:this.getDefault(),minLength:this.config?.minLength,maxLength:this.config?.maxLength,pattern:this.config?.pattern}))}toType(){return{...super.toType(),type:"string"}}}class iF{constructor(t,n,r=!1,o){if(this.entity=t,this.fields=n,this.unique=r,this.name=o,n.length===0)throw new Error("Indices must contain at least one field");if(n.some(i=>!(i instanceof os)))throw new Error("All fields must be instances of Field");o||(this.name=[r?"idx_unique":"idx",t.name,...n.map(i=>i.name)].join("_"))}toJSON(){return{entity:this.entity.name,fields:this.fields.map(t=>t.name),unique:this.unique}}}var sF=typeof global=="object"&&global&&global.Object===Object&&global,Tue=typeof self=="object"&&self&&self.Object===Object&&self,is=sF||Tue||Function("return this")(),pi=is.Symbol,aF=Object.prototype,$ue=aF.hasOwnProperty,Rue=aF.toString,Dp=pi?pi.toStringTag:void 0;function kue(e){var t=$ue.call(e,Dp),n=e[Dp];try{e[Dp]=void 0;var r=!0}catch{}var o=Rue.call(e);return r&&(t?e[Dp]=n:delete e[Dp]),o}var Mue=Object.prototype,Pue=Mue.toString;function Due(e){return Pue.call(e)}var Iue="[object Null]",Lue="[object Undefined]",aM=pi?pi.toStringTag:void 0;function Vu(e){return e==null?e===void 0?Lue:Iue:aM&&aM in Object(e)?kue(e):Due(e)}function js(e){return e!=null&&typeof e=="object"}var Fue="[object Symbol]";function mw(e){return typeof e=="symbol"||js(e)&&Vu(e)==Fue}function lF(e,t){for(var n=-1,r=e==null?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var go=Array.isArray,lM=pi?pi.prototype:void 0,cM=lM?lM.toString:void 0;function cF(e){if(typeof e=="string")return e;if(go(e))return lF(e,cF)+"";if(mw(e))return cM?cM.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var zue=/\s/;function Bue(e){for(var t=e.length;t--&&zue.test(e.charAt(t)););return t}var Vue=/^\s+/;function Uue(e){return e&&e.slice(0,Bue(e)+1).replace(Vue,"")}function Er(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var uM=NaN,Hue=/^[-+]0x[0-9a-f]+$/i,que=/^0b[01]+$/i,Wue=/^0o[0-7]+$/i,Gue=parseInt;function dM(e){if(typeof e=="number")return e;if(mw(e))return uM;if(Er(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Er(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Uue(e);var n=que.test(e);return n||Wue.test(e)?Gue(e.slice(2),n?2:8):Hue.test(e)?uM:+e}function Xj(e){return e}var Jue="[object AsyncFunction]",Yue="[object Function]",Kue="[object GeneratorFunction]",Xue="[object Proxy]";function gw(e){if(!Er(e))return!1;var t=Vu(e);return t==Yue||t==Kue||t==Jue||t==Xue}var w2=is["__core-js_shared__"],fM=function(){var e=/[^.]+$/.exec(w2&&w2.keys&&w2.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Que(e){return!!fM&&fM in e}var Zue=Function.prototype,ede=Zue.toString;function Uu(e){if(e!=null){try{return ede.call(e)}catch{}try{return e+""}catch{}}return""}var tde=/[\\^$.*+?()[\]{}|]/g,nde=/^\[object .+?Constructor\]$/,rde=Function.prototype,ode=Object.prototype,ide=rde.toString,sde=ode.hasOwnProperty,ade=RegExp("^"+ide.call(sde).replace(tde,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function lde(e){if(!Er(e)||Que(e))return!1;var t=gw(e)?ade:nde;return t.test(Uu(e))}function cde(e,t){return e?.[t]}function Hu(e,t){var n=cde(e,t);return lde(n)?n:void 0}var R_=Hu(is,"WeakMap"),hM=Object.create,uF=function(){function e(){}return function(t){if(!Er(t))return{};if(hM)return hM(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function ude(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function dF(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var dde=800,fde=16,hde=Date.now;function pde(e){var t=0,n=0;return function(){var r=hde(),o=fde-(r-n);if(n=r,o>0){if(++t>=dde)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function mde(e){return function(){return e}}var Ev=function(){try{var e=Hu(Object,"defineProperty");return e({},"",{}),e}catch{}}(),gde=Ev?function(e,t){return Ev(e,"toString",{configurable:!0,enumerable:!1,value:mde(t),writable:!0})}:Xj,fF=pde(gde);function hF(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var yde=9007199254740991,bde=/^(?:0|[1-9]\d*)$/;function yw(e,t){var n=typeof e;return t=t??yde,!!t&&(n=="number"||n!="symbol"&&bde.test(e))&&e>-1&&e%1==0&&e<t}function Qj(e,t,n){t=="__proto__"&&Ev?Ev(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function zg(e,t){return e===t||e!==e&&t!==t}var vde=Object.prototype,xde=vde.hasOwnProperty;function Zj(e,t,n){var r=e[t];(!(xde.call(e,t)&&zg(r,n))||n===void 0&&!(t in e))&&Qj(e,t,n)}function vh(e,t,n,r){var o=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var a=t[i],c=void 0;c===void 0&&(c=e[a]),o?Qj(n,a,c):Zj(n,a,c)}return n}var pM=Math.max;function pF(e,t,n){return t=pM(t===void 0?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=pM(r.length-t,0),s=Array(i);++o<i;)s[o]=r[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=r[o];return a[t]=n(s),ude(e,this,a)}}function wde(e,t){return fF(pF(e,t,Xj),e+"")}var Sde=9007199254740991;function eA(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Sde}function bw(e){return e!=null&&eA(e.length)&&!gw(e)}function Ede(e,t,n){if(!Er(n))return!1;var r=typeof t;return(r=="number"?bw(n)&&yw(t,n.length):r=="string"&&t in n)?zg(n[t],e):!1}function Nde(e){return wde(function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(o--,i):void 0,s&&Ede(n[0],n[1],s)&&(i=o<3?void 0:i,o=1),t=Object(t);++r<o;){var a=n[r];a&&e(t,a,r,i)}return t})}var _de=Object.prototype;function tA(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||_de;return e===n}function Cde(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Ode="[object Arguments]";function mM(e){return js(e)&&Vu(e)==Ode}var mF=Object.prototype,jde=mF.hasOwnProperty,Ade=mF.propertyIsEnumerable,Um=mM(function(){return arguments}())?mM:function(e){return js(e)&&jde.call(e,"callee")&&!Ade.call(e,"callee")};function Tde(){return!1}var gF=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gM=gF&&typeof module=="object"&&module&&!module.nodeType&&module,$de=gM&&gM.exports===gF,yM=$de?is.Buffer:void 0,Rde=yM?yM.isBuffer:void 0,Mf=Rde||Tde,kde="[object Arguments]",Mde="[object Array]",Pde="[object Boolean]",Dde="[object Date]",Ide="[object Error]",Lde="[object Function]",Fde="[object Map]",zde="[object Number]",Bde="[object Object]",Vde="[object RegExp]",Ude="[object Set]",Hde="[object String]",qde="[object WeakMap]",Wde="[object ArrayBuffer]",Gde="[object DataView]",Jde="[object Float32Array]",Yde="[object Float64Array]",Kde="[object Int8Array]",Xde="[object Int16Array]",Qde="[object Int32Array]",Zde="[object Uint8Array]",efe="[object Uint8ClampedArray]",tfe="[object Uint16Array]",nfe="[object Uint32Array]",ln={};ln[Jde]=ln[Yde]=ln[Kde]=ln[Xde]=ln[Qde]=ln[Zde]=ln[efe]=ln[tfe]=ln[nfe]=!0;ln[kde]=ln[Mde]=ln[Wde]=ln[Pde]=ln[Gde]=ln[Dde]=ln[Ide]=ln[Lde]=ln[Fde]=ln[zde]=ln[Bde]=ln[Vde]=ln[Ude]=ln[Hde]=ln[qde]=!1;function rfe(e){return js(e)&&eA(e.length)&&!!ln[Vu(e)]}function nA(e){return function(t){return e(t)}}var yF=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hm=yF&&typeof module=="object"&&module&&!module.nodeType&&module,ofe=hm&&hm.exports===yF,S2=ofe&&sF.process,Pf=function(){try{var e=hm&&hm.require&&hm.require("util").types;return e||S2&&S2.binding&&S2.binding("util")}catch{}}(),bM=Pf&&Pf.isTypedArray,vw=bM?nA(bM):rfe,ife=Object.prototype,sfe=ife.hasOwnProperty;function bF(e,t){var n=go(e),r=!n&&Um(e),o=!n&&!r&&Mf(e),i=!n&&!r&&!o&&vw(e),s=n||r||o||i,a=s?Cde(e.length,String):[],c=a.length;for(var u in e)(t||sfe.call(e,u))&&!(s&&(u=="length"||o&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||yw(u,c)))&&a.push(u);return a}function vF(e,t){return function(n){return e(t(n))}}var afe=vF(Object.keys,Object),lfe=Object.prototype,cfe=lfe.hasOwnProperty;function ufe(e){if(!tA(e))return afe(e);var t=[];for(var n in Object(e))cfe.call(e,n)&&n!="constructor"&&t.push(n);return t}function Bg(e){return bw(e)?bF(e):ufe(e)}function dfe(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ffe=Object.prototype,hfe=ffe.hasOwnProperty;function pfe(e){if(!Er(e))return dfe(e);var t=tA(e),n=[];for(var r in e)r=="constructor"&&(t||!hfe.call(e,r))||n.push(r);return n}function Vg(e){return bw(e)?bF(e,!0):pfe(e)}var mfe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gfe=/^\w*$/;function rA(e,t){if(go(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||mw(e)?!0:gfe.test(e)||!mfe.test(e)||t!=null&&e in Object(t)}var Hm=Hu(Object,"create");function yfe(){this.__data__=Hm?Hm(null):{},this.size=0}function bfe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var vfe="__lodash_hash_undefined__",xfe=Object.prototype,wfe=xfe.hasOwnProperty;function Sfe(e){var t=this.__data__;if(Hm){var n=t[e];return n===vfe?void 0:n}return wfe.call(t,e)?t[e]:void 0}var Efe=Object.prototype,Nfe=Efe.hasOwnProperty;function _fe(e){var t=this.__data__;return Hm?t[e]!==void 0:Nfe.call(t,e)}var Cfe="__lodash_hash_undefined__";function Ofe(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Hm&&t===void 0?Cfe:t,this}function Tu(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Tu.prototype.clear=yfe;Tu.prototype.delete=bfe;Tu.prototype.get=Sfe;Tu.prototype.has=_fe;Tu.prototype.set=Ofe;function jfe(){this.__data__=[],this.size=0}function xw(e,t){for(var n=e.length;n--;)if(zg(e[n][0],t))return n;return-1}var Afe=Array.prototype,Tfe=Afe.splice;function $fe(e){var t=this.__data__,n=xw(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Tfe.call(t,n,1),--this.size,!0}function Rfe(e){var t=this.__data__,n=xw(t,e);return n<0?void 0:t[n][1]}function kfe(e){return xw(this.__data__,e)>-1}function Mfe(e,t){var n=this.__data__,r=xw(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function za(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}za.prototype.clear=jfe;za.prototype.delete=$fe;za.prototype.get=Rfe;za.prototype.has=kfe;za.prototype.set=Mfe;var qm=Hu(is,"Map");function Pfe(){this.size=0,this.__data__={hash:new Tu,map:new(qm||za),string:new Tu}}function Dfe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ww(e,t){var n=e.__data__;return Dfe(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ife(e){var t=ww(this,e).delete(e);return this.size-=t?1:0,t}function Lfe(e){return ww(this,e).get(e)}function Ffe(e){return ww(this,e).has(e)}function zfe(e,t){var n=ww(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Ba(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ba.prototype.clear=Pfe;Ba.prototype.delete=Ife;Ba.prototype.get=Lfe;Ba.prototype.has=Ffe;Ba.prototype.set=zfe;var Bfe="Expected a function";function oA(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Bfe);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(oA.Cache||Ba),n}oA.Cache=Ba;var Vfe=500;function Ufe(e){var t=oA(e,function(r){return n.size===Vfe&&n.clear(),r}),n=t.cache;return t}var Hfe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qfe=/\\(\\)?/g,Wfe=Ufe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Hfe,function(n,r,o,i){t.push(o?i.replace(qfe,"$1"):r||n)}),t});function Gfe(e){return e==null?"":cF(e)}function xh(e,t){return go(e)?e:rA(e,t)?[e]:Wfe(Gfe(e))}function wh(e){if(typeof e=="string"||mw(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Sw(e,t){t=xh(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[wh(t[n++])];return n&&n==r?e:void 0}function Wm(e,t,n){var r=e==null?void 0:Sw(e,t);return r===void 0?n:r}function iA(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}var vM=pi?pi.isConcatSpreadable:void 0;function Jfe(e){return go(e)||Um(e)||!!(vM&&e&&e[vM])}function Yfe(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=Jfe),o||(o=[]);++i<s;){var a=e[i];n(a)?iA(o,a):o[o.length]=a}return o}function Kfe(e){var t=e==null?0:e.length;return t?Yfe(e):[]}function xF(e){return fF(pF(e,void 0,Kfe),e+"")}var Ew=vF(Object.getPrototypeOf,Object),Xfe="[object Object]",Qfe=Function.prototype,Zfe=Object.prototype,wF=Qfe.toString,ehe=Zfe.hasOwnProperty,the=wF.call(Object);function SF(e){if(!js(e)||Vu(e)!=Xfe)return!1;var t=Ew(e);if(t===null)return!0;var n=ehe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&wF.call(n)==the}function nhe(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),n=n>o?o:n,n<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}function rhe(){this.__data__=new za,this.size=0}function ohe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ihe(e){return this.__data__.get(e)}function she(e){return this.__data__.has(e)}var ahe=200;function lhe(e,t){var n=this.__data__;if(n instanceof za){var r=n.__data__;if(!qm||r.length<ahe-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ba(r)}return n.set(e,t),this.size=n.size,this}function Gi(e){var t=this.__data__=new za(e);this.size=t.size}Gi.prototype.clear=rhe;Gi.prototype.delete=ohe;Gi.prototype.get=ihe;Gi.prototype.has=she;Gi.prototype.set=lhe;function che(e,t){return e&&vh(t,Bg(t),e)}function uhe(e,t){return e&&vh(t,Vg(t),e)}var EF=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xM=EF&&typeof module=="object"&&module&&!module.nodeType&&module,dhe=xM&&xM.exports===EF,wM=dhe?is.Buffer:void 0,SM=wM?wM.allocUnsafe:void 0;function NF(e,t){if(t)return e.slice();var n=e.length,r=SM?SM(n):new e.constructor(n);return e.copy(r),r}function fhe(e,t){for(var n=-1,r=e==null?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}function _F(){return[]}var hhe=Object.prototype,phe=hhe.propertyIsEnumerable,EM=Object.getOwnPropertySymbols,sA=EM?function(e){return e==null?[]:(e=Object(e),fhe(EM(e),function(t){return phe.call(e,t)}))}:_F;function mhe(e,t){return vh(e,sA(e),t)}var ghe=Object.getOwnPropertySymbols,CF=ghe?function(e){for(var t=[];e;)iA(t,sA(e)),e=Ew(e);return t}:_F;function yhe(e,t){return vh(e,CF(e),t)}function OF(e,t,n){var r=t(e);return go(e)?r:iA(r,n(e))}function k_(e){return OF(e,Bg,sA)}function jF(e){return OF(e,Vg,CF)}var M_=Hu(is,"DataView"),P_=Hu(is,"Promise"),D_=Hu(is,"Set"),NM="[object Map]",bhe="[object Object]",_M="[object Promise]",CM="[object Set]",OM="[object WeakMap]",jM="[object DataView]",vhe=Uu(M_),xhe=Uu(qm),whe=Uu(P_),She=Uu(D_),Ehe=Uu(R_),Mi=Vu;(M_&&Mi(new M_(new ArrayBuffer(1)))!=jM||qm&&Mi(new qm)!=NM||P_&&Mi(P_.resolve())!=_M||D_&&Mi(new D_)!=CM||R_&&Mi(new R_)!=OM)&&(Mi=function(e){var t=Vu(e),n=t==bhe?e.constructor:void 0,r=n?Uu(n):"";if(r)switch(r){case vhe:return jM;case xhe:return NM;case whe:return _M;case She:return CM;case Ehe:return OM}return t});var Nhe=Object.prototype,_he=Nhe.hasOwnProperty;function Che(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&_he.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var Nv=is.Uint8Array;function aA(e){var t=new e.constructor(e.byteLength);return new Nv(t).set(new Nv(e)),t}function Ohe(e,t){var n=t?aA(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var jhe=/\w*$/;function Ahe(e){var t=new e.constructor(e.source,jhe.exec(e));return t.lastIndex=e.lastIndex,t}var AM=pi?pi.prototype:void 0,TM=AM?AM.valueOf:void 0;function The(e){return TM?Object(TM.call(e)):{}}function AF(e,t){var n=t?aA(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var $he="[object Boolean]",Rhe="[object Date]",khe="[object Map]",Mhe="[object Number]",Phe="[object RegExp]",Dhe="[object Set]",Ihe="[object String]",Lhe="[object Symbol]",Fhe="[object ArrayBuffer]",zhe="[object DataView]",Bhe="[object Float32Array]",Vhe="[object Float64Array]",Uhe="[object Int8Array]",Hhe="[object Int16Array]",qhe="[object Int32Array]",Whe="[object Uint8Array]",Ghe="[object Uint8ClampedArray]",Jhe="[object Uint16Array]",Yhe="[object Uint32Array]";function Khe(e,t,n){var r=e.constructor;switch(t){case Fhe:return aA(e);case $he:case Rhe:return new r(+e);case zhe:return Ohe(e,n);case Bhe:case Vhe:case Uhe:case Hhe:case qhe:case Whe:case Ghe:case Jhe:case Yhe:return AF(e,n);case khe:return new r;case Mhe:case Ihe:return new r(e);case Phe:return Ahe(e);case Dhe:return new r;case Lhe:return The(e)}}function TF(e){return typeof e.constructor=="function"&&!tA(e)?uF(Ew(e)):{}}var Xhe="[object Map]";function Qhe(e){return js(e)&&Mi(e)==Xhe}var $M=Pf&&Pf.isMap,Zhe=$M?nA($M):Qhe,epe="[object Set]";function tpe(e){return js(e)&&Mi(e)==epe}var RM=Pf&&Pf.isSet,npe=RM?nA(RM):tpe,rpe=1,ope=2,ipe=4,$F="[object Arguments]",spe="[object Array]",ape="[object Boolean]",lpe="[object Date]",cpe="[object Error]",RF="[object Function]",upe="[object GeneratorFunction]",dpe="[object Map]",fpe="[object Number]",kF="[object Object]",hpe="[object RegExp]",ppe="[object Set]",mpe="[object String]",gpe="[object Symbol]",ype="[object WeakMap]",bpe="[object ArrayBuffer]",vpe="[object DataView]",xpe="[object Float32Array]",wpe="[object Float64Array]",Spe="[object Int8Array]",Epe="[object Int16Array]",Npe="[object Int32Array]",_pe="[object Uint8Array]",Cpe="[object Uint8ClampedArray]",Ope="[object Uint16Array]",jpe="[object Uint32Array]",en={};en[$F]=en[spe]=en[bpe]=en[vpe]=en[ape]=en[lpe]=en[xpe]=en[wpe]=en[Spe]=en[Epe]=en[Npe]=en[dpe]=en[fpe]=en[kF]=en[hpe]=en[ppe]=en[mpe]=en[gpe]=en[_pe]=en[Cpe]=en[Ope]=en[jpe]=!0;en[cpe]=en[RF]=en[ype]=!1;function pm(e,t,n,r,o,i){var s,a=t&rpe,c=t&ope,u=t&ipe;if(n&&(s=o?n(e,r,o,i):n(e)),s!==void 0)return s;if(!Er(e))return e;var f=go(e);if(f){if(s=Che(e),!a)return dF(e,s)}else{var p=Mi(e),g=p==RF||p==upe;if(Mf(e))return NF(e,a);if(p==kF||p==$F||g&&!o){if(s=c||g?{}:TF(e),!a)return c?yhe(e,uhe(s,e)):mhe(e,che(s,e))}else{if(!en[p])return o?e:{};s=Khe(e,p,a)}}i||(i=new Gi);var y=i.get(e);if(y)return y;i.set(e,s),npe(e)?e.forEach(function(S){s.add(pm(S,t,n,S,e,i))}):Zhe(e)&&e.forEach(function(S,E){s.set(E,pm(S,t,n,E,e,i))});var v=u?c?jF:k_:c?Vg:Bg,x=f?void 0:v(e);return hF(x||e,function(S,E){x&&(E=S,S=e[E]),Zj(s,E,pm(S,t,n,E,e,i))}),s}var Ape=1,Tpe=4;function Nw(e){return pm(e,Ape|Tpe)}var $pe="__lodash_hash_undefined__";function Rpe(e){return this.__data__.set(e,$pe),this}function kpe(e){return this.__data__.has(e)}function _v(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Ba;++t<n;)this.add(e[t])}_v.prototype.add=_v.prototype.push=Rpe;_v.prototype.has=kpe;function Mpe(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function Ppe(e,t){return e.has(t)}var Dpe=1,Ipe=2;function MF(e,t,n,r,o,i){var s=n&Dpe,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var u=i.get(e),f=i.get(t);if(u&&f)return u==t&&f==e;var p=-1,g=!0,y=n&Ipe?new _v:void 0;for(i.set(e,t),i.set(t,e);++p<a;){var v=e[p],x=t[p];if(r)var S=s?r(x,v,p,t,e,i):r(v,x,p,e,t,i);if(S!==void 0){if(S)continue;g=!1;break}if(y){if(!Mpe(t,function(E,C){if(!Ppe(y,C)&&(v===E||o(v,E,n,r,i)))return y.push(C)})){g=!1;break}}else if(!(v===x||o(v,x,n,r,i))){g=!1;break}}return i.delete(e),i.delete(t),g}function Lpe(e){var t=-1,n=Array(e.size);return e.forEach(function(r,o){n[++t]=[o,r]}),n}function Fpe(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var zpe=1,Bpe=2,Vpe="[object Boolean]",Upe="[object Date]",Hpe="[object Error]",qpe="[object Map]",Wpe="[object Number]",Gpe="[object RegExp]",Jpe="[object Set]",Ype="[object String]",Kpe="[object Symbol]",Xpe="[object ArrayBuffer]",Qpe="[object DataView]",kM=pi?pi.prototype:void 0,E2=kM?kM.valueOf:void 0;function Zpe(e,t,n,r,o,i,s){switch(n){case Qpe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Xpe:return!(e.byteLength!=t.byteLength||!i(new Nv(e),new Nv(t)));case Vpe:case Upe:case Wpe:return zg(+e,+t);case Hpe:return e.name==t.name&&e.message==t.message;case Gpe:case Ype:return e==t+"";case qpe:var a=Lpe;case Jpe:var c=r&zpe;if(a||(a=Fpe),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;r|=Bpe,s.set(e,t);var f=MF(a(e),a(t),r,o,i,s);return s.delete(e),f;case Kpe:if(E2)return E2.call(e)==E2.call(t)}return!1}var eme=1,tme=Object.prototype,nme=tme.hasOwnProperty;function rme(e,t,n,r,o,i){var s=n&eme,a=k_(e),c=a.length,u=k_(t),f=u.length;if(c!=f&&!s)return!1;for(var p=c;p--;){var g=a[p];if(!(s?g in t:nme.call(t,g)))return!1}var y=i.get(e),v=i.get(t);if(y&&v)return y==t&&v==e;var x=!0;i.set(e,t),i.set(t,e);for(var S=s;++p<c;){g=a[p];var E=e[g],C=t[g];if(r)var _=s?r(C,E,g,t,e,i):r(E,C,g,e,t,i);if(!(_===void 0?E===C||o(E,C,n,r,i):_)){x=!1;break}S||(S=g=="constructor")}if(x&&!S){var j=e.constructor,A=t.constructor;j!=A&&"constructor"in e&&"constructor"in t&&!(typeof j=="function"&&j instanceof j&&typeof A=="function"&&A instanceof A)&&(x=!1)}return i.delete(e),i.delete(t),x}var ome=1,MM="[object Arguments]",PM="[object Array]",K0="[object Object]",ime=Object.prototype,DM=ime.hasOwnProperty;function sme(e,t,n,r,o,i){var s=go(e),a=go(t),c=s?PM:Mi(e),u=a?PM:Mi(t);c=c==MM?K0:c,u=u==MM?K0:u;var f=c==K0,p=u==K0,g=c==u;if(g&&Mf(e)){if(!Mf(t))return!1;s=!0,f=!1}if(g&&!f)return i||(i=new Gi),s||vw(e)?MF(e,t,n,r,o,i):Zpe(e,t,c,n,r,o,i);if(!(n&ome)){var y=f&&DM.call(e,"__wrapped__"),v=p&&DM.call(t,"__wrapped__");if(y||v){var x=y?e.value():e,S=v?t.value():t;return i||(i=new Gi),o(x,S,n,r,i)}}return g?(i||(i=new Gi),rme(e,t,n,r,o,i)):!1}function _w(e,t,n,r,o){return e===t?!0:e==null||t==null||!js(e)&&!js(t)?e!==e&&t!==t:sme(e,t,n,r,_w,o)}var ame=1,lme=2;function cme(e,t,n,r){var o=n.length,i=o;if(e==null)return!i;for(e=Object(e);o--;){var s=n[o];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<i;){s=n[o];var a=s[0],c=e[a],u=s[1];if(s[2]){if(c===void 0&&!(a in e))return!1}else{var f=new Gi,p;if(!(p===void 0?_w(u,c,ame|lme,r,f):p))return!1}}return!0}function PF(e){return e===e&&!Er(e)}function ume(e){for(var t=Bg(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,PF(o)]}return t}function DF(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function dme(e){var t=ume(e);return t.length==1&&t[0][2]?DF(t[0][0],t[0][1]):function(n){return n===e||cme(n,e,t)}}function fme(e,t){return e!=null&&t in Object(e)}function IF(e,t,n){t=xh(t,e);for(var r=-1,o=t.length,i=!1;++r<o;){var s=wh(t[r]);if(!(i=e!=null&&n(e,s)))break;e=e[s]}return i||++r!=o?i:(o=e==null?0:e.length,!!o&&eA(o)&&yw(s,o)&&(go(e)||Um(e)))}function LF(e,t){return e!=null&&IF(e,t,fme)}var hme=1,pme=2;function mme(e,t){return rA(e)&&PF(t)?DF(wh(e),t):function(n){var r=Wm(n,e);return r===void 0&&r===t?LF(n,e):_w(t,r,hme|pme)}}function gme(e){return function(t){return t?.[e]}}function yme(e){return function(t){return Sw(t,e)}}function bme(e){return rA(e)?gme(wh(e)):yme(e)}function vme(e){return typeof e=="function"?e:e==null?Xj:typeof e=="object"?go(e)?mme(e[0],e[1]):dme(e):bme(e)}function xme(e){return function(t,n,r){for(var o=-1,i=Object(t),s=r(t),a=s.length;a--;){var c=s[++o];if(n(i[c],c,i)===!1)break}return t}}var FF=xme();function wme(e,t){return e&&FF(e,t,Bg)}var N2=function(){return is.Date.now()},Sme="Expected a function",Eme=Math.max,Nme=Math.min;function _me(e,t,n){var r,o,i,s,a,c,u=0,f=!1,p=!1,g=!0;if(typeof e!="function")throw new TypeError(Sme);t=dM(t)||0,Er(n)&&(f=!!n.leading,p="maxWait"in n,i=p?Eme(dM(n.maxWait)||0,t):i,g="trailing"in n?!!n.trailing:g);function y(T){var k=r,R=o;return r=o=void 0,u=T,s=e.apply(R,k),s}function v(T){return u=T,a=setTimeout(E,t),f?y(T):s}function x(T){var k=T-c,R=T-u,V=t-k;return p?Nme(V,i-R):V}function S(T){var k=T-c,R=T-u;return c===void 0||k>=t||k<0||p&&R>=i}function E(){var T=N2();if(S(T))return C(T);a=setTimeout(E,x(T))}function C(T){return a=void 0,g&&r?y(T):(r=o=void 0,s)}function _(){a!==void 0&&clearTimeout(a),u=0,r=c=o=a=void 0}function j(){return a===void 0?s:C(N2())}function A(){var T=N2(),k=S(T);if(r=arguments,o=this,c=T,k){if(a===void 0)return v(c);if(p)return clearTimeout(a),a=setTimeout(E,t),y(c)}return a===void 0&&(a=setTimeout(E,t)),s}return A.cancel=_,A.flush=j,A}function I_(e,t,n){(n!==void 0&&!zg(e[t],n)||n===void 0&&!(t in e))&&Qj(e,t,n)}function Cme(e){return js(e)&&bw(e)}function L_(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Ome(e){return vh(e,Vg(e))}function jme(e,t,n,r,o,i,s){var a=L_(e,n),c=L_(t,n),u=s.get(c);if(u){I_(e,n,u);return}var f=i?i(a,c,n+"",e,t,s):void 0,p=f===void 0;if(p){var g=go(c),y=!g&&Mf(c),v=!g&&!y&&vw(c);f=c,g||y||v?go(a)?f=a:Cme(a)?f=dF(a):y?(p=!1,f=NF(c,!0)):v?(p=!1,f=AF(c,!0)):f=[]:SF(c)||Um(c)?(f=a,Um(a)?f=Ome(a):(!Er(a)||gw(a))&&(f=TF(c))):p=!1}p&&(s.set(c,f),o(f,c,r,i,s),s.delete(c)),I_(e,n,f)}function zF(e,t,n,r,o){e!==t&&FF(t,function(i,s){if(o||(o=new Gi),Er(i))jme(e,t,s,n,zF,r,o);else{var a=r?r(L_(e,s),i,s+"",e,t,o):void 0;a===void 0&&(a=i),I_(e,s,a)}},Vg)}var Ame=Nde(function(e,t,n,r){zF(e,t,n,r)});function Tme(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var $me=Object.prototype,Rme=$me.hasOwnProperty;function kme(e,t){return e!=null&&Rme.call(e,t)}function _2(e,t){return e!=null&&IF(e,t,kme)}function Mme(e,t){return t.length<2?e:Sw(e,nhe(t,0,-1))}function BF(e,t){return _w(e,t)}function Pme(e,t){return t=xh(t,e),e=Mme(e,t),e==null||delete e[wh(Tme(t))]}function Dme(e){return SF(e)?void 0:e}var Ime=1,Lme=2,Fme=4,Cv=xF(function(e,t){var n={};if(e==null)return n;var r=!1;t=lF(t,function(i){return i=xh(i,e),r||(r=i.length>1),i}),vh(e,jF(e),n),r&&(n=pm(n,Ime|Lme|Fme,Dme));for(var o=t.length;o--;)Pme(n,t[o]);return n});function VF(e,t,n,r){if(!Er(e))return e;t=xh(t,e);for(var o=-1,i=t.length,s=i-1,a=e;a!=null&&++o<i;){var c=wh(t[o]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(o!=s){var f=a[c];u=void 0,u===void 0&&(u=Er(f)?f:yw(t[o+1])?[]:{})}Zj(a,c,u),a=a[c]}return e}function zme(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var s=t[r],a=Sw(e,s);n(a,s)&&VF(i,xh(s,e),a)}return i}function Bme(e,t){return zme(e,t,function(n,r){return LF(e,r)})}var UF=xF(function(e,t){return e==null?{}:Bme(e,t)});function X0(e,t,n){return e==null?e:VF(e,t,n)}var Vme="Expected a function";function lA(e,t,n){var r=!0,o=!0;if(typeof e!="function")throw new TypeError(Vme);return Er(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),_me(e,t,{leading:r,maxWait:t,trailing:o})}function Vi(e,t,n){var r=go(e),o=r||Mf(e)||vw(e);if(t=vme(t),n==null){var i=e&&e.constructor;o?n=r?new i:[]:Er(e)?n=gw(i)?uF(Ew(e)):{}:n={}}return(o?hF:wme)(e,function(s,a,c){return t(n,s,a,c)}),n}const Ume={primary:{schema:rF,field:Vm},text:{schema:oF,field:Sv},number:{schema:eF,field:tF},boolean:{schema:U7,field:H7},date:{schema:q7,field:$_},enum:{schema:W7,field:G7},json:{schema:J7,field:Y7},jsonschema:{schema:Q7,field:Z7}};class cA{constructor(t){this.em=t}static EXCLUDE_TABLES=["libsql_wasm_func_table","sqlite_sequence","_cf_KV"];getIntrospector(){return this.em.connection.getIntrospector()}async introspect(){const t=await this.getIntrospector().getTables({withInternalKyselyTables:!1}),n=await this.getIntrospector().getIndices(),r=[];for(const o of t)cA.EXCLUDE_TABLES.includes(o.name)||o.name&&r.push({...o,indices:n.filter(i=>i.table===o.name)});return r}getIntrospectionFromEntity(t){const n=t.getFields(!1),r=this.em.getIndicesOf(t);return{name:t.name,isView:!1,columns:n.map(o=>({name:o.name,dataType:"TEXT",isNullable:!0,isAutoIncrementing:o instanceof Vm,hasDefaultValue:!1,comment:void 0})),indices:r.map(o=>({name:o.name,table:t.name,isUnique:o.unique,columns:o.fields.map(i=>({name:i.name,order:0}))}))}}async getDiff(){const t=await this.introspect(),n=this.em.entities.map(i=>this.getIntrospectionFromEntity(i)),r=[],o=i=>i.name;t.filter(i=>/bknd/.test(i.name)||i.isView?!1:!n.map(s=>s.name).includes(i.name)).forEach(i=>{r.push({name:i.name,isDrop:!0,isNew:!1,columns:{add:[],drop:[],change:[]},indices:{add:[],drop:[]}})});for(const i of n){const s=t.find(a=>a.name===i.name);if(!s)r.push({name:i.name,isNew:!0,columns:{add:i.columns.map(o),drop:[],change:[]},indices:{add:i.indices.map(o),drop:[]}});else{const a=i.columns.filter(y=>!s.columns.map(o).includes(y.name)),c=s.columns.filter(y=>!i.columns.map(o).includes(y.name)),u=[];for(const y of i.columns){const v=s.columns.find(S=>S.name===y.name),x=[];for(const[S,E]of Object.entries(y))v&&v[S]!==E&&x.push({attribute:S,prev:v[S],next:E});Object.keys(x).length>0&&u.push({name:y.name,changes:x})}const f=i.indices.filter(y=>!s.indices.map(v=>v.name).includes(y.name)),p=s.indices.filter(y=>!i.indices.map(v=>v.name).includes(y.name));[a,c,f,p].some(y=>y.length>0)&&r.push({name:i.name,isNew:!1,columns:{add:a.map(o),drop:c.map(o),change:[]},indices:{add:f.map(o),drop:p.map(o)}})}}return r}collectFieldSchemas(t,n){const r=[];if(n.length===0)return r;for(const o of n){const s=this.em.entity(t).getField(o).schema();s&&r.push(this.em.connection.getFieldSchema(s))}return r}async sync(t={force:!1,drop:!1}){const n=await this.getDiff(),r=[],o=this.em.connection.kysely.schema,i=[];for(const s of n){const a=this.collectFieldSchemas(s.name,s.columns.add),c=s.columns.drop,u=s.indices.drop;if(s.isDrop)t.drop&&i.push(o.dropTable(s.name));else if(s.isNew){let f=o.createTable(s.name);for(const p of a)f=f.addColumn(...p);i.push(f)}else{if(a.length>0)for(const f of a)i.push(o.alterTable(s.name).addColumn(...f));if(t.drop&&c.length>0)for(const f of c)i.push(o.alterTable(s.name).dropColumn(f))}for(const f of s.indices.add){const g=this.em.getIndicesOf(s.name).find(v=>v.name===f);let y=o.createIndex(f).on(s.name).columns(g.fields.map(v=>v.name));g.unique&&(y=y.unique()),i.push(y)}if(t.drop)for(const f of u)i.push(o.dropIndex(f))}if(i.length>0){r.push(...i.map(s=>{const{sql:a,parameters:c}=s.compile();return{sql:a,parameters:c}})),rt.debug("[SchemaManager]",`${i.length} statements
${r.map(s=>s.sql).join(`;
`)}`);try{await this.em.connection.executeQueries(...i)}catch(s){throw new Error(`Failed to execute batch: ${String(s)}`)}}return r}}const uA=Ve({name:le(),name_singular:le(),description:le(),sort_field:le({default:nF.data.default_primary_field}),sort_dir:le({enum:["asc","desc"],default:"asc"}),primary_format:le({enum:Kj})},{default:{}}).partial(),HF=["regular","system","generated"],IM=Symbol.for("bknd:entity");class Kl{#e;#t;name;fields;config;data;type="regular";constructor(t,n,r,o){if(typeof t!="string"||t.length===0)throw new Error("Entity name must be a non-empty string");this.name=t,this.config=Cn(uA,r||{});const i=n?.filter(s=>s instanceof Vm).length??0;if(i>1)throw new Error(`Entity "${t}" has more than one primary field`);this.fields=i===1?[]:[new Vm(void 0,{format:this.config.primary_format})],n&&n.forEach(s=>this.addField(s)),o&&(this.type=o),this[IM]=!0}static isEntity(t){return t?t[IM]===!0:!1}static create(t){return new Kl(t.name,t.fields,t.config,t.type)}getType(){return this.type}getSelect(t,n){return this.getFields().filter(r=>!r.isHidden(n??"read")).map(r=>t?`${t}.${r.name} as ${r.name}`:r.name)}getDefaultSort(){return{by:this.config.sort_field??"id",dir:this.config.sort_dir??"asc"}}getAliasedSelectFrom(t,n,r){const o=n??this.name;return this.getFields().filter(i=>!i.isVirtual()&&!i.isHidden(r??"read")&&t.includes(i.name)).map(i=>o?`${o}.${i.name} as ${i.name}`:i.name)}getFillableFields(t,n){return this.getFields(n).filter(r=>r.isFillable(t))}getRequiredFields(){return this.getFields().filter(t=>t.isRequired())}getDefaultObject(){return this.getFields().reduce((t,n)=>(n.hasDefault()&&(t[n.name]=n.getDefault()),t),{})}getField(t){return this.fields.find(n=>n.name===t)}__replaceField(t,n){const r=this.fields.findIndex(o=>o.name===t);if(r===-1)throw new Error(`Field "${t}" not found on entity "${this.name}"`);this.fields[r]=n}getPrimaryField(){return this.fields[0]}id(){return this.getPrimaryField()}get label(){return this.config.name??$f(this.name)}field(t){return this.getField(t)}hasField(t){const n=typeof t=="string"?t:t.name;return this.fields.findIndex(r=>r.name===n)!==-1}getFields(t=!1){return t?this.fields:this.fields.filter(n=>!n.isVirtual())}addField(t){const n=this.getField(t.name);if(n){if(JSON.stringify(n)===JSON.stringify(t)){rt.warn(`Field "${t.name}" already exists on entity "${this.name}", but it's the same, so skipping.`);return}throw new Error(`Field "${t.name}" already exists on entity "${this.name}"`)}this.fields.push(t)}__setData(t){this.data=t}isValidData(t,n,r){if(typeof t!="object"&&r?.explain)throw new Error(`Entity "${this.name}" data must be an object`);const o=this.getFillableFields(n,!1);if(r?.ignoreUnknown!==!0){const i=o.map(c=>c.name),a=Object.keys(t).filter(c=>!i.includes(c));if(a.length>0&&r?.explain)throw new Error(`Entity "${this.name}" data must only contain known keys, unknown: "${a}"`)}for(const i of o)if(!i.isValid(t?.[i.name],n)){if(rt.warn("invalid data given for",this.name,n,i.name,t[i.name]),r?.explain)throw new Error(`Field "${i.name}" has invalid data: "${t[i.name]}"`);return!1}return!0}toSchema(t){let n;switch(t?.context){case"create":case"update":n=this.getFillableFields(t.context);break;default:n=this.getFields(!0)}const r=Object.fromEntries(n.map(i=>[i.name,i])),o={type:"object",additionalProperties:!1,properties:Vt(r,i=>{const s=i.isFillable(t?.context);return{title:i.config.label,$comment:i.config.description,$field:i.type,readOnly:s?void 0:!0,...i.toJsonSchema()}})};return t?.clean?JSON.parse(JSON.stringify(o)):o}toTypes(){return{name:this.name,type:this.type,comment:this.config.description,fields:Object.fromEntries(this.getFields().map(t=>[t.name,t.toType()]))}}toJSON(){return{type:this.type,fields:Object.fromEntries(this.fields.map(t=>[t.name,t.toJSON()])),config:this.config}}}function Ai(e){if(typeof e!="string")throw new Error(`Invalid key: ${e}`);return e}const Hme=[hn("$eq",e=>$i(e),(e,t,n)=>n(Ai(t),"=",e)),hn("$ne",e=>$i(e),(e,t,n)=>n(Ai(t),"!=",e)),hn("$gt",e=>$i(e),(e,t,n)=>n(Ai(t),">",e)),hn("$gte",e=>$i(e),(e,t,n)=>n(Ai(t),">=",e)),hn("$lt",e=>$i(e),(e,t,n)=>n(Ai(t),"<",e)),hn("$lte",e=>$i(e),(e,t,n)=>n(Ai(t),"<=",e)),hn("$isnull",e=>sle(e),(e,t,n)=>n(Ai(t),e?"is":"is not",null)),hn("$in",e=>Array.isArray(e),(e,t,n)=>n(Ai(t),"in",e)),hn("$notin",e=>Array.isArray(e),(e,t,n)=>n(Ai(t),"not in",e)),hn("$between",e=>Array.isArray(e)&&e.length===2,(e,t,n)=>n.between(Ai(t),e[0],e[1])),hn("$like",e=>$i(e),(e,t,n)=>n(Ai(t),"like",String(e).replace(/\*/g,"%")))],C2=x7(Hme);class Gl{static addClause(t,n){return Object.keys(n).length===0?t:t.where(r=>{const o=C2.build(n,{value_is_kv:!0,exp_ctx:r,convert:!0});return o.$or.length>0&&o.$and.length>0?r.and(o.$and).or(r.and(o.$or)):o.$or.length>0?r.or(o.$or):r.and(o.$and)})}static convert(t){return C2.convert(t)}static getPropertyNames(t){const{keys:n}=C2.build(t,{value_is_kv:!0,exp_ctx:()=>null,convert:!0});return Array.from(n)}}class Df{config;source;target;directions=["source","target"];static schema=Ve({mappedBy:le().optional(),inversedBy:le().optional(),required:at().optional()});constructor(t,n,r={}){this.source=t,this.target=n;const o=this.constructor.schema;this.config=Cn(o,r)}getReferenceQuery(t,n,r){return{}}helper(t){return new Wme(this,t)}other(t){const n=typeof t=="string"?t:t.name;if(this.source.entity.name===this.target.entity.name)return this.source.cardinality===1?this.target:this.source;if(this.source.entity.name===n)return this.target;if(this.target.entity.name===n)return this.source;throw new Error(`Entity "${n}" is not part of the relation "${this.source.entity.name} <-> ${this.target.entity.name}"`)}self(t){return this.other(t).entity.name===this.source.entity.name?this.target:this.source}ref(t){return this.source.reference===t?this.source:this.target}otherRef(t){return this.source.reference===t?this.target:this.source}visibleFrom(t){return this.directions.includes(t)}hydrate(t,n,r){const o=typeof t=="string"?t:t.name,i=this.ref(o),s=r.hydrate(i.entity.name,n);if(i.cardinality===1){if(Array.isArray(s)&&s.length>1)throw new Error(`Failed to hydrate "${i.entity.name}" with value: ${JSON.stringify(n)} (cardinality: 1)`);return s[0]}if(!s)throw new Error(`Failed to hydrate "${i.entity.name}" with value: ${JSON.stringify(n)} (cardinality: -)`);return s}isListableFor(t){return this.target.entity.name===t.name}get required(){return!!this.config.required}async $set(t,n,r){throw new Error("$set is not allowed")}async $create(t,n,r){throw new Error("$create is not allowed")}async $attach(t,n,r){throw new Error("$attach is not allowed")}async $detach(t,n,r){throw new Error("$detach is not allowed")}getName(){return[this.type().replace(":",""),this.source.entity.name,this.target.entity.name,this.config.mappedBy,this.config.inversedBy].filter(Boolean).join("_")}toJSON(){return{type:this.type(),source:this.source.entity.name,target:this.target.entity.name,config:this.config}}}class If{entity;cardinality;reference;constructor(t,n,r){this.entity=t,this.cardinality=r,this.reference=n}toJSON(){return{entity:this.entity.name,cardinality:this.cardinality,name:this.reference}}}const qme=["cascade","set null","set default","restrict","no action"],qF=Ve({reference:le(),target:le(),target_field:le({default:"id"}).optional(),target_field_type:le({enum:["text","integer"],default:"integer"}).optional(),on_delete:le({enum:qme,default:"set null"}).optional(),...rs.properties});class To extends os{type="relation";getSchema(){return qF}static create(t,n,r){const o=[n.reference??n.entity.name,n.entity.getPrimaryField().name].join("_");return new To(o,{...r,required:t.required,reference:n.reference,target:n.entity.name,target_field:n.entity.getPrimaryField().name,target_field_type:n.entity.getPrimaryField().fieldType})}reference(){return this.config.reference}target(){return this.config.target}targetField(){return this.config.target_field}schema(){return Object.freeze({...super.schema(),type:this.config.target_field_type??"integer",references:`${this.config.target}.${this.config.target_field}`,onDelete:this.config.on_delete??"set null"})}transformRetrieve(t){return t}async transformPersist(t,n){throw new Error("RelationField: This function should not be called")}toJsonSchema(){return this.toSchemaWrapIfRequired(bt({$ref:`${this.config?.target}#/properties/${this.config?.target_field}`}))}toType(){const t=this.config.target_field_type==="integer"?"number":"string";return{...super.toType(),type:t}}}const Fr={OneToOne:"1:1",ManyToOne:"n:1",ManyToMany:"m:n",Polymorphic:"poly"};class Ra extends Df{connectionEntity;additionalFields=[];connectionTableMappedName;em;static schema=Ve({connectionTable:le().optional(),connectionTableMappedName:le().optional(),...Df.schema.properties});constructor(t,n,r,o){const i=r?.connectionTable||Ra.defaultConnectionTable(t,n),s=new If(t,t.name),a=new If(n,n.name);super(s,a,r),this.connectionEntity=new Kl(i,o,void 0,"generated"),this.connectionTableMappedName=r?.connectionTableMappedName||i,this.additionalFields=o||[]}static defaultConnectionTable(t,n){return`${t.name}_${n.name}`}type(){return Fr.ManyToMany}isListableFor(){return!0}getField(t){const n=this.connectionEntity,r=n.fields.find(o=>o instanceof To&&o.target()===t.name);if(!r||!(r instanceof To))throw new Error(`Connection entity "${n.name}" does not have a relation to "${t.name}"`);return r}getQueryInfo(t){const n=this.other(t),r=this.connectionEntity,o=this.getField(t),i=this.getField(n.entity),s=`${t.name}.${t.getPrimaryField().name}`,a=`${r.name}.${o.name}`,c=`${r.name}.${i.name}`,u=[r.name,`${n.entity.name}.${n.entity.getPrimaryField().name}`,c],f=`${t.name}.${t.getPrimaryField().name}`;return{other:n,join:u,entityRef:s,selfRef:a,otherRef:c,groupBy:f}}getReferenceQuery(t,n){const{other:r,otherRef:o}=this.getQueryInfo(t);return{where:{[o]:n},join:[r.reference]}}buildJoin(t,n){const{other:r,join:o,entityRef:i,selfRef:s,groupBy:a}=this.getQueryInfo(t);return n.innerJoin(r.entity.name,i,s).innerJoin(...o).groupBy(a)}buildWith(t){if(!this.em)throw new Error("EntityManager not set, can't build");const n=this.em.connection.fn.jsonBuildObject;if(!n)throw new Error("Connection does not support jsonBuildObject");const r=5,{other:o,join:i,entityRef:s,selfRef:a}=this.getQueryInfo(t),c=this.connectionEntity.fields.filter(u=>!(u instanceof To||u instanceof Vm));return u=>u.selectFrom(o.entity.name).select(f=>{const p=[];if(c.length>0){const g=this.connectionEntity.name;p.push(n(Object.fromEntries(c.map(y=>[y.name,f.ref(`${g}.${y.name}`)]))).as(this.connectionTableMappedName))}return p}).whereRef(s,"=",a).innerJoin(...i).limit(r)}initialize(t){this.em=t;const n=To.create(this,this.source),r=To.create(this,this.target);t.hasEntity(this.connectionEntity)?(this.connectionEntity.hasField(n)||this.connectionEntity.addField(n),this.connectionEntity.hasField(r)||this.connectionEntity.addField(r)):(this.connectionEntity.addField(n),this.connectionEntity.addField(r),t.addEntity(this.connectionEntity))}getName(){return[...Array.from(new Set([this.type().replace(":",""),this.connectionEntity.name,this.connectionTableMappedName].filter(Boolean)))].join("_")}}class ac extends Df{fieldConfig;static DEFAULTS={with_limit:5};static schema=Ve({sourceCardinality:bt().optional(),with_limit:bt({default:ac.DEFAULTS.with_limit}).optional(),fieldConfig:ke({label:le()}).optional(),...Df.schema.properties});constructor(t,n,r={}){const o=r.mappedBy||n.name,i=r.inversedBy||t.name,s=typeof r.sourceCardinality=="number"&&r.sourceCardinality>0?r.sourceCardinality:void 0,a=new If(t,i,s),c=new If(n,o,1);super(a,c,r),this.fieldConfig=r.fieldConfig??{}}type(){return Fr.ManyToOne}initialize(t){const n=$f(this.target.reference),r=To.create(this,this.target,{label:n,...this.fieldConfig});this.source.entity.field(r.name)||this.source.entity.addField(To.create(this,this.target,{label:n,...this.fieldConfig}))}getField(){const t=this.target.entity.getPrimaryField().name,n=this.source.entity.getField(`${this.target.reference}_${t}`);if(!(n instanceof To))throw new Error(`Field "${this.target.reference}_${t}" not found on entity "${this.source.entity.name}"`);return n}queryInfo(t,n){const r=this.source.reference===n?"source":"target",o=this[r],i=this[r==="source"?"target":"source"];let s,a,c;r==="source"?(s=this.source.reference,a=`${s}.${this.getField().name}`,c=`${t.name}.${o.entity.getPrimaryField().name}`):(s=this.target.reference,a=`${s}.${t.getPrimaryField().name}`,c=`${t.name}.${this.getField().name}`);const u=`${t.name}.${t.getPrimaryField().name}`;return{other:i,self:o,relationRef:s,entityRef:a,otherRef:c,groupBy:u}}getReferenceQuery(t,n,r){const o=this.source.reference===r?"source":"target",i=this[o],s=this[o==="source"?"target":"source"];return{where:{[`${s.reference}_${s.entity.getPrimaryField().name}`]:n},join:s.entity.name===i.entity.name?[]:[s.entity.name]}}buildJoin(t,n,r){const{self:o,entityRef:i,otherRef:s,groupBy:a}=this.queryInfo(t,r);return n.innerJoin(o.entity.name,i,s).groupBy(a)}buildWith(t,n){const{self:r,entityRef:o,otherRef:i,relationRef:s}=this.queryInfo(t,n);return a=>a.selectFrom(`${r.entity.name} as ${s}`).whereRef(o,"=",i).$if(r.cardinality===1,c=>c.limit(1))}async $set(t,n,r){if(typeof r!="object")throw new Error(`Invalid value for relation field "${n}" given, expected object.`);const o=this.source.entity,s=this.helper(o.name).getMutationInfo();if(!s.$set)throw new Error(`Cannot perform $set for relation "${n}"`);const a=s.local_field,c=this.getField(),u=r[Object.keys(r)[0]];if(!a||!(c instanceof To))throw new Error(`Cannot perform $set for relation "${n}"`);if(u===null&&!c.isRequired())return[a,null];if(!(await t.repository(c.target()).exists({[c.targetField()]:u})).data.exists){const p=c.targetField();throw new Error(`Cannot connect "${o.name}.${n}" to "${c.target()}.${p}" = "${u}": not found.`)}return[a,u]}}class F_ extends ac{constructor(t,n,r){const{mappedBy:o,inversedBy:i,required:s}=r||{};super(t,n,{mappedBy:o,inversedBy:i,sourceCardinality:1,required:s,with_limit:1})}type(){return Fr.OneToOne}isListableFor(){return!1}async $set(t,n,r){throw new Error("$set is not allowed")}async $create(t,n,r){if(r===null||typeof r!="object")throw new Error(`Invalid value for relation field "${n}" given, expected object.`);const o=this.other(this.source.entity).entity,s=this.helper(this.source.entity.name).getMutationInfo(),a=s.primary,c=s.local_field;if(!s.$create||!a||!c)throw new Error(`Cannot perform $create for relation "${n}"`);try{const{data:u}=await t.mutator(o).insertOne(r),f=u[a];return[c,f]}catch{throw new Error(`Error performing $create on "${o.name}".`)}}}class Ov extends Df{static schema=Ve({targetCardinality:bt().optional(),...Df.schema.properties});constructor(t,n,r={}){const o=r.mappedBy||n.name,i=r.inversedBy||t.name,s=typeof r.targetCardinality=="number"&&r.targetCardinality>0?r.targetCardinality:void 0,a=new If(t,i,1),c=new If(n,o,s);super(a,c,r),this.directions=["source"]}type(){return Fr.Polymorphic}queryInfo(t){const n=this.other(t),r=`${n.entity.name}.${this.getReferenceField().name}`,o=`${t.name}.${this.config.mappedBy}`,i=`${n.entity.name}.${this.config.mappedBy}`,s=`${t.name}.${t.getPrimaryField().name}`,a=`${n.entity.name}.${this.getEntityIdField().name}`,c=`${t.name}.${t.getPrimaryField().name}`;return{other:n,whereLhs:r,reference:o,reference_other:i,entityRef:s,otherRef:a,groupBy:c}}buildJoin(t,n){const{other:r,whereLhs:o,reference:i,entityRef:s,otherRef:a,groupBy:c}=this.queryInfo(t);return n.innerJoin(r.entity.name,u=>u.onRef(s,"=",a).on(o,"=",i)).groupBy(c)}getReferenceQuery(t,n){const r=this.queryInfo(t);return{where:{[this.getReferenceField().name]:r.reference_other,[this.getEntityIdField().name]:n}}}buildWith(t){const{other:n,whereLhs:r,reference:o,entityRef:i,otherRef:s}=this.queryInfo(t);return a=>a.selectFrom(n.entity.name).where(r,"=",o).whereRef(i,"=",s).$if(n.cardinality===1,c=>c.limit(1))}isListableFor(t){return this.source.entity.name===t.name&&this.target.cardinality!==1}getReferenceField(){return new Sv("reference",{hidden:!0,fillable:["create"]})}getEntityIdField(){return new Sv("entity_id",{hidden:!0,fillable:["create"]})}initialize(t){const n=this.getReferenceField(),r=this.getEntityIdField();this.target.entity.field(n.name)||this.target.entity.addField(n),this.target.entity.field(r.name)||this.target.entity.addField(r)}}const LM=["$set","$create","$attach","$detach"];class Wme{relation;access;self;other;constructor(t,n){if(this.relation=t,t.source.entity.name===n)this.access="source",this.self=t.source,this.other=t.target;else if(t.target.entity.name===n)this.access="target",this.self=t.target,this.other=t.source;else throw new Error(`Entity "${n}" is not part of the relation "${t.source.entity.name} <-> ${t.target.entity.name}"`)}getMutationInfo(){const t={$set:!1,$create:!1,$attach:!1,$detach:!1};let n,r;switch(this.relation.type()){case Fr.ManyToOne:typeof this.self.cardinality>"u"&&this.other.cardinality===1&&(t.$set=!0,n=this.relation.getField()?.name,r=this.other.entity.getPrimaryField().name);break;case Fr.OneToOne:this.access==="source"&&(t.$create=!0,t.$set=!0,n=this.relation.getField()?.name,r=this.other.entity.getPrimaryField().name);break;case Fr.ManyToMany:this.access==="source"&&(t.$attach=!0,t.$detach=!0,r=this.other.entity.getPrimaryField().name);break}return{reference:this.other.reference,local_field:n,...t,primary:r,cardinality:this.other.cardinality,relation_type:this.relation.type()}}}class Gme{constructor(t,n){this.entity=t,this.em=n}getRelationalKeys(){const t=[];return this.entity.type==="generated"&&this.em.relations.all.find(r=>r instanceof Ra&&r.connectionEntity.name===this.entity.name)instanceof Ra&&t.push(...this.entity.fields.filter(r=>r.type==="relation").map(r=>r.name)),this.em.relationsOf(this.entity.name).map(n=>{const r=n.helper(this.entity.name).getMutationInfo();t.push(r.reference),r.local_field&&t.push(r.local_field)}),t}async persistRelationField(t,n,r){if(r===null&&!t.isRequired())return[n,r];if(typeof r=="object")throw new Error(`Invalid value for relation field "${n}" given, expected primitive.`);if(!(await this.em.repository(t.target()).exists({[t.targetField()]:r})).data.exists){const i=t.targetField();throw new Error(`Cannot connect "${this.entity.name}.${n}" to "${t.target()}.${i}" = "${r}": not found.`)}return[n,r]}async persistReference(t,n,r){if(typeof r!="object"||r===null||typeof r>"u")throw new Error(`Invalid value for relation "${n}" given, expected object to persist reference. Like '{$set: {id: 1}}'.`);const o=Object.keys(r)[0];if(!LM.includes(o))throw new Error(`Invalid operation "${o}" for relation "${n}". Allowed: ${LM.join(", ")}`);const i=r[o];return await t[o](this.em,n,i)}async persistRelation(t,n){const r=this.entity.getField(t);if(r instanceof To)return this.persistRelationField(r,t,n);const o=this.em.relationOf(this.entity.name,t);if(o)return this.persistReference(o,t,n);throw new Error(`Relation "${t}" failed to resolve on entity "${this.entity.name}": Unable to resolve relation origin.`)}}const dA={[Fr.OneToOne]:{schema:F_.schema,cls:F_},[Fr.ManyToOne]:{schema:ac.schema,cls:ac},[Fr.ManyToMany]:{schema:Ra.schema,cls:Ra},[Fr.Polymorphic]:{schema:Ov.schema,cls:Ov}},Jme={relation:{schema:qF,field:To}};class WF{constructor(t,n={}){this.conn=t,this.options=n}results=[];time=0;get(){if(!this.results)throw new Error("Result not executed");return Array.isArray(this.results)?this.results??[]:this.results[0]}first(){const t=this.get();return(Array.isArray(t)?t[0]:t)??{}}get sql(){return this.first().sql}get parameters(){return this.first().parameters}get data(){return this.options.single?this.first().data?.[0]:this.first().data??[]}async execute(t){const n=Array.isArray(t)?t:[t];for(const r of n){const o=r.compile();await this.options.beforeExecute?.(o);try{const i=performance.now(),s=await this.conn.executeQuery(o);this.time=Number.parseFloat((performance.now()-i).toFixed(2)),this.results.push({...s,data:this.options.hydrator?.(s.rows),items:s.rows.length,time:this.time,sql:o.sql,parameters:[...o.parameters]})}catch(i){if(this.options.onError)await this.options.onError(i);else throw i}}return this}additionalMetaKeys(){return[]}toJSON(){const{rows:t,data:n,...r}=this.first(),o=ir()?["items","time","sql","parameters"]:["items","time"],i=IL(r,[...o,...this.additionalMetaKeys()]);return{data:this.data,meta:i}}}class Yme extends WF{constructor(t,n,r){const o=r?.logParams===void 0?ir():r.logParams;super(t.connection,{hydrator:i=>t.hydrate(n.name,i),beforeExecute:i=>{r?.silent||rt.debug(`[Mutation]
${i.sql}
`,o?i.parameters:void 0)},onError:i=>{if(!r?.silent)throw rt.error("[ERROR] Mutator:",i.message),i},...r}),this.em=t,this.entity=n}}class Ll{constructor(t,n,r){this.em=t,this.entity=n,this.options=r,this.emgr=r?.emgr??new Lg(wv)}static Events=wv;emgr;__unstable_disable_system_entity_creation=!0;__unstable_toggleSystemEntityCreation(t){this.__unstable_disable_system_entity_creation=t}get conn(){return this.em.connection.kysely}async getValidatedData(t,n){const r=this.entity;if(!n)throw new Error("Context must be provided for validation");const o=Object.keys(t),i={},s=new Gme(r,this.em),a=s.getRelationalKeys();for(const c of o){if(a.includes(c)){const f=await s.persistRelation(c,t[c]);if(Array.isArray(f)){const[p,g]=f;i[p]=g}continue}const u=r.getField(c);if(!u)throw new Error(`Field "${c}" not found on entity "${r.name}". Fields: ${r.getFillableFields().map(f=>f.name).join(", ")}`);if(!u.isFillable(n))throw new Error(`Field "${c}" is not fillable on entity "${r.name}"`);i[c]=await u.transformPersist(t[c],this.em,n),i[c]=this.em.connection.toDriver(i[c],u)}if(Object.keys(i).length===0)throw new Error(`No data left to update "${r.name}"`);return i}async performQuery(t,n){return await new Yme(this.em,this.entity,{silent:!1,...n}).execute(t)}async insertOne(t){const n=this.entity;if(n.type==="system"&&this.__unstable_disable_system_entity_creation)throw new Error(`Creation of system entity "${n.name}" is disabled`);const r=await this.emgr.emit(new Ll.Events.MutatorInsertBefore({entity:n,data:t})),o=r.returned?r.params.data:t;let i=await this.getValidatedData({...n.getDefaultObject(),...o},"create");const s=n.getRequiredFields();for(const p of s)if(typeof i[p.name]>"u"||i[p.name]===null)throw new Error(`Field "${p.name}" is required`);const a=n.getPrimaryField(),c=a.getNewValue();c&&(i={[a.name]:c,...i});const u=this.conn.insertInto(n.name).values(i).returning(n.getSelect()),f=await this.performQuery(u,{single:!0});return await this.emgr.emit(new Ll.Events.MutatorInsertAfter({entity:n,data:f.data,changed:i})),f}async updateOne(t,n){const r=this.entity;if(!t)throw new Error("ID must be provided for update");const o=await this.emgr.emit(new Ll.Events.MutatorUpdateBefore({entity:r,entityId:t,data:n})),i=o.returned?o.params.data:n,s=await this.getValidatedData(i,"update"),a=this.conn.updateTable(r.name).set(s).where(r.id().name,"=",t).returning(r.getSelect()),c=await this.performQuery(a,{single:!0});return await this.emgr.emit(new Ll.Events.MutatorUpdateAfter({entity:r,entityId:t,data:c.data,changed:s})),c}async deleteOne(t){const n=this.entity;if(!t)throw new Error("ID must be provided for deletion");await this.emgr.emit(new Ll.Events.MutatorDeleteBefore({entity:n,entityId:t}));const r=this.conn.deleteFrom(n.name).where(n.id().name,"=",t).returning(n.getSelect()),o=await this.performQuery(r,{single:!0});return await this.emgr.emit(new Ll.Events.MutatorDeleteAfter({entity:n,entityId:t,data:o.data})),o}getValidOptions(t){const n=this.entity,r={};if(t?.where){const o=Gl.getPropertyNames(t.where).filter(i=>typeof n.getField(i)>"u");if(o.length>0)throw new ua(`Invalid where field(s): ${o.join(", ")}`);r.where=t.where}return r}appendWhere(t,n){const r=this.entity;if(r.name,n){const o=Gl.getPropertyNames(n).filter(i=>typeof r.getField(i)>"u");if(o.length>0)throw new ua(`Invalid where field(s): ${o.join(", ")}`);return Gl.addClause(t,n)}return t}async deleteWhere(t){const n=this.entity;if(!t||typeof t!="object"||Object.keys(t).length===0)throw new Error("Where clause must be provided for mass deletion");const r=this.appendWhere(this.conn.deleteFrom(n.name),t).returning(n.getSelect());return await this.performQuery(r)}async updateWhere(t,n){const r=this.entity,o=await this.getValidatedData(t,"update");if(!n||typeof n!="object"||Object.keys(n).length===0)throw new Error("Where clause must be provided for mass update");const i=this.appendWhere(this.conn.updateTable(r.name),n).set(o).returning(r.getSelect());return await this.performQuery(i)}async insertMany(t){const n=this.entity;if(n.type==="system"&&this.__unstable_disable_system_entity_creation)throw new Error(`Creation of system entity "${n.name}" is disabled`);const r=[];for(const i of t){const s={...n.getDefaultObject(),...await this.getValidatedData(i,"create")},a=n.getRequiredFields();for(const c of a)if(typeof s[c.name]>"u"||s[c.name]===null)throw new Error(`Field "${c.name}" is required`);r.push(s)}const o=this.conn.insertInto(n.name).values(r).returning(n.getSelect());return await this.performQuery(o)}}const jv=le({}),FM=Rt([jv,un(jv,{uniqueItems:!0})],{default:[],coerce:e=>Array.isArray(e)?e:typeof e=="string"?e.includes(",")?e.split(","):[e].filter(Boolean):[]}),Q0={by:"id",dir:"asc"},Kme=ke({by:le(),dir:le({enum:["asc","desc"]}).optional()}).strict(),Xme=Rt([le(),Kme],{default:Q0,coerce:e=>{if(typeof e=="string"){if(/^-?[a-zA-Z_][a-zA-Z0-9_.]*$/.test(e)){const t=e[0]==="-"?"desc":"asc";return{by:t==="desc"?e.slice(1):e,dir:t}}else if(/^{.*}$/.test(e))return{...Q0,...JSON.parse(e)};return rt.warn(`Invalid sort given: '${JSON.stringify(e)}'`),Q0}else if(_u(e))return{...Q0,...e};return e}}),Qme=Rt([le(),ke({})],{default:{},examples:[{attribute:{$eq:1}}],coerce:e=>{if(e==null||e==="")return{};const t=typeof e=="string"?JSON.parse(e):e;return Gl.convert(t)}}),Zme=e=>Rt([jv,un(jv),e],{coerce:function(t,n={}){let r=t;if(typeof r=="string"&&(r.match(/^\{/)||r.match(/^\[/)?r=JSON.parse(r):r.includes(",")?r=r.split(","):r=[r]),Array.isArray(r)&&(r=r.reduce((o,i)=>(o[i]={},o),{})),_u(r))for(const o in r)r[o]=e.coerce(r[o],n);return r}}),oi=Cae(e=>ke({limit:bt({default:10}),offset:bt({default:0}),sort:Xme,where:Qme,select:FM,join:FM,with:Zme(e)}).partial()),ege=()=>oi.template({},{withOptional:!0});class Av{static buildClause(t,n,r,o){const i=t.relationOf(r.name,o);if(!i)throw new Error(`Relation "${o}" not found`);return i.buildJoin(r,n,o)}static getJoinedEntityNames(t,n,r){return r.flatMap(o=>{const i=t.relationOf(n.name,o);if(!i)throw new Error(`Relation "${o}" not found`);const s=i.other(n);return i instanceof ac?[s.entity.name]:i instanceof Ra?[s.entity.name,i.connectionEntity.name]:[]})}static addClause(t,n,r,o){if(o.length===0)return n;let i=n;for(const s of o)i=Av.buildClause(t,i,r,s);return i}}class tge extends WF{constructor(t,n,r){super(t.connection,{hydrator:o=>t.hydrate(n.name,o),beforeExecute:o=>{r?.silent||rt.debug(`Query:
${o.sql}
`,o.parameters)},onError:o=>{if(r?.silent!==!0)throw rt.error("Repository:",String(o)),o},...r}),this.em=t,this.entity=n}shouldIncludeCounts(t){return t===void 0?this.conn.supports("softscans"):t}async execute(t,n){if(this.shouldIncludeCounts(n?.includeCounts)){const o=(c="count")=>this.conn.kysely.fn.countAll().as(c),i=t.clearSelect().select(o()).clearLimit().clearOffset().clearGroupBy().clearOrderBy(),s=this.conn.kysely.selectFrom(this.entity.name).select(o()),a=t.compile();this.options.beforeExecute?.(a);try{const c=performance.now(),[u,f,p]=await this.em.connection.executeQueries(a,i,s);this.time=Number.parseFloat((performance.now()-c).toFixed(2)),this.results.push({...u,data:this.options.hydrator?.(u.rows),items:u.rows.length,count:Ok(f.rows[0]?.count??0),total:Ok(p.rows[0]?.count??0),time:this.time,sql:a.sql,parameters:[...a.parameters]})}catch(c){if(this.options.onError)await this.options.onError(c);else throw c}return this}return await super.execute(t)}get count(){return this.first().count}get total(){return this.first().total}additionalMetaKeys(){return["count","total"]}}class au{constructor(t,n,r={}){this.em=t,this.entity=n,this.options=r,this.emgr=r?.emgr??new Lg(wv)}static Events=B7;emgr;cloneFor(t,n={}){return new au(this.em,this.em.entity(t),{...this.options,...n,emgr:this.emgr})}get conn(){return this.em.connection.kysely}checkIndex(t,n,r){!this.em.getIndexedFields(t).map(i=>i.name).includes(n)&&this.options?.silent!==!0&&rt.warn(`Field "${t}.${n}" used in "${r}" is not indexed`)}getValidOptions(t){const n=this.entity,r={...structuredClone(ege()),sort:n.getDefaultSort(),select:n.getSelect()};if(!t)return r;if(t.sort){if(!r.select.includes(t.sort.by))throw new ua(`Invalid sort field "${t.sort.by}"`);if(!["asc","desc"].includes(t.sort.dir))throw new ua(`Invalid sort direction "${t.sort.dir}"`);this.checkIndex(n.name,t.sort.by,"sort"),r.sort={dir:t.sort.dir??"asc",by:t.sort.by}}if(t.select&&t.select.length>0){const o=t.select.filter(i=>!r.select.includes(i));if(o.length>0)throw new ua(`Invalid select field(s): ${o.join(", ")}`).context({entity:n.name,valid:r.select});r.select=t.select}if(t.with&&(Gm.validateWiths(this.em,n.name,t.with),r.with=t.with),t.join&&t.join.length>0)for(const o of t.join){if(!this.em.relationOf(n.name,o))throw new ua(`JOIN: "${o}" is not a relation of "${n.name}"`);r.join.push(o)}if(t.where){const o=[n.name];r.join?.length>0&&o.push(...Av.getJoinedEntityNames(this.em,n,r.join));const i=Gl.getPropertyNames(t.where).filter(s=>{if(s.includes(".")){const[a,c]=s.split(".");if(o.includes(a))return this.checkIndex(a,c,"where"),!this.em.entity(a).getField(c);if(!this.em.hasEntity(a))return!0;const u=this.em.relationOf(n.name,a);return u&&u.other(n).entity.getField(c)?(r.join?.push(a),this.checkIndex(a,c,"where"),!1):!0}return this.checkIndex(n.name,s,"where"),typeof n.getField(s)>"u"});if(i.length>0)throw new ua(`Invalid where field(s): ${i.join(", ")}`).context({aliases:o,entity:n.name});r.where=t.where}return t.limit&&(r.limit=t.limit),t.offset&&(r.offset=t.offset),r}async performQuery(t,n,r){return await new tge(this.em,this.entity,{silent:this.options.silent,...n}).execute(t,{includeCounts:r?.includeCounts??this.options.includeCounts})}async triggerFindBefore(t,n){const r=n.limit===1?au.Events.RepositoryFindOneBefore:au.Events.RepositoryFindManyBefore;await this.emgr.emit(new r({entity:t,options:n}))}async triggerFindAfter(t,n,r){n.limit===1?await this.emgr.emit(new au.Events.RepositoryFindOneAfter({entity:t,options:n,data:r})):await this.emgr.emit(new au.Events.RepositoryFindManyAfter({entity:t,options:n,data:r}))}async single(t,n){await this.triggerFindBefore(this.entity,n);const r=await this.performQuery(t,{single:!0});return await this.triggerFindAfter(this.entity,n,r.data),r}addOptionsToQueryBuilder(t,n,r){const o=this.entity;let i=t??this.conn.selectFrom(o.name);const s=r?.validate!==!1?this.getValidOptions(n):n;if(!s)return i;const a=r?.alias??o.name,c=p=>`${a}.${p}`,u=r?.ignore??[],f={limit:10,offset:0,...r?.defaults};return!u.includes("select")&&s.select&&(i=i.select(o.getAliasedSelectFrom(s.select,a))),!u.includes("with")&&s.with&&(i=Gm.addClause(this.em,i,o,s.with)),!u.includes("join")&&s.join&&(i=Av.addClause(this.em,i,o,s.join)),!u.includes("where")&&s.where&&(i=Gl.addClause(i,s.where)),u.includes("limit")||(i=i.limit(s.limit??f.limit),u.includes("offset")||(i=i.offset(s.offset??f.offset))),u.includes("sort")||(i=i.orderBy(c(s.sort?.by??"id"),s.sort?.dir??"asc")),i}buildQuery(t,n=[]){const r=this.entity,o=this.getValidOptions(t);return{qb:this.addOptionsToQueryBuilder(void 0,o,{ignore:n,alias:r.name,validate:!1}),options:o}}async findId(t,n){if(typeof t>"u"||t===null)throw new ua("id is required");return this.findOne({[this.entity.getPrimaryField().name]:t},n)}async findOne(t,n){const{qb:r,options:o}=this.buildQuery({...n,where:t,limit:1});return await this.single(r,o)}async findMany(t){const{qb:n,options:r}=this.buildQuery(t);await this.triggerFindBefore(this.entity,r);const o=await this.performQuery(n);return await this.triggerFindAfter(this.entity,r,o.data),o}getEntityByReference(t){const r=this.em.relations.listableRelationsOf(this.entity).find(o=>o.ref(t).reference===t);if(!r)throw new Error(`Relation "${t}" not found or not listable on entity "${this.entity.name}"`);return{entity:r.other(this.entity).entity,relation:r}}async findManyByReference(t,n,r){const{entity:o,relation:i}=this.getEntityByReference(n),s=i.getReferenceQuery(o,t,n);if(!("where"in s)||Object.keys(s.where).length===0)throw new Error(`Invalid reference query for "${n}" on entity "${o.name}"`);const a={...r,...s,where:{...s.where,...r?.where??{}}};return this.cloneFor(o).findMany(a)}async count(t){const n=this.entity,r=this.getValidOptions({where:t}),o=this.conn.fn.count(Bm`*`).as("count");let i=this.conn.selectFrom(n.name).select(o);return r.where&&(i=Gl.addClause(i,r.where)),await this.performQuery(i,{hydrator:s=>({count:s[0]?.count??0})},{includeCounts:!1})}async exists(t){const n=this.entity,r=this.getValidOptions({where:t}),o=this.conn.fn.count(Bm`*`).as("count");let i=this.conn.selectFrom(n.name).select(o);return i=Gl.addClause(i,r.where).limit(1),await this.performQuery(i,{hydrator:s=>({exists:s[0]?.count>0})})}}class Gm{static addClause(t,n,r,o){if(!o||!_u(o))return rt.warn(`'withs' undefined or invalid, given: ${JSON.stringify(o)}`),n;const i=t.connection.fn;let s=n;for(const[a,c]of Object.entries(o)){const u=t.relationOf(r.name,a);if(!u)throw new Error(`Relation "${r.name}<>${a}" not found`);const f=u.ref(a).cardinality,p=f===1?i.jsonObjectFrom:i.jsonArrayFrom;if(!p)throw new Error("Connection does not support jsonObjectFrom/jsonArrayFrom");const g=u.other(r);s=s.select(y=>{let v=u.buildWith(r,a)(y);return c&&(v=t.repo(g.entity).addOptionsToQueryBuilder(v,c,{ignore:["with",f===1?"limit":void 0].filter(Boolean)})),c.with&&(v=Gm.addClause(t,v,g.entity,c.with)),p(v).as(g.reference)})}return s}static validateWiths(t,n,r){let o=0;if(!r||!_u(r))return r&&rt.warn(`'withs' invalid, given: ${JSON.stringify(r)}`),o;const i=[];for(const[s,a]of Object.entries(r)){if(!t.relationOf(n,s))throw new ua(`WITH: "${s}" is not a relation of "${n}"`);o++,"with"in a&&i.push(Gm.validateWiths(t,s,a.with))}return i.length>0&&(o+=Math.max(...i)),o}}class Jm{connection;_entities=[];_relations=[];_indices=[];emgr;static Events={...wv,...B7};constructor(t,n,r=[],o=[],i){if(t.forEach(s=>this.addEntity(s)),r.forEach(s=>this.addRelation(s)),o.forEach(s=>this.addIndex(s)),!F7.isConnection(n))throw new Fce("");this.connection=n,this.emgr=i??new Lg,this.emgr.registerEvents(Jm.Events)}fork(){return new Jm(this._entities,this.connection,this._relations,this._indices)}clear(){return this._entities=[],this._relations=[],this._indices=[],this}get entities(){return this._entities}get relations(){return new V7(this._relations)}get indices(){return this._indices}async ping(){return(await Bm`SELECT 1`.execute(this.connection.kysely)).rows.length>0}addEntity(t){const n=this.entities.find(r=>r.name===t.name);if(n){if(JSON.stringify(n)===JSON.stringify(t)){rt.warn(`Entity "${t.name}" already exists, but it's the same, skipping adding it.`);return}throw new Error(`Entity "${t.name}" already exists`)}this.entities.push(t)}__replaceEntity(t,n=t.name){const r=this._entities.findIndex(o=>o.name===n);if(r===-1)throw new Error(`Entity "${n}" not found and cannot be replaced`);this._entities[r]=t}entity(t,n){const r=this.entities.find(o=>Kl.isEntity(t)?o.name===t.name:o.name===t);if(!r){if(n===!0)return;throw new Vce(Kl.isEntity(t)?t.name:t)}return r}hasEntity(t){const n=typeof t=="string"?t:t.name;return this.entities.some(r=>r.name===n)}hasIndex(t){const n=typeof t=="string"?t:t.name;return this.indices.some(r=>r.name===n)}getIndexedFields(t){const n=this.entity(t),r=this.getIndicesOf(n),o=n.fields.filter(s=>s.type==="relation"),i=r.map(s=>s.fields[0]);return[n.getPrimaryField(),...o,...i].filter(Boolean)}addRelation(t){if(!this.entity(t.source.entity.name)||!this.entity(t.target.entity.name))throw new Error("Relation source or target entity not found");if(this._relations.find(r=>{const o=r.source.entity.name===t.source.entity.name&&r.target.entity.name===t.target.entity.name,i=r.source.reference===t.source.reference&&r.target.reference===t.target.reference;return o&&i}))throw new Error(`Relation "${t.type}" between "${t.source.entity.name}" and "${t.target.entity.name}" already exists`);this._relations.push(t),t.initialize(this)}relationsOf(t){return this.relations.relationsOf(this.entity(t))}relationOf(t,n){return this.relations.relationOf(this.entity(t),n)}hasRelations(t){return this.relations.hasRelations(this.entity(t))}relatedEntitiesOf(t){return this.relations.relatedEntitiesOf(this.entity(t))}relationReferencesOf(t){return this.relations.relationReferencesOf(this.entity(t))}repository(t,n={}){return this.repo(t,n)}repo(t,n={}){return new au(this,this.entity(t),{...n,emgr:this.emgr})}mutator(t){return new Ll(this,this.entity(t),{emgr:this.emgr})}addIndex(t,n=!1){if(this.indices.find(r=>r.name===t.name)){if(n)throw new Error(`Index "${t.name}" already exists`);return}this._indices.push(t)}getIndicesOf(t){const n=Kl.isEntity(t)?t:this.entity(t);return this.indices.filter(r=>r.entity.name===n.name)}schema(){return new cA(this)}hydrate(t,n){if(!Array.isArray(n)||n.length===0)return[];const r=this.entity(t),o=[];for(const i of n){for(let[s,a]of Object.entries(i)){const c=r.getField(s);if(!c||c.isVirtual()){const u=this.relationOf(t,s);if(u){if(!a)continue;a=u.hydrate(s,Array.isArray(a)?a:[a],this),i[s]=a;continue}else if(c?.isVirtual())continue;throw new Error(`Field "${s}" not found on entity "${r.name}"`)}try{a===null&&c.hasDefault()&&(i[s]=c.getDefault()),a=this.connection.fromDriver(a,c),i[s]=c.transformRetrieve(a)}catch(u){throw new zce(`"${c.type}" field "${s}" on entity "${r.name}": ${u.message}`)}}o.push(i)}return o}toJSON(){return{entities:Object.fromEntries(this.entities.map(t=>[t.name,t.toJSON()])),relations:Object.fromEntries(this.relations.all.map(t=>[t.getName(),t.toJSON()])),indices:Object.fromEntries(this.indices.map(t=>[t.name,t.toJSON()]))}}}var zM=(e,t,n)=>(r,o)=>{let i=-1;return s(0);async function s(a){if(a<=i)throw new Error("next() called multiple times");i=a;let c,u=!1,f;if(e[a]?(f=e[a][0][0],r.req.routeIndex=a):f=a===e.length&&o||void 0,f)try{c=await f(r,()=>s(a+1))}catch(p){if(p instanceof Error&&t)r.error=p,c=await t(p,r),u=!0;else throw p}else r.finalized===!1&&n&&(c=await n(r));return c&&(r.finalized===!1||u)&&(r.res=c),r}},nge=Symbol(),rge=async(e,t=Object.create(null))=>{const{all:n=!1,dot:r=!1}=t,i=(e instanceof GF?e.raw.headers:e.headers).get("Content-Type");return i?.startsWith("multipart/form-data")||i?.startsWith("application/x-www-form-urlencoded")?oge(e,{all:n,dot:r}):{}};async function oge(e,t){const n=await e.formData();return n?ige(n,t):{}}function ige(e,t){const n=Object.create(null);return e.forEach((r,o)=>{t.all||o.endsWith("[]")?sge(n,o,r):n[o]=r}),t.dot&&Object.entries(n).forEach(([r,o])=>{r.includes(".")&&(age(n,r,o),delete n[r])}),n}var sge=(e,t,n)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]:t.endsWith("[]")?e[t]=[n]:e[t]=n},age=(e,t,n)=>{let r=e;const o=t.split(".");o.forEach((i,s)=>{s===o.length-1?r[i]=n:((!r[i]||typeof r[i]!="object"||Array.isArray(r[i])||r[i]instanceof File)&&(r[i]=Object.create(null)),r=r[i])})},BM=e=>aw(e,zj),GF=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t="/",n=[[]]){this.raw=e,this.path=t,this.#t=n,this.#e={}}param(e){return e?this.#n(e):this.#i()}#n(e){const t=this.#t[0][this.routeIndex][1][e],n=this.#r(t);return n&&/\%/.test(n)?BM(n):n}#i(){const e={},t=Object.keys(this.#t[0][this.routeIndex][1]);for(const n of t){const r=this.#r(this.#t[0][this.routeIndex][1][n]);r!==void 0&&(e[n]=/\%/.test(r)?BM(r):r)}return e}#r(e){return this.#t[1]?this.#t[1][e]:e}query(e){return kae(this.url,e)}queries(e){return Mae(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;const t={};return this.raw.headers.forEach((n,r)=>{t[r]=n}),t}async parseBody(e){return this.bodyCache.parsedBody??=await rge(this,e)}#o=e=>{const{bodyCache:t,raw:n}=this,r=t[e];if(r)return r;const o=Object.keys(t)[0];return o?t[o].then(i=>(o==="json"&&(i=JSON.stringify(i)),new Response(i)[e]())):t[e]=n[e]()};json(){return this.#o("text").then(e=>JSON.parse(e))}text(){return this.#o("text")}arrayBuffer(){return this.#o("arrayBuffer")}blob(){return this.#o("blob")}formData(){return this.#o("formData")}addValidatedData(e,t){this.#e[e]=t}valid(e){return this.#e[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[nge](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}},lge={Stringify:1},JF=async(e,t,n,r,o)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));const i=e.callbacks;return i?.length?(o?o[0]+=e:o=[e],Promise.all(i.map(a=>a({phase:t,buffer:o,context:r}))).then(a=>Promise.all(a.filter(Boolean).map(c=>JF(c,t,!1,r,o))).then(()=>o[0]))):Promise.resolve(e)},cge="text/plain; charset=UTF-8",O2=(e,t)=>({"Content-Type":e,...t}),uge=class{#e;#t;env={};#n;finalized=!1;error;#i;#r;#o;#a;#s;#l;#c;#d;#u;constructor(e,t){this.#e=e,t&&(this.#r=t.executionCtx,this.env=t.env,this.#l=t.notFoundHandler,this.#u=t.path,this.#d=t.matchResult)}get req(){return this.#t??=new GF(this.#e,this.#u,this.#d),this.#t}get event(){if(this.#r&&"respondWith"in this.#r)return this.#r;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#r)return this.#r;throw Error("This context has no ExecutionContext")}get res(){return this.#o||=new Response(null,{headers:this.#c??=new Headers})}set res(e){if(this.#o&&e){e=new Response(e.body,e);for(const[t,n]of this.#o.headers.entries())if(t!=="content-type")if(t==="set-cookie"){const r=this.#o.headers.getSetCookie();e.headers.delete("set-cookie");for(const o of r)e.headers.append("set-cookie",o)}else e.headers.set(t,n)}this.#o=e,this.finalized=!0}render=(...e)=>(this.#s??=t=>this.html(t),this.#s(...e));setLayout=e=>this.#a=e;getLayout=()=>this.#a;setRenderer=e=>{this.#s=e};header=(e,t,n)=>{this.finalized&&(this.#o=new Response(this.#o.body,this.#o));const r=this.#o?this.#o.headers:this.#c??=new Headers;t===void 0?r.delete(e):n?.append?r.append(e,t):r.set(e,t)};status=e=>{this.#i=e};set=(e,t)=>{this.#n??=new Map,this.#n.set(e,t)};get=e=>this.#n?this.#n.get(e):void 0;get var(){return this.#n?Object.fromEntries(this.#n):{}}#f(e,t,n){const r=this.#o?new Headers(this.#o.headers):this.#c??new Headers;if(typeof t=="object"&&"headers"in t){const i=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(const[s,a]of i)s.toLowerCase()==="set-cookie"?r.append(s,a):r.set(s,a)}if(n)for(const[i,s]of Object.entries(n))if(typeof s=="string")r.set(i,s);else{r.delete(i);for(const a of s)r.append(i,a)}const o=typeof t=="number"?t:t?.status??this.#i;return new Response(e,{status:o,headers:r})}newResponse=(...e)=>this.#f(...e);body=(e,t,n)=>this.#f(e,t,n);text=(e,t,n)=>!this.#c&&!this.#i&&!t&&!n&&!this.finalized?new Response(e):this.#f(e,t,O2(cge,n));json=(e,t,n)=>this.#f(JSON.stringify(e),t,O2("application/json",n));html=(e,t,n)=>{const r=o=>this.#f(o,t,O2("text/html; charset=UTF-8",n));return typeof e=="object"?JF(e,lge.Stringify,!1,{}).then(r):r(e)};redirect=(e,t)=>{const n=String(e);return this.header("Location",/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,t??302)};notFound=()=>(this.#l??=()=>new Response,this.#l(this))},Yn="ALL",dge="all",fge=["get","post","put","delete","options","patch"],YF="Can not add a route since the matcher is already built.",KF=class extends Error{},hge="__COMPOSED_HANDLER",pge=e=>e.text("404 Not Found",404),VM=(e,t)=>{if("getResponse"in e){const n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)},XF=class{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(t={}){[...fge,dge].forEach(i=>{this[i]=(s,...a)=>(typeof s=="string"?this.#e=s:this.#i(i,this.#e,s),a.forEach(c=>{this.#i(i,this.#e,c)}),this)}),this.on=(i,s,...a)=>{for(const c of[s].flat()){this.#e=c;for(const u of[i].flat())a.map(f=>{this.#i(u.toUpperCase(),this.#e,f)})}return this},this.use=(i,...s)=>(typeof i=="string"?this.#e=i:(this.#e="*",s.unshift(i)),s.forEach(a=>{this.#i(Yn,this.#e,a)}),this);const{strict:r,...o}=t;Object.assign(this,o),this.getPath=r??!0?t.getPath??s7:Rae}#t(){const t=new XF({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#n=this.#n,t.routes=this.routes,t}#n=pge;errorHandler=VM;route(t,n){const r=this.basePath(t);return n.routes.map(o=>{let i;n.errorHandler===VM?i=o.handler:(i=async(s,a)=>(await zM([],n.errorHandler)(s,()=>o.handler(s,a))).res,i[hge]=o.handler),r.#i(o.method,o.path,i)}),this}basePath(t){const n=this.#t();return n._basePath=Zd(this._basePath,t),n}onError=t=>(this.errorHandler=t,this);notFound=t=>(this.#n=t,this);mount(t,n,r){let o,i;r&&(typeof r=="function"?i=r:(i=r.optionHandler,r.replaceRequest===!1?o=c=>c:o=r.replaceRequest));const s=i?c=>{const u=i(c);return Array.isArray(u)?u:[u]}:c=>{let u;try{u=c.executionCtx}catch{}return[c.env,u]};o||=(()=>{const c=Zd(this._basePath,t),u=c==="/"?0:c.length;return f=>{const p=new URL(f.url);return p.pathname=p.pathname.slice(u)||"/",new Request(p,f)}})();const a=async(c,u)=>{const f=await n(o(c.req.raw),...s(c));if(f)return f;await u()};return this.#i(Yn,Zd(t,"*"),a),this}#i(t,n,r){t=t.toUpperCase(),n=Zd(this._basePath,n);const o={basePath:this._basePath,path:n,method:t,handler:r};this.router.add(t,n,[r,o]),this.routes.push(o)}#r(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t}#o(t,n,r,o){if(o==="HEAD")return(async()=>new Response(null,await this.#o(t,n,r,"GET")))();const i=this.getPath(t,{env:r}),s=this.router.match(o,i),a=new uge(t,{path:i,matchResult:s,env:r,executionCtx:n,notFoundHandler:this.#n});if(s[0].length===1){let u;try{u=s[0][0][0][0](a,async()=>{a.res=await this.#n(a)})}catch(f){return this.#r(f,a)}return u instanceof Promise?u.then(f=>f||(a.finalized?a.res:this.#n(a))).catch(f=>this.#r(f,a)):u??this.#n(a)}const c=zM(s[0],this.errorHandler,this.#n);return(async()=>{try{const u=await c(a);if(!u.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return u.res}catch(u){return this.#r(u,a)}})()}fetch=(t,...n)=>this.#o(t,n[1],n[0],t.method);request=(t,n,r,o)=>t instanceof Request?this.fetch(n?new Request(t,n):t,r,o):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${Zd("/",t)}`,n),r,o));fire=()=>{addEventListener("fetch",t=>{t.respondWith(this.#o(t.request,t,void 0,t.request.method))})}},QF=[];function mge(e,t){const n=this.buildAllMatchers(),r=(o,i)=>{const s=n[o]||n[Yn],a=s[2][i];if(a)return a;const c=i.match(s[0]);if(!c)return[[],QF];const u=c.indexOf("",1);return[s[1][u],c]};return this.match=r,r(e,t)}var Tv="[^/]+",mm=".*",gm="(?:|/.*)",ef=Symbol(),gge=new Set(".\\+*[^]$()");function yge(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1||e===mm||e===gm?1:t===mm||t===gm?-1:e===Tv?1:t===Tv?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var z_=class{#e;#t;#n=Object.create(null);insert(t,n,r,o,i){if(t.length===0){if(this.#e!==void 0)throw ef;if(i)return;this.#e=n;return}const[s,...a]=t,c=s==="*"?a.length===0?["","",mm]:["","",Tv]:s==="/*"?["","",gm]:s.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let u;if(c){const f=c[1];let p=c[2]||Tv;if(f&&c[2]&&(p===".*"||(p=p.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(p))))throw ef;if(u=this.#n[p],!u){if(Object.keys(this.#n).some(g=>g!==mm&&g!==gm))throw ef;if(i)return;u=this.#n[p]=new z_,f!==""&&(u.#t=o.varIndex++)}!i&&f!==""&&r.push([f,u.#t])}else if(u=this.#n[s],!u){if(Object.keys(this.#n).some(f=>f.length>1&&f!==mm&&f!==gm))throw ef;if(i)return;u=this.#n[s]=new z_}u.insert(a,n,r,o,i)}buildRegExpStr(){const n=Object.keys(this.#n).sort(yge).map(r=>{const o=this.#n[r];return(typeof o.#t=="number"?`(${r})@${o.#t}`:gge.has(r)?`\\${r}`:r)+o.buildRegExpStr()});return typeof this.#e=="number"&&n.unshift(`#${this.#e}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}},bge=class{#e={varIndex:0};#t=new z_;insert(e,t,n){const r=[],o=[];for(let s=0;;){let a=!1;if(e=e.replace(/\{[^}]+\}/g,c=>{const u=`@\\${s}`;return o[s]=[u,c],s++,a=!0,u}),!a)break}const i=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let s=o.length-1;s>=0;s--){const[a]=o[s];for(let c=i.length-1;c>=0;c--)if(i[c].indexOf(a)!==-1){i[c]=i[c].replace(a,o[s][1]);break}}return this.#t.insert(i,t,r,this.#e,n),r}buildRegExp(){let e=this.#t.buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0;const n=[],r=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(o,i,s)=>i!==void 0?(n[++t]=Number(i),"$()"):(s!==void 0&&(r[Number(s)]=++t),"")),[new RegExp(`^${e}`),n,r]}},vge=[/^$/,[],Object.create(null)],ZF=Object.create(null);function ez(e){return ZF[e]??=new RegExp(e==="*"?"":`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,(t,n)=>n?`\\${n}`:"(?:|/.*)")}$`)}function xge(){ZF=Object.create(null)}function wge(e){const t=new bge,n=[];if(e.length===0)return vge;const r=e.map(u=>[!/\*|\/:/.test(u[0]),...u]).sort(([u,f],[p,g])=>u?1:p?-1:f.length-g.length),o=Object.create(null);for(let u=0,f=-1,p=r.length;u<p;u++){const[g,y,v]=r[u];g?o[y]=[v.map(([S])=>[S,Object.create(null)]),QF]:f++;let x;try{x=t.insert(y,f,g)}catch(S){throw S===ef?new KF(y):S}g||(n[f]=v.map(([S,E])=>{const C=Object.create(null);for(E-=1;E>=0;E--){const[_,j]=x[E];C[_]=j}return[S,C]}))}const[i,s,a]=t.buildRegExp();for(let u=0,f=n.length;u<f;u++)for(let p=0,g=n[u].length;p<g;p++){const y=n[u][p]?.[1];if(!y)continue;const v=Object.keys(y);for(let x=0,S=v.length;x<S;x++)y[v[x]]=a[y[v[x]]]}const c=[];for(const u in s)c[u]=n[s[u]];return[i,c,o]}function qd(e,t){if(e){for(const n of Object.keys(e).sort((r,o)=>o.length-r.length))if(ez(n).test(t))return[...e[n]]}}var Sge=class{name="RegExpRouter";#e;#t;constructor(){this.#e={[Yn]:Object.create(null)},this.#t={[Yn]:Object.create(null)}}add(e,t,n){const r=this.#e,o=this.#t;if(!r||!o)throw new Error(YF);r[e]||[r,o].forEach(a=>{a[e]=Object.create(null),Object.keys(a[Yn]).forEach(c=>{a[e][c]=[...a[Yn][c]]})}),t==="/*"&&(t="*");const i=(t.match(/\/:/g)||[]).length;if(/\*$/.test(t)){const a=ez(t);e===Yn?Object.keys(r).forEach(c=>{r[c][t]||=qd(r[c],t)||qd(r[Yn],t)||[]}):r[e][t]||=qd(r[e],t)||qd(r[Yn],t)||[],Object.keys(r).forEach(c=>{(e===Yn||e===c)&&Object.keys(r[c]).forEach(u=>{a.test(u)&&r[c][u].push([n,i])})}),Object.keys(o).forEach(c=>{(e===Yn||e===c)&&Object.keys(o[c]).forEach(u=>a.test(u)&&o[c][u].push([n,i]))});return}const s=a7(t)||[t];for(let a=0,c=s.length;a<c;a++){const u=s[a];Object.keys(o).forEach(f=>{(e===Yn||e===f)&&(o[f][u]||=[...qd(r[f],u)||qd(r[Yn],u)||[]],o[f][u].push([n,i-c+a+1]))})}}match=mge;buildAllMatchers(){const e=Object.create(null);return Object.keys(this.#t).concat(Object.keys(this.#e)).forEach(t=>{e[t]||=this.#n(t)}),this.#e=this.#t=void 0,xge(),e}#n(e){const t=[];let n=e===Yn;return[this.#e,this.#t].forEach(r=>{const o=r[e]?Object.keys(r[e]).map(i=>[i,r[e][i]]):[];o.length!==0?(n||=!0,t.push(...o)):e!==Yn&&t.push(...Object.keys(r[Yn]).map(i=>[i,r[Yn][i]]))}),n?wge(t):null}},Ege=class{name="SmartRouter";#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,t,n){if(!this.#t)throw new Error(YF);this.#t.push([e,t,n])}match(e,t){if(!this.#t)throw new Error("Fatal error");const n=this.#e,r=this.#t,o=n.length;let i=0,s;for(;i<o;i++){const a=n[i];try{for(let c=0,u=r.length;c<u;c++)a.add(...r[c]);s=a.match(e,t)}catch(c){if(c instanceof KF)continue;throw c}this.match=a.match.bind(a),this.#e=[a],this.#t=void 0;break}if(i===o)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,s}get activeRouter(){if(this.#t||this.#e.length!==1)throw new Error("No active router has been determined yet.");return this.#e[0]}},Ip=Object.create(null),tz=class{#e;#t;#n;#i=0;#r=Ip;constructor(t,n,r){if(this.#t=r||Object.create(null),this.#e=[],t&&n){const o=Object.create(null);o[t]={handler:n,possibleKeys:[],score:0},this.#e=[o]}this.#n=[]}insert(t,n,r){this.#i=++this.#i;let o=this;const i=Oae(n),s=[];for(let a=0,c=i.length;a<c;a++){const u=i[a],f=i[a+1],p=Tae(u,f),g=Array.isArray(p)?p[0]:u;if(g in o.#t){o=o.#t[g],p&&s.push(p[1]);continue}o.#t[g]=new tz,p&&(o.#n.push(p),s.push(p[1])),o=o.#t[g]}return o.#e.push({[t]:{handler:r,possibleKeys:s.filter((a,c,u)=>u.indexOf(a)===c),score:this.#i}}),o}#o(t,n,r,o){const i=[];for(let s=0,a=t.#e.length;s<a;s++){const c=t.#e[s],u=c[n]||c[Yn],f={};if(u!==void 0&&(u.params=Object.create(null),i.push(u),r!==Ip||o&&o!==Ip))for(let p=0,g=u.possibleKeys.length;p<g;p++){const y=u.possibleKeys[p],v=f[u.score];u.params[y]=o?.[y]&&!v?o[y]:r[y]??o?.[y],f[u.score]=!0}}return i}search(t,n){const r=[];this.#r=Ip;let i=[this];const s=i7(n),a=[];for(let c=0,u=s.length;c<u;c++){const f=s[c],p=c===u-1,g=[];for(let y=0,v=i.length;y<v;y++){const x=i[y],S=x.#t[f];S&&(S.#r=x.#r,p?(S.#t["*"]&&r.push(...this.#o(S.#t["*"],t,x.#r)),r.push(...this.#o(S,t,x.#r))):g.push(S));for(let E=0,C=x.#n.length;E<C;E++){const _=x.#n[E],j=x.#r===Ip?{}:{...x.#r};if(_==="*"){const H=x.#t["*"];H&&(r.push(...this.#o(H,t,x.#r)),H.#r=j,g.push(H));continue}const[A,T,k]=_;if(!f&&!(k instanceof RegExp))continue;const R=x.#t[A],V=s.slice(c).join("/");if(k instanceof RegExp){const H=k.exec(V);if(H){if(j[T]=H[0],r.push(...this.#o(R,t,x.#r,j)),Object.keys(R.#t).length){R.#r=j;const F=H[0].match(/\//)?.length??0;(a[F]||=[]).push(R)}continue}}(k===!0||k.test(f))&&(j[T]=f,p?(r.push(...this.#o(R,t,j,x.#r)),R.#t["*"]&&r.push(...this.#o(R.#t["*"],t,j,x.#r))):(R.#r=j,g.push(R)))}}i=g.concat(a.shift()??[])}return r.length>1&&r.sort((c,u)=>c.score-u.score),[r.map(({handler:c,params:u})=>[c,u])]}},Nge=class{name="TrieRouter";#e;constructor(){this.#e=new tz}add(e,t,n){const r=a7(t);if(r){for(let o=0,i=r.length;o<i;o++)this.#e.insert(e,r[o],n);return}this.#e.insert(e,t,n)}match(e,t){return this.#e.search(e,t)}},Cw=class extends XF{constructor(e={}){super(e),this.router=e.router??new Ege({routers:[new Sge,new Nge]})}};class UM{constructor(t,n,r){this._schema=t,this.options=r,this._default=Qd(t.template({},{withOptional:!0})),this._value=Qd(Cn(t,n??{},{withDefaults:!0,forceParse:this.isForceParse(),skipMark:this.isForceParse()})),this._config=Qd(this._value)}_default;_value;_config;_restriction_bypass=!1;isForceParse(){return this.options?.forceParse??!0}default(){return this._default}async onBeforeUpdate(t,n){return this.options?.onBeforeUpdate?this.options.onBeforeUpdate(t,n):n}get(t){return t?.stripMark?ole(this._config):this._config}clone(){return structuredClone(this._config)}async set(t,n){const r=Cn(this._schema,structuredClone(t),{coerce:!1,forceParse:!0,skipMark:this.isForceParse()}),o=await this.onBeforeUpdate(this._config,r);return this._value=Qd(o),this._config=Qd(o),n!==!0&&await this.options?.onUpdate?.(this._config),this._config}bypass(){return this._restriction_bypass=!0,this}throwIfRestricted(t){if(this._restriction_bypass){this._restriction_bypass=!1;return}const n=this.options?.restrictPaths??[];if(Array.isArray(n)&&n.length>0){for(const r of n)if(typeof t=="string"?t.startsWith(r):_2(t,r))throw new Error(`Path "${r}" is restricted`)}}async patch(t,n){const r=this.clone(),o=t.length>0?X0({},t,n):n;this.throwIfRestricted(o);const i=DL(r,o,(a,c)=>{if(Array.isArray(a)&&Array.isArray(c))return c});if(this.options?.overwritePaths){const c=kL(n).map(u=>t.length>0?t+"."+u:u).filter(u=>this.options?.overwritePaths?.some(f=>typeof f=="string"?u===f:f.test(u)));if(c.length>0){const u=c.length>1?c.filter(f=>c.some(p=>p!==f&&p.startsWith(f))):c;for(const f of u)X0(i,f,Wm(o,f))}}const s=await this.set(i);return[o,s]}async overwrite(t,n){const r=this.clone(),o=t.length>0?X0({},t,n):n;this.throwIfRestricted(o);const i=X0(r,t,n),s=await this.set(i);return[o,s]}has(t){const n=t.split(".");if(n.length>1){const r=n.slice(0,-1).join(".");if(!_2(this._config,r))throw new Error(`Parent path "${r}" does not exist`)}return _2(this._config,t)}async remove(t){if(this.throwIfRestricted(t),!this.has(t))throw new Error(`Path "${t}" does not exist`);const n=this.clone(),r=Wm(n,t),o=Cv(n,t),i=await this.set(o);return[r,i]}}let Ug=class{constructor(t,n){this._ctx=n,this._schema=new UM(this.getSchema(),t,{forceParse:this.useForceParse(),onUpdate:async r=>{await this._listener(r)},restrictPaths:this.getRestrictedPaths(),overwritePaths:this.getOverwritePaths(),onBeforeUpdate:this.onBeforeUpdate.bind(this)})}_built=!1;_schema;_listener=()=>null;static ctx_flags={sync_required:!1,ctx_reload_required:!1};onBeforeUpdate(t,n){return n}setListener(t){return this._listener=t,this}useForceParse(){return!1}getRestrictedPaths(){}getOverwritePaths(){}get configDefault(){return this._schema.default()}get config(){return this._schema.get()}setContext(t){return this._ctx=t,this}schema(){return this._schema}onServerInit(t){}get ctx(){if(!this._ctx)throw new Error("Context not set");return this._ctx}async build(){throw new Error("Not implemented")}setBuilt(){this._built=!0,this._schema=new UM(this.getSchema(),this.toJSON(!0),{onUpdate:async t=>{await this._listener(t)},forceParse:this.useForceParse(),restrictPaths:this.getRestrictedPaths(),overwritePaths:this.getOverwritePaths(),onBeforeUpdate:this.onBeforeUpdate.bind(this)})}isBuilt(){return this._built}throwIfNotBuilt(){if(!this._built)throw new Error("Config not built: "+this.constructor.name)}toJSON(t){return this.config}};class _ge extends F7{name="dummy";supported={batching:!0};constructor(){super(void 0)}getFieldSchema(t,n){throw new Error("Method not implemented.")}}const nz=Ve({entity:le(),min_items:bt(),max_items:bt(),mime_types:un(le()),...rs.properties}).partial();class Ym extends os{type="media";constructor(t,n){super(t,{...n,fillable:["update"],virtual:!0})}getSchema(){return nz}getMaxItems(){return this.config.max_items}getAllowedMimeTypes(){return this.config.mime_types}getMinItems(){return this.config.min_items}schema(){}toJsonSchema(){const t="../schema.json#/properties/media",n=this.config?.min_items,r=this.config?.max_items;return r===1?{$ref:t}:{type:"array",items:{$ref:t},minItems:n,maxItems:r}}}const Z0={text:e=>new Sv(e.field_name,{...e.config,required:e.is_required}),number:e=>new tF(e.field_name,{...e.config,required:e.is_required}),date:e=>new $_(e.field_name,{...e.config,required:e.is_required}),datetime:e=>new $_(e.field_name,{...e.config,required:e.is_required}),boolean:e=>new H7(e.field_name,{...e.config,required:e.is_required}),enumm:e=>new G7(e.field_name,{...e.config,required:e.is_required}),json:e=>new Y7(e.field_name,{...e.config,required:e.is_required}),jsonSchema:e=>new Z7(e.field_name,{...e.config,required:e.is_required}),media:e=>new Ym(e.field_name,{...e.config,entity:e.entity.name,required:e.is_required}),medium:e=>new Ym(e.field_name,{...e.config,entity:e.entity.name,required:e.is_required})};class Sh{constructor(t,n,r){this.type=t,this.config=n,this.is_required=r}required(){return this.is_required=!0,this}getField(t){if(!Z0[this.type])throw new Error(`Unknown field type: ${this.type}`);try{return Z0[this.type](t)}catch(n){throw new Error(`Faild to construct field "${this.type}": ${n}`)}}make(t){if(!Z0[this.type])throw new Error(`Unknown field type: ${this.type}`);try{return Z0[this.type]({entity:{name:"unknown",fields:{}},field_name:t,config:this.config,is_required:this.is_required})}catch(n){throw new Error(`Faild to construct field "${this.type}": ${n}`)}}}function ys(e){return new Sh("text",e,!1)}function Cge(e){return new Sh("number",e,!1)}function Oge(e){return new Sh("date",{...e,type:"datetime"},!1)}function jge(e){return new Sh("boolean",e,!1)}function HM(e){const n={options:{type:typeof e?.enum?.[0]!="string"?"objects":"strings",values:e?.enum??[]}};return new Sh("enumm",n,!1)}function Age(e){return new Sh("json",e,!1)}function rz(e,t,n,r){const o=[];for(const[i,s]of Object.entries(t)){const a=s,c={entity:{name:e,fields:t},field_name:i,config:a.config,is_required:a.is_required};o.push(a.getField(c))}return new Kl(e,o,n,r)}function Tge(e){return{manyToOne:(t,n)=>new ac(e,t,n),oneToOne:(t,n)=>new F_(e,t,n),manyToMany:(t,n,r)=>{const o=[];if(r){const i=r,s=[],a=n?.connectionTable??Ra.defaultConnectionTable(e,t);for(const[c,u]of Object.entries(r)){const f=u,p={entity:{name:a,fields:i},field_name:c,config:f.config,is_required:f.is_required};s.push(f.getField(p))}o.push(s)}return new Ra(e,t,n,o)},polyToOne:(t,n)=>new Ov(e,t,{...n,targetCardinality:1}),polyToMany:(t,n)=>new Ov(e,t,n)}}function $ge(e){return{on:(t,n)=>{const r=t.map(o=>{const i=e.field(o);if(!i)throw new Error(`Field "${String(o)}" not found on entity "${e.name}"`);return i});return new iF(e,r,n)}}}class Rge extends Jm{constructor(t,n=[],r=[]){super(Object.values(t),new _ge,n,r),this.__entities=t}withConnection(t){return new Jm(this.entities,t,this.relations.all,this.indices)}}function oz(e,t){const n=[],r=[],o=a=>new Proxy(Tge(a),{get(c,u){return(...f)=>(n.push(c[u](...f)),o(a))}}),i=a=>new Proxy($ge(a),{get(c,u){return(...f)=>(r.push(c[u](...f)),i(a))}});t&&t({relation:o,index:i},e);const s=new Rge(e,n,r);return{DB:s.__entities,entities:s.__entities,relations:n,indices:r,proto:s,toJSON:()=>s.toJSON()}}function kge(e,t){const n=e.toJSON(),r=o=>{if($a(o)&&("required"in o&&t?.removeRequired&&(o.required=void 0),"default"in o&&t?.removeDefault&&(o.default=void 0),"properties"in o&&$a(o.properties)))for(const i in o.properties)o.properties[i]=r(o.properties[i]);return o};return r(n),Pi(n)}function Mge(e,t){const n={...e.properties};return Vt(n,(r,o)=>{if(!t(r))return r})}const Lf=Symbol.for("bknd-mcp-schema");class fA{constructor(t,n,r){this.schema=t,this.name=n,this.options=r,this.cleanSchema=this.getCleanSchema(this.schema)}cleanSchema;getCleanSchema(t){if(t.type!=="object")return t;const n=Mge(t,o=>$a(o)&&Lf in o),r=Ve(n);return kge(r,{removeRequired:!0,removeDefault:!1})}getToolOptions(t){const{tools:n,resources:r,...o}=this.options,i=s=>s&&[t&&Ta(t),s].filter(Boolean).join(" ");return{title:i(this.options.title??this.schema.title),description:i(this.options.description??this.schema.description),annotations:{destructiveHint:!0,idempotentHint:!0,...o.annotations}}}getManager(t){const n=t.context.app.modules;if("mutateConfigSafe"in n)return n;throw new Error("Manager not found")}}class Pge extends Lj{constructor(t,n,r){const{mcp:o,...i}=r||{};super(n,i),this[Lf]=new fA(this,t,o||{})}get mcp(){return this[Lf]}toolGet(t){return new ql([this.mcp.name,"get"].join("_"),{...this.mcp.getToolOptions("get"),inputSchema:Ve({path:le({pattern:/^[a-zA-Z0-9_.]{0,}$/,title:"Path",description:"Path to the property to get, e.g. `key.subkey`"}).optional(),depth:bt({description:"Limit the depth of the response"}).optional(),secrets:at({default:!1,description:"Include secrets in the response config"}).optional()}),annotations:{readOnlyHint:!0,destructiveHint:!1}},async(n,r)=>{const o=r.context.app.toJSON(n.secrets),i=Bn(o,t.instancePath);let s=Bn(i,n.path??[]);return n.depth&&(s=oie(s,n.depth)),r.json({path:n.path??"",secrets:n.secrets??!1,partial:!!n.depth,value:s??null})})}toolUpdate(t){const n=this.mcp.cleanSchema;return new ql([this.mcp.name,"update"].join("_"),{...this.mcp.getToolOptions("update"),inputSchema:Ve({full:at({default:!1}).optional(),return_config:at({default:!1,description:"If the new configuration should be returned"}).optional(),value:Ve(n.properties).partial()})},async(r,o)=>{const{full:i,value:s,return_config:a}=r,[c]=t.instancePath,u=this.mcp.getManager(o);i?await u.mutateConfigSafe(c).set(s):await u.mutateConfigSafe(c).patch("",s);let f;if(a){const p=o.context.app.toJSON();f=Bn(p,t.instancePath)}return o.json({success:!0,module:c,config:f})})}getTools(t){const{tools:n=[]}=this.mcp.options;return[this.toolGet(t),this.toolUpdate(t),...n]}}const Ow=(e,t,n)=>new Pge(e,t,n),qM=Symbol.for("bknd-mcp-record-opts");class Dge extends Fj{constructor(t,n,r,o){const{mcp:i,...s}=r||{};super(n,s),this[Lf]=new fA(this,t,i||{}),this[qM]={new_schema:o}}get mcp(){return this[Lf]}getNewSchema(t=this.additionalProperties){return this[qM].new_schema??this.additionalProperties??t}toolGet(t){return new ql([this.mcp.name,"get"].join("_"),{...this.mcp.getToolOptions("get"),inputSchema:Ve({key:le({description:"key to get"}).optional(),secrets:at({default:!1,description:"(optional) include secrets in the response config"}).optional(),schema:at({default:!1,description:"(optional) include the schema in the response"}).optional()}),annotations:{readOnlyHint:!0,destructiveHint:!1}},async(n,r)=>{const o=r.context.app.toJSON(n.secrets),i=Bn(o,t.instancePath),[s]=t.instancePath,a=n.schema?this.getNewSchema().toJSON():void 0;if(n.key){if(!(n.key in i))throw new Error(`Key "${n.key}" not found in config`);const c=Bn(i,n.key);return r.json({secrets:n.secrets??!1,module:s,key:n.key,value:c??null,schema:a})}return r.json({secrets:n.secrets??!1,module:s,key:null,value:i??null,schema:a})})}toolAdd(t){return new ql([this.mcp.name,"add"].join("_"),{...this.mcp.getToolOptions("add"),inputSchema:Ve({key:le({description:"key to add"}),value:this.getNewSchema(),return_config:at({default:!1,description:"If the new configuration should be returned"}).optional()})},async(n,r)=>{const o=r.context.app.toJSON(!0),i=Bn(o,t.instancePath),[s,...a]=t.instancePath,c=this.mcp.getManager(r);if(n.key in i)throw new Error(`Key "${n.key}" already exists in config`);await c.mutateConfigSafe(s).patch([...a,n.key],n.value);const u=Bn(r.context.app.toJSON(),t.instancePath);return r.json({success:!0,module:s,action:{type:"add",key:n.key},config:n.return_config?u:void 0})})}toolUpdate(t){return new ql([this.mcp.name,"update"].join("_"),{...this.mcp.getToolOptions("update"),inputSchema:Ve({key:le({description:"key to update"}),value:this.mcp.getCleanSchema(this.getNewSchema(ke({}))),return_config:at({default:!1,description:"If the new configuration should be returned"}).optional()})},async(n,r)=>{const o=r.context.app.toJSON(!0),i=Bn(o,t.instancePath),[s,...a]=t.instancePath,c=this.mcp.getManager(r);if(!(n.key in i))throw new Error(`Key "${n.key}" not found in config`);await c.mutateConfigSafe(s).patch([...a,n.key],n.value);const u=Bn(r.context.app.toJSON(),t.instancePath);return r.json({success:!0,module:s,action:{type:"update",key:n.key},config:n.return_config?u:void 0})})}toolRemove(t){return new ql([this.mcp.name,"remove"].join("_"),{...this.mcp.getToolOptions("get"),inputSchema:Ve({key:le({description:"key to remove"}),return_config:at({default:!1,description:"If the new configuration should be returned"}).optional()})},async(n,r)=>{const o=r.context.app.toJSON(!0),i=Bn(o,t.instancePath),[s,...a]=t.instancePath,c=this.mcp.getManager(r);if(!(n.key in i))throw new Error(`Key "${n.key}" not found in config`);await c.mutateConfigSafe(s).remove([...a,n.key].join("."));const u=Bn(r.context.app.toJSON(),t.instancePath);return r.json({success:!0,module:s,action:{type:"remove",key:n.key},config:n.return_config?u:void 0})})}getTools(t){const{tools:n=[],get:r=!0,add:o=!0,update:i=!0,remove:s=!0}=this.mcp.options;return[r&&this.toolGet(t),o&&this.toolAdd(t),i&&this.toolUpdate(t),s&&this.toolRemove(t),...n].filter(Boolean)}}const ym=(e,t,n,r)=>new Dge(e,t,n,r),Ige=(e,t,n)=>{const r=new fA(t,e,{}),o=a=>new ql([r.name,"get"].join("_"),{...r.getToolOptions("get"),inputSchema:Ve({secrets:at({default:!1,description:"Include secrets in the response config"}).optional()})},async(c,u)=>{const f=u.context.app.toJSON(c.secrets),p=Bn(f,a.instancePath);return u.json({secrets:c.secrets??!1,value:p??null})}),i=a=>new ql([r.name,"update"].join("_"),{...r.getToolOptions("update"),inputSchema:Ve({value:t,return_config:at({default:!1}).optional(),secrets:at({default:!1}).optional()})},async(c,u)=>{const{value:f,return_config:p,secrets:g}=c,[y,...v]=a.instancePath;await r.getManager(u).mutateConfigSafe(y).overwrite(v,f);let S;if(p){const E=u.context.app.toJSON(g);S=Bn(E,a.instancePath)}return u.json({success:!0,module:y,config:S})}),s=a=>{const{tools:c=[]}=r.options;return[o(a),i(a),...c]};return Object.assign(t,{[Lf]:r,getTools:s})};var Lge=e=>{const n={...{origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[]},...e},r=(i=>typeof i=="string"?i==="*"?()=>i:s=>i===s?s:null:typeof i=="function"?i:s=>i.includes(s)?s:null)(n.origin),o=(i=>typeof i=="function"?i:Array.isArray(i)?()=>i:()=>[])(n.allowMethods);return async function(s,a){function c(f,p){s.res.headers.set(f,p)}const u=await r(s.req.header("origin")||"",s);if(u&&c("Access-Control-Allow-Origin",u),n.credentials&&c("Access-Control-Allow-Credentials","true"),n.exposeHeaders?.length&&c("Access-Control-Expose-Headers",n.exposeHeaders.join(",")),s.req.method==="OPTIONS"){n.origin!=="*"&&c("Vary","Origin"),n.maxAge!=null&&c("Access-Control-Max-Age",n.maxAge.toString());const f=await o(s.req.header("origin")||"",s);f.length&&c("Access-Control-Allow-Methods",f.join(","));let p=n.allowHeaders;if(!p?.length){const g=s.req.header("Access-Control-Request-Headers");g&&(p=g.split(/\s*,\s*/))}return p?.length&&(c("Access-Control-Allow-Headers",p.join(",")),s.res.headers.append("Vary","Access-Control-Request-Headers")),s.res.headers.delete("Content-Length"),s.res.headers.delete("Content-Type"),new Response(null,{headers:s.res.headers,status:204,statusText:"No Content"})}await a(),n.origin!=="*"&&s.header("Vary","Origin",{append:!0})}};class Hg extends Br{getSafeErrorAndCode(){return{error:"Invalid credentials",code:Qt.UNAUTHORIZED}}toJSON(){return ir()?super.toJSON():{error:this.getSafeErrorAndCode().error,type:"AuthException"}}}class Fge extends Hg{name="UserNotFoundException";code=Qt.NOT_FOUND;constructor(){super("User not found")}}class Lp extends Hg{name="InvalidCredentialsException";code=Qt.UNAUTHORIZED;constructor(){super("Invalid credentials")}}class zge extends Hg{name="UnableToCreateUserException";code=Qt.INTERNAL_SERVER_ERROR;constructor(){super("Unable to create user")}}class aa extends Hg{code=Qt.UNPROCESSABLE_ENTITY;constructor(t){super(t??"Invalid conditions")}}const WM=["GET","POST","PATCH","PUT","DELETE"],Bge=Ow("config_server",{cors:Ve({origin:le({default:"*"}),allow_methods:un(le({enum:WM}),{default:WM,uniqueItems:!0}),allow_headers:un(le(),{default:["Content-Type","Content-Length","Authorization","Accept"]}),allow_credentials:at({default:!0})}),mcp:Ve({enabled:at({default:!1}),path:le({default:"/api/system/mcp"}),logLevel:le({enum:Zae,default:"warning"})})},{description:"Server configuration"}).strict();class Vge extends Ug{getRestrictedPaths(){return[]}get client(){return this.ctx.server}getSchema(){return Bge}async build(){const t=this.config.cors.origin??"*",n=t.includes(",")?t.split(",").map(o=>o.trim()):[t],r=n.includes("*");this.client.use("*",Lge({origin:o=>r||n.includes(o)?o:void 0,allowMethods:this.config.cors.allow_methods,allowHeaders:this.config.cors.allow_headers,credentials:this.config.cors.allow_credentials})),this.client.use("/",async(o,i)=>{await i(),(!o.finalized||o.res.status===404)&&new URL(o.req.url).pathname==="/"&&(o.res=void 0,o.res=Response.json({bknd:"hello world!"}))}),this.client.onError((o,i)=>(rt.error("[AppServer:onError]",o),o instanceof Response?o:o instanceof Hg?ir()?i.json(o.toJSON(),o.code):i.json(o.toJSON(),o.getSafeErrorAndCode().code):o instanceof Br?i.json(o.toJSON(),o.code):o instanceof Error&&ir()?i.json({error:o.message,stack:o.stack?.split(`
`).map(s=>s.trim())},500):i.json({error:o.message},500))),this.setBuilt()}toJSON(t){return this.config}}Ve({description:le(),filterable:at()}).partial();class hA extends yh{name="InvalidPermissionContextError";code=Qt.INTERNAL_SERVER_ERROR;static from(t){return new hA(t.schema,t.value,t.errors)}}let On=class{constructor(t,n={},r=void 0){this.name=t,this.options=n,this.context=r}isFilterable(){return this.options.filterable===!0}parseContext(t,n){if(!this.context)return t;try{return this.context?Cn(this.context,t,n):void 0}catch(r){throw r instanceof yh?hA.from(r):r}}toJSON(){return{name:this.name,...this.options,context:this.context}}};const B_=new On("auth.user.create"),iz=new On("auth.user.password.test"),sz=new On("auth.user.password.change"),az=new On("auth.user.token.create"),Uge=Object.freeze(Object.defineProperty({__proto__:null,changePassword:sz,createToken:az,createUser:B_,testPassword:iz},Symbol.toStringTag,{value:"Module"})),Zr=new On("data.entity.read",{filterable:!0},ke({entity:le(),id:Rt([bt(),le()]).optional()})),Km=new On("data.entity.create",{filterable:!0},ke({entity:le()})),em=new On("data.entity.update",{filterable:!0},ke({entity:le(),id:Rt([bt(),le()]).optional()})),tm=new On("data.entity.delete",{filterable:!0},ke({entity:le(),id:Rt([bt(),le()]).optional()})),lz=new On("data.database.sync"),Hge=new On("data.raw.query"),qge=new On("data.raw.mutate"),Wge=Object.freeze(Object.defineProperty({__proto__:null,databaseSync:lz,entityCreate:Km,entityDelete:tm,entityRead:Zr,entityUpdate:em,rawMutate:qge,rawQuery:Hge},Symbol.toStringTag,{value:"Module"}));var cz=e=>e;function uz(e){const t=e instanceof Request?e:e.req.raw;return new URL(t.url).pathname}function Gge(e,t){const n=e.get("auth");if(!n)throw new Error("auth ctx not found");if(n.skip)return!0;const r=e.req.raw;if(!t)return!1;const o=uz(r),i=t.some(s=>nie(o,s));return n.skip=i,i}const Jge=e=>cz(async(t,n)=>{t.get("auth")||t.set("auth",{registered:!1,resolved:!1,skip:!1,user:void 0});const r=t.get("app"),o=t.get("auth"),i=r?.module.auth.authenticator;let s=Gge(t,e?.skip)||!r?.module.auth.enabled;o.registered?(s=!0,rt.debug(`auth middleware already registered for ${uz(t)}`)):(o.registered=!0,!s&&!o.resolved&&r?.module.auth.enabled&&(o.user=await i?.resolveAuthFromRequest(t),o.resolved=!0)),await n(),o.skip=!1,o.resolved=!1,o.user=void 0});function Yge(e){const t=e instanceof Request?e:e.req.raw;return new URL(t.url).pathname}const Kge=Symbol.for("permission");function Xge(e,t){const n=cz(async(r,o)=>{const i=r.get("app"),s=r.get("auth");if(!s)throw new Error("auth ctx not found");if(!s.registered||!i){const a=`auth middleware not registered, cannot check permissions for ${Yge(r)}`;if(i?.module.auth.enabled)throw new Error(a);rt.warn(a)}else if(!s.skip){const a=i.modules.ctx().guard,c=await t?.context?.(r)??{};if(t?.onGranted||t?.onDenied){let u;if(die(()=>a.granted(e,r,c),dle)?u=await t?.onDenied?.(r):u=await t?.onGranted?.(r),u instanceof Response)return u}else a.granted(e,r,c)}await o()});return Object.assign(n,{[Kge]:{permission:e,options:t}})}const Qge=Object.freeze(Object.defineProperty({__proto__:null,auth:Jge,permission:Xge},Symbol.toStringTag,{value:"Module"}));class qg{middlewares=Qge;create(){return qg.createServer()}static createServer(){return new Cw}getController(){return this.create()}isJsonRequest(t){return t.req.header("Content-Type")==="application/json"||t.req.header("Accept")==="application/json"}notFound(t){return this.isJsonRequest(t)?t.json({error:"Not found"},404):t.notFound()}getEntitiesEnum(t){const n=t.entities.map(r=>r.name);return n.length>0?Rt([le({enum:n}),le()]):le()}registerMcp(){}}class Zge extends qg{constructor(t){super(),this.auth=t}get guard(){return this.auth.ctx.guard}get em(){return this.auth.ctx.em}get userRepo(){const t=this.auth.config.entity_name;return this.em.repo(t)}registerStrategyActions(t,n){if(!this.auth.isStrategyEnabled(t))return;const r=t.getActions?.();if(!r)return;const{auth:o,permission:i}=this.middlewares,s=this.create().use(o()),a=t.getName(),{create:c,change:u}=r,f=this.auth.em;c&&(s.post("/create",i(B_,{}),i(Km,{context:p=>({entity:this.auth.config.entity_name})}),zt({summary:"Create a new user",tags:["auth"]}),async p=>{try{const g=await this.auth.authenticator.getBody(p),y=Cn(c.schema,g,{}),v=await c.preprocess?.(y)??y,x=f.mutator(this.auth.config.entity_name);x.__unstable_toggleSystemEntityCreation(!1);const{data:S}=await x.insertOne({...v,strategy:a});return x.__unstable_toggleSystemEntityCreation(!0),p.json({success:!0,action:"create",strategy:a,data:S})}catch(g){if(g instanceof yh)return p.json({success:!1,errors:g.errors},400);throw g}}),s.get("create/schema.json",zt({summary:"Get the schema for creating a user",tags:["auth"]}),async p=>p.json(c.schema))),n.route(`/${a}/actions`,s)}getController(){const{auth:t}=this.middlewares,n=this.create();n.get("/me",zt({summary:"Get the current user",tags:["auth"]}),eo("auth_me",{noErrorCodes:[403]}),t(),async o=>{const i=o.get("auth")?.user;if(i){const{data:s}=await this.userRepo.findId(i.id);return await this.auth.authenticator?.requestCookieRefresh(o),o.json({user:s})}return o.json({user:null},403)}),n.get("/logout",zt({summary:"Logout the current user",tags:["auth"]}),t(),async o=>{if(await this.auth.authenticator.logout(o),this.auth.authenticator.isJsonRequest(o))return o.json({ok:!0});const i=o.req.header("referer");return i?o.redirect(i):o.redirect("/")}),n.get("/strategies",zt({summary:"Get the available authentication strategies",tags:["auth"]}),eo("auth_strategies"),Ft("query",ke({include_disabled:at().optional()})),async o=>{const{include_disabled:i}=o.req.valid("query"),{strategies:s,basepath:a}=this.auth.toJSON(!1);return i?o.json({strategies:s,basepath:a}):o.json({strategies:Vt(s??{},(c,u)=>this.auth.isStrategyEnabled(u)?c:void 0),basepath:a})});const r=this.auth.authenticator.getStrategies();for(const[o,i]of Object.entries(r))this.auth.isStrategyEnabled(i)&&(n.route(`/${o}`,i.getController(this.auth.authenticator)),this.registerStrategyActions(i,n));return n}registerMcp(){const{mcp:t}=this.auth.ctx,n=Rt([bt({title:"Integer"}),le({title:"UUID"})]),r=async i=>{let s;if(i.id){const{data:a}=await this.userRepo.findId(i.id);s=a}else if(i.email){const{data:a}=await this.userRepo.findOne({email:i.email});s=a}if(!s)throw new Error("User not found");return s},o=Object.keys(this.auth.config.roles??{});try{const i=this.auth.authenticator.strategy("password").getActions();if(i.create){const s=i.create.schema;t.tool("auth_user_create",{description:"Create a new user",inputSchema:ke({...s.properties,role:le({enum:o.length>0?o:void 0}).optional()})},async(a,c)=>(await c.context.ctx().helper.granted(c,B_),c.json(await this.auth.createUser(a))))}}catch(i){rt.warn("error creating auth_user_create tool",i)}t.tool("auth_user_token",{description:"Get a user token",inputSchema:ke({id:n.optional(),email:le({format:"email"}).optional()})},async(i,s)=>{await s.context.ctx().helper.granted(s,az);const a=await r(i);return s.json({user:a,token:await this.auth.authenticator.jwt(a)})}),t.tool("auth_user_password_change",{description:"Change a user's password",inputSchema:ke({id:n.optional(),email:le({format:"email"}).optional(),password:le({minLength:8})})},async(i,s)=>{await s.context.ctx().helper.granted(s,sz);const a=await r(i);if(!await this.auth.changePassword(a.id,i.password))throw new Error("Failed to change password");return s.json({changed:!0})}),t.tool("auth_user_password_test",{description:"Test a user's password",inputSchema:ke({email:le({format:"email"}),password:le({minLength:8})})},async(i,s)=>{await s.context.ctx().helper.granted(s,iz);const u=await this.auth.authenticator.strategy("password").getController(this.auth.authenticator).request(new Request("https://localhost/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:i.email,password:i.password})}));return s.json({valid:u.ok})})}}const V_="__bknd_flash";function GM(e,t,n="info"){e.req.header("Accept")?.includes("text/html")&&h7(e,V_,JSON.stringify({type:n,message:t}),{path:"/"})}function eye(e){const t=document.cookie.split("; ");for(const n of t){const[r,o]=n.split("=");if(r===e)try{return decodeURIComponent(o)}catch{return null}}return null}function tye(e=!0){const t=eye(V_);return t&&e&&(document.cookie=`${V_}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`),t?JSON.parse(t):void 0}var dz=e=>hz(e.replace(/_|-/g,t=>({_:"/","-":"+"})[t]??t)),fz=e=>nye(e).replace(/\/|\+/g,t=>({"/":"_","+":"-"})[t]??t),nye=e=>{let t="";const n=new Uint8Array(e);for(let r=0,o=n.length;r<o;r++)t+=String.fromCharCode(n[r]);return btoa(t)},hz=e=>{const t=atob(e),n=new Uint8Array(new ArrayBuffer(t.length)),r=t.length/2;for(let o=0,i=t.length-1;o<=r;o++,i--)n[o]=t.charCodeAt(o),n[i]=t.charCodeAt(i);return n},pz=(e=>(e.HS256="HS256",e.HS384="HS384",e.HS512="HS512",e.RS256="RS256",e.RS384="RS384",e.RS512="RS512",e.PS256="PS256",e.PS384="PS384",e.PS512="PS512",e.ES256="ES256",e.ES384="ES384",e.ES512="ES512",e.EdDSA="EdDSA",e))(pz||{}),rye=class extends Error{constructor(e){super(`${e} is not an implemented algorithm`),this.name="JwtAlgorithmNotImplemented"}},mz=class extends Error{constructor(e){super(`invalid JWT token: ${e}`),this.name="JwtTokenInvalid"}},oye=class extends Error{constructor(e){super(`token (${e}) is being used before it's valid`),this.name="JwtTokenNotBefore"}},iye=class extends Error{constructor(e){super(`token (${e}) expired`),this.name="JwtTokenExpired"}},sye=class extends Error{constructor(e,t){super(`Invalid "iat" claim, must be a valid number lower than "${e}" (iat: "${t}")`),this.name="JwtTokenIssuedAt"}},j2=class extends Error{constructor(e,t){super(`expected issuer "${e}", got ${t?`"${t}"`:"none"} `),this.name="JwtTokenIssuer"}},aye=class extends Error{constructor(e){super(`jwt header is invalid: ${JSON.stringify(e)}`),this.name="JwtHeaderInvalid"}},lye=class extends Error{constructor(e){super(`token(${e}) signature mismatched`),this.name="JwtTokenSignatureMismatched"}},cye=class extends Error{constructor(e){super(`required "aud" in jwt payload: ${JSON.stringify(e)}`),this.name="JwtPayloadRequiresAud"}},uye=class extends Error{constructor(e,t){super(`expected audience "${Array.isArray(e)?e.join(", "):e}", got "${t}"`),this.name="JwtTokenAudience"}},Xm=(e=>(e.Encrypt="encrypt",e.Decrypt="decrypt",e.Sign="sign",e.Verify="verify",e.DeriveKey="deriveKey",e.DeriveBits="deriveBits",e.WrapKey="wrapKey",e.UnwrapKey="unwrapKey",e))(Xm||{}),Wg=new TextEncoder,dye=new TextDecoder;async function fye(e,t,n){const r=gz(t),o=await pye(e,r);return await crypto.subtle.sign(r,o,n)}async function hye(e,t,n,r){const o=gz(t),i=await mye(e,o);return await crypto.subtle.verify(o,i,n,r)}function U_(e){return hz(e.replace(/-+(BEGIN|END).*/g,"").replace(/\s/g,""))}async function pye(e,t){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(yz(e)){if(e.type!=="private"&&e.type!=="secret")throw new Error(`unexpected key type: CryptoKey.type is ${e.type}, expected private or secret`);return e}const n=[Xm.Sign];return typeof e=="object"?await crypto.subtle.importKey("jwk",e,t,!1,n):e.includes("PRIVATE")?await crypto.subtle.importKey("pkcs8",U_(e),t,!1,n):await crypto.subtle.importKey("raw",Wg.encode(e),t,!1,n)}async function mye(e,t){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(yz(e)){if(e.type==="public"||e.type==="secret")return e;e=await JM(e)}if(typeof e=="string"&&e.includes("PRIVATE")){const r=await crypto.subtle.importKey("pkcs8",U_(e),t,!0,[Xm.Sign]);e=await JM(r)}const n=[Xm.Verify];return typeof e=="object"?await crypto.subtle.importKey("jwk",e,t,!1,n):e.includes("PUBLIC")?await crypto.subtle.importKey("spki",U_(e),t,!1,n):await crypto.subtle.importKey("raw",Wg.encode(e),t,!1,n)}async function JM(e){if(e.type!=="private")throw new Error(`unexpected key type: ${e.type}`);if(!e.extractable)throw new Error("unexpected private key is unextractable");const t=await crypto.subtle.exportKey("jwk",e),{kty:n}=t,{alg:r,e:o,n:i}=t,{crv:s,x:a,y:c}=t;return{kty:n,alg:r,e:o,n:i,crv:s,x:a,y:c,key_ops:[Xm.Verify]}}function gz(e){switch(e){case"HS256":return{name:"HMAC",hash:{name:"SHA-256"}};case"HS384":return{name:"HMAC",hash:{name:"SHA-384"}};case"HS512":return{name:"HMAC",hash:{name:"SHA-512"}};case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"RS384":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"PS256":return{name:"RSA-PSS",hash:{name:"SHA-256"},saltLength:32};case"PS384":return{name:"RSA-PSS",hash:{name:"SHA-384"},saltLength:48};case"PS512":return{name:"RSA-PSS",hash:{name:"SHA-512"},saltLength:64};case"ES256":return{name:"ECDSA",hash:{name:"SHA-256"},namedCurve:"P-256"};case"ES384":return{name:"ECDSA",hash:{name:"SHA-384"},namedCurve:"P-384"};case"ES512":return{name:"ECDSA",hash:{name:"SHA-512"},namedCurve:"P-521"};case"EdDSA":return{name:"Ed25519",namedCurve:"Ed25519"};default:throw new rye(e)}}function yz(e){return zL()==="node"&&crypto.webcrypto?e instanceof crypto.webcrypto.CryptoKey:e instanceof CryptoKey}var A2=e=>fz(Wg.encode(JSON.stringify(e)).buffer).replace(/=/g,""),gye=e=>fz(e).replace(/=/g,""),YM=e=>JSON.parse(dye.decode(dz(e)));function yye(e){if(typeof e=="object"&&e!==null){const t=e;return"alg"in t&&Object.values(pz).includes(t.alg)&&(!("typ"in t)||t.typ==="JWT")}return!1}var bye=async(e,t,n="HS256")=>{const r=A2(e);let o;typeof t=="object"&&"alg"in t?(n=t.alg,o=A2({alg:n,typ:"JWT",kid:t.kid})):o=A2({alg:n,typ:"JWT"});const i=`${o}.${r}`,s=await fye(t,n,Wg.encode(i)),a=gye(s);return`${i}.${a}`},vye=async(e,t,n)=>{const{alg:r="HS256",iss:o,nbf:i=!0,exp:s=!0,iat:a=!0,aud:c}=typeof n=="string"?{alg:n}:n||{},u=e.split(".");if(u.length!==3)throw new mz(e);const{header:f,payload:p}=bz(e);if(!yye(f))throw new aye(f);const g=Date.now()/1e3|0;if(i&&p.nbf&&p.nbf>g)throw new oye(e);if(s&&p.exp&&p.exp<=g)throw new iye(e);if(a&&p.iat&&g<p.iat)throw new sye(g,p.iat);if(o){if(!p.iss)throw new j2(o,null);if(typeof o=="string"&&p.iss!==o)throw new j2(o,p.iss);if(o instanceof RegExp&&!o.test(p.iss))throw new j2(o,p.iss)}if(c){if(!p.aud)throw new cye(p);if(!(Array.isArray(p.aud)?p.aud:[p.aud]).some(E=>c instanceof RegExp?c.test(E):typeof c=="string"?E===c:Array.isArray(c)&&c.includes(E)))throw new uye(c,p.aud)}const y=e.substring(0,e.lastIndexOf("."));if(!await hye(t,r,dz(u[2]),Wg.encode(y)))throw new lye(e);return p},bz=e=>{try{const[t,n]=e.split("."),r=YM(t),o=YM(n);return{header:r,payload:o}}catch{throw new mz(e)}},pA={sign:bye,verify:vye,decode:bz},xye=pA.verify,wye=pA.decode,Sye=pA.sign;const vz=60*60*24*7,xz=Ve({domain:le().optional(),path:le({default:"/"}),sameSite:le({enum:["strict","lax","none"],default:"lax"}),secure:at({default:!0}),httpOnly:at({default:!0}),expires:bt({default:vz}),partitioned:at({default:!1}),renew:at({default:!0}),pathSuccess:le({default:"/"}),pathLoggedOut:le({default:"/"})}).partial(),wz=Ve({secret:Pm({default:""}),alg:le({enum:["HS256","HS384","HS512"],default:"HS256"}).optional(),expires:bt().optional(),issuer:le().optional(),fields:un(le(),{default:["id","email","role"]})},{default:{}}),Eye=ke({jwt:wz,cookie:xz,default_role_register:le().optional()});class Nye{constructor(t,n,r){this.strategies=t,this.userPool=n,this.config=Cn(Eye,r??{})}config;async resolveLogin(t,n,r,o,i){try{const s=i?.identifier||"email";if(typeof s!="string"||s.length===0)throw new aa("Identifier must be a string");if(!(s in r))throw new aa(`Profile must have identifier "${s}"`);const a=await this.userPool.findBy(n.getName(),s,r[s]);if(a.strategy_value){if(a.strategy!==n.getName())throw new aa("User signed up with a different strategy")}else throw new aa("User must have a strategy value");await o(a);const c=await this.safeAuthResponse(a);return this.respondWithUser(t,c,i)}catch(s){return this.respondWithError(t,s,i)}}async resolveRegister(t,n,r,o,i){try{const s=i?.identifier||"email";if(typeof s!="string"||s.length===0)throw new aa("Identifier must be a string");if(!(s in r))throw new aa(`Profile must have identifier "${s}"`);if(!("strategy_value"in r))throw new aa("Profile must have a strategy value");if("role"in r)throw new aa("Role cannot be provided during registration");const a=await this.userPool.create(n.getName(),{...r,role:this.config.default_role_register,strategy_value:r.strategy_value});await o(a);const c=await this.safeAuthResponse(a);return this.respondWithUser(t,c,i)}catch(s){return this.respondWithError(t,s,i)}}async respondWithUser(t,n,r){const o=this.getSafeUrl(t,r?.redirect??this.config.cookie.pathSuccess??"/");if("token"in n)return await this.setAuthCookie(t,n.token),this.isJsonRequest(t)||r?.forceJsonResponse?t.json(n):t.redirect(o);throw new Br("Invalid response")}async respondWithError(t,n,r){if(rt.error("respondWithError",n),this.isJsonRequest(t)||r?.forceJsonResponse)throw n;await GM(t,String(n),"error");const o=this.getSafeUrl(t,t.req.header("Referer")??"/");return t.redirect(o)}getStrategies(){return this.strategies}strategy(t){try{return this.strategies[t]}catch{throw new Error(`Strategy "${String(t)}" not found`)}}async jwt(t){const r={...Rm(t,this.config.jwt.fields),iat:Math.floor(Date.now()/1e3)};this.config.jwt?.issuer&&(r.iss=this.config.jwt.issuer),this.config.jwt?.expires&&(r.exp=Math.floor(Date.now()/1e3)+this.config.jwt.expires);const o=this.config.jwt.secret;if(!o||o.length===0)throw new Error("Cannot sign JWT without a secret");return Sye(r,o,this.config.jwt?.alg??"HS256")}async safeAuthResponse(t){const n=Rm(t,this.config.jwt.fields);return{user:n,token:await this.jwt(n)}}async verify(t){try{const n=await xye(t,this.config.jwt?.secret??"",this.config.jwt?.alg??"HS256");if(this.config.jwt?.issuer&&n.iss!==this.config.jwt.issuer)throw new Br("Invalid issuer",403);return n}catch(n){rt.debug("Authenticator jwt verify error",String(n))}}get cookieOptions(){const{expires:t=vz,renew:n,...r}=this.config.cookie;return{...r,domain:r.domain??void 0,expires:new Date(Date.now()+t*1e3)}}async getAuthCookie(t){try{const n=this.config.jwt.secret,r=await f7(t,n,"auth");return typeof r!="string"?void 0:r}catch(n){n instanceof Error&&rt.error("[getAuthCookie]",n.message);return}}async requestCookieRefresh(t){if(this.config.cookie.renew&&t.get("auth")?.user){const n=await this.getAuthCookie(t);n&&await this.setAuthCookie(t,n)}}async setAuthCookie(t,n){rt.debug("setting auth cookie",rie(n));const r=this.config.jwt.secret;await p7(t,"auth",n,r,this.cookieOptions)}async getAuthCookieHeader(t,n=new Headers){const r={header:(o,i)=>{n.set(o,i)}};return await this.setAuthCookie(r,t),n}async removeAuthCookieHeader(t=new Headers){const n={header:(r,o)=>{t.set(r,o)},req:{raw:{headers:t}}};return this.deleteAuthCookie(n),t}async unsafeGetAuthCookie(t){return Lb("auth",t,this.config.jwt.secret,this.cookieOptions)}deleteAuthCookie(t){rt.debug("deleting auth cookie"),Bae(t,"auth",this.cookieOptions)}async logout(t){rt.info("Logging out"),t.set("auth",void 0),await this.getAuthCookie(t)&&GM(t,"Signed out","info"),this.deleteAuthCookie(t)}isJsonRequest(t){return t.req.header("Content-Type")==="application/json"||t.req.header("Accept")==="application/json"}async getBody(t){return this.isJsonRequest(t)?await t.req.json():Object.fromEntries((await t.req.formData()).entries())}getSafeUrl(t,n){const r=n.replace(/\/+$/,"/");return uie("redirects_non_fq")?r:new URL(t.req.url).origin+r}async resolveAuthFromRequest(t){let n,r=!1;if(t instanceof Headers)n=t;else if(t instanceof Request)n=t.headers;else{r=!0;try{n=t.req.raw.headers}catch{throw new Br("Request/Headers/Context is required to resolve auth",400)}}let o;if(n.has("Authorization"))o=String(n.get("Authorization")).replace("Bearer ","");else{const i=r?t:{req:{raw:{headers:n}}};o=await this.getAuthCookie(i)}if(o)return await this.verify(o)}toJSON(t){return{...this.config,jwt:t?this.config.jwt:void 0}}}let H_;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(H_="oauth4webapi/v2.17.0");function Gg(e,t){if(e==null)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch{return!1}}const $v=Symbol(),_ye=Symbol(),mA=Symbol(),Cye=Symbol(),Sz=Symbol(),Oye=Symbol(),jye=new TextEncoder,Aye=new TextDecoder;function Xl(e){return typeof e=="string"?jye.encode(e):Aye.decode(e)}const KM=32768;function Tye(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));const t=[];for(let n=0;n<e.byteLength;n+=KM)t.push(String.fromCharCode.apply(null,e.subarray(n,n+KM)));return btoa(t.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function $ye(e){try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}catch(t){throw new Ge("The input to be decoded is not correctly encoded.",{cause:t})}}function xa(e){return typeof e=="string"?$ye(e):Tye(e)}class Rye{constructor(t){this.cache=new Map,this._cache=new Map,this.maxSize=t}get(t){let n=this.cache.get(t);if(n)return n;if(n=this._cache.get(t))return this.update(t,n),n}has(t){return this.cache.has(t)||this._cache.has(t)}set(t,n){return this.cache.has(t)?this.cache.set(t,n):this.update(t,n),this}delete(t){return this.cache.has(t)?this.cache.delete(t):this._cache.has(t)?this._cache.delete(t):!1}update(t,n){this.cache.set(t,n),this.cache.size>=this.maxSize&&(this._cache=this.cache,this.cache=new Map)}}class Zi extends Error{constructor(t){super(t??"operation not supported"),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class kye extends Error{constructor(t,n){super(t,n),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}const Ge=kye,Ez=new Rye(100);function Nz(e){return e instanceof CryptoKey}function Mye(e){return Nz(e)&&e.type==="private"}function Pye(e){return Nz(e)&&e.type==="public"}function gA(e){try{const t=e.headers.get("dpop-nonce");t&&Ez.set(new URL(e.url).origin,t)}catch{}return e}function Ff(e){return!(e===null||typeof e!="object"||Array.isArray(e))}function jw(e){Gg(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(e);if(H_&&!t.has("user-agent")&&t.set("user-agent",H_),t.has("authorization"))throw new TypeError('"options.headers" must not include the "authorization" header name');if(t.has("dpop"))throw new TypeError('"options.headers" must not include the "dpop" header name');return t}function Dye(e){if(typeof e=="function"&&(e=e()),!(e instanceof AbortSignal))throw new TypeError('"options.signal" must return or be an instance of AbortSignal');return e}async function Iye(e,t){if(!(e instanceof URL))throw new TypeError('"issuerIdentifier" must be an instance of URL');if(e.protocol!=="https:"&&e.protocol!=="http:")throw new TypeError('"issuer.protocol" must be "https:" or "http:"');const n=new URL(e.href);switch(t?.algorithm){case void 0:case"oidc":n.pathname=`${n.pathname}/.well-known/openid-configuration`.replace("//","/");break;case"oauth2":n.pathname==="/"?n.pathname=".well-known/oauth-authorization-server":n.pathname=`.well-known/oauth-authorization-server/${n.pathname}`.replace("//","/");break;default:throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"')}const r=jw(t?.headers);return r.set("accept","application/json"),(t?.[mA]||fetch)(n.href,{headers:Object.fromEntries(r.entries()),method:"GET",redirect:"manual",signal:null}).then(gA)}function rr(e){return typeof e=="string"&&e.length!==0}async function Lye(e,t){if(!(e instanceof URL))throw new TypeError('"expectedIssuer" must be an instance of URL');if(!Gg(t,Response))throw new TypeError('"response" must be an instance of Response');if(t.status!==200)throw new Ge('"response" is not a conform Authorization Server Metadata response');Qm(t);let n;try{n=await t.json()}catch(r){throw new Ge('failed to parse "response" body as JSON',{cause:r})}if(!Ff(n))throw new Ge('"response" body must be a top level object');if(!rr(n.issuer))throw new Ge('"response" body "issuer" property must be a non-empty string');if(new URL(n.issuer).href!==e.href)throw new Ge('"response" body "issuer" does not match "expectedIssuer"');return n}function _z(){return xa(crypto.getRandomValues(new Uint8Array(32)))}function XM(){return _z()}async function Fye(e){if(!rr(e))throw new TypeError('"codeVerifier" must be a non-empty string');return xa(await crypto.subtle.digest("SHA-256",Xl(e)))}function QM(e){return encodeURIComponent(e).replace(/%20/g,"+")}function zye(e,t){const n=QM(e),r=QM(t);return`Basic ${btoa(`${n}:${r}`)}`}function Bye(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Zi("unsupported RsaHashedKeyAlgorithm hash name")}}function Vye(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Zi("unsupported RsaHashedKeyAlgorithm hash name")}}function Uye(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Zi("unsupported EcKeyAlgorithm namedCurve")}}function Hye(e){switch(e.algorithm.name){case"RSA-PSS":return Bye(e);case"RSASSA-PKCS1-v1_5":return Vye(e);case"ECDSA":return Uye(e);case"Ed25519":case"Ed448":return"EdDSA";default:throw new Zi("unsupported CryptoKey algorithm name")}}function Jg(e){const t=e?.[$v];return typeof t=="number"&&Number.isFinite(t)?t:0}function yA(e){const t=e?.[_ye];return typeof t=="number"&&Number.isFinite(t)&&Math.sign(t)!==-1?t:30}function bA(){return Math.floor(Date.now()/1e3)}function Yg(e){if(typeof e!="object"||e===null)throw new TypeError('"as" must be an object');if(!rr(e.issuer))throw new TypeError('"as.issuer" property must be a non-empty string');return!0}function Kg(e){if(typeof e!="object"||e===null)throw new TypeError('"client" must be an object');if(!rr(e.client_id))throw new TypeError('"client.client_id" property must be a non-empty string');return!0}function ZM(e){if(!rr(e))throw new TypeError('"client.client_secret" property must be a non-empty string');return e}function e6(e,t){if(t!==void 0)throw new TypeError(`"client.client_secret" property must not be provided when ${e} client authentication method is used.`)}async function qye(e,t,n,r,o){switch(n.delete("client_secret"),n.delete("client_assertion_type"),n.delete("client_assertion"),t.token_endpoint_auth_method){case void 0:case"client_secret_basic":{r.set("authorization",zye(t.client_id,ZM(t.client_secret)));break}case"client_secret_post":{n.set("client_id",t.client_id),n.set("client_secret",ZM(t.client_secret));break}case"private_key_jwt":throw e6("private_key_jwt",t.client_secret),new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');case"tls_client_auth":case"self_signed_tls_client_auth":case"none":{e6(t.token_endpoint_auth_method,t.client_secret),t.token_endpoint_auth_method,n.set("client_id",t.client_id);break}default:throw new Zi("unsupported client token_endpoint_auth_method")}}async function Wye(e,t,n){if(!n.usages.includes("sign"))throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');const r=`${xa(Xl(JSON.stringify(e)))}.${xa(Xl(JSON.stringify(t)))}`,o=xa(await crypto.subtle.sign(Mz(n),n,Xl(r)));return`${r}.${o}`}async function Gye(e,t,n,r,o,i){const{privateKey:s,publicKey:a,nonce:c=Ez.get(n.origin)}=t;if(!Mye(s))throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');if(!Pye(a))throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');if(c!==void 0&&!rr(c))throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');if(!a.extractable)throw new TypeError('"DPoP.publicKey.extractable" must be true');const u=bA()+o,f={alg:Hye(s),typ:"dpop+jwt",jwk:await Yye(a)},p={iat:u,jti:_z(),htm:r,nonce:c,htu:`${n.origin}${n.pathname}`,ath:i?xa(await crypto.subtle.digest("SHA-256",Xl(i))):void 0};t[Cye]?.(f,p),e.set("dpop",await Wye(f,p,s))}let zb;async function Jye(e){const{kty:t,e:n,n:r,x:o,y:i,crv:s}=await crypto.subtle.exportKey("jwk",e),a={kty:t,e:n,n:r,x:o,y:i,crv:s};return zb.set(e,a),a}async function Yye(e){return zb||(zb=new WeakMap),zb.get(e)||Jye(e)}function t6(e,t,n){if(typeof e!="string")throw n?new TypeError(`"as.mtls_endpoint_aliases.${t}" must be a string`):new TypeError(`"as.${t}" must be a string`);return new URL(e)}function Cz(e,t,n=!1){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?t6(e.mtls_endpoint_aliases[t],t,n):t6(e[t],t,n)}function Oz(e,t){return!!(e.use_mtls_endpoint_aliases||t?.[Oye])}function uf(e){const t=e;return typeof t!="object"||Array.isArray(t)||t===null?!1:t.error!==void 0}function Kye(e){return e.length>=2&&e[0]==='"'&&e[e.length-1]==='"'?e.slice(1,-1):e}const Xye=/((?:,|, )?[0-9a-zA-Z!#$%&'*+-.^_`|~]+=)/,Qye=/(?:^|, ?)([0-9a-zA-Z!#$%&'*+\-.^_`|~]+)(?=$|[ ,])/g;function Zye(e,t){const n=t.split(Xye).slice(1);if(!n.length)return{scheme:e.toLowerCase(),parameters:{}};n[n.length-1]=n[n.length-1].replace(/,$/,"");const r={};for(let o=1;o<n.length;o+=2){const i=o;if(n[i][0]==='"')for(;n[i].slice(-1)!=='"'&&++o<n.length;)n[i]+=n[o];const s=n[i-1].replace(/^(?:, ?)|=$/g,"").toLowerCase();r[s]=Kye(n[i])}return{scheme:e.toLowerCase(),parameters:r}}function n6(e){if(!Gg(e,Response))throw new TypeError('"response" must be an instance of Response');const t=e.headers.get("www-authenticate");if(t===null)return;const n=[];for(const{1:o,index:i}of t.matchAll(Qye))n.push([o,i]);return n.length?n.map(([o,i],s,a)=>{const c=a[s+1];let u;return c?u=t.slice(i,c[1]):u=t.slice(i),Zye(o,u)}):void 0}async function e0e(e,t,n,r,o,i){if(!rr(e))throw new TypeError('"accessToken" must be a non-empty string');if(!(n instanceof URL))throw new TypeError('"url" must be an instance of URL');return r=jw(r),i?.DPoP===void 0?r.set("authorization",`Bearer ${e}`):(await Gye(r,i.DPoP,n,t.toUpperCase(),Jg({[$v]:i?.[$v]}),e),r.set("authorization",`DPoP ${e}`)),(i?.[mA]||fetch)(n.href,{body:o,headers:Object.fromEntries(r.entries()),method:t,redirect:"manual",signal:i?.signal?Dye(i.signal):null}).then(gA)}async function r6(e,t,n,r){Yg(e),Kg(t);const o=Cz(e,"userinfo_endpoint",Oz(t,r)),i=jw(r?.headers);return t.userinfo_signed_response_alg?i.set("accept","application/jwt"):(i.set("accept","application/json"),i.append("accept","application/jwt")),e0e(n,"GET",o,i,null,{...r,[$v]:Jg(t)})}const t0e=Symbol();function n0e(e){return e.headers.get("content-type")?.split(";")[0]}async function r0e(e,t,n,r){if(Yg(e),Kg(t),!Gg(r,Response))throw new TypeError('"response" must be an instance of Response');if(r.status!==200)throw new Ge('"response" is not a conform UserInfo Endpoint response');let o;if(n0e(r)==="application/jwt"){Qm(r);const{claims:i,jwt:s}=await Pz(await r.text(),Dz.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported),vA,Jg(t),yA(t),t[Sz]).then(a0e.bind(void 0,t.client_id)).then(l0e.bind(void 0,e.issuer));s0e.set(r,s),o=i}else{if(t.userinfo_signed_response_alg)throw new Ge("JWT UserInfo Response expected");Qm(r);try{o=await r.json()}catch(i){throw new Ge('failed to parse "response" body as JSON',{cause:i})}}if(!Ff(o))throw new Ge('"response" body must be a top level object');if(!rr(o.sub))throw new Ge('"response" body "sub" property must be a non-empty string');switch(n){case t0e:break;default:if(!rr(n))throw new Ge('"expectedSubject" must be a non-empty string');if(o.sub!==n)throw new Ge('unexpected "response" body "sub" value')}return o}async function o0e(e,t,n,r,o,i,s){return await qye(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),(s?.[mA]||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:n,redirect:"manual",signal:null}).then(gA)}async function i0e(e,t,n,r,o){const i=Cz(e,"token_endpoint",Oz(t,o));r.set("grant_type",n);const s=jw(o?.headers);return s.set("accept","application/json"),o0e(e,t,"POST",i,r,s,o)}const jz=new WeakMap,s0e=new WeakMap;function Az(e){if(!e.id_token)return;const t=jz.get(e);if(!t)throw new TypeError('"ref" was already garbage collected or did not resolve from the proper sources');return t[0]}async function Tz(e,t,n,r=!1,o=!1){if(Yg(e),Kg(t),!Gg(n,Response))throw new TypeError('"response" must be an instance of Response');if(n.status!==200){let s;if(s=await m0e(n))return s;throw new Ge('"response" is not a conform Token Endpoint response')}Qm(n);let i;try{i=await n.json()}catch(s){throw new Ge('failed to parse "response" body as JSON',{cause:s})}if(!Ff(i))throw new Ge('"response" body must be a top level object');if(!rr(i.access_token))throw new Ge('"response" body "access_token" property must be a non-empty string');if(!rr(i.token_type))throw new Ge('"response" body "token_type" property must be a non-empty string');if(i.token_type=i.token_type.toLowerCase(),i.token_type!=="dpop"&&i.token_type!=="bearer")throw new Zi("unsupported `token_type` value");if(i.expires_in!==void 0&&(typeof i.expires_in!="number"||i.expires_in<=0))throw new Ge('"response" body "expires_in" property must be a positive number');if(!o&&i.refresh_token!==void 0&&!rr(i.refresh_token))throw new Ge('"response" body "refresh_token" property must be a non-empty string');if(i.scope!==void 0&&typeof i.scope!="string")throw new Ge('"response" body "scope" property must be a string');if(!r){if(i.id_token!==void 0&&!rr(i.id_token))throw new Ge('"response" body "id_token" property must be a non-empty string');if(i.id_token){const{claims:s,jwt:a}=await Pz(i.id_token,Dz.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported),vA,Jg(t),yA(t),t[Sz]).then(d0e.bind(void 0,["aud","exp","iat","iss","sub"])).then(Rz.bind(void 0,e.issuer)).then($z.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&s.aud.length!==1){if(s.azp===void 0)throw new Ge('ID Token "aud" (audience) claim includes additional untrusted audiences');if(s.azp!==t.client_id)throw new Ge('unexpected ID Token "azp" (authorized party) claim value')}if(s.auth_time!==void 0&&(!Number.isFinite(s.auth_time)||Math.sign(s.auth_time)!==1))throw new Ge('ID Token "auth_time" (authentication time) must be a positive number');jz.set(i,[s,a])}}return i}function a0e(e,t){return t.claims.aud!==void 0?$z(e,t):t}function $z(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw new Ge('unexpected JWT "aud" (audience) claim value')}else if(t.claims.aud!==e)throw new Ge('unexpected JWT "aud" (audience) claim value');return t}function l0e(e,t){return t.claims.iss!==void 0?Rz(e,t):t}function Rz(e,t){if(t.claims.iss!==e)throw new Ge('unexpected JWT "iss" (issuer) claim value');return t}const kz=new WeakSet;function c0e(e){return kz.add(e),e}async function o6(e,t,n,r,o,i){if(Yg(e),Kg(t),!kz.has(n))throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');if(!rr(r))throw new TypeError('"redirectUri" must be a non-empty string');if(!rr(o))throw new TypeError('"codeVerifier" must be a non-empty string');const s=la(n,"code");if(!s)throw new Ge('no authorization code in "callbackParameters"');const a=new URLSearchParams(i?.additionalParameters);return a.set("redirect_uri",r),a.set("code_verifier",o),a.set("code",s),i0e(e,t,"authorization_code",a,i)}const u0e={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation"};function d0e(e,t){for(const n of e)if(t.claims[n]===void 0)throw new Ge(`JWT "${n}" (${u0e[n]}) claim missing`);return t}const f0e=Symbol(),T2=Symbol();async function h0e(e,t,n,r,o){const i=await Tz(e,t,n);if(uf(i))return i;if(!rr(i.id_token))throw new Ge('"response" body "id_token" property must be a non-empty string');o??(o=t.default_max_age??T2);const s=Az(i);if((t.require_auth_time||o!==T2)&&s.auth_time===void 0)throw new Ge('ID Token "auth_time" (authentication time) claim missing');if(o!==T2){if(typeof o!="number"||o<0)throw new TypeError('"maxAge" must be a non-negative number');const a=bA()+Jg(t),c=yA(t);if(s.auth_time+o<a-c)throw new Ge("too much time has elapsed since the last End-User authentication")}switch(r){case void 0:case f0e:if(s.nonce!==void 0)throw new Ge('unexpected ID Token "nonce" claim value');break;default:if(!rr(r))throw new TypeError('"expectedNonce" must be a non-empty string');if(s.nonce===void 0)throw new Ge('ID Token "nonce" claim missing');if(s.nonce!==r)throw new Ge('unexpected ID Token "nonce" claim value')}return i}async function p0e(e,t,n){const r=await Tz(e,t,n,!0);if(uf(r))return r;if(r.id_token!==void 0){if(typeof r.id_token=="string"&&r.id_token.length)throw new Ge("Unexpected ID Token returned, use processAuthorizationCodeOpenIDResponse() for OpenID Connect callback processing");delete r.id_token}return r}function Qm(e){if(e.bodyUsed)throw new TypeError('"response" body has been used already')}async function m0e(e){if(e.status>399&&e.status<500){Qm(e);try{const t=await e.json();if(Ff(t)&&typeof t.error=="string"&&t.error.length)return t.error_description!==void 0&&typeof t.error_description!="string"&&delete t.error_description,t.error_uri!==void 0&&typeof t.error_uri!="string"&&delete t.error_uri,t.algs!==void 0&&typeof t.algs!="string"&&delete t.algs,t.scope!==void 0&&typeof t.scope!="string"&&delete t.scope,t}catch{}}}function i6(e){if(typeof e.modulusLength!="number"||e.modulusLength<2048)throw new Ge(`${e.name} modulusLength must be at least 2048 bits`)}function g0e(e){switch(e){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Zi}}function Mz(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:g0e(e.algorithm.namedCurve)};case"RSA-PSS":switch(i6(e.algorithm),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Zi}case"RSASSA-PKCS1-v1_5":return i6(e.algorithm),e.algorithm.name;case"Ed448":case"Ed25519":return e.algorithm.name}throw new Zi}const vA=Symbol();async function y0e(e,t,n,r){const o=`${e}.${t}`;if(!await crypto.subtle.verify(Mz(n),n,r,Xl(o)))throw new Ge("JWT signature verification failed")}async function Pz(e,t,n,r,o,i){let{0:s,1:a,2:c,length:u}=e.split(".");if(u===5)if(i!==void 0)e=await i(e),{0:s,1:a,2:c,length:u}=e.split(".");else throw new Zi("JWE structure JWTs are not supported");if(u!==3)throw new Ge("Invalid JWT");let f;try{f=JSON.parse(Xl(xa(s)))}catch(x){throw new Ge("failed to parse JWT Header body as base64url encoded JSON",{cause:x})}if(!Ff(f))throw new Ge("JWT Header must be a top level object");if(t(f),f.crit!==void 0)throw new Ge('unexpected JWT "crit" header parameter');const p=xa(c);let g;n!==vA&&(g=await n(f),await y0e(s,a,g,p));let y;try{y=JSON.parse(Xl(xa(a)))}catch(x){throw new Ge("failed to parse JWT Payload body as base64url encoded JSON",{cause:x})}if(!Ff(y))throw new Ge("JWT Payload must be a top level object");const v=bA()+r;if(y.exp!==void 0){if(typeof y.exp!="number")throw new Ge('unexpected JWT "exp" (expiration time) claim type');if(y.exp<=v-o)throw new Ge('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()')}if(y.iat!==void 0&&typeof y.iat!="number")throw new Ge('unexpected JWT "iat" (issued at) claim type');if(y.iss!==void 0&&typeof y.iss!="string")throw new Ge('unexpected JWT "iss" (issuer) claim type');if(y.nbf!==void 0){if(typeof y.nbf!="number")throw new Ge('unexpected JWT "nbf" (not before) claim type');if(y.nbf>v+o)throw new Ge('unexpected JWT "nbf" (not before) claim value, timestamp is > now()')}if(y.aud!==void 0&&typeof y.aud!="string"&&!Array.isArray(y.aud))throw new Ge('unexpected JWT "aud" (audience) claim type');return{header:f,claims:y,signature:p,key:g,jwt:e}}function Dz(e,t,n){if(e!==void 0){if(n.alg!==e)throw new Ge('unexpected JWT "alg" header parameter');return}if(Array.isArray(t)){if(!t.includes(n.alg))throw new Ge('unexpected JWT "alg" header parameter');return}if(n.alg!=="RS256")throw new Ge('unexpected JWT "alg" header parameter')}function la(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw new Ge(`"${t}" parameter must be provided only once`);return n}const b0e=Symbol(),q_=Symbol();function s6(e,t,n,r){if(Yg(e),Kg(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');if(la(n,"response"))throw new Ge('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');const o=la(n,"iss"),i=la(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw new Ge('response parameter "iss" (issuer) missing');if(o&&o!==e.issuer)throw new Ge('unexpected "iss" (issuer) response parameter value');switch(r){case void 0:case q_:if(i!==void 0)throw new Ge('unexpected "state" response parameter encountered');break;case b0e:break;default:if(!rr(r))throw new Ge('"expectedState" must be a non-empty string');if(i===void 0)throw new Ge('response parameter "state" missing');if(i!==r)throw new Ge('unexpected "state" response parameter value')}const s=la(n,"error");if(s)return{error:s,error_description:la(n,"error_description"),error_uri:la(n,"error_uri")};const a=la(n,"id_token"),c=la(n,"token");if(a!==void 0||c!==void 0)throw new Zi("implicit and hybrid flows are not supported");return c0e(new URLSearchParams(n))}const v0e={type:"oidc",client:{token_endpoint_auth_method:"client_secret_basic"},as:{issuer:"https://accounts.google.com"},profile:async e=>({...e,sub:e.sub,email:e.email})},x0e={type:"oauth2",client:{token_endpoint_auth_method:"client_secret_basic"},as:{code_challenge_methods_supported:["S256"],issuer:"https://github.com",scopes_supported:["read:user","user:email"],scope_separator:" ",authorization_endpoint:"https://github.com/login/oauth/authorize",token_endpoint:"https://github.com/login/oauth/access_token",userinfo_endpoint:"https://api.github.com/user"},profile:async(e,t,n)=>{try{const i=(await(await fetch("https://api.github.com/user/emails",{headers:{"User-Agent":"bknd",Accept:"application/json",Authorization:`Bearer ${n.access_token}`}})).json()).find(s=>s.primary)?.email;if(!i)throw new Error("No primary email found");return{...e,sub:String(e.id),email:i}}catch{throw new Error("Couldn't retrive github email")}}},Iz=Object.freeze(Object.defineProperty({__proto__:null,github:x0e,google:v0e},Symbol.toStringTag,{value:"Module"}));class Lz{constructor(t,n,r,o){this.config=t,this.type=n,this.name=r,this.mode=o,this.config=Cn(this.getSchema(),t??{})}actions={};registerAction(t,n,r){this.actions[t]={schema:n,preprocess:r}}getType(){return this.type}getMode(){return this.mode}getName(){return this.name}toJSON(t){return{type:this.getType(),config:t?this.config:void 0}}getActions(){return this.actions}}const w0e=ke({name:le({enum:Object.keys(Iz)}),type:le({enum:["oidc","oauth2"],default:"oauth2"}),client:ke({client_id:le(),client_secret:le()}).strict()},{title:"OAuth"});class Fp extends Br{constructor(t,n){super("OAuthCallbackException on "+n),this.error=t,this.step=n}name="OAuthCallbackException"}class W_ extends Lz{constructor(t){super(t,"oauth",t.name,"external")}getSchema(){return w0e}getIssuerConfig(){return Iz[this.config.name]}async getConfig(){const t=this.getIssuerConfig();if(t.type==="oidc"){const n=new URL(t.as.issuer),r=await Iye(n);t.as=await Lye(n,r)}return{...t,type:t.type,client:{...t.client,...this.config.client}}}async getCodeChallenge(t,n,r="S256"){const o=t.code_challenge_methods_supported?.includes(r);let i,s;return o&&(i=await Fye(n),s=r),{challenge_supported:o,challenge:i,challenge_method:s}}async request(t){const{client:n,as:r}=await this.getConfig(),{challenge_supported:o,challenge:i,challenge_method:s}=await this.getCodeChallenge(r,t.state);if(!r.authorization_endpoint)throw new Error("authorization_endpoint is not provided");const a=t.scopes??r.scopes_supported;if(!Array.isArray(a)||a.length===0)throw new Error("No scopes provided");if(a.every(f=>!r.scopes_supported?.includes(f)))throw new Error("Invalid scopes provided");const c=r.authorization_endpoint,u={client_id:n.client_id,redirect_uri:t.redirect_uri,response_type:"code",scope:a.join(r.scope_separator??" ")};return o?(u.code_challenge=i,u.code_challenge_method=s):u.nonce=t.state,{url:new URL(c)+"?"+new URLSearchParams(u).toString(),endpoint:c,params:u}}async oidc(t,n){const r=await this.getConfig(),{client:o,as:i,type:s}=r,a=s6(i,o,t,q_);if(uf(a))throw new Fp(a,"validateAuthResponse");const c=await o6(i,o,a,n.redirect_uri,n.state),u=n6(c);if(u)throw new Fp(u,"www-authenticate");const{challenge_supported:f,challenge:p}=await this.getCodeChallenge(i,n.state),y=await h0e(i,o,c,f?void 0:p);if(uf(y))throw new Fp(y,"processAuthorizationCodeOpenIDResponse");const v=Az(y),x=await r6(i,o,y.access_token),S=await r0e(i,o,v.sub,x);return await r.profile(S,r,v)}async oauth2(t,n){const r=await this.getConfig(),{client:o,type:i,as:s,profile:a}=r,c=s6(s,o,t,q_);if(uf(c))throw new Fp(c,"validateAuthResponse");const u=await o6(s,o,c,n.redirect_uri,n.state),f=n6(u);if(f)throw new Fp(f,"www-authenticate");const p=u.clone();let g={};try{if(g=await p0e(s,o,u),uf(g))throw new Error}catch{g=await p.json()}const v=await(await r6(s,o,g.access_token)).json();return await r.profile(v,r,g)}async callback(t,n){switch(this.getIssuerConfig().type){case"oidc":return await this.oidc(t,n);case"oauth2":return await this.oauth2(t,n);default:throw new Error("Unsupported type")}}getController(t){const n=new Cw,r="secret",o="_challenge",i=async(a,c)=>{await p7(a,o,JSON.stringify(c),r,{secure:!0,httpOnly:!0,sameSite:"Lax",maxAge:60*5})},s=async a=>{if(a.req.header("X-State-Challenge"))return{state:a.req.header("X-State-Challenge"),action:a.req.header("X-State-Action"),mode:"token"};const c=await f7(a,r,o);try{return JSON.parse(c)}catch{throw new Error("Invalid state")}};return n.get("/callback",async a=>{const c=new URL(a.req.url),u=new URLSearchParams(c.search),f=await s(a),p=f.mode==="cookie"?c.origin+c.pathname:c.origin+c.pathname.replace("/callback","/token"),g=await this.callback(u,{redirect_uri:p,state:f.state}),y={email:g.email,strategy_value:g.sub},v=async S=>{if(S.strategy_value!==g.sub)throw new Br("Invalid credentials")},x={redirect:f.redirect,forceJsonResponse:f.mode!=="cookie"};switch(f.action){case"login":return t.resolveLogin(a,this,y,v,x);case"register":return t.resolveRegister(a,this,y,v,x);default:throw new Error("Invalid action")}}),n.get("/token",async a=>{const c=new URL(a.req.url),u=new URLSearchParams(c.search);return a.json({code:u.get("code")??null})}),n.post("/:action",async a=>{const c=a.req.param("action");if(!["login","register"].includes(c))return a.notFound();const u=new URL(a.req.url),f=u.pathname.replace(`/${c}`,""),p=u.origin+f+"/callback",g=new URL(a.req.header("Referer")??"/"),y=XM(),v=await this.request({redirect_uri:p,state:y});return await i(a,{state:y,action:c,redirect:g.toString(),mode:"cookie"}),a.redirect(v.url)}),n.get("/:action",async a=>{const c=a.req.param("action");if(!["login","register"].includes(c))return a.notFound();const u=new URL(a.req.url),f=u.pathname.replace(`/${c}`,""),p=u.origin+f+"/token",g=XM(),y=await this.request({redirect_uri:p,state:g});return ir()?a.json({url:y.url,redirect_uri:p,challenge:g,action:c,params:y.params}):a.json({url:y.url,challenge:g,action:c})}),n}toJSON(t){const n=t?this.config:RL(this.config,["secret","client_id"]);return{...super.toJSON(t),config:{...n,type:this.getIssuerConfig().type}}}}const $2=le({pattern:"^(https?|wss?)://[^\\s/$.?#].[^\\s]*$"}),S0e=Ve({type:le({enum:["oidc","oauth2"],default:"oidc"}),name:le(),client:ke({client_id:le(),client_secret:le(),token_endpoint_auth_method:le({enum:["client_secret_basic"]})}),as:Ve({issuer:le(),code_challenge_methods_supported:le({enum:["S256"]}).optional(),scopes_supported:un(le()).optional(),scope_separator:le({default:" "}).optional(),authorization_endpoint:$2.optional(),token_endpoint:$2.optional(),userinfo_endpoint:$2.optional()})},{title:"Custom OAuth"});class a6 extends W_{constructor(t){super(t),this.type="custom_oauth"}getIssuerConfig(){return{...this.config,profile:async t=>t}}getSchema(){return S0e}}const E0e={};function N0e(e){try{return crypto.getRandomValues(new Uint8Array(e))}catch{}try{return E0e.randomBytes(e)}catch{}throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative")}function _0e(e,t){if(e=e||Bz,typeof e!="number")throw Error("Illegal arguments: "+typeof e+", "+typeof t);e<4?e=4:e>31&&(e=31);var n=[];return n.push("$2b$"),e<10&&n.push("0"),n.push(e.toString()),n.push("$"),n.push(G_(N0e(Zm),Zm)),n.join("")}function Fz(e,t,n){if(typeof t=="function"&&(n=t,t=void 0),typeof e=="function"&&(n=e,e=void 0),typeof e>"u")e=Bz;else if(typeof e!="number")throw Error("illegal arguments: "+typeof e);function r(o){Ui(function(){try{o(null,_0e(e))}catch(i){o(i)}})}if(n){if(typeof n!="function")throw Error("Illegal callback: "+typeof n);r(n)}else return new Promise(function(o,i){r(function(s,a){if(s){i(s);return}o(a)})})}function zz(e,t,n,r){function o(i){typeof e=="string"&&typeof t=="number"?Fz(t,function(s,a){f6(e,a,i,r)}):typeof e=="string"&&typeof t=="string"?f6(e,t,i,r):Ui(i.bind(this,Error("Illegal arguments: "+typeof e+", "+typeof t)))}if(n){if(typeof n!="function")throw Error("Illegal callback: "+typeof n);o(n)}else return new Promise(function(i,s){o(function(a,c){if(a){s(a);return}i(c)})})}function C0e(e,t){for(var n=e.length^t.length,r=0;r<e.length;++r)n|=e.charCodeAt(r)^t.charCodeAt(r);return n===0}function O0e(e,t,n,r){function o(i){if(typeof e!="string"||typeof t!="string"){Ui(i.bind(this,Error("Illegal arguments: "+typeof e+", "+typeof t)));return}if(t.length!==60){Ui(i.bind(this,null,!1));return}zz(e,t.substring(0,29),function(s,a){s?i(s):i(null,C0e(a,t))},r)}if(n){if(typeof n!="function")throw Error("Illegal callback: "+typeof n);o(n)}else return new Promise(function(i,s){o(function(a,c){if(a){s(a);return}i(c)})})}var Ui=typeof setImmediate=="function"?setImmediate:typeof scheduler=="object"&&typeof scheduler.postTask=="function"?scheduler.postTask.bind(scheduler):setTimeout;function j0e(e){for(var t=0,n=0,r=0;r<e.length;++r)n=e.charCodeAt(r),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320?(++r,t+=4):t+=3;return t}function A0e(e){for(var t=0,n,r,o=new Array(j0e(e)),i=0,s=e.length;i<s;++i)n=e.charCodeAt(i),n<128?o[t++]=n:n<2048?(o[t++]=n>>6|192,o[t++]=n&63|128):(n&64512)===55296&&((r=e.charCodeAt(i+1))&64512)===56320?(n=65536+((n&1023)<<10)+(r&1023),++i,o[t++]=n>>18|240,o[t++]=n>>12&63|128,o[t++]=n>>6&63|128,o[t++]=n&63|128):(o[t++]=n>>12|224,o[t++]=n>>6&63|128,o[t++]=n&63|128);return o}var Wd="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),Tl=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1];function G_(e,t){var n=0,r=[],o,i;if(t<=0||t>e.length)throw Error("Illegal len: "+t);for(;n<t;){if(o=e[n++]&255,r.push(Wd[o>>2&63]),o=(o&3)<<4,n>=t){r.push(Wd[o&63]);break}if(i=e[n++]&255,o|=i>>4&15,r.push(Wd[o&63]),o=(i&15)<<2,n>=t){r.push(Wd[o&63]);break}i=e[n++]&255,o|=i>>6&3,r.push(Wd[o&63]),r.push(Wd[i&63])}return r.join("")}function T0e(e,t){for(var n=0,r=e.length,o=0,i=[],s,a,c,u,f,p;n<r-1&&o<t&&(p=e.charCodeAt(n++),s=p<Tl.length?Tl[p]:-1,p=e.charCodeAt(n++),a=p<Tl.length?Tl[p]:-1,!(s==-1||a==-1||(f=s<<2>>>0,f|=(a&48)>>4,i.push(String.fromCharCode(f)),++o>=t||n>=r)||(p=e.charCodeAt(n++),c=p<Tl.length?Tl[p]:-1,c==-1)||(f=(a&15)<<4>>>0,f|=(c&60)>>2,i.push(String.fromCharCode(f)),++o>=t||n>=r)));)p=e.charCodeAt(n++),u=p<Tl.length?Tl[p]:-1,f=(c&3)<<6>>>0,f|=u,i.push(String.fromCharCode(f)),++o;var g=[];for(n=0;n<o;n++)g.push(i[n].charCodeAt(0));return g}var Zm=16,Bz=10,$0e=16,R0e=100,l6=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c6=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],Vz=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function eg(e,t,n,r){var o,i=e[t],s=e[t+1];return i^=n[0],o=r[i>>>24],o+=r[256|i>>16&255],o^=r[512|i>>8&255],o+=r[768|i&255],s^=o^n[1],o=r[s>>>24],o+=r[256|s>>16&255],o^=r[512|s>>8&255],o+=r[768|s&255],i^=o^n[2],o=r[i>>>24],o+=r[256|i>>16&255],o^=r[512|i>>8&255],o+=r[768|i&255],s^=o^n[3],o=r[s>>>24],o+=r[256|s>>16&255],o^=r[512|s>>8&255],o+=r[768|s&255],i^=o^n[4],o=r[i>>>24],o+=r[256|i>>16&255],o^=r[512|i>>8&255],o+=r[768|i&255],s^=o^n[5],o=r[s>>>24],o+=r[256|s>>16&255],o^=r[512|s>>8&255],o+=r[768|s&255],i^=o^n[6],o=r[i>>>24],o+=r[256|i>>16&255],o^=r[512|i>>8&255],o+=r[768|i&255],s^=o^n[7],o=r[s>>>24],o+=r[256|s>>16&255],o^=r[512|s>>8&255],o+=r[768|s&255],i^=o^n[8],o=r[i>>>24],o+=r[256|i>>16&255],o^=r[512|i>>8&255],o+=r[768|i&255],s^=o^n[9],o=r[s>>>24],o+=r[256|s>>16&255],o^=r[512|s>>8&255],o+=r[768|s&255],i^=o^n[10],o=r[i>>>24],o+=r[256|i>>16&255],o^=r[512|i>>8&255],o+=r[768|i&255],s^=o^n[11],o=r[s>>>24],o+=r[256|s>>16&255],o^=r[512|s>>8&255],o+=r[768|s&255],i^=o^n[12],o=r[i>>>24],o+=r[256|i>>16&255],o^=r[512|i>>8&255],o+=r[768|i&255],s^=o^n[13],o=r[s>>>24],o+=r[256|s>>16&255],o^=r[512|s>>8&255],o+=r[768|s&255],i^=o^n[14],o=r[i>>>24],o+=r[256|i>>16&255],o^=r[512|i>>8&255],o+=r[768|i&255],s^=o^n[15],o=r[s>>>24],o+=r[256|s>>16&255],o^=r[512|s>>8&255],o+=r[768|s&255],i^=o^n[16],e[t]=s^n[$0e+1],e[t+1]=i,e}function tf(e,t){for(var n=0,r=0;n<4;++n)r=r<<8|e[t]&255,t=(t+1)%e.length;return{key:r,offp:t}}function u6(e,t,n){for(var r=0,o=[0,0],i=t.length,s=n.length,a,c=0;c<i;c++)a=tf(e,r),r=a.offp,t[c]=t[c]^a.key;for(c=0;c<i;c+=2)o=eg(o,0,t,n),t[c]=o[0],t[c+1]=o[1];for(c=0;c<s;c+=2)o=eg(o,0,t,n),n[c]=o[0],n[c+1]=o[1]}function k0e(e,t,n,r){for(var o=0,i=[0,0],s=n.length,a=r.length,c,u=0;u<s;u++)c=tf(t,o),o=c.offp,n[u]=n[u]^c.key;for(o=0,u=0;u<s;u+=2)c=tf(e,o),o=c.offp,i[0]^=c.key,c=tf(e,o),o=c.offp,i[1]^=c.key,i=eg(i,0,n,r),n[u]=i[0],n[u+1]=i[1];for(u=0;u<a;u+=2)c=tf(e,o),o=c.offp,i[0]^=c.key,c=tf(e,o),o=c.offp,i[1]^=c.key,i=eg(i,0,n,r),r[u]=i[0],r[u+1]=i[1]}function d6(e,t,n,r,o){var i=Vz.slice(),s=i.length,a;if(n<4||n>31)if(a=Error("Illegal number of rounds (4-31): "+n),r){Ui(r.bind(this,a));return}else throw a;if(t.length!==Zm)if(a=Error("Illegal salt length: "+t.length+" != "+Zm),r){Ui(r.bind(this,a));return}else throw a;n=1<<n>>>0;var c,u,f=0,p;typeof Int32Array=="function"?(c=new Int32Array(l6),u=new Int32Array(c6)):(c=l6.slice(),u=c6.slice()),k0e(t,e,c,u);function g(){if(o&&o(f/n),f<n)for(var v=Date.now();f<n&&(f=f+1,u6(e,c,u),u6(t,c,u),!(Date.now()-v>R0e)););else{for(f=0;f<64;f++)for(p=0;p<s>>1;p++)eg(i,p<<1,c,u);var x=[];for(f=0;f<s;f++)x.push((i[f]>>24&255)>>>0),x.push((i[f]>>16&255)>>>0),x.push((i[f]>>8&255)>>>0),x.push((i[f]&255)>>>0);if(r){r(null,x);return}else return x}r&&Ui(g)}if(typeof r<"u")g();else for(var y;;)if(typeof(y=g())<"u")return y||[]}function f6(e,t,n,r){var o;if(typeof e!="string"||typeof t!="string")if(o=Error("Invalid string / salt: Not a string"),n){Ui(n.bind(this,o));return}else throw o;var i,s;if(t.charAt(0)!=="$"||t.charAt(1)!=="2")if(o=Error("Invalid salt version: "+t.substring(0,2)),n){Ui(n.bind(this,o));return}else throw o;if(t.charAt(2)==="$")i="\0",s=3;else{if(i=t.charAt(2),i!=="a"&&i!=="b"&&i!=="y"||t.charAt(3)!=="$")if(o=Error("Invalid salt revision: "+t.substring(2,4)),n){Ui(n.bind(this,o));return}else throw o;s=4}if(t.charAt(s+2)>"$")if(o=Error("Missing salt rounds"),n){Ui(n.bind(this,o));return}else throw o;var a=parseInt(t.substring(s,s+1),10)*10,c=parseInt(t.substring(s+1,s+2),10),u=a+c,f=t.substring(s+3,s+25);e+=i>="a"?"\0":"";var p=A0e(e),g=T0e(f,Zm);function y(v){var x=[];return x.push("$2"),i>="a"&&x.push(i),x.push("$"),u<10&&x.push("0"),x.push(u.toString()),x.push("$"),x.push(G_(g,g.length)),x.push(G_(v,Vz.length*4-1)),x.join("")}if(typeof n>"u")return y(d6(p,g,u));d6(p,g,u,function(v,x){v?n(v,null):n(null,y(x))},r)}const M0e=ke({hashing:le({enum:["plain","sha256","bcrypt"],default:"sha256"}),rounds:bt({minimum:1,maximum:10}).optional(),minLength:bt({default:8,minimum:1}).optional()}).strict();class h6 extends Lz{constructor(t={}){super(t,"password","password","form"),this.registerAction("create",this.getPayloadSchema(),async({password:n,...r})=>({...r,strategy_value:await this.hash(n)}))}getSchema(){return M0e}getPayloadSchema(){return ke({email:le({format:"email"}),password:le({minLength:this.config.minLength})})}async hash(t){switch(this.config.hashing){case"sha256":return HL.sha256(t);case"bcrypt":{const n=await Fz(this.config.rounds??4);return zz(t,n)}default:return t}}async compare(t,n){switch(this.config.hashing){case"sha256":{const r=await this.hash(n);return t===r}case"bcrypt":return await O0e(n,t)}return t===n}verify(t){return async n=>{if(!n||!n.strategy_value)throw new Lp;if(!this.getPayloadSchema().properties.password.validate(t).valid)throw rt.debug("PasswordStrategy: Invalid password",t),new Lp;if(await this.compare(n.strategy_value,t)!==!0)throw new Lp}}getController(t){const n=new Cw,r=ke({redirect:le().optional()}),o=this.getPayloadSchema();return n.post("/login",zt({summary:"Login with email and password",tags:["auth"]}),Ft("query",r),async i=>{try{const s=Cn(o,await t.getBody(i),{onError:c=>{throw rt.error("Invalid login payload",[...c]),new Lp}}),{redirect:a}=i.req.valid("query");return await t.resolveLogin(i,this,s,this.verify(s.password),{redirect:a})}catch(s){return t.respondWithError(i,s)}}),n.post("/register",zt({summary:"Register a new user with email and password",tags:["auth"]}),Ft("query",r),async i=>{try{const{redirect:s}=i.req.valid("query"),{password:a,email:c,...u}=Cn(o,await t.getBody(i),{onError:p=>{rt.error("Invalid register payload",[...p]),new Lp}}),f={...u,email:c,strategy_value:await this.hash(a)};return await t.resolveRegister(i,this,f,async()=>{},{redirect:s})}catch(s){return t.respondWithError(i,s)}}),n}}const Uz=Ve({description:le(),condition:ke({}).optional(),effect:le({enum:["allow","deny","filter"],default:"allow"}),filter:ke({}).optional()}).partial();let P0e=class{content;constructor(t){this.content=Cn(Uz,t??{},{withDefaults:!0})}replace(t,n,r){return n?b_(t,/^@([a-zA-Z_\.]+)$/,n,r):t}getReplacedFilter(t,n){return this.content.filter?this.replace(this.content.filter,t,n):t}meetsCondition(t,n){return this.content.condition?Ik(this.replace(this.content.condition,n),t):!0}meetsFilter(t,n){return this.content.filter?Ik(this.replace(this.content.filter,n),t):!0}getFiltered(t){return t.filter(n=>this.meetsFilter(n))}toJSON(){return this.content}};const Hz="allow",D0e=Ve({permission:le(),effect:le({enum:["allow","deny"],default:Hz}).optional(),policies:un(Uz).optional()}),I0e=Ve({permissions:Rt([un(le()),un(D0e)]).optional(),is_default:at().optional(),implicit_allow:at().optional()});class p6{constructor(t,n=[],r=Hz){this.permission=t,this.policies=n,this.effect=r}toJSON(){return{permission:this.permission.name,policies:this.policies.map(t=>t.toJSON()),effect:this.effect}}}class xA{constructor(t,n=[],r=!1,o=!1){this.name=t,this.permissions=n,this.is_default=r,this.implicit_allow=o}static create(t,n){const r=n.permissions?.map(o=>{if(typeof o=="string")return new p6(new On(o),[]);const i=o.policies?.map(s=>new P0e(s));return new p6(new On(o.permission),i,o.effect)})??[];return new xA(t,r,n.is_default,n.implicit_allow)}toJSON(){return{permissions:this.permissions.map(t=>t.toJSON()),is_default:this.is_default,implicit_allow:this.implicit_allow}}}const L0e={password:{cls:h6,schema:h6.prototype.getSchema()},oauth:{cls:W_,schema:W_.prototype.getSchema()},custom_oauth:{cls:a6,schema:a6.prototype.getSchema()}},qz=L0e,F0e=Zx(qz,(e,t)=>Ve({enabled:at({default:!0}).optional(),type:ui(t),config:e.schema},{title:t})),z0e=Rt(Object.values(F0e)),B0e=ke({enabled:at({default:!1}).optional()}),V0e=I0e,m6=Ow("config_auth",{enabled:at({default:!1}),basepath:le({default:"/api/auth"}),entity_name:le({default:"users"}),allow_register:at({default:!0}).optional(),default_role_register:le().optional(),jwt:wz,cookie:xz,strategies:ym("config_auth_strategies",z0e,{title:"Strategies",default:{password:{type:"password",enabled:!0,config:{hashing:"sha256"}}}},Ve({type:le(),enabled:at({default:!0}).optional(),config:ke({})})),guard:B0e.optional(),roles:ym("config_auth_roles",V0e,{default:{}}).optional()},{title:"Authentication"});class U0e{constructor(t){this.appAuth=t}get em(){return this.appAuth.em}get users(){return this.appAuth.getUsersEntity()}async findBy(t,n,r){rt.debug("[AppUserPool:findBy]",{strategy:t,prop:n,value:r}),this.toggleStrategyValueVisibility(!0);const o=await this.em.repo(this.users).findOne({[n]:r,strategy:t});if(this.toggleStrategyValueVisibility(!1),!o.data)throw rt.debug("[AppUserPool]: User not found"),new Fge;return o.data}async create(t,n){if(rt.debug("[AppUserPool:create]",{strategy:t,payload:n}),!("strategy_value"in n))throw new aa("Profile must have a strategy_value value");const r=this.users.getSelect(void 0,"create"),i={...UF(n,r),strategy:t},s=this.em.mutator(this.users);s.__unstable_toggleSystemEntityCreation(!1),this.toggleStrategyValueVisibility(!0);const a=await s.insertOne(i);if(s.__unstable_toggleSystemEntityCreation(!0),this.toggleStrategyValueVisibility(!1),!a.data)throw new zge;return rt.debug("[AppUserPool]: User created",a.data),a.data}toggleStrategyValueVisibility(t){const n=(r,o)=>{const i=this.users.field(r);if(o)i.config.hidden=!1,i.config.fillable=!0;else{const s=Aw.usersFields.strategy_value.config;i.config.hidden=s.hidden,i.config.fillable=s.fillable}};n("strategy_value",t),n("strategy",t)}}const Wz={email:ys().required(),strategy:ys({fillable:["create"],hidden:["update","form"]}).required(),strategy_value:ys({fillable:["create"],hidden:["read","table","update","form"]}).required(),role:ys()};class Aw extends Ug{_authenticator;cache={};_controller;async onBeforeUpdate(t,n){const r=m6.properties.jwt.properties.secret.default;if(!t.enabled&&n.enabled&&n.jwt.secret===r&&(rt.warn("No JWT secret provided, generating a random one"),n.jwt.secret=gse(64)),n.strategies?.password?.enabled||(rt.warn("Password strategy cannot be disabled."),n.strategies.password.enabled=!0),n.default_role_register&&n.default_role_register?.length>0&&!Object.keys(n.roles??{}).includes(n.default_role_register)){const i=`Default role for registration not found: ${n.default_role_register}`;if(t.default_role_register!==n.default_role_register)throw new Error(i);rt.warn(`${i}, resetting to undefined`),n.default_role_register=void 0}return n}get enabled(){return this.config.enabled}async build(){if(!this.enabled){this.setBuilt();return}const t=Vt(this.config.roles??{},(r,o)=>xA.create(o,r));this.ctx.guard.setRoles(Object.values(t)),this.ctx.guard.setConfig(this.config.guard??{});const n=Vt(this.config.strategies??{},(r,o)=>{try{return new qz[r.type].cls(r.config)}catch{throw new Error(`Could not build strategy ${String(o)} with config ${JSON.stringify(r.config)}`)}});this._authenticator=new Nye(n,new U0e(this),{jwt:this.config.jwt,cookie:this.config.cookie,default_role_register:this.config.default_role_register}),this.registerEntities(),super.setBuilt(),this._controller=new Zge(this),this._controller.registerMcp(),this.ctx.server.route(this.config.basepath,this._controller.getController()),this.ctx.guard.registerPermissions(Uge)}isStrategyEnabled(t){const n=typeof t=="string"?t:t.getName();return n==="password"?!0:this.config.strategies?.[n]?.enabled??!1}get controller(){if(!this.isBuilt())throw new Error("Can't access controller, AppAuth not built yet");return this._controller}getSchema(){return m6}getGuardContextSchema(){const t=this.getUsersEntity().toSchema();return{type:"object",properties:{user:{type:"object",properties:Rm(t.properties,this.config.jwt.fields)}}}}get authenticator(){return this.throwIfNotBuilt(),this._authenticator}get em(){return this.ctx.em}getUsersEntity(t){const n=this.config.entity_name;return t||!this.em.hasEntity(n)?rz(n,Aw.usersFields,void 0,"system"):this.em.entity(n)}static usersFields=Wz;registerEntities(){const t=this.getUsersEntity(!0);this.ctx.helper.ensureSchema(oz({[t.name]:t},({index:n},{users:r})=>{n(r).on(["email"],!0).on(["strategy"]).on(["strategy_value"])}));try{const n=Object.keys(this.config.roles??{});this.ctx.helper.replaceEntityField(t,"role",HM({enum:n}))}catch{}try{const n=Object.keys(this.config.strategies??{});this.ctx.helper.replaceEntityField(t,"strategy",HM({enum:n}))}catch{}}async createUser({email:t,password:n,role:r,...o}){if(!this.enabled)throw new Error("Cannot create user, auth not enabled");if(r&&!Object.keys(this.config.roles??{}).includes(r))throw new Error(`Role "${r}" not found`);const i="password",a=await this.authenticator.strategy(i).hash(n),c=this.em.mutator(this.config.entity_name);c.__unstable_toggleSystemEntityCreation(!1);const{data:u}=await c.insertOne({...o,role:r||this.config.default_role_register||void 0,email:t,strategy:i,strategy_value:a});return c.__unstable_toggleSystemEntityCreation(!0),u}async changePassword(t,n){const r=this.config.entity_name,{data:o}=await this.em.repository(r).findId(t);if(o){if(o.strategy!=="password")throw new Error("User is not using password strategy")}else throw new Error("User not found");const i=a=>{const c=this.em.entity(r).field("strategy_value");c.config.hidden=!a,c.config.fillable=a},s=this.authenticator.strategy("password");return i(!0),await this.em.mutator(r).updateOne(o.id,{strategy_value:await s.hash(n)}),i(!1),!0}toJSON(t){if(!this.config.enabled)return this.configDefault;const n=this.authenticator.getStrategies(),r=Object.fromEntries(this.ctx.guard.getRoles().map(o=>[o.name,o.toJSON()]));return{...this.config,...this.authenticator.toJSON(t),roles:r,strategies:Vt(n,o=>({enabled:this.isStrategyEnabled(o),...o.toJSON(t)}))}}}const H0e=new On("system.access.api");new On("system.config.read",{},ke({module:le().optional()}));new On("system.config.read.secrets",{},ke({module:le().optional()}));new On("system.config.write",{},ke({module:le().optional()}));const eb=new On("system.schema.read",{},ke({module:le().optional()})),Gz={path:ys().required(),folder:jge({default_value:!1,hidden:!0,fillable:["create"]}),mime_type:ys(),size:Cge(),scope:ys({hidden:!0,fillable:["create"]}),etag:ys(),modified_at:Oge(),reference:ys(),entity_id:ys(),metadata:Age()},q0e={users:Wz,media:Gz};class W0e{constructor(t,n={}){this.em=t,this._options=n}get options(){return{...this._options,indentWidth:2,indentChar:" ",entityCommentMultiline:!0,fieldCommentMultiline:!0}}toTypes(){return this.em.entities.map(t=>t.toTypes())}getTab(t=1){return this.options.indentChar.repeat(this.options.indentWidth).repeat(t)}collectImports(t,n={}){for(const[,r]of Object.entries(t.fields))for(const o of r.import??[]){const i=o.name,s=o.package;n[s]||(n[s]=[]),n[s].includes(i)||n[s].push(i)}return n}typeName(t){return Ta(t).replace(/ /g,"")}fieldTypesToString(t,n){let r="";const o=this.options.fieldCommentMultiline,i=n?.indent??1;for(const[s,a]of Object.entries(t.fields)){if(n?.ignore_fields?.includes(s))continue;let c="";c+=this.commentString(a.comment,i,o),c+=`${this.getTab(i)}${s}${a.required?"":"?"}: `,c+=a.type+";",c+=`
`,r+=c}return r}relationToFieldType(t,n){const r=t.other(n),o=t.isListableFor(n);let s=this.typeName(r.entity.name);return r.entity.type==="system"&&(s=`DB["${r.entity.name}"]`),{fields:{[r.reference]:{required:!1,type:`${s}${o?"[]":""}`}}}}importsToString(t){const n=[];for(const[r,o]of Object.entries(t))n.push(`import type { ${o.join(", ")} } from "${r}";`);return n}commentString(t,n=0,r=!0){if(!t)return"";const o=this.getTab(n);return r?`${o}/**
${o} * ${t}
${o} */
`:`${o}// ${t}
`}entityToTypeString(t,n){const r=t.toTypes(),o=this.typeName(r.name),i=n?.indent??1,s=Math.max(0,i-1);let a=this.commentString(r.comment,s,this.options.entityCommentMultiline);a+=`${n?.export?"export ":""}interface ${o} {
`,a+=this.fieldTypesToString(r,n);const u=this.em.relations.relationsOf(t).map(f=>this.relationToFieldType(f,t));for(const f of u)a+=this.fieldTypesToString(f,{indent:i});return a+=`${this.getTab(s)}}`,a}toString(){const t=[],n={},r={bknd:["DB"],kysely:["Insertable","Selectable","Updateable","Generated"]};let o=`declare global {
`;o+=`${this.getTab(1)}type BkndEntity<T extends keyof DB> = Selectable<DB[T]>;
`,o+=`${this.getTab(1)}type BkndEntityCreate<T extends keyof DB> = Insertable<DB[T]>;
`,o+=`${this.getTab(1)}type BkndEntityUpdate<T extends keyof DB> = Updateable<DB[T]>;
`,o+="}",t.push(o);const i=this.em.entities.filter(u=>u.type==="system");for(const u of this.em.entities){if(i.includes(u))continue;const f=u.toTypes();if(!f)continue;this.collectImports(f,r),n[f.name]=this.typeName(f.name);const p=this.entityToTypeString(u,{export:!0});t.push(p)}let s=`interface Database {
`;for(const[u,f]of Object.entries(n))s+=`${this.getTab(1)}${u}: ${f};
`;s+="}",t.push(s);let a=`declare module "bknd" {
`;for(const u of i){const f=Object.keys(q0e[u.name]);u.fields.filter(g=>!f.includes(g.name)&&g.type!=="primary").map(g=>g.name).length!==0&&(a+=`${this.getTab(1)}${this.entityToTypeString(u,{ignore_fields:["id",...f],indent:2})}
`)}return a+=`${this.getTab(1)}interface DB extends Database {}
}`,t.push(a),[this.importsToString(r).join(`
`),t.join(`
`)].join(`
`)}}class G0e extends qg{constructor(t,n){super(),this.ctx=t,this.config=n}get em(){return this.ctx.em}get guard(){return this.ctx.guard}entityExists(t){try{return!!this.em.entity(t)}catch{return!1}}getController(){const{permission:t,auth:n}=this.middlewares,r=this.create().use(n(),t(H0e,{})),o=this.getEntitiesEnum(this.em);return r.get("/",zt({summary:"Retrieve data configuration",tags:["data"]}),i=>i.json(this.em.toJSON())),r.get("/sync",t(lz,{}),eo("data_sync",{annotations:{destructiveHint:!0}}),zt({summary:"Sync database schema",tags:["data"]}),Ft("query",ke({force:at(),drop:at()}).partial()),async i=>{const{force:s,drop:a}=i.req.valid("query"),c=await this.em.schema().introspect(),u=await this.em.schema().sync({force:s,drop:a});return i.json({tables:c.map(f=>f.name),changes:u})}),r.get("/schema.json",t(eb,{context:i=>({module:"data"})}),t(Zr,{context:i=>({entity:i.req.param("entity")})}),zt({summary:"Retrieve data schema",tags:["data"]}),async i=>{const s=`${this.config.basepath}/schema.json`,a=Object.fromEntries(this.em.entities.map(c=>[c.name,{$ref:`${this.config.basepath}/schemas/${c.name}`}]));return i.json({$schema:"https://json-schema.org/draft/2020-12/schema",$id:s,properties:a})}),r.get("/schemas/:entity/:context?",t(eb,{context:i=>({module:"data"})}),t(Zr,{context:i=>({entity:i.req.param("entity")})}),zt({summary:"Retrieve entity schema",tags:["data"]}),Ft("param",ke({entity:o,context:le({enum:["create","update"],default:"create"}).optional()})),async i=>{const{entity:s,context:a}=i.req.param();if(!this.entityExists(s))return this.notFound(i);const c=this.em.entity(s),u=c.toSchema({context:a}),p=`${new URL(i.req.url).origin}${this.config.basepath}`,g=`${this.config.basepath}/schemas/${s}`;return i.json({$schema:`${p}/schema.json`,$id:g,title:c.label,$comment:c.config.description,...u})}),r.get("/types",t(eb,{context:i=>({module:"data"})}),zt({summary:"Retrieve data typescript definitions",tags:["data"]}),eo("data_types"),async i=>{const s=new W0e(this.em);return i.text(s.toString())}),r.route("/entity",this.getEntityRoutes()),r.get("/info/:entity",t(eb,{context:i=>({module:"data"})}),t(Zr,{context:i=>({entity:i.req.param("entity")})}),zt({summary:"Retrieve entity info",tags:["data"]}),eo("data_entity_info"),Ft("param",ke({entity:o})),async i=>{const{entity:s}=i.req.param();if(!this.entityExists(s))return this.notFound(i);const a=this.em.entity(s),c=a.fields.map(f=>f.name),u=f=>f.map(p=>({entity:p.other(a).entity.name,ref:p.other(a).reference}));return i.json({name:a.name,fields:c,relations:{all:u(this.em.relations.relationsOf(a)),listable:u(this.em.relations.listableRelationsOf(a)),source:u(this.em.relations.sourceRelationsOf(a)),target:u(this.em.relations.targetRelationsOf(a))}})}),r}getEntityRoutes(){const{permission:t}=this.middlewares,n=this.create(),r=this.getEntitiesEnum(this.em),o=Rt([bt({title:"Integer"}),le({title:"UUID"})],{coerce:u=>u});n.post("/:entity/fn/count",t(Zr,{context:u=>({entity:u.req.param("entity")})}),zt({summary:"Count entities",tags:["data"]}),eo("data_entity_fn_count"),Ft("param",ke({entity:r})),Ft("json",oi.properties.where),async u=>{const{entity:f}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const p=u.req.valid("json"),g=await this.em.repository(f).count(p);return u.json({entity:f,...g.data})}),n.post("/:entity/fn/exists",t(Zr,{context:u=>({entity:u.req.param("entity")})}),zt({summary:"Check if entity exists",tags:["data"]}),eo("data_entity_fn_exists"),Ft("param",ke({entity:r})),Ft("json",oi.properties.where),async u=>{const{entity:f}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const p=u.req.valid("json"),g=await this.em.repository(f).exists(p);return u.json({entity:f,...g.data})});const i=ke({...mo(oi.properties,["with"]),sort:le({default:"id"}),select:un(le()),join:un(le())}).partial(),s=(u=Object.keys(oi.properties))=>[...Yae(i,"query").parameters?.filter(f=>u.includes(f.name))],a=(u=Object.keys(i.properties))=>ke(Rm(i.properties,u));n.get("/:entity",zt({summary:"Read many",parameters:s(["limit","offset","sort","select","join"]),tags:["data"]}),Ft("param",ke({entity:r})),Ft("query",oi,{skipOpenAPI:!0}),t(Zr,{context:u=>({entity:u.req.param("entity")})}),async u=>{const{entity:f}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const{merge:p}=this.ctx.guard.filters(Zr,u,{entity:f}),g=u.req.valid("query"),y=await this.em.repository(f).findMany({...g,where:p(g.where)});return u.json(y,{status:y.data?200:404})}),n.get("/:entity/:id",zt({summary:"Read one",parameters:s(["offset","sort","select"]),tags:["data"]}),t(Zr,{context:u=>({...u.req.param()})}),eo("data_entity_read_one",{inputSchema:{param:ke({entity:r,id:o}),query:a(["offset","sort","select"])},noErrorCodes:[404]}),Ft("param",ke({entity:r,id:o})),Ft("query",oi,{skipOpenAPI:!0}),async u=>{const{entity:f,id:p}=u.req.valid("param");if(!this.entityExists(f)||!p)return this.notFound(u);const g=u.req.valid("query"),{merge:y}=this.ctx.guard.filters(Zr,u,u.req.valid("param")),v=this.em.entity(f).getPrimaryField().name,x=await this.em.repository(f).findOne(y({[v]:p}),g);return u.json(x,{status:x.data?200:404})}),n.get("/:entity/:id/:reference",zt({summary:"Read many by reference",parameters:s(),tags:["data"]}),t(Zr,{context:u=>({...u.req.param()})}),Ft("param",ke({entity:r,id:o,reference:le()})),Ft("query",oi,{skipOpenAPI:!0}),async u=>{const{entity:f,id:p,reference:g}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const y=u.req.valid("query"),{entity:v}=this.em.repository(f).getEntityByReference(g),{merge:x}=this.ctx.guard.filters(Zr,u,{entity:v.name,id:p,reference:g}),S=await this.em.repository(f).findManyByReference(p,g,{...y,where:x(y.where)});return u.json(S,{status:S.data?200:404})});const c=ke({...i.properties,with:ke({})}).partial();return n.post("/:entity/query",zt({summary:"Query entities",requestBody:{content:{"application/json":{schema:c.toJSON(),example:c.template({withOptional:!0})}}},tags:["data"]}),t(Zr,{context:u=>({entity:u.req.param("entity")})}),eo("data_entity_read_many",{inputSchema:{param:ke({entity:r}),json:c}}),Ft("param",ke({entity:r})),Ft("json",oi,{skipOpenAPI:!0}),async u=>{const{entity:f}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const p=u.req.valid("json"),{merge:g}=this.ctx.guard.filters(Zr,u,{entity:f}),y=await this.em.repository(f).findMany({...p,where:g(p.where)});return u.json(y,{status:y.data?200:404})}),n.post("/:entity",zt({summary:"Insert one or many",tags:["data"]}),t(Km,{context:u=>({...u.req.param()})}),eo("data_entity_insert"),Ft("param",ke({entity:r})),Ft("json",Rt([ke({}),un(ke({}))])),async u=>{const{entity:f}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const p=await u.req.json(),g=iie(p);if(this.ctx.guard.filters(Km,u,{entity:f}).matches(g,{throwOnError:!0}),Array.isArray(g)){const v=await this.em.mutator(f).insertMany(g);return u.json(v,201)}const y=await this.em.mutator(f).insertOne(g);return u.json(y,201)}),n.patch("/:entity",zt({summary:"Update many",tags:["data"]}),t(em,{context:u=>({...u.req.param()})}),eo("data_entity_update_many",{inputSchema:{param:ke({entity:r}),json:ke({update:ke({}),where:ke({})})}}),Ft("param",ke({entity:r})),Ft("json",ke({update:ke({}),where:oi.properties.where})),async u=>{const{entity:f}=u.req.param();if(!this.entityExists(f))return this.notFound(u);const{update:p,where:g}=await u.req.json(),{merge:y}=this.ctx.guard.filters(em,u,{entity:f}),v=await this.em.mutator(f).updateWhere(p,y(g));return u.json(v)}),n.patch("/:entity/:id",zt({summary:"Update one",tags:["data"]}),t(em,{context:u=>({...u.req.param()})}),eo("data_entity_update_one"),Ft("param",ke({entity:r,id:o})),Ft("json",ke({})),async u=>{const{entity:f,id:p}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const g=await u.req.json(),y=this.ctx.guard.filters(em,u,{entity:f,id:p});if(y.filters.length>0){const{data:x}=await this.em.repository(f).findId(p);y.matches(x,{throwOnError:!0})}const v=await this.em.mutator(f).updateOne(p,g);return u.json(v)}),n.delete("/:entity/:id",zt({summary:"Delete one",tags:["data"]}),t(tm,{context:u=>({...u.req.param()})}),eo("data_entity_delete_one"),Ft("param",ke({entity:r,id:o})),async u=>{const{entity:f,id:p}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const g=this.ctx.guard.filters(tm,u,{entity:f,id:p});if(g.filters.length>0){const{data:v}=await this.em.repository(f).findId(p);g.matches(v,{throwOnError:!0})}const y=await this.em.mutator(f).deleteOne(p);return u.json(y)}),n.delete("/:entity",zt({summary:"Delete many",tags:["data"]}),t(tm,{context:u=>({...u.req.param()})}),eo("data_entity_delete_many",{inputSchema:{param:ke({entity:r}),json:ke({})}}),Ft("param",ke({entity:r})),Ft("json",oi.properties.where),async u=>{const{entity:f}=u.req.valid("param");if(!this.entityExists(f))return this.notFound(u);const p=await u.req.json(),{merge:g}=this.ctx.guard.filters(tm,u,{entity:f}),y=await this.em.mutator(f).deleteWhere(g(p));return u.json(y)}),n}registerMcp(){this.ctx.mcp.resource("data_entities","bknd://data/entities",t=>t.json(t.context.ctx().em.toJSON().entities),{title:"Entities",description:"Retrieve all entities"}).resource("data_relations","bknd://data/relations",t=>t.json(t.context.ctx().em.toJSON().relations),{title:"Relations",description:"Retrieve all relations"}).resource("data_indices","bknd://data/indices",t=>t.json(t.context.ctx().em.toJSON().indices),{title:"Indices",description:"Retrieve all indices"})}}const Rv={...Ume,...Jme,media:{schema:nz,field:Ym}},J0e=Object.keys(Rv),Y0e=dA,Jz=Zx(Rv,(e,t)=>Ve({name:le().optional(),type:ui(t),config:e.schema.optional()},{title:t})),wA=Rt(Object.values(Jz)),Yz=Ou(wA,{default:{}}),SA=Ve({name:le().optional(),type:le({enum:HF,default:"regular"}).optional(),config:uA.optional(),fields:Yz.optional()});Ve({type:le({enum:HF,default:"regular"}).optional(),config:uA.optional(),fields:Ou(ke({type:Rt([le({enum:J0e}),le()]),config:rs.optional()}),{default:{}}).optional()});const EA=Object.entries(dA).map(([e,t])=>Ve({type:ui(e),source:le(),target:le(),config:t.schema.optional()},{title:e})),K0e=Ve({entity:le(),fields:un(le(),{minItems:1}),unique:at({default:!1}).optional()}),X0e=Ow("config_data",{basepath:le({default:"/api/data"}).optional(),default_primary_format:le({enum:Kj,default:"integer"}).optional(),entities:ym("config_data_entities",SA,{default:{}}).optional(),relations:ym("config_data_relations",Rt(EA),{default:{}},Ve({type:le({enum:Object.keys(dA)}),source:le(),target:le(),config:ke({}).optional()})).optional(),indices:ym("config_data_indices",K0e,{default:{},mcp:{update:!1}}).optional()}).strict();function NA(e,t){const n=Vt(t.fields??{},(r,o)=>{const{type:i}=r;if(!(i in Rv))throw new Error(`Field type "${i}" not found`);const{field:s}=Rv[i];return new s(o,r.config)});return new Kl(e,Object.values(n),t.config,t.type)}function Kz(e,t){return new Y0e[e.type].cls(t(e.source),t(e.target),e.config)}class Q0e extends Ug{async build(){const{entities:t={},relations:n={},indices:r={}}=this.config,o=Vt(t,(u,f)=>NA(f,u)),i=u=>{const f=typeof u=="string"?u:u.name,p=o[f];if(p)return p;throw new Error(`[AppData] Entity "${f}" not found`)},s=Vt(n,u=>Kz(u,i)),a=Vt(r,(u,f)=>{const p=i(u.entity),g=u.fields.map(y=>p.field(y));return new iF(p,g,u.unique,f)});for(const u of Object.values(o))this.ctx.em.addEntity(u);for(const u of Object.values(s))this.ctx.em.addRelation(u);for(const u of Object.values(a))this.ctx.em.addIndex(u);const c=new G0e(this.ctx,this.config);c.registerMcp(),this.ctx.server.route(this.basepath,c.getController()),this.ctx.guard.registerPermissions(Object.values(Wge)),this.setBuilt()}async onBeforeUpdate(t,n){const r={from:Object.keys(t.entities??{}),to:Object.keys(n.entities??{})};if(r.from.length-r.to.length>1)throw new Error("Cannot remove more than one entity at a time");return n}getSchema(){return X0e}get em(){return this.throwIfNotBuilt(),this.ctx.em}get basepath(){return this.config.basepath??"/api/data"}getOverwritePaths(){return[/^entities\..*\.config$/,/^entities\..*\.fields\..*\.config$/]}toJSON(t){return{...this.config,...this.em.toJSON()}}}class g6{constructor(t={},n={}){this.variables=t,this.options=n}another(){return 1}static hasMarkup(t){let n="";if(Array.isArray(t)||typeof t=="object"){if(!["Array","Object"].includes(t.constructor.name))return!1;n=JSON.stringify(t)}else n=String(t);return["{{"].some(o=>n.includes(o))}async render(t){if(typeof t>"u"||t===null)return t;if(typeof t=="string")return await this.renderString(t);if(Array.isArray(t))return await Promise.all(t.map(n=>this.render(n)));if(typeof t=="object")return await this.renderObject(t);throw new Error("Invalid template type")}async renderString(t){return t.replace(/{{\s*([^{}]+?)\s*}}/g,(n,r)=>{const o=Wm(this.variables,r.trim());return o==null?"":String(o)})}async renderObject(t){const n={};for(const[r,o]of Object.entries(t)){let i=r;this.options.renderKeys&&(i=await this.renderString(r)),n[i]=await this.render(o)}return n}}const nm=(e,t)=>e;class $u{name;static schema=Xi();_params;constructor(t,n){if(typeof t!="string")throw new Error(`Task name must be a string, got ${typeof t}`);this.name=t;const r=this.constructor.schema;if(r===$u.schema&&typeof n<"u"&&Object.keys(n||{}).length>0)throw new Error(`Task "${t}" has no schema defined but params passed: ${JSON.stringify(n)}`);this._params=Cn(r,n||{})}get params(){return this._params}clone(t,n){return new this.constructor(t,n)}static async resolveParams(t,n,r={}){const o={},i=new g6(r,{renderKeys:!0});for(const[s,a]of Object.entries(n)){if(a&&g6.hasMarkup(a)){try{o[s]=await i.render(a)}catch(c){throw c instanceof af?c:new af("Failed to resolve param",{key:s,value:a,error:c.message},"resolve-params")}continue}o[s]=a}return t.coerce(o)}async cloneWithResolvedParams(t){const n=Object.fromEntries(t.entries()),r=await $u.resolveParams(this.constructor.schema,this._params,n);return this.clone(this.name,r)}async run(t=new Map){const n=new Date;let r,o,i,s;const a=performance.now();try{const c=await this.cloneWithResolvedParams(t);s=c.params,r=await c.execute(t),i=!0}catch(c){i=!1,c instanceof af?o=c.toJSON():o={type:"unknown",message:c.message}}return{start:n,output:r,error:o,success:i,params:s,time:performance.now()-a}}error(t,n){return new af(t,n,"runtime")}get label(){return this.name}toJSON(){return{type:this.type,params:this.params}}}const R2=["GET","POST","PUT","PATCH","DELETE"];class Xz extends $u{type="fetch";static schema=Ve({url:le({pattern:"^(http|https)://"}),method:nm(le({enum:R2,default:"GET"})).optional(),headers:nm(un(Ve({key:le(),value:le()}))).optional(),body:nm(le()).optional(),normal:nm(bt()).optional()});getBody(){const t=this.params.body;if(t){if(typeof t=="string")return t;if(typeof t=="object")return JSON.stringify(t);throw new Error(`Invalid body type: ${typeof t}`)}}async execute(){if(!R2.includes(this.params.method??"GET"))throw this.error("Invalid method",{given:this.params.method,valid:R2});const t=this.getBody(),n=new Headers(this.params.headers?.map(i=>[i.key,i.value])),r=await fetch(this.params.url,{method:this.params.method??"GET",headers:n,body:t});if(!r.ok)throw this.error("Failed to fetch",{status:r.status,statusText:r.statusText});return await r.json()}}class Z0e extends $u{type="log";static schema=Ve({delay:bt({default:10})});async execute(){return await new Promise(t=>setTimeout(t,this.params.delay)),rt.log(`[DONE] LogTask: ${this.name}`),!0}}class ebe extends $u{type="render";static schema=Ve({render:le()});async execute(){return this.params.render}}class Qz{source;target;config;id;constructor(t,n,r,o){this.source=t,this.target=n,this.config=r??{},this.config.condition instanceof bs||(this.config.condition=bs.default()),this.id=o??Nse()}get condition(){return this.config.condition}get max_retries(){return this.config.max_retries??0}toJSON(){return km({source:this.source.name,target:this.target.name,config:{...this.config,condition:this.config.condition?.toJSON()}})}}class bs{constructor(t,n="",r=void 0){this.type=t,this.path=n,this.value=r}static default(){return bs.success()}static success(){return new bs("success")}static error(){return new bs("error")}static matches(t,n){if(typeof t!="string"||t.length===0)throw new Error("Invalid path");return new bs("matches",t,n)}isMet(t){switch(this.type){case"success":return t.success;case"error":return t.success===!1;case"matches":return Wm(t.output,this.path)===this.value}}sameAs(t=bs.default()){return this.type===t.type&&this.path===t.path&&this.value===t.value}toJSON(){return{type:this.type,path:this.path.length===0?void 0:this.path,value:this.value}}static fromObject(t){return new bs(t.type,t.path,t.value)}}class k2 extends Ur{static slug="flow-execution-event";task(){return this.params.task}getState(){return this.succeeded()?"success":this.failed()?"failed":this.isStart()?"running":"idle"}isStart(){return this.params.end===void 0}isEnd(){return!this.isStart()}succeeded(){return this.isEnd()&&this.params.result?.success}failed(){return this.isEnd()&&!this.params.result?.success}}class M2 extends Ur{static slug="flow-execution-state"}class _A{flow;started_at;finished_at;logs=[];inputs=new Map;queue=[];emgr;static Events={ExecutionEvent:k2,ExecutionState:M2};constructor(t){this.flow=t,this.logs=[],this.queue=[this.flow.startTask],this.emgr=new Lg(_A.Events)}subscribe(t){this.emgr.onAny(t)}async onDone(t,n){const r=new Date;if(this.logs.push({...n,task:t,end:r}),this.inputs.set(t.name,n),this.flow.respondingTask===t){this.queue=[];return}this.queue=this.queue.filter(i=>i!==t);const o=this.flow.task(t).getOutConnections(n).filter(i=>{const s=i.target,a=this.logs.filter(u=>u.task===s&&u.success).length,c=this.flow.task(s).getInConnections().find(u=>u.source===t)?.max_retries??0;if(a>c)throw new Error(`Task "${s.name}" reached max retries (${a}/${c})`);return this.flow.task(s).getInTasks(!0).every(u=>this.logs.some(f=>f.task===u&&f.end!==void 0))}).map(i=>i.target);this.queue.push(...o)}__getLastTaskLog(t){for(let n=this.logs.length-1;n>=0;n--)if(this.logs[n]?.task===t)return this.logs[n];return null}async run(){const t=this.queue;if(t.length===0)return;const n=t.map(async r=>{await this.emgr.emit(new k2({task:r}));const o=await r.run(this.inputs);return await this.emgr.emit(new k2({task:r,result:o,end:new Date})),await this.onDone(r,o),o});try{return await Promise.all(n),this.run()}catch(r){throw rt.error("RuntimeExecutor: error",r),r}}async start(t){await this.emgr.emit(new M2({execution:this,state:"started"})),this.inputs.set("flow",{start:new Date,output:t,error:void 0,success:!0,params:t}),this.started_at=new Date,await this.run(),this.finished_at=new Date,await this.emgr.emit(new M2({execution:this,state:"ended"}))}finished(){return this.finished_at!==void 0}errorCount(){return this.logs.filter(t=>!t.success).length}hasErrors(){return this.errorCount()>0}getErrorLogs(){return this.logs.filter(t=>!t.success)}getErrors(){return this.getErrorLogs().map(t=>t.error)}getResponse(){let t=this.flow.respondingTask;t||(t=this.flow.tasks[this.flow.tasks.length-1]);const n=this.__getLastTaskLog(t);if(n)return n.output}}class CA{flow;source;constructor(t,n){this.flow=t,this.source=n}task(t){return new CA(this.flow,t)}asInputFor(t,n,r){const o=this.getDepth(),i=this.getOutConnections(),s=i.map(c=>c.condition),a=i.some(c=>this.task(c.target).getDepth()<=o);if(s.length>0&&a&&this.getOutConnections().some(c=>c.condition.sameAs(n)))throw new Error("Task cannot be connected to a deeper task with the same condition");this.flow.addConnection(new Qz(this.source,t,{condition:n,max_retries:r}))}asOutputFor(t,n){this.task(t).asInputFor(this.source,n)}getNext(){return this.flow.connections.filter(t=>t.source===this.source).map(t=>t.target)}getDepth(){return this.flow.getSequence().findIndex(t=>t.includes(this.source))}getInConnections(t=!1){if(t){const n=this.getDepth();return this.getInConnections().filter(r=>r.target===this.source&&this.task(r.source).getDepth()<n)}return this.flow.connections.filter(n=>n.target===this.source)}getInTasks(t=!1){if(t){const n=this.getDepth();return this.getInConnections().map(r=>r.source).filter(r=>this.task(r).getDepth()<n)}return this.getInConnections().map(n=>n.source)}getOutConnections(t){return t?this.flow.connections.filter(n=>n.source===this.source&&n.condition.isMet(t)):this.flow.connections.filter(n=>n.source===this.source)}getOutTasks(t){return this.getOutConnections(t).map(n=>n.target)}}class zf{executions=[];type="manual";config;static schema=Ve({mode:le({enum:["sync","async"],default:"async"})});constructor(t){const n=this.constructor.schema;this.config=Cn(n,t??{})}async register(t,...n){this.executions.push(await t.start())}toJSON(){return{type:this.type,config:this.config}}}class Xg{name;trigger;tasks=[];connections=[];respondingTask;startTask;sequence;constructor(t,n,r,o){this.name=t,this.trigger=o??new zf,n.map(i=>this.addTask(i)),this.connections=r||[],this.startTask=n[0],this.sequence=this.getSequence()}setStartTask(t){return this.startTask=t,this.sequence=this.getSequence(),this}getSequence(t=[]){if(t.length===0)return t.push([this.startTask]),this.getSequence(t);const n=t[t.length-1],r=[];return n?.forEach(o=>{this.task(o).getOutTasks().forEach(s=>{t.some(a=>a.includes(s))||r.push(s)})}),r.length===0?t:(t.push(r),this.getSequence(t))}addTask(t){if(this.tasks.includes(t))throw new Error("Task already defined");if(this.tasks.some(n=>n.name===t.name))throw new Error(`Task with name "${t.name}" already defined. Use a unique name.`);return this.tasks.push(t),this}setRespondingTask(t){if(!this.tasks.includes(t))throw new Error(`Cannot set task "${t.name}" as responding, not registered.`);return this.respondingTask=t,this}addConnection(t){if(this.connections.some(r=>r.source===t.source&&r.target===t.target&&r.condition[0]===t.condition[0]&&r.condition[1]===t.condition[1]))throw new Error("Connection already defined");return this.connections.push(t),this}task(t){return new CA(this,t)}createExecution(){return this.sequence=this.getSequence(),new _A(this)}async start(t=void 0){const n=this.createExecution();return await n.start(t),n}toJSON(){return{trigger:this.trigger.toJSON(),tasks:Object.fromEntries(this.tasks.map(t=>[t.name,t.toJSON()])),connections:Object.fromEntries(this.connections.map(t=>[t.id,t.toJSON()])),start_task:this.startTask?.name,responding_task:this.respondingTask?.name}}static fromObject(t,n,r){const o=Vt(n.tasks??{},(c,u)=>{const f=r[c.type];if(!f)throw new Error(`Task ${u} not found in taskMap`);try{const p=f.cls;return new p(u,c.params)}catch(p){throw rt.error("Error creating task",u,c.type,c,f),new Error(`Error creating task ${c.type}: ${p.message}`)}}),i=Vt(n.connections??{},(c,u)=>{const f=c.config.condition?bs.fromObject(c.config.condition):void 0;return new Qz(o[c.source],o[c.target],{...c.config,condition:f},u)});let s;if(n.trigger){const c=OA[n.trigger.type]?.cls;c&&(s=new c(n.trigger.config))}const a=new Xg(t,Object.values(o),Object.values(i),s);return a.startTask=n.start_task?o[n.start_task]:null,n.responding_task&&(a.respondingTask=o[n.responding_task]),a}}class tbe extends $u{type="subflow";static schema=Ve({flow:Xi(),input:nm(Xi()).optional(),loop:at().optional()});async execute(){const t=this.params.flow;if(!(t instanceof Xg))throw new Error("Invalid flow provided");if(this.params.loop){const r=Array.isArray(this.params.input)?this.params.input:[this.params.input],o=[];for(const i of r){const s=t.createExecution();await s.start(i),o.push(await s.getResponse())}return o}const n=t.createExecution();return await n.start(this.params.input),n.getResponse()}}class nbe extends zf{type="event";static schema=Ve({event:le(),...zf.schema.properties});async register(t,n){if(!n.eventExists(this.config.event))throw new Error(`Event ${this.config.event} is not registered.`);n.on(this.config.event,async r=>{const o=t.createExecution();this.executions.push(o);try{await o.start(r.params)}catch(i){rt.error(i)}},this.config.mode)}}const rbe=["GET","POST","PUT","PATCH","DELETE"];class Zz extends zf{type="http";static schema=Ve({path:le({pattern:"^/.*$"}),method:le({enum:rbe,default:"GET"}),response_type:le({enum:["json","text","html"],default:"json"}),...zf.schema.properties});async register(t,n){const r=this.config.method.toLowerCase();n[r](this.config.path,async o=>{const i=o.req.raw,s=o[this.config.response_type],a=t.createExecution();if(this.executions.push(a),this.config.mode==="sync"){await a.start(i);const c=a.getResponse(),u=a.getErrors();return u.length>0?o.json({success:!1,errors:u}):s(c)}return a.start(i),o.json({success:!0})})}}const OA={manual:{cls:zf},event:{cls:nbe},http:{cls:Zz}},eB={fetch:{cls:Xz},log:{cls:Z0e},render:{cls:ebe},subflow:{cls:tbe}},tB={...eB},nB=OA,rB=Vt(tB,(e,t)=>Ve({type:ui(t),params:e.cls.schema},{title:String(t)}));Rt(Object.values(rB));const oB=Vt(nB,(e,t)=>Ve({type:ui(t),config:e.cls.schema.optional()},{title:String(t)}));Rt(Object.values(oB));const obe=Ve({source:le(),target:le(),config:Ve({condition:Rt([Ve({type:ui("success")},{title:"success"}),Ve({type:ui("error")},{title:"error"}),Ve({type:ui("matches"),path:le(),value:le()},{title:"matches"})]),max_retries:bt()}).partial()}),iB=Ve({trigger:Rt(Object.values(oB)),tasks:Ou(Rt(Object.values(rB))).optional(),connections:Ou(obe).optional(),start_task:le().optional(),responding_task:le().optional()}),ibe=Ve({basepath:le({default:"/api/flows"}),flows:Ou(iB,{default:{}})});class sbe extends Ug{flows={};getSchema(){return ibe}getFlowInfo(t){return{...t.toJSON(),tasks:t.tasks.length,connections:t.connections}}async build(){const t=Vt(this.config.flows,(r,o)=>Xg.fromObject(o,r,tB));this.flows=t;const n=new Cw;n.get("/",async r=>{const o=Vt(this.flows,i=>this.getFlowInfo(i));return r.json(o)}),n.get("/flow/:name",async r=>{const o=r.req.param("name");return r.json(this.flows[o]?.toJSON())}),n.get("/flow/:name/run",async r=>{const o=r.req.param("name"),i=this.flows[o],s=i.createExecution(),a=performance.now();await s.start();const c=performance.now()-a,u=s.getErrors();return r.json({success:u.length===0,time:c,errors:u,response:s.getResponse(),flow:this.getFlowInfo(i),logs:s.logs})}),n.all("*",r=>r.notFound()),this.ctx.server.route(this.config.basepath,n);for(const[r,o]of Object.entries(this.flows)){const i=o.trigger;switch(!0){case i instanceof Zz:await i.register(o,this.ctx.server);break}}this.setBuilt()}toJSON(){return{...this.config,flows:Vt(this.flows,t=>t.toJSON())}}}class sB extends Ur{static slug="file-uploaded";validate(t){if(typeof t!="object")throw new lw("object",typeof t);return this.clone({...t,...this.params})}}class aB extends Ur{static slug="file-deleted"}class lB extends Ur{static slug="file-access"}const abe=Object.freeze(Object.defineProperty({__proto__:null,FileAccessEvent:lB,FileDeletedEvent:aB,FileUploadedEvent:sB},Symbol.toStringTag,{value:"Module"}));class bm{#e;static Events=abe;emgr;config;constructor(t,n={},r){this.#e=t,this.config={...n,body_max_size:n.body_max_size&&n.body_max_size>0?n.body_max_size:void 0},this.emgr=r??new Lg,this.emgr.registerEvents(bm.Events)}getAdapter(){return this.#e}async objectMetadata(t){return await this.#e.getObjectMeta(t)}getConfig(){return this.config}async uploadFile(t,n,r){const o=await this.#e.putObject(n,t);if(typeof o>"u")throw new Error("Failed to upload file");let i={name:n,meta:xc(t)?{size:t.size,type:t.type}:{size:0,type:"application/octet-stream"},etag:typeof o=="string"?o:""};if(typeof o=="object"&&(i=o),!i.meta.type||["application/octet-stream","application/json"].includes(i.meta.type)||!i.meta.size){const a=await this.#e.getObjectMeta(n);if(!a)throw new Error("Failed to get object meta");i.meta=a}if(i.meta.type.startsWith("image")&&(!i.meta.width||!i.meta.height))try{const a=await bie(t);i.meta={...i.meta,...a}}catch(a){rt.warn("Failed to get image dimensions",a,t)}const s={file:t,...i,state:{name:i.name,path:i.name}};if(!r){const a=await this.emgr.emit(new sB(s));if(a.returned)return a.params}return s}async deleteFile(t){await this.#e.deleteObject(t),await this.emgr.emit(new aB({name:t}))}async fileExists(t){return await this.#e.objectExists(t)}}const cB=new On("media.file.read"),uB=new On("media.file.list"),J_=new On("media.file.upload"),dB=new On("media.file.delete"),lbe=Object.freeze(Object.defineProperty({__proto__:null,deleteFile:dB,listFiles:uB,readFile:cB,uploadFile:J_},Symbol.toStringTag,{value:"Module"}));function cbe(e){if(!e.includes("."))return;const t=e.split(".");return t[t.length-1]?.toLowerCase()}function y6(e,t=16){const n=typeof e=="string"?e:e.name;if(typeof n!="string")throw console.error("Couldn't extract filename from",e),new Error("Invalid file name");let r=cbe(n);if(!r&&xc(e)&&e.type){const o=FL(e.type);o.length>0&&(r=o)}return[$L(t),r].filter(Boolean).join(".")}class ube extends qg{constructor(t){super(),this.media=t}getStorageAdapter(){return this.getStorage().getAdapter()}getStorage(){return this.media.storage}getController(){const{auth:t,permission:n}=this.middlewares,r=this.create().use(t()),o=this.getEntitiesEnum(this.media.em);r.get("/files",zt({summary:"Get the list of files",tags:["media"]}),n(uB,{}),async a=>{const c=await this.getStorageAdapter().listObjects();return a.json(c)}),r.get("/file/:filename",zt({summary:"Get a file by name",tags:["media"]}),n(cB,{}),async a=>{const{filename:c}=a.req.param();if(!c)throw new Error("No file name provided");await this.getStorage().emgr.emit(new lB({name:c}));const u=await this.getStorageAdapter().getObject(c,a.req.raw.headers),f=new Headers(u.headers);return f.set("Cache-Control","public, max-age=31536000, immutable"),new Response(u.body,{status:u.status,statusText:u.statusText,headers:f})}),r.delete("/file/:filename",zt({summary:"Delete a file by name",tags:["media"]}),n(dB,{}),async a=>{const{filename:c}=a.req.param();if(!c)throw new Error("No file name provided");return await this.getStorage().deleteFile(c),a.json({message:"File deleted"})});const i=this.media.options.body_max_size??this.getStorage().getConfig().body_max_size??Number.POSITIVE_INFINITY;ir()&&r.post("/inspect",zt({summary:"Inspect a file",tags:["media"]}),async a=>{const c=await d2(a);return a.json({type:c?.type,name:c?.name,size:c?.size})});const s={content:{"multipart/form-data":{schema:{type:"object",properties:{file:{type:"string",format:"binary"}},required:["file"]}},"application/octet-stream":{schema:{type:"string",format:"binary"}}}};return r.post("/upload/:filename?",zt({summary:"Upload a file",tags:["media"],requestBody:s}),Ft("param",ke({filename:le().optional()})),n(J_,{}),async a=>{const c=a.req.param("filename"),u=await d2(a);if(!u)return a.json({error:"No file provided"},Qt.BAD_REQUEST);if(u.size>i)return a.json({error:`Max size (${i} bytes) exceeded`},Qt.PAYLOAD_TOO_LARGE);const f=c??y6(u),p=await this.getStorage().uploadFile(u,f);return a.json(p,Qt.CREATED)}),r.post("/entity/:entity/:id/:field",zt({summary:"Add a file to an entity",tags:["media"],requestBody:s}),Ft("param",ke({entity:o,id:Rt([bt(),le()]),field:le()})),Ft("query",ke({overwrite:at().optional()})),n(Km,{context:a=>({entity:a.req.param("entity")})}),n(J_,{}),async a=>{const{entity:c,id:u,field:f}=a.req.valid("param"),p=this.media.em.entity(c);if(!p)return a.json({error:`Entity "${c}" not found`},Qt.NOT_FOUND);const g=p.field(f);if(!g||!(g instanceof Ym))return a.json({error:`Invalid field "${f}"`},Qt.BAD_REQUEST);const y=this.media.getMediaEntity().name,v=`${c}.${f}`,x={scope:f,reference:v,entity_id:u},S=g.getMaxItems(),E=[];if(S){const{overwrite:R}=a.req.valid("query"),{data:{count:V}}=await this.media.em.repository(y).count(x);if(V>=S){if(!R)return a.json({error:`Max items (${S}) reached`},Qt.BAD_REQUEST);if(V>S)return a.json({error:`Max items (${S}) exceeded already with ${V} items.`},Qt.UNPROCESSABLE_ENTITY);const H=await this.media.em.repo(y).findMany({select:["path"],where:x,sort:{by:"id",dir:"asc"},limit:V-S+1});H.data&&H.data.length>0&&H.data.map(F=>E.push(F.path))}}const{data:{exists:C}}=await this.media.em.repository(p).exists({id:u});if(!C)return a.json({error:`Entity "${c}" with ID "${u}" doesn't exist found`},Qt.NOT_FOUND);const _=await d2(a);if(!_)return a.json({error:"No file provided"},Qt.BAD_REQUEST);if(_.size>i)return a.json({error:`Max size (${i} bytes) exceeded`},Qt.PAYLOAD_TOO_LARGE);const j=y6(_),A=await this.getStorage().uploadFile(_,j,!0),T=this.media.em.mutator(y);T.__unstable_toggleSystemEntityCreation(!1);const k=await T.insertOne({...this.media.uploadedEventDataToMediaPayload(A),...x});if(T.__unstable_toggleSystemEntityCreation(!0),E.length>0)for(const R of E)await this.getStorage().deleteFile(R);return a.json({ok:!0,result:k.data,...A},Qt.CREATED)}),r}}class dbe{constructor(t){this.registerFn=t}is_set=!1;items={};set(t){if(this.is_set)throw new Error("Registry is already set");return this.items=t,this.is_set=!0,this}add(t,n){return this.items[t]=n,this}register(t,n){if(this.registerFn){const r=this.registerFn(n);return this.items[t]=r,this}return this.add(t,n)}get(t){return this.items[t]}has(t){return t in this.items}all(){return this.items}}/**
* @license MIT <https://opensource.org/licenses/MIT>
* @copyright Michael Hart 2024
*/const Y_=new TextEncoder,fbe={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},hbe=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]);let pbe=class{constructor({accessKeyId:t,secretAccessKey:n,sessionToken:r,service:o,region:i,cache:s,retries:a,initRetryMs:c}){if(t==null)throw new TypeError("accessKeyId is a required option");if(n==null)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=t,this.secretAccessKey=n,this.sessionToken=r,this.service=o,this.region=i,this.cache=s||new Map,this.retries=a??10,this.initRetryMs=c||50}async sign(t,n){if(t instanceof Request){const{method:i,url:s,headers:a,body:c}=t;n=Object.assign({method:i,url:s,headers:a},n),n.body==null&&a.has("Content-Type")&&(n.body=c!=null&&a.has("X-Amz-Content-Sha256")?c:await t.clone().arrayBuffer()),t=s}const r=new mbe(Object.assign({url:t.toString()},n,this,n&&n.aws)),o=Object.assign({},n,await r.sign());delete o.aws;try{return new Request(o.url.toString(),o)}catch(i){if(i instanceof TypeError)return new Request(o.url.toString(),Object.assign({duplex:"half"},o));throw i}}async fetch(t,n){for(let r=0;r<=this.retries;r++){const o=fetch(await this.sign(t,n));if(r===this.retries)return o;const i=await o;if(i.status<500&&i.status!==429)return i;await new Promise(s=>setTimeout(s,Math.random()*this.initRetryMs*Math.pow(2,r)))}throw new Error("An unknown error occurred, ensure retries is not negative")}};class mbe{constructor({method:t,url:n,headers:r,body:o,accessKeyId:i,secretAccessKey:s,sessionToken:a,service:c,region:u,cache:f,datetime:p,signQuery:g,appendSessionToken:y,allHeaders:v,singleEncode:x}){if(n==null)throw new TypeError("url is a required option");if(i==null)throw new TypeError("accessKeyId is a required option");if(s==null)throw new TypeError("secretAccessKey is a required option");this.method=t||(o?"POST":"GET"),this.url=new URL(n),this.headers=new Headers(r||{}),this.body=o,this.accessKeyId=i,this.secretAccessKey=s,this.sessionToken=a;let S,E;(!c||!u)&&([S,E]=gbe(this.url,this.headers)),this.service=c||S||"",this.region=u||E||"us-east-1",this.cache=f||new Map,this.datetime=p||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=g,this.appendSessionToken=y||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256")&&this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");const C=this.signQuery?this.url.searchParams:this.headers;if(C.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&C.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(j=>v||!hbe.has(j)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(j=>j+":"+(j==="host"?this.url.host:(this.headers.get(j)||"").replace(/\s+/g," "))).join(`
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&(this.service==="s3"&&!C.has("X-Amz-Expires")&&C.set("X-Amz-Expires","86400"),C.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),C.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),C.set("X-Amz-SignedHeaders",this.signedHeaders)),this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch{this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");x||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=x6(this.encodedPath);const _=new Set;this.encodedSearch=[...this.url.searchParams].filter(([j])=>{if(!j)return!1;if(this.service==="s3"){if(_.has(j))return!1;_.add(j)}return!0}).map(j=>j.map(A=>x6(encodeURIComponent(A)))).sort(([j,A],[T,k])=>j<T?-1:j>T?1:A<k?-1:A>k?1:0).map(j=>j.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){const t=this.datetime.slice(0,8),n=[this.secretAccessKey,t,this.region,this.service].join();let r=this.cache.get(n);if(!r){const o=await zp("AWS4"+this.secretAccessKey,t),i=await zp(o,this.region),s=await zp(i,this.service);r=await zp(s,"aws4_request"),this.cache.set(n,r)}return P2(await zp(r,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,P2(await b6(await this.canonicalString()))].join(`
`)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
`,this.signedHeaders,await this.hexBodyHash()].join(`
`)}async hexBodyHash(){let t=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(t==null){if(this.body&&typeof this.body!="string"&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");t=P2(await b6(this.body||""))}return t}}async function zp(e,t){const n=await crypto.subtle.importKey("raw",typeof e=="string"?Y_.encode(e):e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",n,Y_.encode(t))}async function b6(e){return crypto.subtle.digest("SHA-256",typeof e=="string"?Y_.encode(e):e)}const v6=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function P2(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++){const o=t[r];n+=v6[o>>>4&15],n+=v6[o&15]}return n}function x6(e){return e.replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}function gbe(e,t){const{hostname:n,pathname:r}=e;if(n.endsWith(".on.aws")){const a=n.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return a!=null?["lambda",a[1]||""]:["",""]}if(n.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(n.endsWith(".backblazeb2.com")){const a=n.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return a!=null?["s3",a[1]||""]:["",""]}const o=n.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/);let i=o&&o[1]||"",s=o&&o[2];if(s==="us-gov")s="us-gov-west-1";else if(s==="s3"||s==="s3-accelerate")s="us-east-1",i="s3";else if(i==="iot")n.startsWith("iot.")?i="execute-api":n.startsWith("data.jobs.iot.")?i="iot-jobs-data":i=r==="/mqtt"?"iotdevicegateway":"iotdata";else if(i==="autoscaling"){const a=(t.get("X-Amz-Target")||"").split(".")[0];a==="AnyScaleFrontendService"?i="application-autoscaling":a==="AnyScaleScalingPlannerFrontendService"&&(i="autoscaling-plans")}else s==null&&i.startsWith("s3-")?(s=i.slice(3).replace(/^fips-|^external-1/,""),i="s3"):i.endsWith("-fips")?i=i.slice(0,-5):s&&/-\d$/.test(i)&&!/-\d$/.test(s)&&([i,s]=[s,i]);return[fbe[i]||i,s||""]}class ybe extends pbe{#e;constructor(t,n){super(t),this.#e=n??{responseType:"json"}}convertParams(t){switch(this.#e.convertParams){case"pascalToKebab":return g_(t);default:return t}}getUrl(t="/",n={}){const r=new URL(t),o=this.convertParams(n);return Object.entries(o).forEach(([i,s])=>{r.searchParams.append(i,s)}),r.toString()}updateKeysRecursively(t,n){return t==null?t:Array.isArray(t)?t.map(r=>this.updateKeysRecursively(r,n)):typeof t=="object"?Object.keys(t).reduce((r,o)=>{let i=o;return o.indexOf(" ")===-1&&(i=o.charAt(0)[n]()+o.slice(1)),r[i]=this.updateKeysRecursively(t[o],n),r},{}):t}async fetchJson(t,n){const r=await this.fetch(t,n);if(this.#e.responseType==="xml"){if(!r.ok){const s=await r.text();throw new Error(s)}const i=await r.text();return pse(i)}if(!r.ok){const i=await r.json();throw new Error(i.message)}const o=await r.json();return this.#e.responseKeysToUpper?this.updateKeysRecursively(o,"toUpperCase"):o}}const w6=Symbol.for("bknd:storage");class fB{constructor(){this[w6]=!0}static isAdapter(t){return t?t[w6]===!0:!1}}const S6=ke({access_key:Pm(),secret_access_key:Pm(),url:le({pattern:"^https?://(?:.*)?[^/.]+$",description:"URL to S3 compatible endpoint without trailing slash",examples:["https://{account_id}.r2.cloudflarestorage.com/{bucket}","https://{bucket}.s3.{region}.amazonaws.com"]})},{title:"AWS S3",description:"AWS S3 or compatible storage"});class hB extends fB{#e;client;constructor(t){super(),this.client=new ybe({accessKeyId:t.access_key,secretAccessKey:t.secret_access_key,retries:ir()?0:10,service:"s3"},{convertParams:"pascalToKebab",responseType:"xml"}),this.#e=Cn(S6,t)}getName(){return"s3"}getSchema(){return S6}getUrl(t="",n={}){let r=this.getObjectUrl("").slice(0,-1);return t.length>0&&(r+=`/${t}`),this.client.getUrl(r,n)}getObjectUrl(t){return`${this.#e.url}/${t}`}async listObjects(t=""){const n={ListType:2,Prefix:t},r=this.getUrl("",n),o=await this.client.fetchJson(r,{method:"GET"}),{Contents:i}=o.ListBucketResult,s=i?Array.isArray(i)?i:[i]:[];return Vi(s,(c,u)=>{u.Key&&u.LastModified&&u.Size&&c.push({key:u.Key,last_modified:u.LastModified,size:u.Size})},[])}async putObject(t,n,r={}){const o=this.getUrl(t,{}),i=await this.client.fetch(o,{method:"PUT",body:n,headers:xc(n)?{"Content-Length":String(n.size)}:{}});if(!i.ok)throw new Error(`Failed to upload object: ${i.status} ${i.statusText}`);return String(i.headers.get("etag"))}async headObject(t,n={}){const r=this.getUrl(t,{});return await this.client.fetch(r,{method:"HEAD",headers:{Range:"bytes=0-1"}})}async getObjectMeta(t){const n=await this.headObject(t),r=String(n.headers.get("content-type")),o=Number(String(n.headers.get("content-range")?.split("/")[1]));return{type:r,size:o}}async objectExists(t,n={}){return(await this.headObject(t)).ok}async getObject(t,n){const r=this.getUrl(t),o=await this.client.fetch(r,{method:"GET",headers:Sie(n,["if-none-match","accept","if-modified-since"])});return new Response(o.body,{status:o.status,statusText:o.statusText,headers:o.headers})}async deleteObject(t,n={}){const r=this.getUrl(t,n);await this.client.fetch(r,{method:"DELETE"})}toJSON(t){return{type:this.getName(),config:t?this.#e:void 0}}}const E6=ke({cloud_name:le(),api_key:Pm(),api_secret:Pm(),upload_preset:le().optional()},{title:"Cloudinary",description:"Cloudinary media storage"});class pB extends fB{config;constructor(t){super(),this.config=Cn(E6,t)}getSchema(){return E6}getMimeType(t){switch(!0){case(t.format==="jpeg"||t.format==="jpg"):return"image/jpeg"}return`${t.resource_type}/${t.format}`}getName(){return"cloudinary"}getAuthorizationHeader(){return{Authorization:`Basic ${btoa(`${this.config.api_key}:${this.config.api_secret}`)}`}}async putObject(t,n){const r=t.replace(/\.[a-z0-9]{2,5}$/,""),o=new FormData;o.append("file",n),o.append("public_id",r),o.append("api_key",this.config.api_key),this.config.upload_preset&&o.append("upload_preset",this.config.upload_preset);const i=await fetch(`https://api.cloudinary.com/v1_1/${this.config.cloud_name}/auto/upload`,{method:"POST",headers:{Accept:"application/json"},body:o});if(!i.ok)return;const s=await i.json();return{name:s.public_id+"."+s.format,etag:s.etag,meta:{type:this.getMimeType(s),size:s.bytes}}}async listObjects(t){const n=await fetch(`https://api.cloudinary.com/v1_1/${this.config.cloud_name}/resources/search`,{method:"GET",headers:{Accept:"application/json","Cache-Control":"no-cache",...this.getAuthorizationHeader()}});if(!n.ok)throw new Error("Failed to list objects");return(await n.json()).resources.map(i=>({key:i.public_id,last_modified:new Date(i.uploaded_at),size:i.bytes}))}async headObject(t){const n=this.getObjectUrl(t);return await fetch(n,{method:"HEAD",headers:{"Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:"0",Range:"bytes=0-1"}})}async objectExists(t){return(await this.headObject(t)).ok}async getObjectMeta(t){const n=await this.headObject(t);if(n.ok){const r=n.headers.get("content-type"),o=Number(n.headers.get("content-range")?.split("/")[1]);return{type:r,size:o}}throw new Error("Cannot get object meta")}guessType(t){const n={image:["jpg","jpeg","png","gif","webp","svg"],video:["mp4","webm","ogg"]},r=t.split(".").pop();return Object.keys(n).find(o=>n[o].includes(r))}getObjectUrl(t){const n=this.guessType(t)??"image";return`https://res.cloudinary.com/${this.config.cloud_name}/${n}/upload/${t}`}async generateSignature(t,n){const r=t.timestamp??Math.floor(Date.now()/1e3),o=Object.entries({...t,timestamp:r}).sort(([s],[a])=>s.localeCompare(a)).map(([s,a])=>`${s}=${a}`).join("&");return{signature:await HL.sha1(o+(n??this.config.api_secret)),timestamp:r}}filenameToPublicId(t){return t.split(".").slice(0,-1).join(".")}async getObject(t,n){const r=await fetch(this.getObjectUrl(t),{method:"GET",headers:wie(n,["range"])});return new Response(r.body,{status:r.status,statusText:r.statusText,headers:r.headers})}async deleteObject(t){const n=this.guessType(t)??"image",r=this.filenameToPublicId(t),{timestamp:o,signature:i}=await this.generateSignature({public_id:r}),s=new FormData;s.append("public_id",r),s.append("timestamp",String(o)),s.append("signature",i),s.append("api_key",this.config.api_key);const a=`https://api.cloudinary.com/v1_1/${this.config.cloud_name}/${n}/destroy`,c=await fetch(a,{headers:{Accept:"application/json","Cache-Control":"no-cache",...this.getAuthorizationHeader()},method:"POST",body:s});if(!c.ok)throw new Error(`Failed to delete object: ${c.status} ${c.statusText}`)}toJSON(t){return{type:"cloudinary",config:t?this.config:{cloud_name:this.config.cloud_name}}}}const bbe=new dbe(e=>({cls:e,schema:e.prototype.getSchema()})).register("s3",hB).register("cloudinary",pB);hB.prototype.getSchema(),pB.prototype.getSchema();const vbe={media:bbe},mB=vbe.media;function gB(){const e=Zx(mB.all(),(t,n)=>Ve({type:ui(n),config:t.schema},{title:t.schema?.title??n,description:t.schema?.description}));return Ow("config_media",{enabled:at({default:!1}),basepath:le({default:"/api/media"}),entity_name:le({default:"media"}),storage:Ve({body_max_size:bt({description:"Max size of the body in bytes. Leave blank for unlimited."}).optional()},{default:{}}),adapter:Ige("config_media_adapter",Rt(Object.values(e))).optional()},{default:{}}).strict()}gB();class jA extends Ug{_storage;options={body_max_size:null};async build(){if(!this.config.enabled){this.setBuilt();return}if(!this.config.adapter){console.info("No storage adapter provided, skip building media.");return}let t;try{const{type:n,config:r}=this.config.adapter,o=mB.get(n).cls;t=new o(r),this._storage=new bm(t,this.config.storage,this.ctx.emgr),this.setBuilt(),this.setupListeners(),this.ctx.guard.registerPermissions(lbe),this.ctx.server.route(this.basepath,new ube(this).getController());const i=this.getMediaEntity(!0);this.ctx.helper.ensureSchema(oz({[i.name]:i},({index:s},{media:a})=>{s(a).on(["path"],!0).on(["reference"]).on(["entity_id"])}))}catch(n){throw console.error(n),new Error(`Could not build adapter with config ${JSON.stringify(this.config.adapter)}`)}}getSchema(){return gB()}get basepath(){return this.config.basepath}get storage(){return this.throwIfNotBuilt(),this._storage}uploadedEventDataToMediaPayload(t){const n={};return t.meta.width&&t.meta.height&&(n.width=t.meta.width,n.height=t.meta.height),{path:t.name,mime_type:t.meta.type,size:t.meta.size,etag:t.etag,modified_at:new Date,metadata:n}}static mediaFields=Gz;getMediaEntity(t){const n=this.config.entity_name;return t||!this.em.hasEntity(n)?rz(n,jA.mediaFields,void 0,"system"):this.em.entity(n)}get em(){return this.ctx.em}setupListeners(){const{emgr:t,em:n}=this.ctx,r=this.getMediaEntity().name;t.onEvent(bm.Events.FileUploadedEvent,async o=>{const i=n.mutator(r);i.__unstable_toggleSystemEntityCreation(!1);const s=this.uploadedEventDataToMediaPayload(o.params),{data:a}=await i.insertOne(s);return i.__unstable_toggleSystemEntityCreation(!0),{data:a}},{mode:"sync",id:"add-data-media"}),t.onEvent(bm.Events.FileDeletedEvent,async o=>{const{data:i}=await n.repo(r).findOne({path:o.params.name});i&&await n.mutator(r).deleteOne(i.id),rt.log("App:storage:file deleted",o.params)},{mode:"sync",id:"delete-data-media"}),t.onEvent(z7,async o=>{const{entity:i,data:s}=o.params,a=i.fields.filter(c=>c.type==="media");if(a.length>0){const c=a.map(f=>`${i.name}.${f.name}`);rt.log("App:storage:file cleaning up",{reference:{$in:c},entity_id:String(s.id)});const{data:u}=await n.mutator(r).deleteWhere({reference:{$in:c},entity_id:String(s.id)});for(const f of u)await this.storage.deleteFile(f.path);rt.log("App:storage:file cleaned up files:",u.length)}},{mode:"async",id:"delete-data-media-after"})}getOverwritePaths(){return[/^\.?adapter$/]}toJSON(t){return!this.isBuilt()||!this.config.enabled?this.configDefault:{...this.config,adapter:this.storage.getAdapter().toJSON(t)}}}const yB={server:Vge,data:Q0e,auth:Aw,media:jA,flows:sbe};AL("modules_debug",!1);function xbe(){return{type:"object",...Vt(yB,t=>t.prototype.getSchema())}}function wbe(){const e=Vt(yB,t=>t.prototype.getSchema().template({},{withOptional:!0,withExtendedOptional:!0}));return structuredClone(e)}class Tw{constructor(t={},n){this._options=t,this.fetcher=n??fetch}fetcher;getDefaultOptions(){return{}}get options(){return{host:"http://localhost",token:void 0,...this.getDefaultOptions(),...this._options}}key(){return this.options.basepath??""}getUrl(t){const n=this.options.basepath??"";return this.options.host+(n+"/"+t).replace(/\/{2,}/g,"/").replace(/\/$/,"")}request(t,n,r){const o=r?.method??"GET",i=Array.isArray(t)?t.join("/"):t;let s=this.getUrl(i);n instanceof URLSearchParams?s+="?"+n.toString():typeof n=="object"&&Object.keys(n).length>0&&(s+="?"+tw(n));const a=new Headers(this.options.headers??{});for(const[f,p]of Object.entries(r?.headers??{}))a.set(f,p);a.has("Accept")||a.set("Accept","application/json"),this.options.token&&this.options.token_transport==="header"&&a.set("Authorization",`Bearer ${this.options.token}`);let c=r?.body;if(r&&"body"in r&&["POST","PATCH","PUT"].includes(o)){const f=a.get("Content-Type")??void 0;(!f||f.startsWith("application/json")||$a(c))&&(c=JSON.stringify(r.body),a.set("Content-Type","application/json"))}const u=new Request(s,{...r,credentials:this.options.credentials,method:o,body:c,headers:a});return new $w(u,{fetcher:this.fetcher,verbose:this.options.verbose})}get(t,n,r){return this.request(t,n,{...r,method:"GET"})}post(t,n,r){return this.request(t,void 0,{...r,body:n,method:"POST"})}patch(t,n,r){return this.request(t,void 0,{...r,body:n,method:"PATCH"})}put(t,n,r){return this.request(t,void 0,{...r,body:n,method:"PUT"})}delete(t,n,r){return this.request(t,void 0,{...r,body:n,method:"DELETE"})}}function Sbe(e,t,n){let r=typeof n<"u"?n:t;const o=["raw","body","ok","status","res","data","toJSON"];return typeof r!="object"&&(r={}),new Proxy(r,{get(i,s,a){return s==="raw"||s==="res"?e:s==="body"?t:s==="data"?n:s==="ok"?e.ok:s==="status"?e.status:s==="toJSON"?()=>i:Reflect.get(i,s,a)},has(i,s){return o.includes(s)?!0:Reflect.has(i,s)},ownKeys(i){return Array.from(new Set([...Reflect.ownKeys(i),...o]))},getOwnPropertyDescriptor(i,s){return o.includes(s)?{configurable:!0,enumerable:!0,value:Reflect.get({raw:e,body:t,ok:e.ok,status:e.status},s)}:Reflect.getOwnPropertyDescriptor(i,s)}})}class $w{constructor(t,n,r){this.request=t,this.options=n,this.refineData=r}[Symbol.toStringTag];get verbose(){return this.options?.verbose??!1}refine(t){return new $w(this.request,this.options,t)}async execute(){ir()&&await new Promise(s=>setTimeout(s,200));const t=this.options?.fetcher??fetch;this.verbose&&rt.debug("[FetchPromise] Request",{method:this.request.method,url:this.request.url});const n=await t(this.request);this.verbose&&rt.debug("[FetchPromise] Response",{res:n,ok:n.ok,status:n.status});let r,o;const i=n.headers.get("Content-Type")??"";if(i.startsWith("application/json")?(r=await n.json(),typeof r=="object"&&(o="data"in r?r.data:r)):i.startsWith("text")?r=await n.text():r=n.body,this.refineData)try{o=this.refineData(o)}catch(s){console.warn("[FetchPromise] Error in refineData",s),o=void 0}return Sbe(n,r,o)}then(t,n){return this.execute().then(t,n)}catch(t){return this.then(void 0,t)}finally(t){return this.then(n=>(t?.(),n),n=>{throw t?.(),n})}path(){return new URL(this.request.url).pathname}key(t){const n=new URL(this.request.url);return t?.search!==!1?this.path()+n.search:this.path()}keyArray(t){const n=new URL(this.request.url),r=this.path().split("/");return(t?.search!==!1?[...r,n.searchParams.toString()]:r).filter(Boolean)}toString(){return this.key({search:!0})}toJSON(){return{url:this.request.url,method:this.request.method}}}class Ebe extends Tw{getDefaultOptions(){return{basepath:"/api/auth",credentials:"include"}}async login(t,n){const r=await this.post([t,"login"],n);return r.ok&&r.body.token&&await this.options.onTokenUpdate?.(r.body.token,!0),r}async register(t,n){const r=await this.post([t,"register"],n);return r.ok&&r.body.token&&await this.options.onTokenUpdate?.(r.body.token,!0),r}async actionSchema(t,n){return this.get([t,"actions",n,"schema.json"])}async action(t,n,r){return this.post([t,"actions",n],r)}async loginWithPassword(t){return this.login("password",t)}async registerWithPassword(t){return this.register("password",t)}me(){return this.get(["me"])}strategies(){return this.get(["strategies"])}async logout(){return this.get(["logout"],void 0,{headers:{Accept:"application/json"}}).then(()=>this.options.onTokenUpdate?.(void 0,!0))}}class Nbe extends Tw{getDefaultOptions(){return{basepath:"/api/data",queryLengthLimit:1e3,defaultQuery:{limit:10}}}requireObjectSet(t,n){if(!t||typeof t!="object"||Object.keys(t).length===0)throw new Error(n??"object is required")}readOne(t,n,r={}){return this.get(["entity",t,n],r)}readOneBy(t,n={}){return this.readMany(t,{...n,limit:1,offset:0}).refine(r=>r[0])}readMany(t,n={}){const r=n??this.options.defaultQuery,o=this.get(["entity",t],r);return o.request.url.length<=this.options.queryLengthLimit?o:this.post(["entity",t,"query"],r)}readManyByReference(t,n,r,o={}){return this.get(["entity",t,n,r],o??this.options.defaultQuery)}createOne(t,n){return this.post(["entity",t],n)}createMany(t,n){if(!n||!Array.isArray(n)||n.length===0)throw new Error("input is required");return this.post(["entity",t],n)}updateOne(t,n,r){if(!n)throw new Error("ID is required");return this.patch(["entity",t,n],r)}updateMany(t,n,r){return this.requireObjectSet(n),this.patch(["entity",t],{update:r,where:n})}deleteOne(t,n){if(!n)throw new Error("ID is required");return this.delete(["entity",t,n])}deleteMany(t,n){return this.requireObjectSet(n),this.delete(["entity",t],n)}count(t,n={}){return this.post(["entity",t,"fn","count"],n)}exists(t,n={}){return this.post(["entity",t,"fn","exists"],n)}}class _be extends Tw{getDefaultOptions(){return{basepath:"/api/media",upload_fetcher:fetch,init:{}}}listFiles(){return this.get(["files"])}getFile(t){return this.get(["file",t],void 0,{headers:{Accept:"*/*"}})}async getFileStream(t){const{res:n}=await this.getFile(t);if(!n.ok||!n.body)throw new Error("Failed to fetch file");return n.body}async download(t){const{res:n}=await this.getFile(t);if(!n.ok||!n.body)throw new Error("Failed to fetch file");return await n.blob()}getFileUploadUrl(t){return t?this.getUrl(`/upload/${t.path}`):this.getUrl("/upload")}getEntityUploadUrl(t,n,r){return this.getUrl(`/entity/${t}/${n}/${r}`)}getUploadHeaders(){return this.options.token_transport==="header"&&this.options.token?new Headers({Authorization:`Bearer ${this.options.token}`}):new Headers}uploadFile(t,n){const r={"Content-Type":"application/octet-stream",...n?._init?.headers||{}};let o=n?.filename||"";try{typeof t.type<"u"&&(r["Content-Type"]=t.type),n?.filename||(o=t.name)}catch{}o&&o.length>0&&o.includes("/")&&(o=o.split("/").pop()||"");const i={...this.options.init,...n?._init||{},headers:r};if(n?.path)return this.request(n.path,n?.query,{...i,body:t,method:"POST"});if(!o||o.length===0)throw new Error("Invalid filename");return this.request(n?.path??["upload",o],n?.query,{...i,body:t,method:"POST"})}async upload(t,n={}){if(t instanceof Request||typeof t=="string"){const o=await(n.fetcher??this.options.upload_fetcher)(t);if(!o.ok||!o.body)throw new Error("Failed to fetch file");return this.uploadFile(o.body,n)}else if(t instanceof Response){if(!t.body)throw new Error("Invalid response");return this.uploadFile(t.body,{...n??{},_init:{...n._init??{},headers:{...n._init?.headers??{},"Content-Type":t.headers.get("Content-Type")||"application/octet-stream"}}})}return this.uploadFile(t,n)}async uploadToEntity(t,n,r,o,i){const s=i?.overwrite!==void 0?{overwrite:i.overwrite}:void 0;return this.upload(o,{...i,path:["entity",t,n,r],query:s})}deleteFile(t){return this.delete(["file",t])}}class Cbe extends Tw{getDefaultOptions(){return{basepath:"/api/system"}}readConfig(){return this.get("config")}readSchema(t){return this.get("schema",{config:t?.config?1:0,secrets:t?.secrets?1:0,fresh:t?.fresh?1:0})}setConfig(t,n,r){return this.post(["config","set",t].join("/")+`?force=${r?1:0}`,n)}addConfig(t,n,r){return this.post(["config","add",t,n],r)}patchConfig(t,n,r){return this.patch(["config","patch",t,n],r)}overwriteConfig(t,n,r){return this.put(["config","overwrite",t,n],r)}removeConfig(t,n){return this.delete(["config","remove",t,n])}permissions(){return this.get("permissions")}}class bB{constructor(t={}){this.options=t,this.verified=t.verified===!0,"request"in t&&t.request?(this.options.host=t.host??new URL(t.request.url).origin,this.options.headers=t.headers??t.request.headers,this.extractToken()):"token"in t&&t.token?(this.token_transport="header",this.updateToken(t.token,{trigger:!1})):"user"in t&&t.user?(this.token_transport="none",this.user=t.user,this.verified=t.verified!==!1):this.extractToken(),this.buildApis()}token;user;verified=!1;token_transport="header";system;data;auth;media;get fetcher(){return this.options.fetcher??fetch}get baseUrl(){return this.options.host??"http://localhost"}get tokenKey(){return this.options.key??"auth"}extractToken(){if(this.verified=!1,this.options.headers){const t=Obe(this.options.headers.get("cookie"),"auth");if(t){this.token_transport="cookie",this.updateToken(t);return}const n=this.options.headers.get("authorization")?.replace("Bearer ","");if(n){this.token_transport="header",this.updateToken(n);return}}else this.storage&&this.storage.getItem(this.tokenKey).then(t=>{this.token_transport="header",this.updateToken(t?String(t):void 0,{verified:!0,trigger:!1})})}get storage(){const t=this.options.storage;return new Proxy({},{get(n,r){return(...o)=>{const i=t?t[r](...o):void 0;return i instanceof Promise?i:{then:s=>s(i)}}}})}updateToken(t,n){this.token=t,this.verified=n?.verified===!0,t?this.user=mo(wye(t).payload,["iat","iss","exp"]):this.user=void 0;const r=()=>{n?.trigger!==!1&&this.options.onAuthStateChange?.(this.getAuthState())};if(this.storage){const o=this.tokenKey;t?this.storage.setItem(o,t).then(r):this.storage.removeItem(o).then(r)}else n?.trigger!==!1&&r();n?.rebuild&&this.buildApis()}markAuthVerified(t){return this.verified=t,this.options.onAuthStateChange?.(this.getAuthState()),this}isAuthVerified(){return this.verified}getAuthState(){return{token:this.token,user:this.user,verified:this.verified}}isAuthenticated(){const{token:t,user:n}=this.getAuthState();return!!t&&!!n}async getVerifiedAuthState(){return await this.verifyAuth(),this.getAuthState()}async verifyAuth(){try{const{ok:t,data:n}=await this.auth.me(),r=n?.user;if(!t||!r)throw new Error;this.user=r}catch{this.updateToken(void 0)}finally{this.markAuthVerified(!0)}}getUser(){return this.user||null}getParams(){return Object.freeze({host:this.baseUrl,token:this.token,headers:this.options.headers,token_transport:this.token_transport,verbose:this.options.verbose,credentials:this.options.credentials})}buildApis(){const t=this.getParams(),n=this.options.fetcher;this.system=new Cbe(t,n),this.data=new Nbe({...t,...this.options.data},n),this.auth=new Ebe({...t,...this.options.auth,onTokenUpdate:(r,o)=>{this.updateToken(r,{rebuild:!0,verified:o,trigger:!0}),this.options.auth?.onTokenUpdate?.(r)}},n),this.media=new _be({...t,...this.options.media},n)}}function Obe(e,t){if(!e)return null;for(const n of e.split("; ")){const[r,o]=n.split("=");if(r===t&&o)return decodeURIComponent(o)}return null}const AA=w.createContext(void 0),jbe=({children:e,host:t,baseUrl:n=t,api:r,...o})=>{const i=Rw(),s=vB();let a=n??s?.baseUrl??"",c;if(i&&(c=i.user),!a)try{a=window.location.origin}catch{}const u={user:c,...o,host:a},f=w.useMemo(()=>r??new bB({...u,verbose:ir(),onAuthStateChange:y=>{o.onAuthStateChange?.(y),(!p?.token||y.token!==p?.token)&&g(y)}}),[r,JSON.stringify(u)]),[p,g]=w.useState(f.getAuthState());return h.jsx(AA.Provider,{value:{baseUrl:f.baseUrl,api:f,authState:p},children:e})},ss=e=>{const t=w.useContext(AA);if(!t?.api||e)return console.info("creating new api",{host:e}),new bB({host:""});if(!t)throw new Error("useApi must be used within a ClientProvider");return t.api},vB=()=>w.useContext(AA);function Rw(){const e={logout_route:"/api/auth/logout",admin_basepath:""};return typeof window<"u"&&window.__BKND__?{...e,...window.__BKND__}:e}var D2={exports:{}},I2={};/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var N6;function Abe(){if(N6)return I2;N6=1;var e=dc();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(p,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),x=v[0].inst,S=v[1];return i(function(){x.value=y,x.getSnapshot=g,c(x)&&S({inst:x})},[p,y,g]),o(function(){return c(x)&&S({inst:x}),p(function(){c(x)&&S({inst:x})})},[p]),s(y),y}function c(p){var g=p.getSnapshot;p=p.value;try{var y=g();return!n(p,y)}catch{return!0}}function u(p,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return I2.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,I2}var _6;function xB(){return _6||(_6=1,D2.exports=Abe()),D2.exports}var TA=xB();const wB=0,SB=1,EB=2,C6=3;var O6=Object.prototype.hasOwnProperty;function K_(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&K_(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(O6.call(e,n)&&++r&&!O6.call(t,n)||!(n in t)||!K_(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const ws=new WeakMap,Jl=()=>{},Kn=Jl(),X_=Object,mt=e=>e===Kn,Di=e=>typeof e=="function",lc=(e,t)=>({...e,...t}),NB=e=>Di(e.then),L2={},tb={},$A="undefined",Qg=typeof window!=$A,Q_=typeof document!=$A,Tbe=Qg&&"Deno"in window,$be=()=>Qg&&typeof window.requestAnimationFrame!=$A,Fl=(e,t)=>{const n=ws.get(e);return[()=>!mt(t)&&e.get(t)||L2,r=>{if(!mt(t)){const o=e.get(t);t in tb||(tb[t]=o),n[5](t,lc(o,r),o||L2)}},n[6],()=>!mt(t)&&t in tb?tb[t]:!mt(t)&&e.get(t)||L2]};let Z_=!0;const Rbe=()=>Z_,[eC,tC]=Qg&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Jl,Jl],kbe=()=>{const e=Q_&&document.visibilityState;return mt(e)||e!=="hidden"},Mbe=e=>(Q_&&document.addEventListener("visibilitychange",e),eC("focus",e),()=>{Q_&&document.removeEventListener("visibilitychange",e),tC("focus",e)}),Pbe=e=>{const t=()=>{Z_=!0,e()},n=()=>{Z_=!1};return eC("online",t),eC("offline",n),()=>{tC("online",t),tC("offline",n)}},Dbe={isOnline:Rbe,isVisible:kbe},Ibe={initFocus:Mbe,initReconnect:Pbe},j6=!Ne.useId,tg=!Qg||Tbe,Lbe=e=>$be()?window.requestAnimationFrame(e):setTimeout(e,1),Bb=tg?w.useEffect:w.useLayoutEffect,F2=typeof navigator<"u"&&navigator.connection,A6=!tg&&F2&&(["slow-2g","2g"].includes(F2.effectiveType)||F2.saveData),nb=new WeakMap,Fbe=e=>X_.prototype.toString.call(e),z2=(e,t)=>e===`[object ${t}]`;let zbe=0;const nC=e=>{const t=typeof e,n=Fbe(e),r=z2(n,"Date"),o=z2(n,"RegExp"),i=z2(n,"Object");let s,a;if(X_(e)===e&&!r&&!o){if(s=nb.get(e),s)return s;if(s=++zbe+"~",nb.set(e,s),Array.isArray(e)){for(s="@",a=0;a<e.length;a++)s+=nC(e[a])+",";nb.set(e,s)}if(i){s="#";const c=X_.keys(e).sort();for(;!mt(a=c.pop());)mt(e[a])||(s+=a+":"+nC(e[a])+",");nb.set(e,s)}}else s=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return s},ng=e=>{if(Di(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?nC(e):"",[e,t]};let Bbe=0;const rC=()=>++Bbe;async function _B(...e){const[t,n,r,o]=e,i=lc({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let s=i.populateCache;const a=i.rollbackOnError;let c=i.optimisticData;const u=g=>typeof a=="function"?a(g):a!==!1,f=i.throwOnError;if(Di(n)){const g=n,y=[],v=t.keys();for(const x of v)!/^\$(inf|sub)\$/.test(x)&&g(t.get(x)._k)&&y.push(x);return Promise.all(y.map(p))}return p(n);async function p(g){const[y]=ng(g);if(!y)return;const[v,x]=Fl(t,y),[S,E,C,_]=ws.get(t),j=()=>{const M=S[y];return(Di(i.revalidate)?i.revalidate(v().data,g):i.revalidate!==!1)&&(delete C[y],delete _[y],M&&M[0])?M[0](EB).then(()=>v().data):v().data};if(e.length<3)return j();let A=r,T,k=!1;const R=rC();E[y]=[R,0];const V=!mt(c),H=v(),F=H.data,B=H._c,U=mt(B)?F:B;if(V&&(c=Di(c)?c(U,F):c,x({data:c,_c:U})),Di(A))try{A=A(U)}catch(M){T=M,k=!0}if(A&&NB(A))if(A=await A.catch(M=>{T=M,k=!0}),R!==E[y][0]){if(k)throw T;return A}else k&&V&&u(T)&&(s=!0,x({data:U,_c:Kn}));if(s&&!k)if(Di(s)){const M=s(A,U);x({data:M,error:Kn,_c:Kn})}else x({data:A,error:Kn,_c:Kn});if(E[y][1]=rC(),Promise.resolve(j()).then(()=>{x({_c:Kn})}),k){if(f)throw T;return}return A}}const T6=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Vbe=(e,t)=>{if(!ws.has(e)){const n=lc(Ibe,t),r=Object.create(null),o=_B.bind(Kn,e);let i=Jl;const s=Object.create(null),a=(f,p)=>{const g=s[f]||[];return s[f]=g,g.push(p),()=>g.splice(g.indexOf(p),1)},c=(f,p,g)=>{e.set(f,p);const y=s[f];if(y)for(const v of y)v(p,g)},u=()=>{if(!ws.has(e)&&(ws.set(e,[r,Object.create(null),Object.create(null),Object.create(null),o,c,a]),!tg)){const f=n.initFocus(setTimeout.bind(Kn,T6.bind(Kn,r,wB))),p=n.initReconnect(setTimeout.bind(Kn,T6.bind(Kn,r,SB)));i=()=>{f&&f(),p&&p(),ws.delete(e)}}};return u(),[e,o,u,i]}return[e,ws.get(e)[4]]},Ube=(e,t,n,r,o)=>{const i=n.errorRetryCount,s=o.retryCount,a=~~((Math.random()+.5)*(1<<(s<8?s:8)))*n.errorRetryInterval;!mt(i)&&s>i||setTimeout(r,a,o)},Hbe=K_,[RA,kA]=Vbe(new Map),qbe=lc({onLoadingSlow:Jl,onSuccess:Jl,onError:Jl,onErrorRetry:Ube,onDiscarded:Jl,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:A6?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:A6?5e3:3e3,compare:Hbe,isPaused:()=>!1,cache:RA,mutate:kA,fallback:{}},Dbe),Wbe=(e,t)=>{const n=lc(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:s}=t;r&&i&&(n.use=r.concat(i)),o&&s&&(n.fallback=lc(o,s))}return n},Gbe=w.createContext({}),CB="$inf$",OB=Qg&&window.__SWR_DEVTOOLS_USE__,Jbe=OB?window.__SWR_DEVTOOLS_USE__:[],Ybe=()=>{OB&&(window.__SWR_DEVTOOLS_REACT__=Ne)},jB=e=>Di(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],AB=()=>{const e=w.useContext(Gbe);return w.useMemo(()=>lc(qbe,e),[e])},Kbe=e=>(t,n,r)=>e(t,n&&((...i)=>{const[s]=ng(t),[,,,a]=ws.get(RA);if(s.startsWith(CB))return n(...i);const c=a[s];return mt(c)?n(...i):(delete a[s],c)}),r),Xbe=Jbe.concat(Kbe),Qbe=e=>function(...n){const r=AB(),[o,i,s]=jB(n),a=Wbe(r,s);let c=e;const{use:u}=a,f=(u||[]).concat(Xbe);for(let p=f.length;p--;)c=f[p](c);return c(o,i||a.fetcher||null,a)},Zbe=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o>=0&&(r[o]=r[r.length-1],r.pop())}},eve=(e,t)=>(...n)=>{const[r,o,i]=jB(n),s=(i.use||[]).concat(t);return e(r,o,{...i,use:s})};Ybe();const B2=Ne.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),V2={dedupe:!0},$6=Promise.resolve(Kn),tve=(e,t,n)=>{const{cache:r,compare:o,suspense:i,fallbackData:s,revalidateOnMount:a,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:f,refreshWhenOffline:p,keepPreviousData:g}=n,[y,v,x,S]=ws.get(r),[E,C]=ng(e),_=w.useRef(!1),j=w.useRef(!1),A=w.useRef(E),T=w.useRef(t),k=w.useRef(n),R=()=>k.current,V=()=>R().isVisible()&&R().isOnline(),[H,F,B,U]=Fl(r,E),M=w.useRef({}).current,z=mt(s)?mt(n.fallback)?Kn:n.fallback[E]:s,$=(Ee,Re)=>{for(const Me in M){const ze=Me;if(ze==="data"){if(!o(Ee[ze],Re[ze])&&(!mt(Ee[ze])||!o(ie,Re[ze])))return!1}else if(Re[ze]!==Ee[ze])return!1}return!0},L=w.useMemo(()=>{const Ee=!E||!t?!1:mt(a)?R().isPaused()||i?!1:c!==!1:a,Re=G=>{const re=lc(G);return delete re._k,Ee?{isValidating:!0,isLoading:!0,...re}:re},Me=H(),ze=U(),ve=Re(Me),Ce=Me===ze?ve:Re(ze);let Ae=ve;return[()=>{const G=Re(H());return $(G,Ae)?(Ae.data=G.data,Ae.isLoading=G.isLoading,Ae.isValidating=G.isValidating,Ae.error=G.error,Ae):(Ae=G,G)},()=>Ce]},[r,E]),P=TA.useSyncExternalStore(w.useCallback(Ee=>B(E,(Re,Me)=>{$(Me,Re)||Ee()}),[r,E]),L[0],L[1]),q=!_.current,Y=y[E]&&y[E].length>0,D=P.data,W=mt(D)?z&&NB(z)?B2(z):z:D,K=P.error,Q=w.useRef(W),ie=g?mt(D)?mt(Q.current)?W:Q.current:D:W,pe=Y&&!mt(K)?!1:q&&!mt(a)?a:R().isPaused()?!1:i?mt(W)?!1:c:mt(W)||c,ue=!!(E&&t&&q&&pe),se=mt(P.isValidating)?ue:P.isValidating,me=mt(P.isLoading)?ue:P.isLoading,xe=w.useCallback(async Ee=>{const Re=T.current;if(!E||!Re||j.current||R().isPaused())return!1;let Me,ze,ve=!0;const Ce=Ee||{},Ae=!x[E]||!Ce.dedupe,G=()=>j6?!j.current&&E===A.current&&_.current:E===A.current,re={isValidating:!1,isLoading:!1},ne=()=>{F(re)},ce=()=>{const Z=x[E];Z&&Z[1]===ze&&delete x[E]},te={isValidating:!0};mt(H().data)&&(te.isLoading=!0);try{if(Ae&&(F(te),n.loadingTimeout&&mt(H().data)&&setTimeout(()=>{ve&&G()&&R().onLoadingSlow(E,n)},n.loadingTimeout),x[E]=[Re(C),rC()]),[Me,ze]=x[E],Me=await Me,Ae&&setTimeout(ce,n.dedupingInterval),!x[E]||x[E][1]!==ze)return Ae&&G()&&R().onDiscarded(E),!1;re.error=Kn;const Z=v[E];if(!mt(Z)&&(ze<=Z[0]||ze<=Z[1]||Z[1]===0))return ne(),Ae&&G()&&R().onDiscarded(E),!1;const de=H().data;re.data=o(de,Me)?de:Me,Ae&&G()&&R().onSuccess(Me,E,n)}catch(Z){ce();const de=R(),{shouldRetryOnError:Te}=de;de.isPaused()||(re.error=Z,Ae&&G()&&(de.onError(Z,E,de),(Te===!0||Di(Te)&&Te(Z))&&(!R().revalidateOnFocus||!R().revalidateOnReconnect||V())&&de.onErrorRetry(Z,E,de,$e=>{const Ke=y[E];Ke&&Ke[0]&&Ke[0](C6,$e)},{retryCount:(Ce.retryCount||0)+1,dedupe:!0})))}return ve=!1,ne(),!0},[E,r]),je=w.useCallback((...Ee)=>_B(r,A.current,...Ee),[]);if(Bb(()=>{T.current=t,k.current=n,mt(D)||(Q.current=D)}),Bb(()=>{if(!E)return;const Ee=xe.bind(Kn,V2);let Re=0;R().revalidateOnFocus&&(Re=Date.now()+R().focusThrottleInterval);const ze=Zbe(E,y,(ve,Ce={})=>{if(ve==wB){const Ae=Date.now();R().revalidateOnFocus&&Ae>Re&&V()&&(Re=Ae+R().focusThrottleInterval,Ee())}else if(ve==SB)R().revalidateOnReconnect&&V()&&Ee();else{if(ve==EB)return xe();if(ve==C6)return xe(Ce)}});return j.current=!1,A.current=E,_.current=!0,F({_k:C}),pe&&(x[E]||(mt(W)||tg?Ee():Lbe(Ee))),()=>{j.current=!0,ze()}},[E]),Bb(()=>{let Ee;function Re(){const ze=Di(u)?u(H().data):u;ze&&Ee!==-1&&(Ee=setTimeout(Me,ze))}function Me(){!H().error&&(f||R().isVisible())&&(p||R().isOnline())?xe(V2).then(Re):Re()}return Re(),()=>{Ee&&(clearTimeout(Ee),Ee=-1)}},[u,f,p,E]),w.useDebugValue(ie),i){const Ee=E&&mt(W);if(!j6&&tg&&Ee)throw new Error("Fallback data is required when using Suspense in SSR.");Ee&&(T.current=t,k.current=n,j.current=!1);const Re=S[E],Me=!mt(Re)&&Ee?je(Re):$6;if(B2(Me),!mt(K)&&Ee)throw K;const ze=Ee?xe(V2):$6;!mt(ie)&&Ee&&(ze.status="fulfilled",ze.value=!0),B2(ze)}return{mutate:je,get data(){return M.data=!0,ie},get error(){return M.error=!0,K},get isValidating(){return M.isValidating=!0,se},get isLoading(){return M.isLoading=!0,me}}},MA=Qbe(tve),nve=()=>{},rve=nve(),oC=Object,R6=e=>e===rve,ove=e=>typeof e=="function",rb=new WeakMap,ive=e=>oC.prototype.toString.call(e),U2=(e,t)=>e===`[object ${t}]`;let sve=0;const iC=e=>{const t=typeof e,n=ive(e),r=U2(n,"Date"),o=U2(n,"RegExp"),i=U2(n,"Object");let s,a;if(oC(e)===e&&!r&&!o){if(s=rb.get(e),s)return s;if(s=++sve+"~",rb.set(e,s),Array.isArray(e)){for(s="@",a=0;a<e.length;a++)s+=iC(e[a])+",";rb.set(e,s)}if(i){s="#";const c=oC.keys(e).sort();for(;!R6(a=c.pop());)R6(e[a])||(s+=a+":"+iC(e[a])+",");rb.set(e,s)}}else s=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return s},ave=e=>{if(ove(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?iC(e):"",[e,t]},lve=e=>ave(e?e(0,null):null)[0],H2=Promise.resolve(),cve=e=>(t,n,r)=>{const o=w.useRef(!1),{cache:i,initialSize:s=1,revalidateAll:a=!1,persistSize:c=!1,revalidateFirstPage:u=!0,revalidateOnMount:f=!1,parallel:p=!1}=r,[,,,g]=ws.get(RA);let y;try{y=lve(t),y&&(y=CB+y)}catch{}const[v,x,S]=Fl(i,y),E=w.useCallback(()=>mt(v()._l)?s:v()._l,[i,y,s]);TA.useSyncExternalStore(w.useCallback(R=>y?S(y,()=>{R()}):()=>{},[i,y]),E,E);const C=w.useCallback(()=>{const R=v()._l;return mt(R)?s:R},[y,s]),_=w.useRef(C());Bb(()=>{if(!o.current){o.current=!0;return}y&&x({_l:c?_.current:C()})},[y,i]);const j=f&&!o.current,A=e(y,async R=>{const V=v()._i,H=v()._r;x({_r:Kn});const F=[],B=C(),[U]=Fl(i,R),M=U().data,z=[];let $=null;for(let L=0;L<B;++L){const[P,q]=ng(t(L,p?null:$));if(!P)break;const[Y,D]=Fl(i,P);let W=Y().data;const K=a||V||mt(W)||u&&!L&&!mt(M)||j||M&&!mt(M[L])&&!r.compare(M[L],W);if(n&&(typeof H=="function"?H(W,q):K)){const Q=async()=>{if(!(P in g))W=await n(q);else{const pe=g[P];delete g[P],W=await pe}D({data:W,_k:q}),F[L]=W};p?z.push(Q):await Q()}else F[L]=W;p||($=W)}return p&&await Promise.all(z.map(L=>L())),x({_i:Kn}),F},r),T=w.useCallback(function(R,V){const H=typeof V=="boolean"?{revalidate:V}:V||{},F=H.revalidate!==!1;return y?(F&&(mt(R)?x({_i:!0,_r:H.revalidate}):x({_i:!1,_r:H.revalidate})),arguments.length?A.mutate(R,{...H,revalidate:F}):A.mutate()):H2},[y,i]),k=w.useCallback(R=>{if(!y)return H2;const[,V]=Fl(i,y);let H;if(Di(R)?H=R(C()):typeof R=="number"&&(H=R),typeof H!="number")return H2;V({_l:H}),_.current=H;const F=[],[B]=Fl(i,y);let U=null;for(let M=0;M<H;++M){const[z]=ng(t(M,U)),[$]=Fl(i,z),L=z?$().data:Kn;if(mt(L))return T(B().data);F.push(L),U=L}return T(F)},[y,i,T,C]);return{size:C(),setSize:k,mutate:T,get data(){return A.data},get error(){return A.error},get isValidating(){return A.isValidating},get isLoading(){return A.isLoading}}},uve=eve(MA,cve),Zg=(e,t)=>{const n=ss(),r=e(n),o=t?.refine??(c=>c),i=()=>r.execute().then(o),s=r.key();return{...MA(t?.enabled===!1?null:s,i,t),promise:r,key:s,api:n}},dve=(e,t)=>{const[n,r]=w.useState(!1),o=ss(),i=u=>e(o,u),s=t?.refine??(u=>u),a=uve((u,f)=>u>0&&f&&f.length<(t?.pageSize??0)?(r(!0),null):i(u).request.url,u=>new $w(new Request(u),{fetcher:o.fetcher},s).execute(),{revalidateFirstPage:!1}),c=a.data?[].concat(...a.data):[];return{...a,_data:a.data,data:c,endReached:n,promise:i(a.size),key:i(a.size).key(),api:o}},PA=e=>{const t=AB().mutate,n=ss();return async r=>{let o="";return typeof r=="string"?o=r:typeof r=="function"&&(o=r(n).key()),t(i=>typeof i=="string"&&i.startsWith(o))}},k6=new Map,fve=e=>(t,n,r)=>{if(typeof t=="string"){if(k6.has(t))return e(t,n,{...r,revalidateOnMount:!1});const o=e(t,n,r);return o.data&&k6.set(t,!0),o}return e(t,n,r)};class ob extends Error{constructor(t,n){let r=n;"error"in t&&(r=t.error,n&&(r=`${n}: ${r}`)),super(r??"UseEntityApiError"),this.response=t}}const hve=(e,t)=>{const n=ss().data;return{create:async r=>{const o=await n.createOne(e,r);if(!o.ok)throw new ob(o,`Failed to create entity "${e}"`);return o},read:async r=>{const o=t?await n.readOne(e,t,r):await n.readMany(e,r);if(!o.ok)throw new ob(o,`Failed to read entity "${e}"`);return o},update:async(r,o=t)=>{if(!o)throw new Error("id is required");const i=await n.updateOne(e,o,r);if(!i.ok)throw new ob(i,`Failed to update entity "${e}"`);return i},_delete:async(r=t)=>{if(!r)throw new Error("id is required");const o=await n.deleteOne(e,r);if(!o.ok)throw new ob(o,`Failed to delete entity "${e}"`);return o}}};function sC(e,t,n,r){return"/"+[...e.options?.basepath?.split("/")??[],t,...n?[n]:[]].filter(Boolean).join("/")+(r?"?"+tw(r):"")}const kw=(e,t,n,r)=>{const o=ss().data,i=sC(o,e,t,n),{read:s,...a}=hve(e,t),c=()=>s(n??{}),u=MA(r?.enabled===!1?null:i,c,{revalidateOnFocus:!1,keepPreviousData:!0,...r}),f=async g=>{const y=sC(o,e,g);return kA(v=>typeof v=="string"&&v.startsWith(y),void 0,{revalidate:!0})},p=Zx(a,g=>async(...y)=>{const v=await g(...y);return r?.revalidateOnMutate!==!1&&await f(),v});return{...u,...p,mutate:f,mutateRaw:u.mutate,api:o,key:i}};async function pve(e,t,n,r){function o(s,a){return typeof s<"u"&&typeof a<"u"&&"id"in s&&s.id===n?{...s,...a}:s}const i=sC(e,t);return kA(s=>typeof s=="string"&&s.startsWith(i),async s=>{if(!(typeof s>"u"))return Array.isArray(s)?s.map(a=>o(a,r)):o(s,r)},{revalidate:!1})}const mve=(e,t,n)=>{const{data:r,...o}=kw(e,t,void 0,{...n,enabled:!1});return{...o,mutate:(s,a)=>pve(o.api,e,s,a)}},DA=e=>{const t=ss(e?.baseUrl),n=PA(),{authState:r}=vB(),o=r?.verified??!1;async function i(f){return(await t.auth.login("password",f)).data}async function s(f){return(await t.auth.register("password",f)).data}function a(f){t.updateToken(f)}async function c(){await t.auth.logout(),await n()}async function u(){await t.verifyAuth(),await n()}return{data:r,user:r?.user,token:r?.token,verified:o,login:i,register:s,logout:c,setToken:a,verify:u,local:!!t.options.storage}};function gve({api:e,setSchema:t,reloadSchema:n}){async function r(o,i,s,a){const c={id:"schema-"+[o,i,a].join("-"),position:"top-right",autoClose:3e3};return s.success?(console.log("update config",o,i,a,s.body),s.body.success&&t(u=>u&&{...u,config:{...u.config,[i]:s.config}}),ci.show({...c,title:`Config updated: ${Io(i)}`,color:"blue",message:`Operation ${o.toUpperCase()} at ${i}${a?"."+a:""}`})):ci.show({...c,title:`Config Update failed: ${Io(i)}${a?"."+a:""}`,color:"red",withCloseButton:!0,autoClose:!1,message:s.error??"Failed to complete config update"}),s.success}return{reload:n,set:async(o,i,s)=>{const a=await e.system.setConfig(o,i,s);return await r("set",o,a)},patch:async(o,i,s)=>{const a=await e.system.patchConfig(o,i,s);return await r("patch",o,a,i)},overwrite:async(o,i,s)=>{const a=await e.system.overwriteConfig(o,i,s);return await r("overwrite",o,a,i)},add:async(o,i,s)=>{const a=await e.system.addConfig(o,i,s);return await r("add",o,a,i)},remove:async(o,i)=>{const s=await e.system.removeConfig(o,i);return await r("remove",o,s,i)}}}class yve{constructor(t,n={}){this.appJson=t,this._options=n,this._entities=Object.entries(this.appJson.data.entities??{}).map(([r,o])=>NA(r,o)),this._relations=Object.entries(this.appJson.data.relations??{}).map(([,r])=>Kz(r,this.entity.bind(this)));for(const[r,o]of Object.entries(this.appJson.flows.flows??{})){const i=Xg.fromObject(r,o,eB);this._flows.push(i)}}_entities=[];_relations=[];_flows=[];get entities(){return this._entities}entity(t){const n=typeof t=="string"?t:t.name,r=this._entities.find(o=>o.name===n);if(!r)throw new Error(`Entity "${n}" not found`);return r}get relations(){return new V7(this._relations)}get flows(){return this._flows}get config(){return this.appJson}get options(){return{basepath:"",logo_return_path:"/",...this._options}}getSettingsPath(t=[]){return[`~/${this.options.basepath}/settings`.replace(/\/+/g,"/"),...t].join("/")}getAbsolutePath(t){const{basepath:n}=this.options;return(t?`~/${n}/${t}`:`~/${n}`).replace(/\/+/g,"/")}getAuthConfig(){return this.appJson.auth}}/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/var bve={outline:{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"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const kt=(e,t,n,r)=>{const o=w.forwardRef(({color:i="currentColor",size:s=24,stroke:a=2,title:c,className:u,children:f,...p},g)=>w.createElement("svg",{ref:g,...bve[e],width:s,height:s,className:["tabler-icon",`tabler-icon-${t}`,u].join(" "),...e==="filled"?{fill:i}:{strokeWidth:a,stroke:i},...p},[c&&w.createElement("title",{key:"svg-title"},c),...r.map(([y,v])=>w.createElement(y,v)),...Array.isArray(f)?f:[f]]));return o.displayName=`${n}`,o};/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const vve=[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l12 0",key:"svg-2"}]],IA=kt("outline","align-justified","AlignJustified",vve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const xve=[["path",{d:"M4 13h5",key:"svg-0"}],["path",{d:"M12 16v-8h3a2 2 0 0 1 2 2v1a2 2 0 0 1 -2 2h-3",key:"svg-1"}],["path",{d:"M20 8v8",key:"svg-2"}],["path",{d:"M9 16v-5.5a2.5 2.5 0 0 0 -5 0v5.5",key:"svg-3"}]],wve=kt("outline","api","Api",xve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Sve=[["path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11",key:"svg-0"}]],Eve=kt("outline","bolt","Bolt",Sve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Nve=[["path",{d:"M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0",key:"svg-0"}],["path",{d:"M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0",key:"svg-1"}],["path",{d:"M3 6l0 13",key:"svg-2"}],["path",{d:"M12 6l0 13",key:"svg-3"}],["path",{d:"M21 6l0 13",key:"svg-4"}]],_ve=kt("outline","book","Book",Nve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Cve=[["path",{d:"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5",key:"svg-0"}],["path",{d:"M12 12l8 -4.5",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}],["path",{d:"M12 12l-8 -4.5",key:"svg-3"}]],Ove=kt("outline","box","Box",Cve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const jve=[["path",{d:"M17 18.5a15.198 15.198 0 0 1 -7.37 1.44a14.62 14.62 0 0 1 -6.63 -2.94",key:"svg-0"}],["path",{d:"M19.5 21c.907 -1.411 1.451 -3.323 1.5 -5c-1.197 -.773 -2.577 -.935 -4 -1",key:"svg-1"}],["path",{d:"M3 11v-4.5a1.5 1.5 0 0 1 3 0v4.5",key:"svg-2"}],["path",{d:"M3 9h3",key:"svg-3"}],["path",{d:"M9 5l1.2 6l1.8 -4l1.8 4l1.2 -6",key:"svg-4"}],["path",{d:"M18 10.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75",key:"svg-5"}]],Ave=kt("outline","brand-aws","BrandAws",jve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Tve=[["path",{d:"M13.031 7.007c2.469 -.007 3.295 1.293 3.969 2.993c4 0 4.994 3.825 5 6h-20c-.001 -1.64 1.36 -2.954 3 -3c0 -1.5 1 -3 3 -3c.66 -1.942 2.562 -2.986 5.031 -2.993z",key:"svg-0"}],["path",{d:"M12 13h6",key:"svg-1"}],["path",{d:"M17 10l-2.5 6",key:"svg-2"}]],$ve=kt("outline","brand-cloudflare","BrandCloudflare",Tve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Rve=[["path",{d:"M9 9v-1a3 3 0 0 1 6 0v1",key:"svg-0"}],["path",{d:"M8 9h8a6 6 0 0 1 1 3v3a5 5 0 0 1 -10 0v-3a6 6 0 0 1 1 -3",key:"svg-1"}],["path",{d:"M3 13l4 0",key:"svg-2"}],["path",{d:"M17 13l4 0",key:"svg-3"}],["path",{d:"M12 20l0 -6",key:"svg-4"}],["path",{d:"M4 19l3.35 -2",key:"svg-5"}],["path",{d:"M20 19l-3.35 -2",key:"svg-6"}],["path",{d:"M4 7l3.75 2.4",key:"svg-7"}],["path",{d:"M20 7l-3.75 2.4",key:"svg-8"}]],TB=kt("outline","bug","Bug",Rve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const kve=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],Mve=kt("outline","chevron-down","ChevronDown",kve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Pve=[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]],Dve=kt("outline","chevron-up","ChevronUp",Pve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Ive=[["path",{d:"M9.183 6.117a6 6 0 1 0 4.511 3.986",key:"svg-0"}],["path",{d:"M14.813 17.883a6 6 0 1 0 -4.496 -3.954",key:"svg-1"}]],LA=kt("outline","circles-relation","CirclesRelation",Ive);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Lve=[["path",{d:"M6.657 18c-2.572 0 -4.657 -2.007 -4.657 -4.483c0 -2.475 2.085 -4.482 4.657 -4.482c.393 -1.762 1.794 -3.2 3.675 -3.773c1.88 -.572 3.956 -.193 5.444 1c1.488 1.19 2.162 3.007 1.77 4.769h.99c1.913 0 3.464 1.56 3.464 3.486c0 1.927 -1.551 3.487 -3.465 3.487h-11.878",key:"svg-0"}]],Fve=kt("outline","cloud","Cloud",Lve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const zve=[["path",{d:"M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 6v6a8 3 0 0 0 16 0v-6",key:"svg-1"}],["path",{d:"M4 12v6a8 3 0 0 0 16 0v-6",key:"svg-2"}]],Ru=kt("outline","database","Database",zve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Bve=[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]],Vve=kt("outline","external-link","ExternalLink",Bve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Uve=[["path",{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]],Hve=kt("outline","grip-vertical","GripVertical",Uve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const qve=[["path",{d:"M10 3h4v4h-4z",key:"svg-0"}],["path",{d:"M3 17h4v4h-4z",key:"svg-1"}],["path",{d:"M17 17h4v4h-4z",key:"svg-2"}],["path",{d:"M7 17l5 -4l5 4",key:"svg-3"}],["path",{d:"M12 7l0 6",key:"svg-4"}]],Wve=kt("outline","hierarchy-2","Hierarchy2",qve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Gve=[["path",{d:"M5 12l-2 0l9 -9l9 9l-2 0",key:"svg-0"}],["path",{d:"M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7",key:"svg-1"}],["path",{d:"M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6",key:"svg-2"}]],Jve=kt("outline","home","Home",Gve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Yve=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 9h.01",key:"svg-1"}],["path",{d:"M11 12h1v4h1",key:"svg-2"}]],$B=kt("outline","info-circle","InfoCircle",Yve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Kve=[["path",{d:"M10.17 6.159l2.316 -2.316a2.877 2.877 0 0 1 4.069 0l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.33 2.33",key:"svg-0"}],["path",{d:"M14.931 14.948a2.863 2.863 0 0 1 -1.486 -.79l-.301 -.302l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.172a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.172a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.863 2.863 0 0 1 -.794 -1.504",key:"svg-1"}],["path",{d:"M15 9h.01",key:"svg-2"}],["path",{d:"M3 3l18 18",key:"svg-3"}]],Xve=kt("outline","key-off","KeyOff",Kve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const Qve=[["path",{d:"M7 3m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 7.26a2.005 2.005 0 0 0 -1.012 1.737v10c0 1.1 .9 2 2 2h10c.75 0 1.158 -.385 1.5 -1",key:"svg-1"}],["path",{d:"M11 10h6",key:"svg-2"}],["path",{d:"M14 7v6",key:"svg-3"}]],Zve=kt("outline","library-plus","LibraryPlus",Qve);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const exe=[["path",{d:"M4 8v-2c0 -.554 .225 -1.055 .588 -1.417",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2c.55 0 1.05 -.222 1.41 -.582",key:"svg-3"}],["path",{d:"M15 11a1 1 0 0 1 1 1m-.29 3.704a1 1 0 0 1 -.71 .296h-6a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h2",key:"svg-4"}],["path",{d:"M10 11v-1m1.182 -2.826a2 2 0 0 1 2.818 1.826v1",key:"svg-5"}],["path",{d:"M3 3l18 18",key:"svg-6"}]],txe=kt("outline","lock-access-off","LockAccessOff",exe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const nxe=[["path",{d:"M5 12l14 0",key:"svg-0"}]],rxe=kt("outline","minus","Minus",nxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const oxe=[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]],RB=kt("outline","photo","Photo",oxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const ixe=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],FA=kt("outline","plus","Plus",ixe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const sxe=[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]],axe=kt("outline","refresh","Refresh",sxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const lxe=[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M3 12m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-1"}],["path",{d:"M7 8l0 .01",key:"svg-2"}],["path",{d:"M7 16l0 .01",key:"svg-3"}]],cxe=kt("outline","server","Server",lxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const uxe=[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]],rg=kt("outline","settings","Settings",uxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const dxe=[["path",{d:"M16 3l4 4l-4 4",key:"svg-0"}],["path",{d:"M10 7l10 0",key:"svg-1"}],["path",{d:"M8 13l-4 4l4 4",key:"svg-2"}],["path",{d:"M4 17l9 0",key:"svg-3"}]],fxe=kt("outline","switch-horizontal","SwitchHorizontal",dxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const hxe=[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]],kB=kt("outline","trash","Trash",hxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const pxe=[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]],mxe=kt("outline","user","User",pxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const gxe=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M3.6 9h16.8",key:"svg-1"}],["path",{d:"M3.6 15h16.8",key:"svg-2"}],["path",{d:"M11.5 3a17 17 0 0 0 0 18",key:"svg-3"}],["path",{d:"M12.5 3a17 17 0 0 1 0 18",key:"svg-4"}]],MB=kt("outline","world","World",gxe);/**
* @license @tabler/icons-react v3.35.0 - MIT
*
* This source code is licensed under the MIT license.
* See the LICENSE file in the root directory of this source tree.
*/const yxe=[["path",{d:"M13 2l.018 .001l.016 .001l.083 .005l.011 .002h.011l.038 .009l.052 .008l.016 .006l.011 .001l.029 .011l.052 .014l.019 .009l.015 .004l.028 .014l.04 .017l.021 .012l.022 .01l.023 .015l.031 .017l.034 .024l.018 .011l.013 .012l.024 .017l.038 .034l.022 .017l.008 .01l.014 .012l.036 .041l.026 .027l.006 .009c.12 .147 .196 .322 .218 .513l.001 .012l.002 .041l.004 .064v6h5a1 1 0 0 1 .868 1.497l-.06 .091l-8 11c-.568 .783 -1.808 .38 -1.808 -.588v-6h-5a1 1 0 0 1 -.868 -1.497l.06 -.091l8 -11l.01 -.013l.018 -.024l.033 -.038l.018 -.022l.009 -.008l.013 -.014l.04 -.036l.028 -.026l.008 -.006a1 1 0 0 1 .402 -.199l.011 -.001l.027 -.005l.074 -.013l.011 -.001l.041 -.002z",key:"svg-0"}]],bxe=kt("filled","bolt-filled","BoltFilled",yxe),zA="-",vxe=e=>{const t=wxe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(zA);return a[0]===""&&a.length!==1&&a.shift(),PB(a,t)||xxe(s)},getConflictingClassGroupIds:(s,a)=>{const c=n[s]||[];return a&&r[s]?[...c,...r[s]]:c}}},PB=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?PB(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(zA);return t.validators.find(({validator:s})=>s(i))?.classGroupId},M6=/^\[(.+)\]$/,xxe=e=>{if(M6.test(e)){const t=M6.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},wxe=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)aC(n[o],r,o,t);return r},aC=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:P6(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Sxe(o)){aC(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{aC(s,P6(t,i),n,r)})})},P6=(e,t)=>{let n=e;return t.split(zA).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Sxe=e=>e.isThemeGetter,Exe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},lC="!",cC=":",Nxe=cC.length,_xe=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const i=[];let s=0,a=0,c=0,u;for(let v=0;v<o.length;v++){let x=o[v];if(s===0&&a===0){if(x===cC){i.push(o.slice(c,v)),c=v+Nxe;continue}if(x==="/"){u=v;continue}}x==="["?s++:x==="]"?s--:x==="("?a++:x===")"&&a--}const f=i.length===0?o:o.substring(c),p=Cxe(f),g=p!==f,y=u&&u>c?u-c:void 0;return{modifiers:i,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:y}};if(t){const o=t+cC,i=r;r=s=>s.startsWith(o)?i(s.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:s,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=i=>n({className:i,parseClassName:o})}return r},Cxe=e=>e.endsWith(lC)?e.substring(0,e.length-1):e.startsWith(lC)?e.substring(1):e,Oxe=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let i=[];return r.forEach(s=>{s[0]==="["||t[s]?(o.push(...i.sort(),s),i=[]):i.push(s)}),o.push(...i.sort()),o}},jxe=e=>({cache:Exe(e.cacheSize),parseClassName:_xe(e),sortModifiers:Oxe(e),...vxe(e)}),Axe=/\s+/,Txe=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,s=[],a=e.trim().split(Axe);let c="";for(let u=a.length-1;u>=0;u-=1){const f=a[u],{isExternal:p,modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:x}=n(f);if(p){c=f+(c.length>0?" "+c:c);continue}let S=!!x,E=r(S?v.substring(0,x):v);if(!E){if(!S){c=f+(c.length>0?" "+c:c);continue}if(E=r(v),!E){c=f+(c.length>0?" "+c:c);continue}S=!1}const C=i(g).join(":"),_=y?C+lC:C,j=_+E;if(s.includes(j))continue;s.push(j);const A=o(E,S);for(let T=0;T<A.length;++T){const k=A[T];s.push(_+k)}c=f+(c.length>0?" "+c:c)}return c};function $xe(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=DB(t))&&(r&&(r+=" "),r+=n);return r}const DB=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=DB(e[r]))&&(n&&(n+=" "),n+=t);return n};function Rxe(e,...t){let n,r,o,i=s;function s(c){const u=t.reduce((f,p)=>p(f),e());return n=jxe(u),r=n.cache.get,o=n.cache.set,i=a,a(c)}function a(c){const u=r(c);if(u)return u;const f=Txe(c,n);return o(c,f),f}return function(){return i($xe.apply(null,arguments))}}const Jn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},IB=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,LB=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kxe=/^\d+\/\d+$/,Mxe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Pxe=/\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$/,Dxe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ixe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Lxe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gd=e=>kxe.test(e),yt=e=>!!e&&!Number.isNaN(Number(e)),$l=e=>!!e&&Number.isInteger(Number(e)),q2=e=>e.endsWith("%")&&yt(e.slice(0,-1)),ra=e=>Mxe.test(e),Fxe=()=>!0,zxe=e=>Pxe.test(e)&&!Dxe.test(e),FB=()=>!1,Bxe=e=>Ixe.test(e),Vxe=e=>Lxe.test(e),Uxe=e=>!qe(e)&&!We(e),Hxe=e=>Eh(e,VB,FB),qe=e=>IB.test(e),Yc=e=>Eh(e,UB,zxe),W2=e=>Eh(e,Yxe,yt),D6=e=>Eh(e,zB,FB),qxe=e=>Eh(e,BB,Vxe),ib=e=>Eh(e,HB,Bxe),We=e=>LB.test(e),Bp=e=>Nh(e,UB),Wxe=e=>Nh(e,Kxe),I6=e=>Nh(e,zB),Gxe=e=>Nh(e,VB),Jxe=e=>Nh(e,BB),sb=e=>Nh(e,HB,!0),Eh=(e,t,n)=>{const r=IB.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Nh=(e,t,n=!1)=>{const r=LB.exec(e);return r?r[1]?t(r[1]):n:!1},zB=e=>e==="position"||e==="percentage",BB=e=>e==="image"||e==="url",VB=e=>e==="length"||e==="size"||e==="bg-size",UB=e=>e==="length",Yxe=e=>e==="number",Kxe=e=>e==="family-name",HB=e=>e==="shadow",Xxe=()=>{const e=Jn("color"),t=Jn("font"),n=Jn("text"),r=Jn("font-weight"),o=Jn("tracking"),i=Jn("leading"),s=Jn("breakpoint"),a=Jn("container"),c=Jn("spacing"),u=Jn("radius"),f=Jn("shadow"),p=Jn("inset-shadow"),g=Jn("text-shadow"),y=Jn("drop-shadow"),v=Jn("blur"),x=Jn("perspective"),S=Jn("aspect"),E=Jn("ease"),C=Jn("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...j(),We,qe],T=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],R=()=>[We,qe,c],V=()=>[Gd,"full","auto",...R()],H=()=>[$l,"none","subgrid",We,qe],F=()=>["auto",{span:["full",$l,We,qe]},$l,We,qe],B=()=>[$l,"auto",We,qe],U=()=>["auto","min","max","fr",We,qe],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...R()],L=()=>[Gd,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],P=()=>[e,We,qe],q=()=>[...j(),I6,D6,{position:[We,qe]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",Gxe,Hxe,{size:[We,qe]}],W=()=>[q2,Bp,Yc],K=()=>["","none","full",u,We,qe],Q=()=>["",yt,Bp,Yc],ie=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[yt,q2,I6,D6],se=()=>["","none",v,We,qe],me=()=>["none",yt,We,qe],xe=()=>["none",yt,We,qe],je=()=>[yt,We,qe],_e=()=>[Gd,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ra],breakpoint:[ra],color:[Fxe],container:[ra],"drop-shadow":[ra],ease:["in","out","in-out"],font:[Uxe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ra],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ra],shadow:[ra],spacing:["px",yt],text:[ra],"text-shadow":[ra],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Gd,qe,We,S]}],container:["container"],columns:[{columns:[yt,qe,We,a]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"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:A()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[$l,"auto",We,qe]}],basis:[{basis:[Gd,"full","auto",a,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[yt,Gd,"auto","initial","none",qe]}],grow:[{grow:["",yt,We,qe]}],shrink:[{shrink:["",yt,We,qe]}],order:[{order:[$l,"first","last","none",We,qe]}],"grid-cols":[{"grid-cols":H()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":H()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[a,"screen",...L()]}],"min-w":[{"min-w":[a,"screen","none",...L()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",n,Bp,Yc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,We,W2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",q2,qe]}],"font-family":[{font:[Wxe,qe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,We,qe]}],"line-clamp":[{"line-clamp":[yt,"none",We,W2]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",We,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",We,qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[yt,"from-font","auto",We,Yc]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[yt,"auto",We,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",We,qe]}],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",We,qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$l,We,qe],radial:["",We,qe],conic:[$l,We,qe]},Jxe,qxe]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[yt,We,qe]}],"outline-w":[{outline:["",yt,Bp,Yc]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",f,sb,ib]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",p,sb,ib]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[yt,Yc]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",g,sb,ib]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[yt,We,qe]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"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":[yt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[We,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"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":j()}],"mask-image-conic-pos":[{"mask-conic":[yt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",We,qe]}],filter:[{filter:["","none",We,qe]}],blur:[{blur:se()}],brightness:[{brightness:[yt,We,qe]}],contrast:[{contrast:[yt,We,qe]}],"drop-shadow":[{"drop-shadow":["","none",y,sb,ib]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",yt,We,qe]}],"hue-rotate":[{"hue-rotate":[yt,We,qe]}],invert:[{invert:["",yt,We,qe]}],saturate:[{saturate:[yt,We,qe]}],sepia:[{sepia:["",yt,We,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",We,qe]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[yt,We,qe]}],"backdrop-contrast":[{"backdrop-contrast":[yt,We,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",yt,We,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[yt,We,qe]}],"backdrop-invert":[{"backdrop-invert":["",yt,We,qe]}],"backdrop-opacity":[{"backdrop-opacity":[yt,We,qe]}],"backdrop-saturate":[{"backdrop-saturate":[yt,We,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",yt,We,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",We,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[yt,"initial",We,qe]}],ease:[{ease:["linear","initial",E,We,qe]}],delay:[{delay:[yt,We,qe]}],animate:[{animate:["none",C,We,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,We,qe]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[We,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"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",We,qe]}],"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":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",We,qe]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[yt,Bp,Yc,W2]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Be=Rxe(Xxe);function Qxe(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,o,i,s=[],a="",c=e.split("/");for(c[0]||c.shift();o=c.shift();)n=o[0],n==="*"?(s.push(n),a+=o[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(r=o.indexOf("?",1),i=o.indexOf(".",1),s.push(o.substring(1,~r?r:~i?i:o.length)),a+=~r&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(a+=(~r?"?":"")+"\\"+o.substring(i))):a+="/"+o;return{keys:s,pattern:new RegExp("^"+a+(t?"(?=$|/)":"/?$"),"i")}}const Zxe=fO.useInsertionEffect,ewe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",twe=ewe?w.useLayoutEffect:w.useEffect,nwe=Zxe||twe,qB=e=>{const t=w.useRef([e,(...n)=>t[0](...n)]).current;return nwe(()=>{t[0]=e}),t[1]},rwe="popstate",BA="pushState",VA="replaceState",owe="hashchange",L6=[rwe,BA,VA,owe],iwe=e=>{for(const t of L6)addEventListener(t,e);return()=>{for(const t of L6)removeEventListener(t,e)}},WB=(e,t)=>TA.useSyncExternalStore(iwe,e,t),swe=()=>location.search,awe=({ssrSearch:e=""}={})=>WB(swe,()=>e),F6=()=>location.pathname,lwe=({ssrPath:e}={})=>WB(F6,e?()=>e:F6),cwe=(e,{replace:t=!1,state:n=null}={})=>history[t?VA:BA](n,"",e),uwe=(e={})=>[lwe(e),cwe],z6=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[z6]>"u"){for(const e of[BA,VA]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),r=new Event(e);return r.arguments=arguments,dispatchEvent(r),n}}Object.defineProperty(window,z6,{value:!0})}const dwe=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",GB=(e="")=>e==="/"?"":e,fwe=(e,t)=>e[0]==="~"?e.slice(1):GB(t)+e,hwe=(e="",t)=>dwe(uC(GB(e)),uC(t)),pwe=e=>e[0]==="?"?e.slice(1):e,uC=e=>{try{return decodeURI(e)}catch{return e}},mwe=e=>uC(pwe(e)),JB={hook:uwe,searchHook:awe,parser:Qxe,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},YB=w.createContext(JB),Nc=()=>w.useContext(YB),KB={},XB=w.createContext(KB),Mw=()=>w.useContext(XB),Pw=e=>{const[t,n]=e.hook(e);return[hwe(e.base,t),qB((r,o)=>n(fwe(r,e.base),o))]},Uo=()=>Pw(Nc()),gwe=()=>{const e=Nc();return mwe(e.searchHook(e))},QB=(e,t,n,r)=>{const{pattern:o,keys:i}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",r),s=o.exec(n)||[],[a,...c]=s;return a!==void 0?[!0,(()=>{const u=i!==!1?Object.fromEntries(i.map((p,g)=>[p,c[g]])):s.groups;let f={...c};return u&&Object.assign(f,u),f})(),...r?[a]:[]]:[!1,null]},ZB=({children:e,...t})=>{const n=Nc(),r=t.hook?JB:n;let o=r;const[i,s]=t.ssrPath?.split("?")??[];s&&(t.ssrSearch=s,t.ssrPath=i),t.hrefs=t.hrefs??t.hook?.hrefs;let a=w.useRef({}),c=a.current,u=c;for(let f in r){const p=f==="base"?r[f]+(t[f]||""):t[f]||r[f];c===u&&p!==u[f]&&(a.current=u={...u}),u[f]=p,(p!==r[f]||p!==o[f])&&(o=u)}return w.createElement(YB.Provider,{value:o,children:e})},B6=({children:e,component:t},n)=>t?w.createElement(t,{params:n}):typeof e=="function"?e(n):e,ywe=e=>{let t=w.useRef(KB);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([r,o])=>o!==n[r])?e:n},tt=({path:e,nest:t,match:n,...r})=>{const o=Nc(),[i]=Pw(o),[s,a,c]=n??QB(o.parser,e,i,t),u=ywe({...Mw(),...a});if(!s)return null;const f=c?w.createElement(ZB,{base:c},B6(r,u)):B6(r,u);return w.createElement(XB.Provider,{value:u,children:f})},Dw=w.forwardRef((e,t)=>{const n=Nc(),[r,o]=Pw(n),{to:i="",href:s=i,onClick:a,asChild:c,children:u,className:f,replace:p,state:g,...y}=e,v=qB(S=>{S.ctrlKey||S.metaKey||S.altKey||S.shiftKey||S.button!==0||(a?.(S),S.defaultPrevented||(S.preventDefault(),o(s,e)))}),x=n.hrefs(s[0]==="~"?s.slice(1):n.base+s,n);return c&&w.isValidElement(u)?w.cloneElement(u,{onClick:v,href:x}):w.createElement("a",{...y,onClick:v,href:x,className:f?.call?f(r===s):f,children:u,ref:t})}),eV=e=>Array.isArray(e)?e.flatMap(t=>eV(t&&t.type===w.Fragment?t.props.children:t)):[e],As=({children:e,location:t})=>{const n=Nc(),[r]=Pw(n);for(const o of eV(e)){let i=0;if(w.isValidElement(o)&&(i=QB(n.parser,o.props.path,t||r,o.props.nest))[0])return w.cloneElement(o,{match:i})}return null},It=e=>(ir(),e),bwe=(e="",t="")=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",tV=(e,t="")=>e[0]==="~"?e.slice(1):t+e,vwe=e=>{try{return decodeURI(e)}catch{return e}},xwe=e=>{const[t,n]=e.hook(e);return[vwe(bwe(e.base,t)),It((r,o)=>n(tV(r,e.base),o))]};function wwe(e,t){const n=window.location.pathname;return n===e||n.endsWith(e)||n.includes(e+"/")}function Nn({className:e,native:t,onClick:n,...r}){const o=Nc(),[i]=xwe(o);function s(g,y){if(g.startsWith(y)){const v=g.replace(y,"");return v.length===0||v[0]==="/"}return!1}const a=r.href??r.to,c=o.hrefs(a[0]==="~"?a.slice(1):o.base+a,o).replace("//","/"),u=tV(i,o.base).replace("//","/"),f=c.replace(o.base,"").length<=1?c===u:s(u,c);if(t)return h.jsx("a",{className:`${f?"active ":""}${e}`,...r});const p=g=>{n?.(g)};return h.jsx(Dw,{className:`${f?"active ":""}${e}`,...r,onClick:p})}const Swe={smaller:"px-1.5 py-1 rounded-md gap-1 !text-xs",small:"px-2 py-1.5 rounded-md gap-1 text-sm",default:"px-3 py-2.5 rounded-md gap-1.5",large:"px-4 py-3 rounded-md gap-2.5 text-lg"},Ewe={smaller:12,small:14,default:16,large:20},Nwe={default:"bg-primary/5 hover:bg-primary/10 link text-primary/70",primary:"bg-primary hover:bg-primary/80 link text-background",ghost:"bg-transparent hover:bg-primary/5 link text-primary/70",outline:"border border-primary/20 bg-transparent hover:bg-primary/5 link text-primary/80",red:"dark:bg-red-950 dark:hover:bg-red-900 bg-red-100 hover:bg-red-200 link text-primary/70",subtlered:"dark:text-red-700 text-red-700 dark:hover:bg-red-900 dark:hover:text-red-200 bg-transparent hover:bg-red-50 link"},nV=({children:e,size:t,variant:n,IconLeft:r,IconRight:o,iconSize:i=Ewe[t??"default"],iconProps:s,labelClassName:a,...c})=>({...c,className:Be("flex flex-row flex-nowrap items-center !font-semibold disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed transition-[opacity,background-color,color,border-color]",Swe[t??"default"],Nwe[n??"default"],c.className),children:h.jsxs(h.Fragment,{children:[r&&h.jsx(r,{size:i,...s}),e&&w.Children.count(e)===1?h.jsx("span",{className:Be("leading-none",a),children:e}):e,o&&h.jsx(o,{size:i,...s})]})}),Xe=w.forwardRef((e,t)=>h.jsx("button",{type:"button",ref:t,...nV(e)})),dC=w.forwardRef((e,t)=>h.jsx(Nn,{ref:t,href:"#",...nV(e)})),Hn=({Icon:e=void 0,title:t=void 0,description:n="Check back later my friend.",primary:r,secondary:o,className:i,children:s})=>h.jsx("div",{className:Be("flex flex-col h-full w-full justify-center items-center",i),children:h.jsxs("div",{className:"flex flex-col gap-3 items-center max-w-80",children:[e&&h.jsx(e,{size:48,className:"opacity-50",stroke:1}),h.jsxs("div",{className:"flex flex-col gap-1",children:[t&&h.jsx("h3",{className:"text-center text-lg font-bold",children:t}),h.jsx("p",{className:"text-center text-primary/60",children:n})]}),h.jsxs("div",{className:"mt-1.5 flex flex-row gap-2",children:[o&&h.jsx(Xe,{variant:"default",...o}),r&&h.jsx(Xe,{variant:"primary",...r}),s]})]})}),_we=e=>h.jsx(Hn,{title:"Not Found",...e}),Cwe=e=>h.jsx(Hn,{title:"Not Allowed",...e}),Owe=({what:e,...t})=>h.jsx(Hn,{Icon:txe,title:"Missing Permission",description:`You're not allowed to access ${e??"this"}.`,...t}),jwe=e=>h.jsx(Hn,{title:"Not Enabled",...e}),yo={NotFound:_we,NotAllowed:Cwe,NotEnabled:jwe,MissingPermission:Owe},st={data:{root:()=>"/data",entity:{list:e=>`/entity/${e}`,create:e=>`/entity/${e}/create`,edit:(e,t)=>`/entity/${e}/edit/${t}`},schema:{root:()=>"/schema",entity:e=>`/schema/entity/${e}`}},auth:{root:()=>"/auth",users:{list:()=>"/users",edit:e=>`/users/edit/${e}`},roles:{list:()=>"/roles",edit:e=>`/roles/edit/${e}`},settings:()=>"/settings",strategies:()=>"/strategies"},flows:{root:()=>"/flows",flows:{list:()=>"/",edit:e=>`/flow/${e}`}},settings:{root:()=>"/settings",path:e=>`/settings/${e.join("/")}`}};function Awe(e,t){const n=tw(t,{encode:!1});return`${e}?${n}`}function Twe(){const[e]=Pn();return(t,n)=>{e(t(st),n)}}function Pn(){const[e,t]=Uo(),n=Nc(),{app:r}=ot(),o=r.options.basepath;return[(i,s)=>{(c=>{c()})(()=>{if(s){if("reload"in s){window.location.href=i;return}else if("target"in s){const f=window.location.origin+n.base+i;window.open(f,s.target);return}}const c=s?.absolute?`~/${o}${i}`.replace(/\/+/g,"/"):i,u={...s?.state,referrer:e};t(s?.query?Awe(c,s?.query):c,{replace:s?.replace,state:u})})},e,i=>{const s=window.history.state;s?.referrer?t(s.referrer,{replace:!0}):i?.fallback?t(i.fallback,{replace:!0}):window.history.back()}]}function $we(e="/",t){const{app:n}=ot(),[r]=Pn(),o=document.referrer,i=window.history.length,s=o.length===0,a=s&&i>1||!!s;function c(){s&&i>2?window.history.back():typeof e=="string"?r(e):typeof e=="function"&&e()}return{same:s,canGoBack:a,goBack:c}}const rV=w.createContext(void 0);function Rwe({includeSecrets:e=!1,options:t,children:n,fallback:r=null}){const[o,i]=w.useState(e),[s,a]=w.useState(),[c,u]=w.useState(!1),[f,p]=w.useState(),g=w.useRef(!1),y=w.useRef(0),[v,x]=w.useState(0),S=ss();async function E(){await C(e,{force:!0,fresh:!0})}async function C(k=!1,R){const V=o?2:1;if(y.current===V||o&&R?.force!==!0)return;y.current=V;const H=await S.system.readSchema({config:!0,secrets:k,fresh:R?.fresh});if(H.ok)f&&p(!1);else if(g.current||(g.current=!0,p(!0),c&&s?.schema))return;const F=H.ok?H.body:{version:0,mode:"db",schema:xbe(),config:wbe(),permissions:[],fallback:!0};w.startTransition(()=>{(()=>{a(F),i(k),u(!0),x(U=>U+1),y.current=0})()})}async function _(){o||await C(!0)}if(w.useEffect(()=>{s?.schema||C(e)},[]),!c||!s)return r;const j=new yve(s?.config,t),A=gve({api:S,setSchema:a,reloadSchema:E}),T=o&&!f;return h.jsx(rV.Provider,{value:{...s,actions:A,requireSecrets:_,app:j,options:j.options,hasSecrets:T},children:f?h.jsx(kwe,{}):n},v)}function kwe(){const[e]=Pn();return h.jsx(yo.MissingPermission,{what:"the Admin UI",primary:{children:"Login",onClick:()=>e("/auth/login")}})}function ot({withSecrets:e}={}){const t=w.useContext(rV);return e&&t.requireSecrets(),t}function Iw({children:e}){const{readonly:t}=ot();return t?null:e}const Mwe={},V6=e=>{let t;const n=new Set,r=(f,p)=>{const g=typeof f=="function"?f(t):f;if(!Object.is(g,t)){const y=t;t=p??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(v=>v(t,y))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Mwe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,o,c);return c},UA=e=>e?V6(e):V6;var G2={exports:{}},J2={};/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var U6;function Pwe(){if(U6)return J2;U6=1;var e=dc(),t=xB();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return J2.useSyncExternalStoreWithSelector=function(u,f,p,g,y){var v=i(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=a(function(){function E(T){if(!C){if(C=!0,_=T,T=g(T),y!==void 0&&x.hasValue){var k=x.value;if(y(k,T))return j=k}return j=T}if(k=j,r(_,T))return k;var R=g(T);return y!==void 0&&y(k,R)?(_=T,k):(_=T,j=R)}var C=!1,_,j,A=p===void 0?null:p;return[function(){return E(f())},A===null?void 0:function(){return E(A())}]},[f,p,g,y]);var S=o(u,v[0],v[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),c(S),S},J2}var H6;function Dwe(){return H6||(H6=1,G2.exports=Pwe()),G2.exports}var Iwe=Dwe();const oV=es(Iwe),iV={},{useDebugValue:Lwe}=Ne,{useSyncExternalStoreWithSelector:Fwe}=oV;let q6=!1;const zwe=e=>e;function Pr(e,t=zwe,n){(iV?"production":void 0)!=="production"&&n&&!q6&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),q6=!0);const r=Fwe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Lwe(r),r}const W6=e=>{(iV?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?UA(e):e,n=(r,o)=>Pr(t,r,o);return Object.assign(n,t),n},Lw=e=>e?W6(e):W6,Bwe={},ey=(e,t)=>(...n)=>Object.assign({},e,t(...n));function Vwe(e,t){let n;try{n=e()}catch{return}return{getItem:o=>{var i;const s=c=>c===null?null:JSON.parse(c,void 0),a=(i=n.getItem(o))!=null?i:null;return a instanceof Promise?a.then(s):s(a)},setItem:(o,i)=>n.setItem(o,JSON.stringify(i,void 0)),removeItem:o=>n.removeItem(o)}}const og=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return og(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return og(r)(n)}}}},Uwe=(e,t)=>(n,r,o)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:S=>S,version:0,merge:(S,E)=>({...E,...S}),...t},s=!1;const a=new Set,c=new Set;let u;try{u=i.getStorage()}catch{}if(!u)return e((...S)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...S)},r,o);const f=og(i.serialize),p=()=>{const S=i.partialize({...r()});let E;const C=f({state:S,version:i.version}).then(_=>u.setItem(i.name,_)).catch(_=>{E=_});if(E)throw E;return C},g=o.setState;o.setState=(S,E)=>{g(S,E),p()};const y=e((...S)=>{n(...S),p()},r,o);let v;const x=()=>{var S;if(!u)return;s=!1,a.forEach(C=>C(r()));const E=((S=i.onRehydrateStorage)==null?void 0:S.call(i,r()))||void 0;return og(u.getItem.bind(u))(i.name).then(C=>{if(C)return i.deserialize(C)}).then(C=>{if(C)if(typeof C.version=="number"&&C.version!==i.version){if(i.migrate)return i.migrate(C.state,C.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return C.state}).then(C=>{var _;return v=i.merge(C,(_=r())!=null?_:y),n(v,!0),p()}).then(()=>{E?.(v,void 0),s=!0,c.forEach(C=>C(v))}).catch(C=>{E?.(void 0,C)})};return o.persist={setOptions:S=>{i={...i,...S},S.getStorage&&(u=S.getStorage())},clearStorage:()=>{u?.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:S=>(a.add(S),()=>{a.delete(S)}),onFinishHydration:S=>(c.add(S),()=>{c.delete(S)})},x(),v||y},Hwe=(e,t)=>(n,r,o)=>{let i={storage:Vwe(()=>localStorage),partialize:x=>x,version:0,merge:(x,S)=>({...S,...x}),...t},s=!1;const a=new Set,c=new Set;let u=i.storage;if(!u)return e((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...x)},r,o);const f=()=>{const x=i.partialize({...r()});return u.setItem(i.name,{state:x,version:i.version})},p=o.setState;o.setState=(x,S)=>{p(x,S),f()};const g=e((...x)=>{n(...x),f()},r,o);o.getInitialState=()=>g;let y;const v=()=>{var x,S;if(!u)return;s=!1,a.forEach(C=>{var _;return C((_=r())!=null?_:g)});const E=((S=i.onRehydrateStorage)==null?void 0:S.call(i,(x=r())!=null?x:g))||void 0;return og(u.getItem.bind(u))(i.name).then(C=>{if(C)if(typeof C.version=="number"&&C.version!==i.version){if(i.migrate)return[!0,i.migrate(C.state,C.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,C.state];return[!1,void 0]}).then(C=>{var _;const[j,A]=C;if(y=i.merge(A,(_=r())!=null?_:g),n(y,!0),j)return f()}).then(()=>{E?.(y,void 0),y=r(),s=!0,c.forEach(C=>C(y))}).catch(C=>{E?.(void 0,C)})};return o.persist={setOptions:x=>{i={...i,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u?.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>v(),hasHydrated:()=>s,onHydrate:x=>(a.add(x),()=>{a.delete(x)}),onFinishHydration:x=>(c.add(x),()=>{c.delete(x)})},i.skipHydration||v(),y||g},qwe=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((Bwe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Uwe(e,t)):Hwe(e,t),sV=qwe,aV=["dark","light","system"],G6=Lw(sV(ey({theme:null},e=>({setTheme:t=>{aV.includes(t)&&document.startViewTransition(()=>{e({theme:t})})}})),{name:"bknd-admin-theme"}));function Va(e="system"){const t=ot(),n=G6(a=>a.theme),r=G6(a=>a.setTheme),o=t?.options?.theme,i=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches,s=o??n??e;return{theme:s==="system"?i?"dark":"light":s,value:s,themes:aV,setTheme:r,state:n,prefersDark:i,override:o}}function Fw({scale:e=.2,fill:t,...n}){const r=Va(),o=n.theme??r.theme,i=t||(o==="light"?"black":"white"),s={width:Math.round(578*e),height:Math.round(188*e)};return h.jsx("div",{style:s,children:h.jsxs("svg",{width:s.width,height:s.height,viewBox:"0 0 578 188",fill:i,xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M41.5 34C37.0817 34 33.5 37.5817 33.5 42V146C33.5 150.418 37.0817 154 41.5 154H158.5C162.918 154 166.5 150.418 166.5 146V42C166.5 37.5817 162.918 34 158.5 34H41.5ZM123.434 113.942C124.126 111.752 124.5 109.42 124.5 107C124.5 94.2975 114.203 84 101.5 84C99.1907 84 96.9608 84.3403 94.8579 84.9736L87.2208 65.1172C90.9181 63.4922 93.5 59.7976 93.5 55.5C93.5 49.701 88.799 45 83 45C77.201 45 72.5 49.701 72.5 55.5C72.5 61.299 77.201 66 83 66C83.4453 66 83.8841 65.9723 84.3148 65.9185L92.0483 86.0256C87.1368 88.2423 83.1434 92.1335 80.7957 96.9714L65.4253 91.1648C65.4746 90.7835 65.5 90.3947 65.5 90C65.5 85.0294 61.4706 81 56.5 81C51.5294 81 47.5 85.0294 47.5 90C47.5 94.9706 51.5294 99 56.5 99C60.0181 99 63.0648 96.9814 64.5449 94.0392L79.6655 99.7514C78.9094 102.03 78.5 104.467 78.5 107C78.5 110.387 79.2321 113.603 80.5466 116.498L69.0273 123.731C67.1012 121.449 64.2199 120 61 120C55.201 120 50.5 124.701 50.5 130.5C50.5 136.299 55.201 141 61 141C66.799 141 71.5 136.299 71.5 130.5C71.5 128.997 71.1844 127.569 70.6158 126.276L81.9667 119.149C86.0275 125.664 93.2574 130 101.5 130C110.722 130 118.677 124.572 122.343 116.737L132.747 120.899C132.585 121.573 132.5 122.276 132.5 123C132.5 127.971 136.529 132 141.5 132C146.471 132 150.5 127.971 150.5 123C150.5 118.029 146.471 114 141.5 114C138.32 114 135.525 115.649 133.925 118.139L123.434 113.942Z"}),h.jsx("path",{d:"M243.9 151.5C240.4 151.5 237 151 233.7 150C230.4 149 227.4 147.65 224.7 145.95C222 144.15 219.75 142.15 217.95 139.95C216.15 137.65 215 135.3 214.5 132.9L219.3 131.1L218.25 149.7H198.15V39H219.45V89.25L215.4 87.6C216 85.2 217.15 82.9 218.85 80.7C220.55 78.4 222.7 76.4 225.3 74.7C227.9 72.9 230.75 71.5 233.85 70.5C236.95 69.5 240.15 69 243.45 69C250.35 69 256.5 70.8 261.9 74.4C267.3 77.9 271.55 82.75 274.65 88.95C277.85 95.15 279.45 102.25 279.45 110.25C279.45 118.25 277.9 125.35 274.8 131.55C271.7 137.75 267.45 142.65 262.05 146.25C256.75 149.75 250.7 151.5 243.9 151.5ZM238.8 133.35C242.8 133.35 246.25 132.4 249.15 130.5C252.15 128.5 254.5 125.8 256.2 122.4C257.9 118.9 258.75 114.85 258.75 110.25C258.75 105.75 257.9 101.75 256.2 98.25C254.6 94.75 252.3 92.05 249.3 90.15C246.3 88.25 242.8 87.3 238.8 87.3C234.8 87.3 231.3 88.25 228.3 90.15C225.3 92.05 222.95 94.75 221.25 98.25C219.55 101.75 218.7 105.75 218.7 110.25C218.7 114.85 219.55 118.9 221.25 122.4C222.95 125.8 225.3 128.5 228.3 130.5C231.3 132.4 234.8 133.35 238.8 133.35ZM308.312 126.15L302.012 108.6L339.512 70.65H367.562L308.312 126.15ZM288.062 150V39H309.362V150H288.062ZM341.762 150L313.262 114.15L328.262 102.15L367.412 150H341.762ZM371.675 150V70.65H392.075L392.675 86.85L388.475 88.65C389.575 85.05 391.525 81.8 394.325 78.9C397.225 75.9 400.675 73.5 404.675 71.7C408.675 69.9 412.875 69 417.275 69C423.275 69 428.275 70.2 432.275 72.6C436.375 75 439.425 78.65 441.425 83.55C443.525 88.35 444.575 94.3 444.575 101.4V150H423.275V103.05C423.275 99.45 422.775 96.45 421.775 94.05C420.775 91.65 419.225 89.9 417.125 88.8C415.125 87.6 412.625 87.1 409.625 87.3C407.225 87.3 404.975 87.7 402.875 88.5C400.875 89.2 399.125 90.25 397.625 91.65C396.225 93.05 395.075 94.65 394.175 96.45C393.375 98.25 392.975 100.2 392.975 102.3V150H382.475C380.175 150 378.125 150 376.325 150C374.525 150 372.975 150 371.675 150ZM488.536 151.5C481.636 151.5 475.436 149.75 469.936 146.25C464.436 142.65 460.086 137.8 456.886 131.7C453.786 125.5 452.236 118.35 452.236 110.25C452.236 102.35 453.786 95.3 456.886 89.1C460.086 82.9 464.386 78 469.786 74.4C475.286 70.8 481.536 69 488.536 69C492.236 69 495.786 69.6 499.186 70.8C502.686 71.9 505.786 73.45 508.486 75.45C511.286 77.45 513.536 79.7 515.236 82.2C516.936 84.6 517.886 87.15 518.086 89.85L512.686 90.75V39H533.986V150H513.886L512.986 131.7L517.186 132.15C516.986 134.65 516.086 137.05 514.486 139.35C512.886 141.65 510.736 143.75 508.036 145.65C505.436 147.45 502.436 148.9 499.036 150C495.736 151 492.236 151.5 488.536 151.5ZM493.336 133.8C497.336 133.8 500.836 132.8 503.836 130.8C506.836 128.8 509.186 126.05 510.886 122.55C512.586 119.05 513.436 114.95 513.436 110.25C513.436 105.65 512.586 101.6 510.886 98.1C509.186 94.5 506.836 91.75 503.836 89.85C500.836 87.85 497.336 86.85 493.336 86.85C489.336 86.85 485.836 87.85 482.836 89.85C479.936 91.75 477.636 94.5 475.936 98.1C474.336 101.6 473.536 105.65 473.536 110.25C473.536 114.95 474.336 119.05 475.936 122.55C477.636 126.05 479.936 128.8 482.836 130.8C485.836 132.8 489.336 133.8 493.336 133.8Z"})]})})}function J6(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function lV(...e){return t=>{let n=!1;const r=e.map(o=>{const i=J6(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():J6(e[o],null)}}}}function Ua(...e){return w.useCallback(lV(...e),e)}function Wwe(e){const t=Gwe(e),n=w.forwardRef((r,o)=>{const{children:i,...s}=r,a=w.Children.toArray(i),c=a.find(Ywe);if(c){const u=c.props.children,f=a.map(p=>p===c?w.Children.count(u)>1?w.Children.only(null):w.isValidElement(u)?u.props.children:null:p);return h.jsx(t,{...s,ref:o,children:w.isValidElement(u)?w.cloneElement(u,void 0,f):null})}return h.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function Gwe(e){const t=w.forwardRef((n,r)=>{const{children:o,...i}=n;if(w.isValidElement(o)){const s=Xwe(o),a=Kwe(i,o.props);return o.type!==w.Fragment&&(a.ref=r?lV(r,s):s),w.cloneElement(o,a)}return w.Children.count(o)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Jwe=Symbol("radix.slottable");function Ywe(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Jwe}function Kwe(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const c=i(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Xwe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Qwe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qu=Qwe.reduce((e,t)=>{const n=Wwe(`Primitive.${t}`),r=w.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function cV(e,t=[]){let n=[];function r(i,s){const a=w.createContext(s),c=n.length;n=[...n,s];const u=p=>{const{scope:g,children:y,...v}=p,x=g?.[e]?.[c]||a,S=w.useMemo(()=>v,Object.values(v));return h.jsx(x.Provider,{value:S,children:y})};u.displayName=i+"Provider";function f(p,g){const y=g?.[e]?.[c]||a,v=w.useContext(y);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${i}\``)}return[u,f]}const o=()=>{const i=n.map(s=>w.createContext(s));return function(a){const c=a?.[e]||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Zwe(o,...t)]}function Zwe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:u})=>{const p=c(i)[`__scope${u}`];return{...a,...p}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ql(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var ig=globalThis?.document?w.useLayoutEffect:()=>{},e1e=fO[" useInsertionEffect ".trim().toString()]||ig;function t1e({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=n1e({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const f=w.useRef(e!==void 0);w.useEffect(()=>{const p=f.current;p!==a&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${a?"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=a},[a,r])}const u=w.useCallback(f=>{if(a){const p=r1e(f)?f(e):f;p!==e&&s.current?.(p)}else i(f)},[a,e,i,s]);return[c,u]}function n1e({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),o=w.useRef(n),i=w.useRef(t);return e1e(()=>{i.current=t},[t]),w.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function r1e(e){return typeof e=="function"}function o1e(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var ty=e=>{const{present:t,children:n}=e,r=i1e(t),o=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Ua(r.ref,s1e(o));return typeof n=="function"||r.isPresent?w.cloneElement(o,{ref:i}):null};ty.displayName="Presence";function i1e(e){const[t,n]=w.useState(),r=w.useRef(null),o=w.useRef(e),i=w.useRef("none"),s=e?"mounted":"unmounted",[a,c]=o1e(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const u=ab(r.current);i.current=a==="mounted"?u:"none"},[a]),ig(()=>{const u=r.current,f=o.current;if(f!==e){const g=i.current,y=ab(u);e?c("MOUNT"):y==="none"||u?.display==="none"?c("UNMOUNT"):c(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ig(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=y=>{const x=ab(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&x&&(c("ANIMATION_END"),!o.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},g=y=>{y.target===t&&(i.current=ab(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function ab(e){return e?.animationName||"none"}function s1e(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var a1e=w.createContext(void 0);function l1e(e){const t=w.useContext(a1e);return e||t||"ltr"}function lu(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>t.current?.(...n),[])}var Y2={exports:{}},K2={};/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Y6;function c1e(){if(Y6)return K2;Y6=1;var e=dc();function t(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(p,g){var y=g(),v=r({inst:{value:y,getSnapshot:g}}),x=v[0].inst,S=v[1];return i(function(){x.value=y,x.getSnapshot=g,c(x)&&S({inst:x})},[p,y,g]),o(function(){return c(x)&&S({inst:x}),p(function(){c(x)&&S({inst:x})})},[p]),s(y),y}function c(p){var g=p.getSnapshot;p=p.value;try{var y=g();return!n(p,y)}catch{return!0}}function u(p,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return K2.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,K2}var K6;function u1e(){return K6||(K6=1,Y2.exports=c1e()),Y2.exports}function d1e(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function f1e(e){const[t,n]=w.useState(void 0);return ig(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function h1e(e,[t,n]){return Math.min(n,Math.max(t,e))}function p1e(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var HA="ScrollArea",[uV]=cV(HA),[m1e,wi]=uV(HA),dV=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[a,c]=w.useState(null),[u,f]=w.useState(null),[p,g]=w.useState(null),[y,v]=w.useState(null),[x,S]=w.useState(null),[E,C]=w.useState(0),[_,j]=w.useState(0),[A,T]=w.useState(!1),[k,R]=w.useState(!1),V=Ua(t,F=>c(F)),H=l1e(o);return h.jsx(m1e,{scope:n,type:r,dir:H,scrollHideDelay:i,scrollArea:a,viewport:u,onViewportChange:f,content:p,onContentChange:g,scrollbarX:y,onScrollbarXChange:v,scrollbarXEnabled:A,onScrollbarXEnabledChange:T,scrollbarY:x,onScrollbarYChange:S,scrollbarYEnabled:k,onScrollbarYEnabledChange:R,onCornerWidthChange:C,onCornerHeightChange:j,children:h.jsx(qu.div,{dir:H,...s,ref:V,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})})});dV.displayName=HA;var fV="ScrollAreaViewport",hV=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,s=wi(fV,n),a=w.useRef(null),c=Ua(t,a,s.onViewportChange);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),h.jsx(qu.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:h.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});hV.displayName=fV;var Ps="ScrollAreaScrollbar",pV=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=wi(Ps,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return w.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?h.jsx(g1e,{...r,ref:t,forceMount:n}):o.type==="scroll"?h.jsx(y1e,{...r,ref:t,forceMount:n}):o.type==="auto"?h.jsx(mV,{...r,ref:t,forceMount:n}):o.type==="always"?h.jsx(qA,{...r,ref:t}):null});pV.displayName=Ps;var g1e=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=wi(Ps,e.__scopeScrollArea),[i,s]=w.useState(!1);return w.useEffect(()=>{const a=o.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},f=()=>{c=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",f)}}},[o.scrollArea,o.scrollHideDelay]),h.jsx(ty,{present:n||i,children:h.jsx(mV,{"data-state":i?"visible":"hidden",...r,ref:t})})}),y1e=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=wi(Ps,e.__scopeScrollArea),i=e.orientation==="horizontal",s=Bw(()=>c("SCROLL_END"),100),[a,c]=p1e("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return w.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,o.scrollHideDelay,c]),w.useEffect(()=>{const u=o.viewport,f=i?"scrollLeft":"scrollTop";if(u){let p=u[f];const g=()=>{const y=u[f];p!==y&&(c("SCROLL"),s()),p=y};return u.addEventListener("scroll",g),()=>u.removeEventListener("scroll",g)}},[o.viewport,i,c,s]),h.jsx(ty,{present:n||a!=="hidden",children:h.jsx(qA,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Ql(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ql(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),mV=w.forwardRef((e,t)=>{const n=wi(Ps,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=w.useState(!1),a=e.orientation==="horizontal",c=Bw(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,f=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?u:f)}},10);return Bf(n.viewport,c),Bf(n.content,c),h.jsx(ty,{present:r||i,children:h.jsx(qA,{"data-state":i?"visible":"hidden",...o,ref:t})})}),qA=w.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=wi(Ps,e.__scopeScrollArea),i=w.useRef(null),s=w.useRef(0),[a,c]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=vV(a.viewport,a.content),f={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:g=>s.current=g};function p(g,y){return N1e(g,s.current,a,y)}return n==="horizontal"?h.jsx(b1e,{...f,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const g=o.viewport.scrollLeft,y=X6(g,a,o.dir);i.current.style.transform=`translate3d(${y}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=p(g,o.dir))}}):n==="vertical"?h.jsx(v1e,{...f,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const g=o.viewport.scrollTop,y=X6(g,a);i.current.style.transform=`translate3d(0, ${y}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=p(g))}}):null}),b1e=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=wi(Ps,e.__scopeScrollArea),[s,a]=w.useState(),c=w.useRef(null),u=Ua(t,c,i.onScrollbarXChange);return w.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),h.jsx(yV,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":zw(n)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,p)=>{if(i.viewport){const g=i.viewport.scrollLeft+f.deltaX;e.onWheelScroll(g),wV(g,p)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Mv(s.paddingLeft),paddingEnd:Mv(s.paddingRight)}})}})}),v1e=w.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=wi(Ps,e.__scopeScrollArea),[s,a]=w.useState(),c=w.useRef(null),u=Ua(t,c,i.onScrollbarYChange);return w.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),h.jsx(yV,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":zw(n)+"px",...e.style},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,p)=>{if(i.viewport){const g=i.viewport.scrollTop+f.deltaY;e.onWheelScroll(g),wV(g,p)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Mv(s.paddingTop),paddingEnd:Mv(s.paddingBottom)}})}})}),[x1e,gV]=uV(Ps),yV=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:f,onResize:p,...g}=e,y=wi(Ps,n),[v,x]=w.useState(null),S=Ua(t,V=>x(V)),E=w.useRef(null),C=w.useRef(""),_=y.viewport,j=r.content-r.viewport,A=lu(f),T=lu(c),k=Bw(p,10);function R(V){if(E.current){const H=V.clientX-E.current.left,F=V.clientY-E.current.top;u({x:H,y:F})}}return w.useEffect(()=>{const V=H=>{const F=H.target;v?.contains(F)&&A(H,j)};return document.addEventListener("wheel",V,{passive:!1}),()=>document.removeEventListener("wheel",V,{passive:!1})},[_,v,j,A]),w.useEffect(T,[r,T]),Bf(v,k),Bf(y.content,k),h.jsx(x1e,{scope:n,scrollbar:v,hasThumb:o,onThumbChange:lu(i),onThumbPointerUp:lu(s),onThumbPositionChange:T,onThumbPointerDown:lu(a),children:h.jsx(qu.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:Ql(e.onPointerDown,V=>{V.button===0&&(V.target.setPointerCapture(V.pointerId),E.current=v.getBoundingClientRect(),C.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),R(V))}),onPointerMove:Ql(e.onPointerMove,R),onPointerUp:Ql(e.onPointerUp,V=>{const H=V.target;H.hasPointerCapture(V.pointerId)&&H.releasePointerCapture(V.pointerId),document.body.style.webkitUserSelect=C.current,y.viewport&&(y.viewport.style.scrollBehavior=""),E.current=null})})})}),kv="ScrollAreaThumb",bV=w.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=gV(kv,e.__scopeScrollArea);return h.jsx(ty,{present:n||o.hasThumb,children:h.jsx(w1e,{ref:t,...r})})}),w1e=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=wi(kv,n),s=gV(kv,n),{onThumbPositionChange:a}=s,c=Ua(t,p=>s.onThumbChange(p)),u=w.useRef(void 0),f=Bw(()=>{u.current&&(u.current(),u.current=void 0)},100);return w.useEffect(()=>{const p=i.viewport;if(p){const g=()=>{if(f(),!u.current){const y=_1e(p,a);u.current=y,a()}};return a(),p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[i.viewport,f,a]),h.jsx(qu.div,{"data-state":s.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ql(e.onPointerDownCapture,p=>{const y=p.target.getBoundingClientRect(),v=p.clientX-y.left,x=p.clientY-y.top;s.onThumbPointerDown({x:v,y:x})}),onPointerUp:Ql(e.onPointerUp,s.onThumbPointerUp)})});bV.displayName=kv;var WA="ScrollAreaCorner",S1e=w.forwardRef((e,t)=>{const n=wi(WA,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?h.jsx(E1e,{...e,ref:t}):null});S1e.displayName=WA;var E1e=w.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=wi(WA,n),[i,s]=w.useState(0),[a,c]=w.useState(0),u=!!(i&&a);return Bf(o.scrollbarX,()=>{const f=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(f),c(f)}),Bf(o.scrollbarY,()=>{const f=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(f),s(f)}),u?h.jsx(qu.div,{...r,ref:t,style:{width:i,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Mv(e){return e?parseInt(e,10):0}function vV(e,t){const n=e/t;return isNaN(n)?0:n}function zw(e){const t=vV(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function N1e(e,t,n,r="ltr"){const o=zw(n),i=o/2,s=t||i,a=o-s,c=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,f=n.content-n.viewport,p=r==="ltr"?[0,f]:[f*-1,0];return xV([c,u],p)(e)}function X6(e,t,n="ltr"){const r=zw(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,c=n==="ltr"?[0,s]:[s*-1,0],u=h1e(e,c);return xV([0,s],[0,a])(u)}function xV(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function wV(e,t){return e>0&&e<t}var _1e=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Bw(e,t){const n=lu(e),r=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),w.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Bf(e,t){const n=lu(t);ig(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var SV=dV,EV=hV,Pv=pV,Dv=bV,Vw="Switch",[C1e]=cV(Vw),[O1e,j1e]=C1e(Vw),NV=w.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c="on",onCheckedChange:u,form:f,...p}=e,[g,y]=w.useState(null),v=Ua(t,_=>y(_)),x=w.useRef(!1),S=g?f||!!g.closest("form"):!0,[E,C]=t1e({prop:o,defaultProp:i??!1,onChange:u,caller:Vw});return h.jsxs(O1e,{scope:n,checked:E,disabled:a,children:[h.jsx(qu.button,{type:"button",role:"switch","aria-checked":E,"aria-required":s,"data-state":jV(E),"data-disabled":a?"":void 0,disabled:a,value:c,...p,ref:v,onClick:Ql(e.onClick,_=>{C(j=>!j),S&&(x.current=_.isPropagationStopped(),x.current||_.stopPropagation())})}),S&&h.jsx(OV,{control:g,bubbles:!x.current,name:r,value:c,checked:E,required:s,disabled:a,form:f,style:{transform:"translateX(-100%)"}})]})});NV.displayName=Vw;var _V="SwitchThumb",CV=w.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=j1e(_V,n);return h.jsx(qu.span,{"data-state":jV(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});CV.displayName=_V;var A1e="SwitchBubbleInput",OV=w.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},i)=>{const s=w.useRef(null),a=Ua(s,i),c=d1e(n),u=f1e(t);return w.useEffect(()=>{const f=s.current;if(!f)return;const p=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(p,"checked").set;if(c!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[c,n,r]),h.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:a,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});OV.displayName=A1e;function jV(e){return e?"checked":"unchecked"}var T1e=NV,$1e=CV;const R1e={xs:{className:"p-0.5",size:13},sm:{className:"p-0.5",size:15},md:{className:"p-1",size:18},lg:{className:"p-1.5",size:22}},ft=w.forwardRef(({Icon:e,size:t,variant:n="ghost",onClick:r,disabled:o,iconProps:i,tabIndex:s,...a},c)=>{const u=R1e[t??"md"];return h.jsx(Xe,{ref:c,variant:n,iconSize:u.size,iconProps:i,IconLeft:e,className:Be(u.className,a.className),onClick:r,disabled:o,tabIndex:s})});function AV(e){return e.match(/:(\w+)\??/)?.[1]??""}function Q6(e,t){return t?e.replace(/:\w+\??/,t):e.replace(/\/:\w+\??/,"")}function GA(e,t){const n=k1e(e??""),r=e??n?.path??"",o=AV(r),i=Mw()[o],[s,a]=w.useState(i===t),c=n?t===n.activeIdentifier:s,[,u]=Uo();function f(p){const g=p??!s;n&&n.setActiveIdentifier(t),r?u(g?Q6(r,t):Q6(r)):a(g)}return w.useEffect(()=>{!n&&e&&t&&a(i===t)},[i,t,e]),{active:c,toggle:f}}const TV=w.createContext(void 0);function $V({children:e,defaultIdentifier:t,path:n}){const r=AV(n),o=Mw()[r],[i,s]=w.useState(o??t);return h.jsx(TV.Provider,{value:{defaultIdentifier:t,path:n,activeIdentifier:i,setActiveIdentifier:s},children:e})}function k1e(e){const t=w.use(TV);if(t&&(!e||t.path===e))return t}const RV=w.createContext(void 0);function M1e({children:e}){const{width:t}=vX(),[n,r]=oh(t>768);return h.jsx(RV.Provider,{value:{sidebar:{open:n,handler:r}},children:e})}function P1e(){return w.useContext(RV)}const wa=Lw(sV(ey({sidebars:{default:{open:!1,width:350}}},e=>({toggleSidebar:t=>()=>e(n=>{const r=n.sidebars[t];return r?{sidebars:{...n.sidebars,[t]:{...r,open:!r.open}}}:n}),closeSidebar:t=>()=>e(n=>{const r=n.sidebars[t];return r?{sidebars:{...n.sidebars,[t]:{...r,open:!1}}}:n}),setSidebarWidth:t=>n=>e(r=>{const o=r.sidebars[t];return o?{sidebars:{...r.sidebars,[t]:{...o,width:n}}}:{sidebars:{...r.sidebars,[t]:{open:!1,width:n}}}}),resetSidebarWidth:t=>e(n=>{const r=n.sidebars[t];return r?{sidebars:{...n.sidebars,[t]:{...r,width:350}}}:n}),setSidebarState:(t,n)=>e(r=>({sidebars:{...r.sidebars,[t]:n}}))})),{name:"appshell",version:1,migrate:()=>({sidebars:{default:{open:!1,width:350}}})}));var kV={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Z6=Ne.createContext&&Ne.createContext(kV),D1e=["attr","size","title"];function I1e(e,t){if(e==null)return{};var n=L1e(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function L1e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Iv(){return Iv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Iv.apply(this,arguments)}function eP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Lv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eP(Object(n),!0).forEach(function(r){F1e(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eP(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}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=B1e(e,"string");return typeof t=="symbol"?t:t+""}function B1e(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function MV(e){return e&&e.map((t,n)=>Ne.createElement(t.tag,Lv({key:n},t.attr),MV(t.child)))}function Le(e){return t=>Ne.createElement(V1e,Iv({attr:Lv({},e.attr)},t),MV(e.child))}function V1e(e){var t=n=>{var{attr:r,size:o,title:i}=e,s=I1e(e,D1e),a=o||n.size||"1em",c;return n.className&&(c=n.className),e.className&&(c=(c?c+" ":"")+e.className),Ne.createElement("svg",Iv({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:c,style:Lv(Lv({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),i&&Ne.createElement("title",null,i),e.children)};return Z6!==void 0?Ne.createElement(Z6.Consumer,null,n=>t(n)):t(kV)}function U1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15.079 5.999l.239 .012c1.43 .097 3.434 1.013 4.508 2.586a1 1 0 0 1 -.344 1.44c-.05 .028 -.372 .158 -.497 .217a4.15 4.15 0 0 0 -.722 .431c-.614 .461 -.948 1.009 -.942 1.694c.01 .885 .339 1.454 .907 1.846c.208 .143 .436 .253 .666 .33c.126 .043 .426 .116 .444 .122a1 1 0 0 1 .662 .942c0 2.621 -3.04 6.381 -5.286 6.381c-.79 0 -1.272 -.091 -1.983 -.315l-.098 -.031c-.463 -.146 -.702 -.192 -1.133 -.192c-.52 0 -.863 .06 -1.518 .237l-.197 .053c-.575 .153 -.964 .226 -1.5 .248c-2.749 0 -5.285 -5.093 -5.285 -9.072c0 -3.87 1.786 -6.92 5.286 -6.92c.297 0 .598 .045 .909 .128c.403 .107 .774 .26 1.296 .508c.787 .374 .948 .44 1.009 .44h.016c.03 -.003 .128 -.047 1.056 -.457c1.061 -.467 1.864 -.685 2.746 -.616l-.24 -.012z"},child:[]},{tag:"path",attr:{d:"M14 1a1 1 0 0 1 1 1a3 3 0 0 1 -3 3a1 1 0 0 1 -1 -1a3 3 0 0 1 3 -3z"},child:[]}]})(e)}function H1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M14.983 3l.123 .006c2.014 .214 3.527 .672 4.966 1.673a1 1 0 0 1 .371 .488c1.876 5.315 2.373 9.987 1.451 12.28c-1.003 2.005 -2.606 3.553 -4.394 3.553c-.732 0 -1.693 -.968 -2.328 -2.045a21.512 21.512 0 0 0 2.103 -.493a1 1 0 1 0 -.55 -1.924c-3.32 .95 -6.13 .95 -9.45 0a1 1 0 0 0 -.55 1.924c.717 .204 1.416 .37 2.103 .494c-.635 1.075 -1.596 2.044 -2.328 2.044c-1.788 0 -3.391 -1.548 -4.428 -3.629c-.888 -2.217 -.39 -6.89 1.485 -12.204a1 1 0 0 1 .371 -.488c1.439 -1.001 2.952 -1.459 4.966 -1.673a1 1 0 0 1 .935 .435l.063 .107l.651 1.285l.137 -.016a12.97 12.97 0 0 1 2.643 0l.134 .016l.65 -1.284a1 1 0 0 1 .754 -.54l.122 -.009zm-5.983 7a2 2 0 0 0 -1.977 1.697l-.018 .154l-.005 .149l.005 .15a2 2 0 1 0 1.995 -2.15zm6 0a2 2 0 0 0 -1.977 1.697l-.018 .154l-.005 .149l.005 .15a2 2 0 1 0 1.995 -2.15z"},child:[]}]})(e)}function q1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18 2a1 1 0 0 1 .993 .883l.007 .117v4a1 1 0 0 1 -.883 .993l-.117 .007h-3v1h3a1 1 0 0 1 .991 1.131l-.02 .112l-1 4a1 1 0 0 1 -.858 .75l-.113 .007h-2v6a1 1 0 0 1 -.883 .993l-.117 .007h-4a1 1 0 0 1 -.993 -.883l-.007 -.117v-6h-2a1 1 0 0 1 -.993 -.883l-.007 -.117v-4a1 1 0 0 1 .883 -.993l.117 -.007h2v-1a6 6 0 0 1 5.775 -5.996l.225 -.004h3z"},child:[]}]})(e)}function W1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.315 2.1c.791 -.113 1.9 .145 3.333 .966l.272 .161l.16 .1l.397 -.083a13.3 13.3 0 0 1 4.59 -.08l.456 .08l.396 .083l.161 -.1c1.385 -.84 2.487 -1.17 3.322 -1.148l.164 .008l.147 .017l.076 .014l.05 .011l.144 .047a1 1 0 0 1 .53 .514a5.2 5.2 0 0 1 .397 2.91l-.047 .267l-.046 .196l.123 .163c.574 .795 .93 1.728 1.03 2.707l.023 .295l.007 .272c0 3.855 -1.659 5.883 -4.644 6.68l-.245 .061l-.132 .029l.014 .161l.008 .157l.004 .365l-.002 .213l-.003 3.834a1 1 0 0 1 -.883 .993l-.117 .007h-6a1 1 0 0 1 -.993 -.883l-.007 -.117v-.734c-1.818 .26 -3.03 -.424 -4.11 -1.878l-.535 -.766c-.28 -.396 -.455 -.579 -.589 -.644l-.048 -.019a1 1 0 0 1 .564 -1.918c.642 .188 1.074 .568 1.57 1.239l.538 .769c.76 1.079 1.36 1.459 2.609 1.191l.001 -.678l-.018 -.168a5.03 5.03 0 0 1 -.021 -.824l.017 -.185l.019 -.12l-.108 -.024c-2.976 -.71 -4.703 -2.573 -4.875 -6.139l-.01 -.31l-.004 -.292a5.6 5.6 0 0 1 .908 -3.051l.152 -.222l.122 -.163l-.045 -.196a5.2 5.2 0 0 1 .145 -2.642l.1 -.282l.106 -.253a1 1 0 0 1 .529 -.514l.144 -.047l.154 -.03z"},child:[]}]})(e)}function G1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 2a9.96 9.96 0 0 1 6.29 2.226a1 1 0 0 1 .04 1.52l-1.51 1.362a1 1 0 0 1 -1.265 .06a6 6 0 1 0 2.103 6.836l.001 -.004h-3.66a1 1 0 0 1 -.992 -.883l-.007 -.117v-2a1 1 0 0 1 1 -1h6.945a1 1 0 0 1 .994 .89c.04 .367 .061 .737 .061 1.11c0 5.523 -4.477 10 -10 10s-10 -4.477 -10 -10s4.477 -10 10 -10z"},child:[]}]})(e)}function J1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"},child:[]}]})(e)}function Y1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z"},child:[]}]})(e)}function K1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.333 2c1.96 0 3.56 1.537 3.662 3.472l.005 .195v12.666c0 1.96 -1.537 3.56 -3.472 3.662l-.195 .005h-12.666a3.667 3.667 0 0 1 -3.662 -3.472l-.005 -.195v-12.666c0 -1.96 1.537 -3.56 3.472 -3.662l.195 -.005h12.666zm-2.626 7.293a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"},child:[]}]})(e)}function X1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 10a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"},child:[]},{tag:"path",attr:{d:"M6 4v4"},child:[]},{tag:"path",attr:{d:"M6 12v8"},child:[]},{tag:"path",attr:{d:"M10 16a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"},child:[]},{tag:"path",attr:{d:"M12 4v10"},child:[]},{tag:"path",attr:{d:"M12 18v2"},child:[]},{tag:"path",attr:{d:"M16 7a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"},child:[]},{tag:"path",attr:{d:"M18 4v1"},child:[]},{tag:"path",attr:{d:"M18 9v11"},child:[]}]})(e)}function PV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"},child:[]},{tag:"path",attr:{d:"M12 8v4"},child:[]},{tag:"path",attr:{d:"M12 16h.01"},child:[]}]})(e)}function Q1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 5l0 14"},child:[]},{tag:"path",attr:{d:"M18 13l-6 6"},child:[]},{tag:"path",attr:{d:"M6 13l6 6"},child:[]}]})(e)}function JA(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l14 0"},child:[]},{tag:"path",attr:{d:"M5 12l6 6"},child:[]},{tag:"path",attr:{d:"M5 12l6 -6"},child:[]}]})(e)}function Z1e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l14 0"},child:[]},{tag:"path",attr:{d:"M13 18l6 -6"},child:[]},{tag:"path",attr:{d:"M13 6l6 6"},child:[]}]})(e)}function eSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 5l0 14"},child:[]},{tag:"path",attr:{d:"M18 11l-6 -6"},child:[]},{tag:"path",attr:{d:"M6 11l6 -6"},child:[]}]})(e)}function tSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"},child:[]},{tag:"path",attr:{d:"M16 12v1.5a2.5 2.5 0 0 0 5 0v-1.5a9 9 0 1 0 -5.5 8.28"},child:[]}]})(e)}function nSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5"},child:[]},{tag:"path",attr:{d:"M12 12l8 -4.5"},child:[]},{tag:"path",attr:{d:"M12 12l0 9"},child:[]},{tag:"path",attr:{d:"M12 12l-8 -4.5"},child:[]}]})(e)}function rSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 4a2 2 0 0 0 -2 2v3a2 3 0 0 1 -2 3a2 3 0 0 1 2 3v3a2 2 0 0 0 2 2"},child:[]},{tag:"path",attr:{d:"M17 4a2 2 0 0 1 2 2v3a2 3 0 0 0 2 3a2 3 0 0 0 -2 3v3a2 2 0 0 1 -2 2"},child:[]}]})(e)}function oSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 8a4 4 0 0 1 4 -4h8a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-8a4 4 0 0 1 -4 -4z"},child:[]},{tag:"path",attr:{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},child:[]},{tag:"path",attr:{d:"M16.5 7.5v.01"},child:[]}]})(e)}function iSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 12m-10 0a10 10 0 1 0 20 0a10 10 0 1 0 -20 0"},child:[]},{tag:"path",attr:{d:"M12.556 6c.65 0 1.235 .373 1.508 .947l2.839 7.848a1.646 1.646 0 0 1 -1.01 2.108a1.673 1.673 0 0 1 -2.068 -.851l-.46 -1.052h-2.73l-.398 .905a1.67 1.67 0 0 1 -1.977 1.045l-.153 -.047a1.647 1.647 0 0 1 -1.056 -1.956l2.824 -7.852a1.664 1.664 0 0 1 1.409 -1.087l1.272 -.008z"},child:[]}]})(e)}function sSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 4l11.733 16h4.267l-11.733 -16z"},child:[]},{tag:"path",attr:{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"},child:[]}]})(e)}function DV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z"},child:[]},{tag:"path",attr:{d:"M16 3v4"},child:[]},{tag:"path",attr:{d:"M8 3v4"},child:[]},{tag:"path",attr:{d:"M4 11h16"},child:[]},{tag:"path",attr:{d:"M11 15h1"},child:[]},{tag:"path",attr:{d:"M12 15v3"},child:[]}]})(e)}function aSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l5 5l10 -10"},child:[]}]})(e)}function IV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 9l6 6l6 -6"},child:[]}]})(e)}function lSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 6l-6 6l6 6"},child:[]}]})(e)}function cSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 6l6 6l-6 6"},child:[]}]})(e)}function uSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 15l6 -6l6 6"},child:[]}]})(e)}function dSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M11 7l-5 5l5 5"},child:[]},{tag:"path",attr:{d:"M17 7l-5 5l5 5"},child:[]}]})(e)}function fSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 7l5 5l-5 5"},child:[]},{tag:"path",attr:{d:"M13 7l5 5l-5 5"},child:[]}]})(e)}function hSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"},child:[]}]})(e)}function YA(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9.183 6.117a6 6 0 1 0 4.511 3.986"},child:[]},{tag:"path",attr:{d:"M14.813 17.883a6 6 0 1 0 -4.496 -3.954"},child:[]}]})(e)}function pSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 12h.01"},child:[]},{tag:"path",attr:{d:"M12 12h.01"},child:[]},{tag:"path",attr:{d:"M9 12h.01"},child:[]},{tag:"path",attr:{d:"M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2"},child:[]}]})(e)}function mSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 12h6"},child:[]},{tag:"path",attr:{d:"M12 9v6"},child:[]},{tag:"path",attr:{d:"M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2"},child:[]}]})(e)}function LV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"},child:[]},{tag:"path",attr:{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"},child:[]}]})(e)}function FV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 6c0 1.657 3.582 3 8 3s8 -1.343 8 -3s-3.582 -3 -8 -3s-8 1.343 -8 3"},child:[]},{tag:"path",attr:{d:"M4 6v6c0 1.657 3.582 3 8 3c1.075 0 2.1 -.08 3.037 -.224"},child:[]},{tag:"path",attr:{d:"M20 12v-6"},child:[]},{tag:"path",attr:{d:"M4 12v6c0 1.657 3.582 3 8 3c.166 0 .331 -.002 .495 -.006"},child:[]},{tag:"path",attr:{d:"M16 19h6"},child:[]},{tag:"path",attr:{d:"M19 16v6"},child:[]}]})(e)}function gSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0"},child:[]},{tag:"path",attr:{d:"M4 6v6a8 3 0 0 0 16 0v-6"},child:[]},{tag:"path",attr:{d:"M4 12v6a8 3 0 0 0 16 0v-6"},child:[]}]})(e)}function G8e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10.831 20.413l-5.375 -6.91c-.608 -.783 -.608 -2.223 0 -3l5.375 -6.911a1.457 1.457 0 0 1 2.338 0l5.375 6.91c.608 .783 .608 2.223 0 3l-5.375 6.911a1.457 1.457 0 0 1 -2.338 0z"},child:[]}]})(e)}function ySe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]}]})(e)}function Ha(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]}]})(e)}function bSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"},child:[]},{tag:"path",attr:{d:"M11 13l9 -9"},child:[]},{tag:"path",attr:{d:"M15 4h5v5"},child:[]}]})(e)}function vSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828"},child:[]},{tag:"path",attr:{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"},child:[]},{tag:"path",attr:{d:"M3 3l18 18"},child:[]}]})(e)}function zV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"},child:[]},{tag:"path",attr:{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"},child:[]}]})(e)}function xSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"},child:[]},{tag:"path",attr:{d:"M9 9l1 0"},child:[]},{tag:"path",attr:{d:"M9 13l6 0"},child:[]},{tag:"path",attr:{d:"M9 17l6 0"},child:[]}]})(e)}function wSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"},child:[]},{tag:"path",attr:{d:"M7 16.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0"},child:[]},{tag:"path",attr:{d:"M10 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"},child:[]},{tag:"path",attr:{d:"M16 15l2 6l2 -6"},child:[]}]})(e)}function SSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"},child:[]},{tag:"path",attr:{d:"M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6"},child:[]},{tag:"path",attr:{d:"M17 18h2"},child:[]},{tag:"path",attr:{d:"M20 15h-3v6"},child:[]},{tag:"path",attr:{d:"M11 15v6h1a2 2 0 0 0 2 -2v-2a2 2 0 0 0 -2 -2h-1z"},child:[]}]})(e)}function ESe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M5 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75"},child:[]},{tag:"path",attr:{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"},child:[]},{tag:"path",attr:{d:"M18 15v6h2"},child:[]},{tag:"path",attr:{d:"M13 15a2 2 0 0 1 2 2v2a2 2 0 1 1 -4 0v-2a2 2 0 0 1 2 -2z"},child:[]},{tag:"path",attr:{d:"M14 20l1.5 1.5"},child:[]}]})(e)}function NSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M16.5 15h3"},child:[]},{tag:"path",attr:{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"},child:[]},{tag:"path",attr:{d:"M4.5 15h3"},child:[]},{tag:"path",attr:{d:"M6 15v6"},child:[]},{tag:"path",attr:{d:"M18 15v6"},child:[]},{tag:"path",attr:{d:"M10 15l4 6"},child:[]},{tag:"path",attr:{d:"M10 21l4 -6"},child:[]}]})(e)}function _Se(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 3v4a1 1 0 0 0 1 1h4"},child:[]},{tag:"path",attr:{d:"M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4"},child:[]},{tag:"path",attr:{d:"M4 15l4 6"},child:[]},{tag:"path",attr:{d:"M4 21l4 -6"},child:[]},{tag:"path",attr:{d:"M19 15v6h3"},child:[]},{tag:"path",attr:{d:"M11 21v-6l2.5 3l2.5 -3v6"},child:[]}]})(e)}function CSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},child:[]}]})(e)}function BV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18.9 7a8 8 0 0 1 1.1 5v1a6 6 0 0 0 .8 3"},child:[]},{tag:"path",attr:{d:"M8 11a4 4 0 0 1 8 0v1a10 10 0 0 0 2 6"},child:[]},{tag:"path",attr:{d:"M12 11v2a14 14 0 0 0 2.5 8"},child:[]},{tag:"path",attr:{d:"M8 15a18 18 0 0 0 1.8 6"},child:[]},{tag:"path",attr:{d:"M4.9 19a22 22 0 0 1 -.9 -7v-1a8 8 0 0 1 12 -6.95"},child:[]}]})(e)}function OSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M9 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M15 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]},{tag:"path",attr:{d:"M15 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},child:[]}]})(e)}function jSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 3h4v4h-4z"},child:[]},{tag:"path",attr:{d:"M3 17h4v4h-4z"},child:[]},{tag:"path",attr:{d:"M17 17h4v4h-4z"},child:[]},{tag:"path",attr:{d:"M7 17l5 -4l5 4"},child:[]},{tag:"path",attr:{d:"M12 7l0 6"},child:[]}]})(e)}function ASe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3.05 11a8.975 8.975 0 0 1 2.54 -5.403m2.314 -1.697a9 9 0 0 1 12.113 12.112m-1.695 2.312a9 9 0 0 1 -14.772 -3.324m-.5 5v-5h5"},child:[]},{tag:"path",attr:{d:"M3 3l18 18"},child:[]}]})(e)}function TSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 8l0 4l2 2"},child:[]},{tag:"path",attr:{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"},child:[]}]})(e)}function VV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"},child:[]},{tag:"path",attr:{d:"M12 9h.01"},child:[]},{tag:"path",attr:{d:"M11 12h1v4h1"},child:[]}]})(e)}function $Se(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 16v-8l3 8v-8"},child:[]},{tag:"path",attr:{d:"M15 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"},child:[]},{tag:"path",attr:{d:"M1 8h3v6.5a1.5 1.5 0 0 1 -3 0v-.5"},child:[]},{tag:"path",attr:{d:"M7 15a1 1 0 0 0 1 1h1a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h1a1 1 0 0 1 1 1"},child:[]}]})(e)}function J8e(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1 -4.069 0l-.301 -.301l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.172a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.172a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.877 2.877 0 0 1 0 -4.069l2.643 -2.643a2.877 2.877 0 0 1 4.069 0z"},child:[]},{tag:"path",attr:{d:"M15 9h.01"},child:[]}]})(e)}function RSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M7 15v-6l2 2l2 -2v6"},child:[]},{tag:"path",attr:{d:"M14 13l2 2l2 -2m-2 2v-6"},child:[]}]})(e)}function kSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 8v-2a2 2 0 0 1 2 -2h2"},child:[]},{tag:"path",attr:{d:"M4 16v2a2 2 0 0 0 2 2h2"},child:[]},{tag:"path",attr:{d:"M16 4h2a2 2 0 0 1 2 2v2"},child:[]},{tag:"path",attr:{d:"M16 20h2a2 2 0 0 0 2 -2v-2"},child:[]}]})(e)}function MSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 6l16 0"},child:[]},{tag:"path",attr:{d:"M4 12l16 0"},child:[]},{tag:"path",attr:{d:"M4 18l16 0"},child:[]}]})(e)}function PSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 12l14 0"},child:[]}]})(e)}function DSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},child:[]},{tag:"path",attr:{d:"M13 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},child:[]},{tag:"path",attr:{d:"M9 17v-13h10v13"},child:[]},{tag:"path",attr:{d:"M9 8h10"},child:[]}]})(e)}function ISe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 10l2 -2v8"},child:[]},{tag:"path",attr:{d:"M9 8h3a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h3"},child:[]},{tag:"path",attr:{d:"M17 8h2.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1 -1.5 1.5h-1.5h1.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1 -1.5 1.5h-2.5"},child:[]}]})(e)}function ny(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 8h.01"},child:[]},{tag:"path",attr:{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z"},child:[]},{tag:"path",attr:{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"},child:[]},{tag:"path",attr:{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3"},child:[]}]})(e)}function UV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 5l0 14"},child:[]},{tag:"path",attr:{d:"M5 12l14 0"},child:[]}]})(e)}function HV(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"},child:[]},{tag:"path",attr:{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"},child:[]}]})(e)}function KA(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 9l4 -4l4 4"},child:[]},{tag:"path",attr:{d:"M16 15l-4 4l-4 -4"},child:[]}]})(e)}function _h(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z"},child:[]},{tag:"path",attr:{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},child:[]}]})(e)}function fC(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 15m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M15 15m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M6 15v-1a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v1"},child:[]},{tag:"path",attr:{d:"M12 9l0 3"},child:[]}]})(e)}function LSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z"},child:[]}]})(e)}function tP(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 15h16"},child:[]},{tag:"path",attr:{d:"M4 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"},child:[]},{tag:"path",attr:{d:"M4 20h12"},child:[]}]})(e)}function FSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M2 6m0 6a6 6 0 0 1 6 -6h8a6 6 0 0 1 6 6v0a6 6 0 0 1 -6 6h-8a6 6 0 0 1 -6 -6z"},child:[]}]})(e)}function XA(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 7l16 0"},child:[]},{tag:"path",attr:{d:"M10 11l0 6"},child:[]},{tag:"path",attr:{d:"M14 11l0 6"},child:[]},{tag:"path",attr:{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"},child:[]},{tag:"path",attr:{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"},child:[]}]})(e)}function zSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},child:[]},{tag:"path",attr:{d:"M7 9l5 -5l5 5"},child:[]},{tag:"path",attr:{d:"M12 4l0 12"},child:[]}]})(e)}function BSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"},child:[]},{tag:"path",attr:{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"},child:[]}]})(e)}function VSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 4c-2.5 5 -2.5 10 0 16m14 -16c2.5 5 2.5 10 0 16m-10 -11h1c1 0 1 1 2.016 3.527c.984 2.473 .984 3.473 1.984 3.473h1"},child:[]},{tag:"path",attr:{d:"M8 16c1.5 0 3 -2 4 -3.5s2.5 -3.5 4 -3.5"},child:[]}]})(e)}function USe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"},child:[]},{tag:"path",attr:{d:"M3.6 9h16.8"},child:[]},{tag:"path",attr:{d:"M3.6 15h16.8"},child:[]},{tag:"path",attr:{d:"M11.5 3a17 17 0 0 0 0 18"},child:[]},{tag:"path",attr:{d:"M12.5 3a17 17 0 0 1 0 18"},child:[]}]})(e)}function QA(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18 6l-12 12"},child:[]},{tag:"path",attr:{d:"M6 6l12 12"},child:[]}]})(e)}function HSe(e){return Le({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M16 16v-8h2a2 2 0 1 1 0 4h-2"},child:[]},{tag:"path",attr:{d:"M12 8v8"},child:[]},{tag:"path",attr:{d:"M4 8h4l-4 8h4"},child:[]}]})(e)}function Nr({children:e,defaultOpen:t=!1,openEvent:n="onClick",position:r="bottom-start",dropdownWrapperProps:o,items:i,title:s,hideOnEmpty:a=!0,onClickItem:c,renderItem:u,itemsClassName:f,className:p}){const[g,y]=w.useState(t),[v,x]=w.useState(r),S=jg(()=>y(!1)),E=i.filter(Boolean),[C,_]=w.useState(0),j=It((B=50)=>setTimeout(()=>y(U=>!U),typeof B=="number"?B:0)),A=n==="onClick"?B=>{B.stopPropagation(),j()}:void 0,T=It(B=>{if(n!=="onContextMenu")return;if(B.preventDefault(),g){j(0),setTimeout(()=>{x(r),_(0)},10);return}const U=B.clientX-B.currentTarget.getBoundingClientRect().left,{left:M=0,right:z=0}=S.current?.getBoundingClientRect()??{};if(M>0&&z>0){const $=GL(U,M,z);U<(M+z)/2?(x("bottom-start"),_($)):(x("bottom-end"),_(z-$))}else x(r),_(0);j()}),k=4,R={"bottom-start":{top:"100%",left:C,marginTop:k},"bottom-end":{right:C,top:"100%",marginTop:k},"top-start":{bottom:"100%",marginBottom:k},"top-end":{bottom:"100%",right:C,marginBottom:k}}[v],V=It(B=>{B.onClick&&B.onClick(),c&&c(B),j(50)});if(E.length===0&&a)return null;const H=E.some(B=>"icon"in B&&B.icon),F=u||((B,{key:U,onClick:M})=>typeof B=="function"?h.jsx(w.Fragment,{children:B()},U):h.jsxs("button",{type:"button",disabled:B.disabled,className:Be("flex flex-row flex-nowrap text-nowrap items-center outline-none cursor-pointer px-2.5 rounded-md link leading-none h-8",f,B.disabled?"opacity-50 cursor-not-allowed":"hover:bg-primary/10",B.destructive&&"text-red-500 hover:bg-red-600 hover:text-white"),onClick:M,title:B.title,children:[H&&h.jsx("div",{className:"size-[16px] text-left mr-1.5 opacity-80",children:B.icon&&h.jsx(B.icon,{className:"size-[16px]"})}),h.jsx("div",{className:"flex flex-grow truncate text-nowrap",children:B.label})]},U));return h.jsxs("div",{role:"dropdown",className:Be("relative flex",p),ref:S,onContextMenu:T,children:[w.cloneElement(e,{onClick:A}),g&&h.jsxs("div",{...o,className:Be("absolute z-30 flex flex-col bg-background border border-muted px-1 py-1 rounded-lg shadow-lg min-w-full",o?.className),style:R,children:[s&&h.jsx("div",{className:"text-sm font-bold px-2.5 mb-1 mt-1 opacity-50 truncate",children:s}),E.map((B,U)=>F(B,{key:U,onClick:M=>{M.stopPropagation(),V(B)}}))]})]})}const ZA=()=>h.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:"1"},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("title",{children:"ModelContextProtocol"}),h.jsx("path",{d:"M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z"}),h.jsx("path",{d:"M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z"})]});function Uw(e,t,n){const o=ot().options?.entities?.[e.name],i=o?.footer?.(t,e,n)??null,s=o?.header?.(t,e,n)??null,a=o?.actions?.(t,e,n);return{footer:i,header:s,field:c=>o?.fields?.[c],actions:a}}function qSe(){const{options:e}=ot();return{userMenu:e?.appShell?.userMenu??[]}}function WSe(){const[e,t]=Uo(),{config:n}=ot(),r=[{label:"Data",href:"/data",Icon:gSe},{label:"Auth",href:"/auth",Icon:BV},{label:"Media",href:"/media",Icon:ny}];(ir()||Object.keys(n.flows?.flows??{}).length>0)&&r.push({label:"Flows",href:"/flows",Icon:jSe}),n.server.mcp.enabled&&r.push({label:"MCP",href:"/tools/mcp",Icon:ZA});const o=r.find(a=>a.exact?e===a.href:e.startsWith(a.href)),i=It(a=>{t(a.href)}),s=(a,{key:c,onClick:u})=>h.jsx(vm,{onClick:u,as:"button",className:"rounded-md",children:h.jsxs("div",{"data-active":o?.label===a.label,className:"flex flex-row items-center gap-2.5 data-[active=true]:opacity-50",children:[h.jsx(a.Icon,{size:18}),h.jsx("span",{className:"text-lg",children:a.label})]})},c);return h.jsxs(h.Fragment,{children:[h.jsx("nav",{className:"hidden md:flex flex-row gap-2.5 pl-0 p-2.5 items-center",children:r.map(a=>h.jsx(vm,{as:Nn,href:a.href,Icon:a.Icon,disabled:a.disabled,children:a.label},a.href))}),h.jsx("nav",{className:"flex md:hidden flex-row items-center",children:o&&h.jsx(Nr,{items:r,onClickItem:i,renderItem:s,children:h.jsx(vm,{as:"button",Icon:o.Icon,className:"active pl-6 pr-3.5",children:h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[h.jsx("span",{className:"text-lg",children:o.label}),h.jsx(KA,{size:18,className:"opacity-70"})]})})})})]})}function GSe({name:e="default"}){const t=wa(r=>r.toggleSidebar(e)),n=wa(r=>r.sidebars[e]?.open);return h.jsx(ft,{id:"toggle-sidebar",size:"lg",Icon:n?QA:MSe,onClick:t})}function JSe({hasSidebar:e=!0}){const{app:t}=ot(),{theme:n}=Va(),{logo_return_path:r="/"}=t.options;return h.jsxs("header",{id:"header","data-shell":"header",className:"flex flex-row w-full h-16 gap-2.5 border-muted border-b justify-start bg-muted/10",children:[h.jsx(Nn,{href:r,native:r!=="/",className:"max-h-full flex hover:bg-primary/5 link p-2.5 w-[134px] outline-none",children:h.jsx(Fw,{theme:n})}),h.jsx(WSe,{}),h.jsx("div",{className:"flex flex-grow"}),h.jsxs("div",{className:"flex md:hidden flex-row items-center pr-2 gap-2",children:[h.jsx(GSe,{name:"default"}),h.jsx(nP,{})]}),h.jsx("div",{className:"hidden md:flex flex-row items-center px-4 gap-2",children:h.jsx(nP,{})})]})}function nP(){const{config:e}=ot(),t=qSe(),n=DA(),[r]=Pn(),{logout_route:o}=Rw();async function i(){await n.logout(),n.local||r(o,{reload:!0})}async function s(){r("/auth/login")}const a=[...t.userMenu??[],{label:"Settings",onClick:()=>r("/settings"),icon:rg},{label:"OpenAPI",onClick:()=>window.open("/api/system/swagger","_blank"),icon:wve},{label:"Docs",onClick:()=>window.open("https://docs.bknd.io","_blank"),icon:_ve}];return e.server.mcp.enabled&&a.push({label:"MCP",onClick:()=>r("/tools/mcp"),icon:ZA}),e.auth.enabled&&(n.user?a.push({label:"Logout",title:`Logout ${n.user.email}`,onClick:i,icon:Xve}):a.push({label:"Login",onClick:s,icon:mxe})),a.push(()=>h.jsx(YSe,{})),a.push(()=>h.jsx("div",{className:"font-mono leading-none text-xs text-primary/50 text-center pb-1 pt-2 mt-1 border-t border-primary/5",children:Joe()})),h.jsx(h.Fragment,{children:h.jsx(Nr,{items:a,position:"bottom-end",children:n.user?h.jsx(Xe,{className:"rounded-full w-12 h-12 justify-center p-0 text-lg",children:n.user.email[0]?.toUpperCase()}):h.jsx(Xe,{className:"rounded-full w-12 h-12 justify-center p-0",IconLeft:BSe})})})}function YSe(){const{value:e,themes:t,setTheme:n}=Va();return h.jsx("div",{className:"flex flex-col items-center mt-1 pt-1 border-t border-primary/5",children:h.jsx(bc,{withItemsBorders:!1,className:"w-full",data:t.map(r=>({value:r,label:Ta(r)})),value:e,onChange:n,size:"xs"})})}function qV({children:e}){const t=wa(r=>r.sidebars),n=Vt(t,r=>r.width);return h.jsx(M1e,{children:h.jsx("div",{id:"app-shell","data-shell":"root",className:"flex flex-1 flex-col select-none h-dvh",style:Object.fromEntries(Object.entries(n).map(([r,o])=>[`--sidebar-width-${r}`,`${o}px`])),children:e})})}const vm=({children:e,as:t,className:n,Icon:r,disabled:o,...i})=>{const s=t||"a";return h.jsxs(s,{...i,className:Be("px-6 py-2 [&.active]:bg-muted [&.active]:hover:bg-primary/15 hover:bg-primary/5 flex flex-row items-center rounded-full gap-2.5 link transition-colors",o&&"opacity-50 cursor-not-allowed",n),children:[r&&h.jsx(r,{size:18}),typeof e=="string"?h.jsx("span",{className:"text-lg",children:e}):e]})};function WV({children:e,center:t}){return h.jsx("main",{"data-shell":"content",className:Be("flex flex-1 flex-row max-w-screen h-full",t&&"justify-center items-center"),children:e})}function ry({children:e}){const{sidebar:t}=P1e();return h.jsx("div",{"data-shell":"main",className:Be("flex flex-col flex-grow w-1 flex-shrink-1",t.open&&"md:max-w-[calc(100%-var(--sidebar-width))]"),children:e})}function Wu({children:e,name:t="default",handle:n="right",minWidth:r,maxWidth:o}){const i=wa(g=>g.sidebars[t]?.open),s=wa(g=>g.closeSidebar(t)),a=wa(g=>g.sidebars[t]?.width??350),c=jg(s,["mouseup","touchend"]),u=w.useRef(null),[f]=Uo(),p=()=>{i&&s()};return w.useEffect(p,[f]),bO([["Escape",p]]),h.jsxs(h.Fragment,{children:[n==="left"&&h.jsx(rP,{name:t,handle:n,sidebarRef:u,minWidth:r,maxWidth:o}),h.jsx("aside",{"data-shell":"sidebar",ref:u,className:"hidden md:flex flex-col flex-shrink-0 flex-grow-0 h-full bg-muted/10",style:{width:a},children:e}),n==="right"&&h.jsx(rP,{name:t,handle:n,sidebarRef:u,minWidth:r,maxWidth:o}),h.jsx("div",{"data-open":i,className:"absolute w-full md:hidden data-[open=true]:translate-x-0 translate-x-[-100%] transition-transform z-10 backdrop-blur-sm max-w-[90%]",children:h.jsx("aside",{ref:c,"data-shell":"sidebar",className:"flex-col w-[var(--sidebar-width)] flex-shrink-0 flex-grow-0 h-full border-muted border-r bg-background",children:h.jsx(XSe,{className:"overflow-y-scroll md:overflow-y-hidden",children:e})})})]})}const rP=({name:e="default",handle:t="right",sidebarRef:n,minWidth:r=250,maxWidth:o=window.innerWidth*.5})=>{const i=wa(x=>x.setSidebarWidth(e)),[s,a]=w.useState(!1),[c,u]=w.useState(0),[f,p]=w.useState(n.current?.offsetWidth??0),g=x=>{x.preventDefault(),a(!0),u(x.clientX),p(n.current?.offsetWidth??0)},y=x=>{if(!s)return;const S=t==="right"?x.clientX-c:c-x.clientX,E=GL(f+S,r,o);i(E)},v=()=>{a(!1)};return w.useEffect(()=>(s&&(window.addEventListener("mousemove",y),window.addEventListener("mouseup",v)),()=>{window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",v)}),[s,c,f,r,o]),h.jsx("div",{"data-shell":"sidebar-resize","data-active":s?1:void 0,className:"w-px h-full hidden md:flex bg-muted after:transition-colors relative after:absolute after:inset-0 after:-left-px after:w-[2px] select-none data-[active]:after:bg-sky-400 data-[active]:cursor-col-resize hover:after:bg-sky-400 hover:cursor-col-resize after:z-2",onMouseDown:g,style:{touchAction:"none"}})};function oy({children:e,className:t,...n}){return h.jsx("h2",{...n,className:Be("text-lg dark:font-bold font-semibold select-text",t),children:e})}function An({children:e,right:t,className:n,scrollable:r,sticky:o}={}){return h.jsxs("div",{className:Be("flex flex-row h-14 flex-shrink-0 py-2 pl-5 pr-3 border-muted border-b items-center justify-between bg-muted/10",o&&"sticky top-0 bottom-10 z-10",n),children:[h.jsx("div",{className:Be("",r&&"overflow-x-scroll overflow-y-visible app-scrollbar"),children:typeof e=="string"?h.jsx(oy,{children:e}):e}),t&&!r&&h.jsx("div",{className:"flex flex-row gap-2.5",children:t}),t&&r&&h.jsxs("div",{className:"flex flex-row sticky z-10 right-0 h-full",children:[h.jsx("div",{className:"h-full w-5 bg-gradient-to-l from-background"}),h.jsx("div",{className:"flex flex-row gap-2.5 bg-background",children:t})]})]})}const oo=({children:e,as:t,className:n,disabled:r=!1,...o})=>{const i=t||"a";return h.jsx(i,{...o,className:Be("flex flex-row px-4 items-center gap-2 h-12",!r&&"cursor-pointer rounded-md [&.active]:bg-primary/10 [&.active]:hover:bg-primary/15 [&.active]:font-medium hover:bg-primary/5 focus:bg-primary/5 link",r&&"opacity-50 cursor-not-allowed pointer-events-none",n),children:e})},KSe=({children:e,as:t,className:n,disabled:r=!1,active:o=!1,badge:i,...s})=>{const a=t||"a";return h.jsxs(a,{...s,className:Be("hover:bg-primary/5 flex flex-row items-center justify-center gap-2.5 px-5 h-12 leading-none font-medium text-primary/80 rounded-tr-lg rounded-tl-lg cursor-pointer border border-transparent border-b-0",o?"bg-background hover:bg-background text-primary border-muted border-b-0":"link opacity-80",i&&"pr-4",n),children:[h.jsx("span",{className:"truncate",children:e}),i?h.jsx("span",{className:"px-3 py-1 rounded-full font-mono bg-primary/5 text-sm leading-none",children:i}):null]})},GV=({title:e,items:t})=>h.jsxs("div",{className:"relative",children:[h.jsx("div",{className:"absolute left-0 right-0 bottom-0 z-0 h-px bg-muted"}),h.jsx("div",{className:"overflow-x-scroll app-scrollbar mt-10 border-t border-t-muted",children:h.jsx(An,{className:"pl-3 pb-0 items-end ",children:h.jsxs("div",{className:"flex flex-row items-center gap-6 -mb-px",children:[e&&h.jsx(oy,{className:"pl-2 hidden md:block",children:e}),h.jsx("div",{className:"flex flex-row items-center gap-3 pr-3",children:t?.map(({label:n,...r},o)=>h.jsx(KSe,{...r,className:"relative z-2",children:n},o))})]})})})]});function XSe(e){const t=w.useRef(null),[n,r]=w.useState(0),[o,i]=w.useState(window.innerHeight);function s(){if(t.current){const a=t.current.getBoundingClientRect().top,c=window.innerHeight;r(a),i(c)}}return w.useEffect(()=>{s();const a=lA(s,500);return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),h.jsx("div",{ref:t,style:{height:`${o-n}px`},...e,children:e.children})}function Zn({children:e,initialOffset:t=64}){const n=w.useRef(null),[r,o]=w.useState(t);function i(){if(n.current){const s=n.current.getBoundingClientRect().top;o(s)}}return w.useEffect(i,[]),typeof window<"u"&&window.addEventListener("resize",lA(i,500)),h.jsxs(SV,{style:{height:`calc(100dvh - ${r}px`},ref:n,children:[h.jsx(EV,{className:"w-full h-full",children:e}),h.jsx(Pv,{forceMount:!0,className:"flex select-none touch-none bg-transparent w-0.5",orientation:"vertical",children:h.jsx(Dv,{className:"flex-1 bg-primary/50"})}),h.jsx(Pv,{forceMount:!0,className:"flex select-none touch-none bg-muted flex-col h-0.5",orientation:"horizontal",children:h.jsx(Dv,{className:"flex-1 bg-primary/50 "})})]})}const QSe=({title:e,open:t,toggle:n,ActiveIcon:r=Dve,children:o,renderHeaderRight:i,scrollContainerRef:s})=>h.jsxs("div",{style:{minHeight:49},className:Be("flex flex-col flex-animate overflow-hidden",t?"flex-open border-b border-b-muted":"flex-initial cursor-pointer hover:bg-primary/5"),children:[h.jsxs("div",{className:Be("flex flex-row bg-muted/10 border-muted border-b h-14 py-4 pr-4 pl-2 items-center gap-2"),onClick:n,children:[h.jsx(ft,{Icon:t?r:Mve,disabled:t}),h.jsx("h2",{className:"text-lg dark:font-bold font-semibold select-text",children:e}),h.jsx("div",{className:"flex grow"}),i?.({open:t})]}),h.jsx("div",{ref:s,className:Be("overflow-y-scroll transition-all",t?" grow":"h-0 opacity-0"),children:o})]}),Vf=({routePattern:e,identifier:t,renderHeaderRight:n,...r})=>{const{active:o,toggle:i}=GA(e,t);return h.jsx(QSe,{...r,open:o,toggle:i,renderHeaderRight:n&&(s=>n?.({open:s.open,active:o}))})},hC=({className:e,...t})=>h.jsx("hr",{...t,className:Be("border-muted my-3",e)});function ZSe(e){const t=e==="light",n={offset:2,transitionProps:{transition:"pop",duration:75}},r="!bg-muted/40 border-transparent disabled:bg-muted/50 disabled:text-primary/50 focus:!border-zinc-500";return{theme:{components:{Button:Nu.extend({vars:(o,i)=>({root:{"--button-height":"auto"}}),classNames:(o,i)=>({root:Be("px-3 py-2 rounded-md h-auto")}),defaultProps:{size:"md",variant:t?"filled":"white"}}),Switch:vc.extend({defaultProps:{size:"md",color:t?"dark":"blue"}}),Select:Xx.extend({classNames:(o,i)=>({input:r,dropdown:`bknd-admin ${e} bg-background border-primary/20`}),defaultProps:{checkIconPosition:"right",comboboxProps:n}}),TagsInput:$j.extend({defaultProps:{comboboxProps:n}}),Radio:Os.extend({defaultProps:{classNames:{body:"items-center"}}}),TextInput:_n.extend({classNames:(o,i)=>({wrapper:"leading-none",input:r})}),NumberInput:Jx.extend({classNames:(o,i)=>({wrapper:"leading-none",input:r})}),Textarea:kg.extend({classNames:(o,i)=>({wrapper:"leading-none",input:r})}),Modal:Bo.extend({classNames:(o,i)=>({...i.classNames,root:`bknd-admin ${e} ${i.className??""}`,content:"!bg-background !rounded-lg !select-none",overlay:"!backdrop-blur-sm"})}),Tabs:xn.extend({vars:(o,i)=>({root:{"--tabs-color":"border-primary"}})}),Menu:Lr.extend({defaultProps:{offset:2},classNames:(o,i)=>({dropdown:"!rounded-lg !px-1",item:"!rounded-md !text-[14px]"})}),SegmentedControl:bc.extend({classNames:(o,i)=>({root:t?"bg-primary/5":"bg-lightest/60",indicator:t?"bg-background":"bg-primary/15"})}),Notifications:ks.extend({classNames:(o,i)=>({notification:"-top-4 -right-4"})})},primaryColor:"dark",primaryShade:9},forceColorScheme:e}}function _c(){const{config:e,schema:t,actions:n,app:r}=ot(),o={config:{set:async a=>(console.log("--set",a),await n.set("auth",a,!0)?(await n.reload(),!0):!1)},roles:{add:async(a,c={})=>(console.log("add role",a,c),await n.add("auth",`roles.${a}`,c)),patch:async(a,c)=>(console.log("patch role",a,c),await n.patch("auth",`roles.${a}`,c)),delete:async a=>(console.log("delete role",a),window.confirm(`Are you sure you want to delete the role "${a}"?`)?await n.remove("auth",`roles.${a}`):!1)}},i=["system.access.admin","system.access.api","system.config.read","system.config.read.secrets","system.build"];return{$auth:{roles:{none:Object.keys(e.auth.roles??{}).length===0,minimum_permissions:i,has_admin:Object.entries(e.auth.roles??{}).some(([a,c])=>c.implicit_allow||i.every(u=>c.permissions?.some(f=>f.permission===f)))},routes:{settings:r.getSettingsPath(["auth"]),listUsers:r.getAbsolutePath("/data/"+st.data.entity.list(e.auth.entity_name))}},config:e.auth,schema:t.auth,actions:o}}const eEe=({className:e,...t})=>h.jsx(PV,{...t,className:Be("dark:text-amber-300 text-amber-700 cursor-help",e)}),tEe=({className:e,...t})=>h.jsx(PV,{...t,className:Be("dark:text-red-300 text-red-700 cursor-help",e)}),Hw={Warning:eEe,Err:tEe};function hr(e=[]){w.useLayoutEffect(()=>{const t="BKND";document.title=[t,...e].join(" / ")})}function nEe({children:e}){const{config:t,$auth:n}=_c();return h.jsxs(h.Fragment,{children:[h.jsxs(Wu,{children:[h.jsx(An,{right:h.jsx(Nn,{href:n.routes.settings,children:h.jsx(ft,{Icon:_h})}),children:"Auth"}),h.jsx(Zn,{initialOffset:96,children:h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:h.jsxs("nav",{className:"flex flex-col flex-1 gap-1",children:[h.jsx(oo,{as:Nn,href:"/",children:"Overview"}),h.jsxs(oo,{as:Nn,href:n.routes.listUsers,disabled:!t.enabled,className:"justify-between",children:["Users",!t.enabled&&h.jsx(Vp,{title:"Auth is not enabled."})]}),h.jsxs(oo,{as:Nn,href:st.auth.roles.list(),disabled:!t.enabled,className:"justify-between",children:["Roles & Permissions",t.enabled?n.roles.none?h.jsx(Vp,{title:"No roles defined."}):n.roles.has_admin?null:h.jsx(Vp,{title:"No admin role defined."}):h.jsx(Vp,{title:"Auth is not enabled."})]}),h.jsxs(oo,{as:Nn,href:st.auth.strategies(),disabled:!t.enabled,className:"justify-between",children:["Strategies",!t.enabled&&h.jsx(Vp,{title:"Auth is not enabled."})]}),h.jsx(oo,{as:Nn,href:st.auth.settings(),className:"justify-between",children:"Settings"})]})})})]}),h.jsx(ry,{children:e})]})}const Vp=({title:e})=>h.jsx(Hw.Warning,{title:e,className:"size-5 pointer-events-auto"}),qw=({visible:e=!0,title:t,message:n,className:r,children:o,...i})=>e?h.jsx("div",{...i,className:Be("flex flex-row items-center p-4",r),children:h.jsxs("p",{children:[t&&h.jsxs("b",{children:[t,": "]}),n||o]})}):null,rEe=({className:e,...t})=>h.jsx(qw,{...t,className:Be("bg-warning text-warning-foreground",e)}),oEe=({className:e,...t})=>h.jsx(qw,{...t,className:Be("bg-error text-error-foreground",e)}),iEe=({className:e,...t})=>h.jsx(qw,{...t,className:Be("bg-success text-success-foreground",e)}),sEe=({className:e,...t})=>h.jsx(qw,{...t,className:Be("bg-info text-info-foreground",e)}),ai={Warning:rEe,Exception:oEe,Success:iEe,Info:sEe};function aEe(){const{app:e}=ot(),{config:{roles:t,strategies:n,entity_name:r,enabled:o}}=_c(),i=r,a=Zg(y=>y.data.count(i),{enabled:o}).data?.count??0,c=Object.keys(t??{}).length??0,u=Object.keys(n??{}).length??0,f=e.getAbsolutePath("/data/"+st.data.entity.list(i)),p=st.auth.roles.list(),g=st.auth.strategies();return h.jsxs(h.Fragment,{children:[h.jsx(An,{children:"Overview"}),h.jsxs(Zn,{children:[h.jsx(ai.Warning,{visible:!o,title:"Auth not enabled",message:"To use authentication features, please enable it in the settings."}),h.jsxs("div",{className:"flex flex-col md:flex-row flex-1 p-3 gap-3",children:[h.jsxs("div",{className:"flex flex-col border border-primary/20 self-stretch md:self-start",children:[h.jsxs("div",{className:"flex flex-row gap-3 py-3 px-4 border-b border-b-muted font-medium bg-muted items-center justify-between",children:["Getting started",h.jsx(BV,{className:"size-5"})]}),h.jsx(lb,{title:"Enable authentication",done:o,to:st.auth.settings()}),h.jsx(lb,{title:"Create Roles",done:c>0,to:p}),h.jsx(lb,{title:"Create an user",done:a>0,to:f}),h.jsx(lb,{title:"Enable a second strategy",done:u>1,to:g})]}),h.jsxs("div",{className:"grid xs:grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-5 flex-grow",children:[h.jsx(X2,{title:"Users registered",value:o?a:0,actions:[{label:"View all",href:f},{label:"Add new",variant:"default",href:f}]}),h.jsx(X2,{title:"Roles",value:o?c:0,actions:[{label:"View all",href:p},{label:"Manage",variant:"default",href:p}]}),h.jsx(X2,{title:"Strategies enabled",value:o?u:0,actions:[{label:"View all",href:g},{label:"Manage",variant:"default",href:g}]})]})]})]})]})}const X2=({title:e,value:t,actions:n})=>h.jsxs("div",{className:"flex flex-col border border-muted h-auto self-start",children:[h.jsxs("div",{className:"flex flex-col gap-2 px-5 pt-3.5 pb-4 border-b border-b-muted",children:[h.jsx("div",{children:h.jsx("span",{className:"opacity-50",children:e})}),h.jsx("div",{className:"text-4xl font-medium",children:t})]}),h.jsx("div",{className:"flex flex-row gap-3 p-3 justify-between",children:n.map((r,o)=>h.jsx(dC,{size:"small",variant:"ghost",href:"#",...r,children:r.label},o))})]}),lb=({title:e,done:t=!1,to:n})=>{const[r]=Pn();return h.jsx("div",{className:"flex border-b border-b-muted",children:h.jsxs("div",{className:pn("flex flex-1 flex-row gap-3 py-3 px-4",t&&"opacity-50"),children:[h.jsxs("div",{className:"flex flex-row flex-1 gap-3 items-center",children:[t?h.jsx(J1e,{className:"size-5"}):h.jsx(hSe,{className:"size-5"}),h.jsx("p",{className:pn("font-medium text-primary/80 leading-none",t?"line-through":""),children:e})]}),n&&h.jsx(ft,{Icon:Z1e,onClick:()=>r(n)})]})})},eT=w.createContext(null);eT.displayName="@mantine/modals/ModalsContext";function lEe(){const e=w.useContext(eT);if(!e)throw new Error("[@mantine/modals] useModals hook was called outside of context, wrap your app with ModalsProvider component");return e}function cEe({id:e,cancelProps:t,confirmProps:n,labels:r={cancel:"",confirm:""},closeOnConfirm:o=!0,closeOnCancel:i=!0,groupProps:s,onCancel:a,onConfirm:c,children:u}){const{cancel:f,confirm:p}=r,g=lEe(),y=x=>{typeof t?.onClick=="function"&&t?.onClick(x),typeof a=="function"&&a(),i&&g.closeModal(e)},v=x=>{typeof n?.onClick=="function"&&n?.onClick(x),typeof c=="function"&&c(),o&&g.closeModal(e)};return h.jsxs(h.Fragment,{children:[u&&h.jsx(Fe,{mb:"md",children:u}),h.jsxs(qO,{mt:u?0:"md",justify:"flex-end",...s,children:[h.jsx(Nu,{variant:"default",...t,onClick:y,children:t?.children||f}),h.jsx(Nu,{...n,onClick:v,children:n?.children||p})]})]})}const[uEe,tT]=$X("mantine-modals"),dEe=e=>{const t=e.modalId||Yl();return tT("openContextModal")({...e,modalId:t}),t},fEe=tT("closeModal"),hEe=tT("closeAllModals"),JV={closeAll:hEe};function oP(e,t){t&&e.type==="confirm"&&e.props.onCancel?.(),e.props.onClose?.()}function pEe(e,t){switch(t.type){case"OPEN":return{current:t.modal,modals:[...e.modals,t.modal]};case"CLOSE":{const n=e.modals.find(o=>o.id===t.modalId);if(!n)return e;oP(n,t.canceled);const r=e.modals.filter(o=>o.id!==t.modalId);return{current:r[r.length-1]||e.current,modals:r}}case"CLOSE_ALL":return e.modals.length?(e.modals.concat().reverse().forEach(n=>{oP(n,t.canceled)}),{current:e.current,modals:[]}):e;case"UPDATE":{const{modalId:n,newProps:r}=t,o=e.modals.map(s=>s.id!==n?s:s.type==="content"||s.type==="confirm"?{...s,props:{...s.props,...r}}:s.type==="context"?{...s,props:{...s.props,...r,innerProps:{...s.props.innerProps,...r.innerProps}}}:s),i=e.current?.id===n&&o.find(s=>s.id===n)||e.current;return{...e,modals:o,current:i}}default:return e}}function mEe(e){if(!e)return{confirmProps:{},modalProps:{}};const{id:t,children:n,onCancel:r,onConfirm:o,closeOnConfirm:i,closeOnCancel:s,cancelProps:a,confirmProps:c,groupProps:u,labels:f,...p}=e;return{confirmProps:{id:t,children:n,onCancel:r,onConfirm:o,closeOnConfirm:i,closeOnCancel:s,cancelProps:a,confirmProps:c,groupProps:u,labels:f},modalProps:{id:t,...p}}}function gEe({children:e,modalProps:t,labels:n,modals:r}){const[o,i]=w.useReducer(pEe,{modals:[],current:null}),s=w.useRef(o);s.current=o;const a=w.useCallback(C=>{i({type:"CLOSE_ALL",canceled:C})},[s,i]),c=w.useCallback(({modalId:C,..._})=>{const j=C||Yl();return i({type:"OPEN",modal:{id:j,type:"content",props:_}}),j},[i]),u=w.useCallback(({modalId:C,..._})=>{const j=C||Yl();return i({type:"OPEN",modal:{id:j,type:"confirm",props:_}}),j},[i]),f=w.useCallback((C,{modalId:_,...j})=>{const A=_||Yl();return i({type:"OPEN",modal:{id:A,type:"context",props:j,ctx:C}}),A},[i]),p=w.useCallback((C,_)=>{i({type:"CLOSE",modalId:C,canceled:_})},[s,i]),g=w.useCallback(({modalId:C,..._})=>{i({type:"UPDATE",modalId:C,newProps:_})},[i]),y=w.useCallback(({modalId:C,..._})=>{i({type:"UPDATE",modalId:C,newProps:_})},[i]);uEe({openModal:c,openConfirmModal:u,openContextModal:({modal:C,..._})=>f(C,_),closeModal:p,closeContextModal:p,closeAllModals:a,updateModal:g,updateContextModal:y});const v={modalProps:t||{},modals:o.modals,openModal:c,openConfirmModal:u,openContextModal:f,closeModal:p,closeContextModal:p,closeAll:a,updateModal:g,updateContextModal:y},x=()=>{const C=s.current.current;switch(C?.type){case"context":{const{innerProps:_,...j}=C.props,A=r[C.ctx];return{modalProps:j,content:h.jsx(A,{innerProps:_,context:v,id:C.id})}}case"confirm":{const{modalProps:_,confirmProps:j}=mEe(C.props);return{modalProps:_,content:h.jsx(cEe,{...j,id:C.id,labels:C.props.labels||n})}}case"content":{const{children:_,...j}=C.props;return{modalProps:j,content:_}}default:return{modalProps:{},content:null}}},{modalProps:S,content:E}=x();return h.jsxs(eT.Provider,{value:v,children:[h.jsx(Bo,{zIndex:ts("modal")+1,...t,...S,opened:o.modals.length>0,onClose:()=>p(o.current?.id),children:E}),e]})}function nT({context:e,id:t,innerProps:{content:n}}){return n}nT.defaultTitle=void 0;nT.modalProps={withCloseButton:!1,classNames:{size:"md",root:"bknd-admin",content:"text-center justify-center",title:"font-bold !text-md",body:"py-3 px-5 gap-4 flex flex-col"}};const yEe=e=>typeof e=="boolean"||e instanceof Boolean,bEe=e=>typeof e=="number"||e instanceof Number,vEe=e=>typeof e=="bigint"||e instanceof BigInt,YV=e=>!!e&&e instanceof Date,xEe=e=>typeof e=="string"||e instanceof String,wEe=e=>Array.isArray(e),KV=e=>typeof e=="object"&&e!==null,XV=e=>!!e&&e instanceof Object&&typeof e=="function";function Fv(e,t){return t===void 0&&(t=!1),!e||t?`"${e}"`:e}function SEe(e,t,n){return n?JSON.stringify(e):t?`"${e}"`:e}function QV(e){let{field:t,value:n,data:r,lastElement:o,openBracket:i,closeBracket:s,level:a,style:c,shouldExpandNode:u,clickToExpandNode:f,outerRef:p,beforeExpandChange:g}=e;const y=w.useRef(!1),[v,x]=w.useState(()=>u(a,n,t)),S=w.useRef(null);w.useEffect(()=>{y.current?x(u(a,n,t)):y.current=!0},[u]);const E=w.useId();if(r.length===0)return EEe({field:t,openBracket:i,closeBracket:s,lastElement:o,style:c});const C=v?c.collapseIcon:c.expandIcon,_=v?c.ariaLables.collapseJson:c.ariaLables.expandJson,j=a+1,A=r.length-1,T=V=>{v!==V&&(!g||g({level:a,value:n,field:t,newExpandValue:V}))&&x(V)},k=V=>{if(V.key==="ArrowRight"||V.key==="ArrowLeft")V.preventDefault(),T(V.key==="ArrowRight");else if(V.key==="ArrowUp"||V.key==="ArrowDown"){V.preventDefault();const H=V.key==="ArrowUp"?-1:1;if(!p.current)return;const F=p.current.querySelectorAll("[role=button]");let B=-1;for(let M=0;M<F.length;M++)if(F[M].tabIndex===0){B=M;break}if(B<0)return;const U=(B+H+F.length)%F.length;F[B].tabIndex=-1,F[U].tabIndex=0,F[U].focus()}},R=()=>{var V;T(!v);const H=S.current;if(!H)return;const F=(V=p.current)===null||V===void 0?void 0:V.querySelector('[role=button][tabindex="0"]');F&&(F.tabIndex=-1),H.tabIndex=0,H.focus()};return w.createElement("div",{className:c.basicChildStyle,role:"treeitem","aria-expanded":v,"aria-selected":void 0},w.createElement("span",{className:C,onClick:R,onKeyDown:k,role:"button","aria-label":_,"aria-expanded":v,"aria-controls":v?E:void 0,ref:S,tabIndex:a===0?0:-1}),(t||t==="")&&(f?w.createElement("span",{className:c.clickableLabel,onClick:R,onKeyDown:k},Fv(t,c.quotesForFieldNames),":"):w.createElement("span",{className:c.label},Fv(t,c.quotesForFieldNames),":")),w.createElement("span",{className:c.punctuation},i),v?w.createElement("ul",{id:E,role:"group",className:c.childFieldsContainer},r.map((V,H)=>w.createElement(pC,{key:V[0]||H,field:V[0],value:V[1],style:c,lastElement:H===A,level:j,shouldExpandNode:u,clickToExpandNode:f,beforeExpandChange:g,outerRef:p}))):w.createElement("span",{className:c.collapsedContent,onClick:R,onKeyDown:k}),w.createElement("span",{className:c.punctuation},s),!o&&w.createElement("span",{className:c.punctuation},","))}function EEe(e){let{field:t,openBracket:n,closeBracket:r,lastElement:o,style:i}=e;return w.createElement("div",{className:i.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||t==="")&&w.createElement("span",{className:i.label},Fv(t,i.quotesForFieldNames),":"),w.createElement("span",{className:i.punctuation},n),w.createElement("span",{className:i.punctuation},r),!o&&w.createElement("span",{className:i.punctuation},","))}function NEe(e){let{field:t,value:n,style:r,lastElement:o,shouldExpandNode:i,clickToExpandNode:s,level:a,outerRef:c,beforeExpandChange:u}=e;return QV({field:t,value:n,lastElement:o||!1,level:a,openBracket:"{",closeBracket:"}",style:r,shouldExpandNode:i,clickToExpandNode:s,data:Object.keys(n).map(f=>[f,n[f]]),outerRef:c,beforeExpandChange:u})}function _Ee(e){let{field:t,value:n,style:r,lastElement:o,level:i,shouldExpandNode:s,clickToExpandNode:a,outerRef:c,beforeExpandChange:u}=e;return QV({field:t,value:n,lastElement:o||!1,level:i,openBracket:"[",closeBracket:"]",style:r,shouldExpandNode:s,clickToExpandNode:a,data:n.map(f=>[void 0,f]),outerRef:c,beforeExpandChange:u})}function CEe(e){let{field:t,value:n,style:r,lastElement:o}=e,i,s=r.otherValue;return n===null?(i="null",s=r.nullValue):n===void 0?(i="undefined",s=r.undefinedValue):xEe(n)?(i=SEe(n,!r.noQuotesForStringValues,r.stringifyStringValues),s=r.stringValue):yEe(n)?(i=n?"true":"false",s=r.booleanValue):bEe(n)?(i=n.toString(),s=r.numberValue):vEe(n)?(i=`${n.toString()}n`,s=r.numberValue):YV(n)?i=n.toISOString():XV(n)?i="function() { }":i=n.toString(),w.createElement("div",{className:r.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||t==="")&&w.createElement("span",{className:r.label},Fv(t,r.quotesForFieldNames),":"),w.createElement("span",{className:s},i),!o&&w.createElement("span",{className:r.punctuation},","))}function pC(e){const t=e.value;return wEe(t)?w.createElement(_Ee,Object.assign({},e)):KV(t)&&!YV(t)&&!XV(t)?w.createElement(NEe,Object.assign({},e)):w.createElement(CEe,Object.assign({},e))}var Ar={"container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","child-fields-container":"_1BXBN","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti"};const OEe={collapseJson:"collapse JSON",expandJson:"expand JSON"},Q2={container:Ar["container-light"],basicChildStyle:Ar["basic-element-style"],childFieldsContainer:Ar["child-fields-container"],label:Ar["label-light"],clickableLabel:Ar["clickable-label-light"],nullValue:Ar["value-null-light"],undefinedValue:Ar["value-undefined-light"],stringValue:Ar["value-string-light"],booleanValue:Ar["value-boolean-light"],numberValue:Ar["value-number-light"],otherValue:Ar["value-other-light"],punctuation:Ar["punctuation-light"],collapseIcon:Ar["collapse-icon-light"],expandIcon:Ar["expand-icon-light"],collapsedContent:Ar["collapsed-content-light"],noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:OEe,stringifyStringValues:!1},jEe=()=>!0,AEe=e=>{let{data:t,style:n=Q2,shouldExpandNode:r=jEe,clickToExpandNode:o=!1,beforeExpandChange:i,compactTopLevel:s,...a}=e;const c=w.useRef(null);return w.createElement("div",Object.assign({"aria-label":"JSON view"},a,{className:n.container,ref:c,role:"tree"}),s&&KV(t)?Object.entries(t).map(u=>{let[f,p]=u;return w.createElement(pC,{key:f,field:f,value:p,style:{...Q2,...n},lastElement:!0,level:1,shouldExpandNode:r,clickToExpandNode:o,beforeExpandChange:i,outerRef:c})}):w.createElement(pC,{value:t,style:{...Q2,...n},lastElement:!0,level:0,shouldExpandNode:r,clickToExpandNode:o,outerRef:c,beforeExpandChange:i}))};let Ch=class extends w.Component{constructor(t){super(t),this.state={hasError:!1,error:void 0}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){const r=this.props.suppressError?"warn":"error";console[r]("ErrorBoundary caught an error:",t,n)}resetError=()=>{this.setState({hasError:!1,error:void 0})};renderFallback(){return this.props.fallback?typeof this.props.fallback=="function"?this.props.fallback({error:this.state.error,resetError:this.resetError}):h.jsx(iP,{children:this.props.fallback}):h.jsx(iP,{children:this.state.error?.message??"Unknown error"})}render(){if(this.state.hasError)return this.renderFallback();if(this.props.suppressError)try{return this.props.children}catch{return this.renderFallback()}return this.props.children}};const iP=({children:e})=>h.jsx("div",{className:"bg-red-700 text-white py-1 px-2 rounded-md leading-tight font-mono",children:e}),TEe={basicChildStyle:"pl-5 ml-1 border-l border-muted hover:border-primary/20",container:"ml-[-10px]",label:"text-primary/90 font-bold font-mono mr-2",stringValue:"text-emerald-600 dark:text-emerald-500 font-mono select-text text-wrap whitespace-wrap break-words",numberValue:"text-sky-500 dark:text-sky-400 font-mono select-text",nullValue:"text-zinc-400 font-mono",undefinedValue:"text-zinc-400 font-mono",otherValue:"text-zinc-400 font-mono",booleanValue:"text-orange-500 dark:text-orange-400 font-mono",punctuation:"text-zinc-400 font-bold font-mono m-0.5",collapsedContent:"text-zinc-400 font-mono after:content-['...']",collapseIcon:"text-zinc-400 font-mono font-bold text-lg after:content-['▾'] mr-1.5",expandIcon:"text-zinc-400 font-mono font-bold text-lg after:content-['▸'] mr-1.5",noQuotesForStringValues:!1},Vr=({json:e,title:t,expand:n=0,showSize:r=!1,showCopy:o=!1,copyIconProps:i={},className:s})=>{const a=r?e?JSON.stringify(e).length:0:void 0,c=rw.fileSize(a??0),u=a||t||o;function f(){navigator.clipboard?.writeText(JSON.stringify(e,null,2))}return h.jsxs("div",{className:Be("bg-primary/5 py-3 relative overflow-hidden",s),children:[u&&h.jsxs("div",{className:"absolute right-4 top-3 font-mono text-zinc-400 flex flex-row gap-2 items-center",children:[(t||a!==void 0)&&h.jsxs("div",{className:"flex flex-row",children:[t&&h.jsx("span",{children:t})," ",a!==void 0&&h.jsxs("span",{children:["(",c,")"]})]}),o&&h.jsx("div",{children:h.jsx(ft,{Icon:LV,onClick:f,...i})})]}),h.jsx(Ch,{children:h.jsx(AEe,{data:e,shouldExpandNode:p=>p<n,style:TEe})})]})},$Ee=w.forwardRef(({tabs:e,...t},n)=>{const r=Object.fromEntries(Object.entries(e).filter(([s,a])=>a.enabled!==!1)),[o,i]=w.useState(t.selected??Object.keys(r)[0]);return w.useImperativeHandle(n,()=>({setSelected:i})),h.jsxs("div",{className:"flex flex-col bg-primary/5 rounded-md flex-shrink-0",children:[h.jsx("div",{className:"flex flex-row gap-4 border-b px-3 border-primary/10 min-w-0",children:Object.keys(r).map(s=>h.jsx("button",{type:"button",className:Be("flex flex-row text-sm cursor-pointer py-3 pt-3.5 px-1 border-b border-transparent -mb-px transition-opacity flex-shrink-0",o===s?"border-primary":"opacity-50 hover:opacity-70"),onClick:()=>i(s),children:h.jsx("span",{className:"font-mono leading-none truncate",children:s})},s))}),h.jsx(Vr,{className:"bg-transparent overflow-x-auto",...t,...r[o],title:void 0})]})}),REe=w.forwardRef(({classNames:e,children:t,opened:n,closeOnClickOutside:r=!1,...o},i)=>{const[s,{open:a,close:c}]=oh(n);return w.useImperativeHandle(i,()=>({open:a,close:c})),h.jsx(Bo,{withCloseButton:!1,padding:0,size:"xl",opened:s,...o,closeOnClickOutside:r,onClose:c,classNames:{...e,root:"bknd-admin",content:"rounded-lg select-none"},children:t})}),Zc=({path:e,onClose:t})=>h.jsxs("div",{className:"py-3 px-5 font-bold bg-lightest flex flex-row justify-between items-center sticky top-0 left-0 right-0 z-10 border-none",children:[h.jsx("div",{className:"flex flex-row gap-1",children:e.map((n,r)=>{const o=r+1===e.length;return h.jsxs(w.Fragment,{children:[h.jsx("span",{className:Be("",!o&&"opacity-70"),children:n},r),!o&&h.jsx("span",{className:"opacity-40",children:"/"})]},r)})}),h.jsx(ft,{Icon:QA,onClick:t})]}),Gu=({children:e,className:t})=>h.jsxs(SV,{className:Be("flex flex-col min-h-96",t),style:{maxHeight:"calc(80vh)"},children:[h.jsx(EV,{className:"w-full h-full",children:h.jsx("div",{className:"py-3 px-5 gap-4 flex flex-col",children:e})}),h.jsx(Pv,{forceMount:!0,className:"flex select-none touch-none bg-transparent w-0.5",orientation:"vertical",children:h.jsx(Dv,{className:"flex-1 bg-primary/50"})}),h.jsx(Pv,{forceMount:!0,className:"flex select-none touch-none bg-muted flex-col h-0.5",orientation:"horizontal",children:h.jsx(Dv,{className:"flex-1 bg-primary/50 "})})]}),Ju=({next:e,prev:t,nextLabel:n="Next",prevLabel:r="Back",debug:o})=>{const[i,s]=oh(!1);return h.jsx("div",{className:"flex flex-col border-t border-t-muted",children:h.jsxs("div",{className:"flex flex-row justify-between items-center py-3 px-4",children:[h.jsx("div",{children:o&&h.jsxs(co,{position:"right-start",shadow:"md",opened:i,classNames:{dropdown:"!px-1 !pr-2.5 !py-2 text-sm"},children:[h.jsx(co.Target,{children:h.jsx(ft,{onClick:s.toggle,Icon:TB,variant:i?"default":"ghost"})}),h.jsx(co.Dropdown,{children:h.jsx(Vr,{json:o,expand:6,className:"p-0"})})]})}),h.jsxs("div",{className:"flex flex-row gap-2",children:[h.jsx(Xe,{className:"w-24 justify-center",...t,children:r}),h.jsx(Xe,{className:"w-24 justify-center",variant:"primary",...e,children:n})]})]})})},ZV=w.createContext(void 0);function eU({children:e,initialPath:t=[],initialState:n={},lastBack:r}){const[o,i]=w.useState(n),[s,a]=w.useState(t),c=w.Children.toArray(e).filter(g=>g.props.disabled!==!0);function u(){s.length===0?r?.():a(g=>g.slice(0,-1))}const f=g=>()=>{a(y=>[...y,g])},p=c.find(g=>g.props.id===s[s.length-1])||c[0];return h.jsx(ZV.Provider,{value:{nextStep:f,stepBack:u,state:o,path:s,setState:i,close:r},children:p})}function Yu(){return w.useContext(ZV)}function eu({children:e,disabled:t=!1,path:n=[],id:r,...o}){return h.jsx("div",{...o,children:e})}function Ho(){const{config:e,app:t,schema:n,actions:r}=ot(),o=Vt(e.data.entities??{},(a,c)=>NA(c,a)),i={entity:{add:async(a,c)=>{const u=Cn(SA,c,{skipMark:!0,forceParse:!0});return await r.add("data",`entities.${a}`,u)},patch:a=>{if(!o[a])throw new Error(`Entity "${a}" not found`);return{config:async u=>await r.overwrite("data",`entities.${a}.config`,u),fields:MEe(r,a)}}},relations:{add:async a=>{const c=crypto.randomUUID(),u=Cn(Rt(EA),a,{skipMark:!0,forceParse:!0});return await r.add("data",`relations.${c}`,u)}}};return{$data:{entity:a=>o[a],modals:kEe,system:a=>({any:o[a]?.type==="system",users:a===e.auth.entity_name,media:a===e.media.entity_name})},entities:o,relations:t.relations,config:e.data,schema:n.data,actions:i}}const kEe={createAny:()=>vr.open(vr.ids.dataCreate,{}),createEntity:()=>vr.open(vr.ids.dataCreate,{initialPath:["entities","entity"],initialState:{action:"entity"}}),createRelation:e=>vr.open(vr.ids.dataCreate,{initialPath:["entities","relation"],initialState:{action:"relation",relations:{create:[{source:e,type:"n:1"}]}}}),createMedia:e=>vr.open(vr.ids.dataCreate,{initialPath:["entities","template-media"],initialState:{action:"template-media",initial:{entity:e}}})};function MEe(e,t){return{add:async(n,r)=>{const o=Cn(wA,r,{skipMark:!0,forceParse:!0});return await e.add("data",`entities.${t}.fields.${n}`,o)},patch:()=>null,set:async n=>{try{const r=Cn(Yz,n,{skipMark:!0,forceParse:!0}),o=await e.overwrite("data",`entities.${t}.fields`,r)}catch(r){console.error("error",r),r instanceof yh?alert("Error updating fields: "+r.firstToString()):alert("An error occured, check console. There will be nice error handling soon.")}}}}function PEe(){const{stepBack:e,state:t,close:n}=Yu(),[r,o]=w.useState([]),[i,s]=w.useState(!1),a=Ho(),c=ot(),u=[];t.entities?.create&&u.push(...t.entities.create.map(p=>({action:"add",Icon:Ove,type:"Entity",name:p.name,json:p,run:async()=>await a.actions.entity.add(p.name,p)}))),t.fields?.create&&u.push(...t.fields.create.map(p=>({action:"add",Icon:IA,type:"Field",name:p.name,json:p,run:async()=>await a.actions.entity.patch(p.entity).fields.add(p.name,p.field)}))),t.relations?.create&&u.push(...t.relations.create.map(p=>({action:"add",Icon:LA,type:"Relation",name:`${p.source} -> ${p.target} (${p.type})`,json:p,run:async()=>await a.actions.relations.add(p)})));async function f(){s(!0);for(const p of u)try{const g=await p.run();if(o(y=>[...y,g]),g!==!0)break}catch(g){o(y=>[...y,g.message])}}return w.useEffect(()=>{console.log("states",r,u,r.length,u.length,r.every(p=>p===!0)),u.length===r.length&&r.every(p=>p===!0)?c.actions.reload().then(n):s(!1)},[r]),h.jsxs(h.Fragment,{children:[h.jsxs(Gu,{children:[h.jsx("div",{children:'This is what will be created. Please confirm by clicking "Next".'}),h.jsx("div",{className:"flex flex-col gap-1",children:u.map((p,g)=>h.jsx(DEe,{...p,state:r[g]},g))})]}),h.jsx(Ju,{nextLabel:"Create",next:{onClick:f,disabled:i},prev:{onClick:e,disabled:i},debug:{state:t}})]})}const DEe=({Icon:e,type:t,name:n,json:r,state:o,action:i,initialExpanded:s=!1})=>{const[a,c]=oh(s),u=typeof o<"u"&&o!==!0,f=o===!0;return h.jsxs("div",{className:Be("flex flex-col border border-muted rounded bg-background mb-2",u&&"bg-red-500/20",f&&"bg-green-500/20"),children:[h.jsxs("div",{className:"flex flex-row gap-4 px-2 py-2 items-center",children:[h.jsx("div",{className:"flex flex-row items-center p-1 bg-primary/5 rounded",children:h.jsx(e,{className:"w-6 h-6"})}),h.jsxs("div",{className:"flex flex-row flex-grow gap-5",children:[h.jsx(Z2,{type:"action",name:i}),h.jsx(Z2,{type:"type",name:t}),h.jsx(Z2,{type:"name",name:n})]}),r&&h.jsx(ft,{Icon:$B,variant:a?"default":"ghost",onClick:c.toggle})]}),r&&a&&h.jsx("div",{className:"flex flex-col border-t border-t-muted",children:h.jsx(Vr,{json:r,expand:8,className:"text-sm"})}),u&&typeof o=="string"&&h.jsx("div",{className:"text-sm text-red-500",children:o})]})},Z2=({type:e,name:t})=>h.jsxs("div",{className:"flex flex-row text-sm font-mono gap-2",children:[h.jsx("div",{className:"opacity-50",children:Io(e)}),h.jsx("div",{className:"font-semibold",children:t})]});var iy=e=>e.type==="checkbox",pu=e=>e instanceof Date,to=e=>e==null;const tU=e=>typeof e=="object";var Vn=e=>!to(e)&&!Array.isArray(e)&&tU(e)&&!pu(e),nU=e=>Vn(e)&&e.target?iy(e.target)?e.target.checked:e.target.value:e,IEe=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,rU=(e,t)=>e.has(IEe(t)),LEe=e=>{const t=e.constructor&&e.constructor.prototype;return Vn(t)&&t.hasOwnProperty("isPrototypeOf")},rT=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function an(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(rT&&(e instanceof Blob||r))&&(n||Vn(e)))if(t=n?[]:Object.create(Object.getPrototypeOf(e)),!n&&!LEe(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=an(e[o]));else return e;return t}var Ww=e=>/^\w*$/.test(e),tn=e=>e===void 0,Gw=e=>Array.isArray(e)?e.filter(Boolean):[],oT=e=>Gw(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ie=(e,t,n)=>{if(!t||!Vn(e))return n;const r=(Ww(t)?[t]:oT(t)).reduce((o,i)=>to(o)?o:o[i],e);return tn(r)||r===e?tn(e[t])?n:e[t]:r},Ao=e=>typeof e=="boolean",Pt=(e,t,n)=>{let r=-1;const o=Ww(t)?[t]:oT(t),i=o.length,s=i-1;for(;++r<i;){const a=o[r];let c=n;if(r!==s){const u=e[a];c=Vn(u)||Array.isArray(u)?u:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const zv={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},si={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},oa={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},oU=Ne.createContext(null);oU.displayName="HookFormContext";const Jw=()=>Ne.useContext(oU);var iU=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==si.all&&(t._proxyFormState[s]=!r||si.all),n&&(n[s]=!0),e[s]}});return o};const Yw=typeof window<"u"?Ne.useLayoutEffect:Ne.useEffect;function FEe(e){const t=Jw(),{control:n=t.control,disabled:r,name:o,exact:i}=e||{},[s,a]=Ne.useState(n._formState),c=Ne.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Yw(()=>n._subscribe({name:o,formState:c.current,exact:i,callback:u=>{!r&&a({...n._formState,...u})}}),[o,r,i]),Ne.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),Ne.useMemo(()=>iU(s,n,c.current,!1),[s,n])}var $o=e=>typeof e=="string",mC=(e,t,n,r,o)=>$o(e)?(r&&t.watch.add(e),Ie(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),Ie(n,i))):(r&&(t.watchAll=!0),n),gC=e=>to(e)||!tU(e);function Ii(e,t,n=new WeakSet){if(gC(e)||gC(t))return e===t;if(pu(e)&&pu(t))return e.getTime()===t.getTime();const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const i of r){const s=e[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=t[i];if(pu(s)&&pu(a)||Vn(s)&&Vn(a)||Array.isArray(s)&&Array.isArray(a)?!Ii(s,a,n):s!==a)return!1}}return!0}function zEe(e){const t=Jw(),{control:n=t.control,name:r,defaultValue:o,disabled:i,exact:s,compute:a}=e||{},c=Ne.useRef(o),u=Ne.useRef(a),f=Ne.useRef(void 0),p=Ne.useRef(n),g=Ne.useRef(r);u.current=a;const[y,v]=Ne.useState(()=>{const j=n._getWatch(r,c.current);return u.current?u.current(j):j}),x=Ne.useCallback(j=>{const A=mC(r,n._names,j||n._formValues,!1,c.current);return u.current?u.current(A):A},[n._formValues,n._names,r]),S=Ne.useCallback(j=>{if(!i){const A=mC(r,n._names,j||n._formValues,!1,c.current);if(u.current){const T=u.current(A);Ii(T,f.current)||(v(T),f.current=T)}else v(A)}},[n._formValues,n._names,i,r]);Yw(()=>((p.current!==n||!Ii(g.current,r))&&(p.current=n,g.current=r,S()),n._subscribe({name:r,formState:{values:!0},exact:s,callback:j=>{S(j.values)}})),[n,s,r,S]),Ne.useEffect(()=>n._removeUnmounted());const E=p.current!==n,C=g.current,_=Ne.useMemo(()=>{if(i)return null;const j=!E&&!Ii(C,r);return E||j?x():null},[i,E,r,C,x]);return _!==null?_:y}function Oh(e){const t=Jw(),{name:n,disabled:r,control:o=t.control,shouldUnregister:i,defaultValue:s}=e,a=rU(o._names.array,n),c=Ne.useMemo(()=>Ie(o._formValues,n,Ie(o._defaultValues,n,s)),[o,n,s]),u=zEe({control:o,name:n,defaultValue:c,exact:!0}),f=FEe({control:o,name:n,exact:!0}),p=Ne.useRef(e),g=Ne.useRef(void 0),y=Ne.useRef(o.register(n,{...e.rules,value:u,...Ao(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const v=Ne.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ie(f.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ie(f.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ie(f.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ie(f.validatingFields,n)},error:{enumerable:!0,get:()=>Ie(f.errors,n)}}),[f,n]),x=Ne.useCallback(_=>y.current.onChange({target:{value:nU(_),name:n},type:zv.CHANGE}),[n]),S=Ne.useCallback(()=>y.current.onBlur({target:{value:Ie(o._formValues,n),name:n},type:zv.BLUR}),[n,o._formValues]),E=Ne.useCallback(_=>{const j=Ie(o._fields,n);j&&_&&(j._f.ref={focus:()=>_.focus&&_.focus(),select:()=>_.select&&_.select(),setCustomValidity:A=>_.setCustomValidity(A),reportValidity:()=>_.reportValidity()})},[o._fields,n]),C=Ne.useMemo(()=>({name:n,value:u,...Ao(r)||f.disabled?{disabled:f.disabled||r}:{},onChange:x,onBlur:S,ref:E}),[n,r,f.disabled,x,S,E,u]);return Ne.useEffect(()=>{const _=o._options.shouldUnregister||i,j=g.current;j&&j!==n&&!a&&o.unregister(j),o.register(n,{...p.current.rules,...Ao(p.current.disabled)?{disabled:p.current.disabled}:{}});const A=(T,k)=>{const R=Ie(o._fields,T);R&&R._f&&(R._f.mount=k)};if(A(n,!0),_){const T=an(Ie(o._options.defaultValues,n,p.current.defaultValue));Pt(o._defaultValues,n,T),tn(Ie(o._formValues,n))&&Pt(o._formValues,n,T)}return!a&&o.register(n),g.current=n,()=>{(a?_&&!o._state.action:_)?o.unregister(n):A(n,!1)}},[n,o,a,i]),Ne.useEffect(()=>{o._setDisabledField({disabled:r,name:n})},[r,n,o]),Ne.useMemo(()=>({field:C,formState:f,fieldState:v}),[C,f,v])}var BEe=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},so=e=>Array.isArray(e)?e:[e],sP=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}};function sU(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const o=e[r],i=t[r];if(o&&Vn(o)&&i){const s=sU(o,i);Vn(s)&&(n[r]=s)}else e[r]&&(n[r]=i)}return n}var yr=e=>Vn(e)&&!Object.keys(e).length,iT=e=>e.type==="file",Li=e=>typeof e=="function",Bv=e=>{if(!rT)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},aU=e=>e.type==="select-multiple",sT=e=>e.type==="radio",VEe=e=>sT(e)||iy(e),eN=e=>Bv(e)&&e.isConnected;function UEe(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=tn(e)?r++:e[t[r++]];return e}function HEe(e){for(const t in e)if(e.hasOwnProperty(t)&&!tn(e[t]))return!1;return!0}function kn(e,t){const n=Array.isArray(t)?t:Ww(t)?[t]:oT(t),r=n.length===1?e:UEe(e,n),o=n.length-1,i=n[o];return r&&delete r[i],o!==0&&(Vn(r)&&yr(r)||Array.isArray(r)&&HEe(r))&&kn(e,n.slice(0,-1)),e}var qEe=e=>{for(const t in e)if(Li(e[t]))return!0;return!1};function lU(e){return Array.isArray(e)||Vn(e)&&!qEe(e)}function yC(e,t={}){for(const n in e)lU(e[n])?(t[n]=Array.isArray(e[n])?[]:{},yC(e[n],t[n])):tn(e[n])||(t[n]=!0);return t}function nf(e,t,n){n||(n=yC(t));for(const r in e)lU(e[r])?tn(t)||gC(n[r])?n[r]=yC(e[r],Array.isArray(e[r])?[]:{}):nf(e[r],to(t)?{}:t[r],n[r]):n[r]=!Ii(e[r],t[r]);return n}const aP={value:!1,isValid:!1},lP={value:!0,isValid:!0};var cU=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!tn(e[0].attributes.value)?tn(e[0].value)||e[0].value===""?lP:{value:e[0].value,isValid:!0}:lP:aP}return aP},uU=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>tn(e)?e:t?e===""?NaN:e&&+e:n&&$o(e)?new Date(e):r?r(e):e;const cP={isValid:!1,value:null};var dU=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,cP):cP;function uP(e){const t=e.ref;return iT(t)?t.files:sT(t)?dU(e.refs).value:aU(t)?[...t.selectedOptions].map(({value:n})=>n):iy(t)?cU(e.refs).value:uU(tn(t.value)?e.ref.value:t.value,e)}var WEe=(e,t,n,r)=>{const o={};for(const i of e){const s=Ie(t,i);s&&Pt(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},Vv=e=>e instanceof RegExp,Up=e=>tn(e)?e:Vv(e)?e.source:Vn(e)?Vv(e.value)?e.value.source:e.value:e,df=e=>({isOnSubmit:!e||e===si.onSubmit,isOnBlur:e===si.onBlur,isOnChange:e===si.onChange,isOnAll:e===si.all,isOnTouch:e===si.onTouched});const dP="AsyncFunction";var GEe=e=>!!e&&!!e.validate&&!!(Li(e.validate)&&e.validate.constructor.name===dP||Vn(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===dP)),JEe=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),bC=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const bf=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const i=Ie(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)return!0;if(s.ref&&t(s.ref,s.name)&&!r)return!0;if(bf(a,t))break}else if(Vn(a)&&bf(a,t))break}}};function fP(e,t,n){const r=Ie(e,n);if(r||Ww(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=Ie(t,i),a=Ie(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:n}}var YEe=(e,t,n,r)=>{n(e);const{name:o,...i}=e;return yr(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!r||si.all))},KEe=(e,t,n)=>!e||!t||e===t||so(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),XEe=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,QEe=(e,t)=>!Gw(Ie(e,t)).length&&kn(e,t),fU=(e,t,n)=>{const r=so(Ie(e,n));return Pt(r,"root",t[n]),Pt(e,n,r),e};function hP(e,t,n="validate"){if($o(e)||Array.isArray(e)&&e.every($o)||Ao(e)&&!e)return{type:n,message:$o(e)?e:"",ref:t}}var Jd=e=>Vn(e)&&!Vv(e)?e:{value:e,message:""},vC=async(e,t,n,r,o,i)=>{const{ref:s,refs:a,required:c,maxLength:u,minLength:f,min:p,max:g,pattern:y,validate:v,name:x,valueAsNumber:S,mount:E}=e._f,C=Ie(n,x);if(!E||t.has(x))return{};const _=a?a[0]:s,j=B=>{o&&_.reportValidity&&(_.setCustomValidity(Ao(B)?"":B||""),_.reportValidity())},A={},T=sT(s),k=iy(s),R=T||k,V=(S||iT(s))&&tn(s.value)&&tn(C)||Bv(s)&&s.value===""||C===""||Array.isArray(C)&&!C.length,H=BEe.bind(null,x,r,A),F=(B,U,M,z=oa.maxLength,$=oa.minLength)=>{const L=B?U:M;A[x]={type:B?z:$,message:L,ref:s,...H(B?z:$,L)}};if(i?!Array.isArray(C)||!C.length:c&&(!R&&(V||to(C))||Ao(C)&&!C||k&&!cU(a).isValid||T&&!dU(a).isValid)){const{value:B,message:U}=$o(c)?{value:!!c,message:c}:Jd(c);if(B&&(A[x]={type:oa.required,message:U,ref:_,...H(oa.required,U)},!r))return j(U),A}if(!V&&(!to(p)||!to(g))){let B,U;const M=Jd(g),z=Jd(p);if(!to(C)&&!isNaN(C)){const $=s.valueAsNumber||C&&+C;to(M.value)||(B=$>M.value),to(z.value)||(U=$<z.value)}else{const $=s.valueAsDate||new Date(C),L=Y=>new Date(new Date().toDateString()+" "+Y),P=s.type=="time",q=s.type=="week";$o(M.value)&&C&&(B=P?L(C)>L(M.value):q?C>M.value:$>new Date(M.value)),$o(z.value)&&C&&(U=P?L(C)<L(z.value):q?C<z.value:$<new Date(z.value))}if((B||U)&&(F(!!B,M.message,z.message,oa.max,oa.min),!r))return j(A[x].message),A}if((u||f)&&!V&&($o(C)||i&&Array.isArray(C))){const B=Jd(u),U=Jd(f),M=!to(B.value)&&C.length>+B.value,z=!to(U.value)&&C.length<+U.value;if((M||z)&&(F(M,B.message,U.message),!r))return j(A[x].message),A}if(y&&!V&&$o(C)){const{value:B,message:U}=Jd(y);if(Vv(B)&&!C.match(B)&&(A[x]={type:oa.pattern,message:U,ref:s,...H(oa.pattern,U)},!r))return j(U),A}if(v){if(Li(v)){const B=await v(C,n),U=hP(B,_);if(U&&(A[x]={...U,...H(oa.validate,U.message)},!r))return j(U.message),A}else if(Vn(v)){let B={};for(const U in v){if(!yr(B)&&!r)break;const M=hP(await v[U](C,n),_,U);M&&(B={...M,...H(U,M.message)},j(M.message),r&&(A[x]=B))}if(!yr(B)&&(A[x]={ref:_,...B},!r))return A}}return j(!0),A};const ZEe={mode:si.onSubmit,reValidateMode:si.onChange,shouldFocusError:!0};function e2e(e={}){let t={...ZEe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Li(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=Vn(t.defaultValues)||Vn(t.values)?an(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:an(o),s={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let p={...f};const g={array:sP(),state:sP()},y=t.criteriaMode===si.all,v=G=>re=>{clearTimeout(u),u=setTimeout(G,re)},x=async G=>{if(!t.disabled&&(f.isValid||p.isValid||G)){const re=t.resolver?yr((await k()).errors):await V(r,!0);re!==n.isValid&&g.state.next({isValid:re})}},S=(G,re)=>{!t.disabled&&(f.isValidating||f.validatingFields||p.isValidating||p.validatingFields)&&((G||Array.from(a.mount)).forEach(ne=>{ne&&(re?Pt(n.validatingFields,ne,re):kn(n.validatingFields,ne))}),g.state.next({validatingFields:n.validatingFields,isValidating:!yr(n.validatingFields)}))},E=(G,re=[],ne,ce,te=!0,Z=!0)=>{if(ce&&ne&&!t.disabled){if(s.action=!0,Z&&Array.isArray(Ie(r,G))){const de=ne(Ie(r,G),ce.argA,ce.argB);te&&Pt(r,G,de)}if(Z&&Array.isArray(Ie(n.errors,G))){const de=ne(Ie(n.errors,G),ce.argA,ce.argB);te&&Pt(n.errors,G,de),QEe(n.errors,G)}if((f.touchedFields||p.touchedFields)&&Z&&Array.isArray(Ie(n.touchedFields,G))){const de=ne(Ie(n.touchedFields,G),ce.argA,ce.argB);te&&Pt(n.touchedFields,G,de)}(f.dirtyFields||p.dirtyFields)&&(n.dirtyFields=nf(o,i)),g.state.next({name:G,isDirty:F(G,re),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Pt(i,G,re)},C=(G,re)=>{Pt(n.errors,G,re),g.state.next({errors:n.errors})},_=G=>{n.errors=G,g.state.next({errors:n.errors,isValid:!1})},j=(G,re,ne,ce)=>{const te=Ie(r,G);if(te){const Z=Ie(i,G,tn(ne)?Ie(o,G):ne);tn(Z)||ce&&ce.defaultChecked||re?Pt(i,G,re?Z:uP(te._f)):M(G,Z),s.mount&&x()}},A=(G,re,ne,ce,te)=>{let Z=!1,de=!1;const Te={name:G};if(!t.disabled){if(!ne||ce){(f.isDirty||p.isDirty)&&(de=n.isDirty,n.isDirty=Te.isDirty=F(),Z=de!==Te.isDirty);const $e=Ii(Ie(o,G),re);de=!!Ie(n.dirtyFields,G),$e?kn(n.dirtyFields,G):Pt(n.dirtyFields,G,!0),Te.dirtyFields=n.dirtyFields,Z=Z||(f.dirtyFields||p.dirtyFields)&&de!==!$e}if(ne){const $e=Ie(n.touchedFields,G);$e||(Pt(n.touchedFields,G,ne),Te.touchedFields=n.touchedFields,Z=Z||(f.touchedFields||p.touchedFields)&&$e!==ne)}Z&&te&&g.state.next(Te)}return Z?Te:{}},T=(G,re,ne,ce)=>{const te=Ie(n.errors,G),Z=(f.isValid||p.isValid)&&Ao(re)&&n.isValid!==re;if(t.delayError&&ne?(c=v(()=>C(G,ne)),c(t.delayError)):(clearTimeout(u),c=null,ne?Pt(n.errors,G,ne):kn(n.errors,G)),(ne?!Ii(te,ne):te)||!yr(ce)||Z){const de={...ce,...Z&&Ao(re)?{isValid:re}:{},errors:n.errors,name:G};n={...n,...de},g.state.next(de)}},k=async G=>{S(G,!0);const re=await t.resolver(i,t.context,WEe(G||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return S(G),re},R=async G=>{const{errors:re}=await k(G);if(G)for(const ne of G){const ce=Ie(re,ne);ce?Pt(n.errors,ne,ce):kn(n.errors,ne)}else n.errors=re;return re},V=async(G,re,ne={valid:!0})=>{for(const ce in G){const te=G[ce];if(te){const{_f:Z,...de}=te;if(Z){const Te=a.array.has(Z.name),$e=te._f&&GEe(te._f);$e&&f.validatingFields&&S([Z.name],!0);const Ke=await vC(te,a.disabled,i,y,t.shouldUseNativeValidation&&!re,Te);if($e&&f.validatingFields&&S([Z.name]),Ke[Z.name]&&(ne.valid=!1,re))break;!re&&(Ie(Ke,Z.name)?Te?fU(n.errors,Ke,Z.name):Pt(n.errors,Z.name,Ke[Z.name]):kn(n.errors,Z.name))}!yr(de)&&await V(de,re,ne)}}return ne.valid},H=()=>{for(const G of a.unMount){const re=Ie(r,G);re&&(re._f.refs?re._f.refs.every(ne=>!eN(ne)):!eN(re._f.ref))&&ue(G)}a.unMount=new Set},F=(G,re)=>!t.disabled&&(G&&re&&Pt(i,G,re),!Ii(Y(),o)),B=(G,re,ne)=>mC(G,a,{...s.mount?i:tn(re)?o:$o(G)?{[G]:re}:re},ne,re),U=G=>Gw(Ie(s.mount?i:o,G,t.shouldUnregister?Ie(o,G,[]):[])),M=(G,re,ne={})=>{const ce=Ie(r,G);let te=re;if(ce){const Z=ce._f;Z&&(!Z.disabled&&Pt(i,G,uU(re,Z)),te=Bv(Z.ref)&&to(re)?"":re,aU(Z.ref)?[...Z.ref.options].forEach(de=>de.selected=te.includes(de.value)):Z.refs?iy(Z.ref)?Z.refs.forEach(de=>{(!de.defaultChecked||!de.disabled)&&(Array.isArray(te)?de.checked=!!te.find(Te=>Te===de.value):de.checked=te===de.value||!!te)}):Z.refs.forEach(de=>de.checked=de.value===te):iT(Z.ref)?Z.ref.value="":(Z.ref.value=te,Z.ref.type||g.state.next({name:G,values:an(i)})))}(ne.shouldDirty||ne.shouldTouch)&&A(G,te,ne.shouldTouch,ne.shouldDirty,!0),ne.shouldValidate&&q(G)},z=(G,re,ne)=>{for(const ce in re){if(!re.hasOwnProperty(ce))return;const te=re[ce],Z=G+"."+ce,de=Ie(r,Z);(a.array.has(G)||Vn(te)||de&&!de._f)&&!pu(te)?z(Z,te,ne):M(Z,te,ne)}},$=(G,re,ne={})=>{const ce=Ie(r,G),te=a.array.has(G),Z=an(re);Pt(i,G,Z),te?(g.array.next({name:G,values:an(i)}),(f.isDirty||f.dirtyFields||p.isDirty||p.dirtyFields)&&ne.shouldDirty&&g.state.next({name:G,dirtyFields:nf(o,i),isDirty:F(G,Z)})):ce&&!ce._f&&!to(Z)?z(G,Z,ne):M(G,Z,ne),bC(G,a)&&g.state.next({...n,name:G}),g.state.next({name:s.mount?G:void 0,values:an(i)})},L=async G=>{s.mount=!0;const re=G.target;let ne=re.name,ce=!0;const te=Ie(r,ne),Z=$e=>{ce=Number.isNaN($e)||pu($e)&&isNaN($e.getTime())||Ii($e,Ie(i,ne,$e))},de=df(t.mode),Te=df(t.reValidateMode);if(te){let $e,Ke;const At=re.type?uP(te._f):nU(G),yn=G.type===zv.BLUR||G.type===zv.FOCUS_OUT,ls=!JEe(te._f)&&!t.resolver&&!Ie(n.errors,ne)&&!te._f.deps||XEe(yn,Ie(n.touchedFields,ne),n.isSubmitted,Te,de),pr=bC(ne,a,yn);Pt(i,ne,At),yn?(!re||!re.readOnly)&&(te._f.onBlur&&te._f.onBlur(G),c&&c(0)):te._f.onChange&&te._f.onChange(G);const dn=A(ne,At,yn),Ut=!yr(dn)||pr;if(!yn&&g.state.next({name:ne,type:G.type,values:an(i)}),ls)return(f.isValid||p.isValid)&&(t.mode==="onBlur"?yn&&x():yn||x()),Ut&&g.state.next({name:ne,...pr?{}:dn});if(!yn&&pr&&g.state.next({...n}),t.resolver){const{errors:nn}=await k([ne]);if(Z(At),ce){const qo=fP(n.errors,r,ne),cs=fP(nn,r,qo.name||ne);$e=cs.error,ne=cs.name,Ke=yr(nn)}}else S([ne],!0),$e=(await vC(te,a.disabled,i,y,t.shouldUseNativeValidation))[ne],S([ne]),Z(At),ce&&($e?Ke=!1:(f.isValid||p.isValid)&&(Ke=await V(r,!0)));ce&&(te._f.deps&&(!Array.isArray(te._f.deps)||te._f.deps.length>0)&&q(te._f.deps),T(ne,Ke,$e,dn))}},P=(G,re)=>{if(Ie(n.errors,re)&&G.focus)return G.focus(),1},q=async(G,re={})=>{let ne,ce;const te=so(G);if(t.resolver){const Z=await R(tn(G)?G:te);ne=yr(Z),ce=G?!te.some(de=>Ie(Z,de)):ne}else G?(ce=(await Promise.all(te.map(async Z=>{const de=Ie(r,Z);return await V(de&&de._f?{[Z]:de}:de)}))).every(Boolean),!(!ce&&!n.isValid)&&x()):ce=ne=await V(r);return g.state.next({...!$o(G)||(f.isValid||p.isValid)&&ne!==n.isValid?{}:{name:G},...t.resolver||!G?{isValid:ne}:{},errors:n.errors}),re.shouldFocus&&!ce&&bf(r,P,G?te:a.mount),ce},Y=(G,re)=>{let ne={...s.mount?i:o};return re&&(ne=sU(re.dirtyFields?n.dirtyFields:n.touchedFields,ne)),tn(G)?ne:$o(G)?Ie(ne,G):G.map(ce=>Ie(ne,ce))},D=(G,re)=>({invalid:!!Ie((re||n).errors,G),isDirty:!!Ie((re||n).dirtyFields,G),error:Ie((re||n).errors,G),isValidating:!!Ie(n.validatingFields,G),isTouched:!!Ie((re||n).touchedFields,G)}),W=G=>{G&&so(G).forEach(re=>kn(n.errors,re)),g.state.next({errors:G?n.errors:{}})},K=(G,re,ne)=>{const ce=(Ie(r,G,{_f:{}})._f||{}).ref,te=Ie(n.errors,G)||{},{ref:Z,message:de,type:Te,...$e}=te;Pt(n.errors,G,{...$e,...re,ref:ce}),g.state.next({name:G,errors:n.errors,isValid:!1}),ne&&ne.shouldFocus&&ce&&ce.focus&&ce.focus()},Q=(G,re)=>Li(G)?g.state.subscribe({next:ne=>"values"in ne&&G(B(void 0,re),ne)}):B(G,re,!0),ie=G=>g.state.subscribe({next:re=>{KEe(G.name,re.name,G.exact)&&YEe(re,G.formState||f,ve,G.reRenderRoot)&&G.callback({values:{...i},...n,...re,defaultValues:o})}}).unsubscribe,pe=G=>(s.mount=!0,p={...p,...G.formState},ie({...G,formState:p})),ue=(G,re={})=>{for(const ne of G?so(G):a.mount)a.mount.delete(ne),a.array.delete(ne),re.keepValue||(kn(r,ne),kn(i,ne)),!re.keepError&&kn(n.errors,ne),!re.keepDirty&&kn(n.dirtyFields,ne),!re.keepTouched&&kn(n.touchedFields,ne),!re.keepIsValidating&&kn(n.validatingFields,ne),!t.shouldUnregister&&!re.keepDefaultValue&&kn(o,ne);g.state.next({values:an(i)}),g.state.next({...n,...re.keepDirty?{isDirty:F()}:{}}),!re.keepIsValid&&x()},se=({disabled:G,name:re})=>{(Ao(G)&&s.mount||G||a.disabled.has(re))&&(G?a.disabled.add(re):a.disabled.delete(re))},me=(G,re={})=>{let ne=Ie(r,G);const ce=Ao(re.disabled)||Ao(t.disabled);return Pt(r,G,{...ne||{},_f:{...ne&&ne._f?ne._f:{ref:{name:G}},name:G,mount:!0,...re}}),a.mount.add(G),ne?se({disabled:Ao(re.disabled)?re.disabled:t.disabled,name:G}):j(G,!0,re.value),{...ce?{disabled:re.disabled||t.disabled}:{},...t.progressive?{required:!!re.required,min:Up(re.min),max:Up(re.max),minLength:Up(re.minLength),maxLength:Up(re.maxLength),pattern:Up(re.pattern)}:{},name:G,onChange:L,onBlur:L,ref:te=>{if(te){me(G,re),ne=Ie(r,G);const Z=tn(te.value)&&te.querySelectorAll&&te.querySelectorAll("input,select,textarea")[0]||te,de=VEe(Z),Te=ne._f.refs||[];if(de?Te.find($e=>$e===Z):Z===ne._f.ref)return;Pt(r,G,{_f:{...ne._f,...de?{refs:[...Te.filter(eN),Z,...Array.isArray(Ie(o,G))?[{}]:[]],ref:{type:Z.type,name:G}}:{ref:Z}}}),j(G,!1,void 0,Z)}else ne=Ie(r,G,{}),ne._f&&(ne._f.mount=!1),(t.shouldUnregister||re.shouldUnregister)&&!(rU(a.array,G)&&s.action)&&a.unMount.add(G)}}},xe=()=>t.shouldFocusError&&bf(r,P,a.mount),je=G=>{Ao(G)&&(g.state.next({disabled:G}),bf(r,(re,ne)=>{const ce=Ie(r,ne);ce&&(re.disabled=ce._f.disabled||G,Array.isArray(ce._f.refs)&&ce._f.refs.forEach(te=>{te.disabled=ce._f.disabled||G}))},0,!1))},_e=(G,re)=>async ne=>{let ce;ne&&(ne.preventDefault&&ne.preventDefault(),ne.persist&&ne.persist());let te=an(i);if(g.state.next({isSubmitting:!0}),t.resolver){const{errors:Z,values:de}=await k();n.errors=Z,te=an(de)}else await V(r);if(a.disabled.size)for(const Z of a.disabled)kn(te,Z);if(kn(n.errors,"root"),yr(n.errors)){g.state.next({errors:{}});try{await G(te,ne)}catch(Z){ce=Z}}else re&&await re({...n.errors},ne),xe(),setTimeout(xe);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:yr(n.errors)&&!ce,submitCount:n.submitCount+1,errors:n.errors}),ce)throw ce},Ee=(G,re={})=>{Ie(r,G)&&(tn(re.defaultValue)?$(G,an(Ie(o,G))):($(G,re.defaultValue),Pt(o,G,an(re.defaultValue))),re.keepTouched||kn(n.touchedFields,G),re.keepDirty||(kn(n.dirtyFields,G),n.isDirty=re.defaultValue?F(G,an(Ie(o,G))):F()),re.keepError||(kn(n.errors,G),f.isValid&&x()),g.state.next({...n}))},Re=(G,re={})=>{const ne=G?an(G):o,ce=an(ne),te=yr(G),Z=te?o:ce;if(re.keepDefaultValues||(o=ne),!re.keepValues){if(re.keepDirtyValues){const de=new Set([...a.mount,...Object.keys(nf(o,i))]);for(const Te of Array.from(de))Ie(n.dirtyFields,Te)?Pt(Z,Te,Ie(i,Te)):$(Te,Ie(Z,Te))}else{if(rT&&tn(G))for(const de of a.mount){const Te=Ie(r,de);if(Te&&Te._f){const $e=Array.isArray(Te._f.refs)?Te._f.refs[0]:Te._f.ref;if(Bv($e)){const Ke=$e.closest("form");if(Ke){Ke.reset();break}}}}if(re.keepFieldsRef)for(const de of a.mount)$(de,Ie(Z,de));else r={}}i=t.shouldUnregister?re.keepDefaultValues?an(o):{}:an(Z),g.array.next({values:{...Z}}),g.state.next({values:{...Z}})}a={mount:re.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!f.isValid||!!re.keepIsValid||!!re.keepDirtyValues||!t.shouldUnregister&&!yr(Z),s.watch=!!t.shouldUnregister,g.state.next({submitCount:re.keepSubmitCount?n.submitCount:0,isDirty:te?!1:re.keepDirty?n.isDirty:!!(re.keepDefaultValues&&!Ii(G,o)),isSubmitted:re.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:te?{}:re.keepDirtyValues?re.keepDefaultValues&&i?nf(o,i):n.dirtyFields:re.keepDefaultValues&&G?nf(o,G):re.keepDirty?n.dirtyFields:{},touchedFields:re.keepTouched?n.touchedFields:{},errors:re.keepErrors?n.errors:{},isSubmitSuccessful:re.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Me=(G,re)=>Re(Li(G)?G(i):G,re),ze=(G,re={})=>{const ne=Ie(r,G),ce=ne&&ne._f;if(ce){const te=ce.refs?ce.refs[0]:ce.ref;te.focus&&(te.focus(),re.shouldSelect&&Li(te.select)&&te.select())}},ve=G=>{n={...n,...G}},Ae={control:{register:me,unregister:ue,getFieldState:D,handleSubmit:_e,setError:K,_subscribe:ie,_runSchema:k,_focusError:xe,_getWatch:B,_getDirty:F,_setValid:x,_setFieldArray:E,_setDisabledField:se,_setErrors:_,_getFieldArray:U,_reset:Re,_resetDefaultValues:()=>Li(t.defaultValues)&&t.defaultValues().then(G=>{Me(G,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:H,_disableForm:je,_subjects:g,_proxyFormState:f,get _fields(){return r},get _formValues(){return i},get _state(){return s},set _state(G){s=G},get _defaultValues(){return o},get _names(){return a},set _names(G){a=G},get _formState(){return n},get _options(){return t},set _options(G){t={...t,...G}}},subscribe:pe,trigger:q,register:me,handleSubmit:_e,watch:Q,setValue:$,getValues:Y,reset:Me,resetField:Ee,clearErrors:W,unregister:ue,setError:K,setFocus:ze,getFieldState:D};return{...Ae,formControl:Ae}}var Rl=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(Math.random()*16+e)%16|0;return(t=="x"?n:n&3|8).toString(16)})},tN=(e,t,n={})=>n.shouldFocus||tn(n.shouldFocus)?n.focusName||`${e}.${tn(n.focusIndex)?t:n.focusIndex}.`:"",nN=(e,t)=>[...e,...so(t)],rN=e=>Array.isArray(e)?e.map(()=>{}):void 0;function oN(e,t,n){return[...e.slice(0,t),...so(n),...e.slice(t)]}var iN=(e,t,n)=>Array.isArray(e)?(tn(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],sN=(e,t)=>[...so(t),...so(e)];function t2e(e,t){let n=0;const r=[...e];for(const o of t)r.splice(o-n,1),n++;return Gw(r).length?r:[]}var aN=(e,t)=>tn(t)?[]:t2e(e,so(t).sort((n,r)=>n-r)),lN=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},pP=(e,t,n)=>(e[t]=n,e);function n2e(e){const t=Jw(),{control:n=t.control,name:r,keyName:o="id",shouldUnregister:i,rules:s}=e,[a,c]=Ne.useState(n._getFieldArray(r)),u=Ne.useRef(n._getFieldArray(r).map(Rl)),f=Ne.useRef(!1);n._names.array.add(r),Ne.useMemo(()=>s&&a.length>=0&&n.register(r,s),[n,r,a.length,s]),Yw(()=>n._subjects.array.subscribe({next:({values:j,name:A})=>{if(A===r||!A){const T=Ie(j,r);Array.isArray(T)&&(c(T),u.current=T.map(Rl))}}}).unsubscribe,[n,r]);const p=Ne.useCallback(j=>{f.current=!0,n._setFieldArray(r,j)},[n,r]),g=(j,A)=>{const T=so(an(j)),k=nN(n._getFieldArray(r),T);n._names.focus=tN(r,k.length-1,A),u.current=nN(u.current,T.map(Rl)),p(k),c(k),n._setFieldArray(r,k,nN,{argA:rN(j)})},y=(j,A)=>{const T=so(an(j)),k=sN(n._getFieldArray(r),T);n._names.focus=tN(r,0,A),u.current=sN(u.current,T.map(Rl)),p(k),c(k),n._setFieldArray(r,k,sN,{argA:rN(j)})},v=j=>{const A=aN(n._getFieldArray(r),j);u.current=aN(u.current,j),p(A),c(A),!Array.isArray(Ie(n._fields,r))&&Pt(n._fields,r,void 0),n._setFieldArray(r,A,aN,{argA:j})},x=(j,A,T)=>{const k=so(an(A)),R=oN(n._getFieldArray(r),j,k);n._names.focus=tN(r,j,T),u.current=oN(u.current,j,k.map(Rl)),p(R),c(R),n._setFieldArray(r,R,oN,{argA:j,argB:rN(A)})},S=(j,A)=>{const T=n._getFieldArray(r);lN(T,j,A),lN(u.current,j,A),p(T),c(T),n._setFieldArray(r,T,lN,{argA:j,argB:A},!1)},E=(j,A)=>{const T=n._getFieldArray(r);iN(T,j,A),iN(u.current,j,A),p(T),c(T),n._setFieldArray(r,T,iN,{argA:j,argB:A},!1)},C=(j,A)=>{const T=an(A),k=pP(n._getFieldArray(r),j,T);u.current=[...k].map((R,V)=>!R||V===j?Rl():u.current[V]),p(k),c([...k]),n._setFieldArray(r,k,pP,{argA:j,argB:T},!0,!1)},_=j=>{const A=so(an(j));u.current=A.map(Rl),p([...A]),c([...A]),n._setFieldArray(r,[...A],T=>T,{},!0,!1)};return Ne.useEffect(()=>{if(n._state.action=!1,bC(r,n._names)&&n._subjects.state.next({...n._formState}),f.current&&(!df(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!df(n._options.reValidateMode).isOnSubmit)if(n._options.resolver)n._runSchema([r]).then(j=>{const A=Ie(j.errors,r),T=Ie(n._formState.errors,r);(T?!A&&T.type||A&&(T.type!==A.type||T.message!==A.message):A&&A.type)&&(A?Pt(n._formState.errors,r,A):kn(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{const j=Ie(n._fields,r);j&&j._f&&!(df(n._options.reValidateMode).isOnSubmit&&df(n._options.mode).isOnSubmit)&&vC(j,n._names.disabled,n._formValues,n._options.criteriaMode===si.all,n._options.shouldUseNativeValidation,!0).then(A=>!yr(A)&&n._subjects.state.next({errors:fU(n._formState.errors,A,r)}))}n._subjects.state.next({name:r,values:an(n._formValues)}),n._names.focus&&bf(n._fields,(j,A)=>{if(n._names.focus&&A.startsWith(n._names.focus)&&j.focus)return j.focus(),1}),n._names.focus="",n._setValid(),f.current=!1},[a,r,n]),Ne.useEffect(()=>(!Ie(n._formValues,r)&&n._setFieldArray(r),()=>{const j=(A,T)=>{const k=Ie(n._fields,A);k&&k._f&&(k._f.mount=T)};n._options.shouldUnregister||i?n.unregister(r):j(r,!1)}),[r,n,o,i]),{swap:Ne.useCallback(S,[p,r,n]),move:Ne.useCallback(E,[p,r,n]),prepend:Ne.useCallback(y,[p,r,n]),append:Ne.useCallback(g,[p,r,n]),remove:Ne.useCallback(v,[p,r,n]),insert:Ne.useCallback(x,[p,r,n]),update:Ne.useCallback(C,[p,r,n]),replace:Ne.useCallback(_,[p,r,n]),fields:Ne.useMemo(()=>a.map((j,A)=>({...j,[o]:u.current[A]||Rl()})),[a,o])}}function Cc(e={}){const t=Ne.useRef(void 0),n=Ne.useRef(void 0),[r,o]=Ne.useState({isDirty:!1,isValidating:!1,isLoading:Li(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Li(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!Li(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=e2e(e);t.current={...a,formState:r}}const i=t.current.control;return i._options=e,Yw(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),Ne.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Ne.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),Ne.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),Ne.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),Ne.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Ne.useEffect(()=>{e.values&&!Ii(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),n.current=e.values,o(s=>({...s}))):i._resetDefaultValues()},[i,e.values]),Ne.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=iU(r,i),t.current}const mP=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Ie(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},hU=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?mP(r.ref,n,e):r&&r.refs&&r.refs.forEach(o=>mP(o,n,e))}},r2e=(e,t)=>{t.shouldUseNativeValidation&&hU(e,t);const n={};for(const r in e){const o=Ie(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(o2e(t.names||Object.keys(e),r)){const s=Object.assign({},Ie(n,r));Pt(s,"root",i),Pt(n,r,s)}else Pt(n,r,i)}return n},o2e=(e,t)=>{const n=gP(t);return e.some(r=>gP(r).match(`^${n}\\.\\d+`))};function gP(e){return e.replace(/\]|\[/g,"")}function i2e(e){if(e.path?.length){let t="";for(const n of e.path){const r=typeof n=="object"?n.key:n;if(typeof r=="string"||typeof r=="number")t?t+=`.${r}`:t+=r;else return null}return t}return null}function xC(){return xC=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xC.apply(null,arguments)}function Oc(e,t,n){return n===void 0&&(n={}),function(r,o,i){try{var s=function(){if(a.issues){var u=function(f,p){for(var g={},y=0;y<f.length;y++){var v=f[y],x=i2e(v);if(x&&(g[x]||(g[x]={message:v.message,type:""}),p)){var S,E=g[x].types||{};g[x].types=xC({},E,((S={})[Object.keys(E).length]=v.message,S))}}return g}(a.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all");return{values:{},errors:r2e(u,i)}}return i.shouldUseNativeValidation&&hU({},i),{values:n.raw?Object.assign({},r):a.value,errors:{}}},a=e["~standard"].validate(r),c=function(){if(a instanceof Promise)return Promise.resolve(a).then(function(u){a=u})}();return Promise.resolve(c&&c.then?c.then(s):s())}catch(u){return Promise.reject(u)}}}const aT=ke({...SA.properties,name:le()}),s2e=Rt([le({enum:["entity","relation","media"]}),le({pattern:"^template-"})]),a2e=ke({entity:le(),name:le(),field:un(wA)});Ve({action:s2e,initial:Xi().optional(),entities:ke({create:un(aT).optional()}).optional(),relations:ke({create:un(Rt(EA)).optional()}).optional(),fields:ke({create:un(a2e).optional()}).optional()});const l2e=ke({name:le({pattern:/^[a-z][a-zA-Z_]+$/}),config:aT.properties.config.partial().optional()});function c2e(){const e=_x(),{nextStep:t,stepBack:n,state:r,setState:o}=Yu(),{register:i,handleSubmit:s,formState:a,watch:c,control:u}=Cc({mode:"onChange",resolver:Oc(b7(l2e)),defaultValues:r.entities?.create?.[0]??{}});function f(p){console.log("onSubmit",p),o(g=>{const y=g.entities?.create?.[0];return y&&y.name!==p.name?{...g,entities:{create:[{...p,fields:y.fields}]}}:{...g,entities:{create:[p]}}}),a.isValid&&(console.log("would go next"),t("entity-fields")())}return h.jsx(h.Fragment,{children:h.jsxs("form",{onSubmit:s(f),ref:e,children:[h.jsxs(Gu,{children:[h.jsx("input",{type:"hidden",...i("type"),defaultValue:"regular"}),h.jsx(_n,{"data-autofocus":!0,required:!0,error:a.errors.name?.message,...i("name"),placeholder:"posts",size:"md",label:"What's the name of the entity?",description:"Use plural form, and all lowercase. It will be used as the database table."}),h.jsx(_n,{...i("config.name"),error:a.errors.config?.name?.message,placeholder:"Posts",size:"md",label:"How should it be called?",description:"Use plural form. This will be used to display in the UI."}),h.jsx(_n,{...i("config.name_singular"),error:a.errors.config?.name_singular?.message,placeholder:"Post",size:"md",label:"What's the singular form of it?"}),h.jsx(kg,{placeholder:"This is a post (optional)",error:a.errors.config?.description?.message,...i("config.description"),size:"md",label:"Description"})]}),h.jsx(Ju,{next:{type:"submit",disabled:!a.isValid},prev:{onClick:n},debug:{state:r}})]})})}function Sa({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o,onChange:i,...s}){const{field:{value:a,onChange:c,...u},fieldState:f}=Oh({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o});return h.jsx(Xx,{value:a,onChange:async p=>{await c({...new Event("change",{bubbles:!0,cancelable:!0}),target:{value:p,name:u.name}}),i?.(p)},error:f.error?.message,...u,...s})}function cN({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o,onChange:i,...s}){const{field:{value:a,onChange:c,...u},fieldState:f}=Oh({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o});return h.jsx(vc,{value:a,checked:a,onChange:p=>{c(p),i?.(p)},error:f.error?.message,...u,...s})}const u2e="modulepreload",d2e=function(e){return"/"+e},yP={},Kw=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=s?.nonce||s?.getAttribute("nonce");o=c(n.map(u=>{if(u=d2e(u),u in yP)return;yP[u]=!0;const f=u.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":u2e,f||(g.as="script"),g.crossOrigin="",g.href=u,a&&g.setAttribute("nonce",a),document.head.appendChild(g),f)return new Promise((y,v)=>{g.addEventListener("load",y),g.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return o.then(s=>{for(const a of s||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},f2e=w.lazy(()=>Kw(()=>import("./JsonSchemaForm-CE_Yijem.js"),[]).then(e=>({default:e.JsonSchemaForm}))),jh=w.forwardRef((e,t)=>h.jsx(w.Suspense,{children:h.jsx(f2e,{ref:t,...e})}));function kr(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 h2e=typeof Symbol=="function"&&Symbol.observable||"@@observable",bP=h2e,vP=()=>Math.random().toString(36).substring(7).split("").join("."),p2e={INIT:`@@redux/INIT${vP()}`,REPLACE:`@@redux/REPLACE${vP()}`},xP=p2e;function m2e(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 pU(e,t,n){if(typeof e!="function")throw new Error(kr(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(kr(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(kr(1));return n(pU)(e,t)}let r=e,o=t,i=new Map,s=i,a=0,c=!1;function u(){s===i&&(s=new Map,i.forEach((S,E)=>{s.set(E,S)}))}function f(){if(c)throw new Error(kr(3));return o}function p(S){if(typeof S!="function")throw new Error(kr(4));if(c)throw new Error(kr(5));let E=!0;u();const C=a++;return s.set(C,S),function(){if(E){if(c)throw new Error(kr(6));E=!1,u(),s.delete(C),i=null}}}function g(S){if(!m2e(S))throw new Error(kr(7));if(typeof S.type>"u")throw new Error(kr(8));if(typeof S.type!="string")throw new Error(kr(17));if(c)throw new Error(kr(9));try{c=!0,o=r(o,S)}finally{c=!1}return(i=s).forEach(C=>{C()}),S}function y(S){if(typeof S!="function")throw new Error(kr(10));r=S,g({type:xP.REPLACE})}function v(){const S=p;return{subscribe(E){if(typeof E!="object"||E===null)throw new Error(kr(11));function C(){const j=E;j.next&&j.next(f())}return C(),{unsubscribe:S(C)}},[bP](){return this}}}return g({type:xP.INIT}),{dispatch:g,subscribe:p,getState:f,replaceReducer:y,[bP]:v}}function wP(e,t){return function(...n){return t(e.apply(this,n))}}function SP(e,t){if(typeof e=="function")return wP(e,t);if(typeof e!="object"||e===null)throw new Error(kr(16));const n={};for(const r in e){const o=e[r];typeof o=="function"&&(n[r]=wP(o,t))}return n}function mU(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function g2e(...e){return t=>(n,r)=>{const o=t(n,r);let i=()=>{throw new Error(kr(15))};const s={getState:o.getState,dispatch:(c,...u)=>i(c,...u)},a=e.map(c=>c(s));return i=mU(...a)(o.dispatch),{...o,dispatch:i}}}var uN={exports:{}},dN={};/**
* @license React
* use-sync-external-store-with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var EP;function y2e(){if(EP)return dN;EP=1;var e=dc();function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,i=e.useEffect,s=e.useMemo,a=e.useDebugValue;return dN.useSyncExternalStoreWithSelector=function(c,u,f,p,g){var y=o(null);if(y.current===null){var v={hasValue:!1,value:null};y.current=v}else v=y.current;y=s(function(){function S(A){if(!E){if(E=!0,C=A,A=p(A),g!==void 0&&v.hasValue){var T=v.value;if(g(T,A))return _=T}return _=A}if(T=_,n(C,A))return T;var k=p(A);return g!==void 0&&g(T,k)?(C=A,T):(C=A,_=k)}var E=!1,C,_,j=f===void 0?null:f;return[function(){return S(u())},j===null?void 0:function(){return S(j())}]},[u,f,p,g]);var x=r(c,y[0],y[1]);return i(function(){v.hasValue=!0,v.value=x},[x]),a(x),x},dN}var NP;function b2e(){return NP||(NP=1,uN.exports=y2e()),uN.exports}b2e();var v2e=w.version.startsWith("19"),x2e=Symbol.for(v2e?"react.transitional.element":"react.element"),w2e=Symbol.for("react.portal"),S2e=Symbol.for("react.fragment"),E2e=Symbol.for("react.strict_mode"),N2e=Symbol.for("react.profiler"),_2e=Symbol.for("react.consumer"),C2e=Symbol.for("react.context"),gU=Symbol.for("react.forward_ref"),O2e=Symbol.for("react.suspense"),j2e=Symbol.for("react.suspense_list"),lT=Symbol.for("react.memo"),A2e=Symbol.for("react.lazy"),T2e=gU,$2e=lT;function R2e(e){if(typeof e=="object"&&e!==null){const{$$typeof:t}=e;switch(t){case x2e:switch(e=e.type,e){case S2e:case N2e:case E2e:case O2e:case j2e:return e;default:switch(e=e&&e.$$typeof,e){case C2e:case gU:case A2e:case lT:return e;case _2e:return e;default:return t}}case w2e:return t}}}function k2e(e){return R2e(e)===lT}function M2e(e,t,n,r,{areStatesEqual:o,areOwnPropsEqual:i,areStatePropsEqual:s}){let a=!1,c,u,f,p,g;function y(C,_){return c=C,u=_,f=e(c,u),p=t(r,u),g=n(f,p,u),a=!0,g}function v(){return f=e(c,u),t.dependsOnOwnProps&&(p=t(r,u)),g=n(f,p,u),g}function x(){return e.dependsOnOwnProps&&(f=e(c,u)),t.dependsOnOwnProps&&(p=t(r,u)),g=n(f,p,u),g}function S(){const C=e(c,u),_=!s(C,f);return f=C,_&&(g=n(f,p,u)),g}function E(C,_){const j=!i(_,u),A=!o(C,c,_,u);return c=C,u=_,j&&A?v():j?x():A?S():g}return function(_,j){return a?E(_,j):y(_,j)}}function P2e(e,{initMapStateToProps:t,initMapDispatchToProps:n,initMergeProps:r,...o}){const i=t(e,o),s=n(e,o),a=r(e,o);return M2e(i,s,a,e,o)}function D2e(e,t){const n={};for(const r in e){const o=e[r];typeof o=="function"&&(n[r]=(...i)=>t(o(...i)))}return n}function wC(e){return function(n){const r=e(n);function o(){return r}return o.dependsOnOwnProps=!1,o}}function _P(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function yU(e,t){return function(r,{displayName:o}){const i=function(a,c){return i.dependsOnOwnProps?i.mapToProps(a,c):i.mapToProps(a,void 0)};return i.dependsOnOwnProps=!0,i.mapToProps=function(a,c){i.mapToProps=e,i.dependsOnOwnProps=_P(e);let u=i(a,c);return typeof u=="function"&&(i.mapToProps=u,i.dependsOnOwnProps=_P(u),u=i(a,c)),u},i}}function cT(e,t){return(n,r)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${r.wrappedComponentName}.`)}}function I2e(e){return e&&typeof e=="object"?wC(t=>D2e(e,t)):e?typeof e=="function"?yU(e):cT(e,"mapDispatchToProps"):wC(t=>({dispatch:t}))}function L2e(e){return e?typeof e=="function"?yU(e):cT(e,"mapStateToProps"):wC(()=>({}))}function F2e(e,t,n){return{...n,...e,...t}}function z2e(e){return function(n,{displayName:r,areMergedPropsEqual:o}){let i=!1,s;return function(c,u,f){const p=e(c,u,f);return i?o(p,s)||(s=p):(i=!0,s=p),s}}}function B2e(e){return e?typeof e=="function"?z2e(e):cT(e,"mergeProps"):()=>F2e}function V2e(e){e()}function U2e(){let e=null,t=null;return{clear(){e=null,t=null},notify(){V2e(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const o=t={callback:n,next:null,prev:t};return o.prev?o.prev.next=o:e=o,function(){!r||e===null||(r=!1,o.next?o.next.prev=o.prev:t=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}var CP={notify(){},get:()=>[]};function bU(e,t){let n,r=CP,o=0,i=!1;function s(x){f();const S=r.subscribe(x);let E=!1;return()=>{E||(E=!0,S(),p())}}function a(){r.notify()}function c(){v.onStateChange&&v.onStateChange()}function u(){return i}function f(){o++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=U2e())}function p(){o--,n&&o===0&&(n(),n=void 0,r.clear(),r=CP)}function g(){i||(i=!0,f())}function y(){i&&(i=!1,p())}const v={addNestedSub:s,notifyNestedSubs:a,handleChangeWrapper:c,isSubscribed:u,trySubscribe:g,tryUnsubscribe:y,getListeners:()=>r};return v}var H2e=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",q2e=H2e(),W2e=()=>typeof navigator<"u"&&navigator.product==="ReactNative",G2e=W2e(),J2e=()=>q2e||G2e?w.useLayoutEffect:w.useEffect,Uv=J2e();function OP(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function fN(e,t){if(OP(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(t,n[o])||!OP(e[n[o]],t[n[o]]))return!1;return!0}var Y2e={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},K2e={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},X2e={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},vU={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Q2e={[T2e]:X2e,[$2e]:vU};function jP(e){return k2e(e)?vU:Q2e[e.$$typeof]||Y2e}var Z2e=Object.defineProperty,eNe=Object.getOwnPropertyNames,AP=Object.getOwnPropertySymbols,tNe=Object.getOwnPropertyDescriptor,nNe=Object.getPrototypeOf,TP=Object.prototype;function SC(e,t){if(typeof t!="string"){if(TP){const i=nNe(t);i&&i!==TP&&SC(e,i)}let n=eNe(t);AP&&(n=n.concat(AP(t)));const r=jP(e),o=jP(t);for(let i=0;i<n.length;++i){const s=n[i];if(!K2e[s]&&!(o&&o[s])&&!(r&&r[s])){const a=tNe(t,s);try{Z2e(e,s,a)}catch{}}}}return e}var rNe=Symbol.for("react-redux-context"),oNe=typeof globalThis<"u"?globalThis:{};function iNe(){if(!w.createContext)return{};const e=oNe[rNe]??=new Map;let t=e.get(w.createContext);return t||(t=w.createContext(null),e.set(w.createContext,t)),t}var xU=iNe(),sNe=[null,null];function aNe(e,t,n){Uv(()=>e(...t),n)}function lNe(e,t,n,r,o,i){e.current=r,n.current=!1,o.current&&(o.current=null,i())}function cNe(e,t,n,r,o,i,s,a,c,u,f){if(!e)return()=>{};let p=!1,g=null;const y=()=>{if(p||!a.current)return;const x=t.getState();let S,E;try{S=r(x,o.current)}catch(C){E=C,g=C}E||(g=null),S===i.current?s.current||u():(i.current=S,c.current=S,s.current=!0,f())};return n.onStateChange=y,n.trySubscribe(),y(),()=>{if(p=!0,n.tryUnsubscribe(),n.onStateChange=null,g)throw g}}function uNe(e,t){return e===t}function dNe(e,t,n,{pure:r,areStatesEqual:o=uNe,areOwnPropsEqual:i=fN,areStatePropsEqual:s=fN,areMergedPropsEqual:a=fN,forwardRef:c=!1,context:u=xU}={}){const f=u,p=L2e(e),g=I2e(t),y=B2e(n),v=!!e;return S=>{const E=S.displayName||S.name||"Component",C=`Connect(${E})`,_={shouldHandleStateChanges:v,displayName:C,wrappedComponentName:E,WrappedComponent:S,initMapStateToProps:p,initMapDispatchToProps:g,initMergeProps:y,areStatesEqual:o,areStatePropsEqual:s,areOwnPropsEqual:i,areMergedPropsEqual:a};function j(k){const[R,V,H]=w.useMemo(()=>{const{reactReduxForwardedRef:_e,...Ee}=k;return[k.context,_e,Ee]},[k]),F=w.useMemo(()=>{let _e=f;return R?.Consumer,_e},[R,f]),B=w.useContext(F),U=!!k.store&&!!k.store.getState&&!!k.store.dispatch,M=!!B&&!!B.store,z=U?k.store:B.store,$=M?B.getServerState:z.getState,L=w.useMemo(()=>P2e(z.dispatch,_),[z]),[P,q]=w.useMemo(()=>{if(!v)return sNe;const _e=bU(z,U?void 0:B.subscription),Ee=_e.notifyNestedSubs.bind(_e);return[_e,Ee]},[z,U,B]),Y=w.useMemo(()=>U?B:{...B,subscription:P},[U,B,P]),D=w.useRef(void 0),W=w.useRef(H),K=w.useRef(void 0),Q=w.useRef(!1),ie=w.useRef(!1),pe=w.useRef(void 0);Uv(()=>(ie.current=!0,()=>{ie.current=!1}),[]);const ue=w.useMemo(()=>()=>K.current&&H===W.current?K.current:L(z.getState(),H),[z,H]),se=w.useMemo(()=>Ee=>P?cNe(v,z,P,L,W,D,Q,ie,K,q,Ee):()=>{},[P]);aNe(lNe,[W,D,Q,H,K,q]);let me;try{me=w.useSyncExternalStore(se,ue,$?()=>L($(),H):ue)}catch(_e){throw pe.current&&(_e.message+=`
The error may be correlated with this previous error:
${pe.current.stack}
`),_e}Uv(()=>{pe.current=void 0,K.current=void 0,D.current=me});const xe=w.useMemo(()=>w.createElement(S,{...me,ref:V}),[V,S,me]);return w.useMemo(()=>v?w.createElement(F.Provider,{value:Y},xe):xe,[F,xe,Y])}const T=w.memo(j);if(T.WrappedComponent=S,T.displayName=j.displayName=C,c){const R=w.forwardRef(function(H,F){return w.createElement(T,{...H,reactReduxForwardedRef:F})});return R.displayName=C,R.WrappedComponent=S,SC(R,S)}return SC(T,S)}}var wU=dNe;function fNe(e){const{children:t,context:n,serverState:r,store:o}=e,i=w.useMemo(()=>{const c=bU(o);return{store:o,subscription:c,getServerState:r?()=>r:void 0}},[o,r]),s=w.useMemo(()=>o.getState(),[o]);Uv(()=>{const{subscription:c}=i;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),s!==o.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[i,s]);const a=n||xU;return w.createElement(a.Provider,{value:i},t)}var hNe=fNe,pNe="Invariant failed";function mNe(e,t){throw new Error(pNe)}var Hi=function(t){var n=t.top,r=t.right,o=t.bottom,i=t.left,s=r-i,a=o-n,c={top:n,right:r,bottom:o,left:i,width:s,height:a,x:i,y:n,center:{x:(r+i)/2,y:(o+n)/2}};return c},uT=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},$P=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},gNe=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},hN={top:0,right:0,bottom:0,left:0},dT=function(t){var n=t.borderBox,r=t.margin,o=r===void 0?hN:r,i=t.border,s=i===void 0?hN:i,a=t.padding,c=a===void 0?hN:a,u=Hi(uT(n,o)),f=Hi($P(n,s)),p=Hi($P(f,c));return{marginBox:u,borderBox:Hi(n),paddingBox:f,contentBox:p,margin:o,border:s,padding:c}},ti=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var o=Number(n);return isNaN(o)&&mNe(),o},yNe=function(){return{x:window.pageXOffset,y:window.pageYOffset}},Hv=function(t,n){var r=t.borderBox,o=t.border,i=t.margin,s=t.padding,a=gNe(r,n);return dT({borderBox:a,border:o,margin:i,padding:s})},qv=function(t,n){return n===void 0&&(n=yNe()),Hv(t,n)},SU=function(t,n){var r={top:ti(n.marginTop),right:ti(n.marginRight),bottom:ti(n.marginBottom),left:ti(n.marginLeft)},o={top:ti(n.paddingTop),right:ti(n.paddingRight),bottom:ti(n.paddingBottom),left:ti(n.paddingLeft)},i={top:ti(n.borderTopWidth),right:ti(n.borderRightWidth),bottom:ti(n.borderBottomWidth),left:ti(n.borderLeftWidth)};return dT({borderBox:t,margin:r,padding:o,border:i})},EU=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return SU(n,r)},sg=function(t){var n=[],r=null,o=function(){for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];n=a,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return o.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},o};function NU(e,t){}NU.bind(null,"warn");NU.bind(null,"error");function Zl(){}function bNe(e,t){return{...e,...t}}function li(e,t,n){const r=t.map(o=>{const i=bNe(n,o.options);return e.addEventListener(o.eventName,o.fn,i),function(){e.removeEventListener(o.eventName,o.fn,i)}});return function(){r.forEach(i=>{i()})}}const vNe="Invariant failed";class Wv extends Error{}Wv.prototype.toString=function(){return this.message};function De(e,t){throw new Wv(vNe)}class xNe extends Ne.Component{constructor(...t){super(...t),this.callbacks=null,this.unbind=Zl,this.onWindowError=n=>{const r=this.getCallbacks();r.isDragging()&&r.tryAbort(),n.error instanceof Wv&&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=li(window,[{eventName:"error",fn:this.onWindowError}])}componentDidCatch(t){if(t instanceof Wv){this.setState({});return}throw t}componentWillUnmount(){this.unbind()}render(){return this.props.children(this.setCallbacks)}}const wNe=`
Press space bar to start a drag.
When dragging you can use the arrow keys to move the item around and escape to cancel.
Some screen readers may require you to be in focus mode or to use your pass through key
`,Gv=e=>e+1,SNe=e=>`
You have lifted an item in position ${Gv(e.source.index)}
`,_U=(e,t)=>{const n=e.droppableId===t.droppableId,r=Gv(e.index),o=Gv(t.index);return n?`
You have moved the item from position ${r}
to position ${o}
`:`
You have moved the item from position ${r}
in list ${e.droppableId}
to list ${t.droppableId}
in position ${o}
`},CU=(e,t,n)=>t.droppableId===n.droppableId?`
The item ${e}
has been combined with ${n.draggableId}`:`
The item ${e}
in list ${t.droppableId}
has been combined with ${n.draggableId}
in list ${n.droppableId}
`,ENe=e=>{const t=e.destination;if(t)return _U(e.source,t);const n=e.combine;return n?CU(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},RP=e=>`
The item has returned to its starting position
of ${Gv(e.index)}
`,NNe=e=>{if(e.reason==="CANCEL")return`
Movement cancelled.
${RP(e.source)}
`;const t=e.destination,n=e.combine;return t?`
You have dropped the item.
${_U(e.source,t)}
`:n?`
You have dropped the item.
${CU(e.draggableId,e.source,n)}
`:`
The item has been dropped while not over a drop area.
${RP(e.source)}
`},Vb={dragHandleUsageInstructions:wNe,onDragStart:SNe,onDragUpdate:ENe,onDragEnd:NNe};function _Ne(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function OU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!_Ne(e[n],t[n]))return!1;return!0}function _t(e,t){const n=w.useState(()=>({inputs:t,result:e()}))[0],r=w.useRef(!0),o=w.useRef(n),s=r.current||!!(t&&o.current.inputs&&OU(t,o.current.inputs))?o.current:{inputs:t,result:e()};return w.useEffect(()=>{r.current=!1,o.current=s},[s]),s.result}function Ze(e,t){return _t(()=>e,t)}const sr={x:0,y:0},fr=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),ko=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),ec=(e,t)=>e.x===t.x&&e.y===t.y,Ah=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),ku=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},ag=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),kP=(e,t)=>Math.min(...t.map(n=>ag(e,n))),jU=e=>t=>({x:e(t.x),y:e(t.y)});var CNe=(e,t)=>{const n=Hi({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 sy=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),MP=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}],ONe={top:0,right:0,bottom:0,left:0},jNe=(e,t)=>t?sy(e,t.scroll.diff.displacement):e,ANe=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,TNe=(e,t)=>t&&t.shouldClipSubject?CNe(t.pageMarginBox,e):Hi(e);var Uf=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const o=jNe(e.marginBox,r),i=ANe(o,n,t),s=TNe(i,r);return{page:e,withPlaceholder:t,active:s}},fT=(e,t)=>{e.frame||De();const n=e.frame,r=ko(t,n.scroll.initial),o=Ah(r),i={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:o},max:n.scroll.max}},s=Uf({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:s}};function or(e,t=OU){let n=null;function r(...o){if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;const i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}const AU=or(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),TU=or(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),Xw=or(e=>Object.values(e)),$Ne=or(e=>Object.values(e));var Th=or((e,t)=>$Ne(t).filter(r=>e===r.descriptor.droppableId).sort((r,o)=>r.descriptor.index-o.descriptor.index));function hT(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Qw(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Zw=or((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),RNe=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:o})=>{if(!n.isCombineEnabled||!hT(o))return null;function s(y){const v={type:"COMBINE",combine:{draggableId:y,droppableId:n.descriptor.id}};return{...o,at:v}}const a=o.displaced.all,c=a.length?a[0]:null;if(e)return c?s(c):null;const u=Zw(t,r);if(!c){if(!u.length)return null;const y=u[u.length-1];return s(y.descriptor.id)}const f=u.findIndex(y=>y.descriptor.id===c);f===-1&&De();const p=f-1;if(p<0)return null;const g=u[p];return s(g.descriptor.id)},$h=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const $U={point:sr,value:0},lg={invisible:{},visible:{},all:[]},kNe={displaced:lg,displacedBy:$U,at:null};var di=(e,t)=>n=>e<=n&&n<=t,RU=e=>{const t=di(e.top,e.bottom),n=di(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const i=t(r.top)||t(r.bottom),s=n(r.left)||n(r.right);if(i&&s)return!0;const c=r.top<e.top&&r.bottom>e.bottom,u=r.left<e.left&&r.right>e.right;return c&&u?!0:c&&s||u&&i}},MNe=e=>{const t=di(e.top,e.bottom),n=di(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const pT={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},kU={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var PNe=e=>t=>{const n=di(t.top,t.bottom),r=di(t.left,t.right);return o=>e===pT?n(o.top)&&n(o.bottom):r(o.left)&&r(o.right)};const DNe=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:sr;return sy(e,n)},INe=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,LNe=(e,t,n)=>n(t)(e),mT=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:o})=>{const i=r?DNe(e,t):e;return INe(i,t,o)&&LNe(i,n,o)},FNe=e=>mT({...e,isVisibleThroughFrameFn:RU}),MU=e=>mT({...e,isVisibleThroughFrameFn:MNe}),zNe=e=>mT({...e,isVisibleThroughFrameFn:PNe(e.destination.axis)}),BNe=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:o}=t;if(r[e])return!1;const i=o[e];return i?i.shouldAnimate:!0};function VNe(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return Hi(uT(n,r))}function cg({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:o,last:i}){return e.reduce(function(a,c){const u=VNe(c,n),f=c.descriptor.id;if(a.all.push(f),!FNe({target:u,destination:t,viewport:r,withDroppableDisplacement:!0}))return a.invisible[c.descriptor.id]=!0,a;const g=BNe(f,i,o),y={draggableId:f,shouldAnimate:g};return a.visible[f]=y,a},{all:[],visible:{},invisible:{}})}function UNe(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}function PP({insideDestination:e,inHomeList:t,displacedBy:n,destination:r}){const o=UNe(e,{inHomeList:t});return{displaced:lg,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:o}}}}function Jv({draggable:e,insideDestination:t,destination:n,viewport:r,displacedBy:o,last:i,index:s,forceShouldAnimate:a}){const c=$h(e,n);if(s==null)return PP({insideDestination:t,inHomeList:c,displacedBy:o,destination:n});const u=t.find(v=>v.descriptor.index===s);if(!u)return PP({insideDestination:t,inHomeList:c,displacedBy:o,destination:n});const f=Zw(e,t),p=t.indexOf(u),g=f.slice(p);return{displaced:cg({afterDragging:g,destination:n,displacedBy:o,last:i,viewport:r.frame,forceShouldAnimate:a}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:s}}}}function cc(e,t){return!!t.effected[e]}var HNe=({isMovingForward:e,destination:t,draggables:n,combine:r,afterCritical:o})=>{if(!t.isCombineEnabled)return null;const i=r.draggableId,a=n[i].descriptor.index;return cc(i,o)?e?a:a-1:e?a+1:a},qNe=({isMovingForward:e,isInHomeList:t,insideDestination:n,location:r})=>{if(!n.length)return null;const o=r.index,i=e?o+1:o-1,s=n[0].descriptor.index,a=n[n.length-1].descriptor.index,c=t?a:a+1;return i<s||i>c?null:i},WNe=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:r,destination:o,insideDestination:i,previousImpact:s,viewport:a,afterCritical:c})=>{const u=s.at;if(u||De(),u.type==="REORDER"){const p=qNe({isMovingForward:e,isInHomeList:t,location:u.destination,insideDestination:i});return p==null?null:Jv({draggable:n,insideDestination:i,destination:o,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:p})}const f=HNe({isMovingForward:e,destination:o,displaced:s.displaced,draggables:r,combine:u.combine,afterCritical:c});return f==null?null:Jv({draggable:n,insideDestination:i,destination:o,viewport:a,last:s.displaced,displacedBy:s.displacedBy,index:f})},GNe=({displaced:e,afterCritical:t,combineWith:n,displacedBy:r})=>{const o=!!(e.visible[n]||e.invisible[n]);return cc(n,t)?o?sr:Ah(r.point):o?r.point:sr},JNe=({afterCritical:e,impact:t,draggables:n})=>{const r=Qw(t);r||De();const o=r.draggableId,i=n[o].page.borderBox.center,s=GNe({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return fr(i,s)};const PU=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,YNe=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,gT=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,DP=({axis:e,moveRelativeTo:t,isMoving:n})=>ku(e.line,t.marginBox[e.end]+PU(e,n),gT(e,t.marginBox,n)),IP=({axis:e,moveRelativeTo:t,isMoving:n})=>ku(e.line,t.marginBox[e.start]-YNe(e,n),gT(e,t.marginBox,n)),KNe=({axis:e,moveInto:t,isMoving:n})=>ku(e.line,t.contentBox[e.start]+PU(e,n),gT(e,t.contentBox,n));var XNe=({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:o})=>{const i=Th(r.descriptor.id,n),s=t.page,a=r.axis;if(!i.length)return KNe({axis:a,moveInto:r.page,isMoving:s});const{displaced:c,displacedBy:u}=e,f=c.all[0];if(f){const g=n[f];if(cc(f,o))return IP({axis:a,moveRelativeTo:g.page,isMoving:s});const y=Hv(g.page,u.point);return IP({axis:a,moveRelativeTo:y,isMoving:s})}const p=i[i.length-1];if(p.descriptor.id===t.descriptor.id)return s.borderBox.center;if(cc(p.descriptor.id,o)){const g=Hv(p.page,Ah(o.displacedBy.point));return DP({axis:a,moveRelativeTo:g,isMoving:s})}return DP({axis:a,moveRelativeTo:p.page,isMoving:s})},EC=(e,t)=>{const n=e.frame;return n?fr(t,n.scroll.diff.displacement):t};const QNe=({impact:e,draggable:t,droppable:n,draggables:r,afterCritical:o})=>{const i=t.page.borderBox.center,s=e.at;return!n||!s?i:s.type==="REORDER"?XNe({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o}):JNe({impact:e,draggables:r,afterCritical:o})};var e1=e=>{const t=QNe(e),n=e.droppable;return n?EC(n,t):t},DU=(e,t)=>{const n=ko(t,e.scroll.initial),r=Ah(n);return{frame:Hi({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:r}}}};function LP(e,t){return e.map(n=>t[n])}function ZNe(e,t){for(let n=0;n<t.length;n++){const r=t[n].visible[e];if(r)return r}return null}var e_e=({impact:e,viewport:t,destination:n,draggables:r,maxScrollChange:o})=>{const i=DU(t,fr(t.scroll.current,o)),s=n.frame?fT(n,fr(n.frame.scroll.current,o)):n,a=e.displaced,c=cg({afterDragging:LP(a.all,r),destination:n,displacedBy:e.displacedBy,viewport:i.frame,last:a,forceShouldAnimate:!1}),u=cg({afterDragging:LP(a.all,r),destination:s,displacedBy:e.displacedBy,viewport:t.frame,last:a,forceShouldAnimate:!1}),f={},p={},g=[a,c,u];return a.all.forEach(v=>{const x=ZNe(v,g);if(x){p[v]=x;return}f[v]=!0}),{...e,displaced:{all:a.all,invisible:f,visible:p}}},t_e=(e,t)=>fr(e.scroll.diff.displacement,t),yT=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const r=t_e(n,e),o=ko(r,t.page.borderBox.center);return fr(t.client.borderBox.center,o)},IU=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:o,onlyOnMainAxis:i=!1})=>{const s=ko(n,e.page.borderBox.center),c={target:sy(e.page.borderBox,s),destination:t,withDroppableDisplacement:o,viewport:r};return i?zNe(c):MU(c)},n_e=({isMovingForward:e,draggable:t,destination:n,draggables:r,previousImpact:o,viewport:i,previousPageBorderBoxCenter:s,previousClientSelection:a,afterCritical:c})=>{if(!n.isEnabled)return null;const u=Th(n.descriptor.id,r),f=$h(t,n),p=RNe({isMovingForward:e,draggable:t,destination:n,insideDestination:u,previousImpact:o})||WNe({isMovingForward:e,isInHomeList:f,draggable:t,draggables:r,destination:n,insideDestination:u,previousImpact:o,viewport:i,afterCritical:c});if(!p)return null;const g=e1({impact:p,draggable:t,droppable:n,draggables:r,afterCritical:c});if(IU({draggable:t,destination:n,newPageBorderBoxCenter:g,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:yT({pageBorderBoxCenter:g,draggable:t,viewport:i}),impact:p,scrollJumpRequest:null};const v=ko(g,s),x=e_e({impact:p,viewport:i,destination:n,draggables:r,maxScrollChange:v});return{clientSelection:a,impact:x,scrollJumpRequest:v}};const Tr=e=>{const t=e.subject.active;return t||De(),t};var r_e=({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:r,viewport:o})=>{const i=n.subject.active;if(!i)return null;const s=n.axis,a=di(i[s.start],i[s.end]),c=Xw(r).filter(f=>f!==n).filter(f=>f.isEnabled).filter(f=>!!f.subject.active).filter(f=>RU(o.frame)(Tr(f))).filter(f=>{const p=Tr(f);return e?i[s.crossAxisEnd]<p[s.crossAxisEnd]:p[s.crossAxisStart]<i[s.crossAxisStart]}).filter(f=>{const p=Tr(f),g=di(p[s.start],p[s.end]);return a(p[s.start])||a(p[s.end])||g(i[s.start])||g(i[s.end])}).sort((f,p)=>{const g=Tr(f)[s.crossAxisStart],y=Tr(p)[s.crossAxisStart];return e?g-y:y-g}).filter((f,p,g)=>Tr(f)[s.crossAxisStart]===Tr(g[0])[s.crossAxisStart]);if(!c.length)return null;if(c.length===1)return c[0];const u=c.filter(f=>di(Tr(f)[s.start],Tr(f)[s.end])(t[s.line]));return u.length===1?u[0]:u.length>1?u.sort((f,p)=>Tr(f)[s.start]-Tr(p)[s.start])[0]:c.sort((f,p)=>{const g=kP(t,MP(Tr(f))),y=kP(t,MP(Tr(p)));return g!==y?g-y:Tr(f)[s.start]-Tr(p)[s.start]})[0]};const FP=(e,t)=>{const n=e.page.borderBox.center;return cc(e.descriptor.id,t)?ko(n,t.displacedBy.point):n},o_e=(e,t)=>{const n=e.page.borderBox;return cc(e.descriptor.id,t)?sy(n,Ah(t.displacedBy.point)):n};var i_e=({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:r,afterCritical:o})=>r.filter(s=>MU({target:o_e(s,o),destination:n,viewport:t.frame,withDroppableDisplacement:!0})).sort((s,a)=>{const c=ag(e,EC(n,FP(s,o))),u=ag(e,EC(n,FP(a,o)));return c<u?-1:u<c?1:s.descriptor.index-a.descriptor.index})[0]||null,ay=or(function(t,n){const r=n[t.line];return{value:r,point:ku(t.line,r)}});const s_e=(e,t,n)=>{const r=e.axis;if(e.descriptor.mode==="virtual")return ku(r.line,t[r.line]);const o=e.subject.page.contentBox[r.size],c=Th(e.descriptor.id,n).reduce((u,f)=>u+f.client.marginBox[r.size],0)+t[r.line]-o;return c<=0?null:ku(r.line,c)},LU=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),FU=(e,t,n)=>{const r=e.frame;$h(t,e)&&De(),e.subject.withPlaceholder&&De();const o=ay(e.axis,t.displaceBy).point,i=s_e(e,o,n),s={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){const f=Uf({page:e.subject.page,withPlaceholder:s,axis:e.axis,frame:e.frame});return{...e,subject:f}}const a=i?fr(r.scroll.max,i):r.scroll.max,c=LU(r,a),u=Uf({page:e.subject.page,withPlaceholder:s,axis:e.axis,frame:c});return{...e,subject:u,frame:c}},a_e=e=>{const t=e.subject.withPlaceholder;t||De();const n=e.frame;if(!n){const s=Uf({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:s}}const r=t.oldFrameMaxScroll;r||De();const o=LU(n,r),i=Uf({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:i,frame:o}};var l_e=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:r,draggables:o,destination:i,viewport:s,afterCritical:a})=>{if(!t){if(n.length)return null;const p={displaced:lg,displacedBy:$U,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},g=e1({impact:p,draggable:r,droppable:i,draggables:o,afterCritical:a}),y=$h(r,i)?i:FU(i,r,o);return IU({draggable:r,destination:y,newPageBorderBoxCenter:g,viewport:s.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?p:null}const c=e[i.axis.line]<=t.page.borderBox.center[i.axis.line],u=(()=>{const p=t.descriptor.index;return t.descriptor.id===r.descriptor.id||c?p:p+1})(),f=ay(i.axis,r.displaceBy);return Jv({draggable:r,insideDestination:n,destination:i,viewport:s,displacedBy:f,last:lg,index:u})},c_e=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:r,draggables:o,droppables:i,viewport:s,afterCritical:a})=>{const c=r_e({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:i,viewport:s});if(!c)return null;const u=Th(c.descriptor.id,o),f=i_e({pageBorderBoxCenter:t,viewport:s,destination:c,insideDestination:u,afterCritical:a}),p=l_e({previousPageBorderBoxCenter:t,destination:c,draggable:n,draggables:o,moveRelativeTo:f,insideDestination:u,viewport:s,afterCritical:a});if(!p)return null;const g=e1({impact:p,draggable:n,droppable:c,draggables:o,afterCritical:a});return{clientSelection:yT({pageBorderBoxCenter:g,draggable:n,viewport:s}),impact:p,scrollJumpRequest:null}},Mo=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const u_e=(e,t)=>{const n=Mo(e);return n?t[n]:null};var d_e=({state:e,type:t})=>{const n=u_e(e.impact,e.dimensions.droppables),r=!!n,o=e.dimensions.droppables[e.critical.droppable.id],i=n||o,s=i.axis.direction,a=s==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||s==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(a&&!r)return null;const c=t==="MOVE_DOWN"||t==="MOVE_RIGHT",u=e.dimensions.draggables[e.critical.draggable.id],f=e.current.page.borderBoxCenter,{draggables:p,droppables:g}=e.dimensions;return a?n_e({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:u,destination:i,draggables:p,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):c_e({isMovingForward:c,previousPageBorderBoxCenter:f,draggable:u,isOver:i,draggables:p,droppables:g,viewport:e.viewport,afterCritical:e.afterCritical})};function tu(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function zU(e){const t=di(e.top,e.bottom),n=di(e.left,e.right);return function(o){return t(o.y)&&n(o.x)}}function f_e(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function h_e({pageBorderBox:e,draggable:t,candidates:n}){const r=t.page.borderBox.center,o=n.map(i=>{const s=i.axis,a=ku(i.axis.line,e.center[s.line],i.page.borderBox.center[s.crossAxisLine]);return{id:i.descriptor.id,distance:ag(r,a)}}).sort((i,s)=>s.distance-i.distance);return o[0]?o[0].id:null}function p_e({pageBorderBox:e,draggable:t,droppables:n}){const r=Xw(n).filter(o=>{if(!o.isEnabled)return!1;const i=o.subject.active;if(!i||!f_e(e,i))return!1;if(zU(i)(e.center))return!0;const s=o.axis,a=i.center[s.crossAxisLine],c=e[s.crossAxisStart],u=e[s.crossAxisEnd],f=di(i[s.crossAxisStart],i[s.crossAxisEnd]),p=f(c),g=f(u);return!p&&!g?!0:p?c<a:u>a});return r.length?r.length===1?r[0].descriptor.id:h_e({pageBorderBox:e,draggable:t,candidates:r}):null}const BU=(e,t)=>Hi(sy(e,t));var m_e=(e,t)=>{const n=e.frame;return n?BU(t,n.scroll.diff.value):t};function VU({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function g_e({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var y_e=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:r,last:o,viewport:i,afterCritical:s})=>{const a=n.axis,c=ay(n.axis,t.displaceBy),u=c.value,f=e[a.start],p=e[a.end],y=Zw(t,r).find(x=>{const S=x.descriptor.id,E=x.page.borderBox.center[a.line],C=cc(S,s),_=VU({displaced:o,id:S});return C?_?p<=E:f<E-u:_?p<=E+u:f<E})||null,v=g_e({draggable:t,closest:y,inHomeList:$h(t,n)});return Jv({draggable:t,insideDestination:r,destination:n,viewport:i,last:o,displacedBy:c,index:v})};const b_e=4;var v_e=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:r,insideDestination:o,afterCritical:i})=>{if(!r.isCombineEnabled)return null;const s=r.axis,a=ay(r.axis,e.displaceBy),c=a.value,u=t[s.start],f=t[s.end],g=Zw(e,o).find(v=>{const x=v.descriptor.id,S=v.page.borderBox,C=S[s.size]/b_e,_=cc(x,i),j=VU({displaced:n.displaced,id:x});return _?j?f>S[s.start]+C&&f<S[s.end]-C:u>S[s.start]-c+C&&u<S[s.end]-c-C:j?f>S[s.start]+c+C&&f<S[s.end]+c-C:u>S[s.start]+C&&u<S[s.end]-C});return g?{displacedBy:a,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:g.descriptor.id,droppableId:r.descriptor.id}}}:null},UU=({pageOffset:e,draggable:t,draggables:n,droppables:r,previousImpact:o,viewport:i,afterCritical:s})=>{const a=BU(t.page.borderBox,e),c=p_e({pageBorderBox:a,draggable:t,droppables:r});if(!c)return kNe;const u=r[c],f=Th(u.descriptor.id,n),p=m_e(u,a);return v_e({pageBorderBoxWithDroppableScroll:p,draggable:t,previousImpact:o,destination:u,insideDestination:f,afterCritical:s})||y_e({pageBorderBoxWithDroppableScroll:p,draggable:t,destination:u,insideDestination:f,last:o.displaced,viewport:i,afterCritical:s})},bT=(e,t)=>({...e,[t.descriptor.id]:t});const x_e=({previousImpact:e,impact:t,droppables:n})=>{const r=Mo(e),o=Mo(t);if(!r||r===o)return n;const i=n[r];if(!i.subject.withPlaceholder)return n;const s=a_e(i);return bT(n,s)};var w_e=({draggable:e,draggables:t,droppables:n,previousImpact:r,impact:o})=>{const i=x_e({previousImpact:r,impact:o,droppables:n}),s=Mo(o);if(!s)return i;const a=n[s];if($h(e,a)||a.subject.withPlaceholder)return i;const c=FU(a,e,t);return bT(i,c)},xm=({state:e,clientSelection:t,dimensions:n,viewport:r,impact:o,scrollJumpRequest:i})=>{const s=r||e.viewport,a=n||e.dimensions,c=t||e.current.client.selection,u=ko(c,e.initial.client.selection),f={offset:u,selection:c,borderBoxCenter:fr(e.initial.client.borderBoxCenter,u)},p={selection:fr(f.selection,s.scroll.current),borderBoxCenter:fr(f.borderBoxCenter,s.scroll.current),offset:fr(f.offset,s.scroll.diff.value)},g={client:f,page:p};if(e.phase==="COLLECTING")return{...e,dimensions:a,viewport:s,current:g};const y=a.draggables[e.critical.draggable.id],v=o||UU({pageOffset:p.offset,draggable:y,draggables:a.draggables,droppables:a.droppables,previousImpact:e.impact,viewport:s,afterCritical:e.afterCritical}),x=w_e({draggable:y,impact:v,previousImpact:e.impact,draggables:a.draggables,droppables:a.droppables});return{...e,current:g,dimensions:{draggables:a.draggables,droppables:x},impact:v,viewport:s,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function S_e(e,t){return e.map(n=>t[n])}var HU=({impact:e,viewport:t,draggables:n,destination:r,forceShouldAnimate:o})=>{const i=e.displaced,s=S_e(i.all,n),a=cg({afterDragging:s,destination:r,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:i});return{...e,displaced:a}},qU=({impact:e,draggable:t,droppable:n,draggables:r,viewport:o,afterCritical:i})=>{const s=e1({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i});return yT({pageBorderBoxCenter:s,draggable:t,viewport:o})},WU=({state:e,dimensions:t,viewport:n})=>{e.movementMode!=="SNAP"&&De();const r=e.impact,o=n||e.viewport,i=t||e.dimensions,{draggables:s,droppables:a}=i,c=s[e.critical.draggable.id],u=Mo(r);u||De();const f=a[u],p=HU({impact:r,viewport:o,destination:f,draggables:s}),g=qU({impact:p,draggable:c,droppable:f,draggables:s,viewport:o,afterCritical:e.afterCritical});return xm({impact:p,clientSelection:g,state:e,dimensions:i,viewport:o})},E_e=e=>({index:e.index,droppableId:e.droppableId}),GU=({draggable:e,home:t,draggables:n,viewport:r})=>{const o=ay(t.axis,e.displaceBy),i=Th(t.descriptor.id,n),s=i.indexOf(e);s===-1&&De();const a=i.slice(s+1),c=a.reduce((g,y)=>(g[y.descriptor.id]=!0,g),{}),u={inVirtualList:t.descriptor.mode==="virtual",displacedBy:o,effected:c};return{impact:{displaced:cg({afterDragging:a,destination:t,displacedBy:o,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:E_e(e.descriptor)}},afterCritical:u}},N_e=(e,t)=>({draggables:e.draggables,droppables:bT(e.droppables,t)}),__e=({draggable:e,offset:t,initialWindowScroll:n})=>{const r=Hv(e.client,t),o=qv(r,n);return{...e,placeholder:{...e.placeholder,client:r},client:r,page:o}},C_e=e=>{const t=e.frame;return t||De(),t},O_e=({additions:e,updatedDroppables:t,viewport:n})=>{const r=n.scroll.diff.value;return e.map(o=>{const i=o.descriptor.droppableId,s=t[i],c=C_e(s).scroll.diff.value,u=fr(r,c);return __e({draggable:o,offset:u,initialWindowScroll:n.scroll.initial})})},j_e=({state:e,published:t})=>{const n=t.modified.map(E=>{const C=e.dimensions.droppables[E.droppableId];return fT(C,E.scroll)}),r={...e.dimensions.droppables,...AU(n)},o=TU(O_e({additions:t.additions,updatedDroppables:r,viewport:e.viewport})),i={...e.dimensions.draggables,...o};t.removals.forEach(E=>{delete i[E]});const s={droppables:r,draggables:i},a=Mo(e.impact),c=a?s.droppables[a]:null,u=s.draggables[e.critical.draggable.id],f=s.droppables[e.critical.droppable.id],{impact:p,afterCritical:g}=GU({draggable:u,home:f,draggables:i,viewport:e.viewport}),y=c&&c.isCombineEnabled?e.impact:p,v=UU({pageOffset:e.current.page.offset,draggable:s.draggables[e.critical.draggable.id],draggables:s.draggables,droppables:s.droppables,previousImpact:y,viewport:e.viewport,afterCritical:g}),x={...e,phase:"DRAGGING",impact:v,onLiftImpact:p,dimensions:s,afterCritical:g,forceShouldAnimate:!1};return e.phase==="COLLECTING"?x:{...x,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const NC=e=>e.movementMode==="SNAP",pN=(e,t,n)=>{const r=N_e(e.dimensions,t);return!NC(e)||n?xm({state:e,dimensions:r}):WU({state:e,dimensions:r})};function mN(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const zP={phase:"IDLE",completed:null,shouldFlush:!1};var A_e=(e=zP,t)=>{if(t.type==="FLUSH")return{...zP,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&De();const{critical:n,clientSelection:r,viewport:o,dimensions:i,movementMode:s}=t.payload,a=i.draggables[n.draggable.id],c=i.droppables[n.droppable.id],u={selection:r,borderBoxCenter:a.client.borderBox.center,offset:sr},f={client:u,page:{selection:fr(u.selection,o.scroll.initial),borderBoxCenter:fr(u.selection,o.scroll.initial),offset:fr(u.selection,o.scroll.diff.value)}},p=Xw(i.droppables).every(x=>!x.isFixedOnPage),{impact:g,afterCritical:y}=GU({draggable:a,home:c,draggables:i.draggables,viewport:o});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:s,dimensions:i,initial:f,current:f,isWindowScrollAllowed:p,impact:g,afterCritical:y,onLiftImpact:g,viewport:o,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&De(),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||De(),j_e({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;tu(e)||De();const{client:n}=t.payload;return ec(n,e.current.client.selection)?e:xm({state:e,clientSelection:n,impact:NC(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return mN(e);tu(e)||De();const{id:n,newScroll:r}=t.payload,o=e.dimensions.droppables[n];if(!o)return e;const i=fT(o,r);return pN(e,i,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;tu(e)||De();const{id:n,isEnabled:r}=t.payload,o=e.dimensions.droppables[n];o||De(),o.isEnabled===r&&De();const i={...o,isEnabled:r};return pN(e,i,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;tu(e)||De();const{id:n,isCombineEnabled:r}=t.payload,o=e.dimensions.droppables[n];o||De(),o.isCombineEnabled===r&&De();const i={...o,isCombineEnabled:r};return pN(e,i,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;tu(e)||De(),e.isWindowScrollAllowed||De();const n=t.payload.newScroll;if(ec(e.viewport.scroll.current,n))return mN(e);const r=DU(e.viewport,n);return NC(e)?WU({state:e,viewport:r}):xm({state:e,viewport:r})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!tu(e))return e;const n=t.payload.maxScroll;if(ec(n,e.viewport.scroll.max))return e;const r={...e.viewport,scroll:{...e.viewport.scroll,max:n}};return{...e,viewport:r}}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"&&De();const n=d_e({state:e,type:t.type});return n?xm({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"&&De(),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(t.type==="DROP_ANIMATE"){const{completed:n,dropDuration:r,newHomeClientOffset:o}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||De(),{phase:"DROP_ANIMATING",completed:n,dropDuration:r,newHomeClientOffset:o,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:n}=t.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return e};function Bt(e,t){return e instanceof Object&&"type"in e&&e.type===t}const T_e=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),$_e=e=>({type:"LIFT",payload:e}),R_e=e=>({type:"INITIAL_PUBLISH",payload:e}),k_e=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),M_e=()=>({type:"COLLECTION_STARTING",payload:null}),P_e=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),D_e=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),I_e=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),JU=e=>({type:"MOVE",payload:e}),L_e=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),F_e=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),z_e=()=>({type:"MOVE_UP",payload:null}),B_e=()=>({type:"MOVE_DOWN",payload:null}),V_e=()=>({type:"MOVE_RIGHT",payload:null}),U_e=()=>({type:"MOVE_LEFT",payload:null}),vT=()=>({type:"FLUSH",payload:null}),H_e=e=>({type:"DROP_ANIMATE",payload:e}),xT=e=>({type:"DROP_COMPLETE",payload:e}),YU=e=>({type:"DROP",payload:e}),q_e=e=>({type:"DROP_PENDING",payload:e}),KU=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});var W_e=e=>({getState:t,dispatch:n})=>r=>o=>{if(!Bt(o,"LIFT")){r(o);return}const{id:i,clientSelection:s,movementMode:a}=o.payload,c=t();c.phase==="DROP_ANIMATING"&&n(xT({completed:c.completed})),t().phase!=="IDLE"&&De(),n(vT()),n(T_e({draggableId:i,movementMode:a}));const f={draggableId:i,scrollOptions:{shouldPublishImmediately:a==="SNAP"}},{critical:p,dimensions:g,viewport:y}=e.startPublishing(f);n(R_e({critical:p,dimensions:g,clientSelection:s,movementMode:a,viewport:y}))},G_e=e=>()=>t=>n=>{Bt(n,"INITIAL_PUBLISH")&&e.dragging(),Bt(n,"DROP_ANIMATE")&&e.dropping(n.payload.completed.result.reason),(Bt(n,"FLUSH")||Bt(n,"DROP_COMPLETE"))&&e.resting(),t(n)};const wT={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},ug={opacity:{drop:0,combining:.7},scale:{drop:.75}},XU={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Kc=`${XU.outOfTheWay}s ${wT.outOfTheWay}`,wm={fluid:`opacity ${Kc}`,snap:`transform ${Kc}, opacity ${Kc}`,drop:e=>{const t=`${e}s ${wT.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Kc}`,placeholder:`height ${Kc}, width ${Kc}, margin ${Kc}`},BP=e=>ec(e,sr)?void 0:`translate(${e.x}px, ${e.y}px)`,_C={moveTo:BP,drop:(e,t)=>{const n=BP(e);if(n)return t?`${n} scale(${ug.scale.drop})`:n}},{minDropTime:CC,maxDropTime:QU}=XU,J_e=QU-CC,VP=1500,Y_e=.6;var K_e=({current:e,destination:t,reason:n})=>{const r=ag(e,t);if(r<=0)return CC;if(r>=VP)return QU;const o=r/VP,i=CC+J_e*o,s=n==="CANCEL"?i*Y_e:i;return Number(s.toFixed(2))},X_e=({impact:e,draggable:t,dimensions:n,viewport:r,afterCritical:o})=>{const{draggables:i,droppables:s}=n,a=Mo(e),c=a?s[a]:null,u=s[t.descriptor.droppableId],f=qU({impact:e,draggable:t,draggables:i,afterCritical:o,droppable:c||u,viewport:r});return ko(f,t.client.borderBox.center)},Q_e=({draggables:e,reason:t,lastImpact:n,home:r,viewport:o,onLiftImpact:i})=>!n.at||t!=="DROP"?{impact:HU({draggables:e,impact:i,destination:r,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:lg},didDropInsideDroppable:!0};const Z_e=({getState:e,dispatch:t})=>n=>r=>{if(!Bt(r,"DROP")){n(r);return}const o=e(),i=r.payload.reason;if(o.phase==="COLLECTING"){t(q_e({reason:i}));return}if(o.phase==="IDLE")return;o.phase==="DROP_PENDING"&&o.isWaiting&&De(),o.phase==="DRAGGING"||o.phase==="DROP_PENDING"||De();const a=o.critical,c=o.dimensions,u=c.draggables[o.critical.draggable.id],{impact:f,didDropInsideDroppable:p}=Q_e({reason:i,lastImpact:o.impact,afterCritical:o.afterCritical,onLiftImpact:o.onLiftImpact,home:o.dimensions.droppables[o.critical.droppable.id],viewport:o.viewport,draggables:o.dimensions.draggables}),g=p?hT(f):null,y=p?Qw(f):null,v={index:a.draggable.index,droppableId:a.droppable.id},x={draggableId:u.descriptor.id,type:u.descriptor.type,source:v,reason:i,mode:o.movementMode,destination:g,combine:y},S=X_e({impact:f,draggable:u,dimensions:c,viewport:o.viewport,afterCritical:o.afterCritical}),E={critical:o.critical,afterCritical:o.afterCritical,result:x,impact:f};if(!(!ec(o.current.client.offset,S)||!!x.combine)){t(xT({completed:E}));return}const _=K_e({current:o.current.client.offset,destination:S,reason:i});t(H_e({newHomeClientOffset:S,dropDuration:_,completed:E}))};var ZU=()=>({x:window.pageXOffset,y:window.pageYOffset});function eCe(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function tCe({onWindowScroll:e}){function t(){e(ZU())}const n=sg(t),r=eCe(n);let o=Zl;function i(){return o!==Zl}function s(){i()&&De(),o=li(window,[r])}function a(){i()||De(),n.cancel(),o(),o=Zl}return{start:s,stop:a,isActive:i}}const nCe=e=>Bt(e,"DROP_COMPLETE")||Bt(e,"DROP_ANIMATE")||Bt(e,"FLUSH"),rCe=e=>{const t=tCe({onWindowScroll:n=>{e.dispatch(L_e({newScroll:n}))}});return n=>r=>{!t.isActive()&&Bt(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&nCe(r)&&t.stop(),n(r)}};var oCe=e=>{let t=!1,n=!1;const r=setTimeout(()=>{n=!0}),o=i=>{t||n||(t=!0,e(i),clearTimeout(r))};return o.wasCalled=()=>t,o},iCe=()=>{const e=[],t=o=>{const i=e.findIndex(a=>a.timerId===o);i===-1&&De();const[s]=e.splice(i,1);s.callback()};return{add:o=>{const i=setTimeout(()=>t(i)),s={timerId:i,callback:o};e.push(s)},flush:()=>{if(!e.length)return;const o=[...e];e.length=0,o.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}};const sCe=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,aCe=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,lCe=(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,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r},Hp=(e,t)=>{t()},cb=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function gN(e,t,n,r){if(!e){n(r(t));return}const o=oCe(n);e(t,{announce:o}),o.wasCalled()||n(r(t))}var cCe=(e,t)=>{const n=iCe();let r=null;const o=(p,g)=>{r&&De(),Hp("onBeforeCapture",()=>{const y=e().onBeforeCapture;y&&y({draggableId:p,mode:g})})},i=(p,g)=>{r&&De(),Hp("onBeforeDragStart",()=>{const y=e().onBeforeDragStart;y&&y(cb(p,g))})},s=(p,g)=>{r&&De();const y=cb(p,g);r={mode:g,lastCritical:p,lastLocation:y.source,lastCombine:null},n.add(()=>{Hp("onDragStart",()=>gN(e().onDragStart,y,t,Vb.onDragStart))})},a=(p,g)=>{const y=hT(g),v=Qw(g);r||De();const x=!lCe(p,r.lastCritical);x&&(r.lastCritical=p);const S=!sCe(r.lastLocation,y);S&&(r.lastLocation=y);const E=!aCe(r.lastCombine,v);if(E&&(r.lastCombine=v),!x&&!S&&!E)return;const C={...cb(p,r.mode),combine:v,destination:y};n.add(()=>{Hp("onDragUpdate",()=>gN(e().onDragUpdate,C,t,Vb.onDragUpdate))})},c=()=>{r||De(),n.flush()},u=p=>{r||De(),r=null,Hp("onDragEnd",()=>gN(e().onDragEnd,p,t,Vb.onDragEnd))};return{beforeCapture:o,beforeStart:i,start:s,update:a,flush:c,drop:u,abort:()=>{if(!r)return;const p={...cb(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};u(p)}}},uCe=(e,t)=>{const n=cCe(e,t);return r=>o=>i=>{if(Bt(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(Bt(i,"INITIAL_PUBLISH")){const a=i.payload.critical;n.beforeStart(a,i.payload.movementMode),o(i),n.start(a,i.payload.movementMode);return}if(Bt(i,"DROP_COMPLETE")){const a=i.payload.completed.result;n.flush(),o(i),n.drop(a);return}if(o(i),Bt(i,"FLUSH")){n.abort();return}const s=r.getState();s.phase==="DRAGGING"&&n.update(s.critical,s.impact)}};const dCe=e=>t=>n=>{if(!Bt(n,"DROP_ANIMATION_FINISHED")){t(n);return}const r=e.getState();r.phase!=="DROP_ANIMATING"&&De(),e.dispatch(xT({completed:r.completed}))},fCe=e=>{let t=null,n=null;function r(){n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)}return o=>i=>{if((Bt(i,"FLUSH")||Bt(i,"DROP_COMPLETE")||Bt(i,"DROP_ANIMATION_FINISHED"))&&r(),o(i),!Bt(i,"DROP_ANIMATE"))return;const s={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(KU())}};n=requestAnimationFrame(()=>{n=null,t=li(window,[s])})}};var hCe=e=>()=>t=>n=>{(Bt(n,"DROP_COMPLETE")||Bt(n,"FLUSH")||Bt(n,"DROP_ANIMATE"))&&e.stopPublishing(),t(n)},pCe=e=>{let t=!1;return()=>n=>r=>{if(Bt(r,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(r.payload.critical.draggable.id),n(r),e.tryRestoreFocusRecorded();return}if(n(r),!!t){if(Bt(r,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(Bt(r,"DROP_COMPLETE")){t=!1;const o=r.payload.completed.result;o.combine&&e.tryShiftRecord(o.draggableId,o.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const mCe=e=>Bt(e,"DROP_COMPLETE")||Bt(e,"DROP_ANIMATE")||Bt(e,"FLUSH");var gCe=e=>t=>n=>r=>{if(mCe(r)){e.stop(),n(r);return}if(Bt(r,"INITIAL_PUBLISH")){n(r);const o=t.getState();o.phase!=="DRAGGING"&&De(),e.start(o);return}n(r),e.scroll(t.getState())};const yCe=e=>t=>n=>{if(t(n),!Bt(n,"PUBLISH_WHILE_DRAGGING"))return;const r=e.getState();r.phase==="DROP_PENDING"&&(r.isWaiting||e.dispatch(YU({reason:r.reason})))},bCe=mU;var vCe=({dimensionMarshal:e,focusMarshal:t,styleMarshal:n,getResponders:r,announce:o,autoScroller:i})=>pU(A_e,bCe(g2e(G_e(n),hCe(e),W_e(e),Z_e,dCe,fCe,yCe,gCe(i),rCe,pCe(t),uCe(r,o))));const yN=()=>({additions:{},removals:{},modified:{}});function xCe({registry:e,callbacks:t}){let n=yN(),r=null;const o=()=>{r||(t.collectionStarting(),r=requestAnimationFrame(()=>{r=null;const{additions:c,removals:u,modified:f}=n,p=Object.keys(c).map(v=>e.draggable.getById(v).getDimension(sr)).sort((v,x)=>v.descriptor.index-x.descriptor.index),g=Object.keys(f).map(v=>{const S=e.droppable.getById(v).callbacks.getScrollWhileDragging();return{droppableId:v,scroll:S}}),y={additions:p,removals:Object.keys(u),modified:g};n=yN(),t.publish(y)}))};return{add:c=>{const u=c.descriptor.id;n.additions[u]=c,n.modified[c.descriptor.droppableId]=!0,n.removals[u]&&delete n.removals[u],o()},remove:c=>{const u=c.descriptor;n.removals[u.id]=!0,n.modified[u.droppableId]=!0,n.additions[u.id]&&delete n.additions[u.id],o()},stop:()=>{r&&(cancelAnimationFrame(r),r=null,n=yN())}}}var eH=({scrollHeight:e,scrollWidth:t,height:n,width:r})=>{const o=ko({x:t,y:e},{x:r,y:n});return{x:Math.max(0,o.x),y:Math.max(0,o.y)}},tH=()=>{const e=document.documentElement;return e||De(),e},nH=()=>{const e=tH();return eH({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},wCe=()=>{const e=ZU(),t=nH(),n=e.y,r=e.x,o=tH(),i=o.clientWidth,s=o.clientHeight,a=r+i,c=n+s;return{frame:Hi({top:n,left:r,right:a,bottom:c}),scroll:{initial:e,current:e,max:t,diff:{value:sr,displacement:sr}}}},SCe=({critical:e,scrollOptions:t,registry:n})=>{const r=wCe(),o=r.scroll.current,i=e.droppable,s=n.droppable.getAllByType(i.type).map(f=>f.callbacks.getDimensionAndWatchScroll(o,t)),a=n.draggable.getAllByType(e.draggable.type).map(f=>f.getDimension(o));return{dimensions:{draggables:TU(a),droppables:AU(s)},critical:e,viewport:r}};function UP(e,t,n){return!(n.descriptor.id===t.id||n.descriptor.type!==t.type||e.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual")}var ECe=(e,t)=>{let n=null;const r=xCe({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),o=(g,y)=>{e.droppable.exists(g)||De(),n&&t.updateDroppableIsEnabled({id:g,isEnabled:y})},i=(g,y)=>{n&&(e.droppable.exists(g)||De(),t.updateDroppableIsCombineEnabled({id:g,isCombineEnabled:y}))},s=(g,y)=>{n&&(e.droppable.exists(g)||De(),t.updateDroppableScroll({id:g,newScroll:y}))},a=(g,y)=>{n&&e.droppable.getById(g).callbacks.scroll(y)},c=()=>{if(!n)return;r.stop();const g=n.critical.droppable;e.droppable.getAllByType(g.type).forEach(y=>y.callbacks.dragStopped()),n.unsubscribe(),n=null},u=g=>{n||De();const y=n.critical.draggable;g.type==="ADDITION"&&UP(e,y,g.value)&&r.add(g.value),g.type==="REMOVAL"&&UP(e,y,g.value)&&r.remove(g.value)};return{updateDroppableIsEnabled:o,updateDroppableIsCombineEnabled:i,scrollDroppable:a,updateDroppableScroll:s,startPublishing:g=>{n&&De();const y=e.draggable.getById(g.draggableId),v=e.droppable.getById(y.descriptor.droppableId),x={draggable:y.descriptor,droppable:v.descriptor},S=e.subscribe(u);return n={critical:x,unsubscribe:S},SCe({critical:x,registry:e,scrollOptions:g.scrollOptions})},stopPublishing:c}},rH=(e,t)=>e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP",NCe=e=>{window.scrollBy(e.x,e.y)};const _Ce=or(e=>Xw(e).filter(t=>!(!t.isEnabled||!t.frame))),CCe=(e,t)=>_Ce(t).find(r=>(r.frame||De(),zU(r.frame.pageMarginBox)(e)))||null;var OCe=({center:e,destination:t,droppables:n})=>{if(t){const o=n[t];return o.frame?o:null}return CCe(e,n)};const dg={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>e**2,durationDampening:{stopDampeningAt:1200,accelerateAt:360},disabled:!1};var jCe=(e,t,n=()=>dg)=>{const r=n(),o=e[t.size]*r.startFromPercentage,i=e[t.size]*r.maxScrollAtPercentage;return{startScrollingFrom:o,maxScrollValueAt:i}},oH=({startOfRange:e,endOfRange:t,current:n})=>{const r=t-e;return r===0?0:(n-e)/r},ST=1,ACe=(e,t,n=()=>dg)=>{const r=n();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return r.maxPixelScroll;if(e===t.startScrollingFrom)return ST;const i=1-oH({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),s=r.maxPixelScroll*r.ease(i);return Math.ceil(s)},TCe=(e,t,n)=>{const r=n(),o=r.durationDampening.accelerateAt,i=r.durationDampening.stopDampeningAt,s=t,a=i,u=Date.now()-s;if(u>=i)return e;if(u<o)return ST;const f=oH({startOfRange:o,endOfRange:a,current:u}),p=e*r.ease(f);return Math.ceil(p)},HP=({distanceToEdge:e,thresholds:t,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:o})=>{const i=ACe(e,t,o);return i===0?0:r?Math.max(TCe(i,n,o),ST):i},qP=({container:e,distanceToEdges:t,dragStartTime:n,axis:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const s=jCe(e,r,i);return t[r.end]<t[r.start]?HP({distanceToEdge:t[r.end],thresholds:s,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i}):-1*HP({distanceToEdge:t[r.start],thresholds:s,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i})},$Ce=({container:e,subject:t,proposedScroll:n})=>{const r=t.height>e.height,o=t.width>e.width;return!o&&!r?n:o&&r?null:{x:o?0:n.x,y:r?0:n.y}};const RCe=jU(e=>e===0?0:e);var iH=({dragStartTime:e,container:t,subject:n,center:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const s={top:r.y-t.top,right:t.right-r.x,bottom:t.bottom-r.y,left:r.x-t.left},a=qP({container:t,distanceToEdges:s,dragStartTime:e,axis:pT,shouldUseTimeDampening:o,getAutoScrollerOptions:i}),c=qP({container:t,distanceToEdges:s,dragStartTime:e,axis:kU,shouldUseTimeDampening:o,getAutoScrollerOptions:i}),u=RCe({x:c,y:a});if(ec(u,sr))return null;const f=$Ce({container:t,subject:n,proposedScroll:u});return f?ec(f,sr)?null:f:null};const kCe=jU(e=>e===0?0:e>0?1:-1),ET=(()=>{const e=(t,n)=>t<0?t:t>n?t-n:0;return({current:t,max:n,change:r})=>{const o=fr(t,r),i={x:e(o.x,n.x),y:e(o.y,n.y)};return ec(i,sr)?null:i}})(),sH=({max:e,current:t,change:n})=>{const r={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},o=kCe(n),i=ET({max:r,current:t,change:o});return!i||o.x!==0&&i.x===0||o.y!==0&&i.y===0},NT=(e,t)=>sH({current:e.scroll.current,max:e.scroll.max,change:t}),MCe=(e,t)=>{if(!NT(e,t))return null;const n=e.scroll.max,r=e.scroll.current;return ET({current:r,max:n,change:t})},_T=(e,t)=>{const n=e.frame;return n?sH({current:n.scroll.current,max:n.scroll.max,change:t}):!1},PCe=(e,t)=>{const n=e.frame;return!n||!_T(e,t)?null:ET({current:n.scroll.current,max:n.scroll.max,change:t})};var DCe=({viewport:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const s=iH({dragStartTime:r,container:e.frame,subject:t,center:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i});return s&&NT(e,s)?s:null},ICe=({droppable:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const s=e.frame;if(!s)return null;const a=iH({dragStartTime:r,container:s.pageMarginBox,subject:t,center:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i});return a&&_T(e,a)?a:null},WP=({state:e,dragStartTime:t,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:o,getAutoScrollerOptions:i})=>{const s=e.current.page.borderBoxCenter,c=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const p=e.viewport,g=DCe({dragStartTime:t,viewport:p,subject:c,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(g){r(g);return}}const u=OCe({center:s,destination:Mo(e.impact),droppables:e.dimensions.droppables});if(!u)return;const f=ICe({dragStartTime:t,droppable:u,subject:c,center:s,shouldUseTimeDampening:n,getAutoScrollerOptions:i});f&&o(u.descriptor.id,f)},LCe=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:n=()=>dg})=>{const r=sg(e),o=sg(t);let i=null;const s=u=>{i||De();const{shouldUseTimeDampening:f,dragStartTime:p}=i;WP({state:u,scrollWindow:r,scrollDroppable:o,dragStartTime:p,shouldUseTimeDampening:f,getAutoScrollerOptions:n})};return{start:u=>{i&&De();const f=Date.now();let p=!1;const g=()=>{p=!0};WP({state:u,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:g,scrollDroppable:g,getAutoScrollerOptions:n}),i={dragStartTime:f,shouldUseTimeDampening:p},p&&s(u)},stop:()=>{i&&(r.cancel(),o.cancel(),i=null)},scroll:s}},FCe=({move:e,scrollDroppable:t,scrollWindow:n})=>{const r=(a,c)=>{const u=fr(a.current.client.selection,c);e({client:u})},o=(a,c)=>{if(!_T(a,c))return c;const u=PCe(a,c);if(!u)return t(a.descriptor.id,c),null;const f=ko(c,u);return t(a.descriptor.id,f),ko(c,f)},i=(a,c,u)=>{if(!a||!NT(c,u))return u;const f=MCe(c,u);if(!f)return n(u),null;const p=ko(u,f);return n(p),ko(u,p)};return a=>{const c=a.scrollJumpRequest;if(!c)return;const u=Mo(a.impact);u||De();const f=o(a.dimensions.droppables[u],c);if(!f)return;const p=a.viewport,g=i(a.isWindowScrollAllowed,p,f);g&&r(a,g)}},zCe=({scrollDroppable:e,scrollWindow:t,move:n,getAutoScrollerOptions:r})=>{const o=LCe({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:r}),i=FCe({move:n,scrollWindow:t,scrollDroppable:e});return{scroll:c=>{if(!(r().disabled||c.phase!=="DRAGGING")){if(c.movementMode==="FLUID"){o.scroll(c);return}c.scrollJumpRequest&&i(c)}},start:o.start,stop:o.stop}};const Hf="data-rfd",qf=(()=>{const e=`${Hf}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),OC=(()=>{const e=`${Hf}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),BCe=(()=>{const e=`${Hf}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),GP={contextId:`${Hf}-scroll-container-context-id`},VCe=e=>t=>`[${t}="${e}"]`,qp=(e,t)=>e.map(n=>{const r=n.styles[t];return r?`${n.selector} { ${r} }`:""}).join(" "),UCe="pointer-events: none;";var HCe=e=>{const t=VCe(e),n=(()=>{const a=`
cursor: -webkit-grab;
cursor: grab;
`;return{selector:t(qf.contextId),styles:{always:`
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
touch-action: manipulation;
`,resting:a,dragging:UCe,dropAnimating:a}}})(),r=(()=>{const a=`
transition: ${wm.outOfTheWay};
`;return{selector:t(OC.contextId),styles:{dragging:a,dropAnimating:a,userCancel:a}}})(),o={selector:t(BCe.contextId),styles:{always:"overflow-anchor: none;"}},s=[r,n,o,{selector:"body",styles:{dragging:`
cursor: grabbing;
cursor: -webkit-grabbing;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-anchor: none;
`}}];return{always:qp(s,"always"),resting:qp(s,"resting"),dragging:qp(s,"dragging"),dropAnimating:qp(s,"dropAnimating"),userCancel:qp(s,"userCancel")}};const Po=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,bN=()=>{const e=document.querySelector("head");return e||De(),e},JP=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function qCe(e,t){const n=_t(()=>HCe(e),[e]),r=w.useRef(null),o=w.useRef(null),i=Ze(or(p=>{const g=o.current;g||De(),g.textContent=p}),[]),s=Ze(p=>{const g=r.current;g||De(),g.textContent=p},[]);Po(()=>{!r.current&&!o.current||De();const p=JP(t),g=JP(t);return r.current=p,o.current=g,p.setAttribute(`${Hf}-always`,e),g.setAttribute(`${Hf}-dynamic`,e),bN().appendChild(p),bN().appendChild(g),s(n.always),i(n.resting),()=>{const y=v=>{const x=v.current;x||De(),bN().removeChild(x),v.current=null};y(r),y(o)}},[t,s,i,n.always,n.resting,e]);const a=Ze(()=>i(n.dragging),[i,n.dragging]),c=Ze(p=>{if(p==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),u=Ze(()=>{o.current&&i(n.resting)},[i,n.resting]);return _t(()=>({dragging:a,dropping:c,resting:u}),[a,c,u])}function aH(e,t){return Array.from(e.querySelectorAll(t))}var lH=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function t1(e){return e instanceof lH(e).HTMLElement}function WCe(e,t){const n=`[${qf.contextId}="${e}"]`,r=aH(document,n);if(!r.length)return null;const o=r.find(i=>i.getAttribute(qf.draggableId)===t);return!o||!t1(o)?null:o}function GCe(e){const t=w.useRef({}),n=w.useRef(null),r=w.useRef(null),o=w.useRef(!1),i=Ze(function(g,y){const v={id:g,focus:y};return t.current[g]=v,function(){const S=t.current;S[g]!==v&&delete S[g]}},[]),s=Ze(function(g){const y=WCe(e,g);y&&y!==document.activeElement&&y.focus()},[e]),a=Ze(function(g,y){n.current===g&&(n.current=y)},[]),c=Ze(function(){r.current||o.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const g=n.current;g&&s(g)}))},[s]),u=Ze(function(g){n.current=null;const y=document.activeElement;y&&y.getAttribute(qf.draggableId)===g&&(n.current=g)},[]);return Po(()=>(o.current=!0,function(){o.current=!1;const g=r.current;g&&cancelAnimationFrame(g)}),[]),_t(()=>({register:i,tryRecordFocus:u,tryRestoreFocusRecorded:c,tryShiftRecord:a}),[i,u,c,a])}function JCe(){const e={draggables:{},droppables:{}},t=[];function n(p){return t.push(p),function(){const y=t.indexOf(p);y!==-1&&t.splice(y,1)}}function r(p){t.length&&t.forEach(g=>g(p))}function o(p){return e.draggables[p]||null}function i(p){const g=o(p);return g||De(),g}const s={register:p=>{e.draggables[p.descriptor.id]=p,r({type:"ADDITION",value:p})},update:(p,g)=>{const y=e.draggables[g.descriptor.id];y&&y.uniqueId===p.uniqueId&&(delete e.draggables[g.descriptor.id],e.draggables[p.descriptor.id]=p)},unregister:p=>{const g=p.descriptor.id,y=o(g);y&&p.uniqueId===y.uniqueId&&(delete e.draggables[g],e.droppables[p.descriptor.droppableId]&&r({type:"REMOVAL",value:p}))},getById:i,findById:o,exists:p=>!!o(p),getAllByType:p=>Object.values(e.draggables).filter(g=>g.descriptor.type===p)};function a(p){return e.droppables[p]||null}function c(p){const g=a(p);return g||De(),g}const u={register:p=>{e.droppables[p.descriptor.id]=p},unregister:p=>{const g=a(p.descriptor.id);g&&p.uniqueId===g.uniqueId&&delete e.droppables[p.descriptor.id]},getById:c,findById:a,exists:p=>!!a(p),getAllByType:p=>Object.values(e.droppables).filter(g=>g.descriptor.type===p)};function f(){e.draggables={},e.droppables={},t.length=0}return{draggable:s,droppable:u,subscribe:n,clean:f}}function YCe(){const e=_t(JCe,[]);return w.useEffect(()=>function(){e.clean()},[e]),e}var CT=Ne.createContext(null),Yv=()=>{const e=document.body;return e||De(),e};const KCe={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},XCe=e=>`rfd-announcement-${e}`;function QCe(e){const t=_t(()=>XCe(e),[e]),n=w.useRef(null);return w.useEffect(function(){const i=document.createElement("div");return n.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),Tf(i.style,KCe),Yv().appendChild(i),function(){setTimeout(function(){const c=Yv();c.contains(i)&&c.removeChild(i),i===n.current&&(n.current=null)})}},[t]),Ze(o=>{const i=n.current;if(i){i.textContent=o;return}},[])}const ZCe={separator:"::"};function OT(e,t=ZCe){const n=Ne.useId();return _t(()=>`${e}${t.separator}${n}`,[t.separator,e,n])}function eOe({contextId:e,uniqueId:t}){return`rfd-hidden-text-${e}-${t}`}function tOe({contextId:e,text:t}){const n=OT("hidden-text",{separator:"-"}),r=_t(()=>eOe({contextId:e,uniqueId:n}),[n,e]);return w.useEffect(function(){const i=document.createElement("div");return i.id=r,i.textContent=t,i.style.display="none",Yv().appendChild(i),function(){const a=Yv();a.contains(i)&&a.removeChild(i)}},[r,t]),r}var n1=Ne.createContext(null);function cH(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),t}function nOe(){let e=null;function t(){return!!e}function n(s){return s===e}function r(s){e&&De();const a={abandon:s};return e=a,a}function o(){e||De(),e=null}function i(){e&&(e.abandon(),o())}return{isClaimed:t,isActive:n,claim:r,release:o,tryAbandon:i}}function fg(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const rOe=9,oOe=13,jT=27,uH=32,iOe=33,sOe=34,aOe=35,lOe=36,cOe=37,uOe=38,dOe=39,fOe=40,hOe={[oOe]:!0,[rOe]:!0};var dH=e=>{hOe[e.keyCode]&&e.preventDefault()};const r1=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(r=>`on${r}`in document)||e})(),fH=0,YP=5;function pOe(e,t){return Math.abs(t.x-e.x)>=YP||Math.abs(t.y-e.y)>=YP}const KP={type:"IDLE"};function mOe({cancel:e,completed:t,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:o=>{const{button:i,clientX:s,clientY:a}=o;if(i!==fH)return;const c={x:s,y:a},u=n();if(u.type==="DRAGGING"){o.preventDefault(),u.actions.move(c);return}u.type!=="PENDING"&&De();const f=u.point;if(!pOe(f,c))return;o.preventDefault();const p=u.actions.fluidLift(c);r({type:"DRAGGING",actions:p})}},{eventName:"mouseup",fn:o=>{const i=n();if(i.type!=="DRAGGING"){e();return}o.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:o=>{n().type==="DRAGGING"&&o.preventDefault(),e()}},{eventName:"keydown",fn:o=>{if(n().type==="PENDING"){e();return}if(o.keyCode===jT){o.preventDefault(),e();return}dH(o)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:o=>{const i=n();if(i.type==="IDLE"&&De(),i.actions.shouldRespectForcePress()){e();return}o.preventDefault()}},{eventName:r1,fn:e}]}function gOe(e){const t=w.useRef(KP),n=w.useRef(Zl),r=_t(()=>({eventName:"mousedown",fn:function(p){if(p.defaultPrevented||p.button!==fH||p.ctrlKey||p.metaKey||p.shiftKey||p.altKey)return;const g=e.findClosestDraggableId(p);if(!g)return;const y=e.tryGetLock(g,s,{sourceEvent:p});if(!y)return;p.preventDefault();const v={x:p.clientX,y:p.clientY};n.current(),u(y,v)}}),[e]),o=_t(()=>({eventName:"webkitmouseforcewillbegin",fn:f=>{if(f.defaultPrevented)return;const p=e.findClosestDraggableId(f);if(!p)return;const g=e.findOptionsForDraggable(p);g&&(g.shouldRespectForcePress||e.canGetLock(p)&&f.preventDefault())}}),[e]),i=Ze(function(){const p={passive:!1,capture:!0};n.current=li(window,[o,r],p)},[o,r]),s=Ze(()=>{t.current.type!=="IDLE"&&(t.current=KP,n.current(),i())},[i]),a=Ze(()=>{const f=t.current;s(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[s]),c=Ze(function(){const p={capture:!0,passive:!1},g=mOe({cancel:a,completed:s,getPhase:()=>t.current,setPhase:y=>{t.current=y}});n.current=li(window,g,p)},[a,s]),u=Ze(function(p,g){t.current.type!=="IDLE"&&De(),t.current={type:"PENDING",point:g,actions:p},c()},[c]);Po(function(){return i(),function(){n.current()}},[i])}function yOe(){}const bOe={[sOe]:!0,[iOe]:!0,[lOe]:!0,[aOe]:!0};function vOe(e,t){function n(){t(),e.cancel()}function r(){t(),e.drop()}return[{eventName:"keydown",fn:o=>{if(o.keyCode===jT){o.preventDefault(),n();return}if(o.keyCode===uH){o.preventDefault(),r();return}if(o.keyCode===fOe){o.preventDefault(),e.moveDown();return}if(o.keyCode===uOe){o.preventDefault(),e.moveUp();return}if(o.keyCode===dOe){o.preventDefault(),e.moveRight();return}if(o.keyCode===cOe){o.preventDefault(),e.moveLeft();return}if(bOe[o.keyCode]){o.preventDefault();return}dH(o)}},{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:r1,fn:n}]}function xOe(e){const t=w.useRef(yOe),n=_t(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==uH)return;const s=e.findClosestDraggableId(i);if(!s)return;const a=e.tryGetLock(s,f,{sourceEvent:i});if(!a)return;i.preventDefault();let c=!0;const u=a.snapLift();t.current();function f(){c||De(),c=!1,t.current(),r()}t.current=li(window,vOe(u,f),{capture:!0,passive:!1})}}),[e]),r=Ze(function(){const i={passive:!1,capture:!0};t.current=li(window,[n],i)},[n]);Po(function(){return r(),function(){t.current()}},[r])}const vN={type:"IDLE"},wOe=120,SOe=.15;function EOe({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===jT&&n.preventDefault(),e()}},{eventName:r1,fn:e}]}function NOe({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}o.hasMoved=!0;const{clientX:i,clientY:s}=r.touches[0],a={x:i,y:s};r.preventDefault(),o.actions.move(a)}},{eventName:"touchend",fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}r.preventDefault(),o.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){e();return}r.preventDefault(),e()}},{eventName:"touchforcechange",fn:r=>{const o=n();o.type==="IDLE"&&De();const i=r.touches[0];if(!i||!(i.force>=SOe))return;const a=o.actions.shouldRespectForcePress();if(o.type==="PENDING"){a&&e();return}if(a){if(o.hasMoved){r.preventDefault();return}e();return}r.preventDefault()}},{eventName:r1,fn:e}]}function _Oe(e){const t=w.useRef(vN),n=w.useRef(Zl),r=Ze(function(){return t.current},[]),o=Ze(function(y){t.current=y},[]),i=_t(()=>({eventName:"touchstart",fn:function(y){if(y.defaultPrevented)return;const v=e.findClosestDraggableId(y);if(!v)return;const x=e.tryGetLock(v,a,{sourceEvent:y});if(!x)return;const S=y.touches[0],{clientX:E,clientY:C}=S,_={x:E,y:C};n.current(),p(x,_)}}),[e]),s=Ze(function(){const y={capture:!0,passive:!1};n.current=li(window,[i],y)},[i]),a=Ze(()=>{const g=t.current;g.type!=="IDLE"&&(g.type==="PENDING"&&clearTimeout(g.longPressTimerId),o(vN),n.current(),s())},[s,o]),c=Ze(()=>{const g=t.current;a(),g.type==="DRAGGING"&&g.actions.cancel({shouldBlockNextClick:!0}),g.type==="PENDING"&&g.actions.abort()},[a]),u=Ze(function(){const y={capture:!0,passive:!1},v={cancel:c,completed:a,getPhase:r},x=li(window,NOe(v),y),S=li(window,EOe(v),y);n.current=function(){x(),S()}},[c,r,a]),f=Ze(function(){const y=r();y.type!=="PENDING"&&De();const v=y.actions.fluidLift(y.point);o({type:"DRAGGING",actions:v,hasMoved:!1})},[r,o]),p=Ze(function(y,v){r().type!=="IDLE"&&De();const x=setTimeout(f,wOe);o({type:"PENDING",point:v,actions:y,longPressTimerId:x}),u()},[u,r,o,f]);Po(function(){return s(),function(){n.current();const v=r();v.type==="PENDING"&&(clearTimeout(v.longPressTimerId),o(vN))}},[r,s,o]),Po(function(){return li(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}const COe=["input","button","textarea","select","option","optgroup","video","audio"];function hH(e,t){if(t==null)return!1;if(COe.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return r==="true"||r===""?!0:t===e?!1:hH(e,t.parentElement)}function OOe(e,t){const n=t.target;return t1(n)?hH(e,n):!1}var jOe=e=>Hi(e.getBoundingClientRect()).center;function AOe(e){return e instanceof lH(e).Element}const TOe=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||e})();function pH(e,t){return e==null?null:e[TOe](t)?e:pH(e.parentElement,t)}function $Oe(e,t){return e.closest?e.closest(t):pH(e,t)}function ROe(e){return`[${qf.contextId}="${e}"]`}function kOe(e,t){const n=t.target;if(!AOe(n))return null;const r=ROe(e),o=$Oe(n,r);return!o||!t1(o)?null:o}function MOe(e,t){const n=kOe(e,t);return n?n.getAttribute(qf.draggableId):null}function POe(e,t){const n=`[${OC.contextId}="${e}"]`,o=aH(document,n).find(i=>i.getAttribute(OC.id)===t);return!o||!t1(o)?null:o}function DOe(e){e.preventDefault()}function ub({expected:e,phase:t,isLockActive:n,shouldWarn:r}){return!(!n()||e!==t)}function mH({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const o=n.draggable.findById(r);return!(!o||!o.options.isEnabled||!rH(t.getState(),r))}function IOe({lockAPI:e,contextId:t,store:n,registry:r,draggableId:o,forceSensorStop:i,sourceEvent:s}){if(!mH({lockAPI:e,store:n,registry:r,draggableId:o}))return null;const c=r.draggable.getById(o),u=POe(t,c.descriptor.id);if(!u||s&&!c.options.canDragInteractiveElements&&OOe(u,s))return null;const f=e.claim(i||Zl);let p="PRE_DRAG";function g(){return c.options.shouldRespectForcePress}function y(){return e.isActive(f)}function v(A,T){ub({expected:A,phase:p,isLockActive:y,shouldWarn:!0})&&n.dispatch(T())}const x=v.bind(null,"DRAGGING");function S(A){function T(){e.release(),p="COMPLETED"}p!=="PRE_DRAG"&&(T(),De()),n.dispatch($_e(A.liftActionArgs)),p="DRAGGING";function k(R,V={shouldBlockNextClick:!1}){if(A.cleanup(),V.shouldBlockNextClick){const H=li(window,[{eventName:"click",fn:DOe,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(H)}T(),n.dispatch(YU({reason:R}))}return{isActive:()=>ub({expected:"DRAGGING",phase:p,isLockActive:y,shouldWarn:!1}),shouldRespectForcePress:g,drop:R=>k("DROP",R),cancel:R=>k("CANCEL",R),...A.actions}}function E(A){const T=sg(R=>{x(()=>JU({client:R}))});return{...S({liftActionArgs:{id:o,clientSelection:A,movementMode:"FLUID"},cleanup:()=>T.cancel(),actions:{move:T}}),move:T}}function C(){const A={moveUp:()=>x(z_e),moveRight:()=>x(V_e),moveDown:()=>x(B_e),moveLeft:()=>x(U_e)};return S({liftActionArgs:{id:o,clientSelection:jOe(u),movementMode:"SNAP"},cleanup:Zl,actions:A})}function _(){ub({expected:"PRE_DRAG",phase:p,isLockActive:y,shouldWarn:!0})&&e.release()}return{isActive:()=>ub({expected:"PRE_DRAG",phase:p,isLockActive:y,shouldWarn:!1}),shouldRespectForcePress:g,fluidLift:E,snapLift:C,abort:_}}const LOe=[gOe,xOe,_Oe];function FOe({contextId:e,store:t,registry:n,customSensors:r,enableDefaultSensors:o}){const i=[...o?LOe:[],...r||[]],s=w.useState(()=>nOe())[0],a=Ze(function(S,E){fg(S)&&!fg(E)&&s.tryAbandon()},[s]);Po(function(){let S=t.getState();return t.subscribe(()=>{const C=t.getState();a(S,C),S=C})},[s,t,a]),Po(()=>s.tryAbandon,[s.tryAbandon]);const c=Ze(x=>mH({lockAPI:s,registry:n,store:t,draggableId:x}),[s,n,t]),u=Ze((x,S,E)=>IOe({lockAPI:s,registry:n,contextId:e,store:t,draggableId:x,forceSensorStop:S||null,sourceEvent:E&&E.sourceEvent?E.sourceEvent:null}),[e,s,n,t]),f=Ze(x=>MOe(e,x),[e]),p=Ze(x=>{const S=n.draggable.findById(x);return S?S.options:null},[n.draggable]),g=Ze(function(){s.isClaimed()&&(s.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(vT()))},[s,t]),y=Ze(()=>s.isClaimed(),[s]),v=_t(()=>({canGetLock:c,tryGetLock:u,findClosestDraggableId:f,findOptionsForDraggable:p,tryReleaseLock:g,isLockClaimed:y}),[c,u,f,p,g,y]);for(let x=0;x<i.length;x++)i[x](v)}const zOe=e=>({onBeforeCapture:t=>{const n=()=>{e.onBeforeCapture&&e.onBeforeCapture(t)};Tg.flushSync(n)},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),BOe=e=>({...dg,...e.autoScrollerOptions,durationDampening:{...dg.durationDampening,...e.autoScrollerOptions}});function Wp(e){return e.current||De(),e.current}function VOe(e){const{contextId:t,setCallbacks:n,sensors:r,nonce:o,dragHandleUsageInstructions:i}=e,s=w.useRef(null),a=cH(e),c=Ze(()=>zOe(a.current),[a]),u=Ze(()=>BOe(a.current),[a]),f=QCe(t),p=tOe({contextId:t,text:i}),g=qCe(t,o),y=Ze(H=>{Wp(s).dispatch(H)},[]),v=_t(()=>SP({publishWhileDragging:k_e,updateDroppableScroll:P_e,updateDroppableIsEnabled:D_e,updateDroppableIsCombineEnabled:I_e,collectionStarting:M_e},y),[y]),x=YCe(),S=_t(()=>ECe(x,v),[x,v]),E=_t(()=>zCe({scrollWindow:NCe,scrollDroppable:S.scrollDroppable,getAutoScrollerOptions:u,...SP({move:JU},y)}),[S.scrollDroppable,y,u]),C=GCe(t),_=_t(()=>vCe({announce:f,autoScroller:E,dimensionMarshal:S,focusMarshal:C,getResponders:c,styleMarshal:g}),[f,E,S,C,c,g]);s.current=_;const j=Ze(()=>{const H=Wp(s);H.getState().phase!=="IDLE"&&H.dispatch(vT())},[]),A=Ze(()=>{const H=Wp(s).getState();return H.phase==="DROP_ANIMATING"?!0:H.phase==="IDLE"?!1:H.isDragging},[]),T=_t(()=>({isDragging:A,tryAbort:j}),[A,j]);n(T);const k=Ze(H=>rH(Wp(s).getState(),H),[]),R=Ze(()=>tu(Wp(s).getState()),[]),V=_t(()=>({marshal:S,focus:C,contextId:t,canLift:k,isMovementAllowed:R,dragHandleUsageInstructionsId:p,registry:x}),[t,S,p,C,k,R,x]);return FOe({contextId:t,store:_,registry:x,customSensors:r||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),w.useEffect(()=>j,[j]),Ne.createElement(n1.Provider,{value:V},Ne.createElement(hNe,{context:CT,store:_},e.children))}function UOe(){return Ne.useId()}function HOe(e){const t=UOe(),n=e.dragHandleUsageInstructions||Vb.dragHandleUsageInstructions;return Ne.createElement(xNe,null,r=>Ne.createElement(VOe,{nonce:e.nonce,contextId:t,setCallbacks:r,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 XP={dragging:5e3,dropAnimating:4500},qOe=(e,t)=>t?wm.drop(t.duration):e?wm.snap:wm.fluid,WOe=(e,t)=>{if(e)return t?ug.opacity.drop:ug.opacity.combining},GOe=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function JOe(e){const n=e.dimension.client,{offset:r,combineWith:o,dropping:i}=e,s=!!o,a=GOe(e),c=!!i,u=c?_C.drop(r,s):_C.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:qOe(a,i),transform:u,opacity:WOe(s,c),zIndex:c?XP.dropAnimating:XP.dragging,pointerEvents:"none"}}function YOe(e){return{transform:_C.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function KOe(e){return e.type==="DRAGGING"?JOe(e):YOe(e)}function XOe(e,t,n=sr){const r=window.getComputedStyle(t),o=t.getBoundingClientRect(),i=SU(o,r),s=qv(i,n),a={client:i,tagName:t.tagName.toLowerCase(),display:r.display},c={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:e,placeholder:a,displaceBy:c,client:i,page:s}}function QOe(e){const t=OT("draggable"),{descriptor:n,registry:r,getDraggableRef:o,canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}=e,c=_t(()=>({canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:a}),[i,a,s]),u=Ze(y=>{const v=o();return v||De(),XOe(n,v,y)},[n,o]),f=_t(()=>({uniqueId:t,descriptor:n,options:c,getDimension:u}),[n,u,c,t]),p=w.useRef(f),g=w.useRef(!0);Po(()=>(r.draggable.register(p.current),()=>r.draggable.unregister(p.current)),[r.draggable]),Po(()=>{if(g.current){g.current=!1;return}const y=p.current;p.current=f,r.draggable.update(f,y)},[f,r.draggable])}var AT=Ne.createContext(null);function Kv(e){const t=w.useContext(e);return t||De(),t}function ZOe(e){e.preventDefault()}const eje=e=>{const t=w.useRef(null),n=Ze((T=null)=>{t.current=T},[]),r=Ze(()=>t.current,[]),{contextId:o,dragHandleUsageInstructionsId:i,registry:s}=Kv(n1),{type:a,droppableId:c}=Kv(AT),u=_t(()=>({id:e.draggableId,index:e.index,type:a,droppableId:c}),[e.draggableId,e.index,a,c]),{children:f,draggableId:p,isEnabled:g,shouldRespectForcePress:y,canDragInteractiveElements:v,isClone:x,mapped:S,dropAnimationFinished:E}=e;if(!x){const T=_t(()=>({descriptor:u,registry:s,getDraggableRef:r,canDragInteractiveElements:v,shouldRespectForcePress:y,isEnabled:g}),[u,s,r,v,y,g]);QOe(T)}const C=_t(()=>g?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":p,"data-rfd-drag-handle-context-id":o,draggable:!1,onDragStart:ZOe}:null,[o,i,p,g]),_=Ze(T=>{S.type==="DRAGGING"&&S.dropping&&T.propertyName==="transform"&&Tg.flushSync(E)},[E,S]),j=_t(()=>{const T=KOe(S),k=S.type==="DRAGGING"&&S.dropping?_:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":o,"data-rfd-draggable-id":p,style:T,onTransitionEnd:k},dragHandleProps:C}},[o,C,p,S,_,n]),A=_t(()=>({draggableId:u.id,type:u.type,source:{index:u.index,droppableId:u.droppableId}}),[u.droppableId,u.id,u.index,u.type]);return Ne.createElement(Ne.Fragment,null,f(j,S.snapshot,A))};var gH=(e,t)=>e===t,yH=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const tje=e=>e.combine?e.combine.draggableId:null,nje=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function rje(){const e=or((o,i)=>({x:o,y:i})),t=or((o,i,s=null,a=null,c=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!c,dropAnimation:c,mode:o,draggingOver:s,combineWith:a,combineTargetFor:null})),n=or((o,i,s,a,c=null,u=null,f=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:c,combineWith:u,mode:i,offset:o,dimension:s,forceShouldAnimate:f,snapshot:t(i,a,c,u,null)}}));return(o,i)=>{if(fg(o)){if(o.critical.draggable.id!==i.draggableId)return null;const s=o.current.client.offset,a=o.dimensions.draggables[i.draggableId],c=Mo(o.impact),u=nje(o.impact),f=o.forceShouldAnimate;return n(e(s.x,s.y),o.movementMode,a,i.isClone,c,u,f)}if(o.phase==="DROP_ANIMATING"){const s=o.completed;if(s.result.draggableId!==i.draggableId)return null;const a=i.isClone,c=o.dimensions.draggables[i.draggableId],u=s.result,f=u.mode,p=yH(u),g=tje(u),v={duration:o.dropDuration,curve:wT.drop,moveTo:o.newHomeClientOffset,opacity:g?ug.opacity.drop:null,scale:g?ug.scale.drop:null};return{mapped:{type:"DRAGGING",offset:o.newHomeClientOffset,dimension:c,dropping:v,draggingOver:p,combineWith:g,mode:f,forceShouldAnimate:null,snapshot:t(f,a,p,g,v)}}}return null}}function bH(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const oje={mapped:{type:"SECONDARY",offset:sr,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:bH(null)}};function ije(){const e=or((s,a)=>({x:s,y:a})),t=or(bH),n=or((s,a=null,c)=>({mapped:{type:"SECONDARY",offset:s,combineTargetFor:a,shouldAnimateDisplacement:c,snapshot:t(a)}})),r=s=>s?n(sr,s,!0):null,o=(s,a,c,u)=>{const f=c.displaced.visible[s],p=!!(u.inVirtualList&&u.effected[s]),g=Qw(c),y=g&&g.draggableId===s?a:null;if(!f){if(!p)return r(y);if(c.displaced.invisible[s])return null;const S=Ah(u.displacedBy.point),E=e(S.x,S.y);return n(E,y,!0)}if(p)return r(y);const v=c.displacedBy.point,x=e(v.x,v.y);return n(x,y,f.shouldAnimate)};return(s,a)=>{if(fg(s))return s.critical.draggable.id===a.draggableId?null:o(a.draggableId,s.critical.draggable.id,s.impact,s.afterCritical);if(s.phase==="DROP_ANIMATING"){const c=s.completed;return c.result.draggableId===a.draggableId?null:o(a.draggableId,c.result.draggableId,c.impact,c.afterCritical)}return null}}const sje=()=>{const e=rje(),t=ije();return(r,o)=>e(r,o)||t(r,o)||oje},aje={dropAnimationFinished:KU},lje=wU(sje,aje,null,{context:CT,areStatePropsEqual:gH})(eje);function vH(e){return Kv(AT).isUsingCloneFor===e.draggableId&&!e.isClone?null:Ne.createElement(lje,e)}function cje(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,r=!!e.shouldRespectForcePress;return Ne.createElement(vH,Tf({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const xH=e=>t=>e===t,uje=xH("scroll"),dje=xH("auto"),QP=(e,t)=>t(e.overflowX)||t(e.overflowY),fje=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return QP(n,uje)||QP(n,dje)},hje=()=>!1,wH=e=>e==null?null:e===document.body?hje()?e:null:e===document.documentElement?null:fje(e)?e:wH(e.parentElement);var jC=e=>({x:e.scrollLeft,y:e.scrollTop});const SH=e=>e?window.getComputedStyle(e).position==="fixed"?!0:SH(e.parentElement):!1;var pje=e=>{const t=wH(e),n=SH(e);return{closestScrollable:t,isFixedOnPage:n}},mje=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:r,direction:o,client:i,page:s,closest:a})=>{const c=(()=>{if(!a)return null;const{scrollSize:g,client:y}=a,v=eH({scrollHeight:g.scrollHeight,scrollWidth:g.scrollWidth,height:y.paddingBox.height,width:y.paddingBox.width});return{pageMarginBox:a.page.marginBox,frameClient:y,scrollSize:g,shouldClipSubject:a.shouldClipSubject,scroll:{initial:a.scroll,current:a.scroll,max:v,diff:{value:sr,displacement:sr}}}})(),u=o==="vertical"?pT:kU,f=Uf({page:s,withPlaceholder:null,axis:u,frame:c});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:r,axis:u,isEnabled:t,client:i,page:s,frame:c,subject:f}};const gje=(e,t)=>{const n=EU(e);if(!t||e!==t)return n;const r=n.paddingBox.top-t.scrollTop,o=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,s=o+t.scrollWidth,c=uT({top:r,right:s,bottom:i,left:o},n.border);return dT({borderBox:c,margin:n.margin,border:n.border,padding:n.padding})};var yje=({ref:e,descriptor:t,env:n,windowScroll:r,direction:o,isDropDisabled:i,isCombineEnabled:s,shouldClipSubject:a})=>{const c=n.closestScrollable,u=gje(e,c),f=qv(u,r),p=(()=>{if(!c)return null;const y=EU(c),v={scrollHeight:c.scrollHeight,scrollWidth:c.scrollWidth};return{client:y,page:qv(y,r),scroll:jC(c),scrollSize:v,shouldClipSubject:a}})();return mje({descriptor:t,isEnabled:!i,isCombineEnabled:s,isFixedOnPage:n.isFixedOnPage,direction:o,client:u,page:f,closest:p})};const bje={passive:!1},vje={passive:!0};var ZP=e=>e.shouldPublishImmediately?bje:vje;const db=e=>e&&e.env.closestScrollable||null;function xje(e){const t=w.useRef(null),n=Kv(n1),r=OT("droppable"),{registry:o,marshal:i}=n,s=cH(e),a=_t(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),c=w.useRef(a),u=_t(()=>or((j,A)=>{t.current||De();const T={x:j,y:A};i.updateDroppableScroll(a.id,T)}),[a.id,i]),f=Ze(()=>{const j=t.current;return!j||!j.env.closestScrollable?sr:jC(j.env.closestScrollable)},[]),p=Ze(()=>{const j=f();u(j.x,j.y)},[f,u]),g=_t(()=>sg(p),[p]),y=Ze(()=>{const j=t.current,A=db(j);if(j&&A||De(),j.scrollOptions.shouldPublishImmediately){p();return}g()},[g,p]),v=Ze((j,A)=>{t.current&&De();const T=s.current,k=T.getDroppableRef();k||De();const R=pje(k),V={ref:k,descriptor:a,env:R,scrollOptions:A};t.current=V;const H=yje({ref:k,descriptor:a,env:R,windowScroll:j,direction:T.direction,isDropDisabled:T.isDropDisabled,isCombineEnabled:T.isCombineEnabled,shouldClipSubject:!T.ignoreContainerClipping}),F=R.closestScrollable;return F&&(F.setAttribute(GP.contextId,n.contextId),F.addEventListener("scroll",y,ZP(V.scrollOptions))),H},[n.contextId,a,y,s]),x=Ze(()=>{const j=t.current,A=db(j);return j&&A||De(),jC(A)},[]),S=Ze(()=>{const j=t.current;j||De();const A=db(j);t.current=null,A&&(g.cancel(),A.removeAttribute(GP.contextId),A.removeEventListener("scroll",y,ZP(j.scrollOptions)))},[y,g]),E=Ze(j=>{const A=t.current;A||De();const T=db(A);T||De(),T.scrollTop+=j.y,T.scrollLeft+=j.x},[]),C=_t(()=>({getDimensionAndWatchScroll:v,getScrollWhileDragging:x,dragStopped:S,scroll:E}),[S,v,x,E]),_=_t(()=>({uniqueId:r,descriptor:a,callbacks:C}),[C,a,r]);Po(()=>(c.current=_.descriptor,o.droppable.register(_),()=>{t.current&&S(),o.droppable.unregister(_)}),[C,a,S,_,i,o.droppable]),Po(()=>{t.current&&i.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),Po(()=>{t.current&&i.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function xN(){}const eD={width:0,height:0,margin:ONe},wje=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?eD:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},Sje=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const r=wje({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?wm.placeholder:null}},Eje=e=>{const t=w.useRef(null),n=Ze(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:r,onTransitionEnd:o,onClose:i,contextId:s}=e,[a,c]=w.useState(e.animate==="open");w.useEffect(()=>a?r!=="open"?(n(),c(!1),xN):t.current?xN:(t.current=setTimeout(()=>{t.current=null,c(!1)}),n):xN,[r,a,n]);const u=Ze(p=>{p.propertyName==="height"&&(o(),r==="close"&&i())},[r,i,o]),f=Sje({isAnimatingOpenOnMount:a,animate:e.animate,placeholder:e.placeholder});return Ne.createElement(e.placeholder.tagName,{style:f,"data-rfd-placeholder-context-id":s,onTransitionEnd:u,ref:e.innerRef})};var Nje=Ne.memo(Eje);class _je extends Ne.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 Cje=e=>{const t=w.useContext(n1);t||De();const{contextId:n,isMovementAllowed:r}=t,o=w.useRef(null),i=w.useRef(null),{children:s,droppableId:a,type:c,mode:u,direction:f,ignoreContainerClipping:p,isDropDisabled:g,isCombineEnabled:y,snapshot:v,useClone:x,updateViewportMaxScroll:S,getContainerForClone:E}=e,C=Ze(()=>o.current,[]),_=Ze((F=null)=>{o.current=F},[]);Ze(()=>i.current,[]);const j=Ze((F=null)=>{i.current=F},[]),A=Ze(()=>{r()&&S({maxScroll:nH()})},[r,S]);xje({droppableId:a,type:c,mode:u,direction:f,isDropDisabled:g,isCombineEnabled:y,ignoreContainerClipping:p,getDroppableRef:C});const T=_t(()=>Ne.createElement(_je,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:F,data:B,animate:U})=>Ne.createElement(Nje,{placeholder:B,onClose:F,innerRef:j,animate:U,contextId:n,onTransitionEnd:A})),[n,A,e.placeholder,e.shouldAnimatePlaceholder,j]),k=_t(()=>({innerRef:_,placeholder:T,droppableProps:{"data-rfd-droppable-id":a,"data-rfd-droppable-context-id":n}}),[n,a,T,_]),R=x?x.dragging.draggableId:null,V=_t(()=>({droppableId:a,type:c,isUsingCloneFor:R}),[a,R,c]);function H(){if(!x)return null;const{dragging:F,render:B}=x,U=Ne.createElement(vH,{draggableId:F.draggableId,index:F.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(M,z)=>B(M,z,F));return sf.createPortal(U,E())}return Ne.createElement(AT.Provider,{value:V},s(k,v),H())};function Oje(){return document.body||De(),document.body}const tD={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:Oje},EH=e=>{let t={...e},n;for(n in tD)e[n]===void 0&&(t={...t,[n]:tD[n]});return t},wN=(e,t)=>e===t.droppable.type,nD=(e,t)=>t.draggables[e.draggable.id],jje=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=or(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=or((i,s,a,c,u,f)=>{const p=u.descriptor.id;if(u.descriptor.droppableId===i){const v=f?{render:f,dragging:n(u.descriptor)}:null,x={isDraggingOver:a,draggingOverWith:a?p:null,draggingFromThisWith:p,isUsingPlaceholder:!0};return{placeholder:u.placeholder,shouldAnimatePlaceholder:!1,snapshot:x,useClone:v}}if(!s)return t;if(!c)return e;const y={isDraggingOver:a,draggingOverWith:p,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:u.placeholder,shouldAnimatePlaceholder:!0,snapshot:y,useClone:null}});return(i,s)=>{const a=EH(s),c=a.droppableId,u=a.type,f=!a.isDropDisabled,p=a.renderClone;if(fg(i)){const g=i.critical;if(!wN(u,g))return t;const y=nD(g,i.dimensions),v=Mo(i.impact)===c;return r(c,f,v,v,y,p)}if(i.phase==="DROP_ANIMATING"){const g=i.completed;if(!wN(u,g.critical))return t;const y=nD(g.critical,i.dimensions);return r(c,f,yH(g.result)===c,Mo(g.impact)===c,y,p)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const g=i.completed;if(!wN(u,g.critical))return t;const y=Mo(g.impact)===c,v=!!(g.impact.at&&g.impact.at.type==="COMBINE"),x=g.critical.droppable.id===c;return y?v?e:t:x?e:t}return t}},Aje={updateViewportMaxScroll:F_e},Tje=wU(jje,Aje,(e,t,n)=>({...EH(n),...e,...t}),{context:CT,areStatePropsEqual:gH})(Cje);function $je({data:e=[],extractId:t,renderItem:n,dndProps:r={droppableId:"sortable-list",direction:"vertical"},onReordered:o,onChange:i,disableIndices:s=[],...a}){function c({destination:f,source:p}){if(s.includes(p.index)||s.includes(f.index))return;const g={from:p.index,to:f?.index||0};o?.(g.from,g.to)}const u=e.map((f,p)=>{const g=t?t(f):w.useId();return h.jsx(cje,{index:p,draggableId:g,isDragDisabled:s.includes(p),children:(y,v,x)=>n?n({...f,dnd:{provided:y,snapshot:v,rubic:x}},p):h.jsxs("div",{className:"flex flex-row gap-2 p-2 border border-gray-200 rounded-md mb-3 bg-white items-center",ref:y.innerRef,...y.draggableProps,children:[h.jsx("div",{...y.dragHandleProps,children:h.jsx(Hve,{className:"size-5",stroke:1.5})}),h.jsx("p",{children:JSON.stringify(f)})]})},g)});return h.jsx(HOe,{onDragEnd:c,children:h.jsx(Tje,{...r,children:f=>h.jsxs("div",{...a,...f.droppableProps,ref:f.innerRef,children:[u,f.placeholder]})})})}function o1({children:e,target:t,defaultOpen:n=!1,backdrop:r=!1,position:o="bottom-start",overlayProps:i,className:s}){const[a,c]=w.useState(n),u=jg(()=>c(!1)),f=It((g=50)=>setTimeout(()=>c(y=>!y),typeof g=="number"?g:0)),p={"bottom-start":"mt-1 top-[100%]","bottom-end":"right-0 top-[100%] mt-1","top-start":"bottom-[100%] mb-1","top-end":"bottom-[100%] right-0 mb-1"}[o];return h.jsxs(h.Fragment,{children:[a&&r&&h.jsx("div",{className:"animate-fade-in w-full h-full absolute top-0 bottom-0 right-0 left-0 bg-background/60"}),h.jsxs("div",{role:"dropdown",className:Be("relative flex",s),ref:u,children:[w.cloneElement(e,{onClick:f}),a&&h.jsx("div",{...i,className:Be("animate-fade-in absolute z-20 flex flex-col bg-background border border-muted px-1 py-1 rounded-lg shadow-lg backdrop-blur-sm min-w-full max-w-20",p,i?.className),children:t({toggle:f})})]})]})}const i1=[{type:"primary",label:"Primary",icon:tP,addable:!1,disabled:["name"],hidden:["virtual"]},{type:"text",label:"Text",icon:tP},{type:"number",label:"Number",icon:ISe},{type:"boolean",label:"Boolean",icon:FSe},{type:"date",label:"Date",icon:DV},{type:"enum",label:"Enum",icon:KA},{type:"json",label:"JSON",icon:rSe},{type:"jsonschema",label:"JSON Schema",icon:mSe},{type:"relation",label:"Relation",icon:YA,addable:!1,hidden:["virtual"]},{type:"media",label:"Media",icon:ny,addable:!1,hidden:["virtual"]}],rD=()=>{const[e,t]=w9([!1,!0]),n=e?K1e:LSe;return h.jsx("button",{role:"checkbox",type:"button",className:"flex px-3 py-3",onClick:()=>t(),children:h.jsx(n,{size:18})})};function s1({data:e=[],columns:t,checkable:n,onClickRow:r,onClickPage:o,onClickSort:i,total:s,sort:a,page:c=1,perPage:u=10,perPageOptions:f,onClickPerPage:p,classNames:g,renderHeader:y,rowActions:v,renderValue:x,onClickNew:S}){const E=!!s,C=Array.isArray(e)?e.slice(0,u):e;s=s||C?.length||0,c=c||1;const _=t&&t.length>0?t:Object.keys(C?.[0]||{}),j=Math.max(Math.ceil(s/u),1),A=E?j>c:(e?.length||0)>u,T=x||a1;return h.jsxs("div",{className:"flex flex-col gap-3",children:[S&&h.jsx("div",{className:"flex flex-row space-between",children:S&&h.jsx(Xe,{onClick:S,children:"Create new"})}),h.jsx("div",{className:"border-muted border rounded-md shadow-sm w-full max-w-full overflow-x-scroll overflow-y-hidden",children:h.jsxs("table",{className:"w-full text-md",children:[_.length>0?h.jsx("thead",{className:"sticky top-0 bg-muted/10",children:h.jsxs("tr",{children:[n&&h.jsx("th",{align:"center",className:"w-[40px]",children:h.jsx(rD,{})}),_.map((k,R)=>{const V=y?.(k)??Io(k);return h.jsx("th",{children:h.jsx("div",{className:"flex flex-row py-1 px-1 font-normal text-primary/55",children:h.jsxs("button",{type:"button",className:Be("py-1.5 rounded-md inline-flex flex-row justify-start items-center gap-1",i?"link hover:bg-primary/5 pl-2.5 pr-1":"px-2.5"),onClick:()=>i?.(k),children:[h.jsx("span",{className:"text-left text-nowrap whitespace-nowrap",children:V}),(i||a&&a.by===k)&&h.jsx(Rje,{sort:a,field:k})]})})},R)}),v&&v.length>0&&h.jsx("th",{className:"w-10"})]})}):null,h.jsx("tbody",{children:!C||!Array.isArray(C)||C.length===0?h.jsx("tr",{children:h.jsx("td",{colSpan:_.length+(n?1:0),children:h.jsx("div",{className:"flex flex-col gap-2 p-8 justify-center items-center border-t border-muted",children:h.jsx("i",{className:"opacity-50",children:Array.isArray(C)?"No data to show":C?h.jsx("pre",{children:JSON.stringify(C,null,2)}):"Loading..."})})})}):C.map((k,R)=>{const V=()=>r?.(k);return h.jsxs("tr",{"data-border":R>0,className:"hover:bg-primary/5 active:bg-muted border-muted data-[border]:border-t cursor-pointer transition-colors",children:[n&&h.jsx("td",{align:"center",children:h.jsx(rD,{})}),Object.entries(k).map(([H,F],B)=>h.jsx("td",{onClick:V,children:h.jsx("div",{className:"flex flex-row items-start py-3 px-3.5 font-normal ",children:h.jsx(T,{property:H,value:F})})},B)),v&&v.length>0&&h.jsx("td",{children:h.jsx("div",{className:"flex flex-row justify-end pr-2",children:h.jsxs(Lr,{position:"bottom-end",children:[h.jsx(Lr.Target,{children:h.jsx(ft,{Icon:ySe})}),h.jsx(Lr.Dropdown,{children:v.map(H=>h.jsx(Lr.Item,{onClick:()=>H.onClick(k,R),leftSection:H.icon&&h.jsx(H.icon,{}),children:H.label},H.label))})]})})})]},R)})})]})}),h.jsxs("div",{className:"flex flex-row items-center justify-between",children:[h.jsx("div",{className:"hidden md:flex text-primary/40",children:h.jsx(kje,{perPage:u,page:c,items:C?.length||0,total:E?s:void 0})}),h.jsxs("div",{className:"flex flex-row gap-2 md:gap-10 items-center",children:[f&&h.jsxs("div",{className:"hidden md:flex flex-row items-center gap-2 text-primary/40",children:["Per Page"," ",h.jsx(Nr,{items:f.map(k=>({label:String(k),perPage:k})),position:"top-end",onClickItem:k=>p?.(k.perPage),children:h.jsx(Xe,{children:u})})]}),h.jsxs("div",{className:"text-primary/40",children:["Page ",c,E?h.jsxs(h.Fragment,{children:[" of ",j]}):""]}),o&&h.jsx("div",{className:"flex flex-row gap-1.5",children:h.jsx(Mje,{current:c,total:E?j:c+(A?1:0),onClick:o,hasLast:E})})]})]})]})}const a1=({value:e,property:t})=>{let n=!1;return e!==null&&typeof e=="object"&&(e=JSON.stringify(e),n=!0),e!==null&&typeof e<"u"?h.jsx("span",{className:Be("line-clamp-2",n&&"font-mono break-all"),children:e}):h.jsx("span",{className:"opacity-10 font-mono",children:"null"})},Rje=({sort:e,field:t})=>!e||e.by!==t?h.jsx(KA,{size:18,className:"mt-[1px]"}):e.dir==="asc"?h.jsx(eSe,{size:18,className:"mt-[1px]"}):h.jsx(Q1e,{size:18,className:"mt-[1px]"}),kje=({perPage:e,page:t,items:n,total:r})=>{if(n===0&&t===1)return h.jsx(h.Fragment,{children:"No rows to show"});const o=Math.max(e*(t-1),1);return r?h.jsxs(h.Fragment,{children:["Showing ",o,"-",e*(t-1)+n," of ",r," rows"]}):h.jsxs(h.Fragment,{children:["Showing ",o,"-",e*(t-1)+n]})},Mje=({current:e,total:t,onClick:n,hasLast:r=!0})=>[{enabled:!0,value:1,Icon:dSe,disabled:e===1},{enabled:!0,value:e-1,Icon:lSe,disabled:e===1},{enabled:!0,value:e+1,Icon:cSe,disabled:e===t},{enabled:r,value:t,Icon:fSe,disabled:e===t}].map((i,s)=>i.enabled&&h.jsx("button",{role:"button",type:"button",disabled:i.disabled,className:"px-2 py-2 border-muted border rounded-md enabled:link text-lg enabled:hover:bg-primary/5 text-primary/90 disabled:opacity-50 cursor-pointer disabled:cursor-not-allowed",onClick:()=>{const a=i.value,c=a<1?1:a>t?t:a;n?.(c)},children:h.jsx(i.Icon,{})},s)),Pje=({path:e,backTo:t,onBack:n})=>{const[r,o]=Uo(),i=window.location.pathname,s=Array.isArray(e)?e:[e],a=i.split("/").filter(p=>p!==""),c=s.length>1,u=n||It(()=>{if(t){o(t,{replace:!0});return}const p=a.slice(0,s.length+1).join("/");o(`~/${p}`,{replace:!0})}),f=w.useMemo(()=>s.map((p,g)=>{const y=g===s.length-1,v=a.indexOf(p),x=a.slice(0,v+1).join("/"),S=Dg(p);return{last:y,href:x,string:S}}),[s,a]);return h.jsxs("div",{className:"flex flex-row flex-grow items-center gap-2 text-lg",children:[c&&h.jsx(ft,{onClick:u,Icon:JA,variant:"default",size:"lg",className:"mr-1"}),h.jsx("div",{className:"hidden md:flex gap-2",children:h.jsx(NH,{crumbs:f})}),h.jsx("div",{className:"flex md:hidden gap-2",children:h.jsx(Dje,{crumbs:f})})]})},NH=({crumbs:e})=>e.map((t,n)=>t.last?h.jsx(_H,{...t},n):h.jsx(CH,{...t},n)),Dje=({crumbs:e})=>{const[,t]=Uo();if(e.length<=2)return h.jsx(NH,{crumbs:e});const n=e[0],r=e[e.length-1],o=w.useMemo(()=>e.slice(1,-1).map(s=>({label:s.string,href:s.href})),[e]),i=It(s=>t(`~/${s.href}`));return h.jsxs(h.Fragment,{children:[h.jsx(CH,{...n}),h.jsx(Nr,{onClickItem:i,items:o,children:h.jsx(ft,{Icon:Ha,variant:"ghost"})}),h.jsx("span",{className:"opacity-25 dark:font-bold font-semibold",children:"/"}),h.jsx(_H,{...r})]})},_H=({string:e})=>h.jsx("span",{className:"text-nowrap dark:font-bold font-semibold",children:e}),CH=({href:e,string:t})=>h.jsxs("div",{className:"opacity-50 flex flex-row gap-2 dark:font-bold font-semibold",children:[h.jsx(Dw,{to:`~/${e}`,className:"text-nowrap",children:t}),h.jsx("span",{className:"opacity-50",children:"/"})]});function OH(e,t,n){if(!e.properties)return[{...e.toJSON()},t,{}];const r=JSON.parse(JSON.stringify(e)),o={...r,properties:mo(r.properties,n)};o.required&&(o.required=o.required.filter(a=>!n.includes(a)));const i={};for(const a of n)i[a]={config:t[a],schema:r.properties[a]};const s=mo(t,n);return[o,s,i]}const Ije=w.forwardRef((e,t)=>{const[n,r]=w.useState(!!(e.value??e.defaultValue));w.useEffect(()=>{console.log("value change",e.value),r(!!e.value)},[e.value]);function o(i){r(i.target.checked),e.onChange?.(i.target.checked)}return h.jsx("div",{className:"flex flex-row",children:h.jsx(vc,{ref:t,checked:n,onChange:o,disabled:e.disabled,id:e.id})})}),mi=({error:e,as:t,...n})=>{const r=t||"div";return h.jsx(r,{...n,"data-role":"group",className:Be("flex flex-col gap-1.5 w-full",t==="fieldset"&&"border border-primary/10 p-3 rounded-md",t==="fieldset"&&e&&"border-red-500",e&&"text-red-500",n.className)})},uc=({as:e,...t})=>{const n=e||"label";return h.jsx(n,{...t})},Lje=({className:e,...t})=>h.jsx("div",{...t,className:Be("text-sm text-primary/50",e)}),jH=({className:e,...t})=>h.jsx("div",{...t,className:Be("text-sm text-red-500",e)}),Rh=({field:e,label:t,...n})=>{const r=e.getDescription(),o=r?i=>h.jsx(ns,{position:"right",label:r,...i}):i=>h.jsx(w.Fragment,{...i});return h.jsx(o,{children:h.jsxs(uc,{...n,className:"flex flex-row gap-1 items-center self-start",children:[t??e.getLabel(),e.isRequired()&&h.jsx("span",{className:"font-medium opacity-30",children:"*"}),r&&h.jsx(VV,{className:"opacity-50"})]})})},qa=w.forwardRef((e,t)=>{const n=e.disabled||e.readOnly;return h.jsx("input",{type:"text",...e,ref:t,className:Be("bg-muted/40 h-11 rounded-md py-2.5 px-4 outline-none w-full disabled:cursor-not-allowed",n&&"bg-muted/50 text-primary/50",!n&&"focus:bg-muted focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-transparent transition-all",e.className)})}),Fje=w.forwardRef((e,t)=>e.type==="password"?h.jsx(AH,{...e,ref:t}):"data-type"in e&&e["data-type"]==="textarea"?h.jsx(TH,{...e,ref:t}):h.jsx(qa,{...e,ref:t})),AH=w.forwardRef((e,t)=>{const[n,r]=w.useState(!1);function o(){r(i=>!i)}return h.jsxs("div",{className:"relative w-full",children:[h.jsx(qa,{...e,type:n?"text":"password",className:"w-full",ref:t}),h.jsx("div",{className:"absolute right-3 top-0 bottom-0 flex items-center",children:h.jsx(ft,{Icon:n?vSe:zV,onClick:o,variant:"ghost",className:"opacity-70"})})]})}),TH=w.forwardRef((e,t)=>h.jsx("textarea",{rows:3,...e,ref:t,className:Be("bg-muted/40 min-h-11 rounded-md py-2.5 px-4 focus:bg-muted outline-none focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-transparent transition-all disabled:bg-muted/50 disabled:text-primary/50",e.className)})),AC=w.forwardRef((e,t)=>{const n=w.useRef(null),r=Qoe();w.useImperativeHandle(t,()=>n.current);const o=It(()=>{n?.current&&(n.current.focus(),["Safari"].includes(r)?n.current.click():n.current.showPicker())});return h.jsxs("div",{className:"relative w-full",children:[h.jsx("div",{className:"absolute h-full right-3 top-0 bottom-0 flex items-center",children:h.jsx(ft,{Icon:DV,onClick:o})}),h.jsx(qa,{...e,type:e.type??"date",ref:n,className:"w-full appearance-none"})]})});w.forwardRef((e,t)=>{const[n,r]=w.useState(!!e.value);w.useEffect(()=>{r(!!e.value)},[e.value]);function o(i){r(i.target.checked),e.onChange?.(i.target.checked)}return h.jsx("div",{className:"h-11 flex items-center",children:h.jsx("input",{...e,type:"checkbox",ref:t,className:"outline-none focus:outline-none focus:ring-2 focus:ring-zinc-500 transition-all disabled:opacity-70 scale-150 ml-1",checked:n,onChange:o,disabled:e.disabled})})});const oD={xs:{root:"h-5 w-8",thumb:"data-[state=checked]:left-[calc(100%-1rem)]"},sm:{root:"h-6 w-10",thumb:"data-[state=checked]:left-[calc(100%-1.25rem)]"},md:{root:"h-7 w-12",thumb:"data-[state=checked]:left-[calc(100%-1.5rem)]"}},$H=w.forwardRef(({type:e,required:t,...n},r)=>h.jsx(T1e,{className:pn("relative cursor-pointer rounded-full bg-muted border-2 border-transparent outline-none ring-1 dark:ring-primary/10 ring-primary/20 data-[state=checked]:ring-primary/60 data-[state=checked]:bg-primary/60 appearance-none transition-colors hover:bg-muted/80",oD[n.size??"md"].root,n.disabled&&"opacity-50 !cursor-not-allowed"),onCheckedChange:o=>{console.log("setting",o),n.onChange?.({target:{value:o}})},...n,checked:typeof n.checked<"u"?n.checked:typeof n.value<"u"?!!n.value:void 0,ref:r,children:h.jsx($1e,{className:pn("absolute top-0 left-0 h-full aspect-square rounded-full bg-primary/30 data-[state=checked]:bg-background transition-[left,right] duration-100 border border-muted",oD[n.size??"md"].thumb)})})),RH=w.forwardRef(({children:e,options:t,...n},r)=>h.jsxs("div",{className:"flex w-full relative",children:[h.jsx("select",{...n,ref:r,className:Be("bg-muted/40 focus:bg-muted rounded-md py-2.5 px-4 outline-none focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-transparent transition-all disabled:bg-muted/50 disabled:text-primary/50","appearance-none h-11 w-full",!n.multiple&&"border-r-8 border-r-transparent",n.className),children:t?h.jsxs(h.Fragment,{children:[!n.required&&h.jsx("option",{value:""}),t.map(o=>typeof o!="object"?{value:o,label:String(o)}:o).map(o=>h.jsx("option",{value:o.value,children:o.label},o.value))]}):e}),!n.multiple&&h.jsx(IV,{className:"absolute right-3 top-0 bottom-0 h-full opacity-70 pointer-events-none",size:18})]})),zje=(e,t)=>{switch(e){case"date":return AC;case"boolean":return Ije;case"textarea":return TH;default:return qa}};function kH({open:e=!1,children:t,onClose:n=()=>null,allowBackdropClose:r=!0,className:o,stickToTop:i}){const s=jg(()=>{r&&n()});return h.jsx(h.Fragment,{children:e&&h.jsx("div",{className:Be("w-full h-full fixed bottom-0 top-0 right-0 left-0 bg-background/60 flex justify-center backdrop-blur-sm z-10",i?"items-start":"items-center"),children:h.jsx("div",{className:Be("z-20 flex flex-col bg-background rounded-lg shadow-lg",o),ref:s,children:t})})})}const Bje=({schema:e,uiSchema:t={},anyOfValues:n,path:r,prefixPath:o,generateKey:i})=>{const[s,a]=Uo(),[c,u]=w.useState(e),[f,p]=w.useState(!1),{actions:g,readonly:y}=ot(),[v,{open:x,close:S}]=oh(!1),E=i!==void 0,C=typeof i=="string",[_,j]=w.useState(C?i:""),A=_x(!E),T=w.useRef(null),k="anyOf"in e;function R(B){i&&typeof i=="function"&&V({target:{value:i(B)}}),console.log("form change",B)}function V(B){const U=String(B.target.value);if(U.length>0&&!/^[a-zA-Z_][a-zA-Z0-9_ ]*$/.test(U)){console.log("no match",U);return}j(U.toLowerCase().replace(/ /g,"_").replace(/__+/g,"_"))}async function H(){if(T.current?.validateForm()){p(!0);const B=T.current?.formData(),[U,...M]=r,z=[...M,_].join(".");await g.add(U,z,B)?setTimeout(()=>{a(o+_,{replace:!0})},500):p(!1)}console.log("valid?",T.current?.validateForm()),console.log("data",_,T.current?.formData())}const F=k?e.anyOf.map(B=>{const U=B.title,M=n?.[U]?.label||U,z=n?.[U]?.icon;return{label:M,icon:z,onClick:()=>{u(B),x()}}}):[];return h.jsxs(h.Fragment,{children:[!y&&h.jsx("div",{className:"flex flex-row",children:k?h.jsx(Nr,{position:"top-start",items:F,itemsClassName:"gap-3",children:h.jsx(Xe,{children:"Add new"})}):h.jsx(Xe,{onClick:x,children:"Add new"})}),h.jsx(kH,{open:v,allowBackdropClose:!1,onClose:S,className:"min-w-96 w-6/12 mt-[30px] mb-[20px]",stickToTop:!0,children:h.jsxs("div",{className:"border border-muted rounded-lg flex flex-col overflow-y-scroll font-normal",style:{maxHeight:"calc(100dvh - 100px)"},children:[h.jsx("div",{className:"bg-muted py-2 px-4 text-primary/70 font-mono flex flex-row gap-2 items-center",children:[...r,_].join(".")}),h.jsxs("div",{className:"flex flex-row gap-10 sticky top-0 bg-background z-10 p-4 border-b border-muted",children:[h.jsxs("div",{className:"flex flex-row flex-grow items-center relative",children:[h.jsx(qa,{ref:A,className:"w-full",placeholder:"New unique key...",onChange:V,value:_,disabled:E}),E&&h.jsx("div",{className:"absolute h-full flex items-center z-10 right-3.5 top-0 bottom-0 font-mono font-sm opacity-50",children:"generated"})]}),h.jsxs("div",{className:"flex flex-row gap-2",children:[h.jsx(Xe,{onClick:S,disabled:f,children:"Cancel"}),h.jsx(Xe,{variant:"primary",onClick:H,disabled:f||_.length===0,children:"Create"})]})]}),h.jsx("div",{className:"flex flex-col p-4",children:h.jsx(jh,{ref:T,schema:Cv(c,["title"]),uiSchema:t,onChange:R,className:"legacy hide-required-mark fieldset-alternative mute-root"})})]})})]})},iD=w.forwardRef(({tabs:e,title:t},n)=>{const[r,{open:o,close:i}]=oh(!1),[s,a]=w.useState(0),c=e[s];return w.useImperativeHandle(n,()=>({open:o,close:i,isOpen:r})),c?h.jsx(kH,{open:r,onClose:i,className:"min-w-96 w-9/12 mt-[80px] mb-[20px]",stickToTop:!0,children:h.jsxs("div",{className:"border border-primary rounded-lg flex flex-col overflow-scroll font-normal",style:{maxHeight:"calc(100dvh - 100px)"},children:[t&&h.jsxs("div",{className:"bg-primary py-2 px-4 text-background font-mono flex flex-row gap-2 items-center",children:[h.jsx(VSe,{size:20,className:"opacity-50"}),t]}),h.jsxs("div",{className:"flex flex-row justify-between sticky top-0 bg-background z-10 py-4 px-5",children:[h.jsx("div",{className:"flex flex-row gap-3",children:e.map((u,f)=>h.jsx("button",{onClick:()=>a(f),"data-active":f===s?1:void 0,className:"font-mono data-[active]:font-bold",children:u.title},f))}),h.jsx(ft,{Icon:QA,onClick:i})]}),h.jsx("div",{className:"",children:h.jsx(Vr,{json:c.json,expand:6,showSize:!0,showCopy:!0})})]})}):null});function io({schema:e,uiSchema:t,config:n,prefix:r="/",options:o,path:i=[],properties:s}){const[a,c]=w.useState(!1),{actions:u,readonly:f}=ot(),p=w.useRef(null),g=w.useRef(null),y=w.useRef(null),[v,x]=w.useState(!1);bO([["mod+s",U=>(U.preventDefault(),F(),!1)],["e",()=>{v||H()}],["Escape",()=>{v&&H()}]]);const S=w.useMemo(()=>s?Object.entries(s).filter(([,U])=>U.hide||U.extract).map(([U])=>U):[],[s]),E=It(U=>{const M=window.location.href.split("/").slice(0,-1).join("/");U?window.location.replace(M):window.history.back()}),C=(o?.allowDelete?.(n)??!0)&&!f,_=(o?.allowEdit?.(n)??!0)&&!f,j=o?.showAlert?.(n)??void 0;console.log("--setting",{schema:e,config:n,prefix:r,path:i,exclude:S});const[A,T,k]=OH(e,n,S);console.log({reducedSchema:A,reducedConfig:T,extracted:k});const R=Object.keys(k),V=R.find(U=>window.location.pathname.endsWith(U))??R[0],H=It(()=>{_&&x(U=>!U)}),F=It(async()=>{if(!(!_||!v)&&p.current?.validateForm()){c(!0);const U=p.current?.formData(),[M,...z]=i;let $;console.log("save:data",{module:M,restOfPath:z},U),z.length>0?(console.log("-> patch",{module:M,path:z.join(".")},U),$=await u.patch(M,z.join("."),U)):(console.log("-> set",{module:M},U),$=await u.set(M,U,!0)),console.log("save:success",$),$?o?.reloadOnSave&&(await u.reload(),c(!1)):c(!1)}}),B=It(async()=>{if(!C)return;const[U,...M]=i;window.confirm(`Are you sure you want to delete ${i.join(".")}`)&&await u.remove(U,M.join("."))&&E(!0)});return n?h.jsxs(h.Fragment,{children:[h.jsx(An,{className:i.length>1?"pl-3":"",scrollable:!0,right:h.jsxs(h.Fragment,{children:[h.jsx(Nr,{items:[{label:"Inspect local schema",onClick:()=>{g.current?.open()}},{label:"Inspect schema",onClick:()=>{y.current?.open()}},C&&{label:"Delete",destructive:!0,onClick:B}],position:"bottom-end",children:h.jsx(ft,{Icon:_h})}),h.jsx(Xe,{onClick:H,disabled:!_,children:v?"Cancel":"Edit"}),v&&h.jsx(Xe,{variant:"primary",onClick:F,disabled:a||!_,children:a?"Save...":"Save"})]}),children:h.jsx(Pje,{path:i})}),h.jsxs(Zn,{children:[typeof j<"u"&&h.jsx(ai.Warning,{message:j}),h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:h.jsx(jh,{ref:p,readonly:!v,schema:Cv(A,["title"]),formData:T,uiSchema:t,onChange:console.log,className:"legacy hide-required-mark fieldset-alternative mute-root"})}),R.length>0&&h.jsxs("div",{className:"flex flex-col max-w-full",children:[h.jsx(GV,{items:R.map(U=>({as:Dw,label:Io(U),href:`${r}/${U}`.replace(/\/+/g,"/"),active:V===U,badge:Object.keys(k[U]?.config??{}).length}))}),h.jsx("div",{className:"flex flex-grow flex-col gap-3 p-3",children:h.jsx(tt,{path:"/:prop?",component:({params:U})=>{const[,M]=Uo(),z=U.prop??V,$=k[z]?.config??{},L=s?.[z]?.tableValues?s?.[z]?.tableValues($):Object.entries($).map(([q,Y])=>{if(!Y||typeof Y!="object")return{key:q,value:Y};const D=Object.keys(Y)[0],W=Y[D],K=Cv(Y,[D]);return{key:q,[D]:W,value:K}}),P=s?.[z]?.new;return z?h.jsxs(h.Fragment,{children:[P&&h.jsx(Bje,{schema:P.schema,uiSchema:P.uiSchema,anyOfValues:P.anyOfValues,prefixPath:`/${z}/`,path:[...i,z],generateKey:P.generateKey}),h.jsx(s1,{data:L,onClickRow:q=>{const Y=Object.values(q)[0];M(`/${z}/${Y}`)}})]}):h.jsx("div",{className:"h-80 flex justify-center align-center",children:h.jsx(Hn,{title:"No sub-setting selected",description:"Select one from the tab bar"})})}})})]})]},i.join("-")),h.jsx(iD,{ref:g,title:i.join("."),tabs:[{title:"Schema",json:A},{title:"Config",json:T}]}),h.jsx(iD,{ref:y,title:i.join("."),tabs:[{title:"Schema",json:e},{title:"Config",json:n}]})]}):h.jsx(Hn,{title:"Not found",description:`Configuration at path ${i.join(".")} doesn't exist.`,primary:{children:"Go back",onClick:()=>E()}})}const TC={config:{fillable:{"ui:options":{wrap:!0},anyOf:[{},{"ui:widget":"checkboxes"}]},hidden:{"ui:options":{wrap:!0},anyOf:[{},{"ui:widget":"checkboxes"}]},schema:{"ui:field":"JsonField"},ui_schema:{"ui:field":"JsonField"}}},Vje=i1.filter(e=>e.type!=="primary").reduce((e,t)=>(e[t.type]={label:t.label,icon:t.icon},e),{}),Uje={"1:1":{label:"One-to-One"},"n:1":{label:"Many-to-One"},"m:n":{label:"Many-to-Many"},poly:{label:"Polymorphic"}},Hje=({schema:e,config:t})=>{const{app:n,readonly:r}=ot(),o=n.getAbsolutePath("settings"),i=Object.keys(t.entities??{});function s(a,c="entity"){i.length!==0&&(a.properties&&c in a.properties&&(a.properties[c].enum=i),"anyOf"in a&&a.anyOf.forEach(u=>s(u,c)))}return h.jsx(tt,{path:"/data",nest:!0,children:h.jsxs(As,{children:[h.jsx(tt,{path:"/entities/:entity/fields/:field",component:({params:{entity:a,field:c}})=>{const u=t.entities?.[a]?.fields?.[c],f=e.properties.entities.additionalProperties?.properties?.fields.additionalProperties,p=f.anyOf.find(g=>g.properties.type.const===u?.type);return h.jsx(io,{schema:p??f,config:u,prefix:`${o}/data/entities/${a}/fields/${c}`,path:["data","entities",a,"fields",c],options:{showAlert:g=>{if(g?.type==="primary"&&!r)return"Modifying the primary field may result in strange behaviors."}},uiSchema:TC})},nest:!0}),h.jsx(tt,{path:"/entities/:entity",component:({params:{entity:a}})=>{const c=e.properties.entities.additionalProperties,u=Nw(c);u.properties.type.readOnly=!0;const f={anyOf:u.properties.fields.additionalProperties.anyOf.filter(p=>p.properties.type.const!=="primary")};return h.jsx(io,{schema:u,config:t.entities?.[a],options:{showAlert:p=>{if(p.type==="system"&&!r)return"Modifying the system entities may result in strange behaviors."}},properties:{fields:{extract:!0,tableValues:p=>Vi(p,(g,y,v)=>{g.push({property:v,type:y.type,required:y.config?.required?"Yes":"No"})},[]),new:{schema:f,uiSchema:TC,anyOfValues:Vje}}},path:["data","entities",a],prefix:`${o}/data/entities/${a}`})},nest:!0}),h.jsx(tt,{path:"/indices/:index",component:({params:{index:a}})=>{const c=e.properties.indices.additionalProperties;return i.length>0&&s(c,"entity"),h.jsx(io,{schema:e.properties.indices.additionalProperties,config:t.indices?.[a],path:["data","indices",a],prefix:`${o}/data/indices/${a}`})},nest:!0}),h.jsx(tt,{path:"/relations/:relation",component:({params:{relation:a}})=>{const c=t.relations?.[a],f=e.properties.relations.additionalProperties.anyOf.find(p=>p.properties.type.const===c?.type);return i.length>0&&(s(f,"source"),s(f,"target")),h.jsx(io,{schema:f,config:c,path:["data","relations",a],prefix:`${o}/data/relations/${a}`})},nest:!0}),h.jsx(tt,{path:"/",component:()=>{const a=e.properties.indices.additionalProperties,c=e.properties.relations.additionalProperties;return s(a,"entity"),s(c,"source"),s(c,"target"),h.jsx(io,{schema:e,config:t,properties:{entities:{extract:!0,tableValues:u=>Vi(u,(f,p,g)=>{f.push({name:g,type:p.type,fields:Object.keys(p.fields??{}).length})},[]),new:{schema:e.properties.entities.additionalProperties,uiSchema:{fields:{"ui:widget":"hidden"},type:{"ui:widget":"hidden"}}}},relations:{extract:!0,new:{schema:e.properties.relations.additionalProperties,generateKey:u=>{const f=[u.type.replace(":",""),u.source,u.target,u.config?.mappedBy,u.config?.inversedBy,u.config?.connectionTable,u.config?.connectionTableMappedName].filter(Boolean);return[...new Set(f)].join("_")},anyOfValues:Uje},tableValues:u=>Vi(u,(f,p,g)=>{f.push({name:g,type:p.type,source:p.source,target:p.target})},[])},indices:{extract:!0,tableValues:u=>Vi(u,(f,p,g)=>{f.push({name:g,entity:p.entity,fields:p.fields.join(", "),unique:p.unique?"Yes":"No"})},[]),new:{schema:a,uiSchema:{fields:{"ui:options":{orderable:!1}}},generateKey:u=>["idx",u.entity,u.unique&&"unique",...u.fields.filter(Boolean)].filter(Boolean).join("_")}}},prefix:`${o}/data`,path:["data"]})},nest:!0})]})})},l1=Jz,qje=Rt(Object.values(l1)),Wje=Ve({name:ju,new:at({const:!0}).optional(),field:qje}),Gje=Ve({fields:un(Wje)}),Jje=Object.keys(l1);Jje[0];const TT=["label","description","required","fillable","hidden","virtual"];function Yje(e){return ke(mo(l1[e]?.properties.config.properties,TT))}const MH=w.forwardRef(function({fields:t,sortable:n,additionalFieldTypes:r,routePattern:o,isNew:i,readonly:s,...a},c){const u=Object.entries(t).map(([H,F])=>({name:H,field:F})),{control:f,formState:{isValid:p,errors:g},getValues:y,watch:v,register:x,setValue:S,setError:E,reset:C}=Cc({mode:"all",resolver:Oc(Gje),defaultValues:{fields:u}}),{fields:_,append:j,remove:A,move:T}=n2e({control:f,name:"fields"});function k(H){return Object.fromEntries(H.fields.map(F=>[F.name,km(F.field)]))}w.useEffect(()=>{a?.onChange&&v(H=>{a?.onChange?.(k(H))})},[]),w.useImperativeHandle(c,()=>({reset:C,getValues:()=>y(),getData:()=>k(y()),isValid:()=>p,getErrors:()=>g}));function R(H){j({name:"",new:!0,field:{type:H,config:l1[H]?.properties.config.template()}})}const V={watch:v,register:x,setValue:S,getValues:y,control:f,setError:E};return h.jsx(h.Fragment,{children:h.jsx("div",{className:"flex flex-col gap-6",children:h.jsx("div",{className:"flex flex-col gap-3",children:h.jsxs("div",{className:"flex flex-col gap-4",children:[n?h.jsx($je,{data:_,onReordered:T,extractId:H=>H.id,disableIndices:[0],renderItem:({dnd:H,...F},B)=>h.jsx(Xje,{readonly:s,field:F,index:B,form:V,errors:g,remove:A,dnd:H,routePattern:o,primary:{defaultFormat:F.defaultPrimaryFormat,editable:i}},F.id)},_.length):h.jsx("div",{children:_.map((H,F)=>h.jsx(PH,{readonly:s,field:H,index:F,form:V,errors:g,remove:A,routePattern:o,primary:{defaultFormat:a.defaultPrimaryFormat,editable:i}},H.id))}),h.jsx(Iw,{children:h.jsx(o1,{className:"flex flex-col w-full",target:({toggle:H})=>h.jsx(Kje,{additionalFieldTypes:r,onSelected:H,onSelect:F=>{R(F)}}),children:h.jsx(Xe,{className:"justify-center",children:"Add Field"})})})]})})})})}),Kje=({onSelect:e,additionalFieldTypes:t=[],onSelected:n})=>{const r=i1.filter(o=>o.addable!==!1);return t&&r.push(...t),h.jsx("div",{className:"flex flex-row gap-2 justify-center flex-wrap",children:r.map(o=>h.jsx(Xe,{IconLeft:o.icon,variant:"ghost",onClick:()=>{o.addable!==!1?e(o.type):o.onClick?.(),n?.()},children:o.label},o.type))})},Xje=w.memo(PH,(e,t)=>e.field.id!==t.field.id);function PH({field:e,index:t,form:{watch:n,register:r,setValue:o,getValues:i,control:s,setError:a},remove:c,errors:u,dnd:f,routePattern:p,primary:g,readonly:y}){const v=`fields.${t}.field`,x=e.field.type,S=n(`fields.${t}.name`),{active:E,toggle:C}=GA(p??"",S),_=i1.find(F=>F.type===x),j=_.disabled||[],A=_.hidden||[],T=t===0,k=!!u?.fields?.[t],R=x==="primary";function V(F){return()=>{(S.length===0||window.confirm(`Sure to delete "${S}"?`))&&(c(F),C())}}const H=f?{...f.provided.draggableProps,ref:f.provided.innerRef}:{};return h.jsxs("div",{className:Be("flex flex-col border border-muted rounded bg-background mb-2",E&&"mb-6",k&&"border-red-500 "),...H,children:[h.jsxs("div",{className:"flex flex-row gap-2 px-2 py-2",children:[f?h.jsx("div",{className:"flex items-center",...f.provided.dragHandleProps,children:h.jsx(ft,{Icon:OSe,className:"mt-1",disabled:T})}):null,h.jsxs("div",{className:"flex flex-row flex-grow gap-4 items-center md:mr-6",children:[h.jsx(ns,{label:_.label,children:h.jsx("div",{className:"flex flex-row items-center p-2 bg-primary/5 rounded",children:h.jsx(_.icon,{className:"size-5"})})}),e.new?h.jsx(_n,{error:!!u?.fields?.[t]?.name.message,placeholder:"Enter a property name...",classNames:{root:"w-full h-full",wrapper:"font-mono h-full",input:"pt-px !h-full"},...r(`fields.${t}.name`),disabled:!e.new}):h.jsxs("div",{className:"font-mono flex-grow flex flex-row gap-3",children:[h.jsx("span",{children:S}),e.field.config?.label&&h.jsx("span",{className:"opacity-50",children:e.field.config?.label})]}),h.jsx("div",{className:"flex-col gap-1 hidden md:flex",children:R?h.jsx(h.Fragment,{children:h.jsx(Sa,{data:["integer","uuid"],defaultValue:g?.defaultFormat,disabled:!g?.editable,placeholder:"Select format",name:`${v}.config.format`,allowDeselect:!1,control:s,size:"xs",className:"w-22"})}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-xs text-primary/50 leading-none",children:"Required"}),h.jsx(cN,{size:"sm",disabled:y,name:`${v}.config.required`,control:s})]})})]}),h.jsx("div",{className:"flex items-end",children:h.jsx("div",{className:"flex flex-row gap-4",children:h.jsx(ft,{size:"lg",Icon:_h,disabled:R,iconProps:{strokeWidth:1.5},onClick:()=>C(),variant:E?"primary":"ghost"})})})]}),E&&h.jsx("div",{className:"flex flex-col border-t border-t-muted px-3 py-2 bg-lightest/50",children:h.jsxs(xn,{defaultValue:"general",children:[h.jsxs(xn.List,{className:"flex flex-row",children:[h.jsx(xn.Tab,{value:"general",children:"General"}),h.jsx(xn.Tab,{value:"specific",children:Dg(x)}),h.jsx(xn.Tab,{value:"visibility",disabled:!0,children:"Visiblity"}),h.jsx("div",{className:"flex flex-grow"}),h.jsx(xn.Tab,{value:"code",className:"!self-end",children:"Code"})]}),h.jsx(xn.Panel,{value:"general",children:h.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-1",children:[h.jsx("div",{className:"flex flex-row",children:h.jsx(cN,{label:"Required",disabled:y,name:`${v}.config.required`,control:s})}),h.jsx(_n,{label:"Label",placeholder:"Label",disabled:y,...r(`${v}.config.label`)}),h.jsx(kg,{label:"Description",placeholder:"Description",disabled:y,...r(`${v}.config.description`)}),!A.includes("virtual")&&h.jsx(cN,{label:"Virtual",name:`${v}.config.virtual`,control:s,disabled:j.includes("virtual")||y})]},`${v}_${x}`)}),h.jsx(xn.Panel,{value:"specific",children:h.jsx("div",{className:"flex flex-col gap-2 pt-3 pb-1",children:h.jsx(Ch,{fallback:`Error rendering JSON Schema for ${x}`,children:h.jsx(Qje,{field:e,onChange:F=>{o(`${v}.config`,{...Rm(i([`${v}.config`])[0],TT),...F})},readonly:y})})})}),h.jsx(xn.Panel,{value:"code",children:(()=>{const{id:F,...B}=e;return h.jsx(Vr,{json:B,expand:4})})()}),!y&&h.jsx("div",{className:"flex flex-row justify-end",children:h.jsx(Xe,{IconLeft:XA,onClick:V(t),size:"small",variant:"subtlered",children:"Delete"})})]})})]},e.id)}const Qje=({field:e,onChange:t,readonly:n})=>{const r=e.field.type,o=mo(e.field.config??{},TT);return h.jsx(jh,{schema:Yje(r)?.toJSON(),formData:o,uiSchema:TC.config,className:"legacy hide-required-mark fieldset-alternative mute-root",onChange:t,readonly:n},r)},Zje=aT;function eAe(){const{nextStep:e,stepBack:t,state:n,setState:r}=Yu(),{config:o}=Ho(),i=n.entities?.create?.[0],s={id:{type:"primary",name:"id"}},a=w.useRef(null),c=km(Ame(i,{fields:s,config:{sort_field:"id",sort_dir:"asc"}})),{control:u,formState:{isValid:f,errors:p},getValues:g,handleSubmit:y,watch:v,setValue:x}=Cc({mode:"onTouched",resolver:Oc(Zje),defaultValues:c}),S=v(),E=It(_=>{x("fields",_)});function C(){f&&a.current?.isValid()?(r(_=>_.entities?.create?.[0]?{..._,entities:{create:[g()]}}:_),console.log("valid"),e("create")()):console.warn("not valid",a.current?.getErrors())}return h.jsxs("form",{onSubmit:y(C),children:[h.jsx(Gu,{children:h.jsxs("div",{className:"flex flex-col gap-6",children:[h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsxs("p",{children:["Add fields to ",h.jsx("strong",{children:i.name}),":"]}),h.jsx("div",{className:"flex flex-col gap-1",children:h.jsx(MH,{ref:a,fields:c.fields,onChange:E,defaultPrimaryFormat:o?.default_primary_format,isNew:!0})})]}),h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsx("p",{children:"How should it be sorted by default?"}),h.jsxs("div",{className:"flex flex-row gap-2",children:[h.jsx(Sa,{label:"Field",data:Object.keys(S.fields??{}).filter(_=>_.length>0),placeholder:"Select field",name:"config.sort_field",allowDeselect:!1,control:u}),h.jsx(Sa,{label:"Direction",data:["asc","desc"],defaultValue:"asc",placeholder:"Select direction",name:"config.sort_dir",allowDeselect:!1,control:u})]})]}),h.jsx("div",{children:Object.entries(p).map(([_,j])=>h.jsxs("p",{children:[_,": ",j.message]},_))})]})}),h.jsx(Ju,{next:{disabled:!f,type:"submit"},prev:{onClick:t},debug:{state:n,values:S}})]})}function Xv({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o,onChange:i,...s}){const{field:{value:a,onChange:c,...u},fieldState:f}=Oh({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o});return h.jsx(Jx,{value:a,onChange:p=>{c(p),i?.(p)},error:f.error?.message,...u,...s})}const $C=[{type:Fr.ManyToOne,label:"Many to One",component:rAe},{type:Fr.OneToOne,label:"One to One",component:oAe},{type:Fr.ManyToMany,label:"Many to Many",component:iAe},{type:Fr.Polymorphic,label:"Polymorphic",component:sAe}],tAe=Ve({type:le({enum:$C.map(e=>e.type)}),source:ju,target:ju,config:ke({})});function nAe(){const{config:e}=ot(),t=e.data.entities,n=Object.keys(t??{}).length,{nextStep:r,stepBack:o,state:i,path:s,setState:a}=Yu(),{register:c,handleSubmit:u,formState:{isValid:f},setValue:p,watch:g,control:y}=Cc({resolver:Oc(tAe),defaultValues:i.relations?.create?.[0]??{}}),v=g();function x(){f&&(a(E=>({...E,relations:{create:[v]}})),console.log("data",v),r("create")())}const S=It(()=>{const{source:E,target:C}=v;E&&C?(p("source",C),p("target",E)):E?(p("target",E),p("source",null)):(p("source",C),p("target",null))});return h.jsxs(h.Fragment,{children:[n<2&&h.jsx("div",{className:"px-5 py-4 bg-red-100 text-red-900",children:"Not enough entities to create a relation."}),h.jsxs("form",{onSubmit:u(x),children:[h.jsxs(Gu,{children:[h.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[h.jsx(Sa,{control:y,name:"source",label:"Source",allowDeselect:!1,data:Object.entries(t??{}).map(([E,C])=>({value:E,label:C.config?.name??E,disabled:v.target===E}))}),h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx(Sa,{control:y,name:"type",onChange:()=>p("config",{}),label:"Relation Type",data:$C.map(E=>({value:E.type,label:E.label})),allowDeselect:!1}),v.type&&h.jsx("div",{className:"flex justify-center mt-1",children:h.jsx(Xe,{size:"small",IconLeft:HV,onClick:S,children:"Flip entities"})})]}),h.jsx(Sa,{control:y,allowDeselect:!1,name:"target",label:"Target",data:Object.entries(t??{}).map(([E,C])=>({value:E,label:C.config?.name??E,disabled:v.source===E}))})]}),h.jsx("div",{children:v.type&&$C.find(E=>E.type===v.type)?.component({register:c,control:y,data:v})})]}),h.jsx(Ju,{next:{type:"submit",disabled:!f,onClick:x},prev:{onClick:o},debug:{state:i,path:s,data:v}})]})]})}const Kt=({children:e})=>h.jsx("b",{className:"font-mono select-text",children:e}),c1=({children:e})=>h.jsx("div",{className:"bg-primary/5 py-4 px-5 rounded-lg mt-10",children:e});function rAe({register:e,control:t,data:{source:n,target:r,config:o}}){return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsx(_n,{label:"Target mapping",...e("config.mappedBy"),placeholder:r}),h.jsx(Xv,{label:"Cardinality",name:"config.sourceCardinality",control:t,placeholder:"n"}),h.jsx(Xv,{label:"WITH limit",name:"config.with_limit",control:t,placeholder:String(ac.DEFAULTS.with_limit)})]}),h.jsx("div",{}),h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsx(_n,{label:"Source mapping",...e("config.inversedBy"),placeholder:n}),h.jsx(vc,{label:"Required",...e("config.required")})]})]}),n&&r&&o&&h.jsx(c1,{children:h.jsxs(h.Fragment,{children:[h.jsxs("pre",{className:"mb-2 opacity-70 flex flex-row items-center gap-2",children:[h.jsx(Ru,{className:"size-4"}),n,".",o.mappedBy||r,"_id ","→"," ",r]}),h.jsxs("p",{children:["Many ",h.jsx(Kt,{children:n})," will each have one reference to ",h.jsx(Kt,{children:r}),"."]}),h.jsxs("p",{children:["A property ",h.jsxs(Kt,{children:[o.mappedBy||r,"_id"]})," will be added to"," ",h.jsx(Kt,{children:n})," (which references ",h.jsx(Kt,{children:r}),")."]}),h.jsxs("p",{children:["When creating ",h.jsx(Kt,{children:n}),", a reference to ",h.jsx(Kt,{children:r})," is"," ",h.jsx("i",{children:o.required?"required":"optional"}),"."]}),o.sourceCardinality?h.jsxs("p",{children:[h.jsx(Kt,{children:r})," should not have more than"," ",h.jsx(Kt,{children:o.sourceCardinality})," referencing entr",o.sourceCardinality===1?"y":"ies"," to ",h.jsx(Kt,{children:n}),"."]}):null]})})]})}function oAe({register:e,control:t,data:{source:n,target:r,config:{mappedBy:o,required:i}}}){return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsx(_n,{label:"Target mapping",...e("config.mappedBy"),placeholder:r}),h.jsx(vc,{label:"Required",...e("config.required")})]}),h.jsx("div",{}),h.jsx("div",{className:"flex flex-col gap-4",children:h.jsx(_n,{label:"Source mapping",...e("config.inversedBy"),placeholder:n})})]}),n&&r&&h.jsx(c1,{children:h.jsxs(h.Fragment,{children:[h.jsxs("pre",{className:"mb-2 opacity-70 flex flex-row items-center gap-2",children:[h.jsx(Ru,{className:"size-4"}),n,".",o||r,"_id ","↔"," ",r]}),h.jsxs("p",{children:["A single entry of ",h.jsx(Kt,{children:n})," will have a reference to"," ",h.jsx(Kt,{children:r}),"."]}),h.jsxs("p",{children:["A property ",h.jsxs(Kt,{children:[o||r,"_id"]})," will be added to"," ",h.jsx(Kt,{children:n})," (which references ",h.jsx(Kt,{children:r}),")."]}),h.jsxs("p",{children:["When creating ",h.jsx(Kt,{children:n}),", a reference to ",h.jsx(Kt,{children:r})," is"," ",h.jsx("i",{children:i?"required":"optional"}),"."]})]})})]})}function iAe({register:e,control:t,data:{source:n,target:r,config:o}}){const i=o.connectionTable?o.connectionTable:n&&r?`${n}_${r}`:"";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[h.jsx("div",{className:"flex flex-col gap-4"}),h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsx(_n,{label:"Connection Table",...e("config.connectionTable"),placeholder:i}),h.jsx(_n,{label:"Connection Mapping",...e("config.connectionTableMappedName"),placeholder:i})]}),h.jsx("div",{className:"flex flex-col gap-4"})]}),n&&r&&h.jsx(c1,{children:h.jsxs(h.Fragment,{children:[h.jsxs("pre",{className:"mb-2 opacity-70 flex flex-row items-center gap-2",children:[h.jsx(Ru,{className:"size-4"}),n," ","→"," ",i," ","←"," ",r]}),h.jsxs("p",{children:["Many ",h.jsx(Kt,{children:n})," will have many ",h.jsx(Kt,{children:r}),"."]}),h.jsxs("p",{children:["A connection table ",h.jsx(Kt,{children:i})," will be created to store the relations."]})]})})]})}function sAe({register:e,control:t,data:{type:n,source:r,target:o,config:i}}){return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid grid-cols-3 gap-8",children:[h.jsx("div",{className:"flex flex-col gap-4",children:h.jsx(_n,{label:"Target mapping",...e("config.mappedBy"),placeholder:o})}),h.jsx("div",{}),h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsx(_n,{label:"Source mapping",...e("config.inversedBy"),placeholder:r}),h.jsx(Xv,{label:"Cardinality",name:"config.targetCardinality",control:t,placeholder:"n"})]})]},n),r&&o&&h.jsx(c1,{children:h.jsxs(h.Fragment,{children:[h.jsxs("pre",{className:"mb-2 opacity-70 flex flex-row items-center gap-2",children:[h.jsx(Ru,{className:"size-4"}),r," ","←"," ",o]}),h.jsxs("p",{children:[h.jsx(Kt,{children:r})," will have many ",h.jsx(Kt,{children:o}),"."]}),h.jsxs("p",{children:[h.jsx(Kt,{children:o})," will get additional properties ",h.jsx(Kt,{children:"reference"})," and"," ",h.jsx(Kt,{children:"entity_id"})," to make the (polymorphic) reference."]}),i.targetCardinality?h.jsxs("p",{children:[h.jsx(Kt,{children:r})," should not have more than"," ",h.jsx(Kt,{children:i.targetCardinality})," reference",i.targetCardinality===1?"":"s"," to ",h.jsx(Kt,{children:o}),"."]}):null]})})]})}function $T({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o,onChange:i,...s}){const{field:{value:a,onChange:c,...u}}=Oh({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o});return h.jsx(Os,{value:a,onChange:f=>{c(f),i?.(f)},...u,...s})}function aAe({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o,onChange:i,...s}){const{field:{value:a,onChange:c,...u},fieldState:f}=Oh({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o});return h.jsx(Yx,{value:a,onChange:p=>{c(p),i?.(p)},error:f.error?.message,...u,...s})}$T.Group=aAe;$T.Item=Os;const sD=ke({entity:ju,cardinality_type:le({enum:["single","multiple"],default:"multiple"}),cardinality:bt({minimum:1}).optional(),name:ju});function lAe(){const{stepBack:e,setState:t,state:n,path:r,nextStep:o}=Yu(),{register:i,handleSubmit:s,formState:{isValid:a,errors:c},watch:u,control:f}=Cc({mode:"onChange",resolver:Oc(sD),defaultValues:sD.template(n.initial??{})}),[p,g]=w.useState(!1),{config:y}=ot(),v=y.media.enabled??!1,x=y.media.entity_name??"media",S=Vt(y.data.entities??{},(j,A)=>A!==x?j:void 0),E=u(),C=Object.keys(y.data.entities?.[E.entity]?.fields??{});w.useEffect(()=>{g(C.includes(E.name))},[C,E.name]);async function _(){if(a&&!p){const{field:j,relation:A}=cAe(x,E);t(T=>({...T,fields:{create:[j]},relations:{create:[A]}})),o("create")()}}return h.jsxs(h.Fragment,{children:[!v&&h.jsx("div",{className:"px-5 py-4 bg-red-100 text-red-900",children:"Media is not enabled in the configuration. Please enable it to use this template."}),h.jsxs("form",{onSubmit:s(_),children:[h.jsx(Gu,{children:h.jsxs("div",{className:"flex flex-col gap-6",children:[h.jsx(Sa,{name:"entity",allowDeselect:!1,control:f,size:"md",label:"Choose which entity to add media to",required:!0,data:Object.entries(S).map(([j,A])=>({value:j,label:A.config?.name??j}))}),h.jsx($T.Group,{name:"cardinality_type",control:f,label:"How many items can be attached?",size:"md",children:h.jsxs("div",{className:"flex flex-col gap-1",children:[h.jsx(Os,{label:"Multiple items",value:"multiple"}),h.jsx(Os,{label:"Single item",value:"single"})]})}),E.cardinality_type==="multiple"&&h.jsx(Xv,{name:"cardinality",control:f,size:"md",label:"How many exactly?",placeholder:"n",description:"Leave empty for unlimited",inputWrapperOrder:["label","input","description","error"]}),h.jsx(_n,{size:"md",label:"Set a name for the property",required:!0,description:`A virtual property will be added to ${E.entity?E.entity:"the entity"}.`,...i("name"),error:c.name?.message?c.name?.message:p?`Property "${E.name}" already exists on entity ${E.entity}`:void 0})]})}),h.jsx(Ju,{next:{type:"submit",disabled:!a||!v||p},prev:{onClick:e},debug:{state:n,path:r,data:E}})]})]})}function cAe(e,t){const n={name:t.name,entity:t.entity,field:{type:"media",config:{required:!1,fillable:["update"],hidden:!1,mime_types:[],virtual:!0,entity:t.entity}}},r={type:"poly",source:t.entity,target:e,config:{mappedBy:t.name,targetCardinality:t.cardinality_type==="single"?1:void 0}};return t.cardinality_type==="multiple"?t.cardinality&&t.cardinality>1&&(n.field.config.max_items=t.cardinality,r.config.targetCardinality=t.cardinality):(n.field.config.max_items=1,r.config.targetCardinality=1),{field:n,relation:r}}const uAe={id:"template-media",title:"Attach Media",description:"Attach media to an entity",Icon:ny},DH=[[lAe,uAe]];function dAe(){const{nextStep:e,stepBack:t,state:n,path:r,setState:o}=Yu(),i=n.action??null;function s(a){if(i===a){e(a)();return}o({action:a})}return h.jsxs(h.Fragment,{children:[h.jsxs(Gu,{children:[h.jsx("p",{children:"Choose what type to add."}),h.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[h.jsx(SN,{Icon:nSe,title:"Entity",description:"Create a new entity with fields",onClick:()=>s("entity"),selected:i==="entity"}),h.jsx(SN,{Icon:YA,title:"Relation",description:"Create a new relation between entities",onClick:()=>s("relation"),selected:i==="relation"})]}),h.jsxs("div",{className:"flex flex-col gap-2 mt-3",children:[h.jsx("h3",{className:"font-bold",children:"Quick templates"}),h.jsx("div",{className:"grid grid-cols-2 gap-3",children:DH.map(([,a])=>h.jsx(SN,{compact:!0,Icon:ny,title:a.title,description:a.description,onClick:()=>s(a.id),selected:i===a.id},a.id))})]})]}),h.jsx(Ju,{next:{onClick:i&&e(i),disabled:!i},prev:{onClick:t},prevLabel:"Cancel",debug:{state:n,path:r}})]})}const SN=({Icon:e,title:t,description:n,onClick:r,selected:o,compact:i=!1,disabled:s=!1})=>h.jsxs("div",{onClick:s!==!0?r:void 0,className:Be("flex gap-3 border border-primary/10 rounded cursor-pointer",i?"flex-row p-4 items-center":"flex-col p-5",o?"bg-primary/10 border-primary/50":"hover:bg-primary/5",s&&"opacity-50"),children:[h.jsx(e,{className:"size-10"}),h.jsxs("div",{className:"flex flex-col leading-tight",children:[h.jsx("p",{className:"text-lg font-bold",children:t}),h.jsx("p",{children:n})]})]});function RT({context:e,id:t,innerProps:{initialPath:n=[],initialState:r}}){const[o,i]=w.useState(n);function s(){e.closeModal(t)}return h.jsxs(eU,{path:o,lastBack:s,initialPath:n,initialState:r,children:[h.jsxs(eu,{id:"select",children:[h.jsx(Zc,{path:["Create New"],onClose:s}),h.jsx(dAe,{})]}),h.jsxs(eu,{id:"entity",path:["action"],children:[h.jsx(Zc,{path:["Create New","Entity"],onClose:s}),h.jsx(c2e,{})]}),h.jsxs(eu,{id:"entity-fields",path:["action","entity"],children:[h.jsx(Zc,{path:["Create New","Entity","Fields"],onClose:s}),h.jsx(eAe,{})]}),h.jsxs(eu,{id:"relation",path:["action"],children:[h.jsx(Zc,{path:["Create New","Relation"],onClose:s}),h.jsx(nAe,{})]}),h.jsxs(eu,{id:"create",path:["action"],children:[h.jsx(Zc,{path:["Create New","Creation"],onClose:s}),h.jsx(PEe,{})]}),DH.map(([a,c])=>h.jsxs(eu,{id:c.id,path:["action"],children:[h.jsx(Zc,{path:["Create New","Template",c.title],onClose:s}),h.jsx(a,{})]},c.id))]})}RT.defaultTitle=void 0;RT.modalProps={withCloseButton:!1,size:"xl",padding:0};function kT({innerProps:e}){const{data:t,...n}=e,r=Vt(t,(s,a)=>typeof s=="object"&&"label"in s?s:{label:h.jsx("span",{className:"font-mono",children:a}),value:s,expand:10,showCopy:!0,...n}),o=Object.keys(r).length;function i({value:s,label:a,className:c,...u}){return h.jsx(Vr,{json:s,className:pn("text-sm",c),...u})}return h.jsx("div",{className:"bg-background",children:o>1?h.jsxs(xn,{defaultValue:Object.keys(r)[0],children:[h.jsx("div",{className:"sticky top-0 bg-background z-10",children:h.jsx(xn.List,{children:Object.entries(r).map(([s,a])=>h.jsx(xn.Tab,{value:s,children:a.label},s))})}),Object.entries(r).map(([s,a])=>h.jsx(xn.Panel,{value:s,children:i(a)},s))]}):i({...r[Object.keys(r)[0]],title:r[Object.keys(r)[0]].label})})}kT.defaultTitle=!1;kT.modalProps={withCloseButton:!1,size:"lg",classNames:{body:"!p-0"}};function MT({context:e,id:t,innerProps:{schema:n,uiSchema:r,onSubmit:o,autoCloseAfterSubmit:i}}){const[s,a]=w.useState(!1),c=w.useRef(null),[u,f]=w.useState(!1),p=w.useRef(!1),[g,y]=w.useState();function v(E,C){const _=C();console.log("Data changed",E,_),a(_)}function x(){e.closeModal(t)}async function S(){p.current=!0,c.current?.validateForm()&&(f(!0),await o?.(c.current?.formData(),{close:x,setError:y}),f(!1),i!==!1&&x())}return h.jsxs(h.Fragment,{children:[g&&h.jsx(ai.Exception,{message:g}),h.jsxs("div",{className:"pt-3 pb-3 px-4 gap-4 flex flex-col",children:[h.jsx(jh,{tagName:"form",ref:c,schema:JSON.parse(JSON.stringify(n)),uiSchema:r,className:"legacy hide-required-mark fieldset-alternative mute-root",onChange:v,onSubmit:S}),h.jsxs("div",{className:"flex flex-row justify-end gap-2",children:[h.jsx(Xe,{onClick:x,children:"Cancel"}),h.jsx(Xe,{variant:"primary",onClick:S,disabled:!s||u,children:"Create"})]})]})]})}MT.defaultTitle="JSON Schema Form Modal";MT.modalProps={size:"md",classNames:{root:"bknd-admin",header:"!bg-lightest !py-3 px-5 !h-auto !min-h-px",content:"rounded-lg select-none",title:"!font-bold !text-md",body:"!p-0"}};function PT({context:e,id:t,innerProps:n}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{children:n.modalBody}),h.jsx("button",{onClick:()=>e.closeModal(t),children:"Close modal"})]})}PT.defaultTitle="Test Modal";PT.modalProps={classNames:{size:"md",root:"bknd-admin",header:"!bg-primary/5 border-b border-b-muted !py-3 px-5 !h-auto !min-h-px",content:"rounded-lg select-none",title:"font-bold !text-md",body:"py-3 px-5 gap-4 flex flex-col"}};const fAe={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0.9)"},transitionProperty:"transform, opacity"},hAe=e=>{const[t,n]=w.useState(),r=ss(e?.baseUrl);return w.useEffect(()=>{(async()=>{const o=await r.auth.strategies();o.res.ok&&n(o.body)})()},[e?.baseUrl]),{strategies:t?.strategies,basepath:t?.basepath,loading:!t}};function IH(e,t){const n=e?.tagName.toLowerCase()??"",r=["input","select","textarea"];return!e||!t?.contains(e)||!r.includes(n)||!("name"in e)||e.hasAttribute("data-ignore")||e.closest("[data-ignore]")}function pAe(e){const t=e.currentTarget,n=e.target;return IH(n,t)?null:n}function mAe(e,t){const n=e.querySelectorAll(`[name="${t}"]`);return Array.from(n).filter(r=>IH(r))}function gAe(e,t){if(!e)return t;const n=e.required;if(!(!t&&!n))if(e.type==="number"){const r=Number(t);if(Number.isNaN(r)&&!n)return;const o="min"in e&&e.min.length>0?Number(e.min):void 0,i="max"in e&&e.max.length>0?Number(e.max):void 0,s="step"in e&&e.step.length>0?Number(e.step):void 0;return o&&r<o?o:i&&r>i?i:s&&s!==1?Math.round(r/s)*s:r}else if(e.type==="text"){const r="maxLength"in e&&e.maxLength>-1?Number(e.maxLength):void 0,o="pattern"in e?new RegExp(e.pattern):void 0;return r&&t.length>r?t.slice(0,r):o&&!o.test(t)?"":t}else return e.type==="checkbox"?"checked"in e?!!e.checked:["on","1","true",1,!0].includes(t):t}function RC(e,t){if(!e)return e;const n=[null,void 0,""],r={empty:t?.empty??n,emptyInArray:t?.emptyInArray??n,keepEmptyArray:t?.keepEmptyArray??!1};return Object.entries(e).reduce((o,[i,s])=>{if(s&&Array.isArray(s)&&s.some(a=>typeof a=="object")){const a=s.map(c=>RC(c,r));(a.length>0||r?.keepEmptyArray)&&(o[i]=a)}else if(s&&typeof s=="object"&&!Array.isArray(s)){const a=RC(s,r);Object.keys(a).length>0&&(o[i]=a)}else if(Array.isArray(s)){const a=s.filter(c=>!r.emptyInArray.includes(c));(a.length>0||r?.keepEmptyArray)&&(o[i]=a)}else r.empty.includes(s)||(o[i]=s);return o},{})}function LH(e,t,n){let r=t;if(typeof r=="string"){const s=a=>a[0]==='"'&&a.at(-1)==='"';r=r.split(/[.\[\]]+/).filter(a=>a).map(a=>Number.isNaN(Number(a))?a:Number(a)).map(a=>typeof a=="string"&&s(a)?a.slice(1,-1):a)}if(r.length===0)throw new Error("The path must have at least one entry in it");const[o,...i]=r;return i.length===0?(e[o]=n,e):(o in e||(e[o]=typeof i[0]=="number"?[]:{}),LH(e[o],i,n),e)}function yAe({children:e,validateOn:t="submit",hiddenSubmit:n=!1,errorFieldSelector:r,reportValidity:o,onSubmit:i,onSubmitInvalid:s,onError:a,clean:c,disableSubmitOnError:u=!0,...f}){const p=w.useRef(null),[g,y]=w.useState([]);w.useEffect(()=>{!p.current||f.noValidate||x()},[]),w.useEffect(()=>{if(!p.current||f.noValidate)return;const j=g.length>0;p.current.querySelectorAll("[type=submit]").forEach(A=>{!A||!("type"in A)||A.type!=="submit"||(A.disabled=j)}),a?.(g)},[g]);const v=(j,A)=>{if(f.noValidate||!j||!("name"in j))return;const T=p.current?.querySelector(r?.(j.name)??`[data-role="input-error"][data-name="${j.name}"]`);if(j.checkValidity())y(k=>k.filter(R=>R.name!==j.name)),T&&(T.textContent="");else{const k={name:j.name,message:j.validationMessage};return y(R=>[...R.filter(V=>V.name!==j.name),k]),A?.report&&(T?T.textContent=k.message:o&&j.reportValidity()),k}},x=j=>{if(!p.current||f.noValidate)return[];const A=[];return p.current.querySelectorAll("input, select, textarea").forEach(T=>{const R=v(T,j);R&&A.push(R)}),u&&p.current.querySelectorAll("[type=submit]").forEach(T=>{A.length>0?T.setAttribute("disabled","disabled"):T.removeAttribute("disabled")}),A},S=()=>{if(!p.current)return{};const j=new FormData(p.current),A={};return j.forEach((T,k)=>{const R=mAe(p.current,k);if(R.length===0){console.warn(`No target found for key: ${k}`);return}const H=R.length>1;R.forEach((F,B)=>{let U=k;H&&(U=`${k}[${B}]`),LH(A,U,gAe(F,F.value))})}),typeof c>"u"?A:RC(A,c===!0?void 0:c)},E=async j=>{if(!p.current)return;const T=pAe(j);T&&((t==="change"||g.length>0)&&v(T,{report:!0}),f.onChange&&await f.onChange(S(),{event:j,key:T.name,value:T.value,errors:g}))},C=async j=>{j.preventDefault();const A=p.current;if(!A)return;const T=x({report:!0});if(T.length>0){s?.(T,{event:j,form:A});return}i?await i(S(),{event:j,form:A}):A.submit()},_=j=>{p.current&&j.keyCode===13&&g.length>0&&!f.noValidate&&o&&p.current.reportValidity()};return h.jsxs("form",{...f,onChange:E,onSubmit:C,ref:p,onKeyDown:_,children:[e,n&&h.jsx("input",{type:"submit",style:{visibility:"hidden"}})]})}function bAe({label:e,provider:t,icon:n,action:r,method:o="POST",basepath:i="/api/auth",children:s}){const a=[i,t,r].join("/");return h.jsxs("form",{method:o,action:a,className:"w-full",children:[h.jsxs(Xe,{type:"submit",size:"large",variant:"outline",className:"justify-center w-full",IconLeft:n,children:["Continue with ",e??Dg(t)]}),s]})}function vAe({formData:e,className:t,method:n="POST",action:r,auth:o,buttonLabel:i=r==="login"?"Sign in":"Sign up",onSubmit:s,...a}){const c=DA(),u=o?.basepath??"/api/auth",[f,p]=w.useState(),[,g]=Uo(),y={action:`${u}/password/${r}`,strategy:o?.strategies?.password??{}},v=Vt(o?.strategies??{},E=>E.type!=="password"?E.config:void 0),x=Object.keys(v).length>0;async function S(E,C){if(c?.local){C.event.preventDefault();const _=await c.login(E);if("token"in _)g("/");else{p(_.error);return}}await s?.(C.event),C.form.submit()}return w.useEffect(()=>{c.user&&g("/")},[c.user]),h.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[x&&h.jsxs(h.Fragment,{children:[h.jsx("div",{children:Object.entries(v)?.map(([E,C],_)=>h.jsx(bAe,{provider:E,method:n,basepath:u,action:r},_))}),h.jsx(xAe,{})]}),h.jsxs(yAe,{method:n,action:y.action,onSubmit:S,...a,validateOn:"change",className:pn("flex flex-col gap-3 w-full",t),children:[f&&h.jsx(ai.Exception,{message:f,className:"justify-center"}),h.jsxs(mi,{children:[h.jsx(uc,{htmlFor:"email",children:"Email address"}),h.jsx(qa,{type:"email",name:"email",required:!0})]}),h.jsxs(mi,{children:[h.jsx(uc,{htmlFor:"password",children:"Password"}),h.jsx(AH,{name:"password",required:!0,minLength:1})]}),h.jsx(Xe,{type:"submit",variant:"primary",size:"large",className:"w-full mt-2 justify-center",children:i})]})]})}const xAe=()=>h.jsxs("div",{className:"w-full flex flex-row items-center",children:[h.jsx("div",{className:"relative flex grow",children:h.jsx("div",{className:"h-px bg-primary/10 w-full absolute top-[50%] z-0"})}),h.jsx("div",{className:"mx-5",children:"or"}),h.jsx("div",{className:"relative flex grow",children:h.jsx("div",{className:"h-px bg-primary/10 w-full absolute top-[50%] z-0"})})]});function wAe({method:e="POST",action:t="login",logo:n,intro:r,formOnly:o}){const{strategies:i,basepath:s,loading:a}=hAe(),c=h.jsx(vAe,{auth:{basepath:s,strategies:i},method:e,action:t});return o?a?null:c:h.jsx("div",{className:"flex flex-1 flex-col select-none h-dvh w-dvw justify-center items-center bknd-admin",children:!a&&h.jsxs("div",{className:"flex flex-col gap-4 items-center w-96 px-6 py-7",children:[n||null,w.isValidElement(r)?r:h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsxs("h1",{className:"text-xl font-bold",children:["Sign ",t==="login"?"in":"up"," to your admin panel"]}),h.jsx("p",{className:"text-primary/50",children:"Enter your credentials below to get access."})]}),c]})})}const FH={Screen:wAe};function SAe(){const e=w.useRef(0);return e.current++,e.current}const EAe=[".DS_Store","Thumbs.db"];function ly(e,t){const n=NAe(e);if(typeof n.path!="string"){const{webkitRelativePath:r}=e;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function NAe(e){const{name:t}=e,n=t&&t.lastIndexOf(".")!==-1;if(console.log("withMimeType",t,n),n&&!e.type){const r=LL(t);console.log("guessed",r),r&&Object.defineProperty(e,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return e}async function fb(e){return Qv(e)&&_Ae(e.dataTransfer)?AAe(e.dataTransfer,e.type):CAe(e)?OAe(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?jAe(e):[]}function _Ae(e){return Qv(e)}function CAe(e){return Qv(e)&&Qv(e.target)}function Qv(e){return typeof e=="object"&&e!==null}function OAe(e){return kC(e.target.files).map(t=>ly(t))}async function jAe(e){return(await Promise.all(e.map(n=>n.getFile()))).map(n=>ly(n))}async function AAe(e,t){if(e.items){const n=kC(e.items).filter(o=>o.kind==="file");if(t!=="drop")return n;const r=await Promise.all(n.map(TAe));return aD(zH(r))}return aD(kC(e.files).map(n=>ly(n)))}function aD(e){return e.filter(t=>EAe.indexOf(t.name)===-1)}function kC(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function TAe(e){if(typeof e.webkitGetAsEntry!="function")return lD(e);const t=e.webkitGetAsEntry();return t?.isDirectory?BH(t):lD(e)}function zH(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?zH(n):[n]],[])}function lD(e){const t=e.getAsFile();if(!t)return Promise.reject(`${e} is not a File`);const n=ly(t);return Promise.resolve(n)}async function $Ae(e){return e.isDirectory?BH(e):RAe(e)}function BH(e){const t=e.createReader();return new Promise((n,r)=>{const o=[];function i(){t.readEntries(async s=>{if(s.length){const a=Promise.all(s.map($Ae));o.push(a),i()}else try{const a=await Promise.all(o);n(a)}catch(a){r(a)}},s=>{r(s)})}i()})}async function RAe(e){return new Promise((t,n)=>{e.file(r=>{const o=ly(r,e.fullPath);t(o)},r=>{n(r)})})}const MC={enter:["dragenter","dragover","dragstart"],leave:["dragleave","drop"]},cD=[...MC.enter,...MC.leave];function kAe({onDropped:e,onOver:t,onLeave:n}){const[r,o]=w.useState(!1),i=w.useRef(null),s=w.useRef(!1),a=w.useCallback(p=>{p.preventDefault(),p.stopPropagation()},[]),c=w.useCallback(async p=>{const g=MC.enter.includes(p.type);t&&g!==r&&!s.current&&(t(await fb(p),p),s.current=!0),o(g),g===!1&&s.current&&(s.current=!1,n?.())},[]),u=w.useCallback(async p=>{const g=await fb(p);e?.(g),s.current=!1},[e]),f=w.useCallback(async p=>{const g=await fb(p);e?.(g)},[e]);return w.useEffect(()=>{const p=i.current;return cD.forEach(g=>{p.addEventListener(g,a),p.addEventListener(g,c)}),p.addEventListener("drop",u),()=>{cD.forEach(g=>{p.removeEventListener(g,a),p.removeEventListener(g,c)}),p.removeEventListener("drop",u)}},[]),{ref:i,isOver:r,fromEvent:fb,onDropped:e,handleFileInputChange:f}}function MAe(e,t={overrides:{},baseUrl:""}){return{body:`${t.baseUrl}/api/media/file/${e.path}`,path:e.path,name:e.path,size:e.size??0,type:e.mime_type??"",state:"uploaded",progress:0,...t.overrides}}function PAe(e,t={overrides:{},baseUrl:""}){return e.map(n=>MAe(n,t))}function uD({maxItems:e,current:t=0,overwrite:n,added:r}){if(!e)return{reject:!1,to_drop:0};const o=e-t,i=r>o?r:r-o>0?r-o:0;return{reject:n?r>e:o-r<0,to_drop:i}}const DAe=()=>UA(ey({files:[],isOver:!1,isOverAccepted:!1,uploading:!1},(e,t)=>({setFiles:n=>e(({files:r})=>({files:n(r)})),getFilesLength:()=>t().files.length,setIsOver:(n,r)=>e({isOver:n,isOverAccepted:r}),setUploading:n=>e({uploading:n}),setIsOverAccepted:n=>e({isOverAccepted:n}),reset:()=>e({files:[],isOver:!1,isOverAccepted:!1}),addFile:n=>e(r=>({files:[...r.files,n]})),removeFile:n=>e(r=>({files:r.files.filter(o=>o.path!==n)})),removeAllFiles:()=>e({files:[]}),setFileProgress:(n,r)=>e(o=>({files:o.files.map(i=>i.path===n?{...i,progress:r}:i)})),setFileState:(n,r,o)=>e(i=>({files:i.files.map(s=>s.path===n?{...s,state:r,progress:o??s.progress}:s)})),overrideFile:(n,r)=>e(o=>({files:o.files.map(i=>i.path===n?{...i,...r}:i)}))})));function IAe(e){if(e&&e instanceof XMLHttpRequest){const t=JSON.parse(e.responseText);alert(`Upload failed with code ${e.status}: ${t.error}`)}else alert("Upload failed")}function LAe({getUploadInfo:e,handleDelete:t,initialItems:n=[],flow:r="start",allowedMimeTypes:o,maxItems:i,overwrite:s,autoUpload:a,placeholder:c,onRejected:u,onDeleted:f,onUploadedAll:p,onUploaded:g,children:y,onClick:v,footer:x}){const S=w.useRef(DAe()).current,E=Pr(S,D=>D.files),C=Pr(S,D=>D.setFiles),_=Pr(S,D=>D.getFilesLength),j=Pr(S,D=>D.setUploading),A=Pr(S,D=>D.setIsOver),T=Pr(S,D=>D.uploading),k=Pr(S,D=>D.setFileState),R=Pr(S,D=>D.overrideFile),V=Pr(S,D=>D.removeFile),H=w.useRef(null);w.useEffect(()=>{C(()=>n)},[n.length]);function F(D){return(Array.isArray(D)?D:[D]).map(Q=>({kind:"kind"in Q?Q.kind:"file",type:Q.type,size:"size"in Q?Q.size:0})).every(Q=>Q.kind!=="file"?(console.warn("file not accepted: not a file",Q.kind),!1):o&&o.length>0&&!vie(D,o)?(console.warn("file not accepted: not allowed mimetype",Q.type),!1):!0)}const B=w.useCallback(D=>{if(console.log("onDropped",D),!F(D))return;const W=D.length;C(K=>{let Q=0;if(i){const me=uD({maxItems:i,overwrite:s,added:W,current:K.length});if(me.reject)return u?u(D):console.warn("maxItems reached"),K;Q=me.to_drop}const ie=K.slice(Q),pe=ie.map(me=>me.path),ue=D.filter(me=>!("path"in me)||me.path&&!pe.includes(me.path)).map(me=>({body:me,path:"path"in me?me.path:me.name,name:me.name,size:me.size,type:me.type,state:"pending",progress:0})),se=r==="start"?[...ue,...ie]:[...ie,...ue];return a&&ue.length>0&&setTimeout(()=>j(!0),0),se})},[a,r,i,s]),{handleFileInputChange:U,ref:M}=kAe({onDropped:D=>{console.log("onDropped",D),B(D)},onOver:D=>{if(!F(D)){A(!0,!1);return}const W=_(),K=uD({maxItems:i,overwrite:s,added:D.length,current:W});console.log("--files in onOver",W,K),A(!0,!K.reject)},onLeave:()=>{A(!1,!1)}});w.useEffect(()=>{console.log("files updated")},[E]),w.useEffect(()=>{T&&(async()=>{const D=E.filter(W=>W.state==="pending");if(D.length===0){j(!1);return}else{const W=[];for(const K of D)try{const Q=await z(K);W.push(Q),g?.(Q)}catch(Q){IAe(Q)}j(!1),p?.(W)}})()},[T]);function z(D){return new Promise((W,K)=>{if(D.body){if(D.state!=="pending"){console.error("File is not pending"),K();return}else if(!(D.body instanceof File)){console.error("File body is not a File instance"),K();return}}else{console.error("File has no body"),K();return}const Q=e({path:D.body.path});console.log("dropzone:uploadInfo",Q);const{url:ie,headers:pe,method:ue="POST"}=Q,se=new XMLHttpRequest;console.log("xhr:url",ie);const me=new URLSearchParams;s&&me.append("overwrite","1"),se.open(ue,String(ie)+"?"+String(me),!0),pe&&pe.forEach((je,_e)=>{se.setRequestHeader(_e,je)}),se.upload.addEventListener("progress",je=>{if(console.log("progress",je.loaded,je.total),je.lengthComputable){k(D.path,"uploading",je.loaded/je.total);const _e=je.loaded/je.total*100;console.log(`Progress: ${_e.toFixed(2)}%`)}else console.log("Unable to compute progress information since the total size is unknown")}),se.onload=()=>{if(console.log("onload",D.path,se.status),se.status>=200&&se.status<300){console.log("Upload complete");try{const je=JSON.parse(se.responseText);console.log("Response:",D,je);const _e={...je.state,progress:1,state:"uploaded"};R(D.path,_e),W({...je,...D,..._e})}catch(je){k(D.path,"uploaded",1),console.error("Error parsing response",je),K(je)}}else k(D.path,"failed",1),console.error("Upload failed with status: ",se.status,se.statusText),K(se)},se.onerror=()=>{console.error("Error during the upload process.")},se.onloadstart=()=>{k(D.path,"uploading",0),console.log("loadstart")},se.setRequestHeader("Accept","application/json");const xe=new FormData;xe.append("file",D.body),se.send(xe)})}const $=w.useCallback(async D=>{switch(console.log("deleteFile",D),D.state){case"uploaded":case"initial":window.confirm("Are you sure you want to delete this file?")&&(console.log('setting state to "deleting"',D),k(D.path,"deleting"),await t(D),V(D.path),f?.(D));break}},[]),L=w.useCallback(async D=>{const W=await z(D);p?.([W]),g?.(W)},[]),P=w.useCallback(()=>H.current?.click(),[H]),q=w.useMemo(()=>!!(c?.show!==!1&&(!i||i&&E.length<i)),[c,i,E.length]),Y=w.useMemo(()=>({store:S,wrapperRef:M,inputProps:{ref:H,type:"file",multiple:!i||i>1,onChange:U,accept:o?.join(",")},showPlaceholder:q,actions:{uploadFile:L,deleteFile:$,openFileInput:P,addFiles:B},dropzoneProps:{maxItems:i,placeholder:c,autoUpload:a,flow:r,allowedMimeTypes:o},onClick:v,footer:x}),[i,E.length,r,c,a,x,o]);return h.jsx(VH.Provider,{value:Y,children:y?typeof y=="function"?y(Y):y:h.jsx(BAe,{...Y})})}const VH=w.createContext(void 0);function UH(){return w.useContext(VH)}const FAe=()=>{const{store:e}=UH(),t=Pr(e,i=>i.files),n=Pr(e,i=>i.isOver),r=Pr(e,i=>i.isOverAccepted),o=Pr(e,i=>i.uploading);return{files:t,isOver:n,isOverAccepted:r,uploading:o}},u1=(e,t)=>{const{store:n}=UH();return Pr(n,r=>{const o=typeof e=="string"?r.files.find(i=>i.path===e):r.files.find(i=>i.path===e.path);return o?t(o):void 0})};function zAe(e){if(e&&e instanceof XMLHttpRequest){const t=JSON.parse(e.responseText);alert(`Upload failed with code ${e.status}: ${t.error}`)}else alert("Upload failed")}const BAe=({wrapperRef:e,inputProps:t,showPlaceholder:n,actions:{uploadFile:r,deleteFile:o,openFileInput:i},dropzoneProps:{placeholder:s,flow:a,maxItems:c,allowedMimeTypes:u},onClick:f,footer:p})=>{const{files:g,isOver:y,isOverAccepted:v}=FAe(),x=n&&h.jsx(VAe,{onClick:i,text:s?.text}),S=w.useCallback(async E=>{try{return await r(E)}catch(C){zAe(C)}},[r]);return h.jsxs("div",{ref:e,className:Be("dropzone w-full h-full align-start flex flex-col select-none",y&&v&&"bg-green-200/10",y&&!v&&"bg-red-200/40 cursor-not-allowed"),children:[h.jsx("div",{className:"hidden",children:h.jsx("input",{...t})}),h.jsx("div",{className:"flex flex-1 flex-col",children:h.jsxs("div",{className:"flex flex-row flex-wrap gap-2 md:gap-3",children:[a==="start"&&x,g.map(E=>h.jsx(HAe,{file:E,handleUpload:S,handleDelete:o,onClick:f},E.path)),a==="end"&&x,p]})})]})},VAe=({onClick:e,text:t="Upload files"})=>h.jsx("div",{className:"w-[49%] aspect-square md:w-60 flex flex-col border-2 border-dashed border-muted relative justify-center items-center text-primary/30 hover:border-primary/30 hover:text-primary/50 hover:cursor-pointer hover:bg-muted/20 transition-colors duration-200",onClick:e,children:h.jsx("span",{className:"",children:t})}),UAe=({file:e,fallback:t,...n})=>e.type.startsWith("image/")?h.jsx(JAe,{...n,file:e}):e.type.startsWith("video/")?h.jsx(YAe,{...n,file:e}):t?t({file:e}):null,HH=w.memo(UAe,(e,t)=>e.file.path===t.file.path),HAe=w.memo(({file:e,handleUpload:t,handleDelete:n,onClick:r})=>{SAe();const o=u1(e,s=>{const{progress:a,...c}=s;return c});if(!o)return null;const i=w.useCallback(()=>{r&&r(o)},[r,o.path]);return h.jsxs("div",{className:Be("w-[49%] md:w-60 aspect-square flex flex-col border border-muted relative hover:bg-primary/5 cursor-pointer transition-colors",o.state==="failed"&&"border-red-500 bg-red-200/20",o.state==="deleting"&&"opacity-70"),onClick:i,children:[h.jsx("div",{className:"absolute top-2 right-2",children:h.jsx(WAe,{file:o,handleDelete:n,handleUpload:t})}),h.jsx(qAe,{file:o}),h.jsx("div",{className:"flex bg-primary/5 aspect-[1/0.78] overflow-hidden items-center justify-center",children:h.jsx(HH,{file:o,fallback:XAe,className:"max-w-full max-h-full"})}),h.jsxs("div",{className:"flex flex-col px-1.5 py-1",children:[h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[h.jsx("p",{className:"truncate select-text w-[calc(100%-10px)]",children:o.name}),h.jsx(GAe,{file:o})]}),h.jsxs("div",{className:"flex flex-row justify-between text-xs md:text-sm font-mono opacity-50 text-nowrap gap-2",children:[h.jsx("span",{className:"truncate select-text",children:o.type}),h.jsx("span",{className:"whitespace-nowrap",children:rw.fileSize(o.size)})]})]})]})},(e,t)=>e.file.path===t.file.path&&e.file.state===t.file.state),qAe=({file:e})=>{const t=u1(e.path,n=>({state:n.state,progress:n.progress}));return!t||t.state!=="uploading"?null:h.jsx("div",{className:"absolute w-full top-0 left-0 right-0 h-1",children:h.jsx("div",{className:"bg-blue-600 h-1 transition-all duration-75",style:{width:(t.progress*100).toFixed(0)+"%"}})})},WAe=w.memo(({file:e,handleDelete:t,handleUpload:n})=>{const r=u1(e.path,i=>{const{progress:s,...a}=i;return a});if(!r)return null;const o=w.useMemo(()=>[r.state==="uploaded"&&typeof r.body=="string"&&{label:"Open",icon:bSe,onClick:()=>{window.open(r.body,"_blank")}},["initial","uploaded"].includes(r.state)&&{label:"Delete",destructive:!0,icon:XA,onClick:()=>t(r)},["initial","pending"].includes(r.state)&&{label:"Upload",icon:zSe,onClick:()=>n(r)}],[r,t,n]);return h.jsx(Nr,{items:o,position:"bottom-end",children:h.jsx(ft,{Icon:Ha})})},(e,t)=>e.file.path===t.file.path),GAe=({file:e})=>{const t=u1(e.path,r=>r.state);if(!t||t==="uploaded")return null;const n={failed:"bg-red-500",deleting:"bg-orange-500 animate-pulse",uploading:"bg-blue-500 animate-pulse"}[t]??"bg-primary/50";return h.jsx("div",{className:"w-2 h-2 rounded-full mt-px "+n,title:t})},JAe=({file:e,...t})=>{const n=typeof e.body=="string"?e.body:URL.createObjectURL(e.body);return h.jsx("img",{...t,src:n})},YAe=({file:e,...t})=>{const n=typeof e.body=="string"?e.body:URL.createObjectURL(e.body);return h.jsx("video",{...t,src:n})},KAe=[{mime:"text/plain",Icon:NSe},{mime:"text/csv",Icon:wSe},{mime:/(text|application)\/xml/,Icon:_Se},{mime:"text/markdown",Icon:RSe},{mime:/^text\/.*$/,Icon:xSe},{mime:"application/json",Icon:$Se},{mime:"application/pdf",Icon:SSe},{mime:/^audio\/.*$/,Icon:DSe},{mime:"application/zip",Icon:HSe},{mime:"application/sql",Icon:ESe}],XAe=({file:e})=>{const t=KAe.find(n=>n.mime instanceof RegExp?n.mime.test(e.type):n.mime===e.type);return t?h.jsx(t.Icon,{className:"size-10 text-gray-400"}):h.jsx("div",{className:"text-xs text-primary/50 text-center font-mono leading-none max-w-[90%] truncate",children:e.type})};function qH({initialItems:e,media:t,entity:n,query:r,randomFilename:o,infinite:i=!1,...s}){const a=w.useId(),c=ss(),u=PA(),f=c.baseUrl,p=r?.limit??s.maxItems??50,g=k=>({limit:p,offset:k*p}),y=t?.entity_name??"media",v=(k,R=0)=>n?k.data.readManyByReference(n.name,n.id,n.field,{...g(R),...r}):k.data.readMany(y,{...g(R),...r}),x=i?dve(v,{pageSize:p}):Zg(v,{enabled:e!==!1&&!e,revalidateOnFocus:!1}),S=It(k=>({url:n?c.media.getEntityUploadUrl(n.name,n.id,n.field):c.media.getFileUploadUrl(o?void 0:k),headers:c.media.getUploadHeaders(),method:"POST"}));It(async()=>{await u(x.promise.key({search:!1}))});const E=It(async k=>c.media.deleteFile(k.path)),C=e??(Array.isArray(x.data)?x.data:[])??[],_=PAe(C,{baseUrl:f}),j=a+JSON.stringify(e),A="_data"in x?x._data?.[0]?.body.meta.count:void 0;let T=0;return i&&"setSize"in x&&(T=typeof A=="number"?A:x.endReached?_.length:_.length+p,!A&&!x.isValidating&&p*x.size>=T&&(T=_.length)),h.jsx(LAe,{getUploadInfo:S,handleDelete:E,autoUpload:!0,initialItems:_,footer:i&&"setSize"in x&&h.jsx(QAe,{items:_.length,length:T,onFirstVisible:()=>x.setSize(x.size+1)}),...s},j)}const QAe=({items:e=0,length:t=0,onFirstVisible:n})=>{const{ref:r,inViewport:o}=OX(),[i,s]=w.useState(0),a=w.useRef(-1);return w.useEffect(()=>{o&&e>a.current&&(a.current=e,s(u=>u+1),n())},[o]),t-e<=0?null:new Array(Math.max(t-e,0)).fill(0).map((u,f)=>h.jsx("div",{ref:f===0?r:void 0,className:"w-[49%] md:w-60 bg-muted aspect-square"},f))},WH={Dropzone:qH,Preview:HH};function GH(){const{config:e,schema:t,actions:n}=ot(),r={config:{patch:async i=>await n.set("media",i,!0)?(await n.reload(),!0):!1}};return{$media:{},config:e.media,schema:t.media,actions:r}}const Wf={};function JH(e){return"init"in e}function PC(e){return!!e.write}function dD(e){return"v"in e||"e"in e}function Zv(e){if("e"in e)throw e.e;if((Wf?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}const ex=new WeakMap;function YH(e){var t;return tx(e)&&!!((t=ex.get(e))!=null&&t[0])}function ZAe(e){const t=ex.get(e);t?.[0]&&(t[0]=!1,t[1].forEach(n=>n()))}function DC(e,t){let n=ex.get(e);if(!n){n=[!0,new Set],ex.set(e,n);const r=()=>{n[0]=!1};e.then(r,r)}n[1].add(t)}function tx(e){return typeof e?.then=="function"}function KH(e,t,n){if(!n.p.has(e)){n.p.add(e);const r=()=>n.p.delete(e);t.then(r,r)}}function XH(e,t,n){var r;const o=new Set;for(const i of((r=n.get(e))==null?void 0:r.t)||[])n.has(i)&&o.add(i);for(const i of t.p)o.add(i);return o}const eTe=(e,t,...n)=>t.read(...n),tTe=(e,t,...n)=>t.write(...n),nTe=(e,t)=>{var n;return(n=t.unstable_onInit)==null?void 0:n.call(t,e)},rTe=(e,t,n)=>{var r;return(r=t.onMount)==null?void 0:r.call(t,n)},oTe=(e,t)=>{const n=wr(e),r=n[0],o=n[9];if((Wf?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let i=r.get(t);return i||(i={d:new Map,p:new Set,n:0},r.set(t,i),o?.(e,t)),i},iTe=e=>{const t=wr(e),n=t[1],r=t[3],o=t[4],i=t[5],s=t[6],a=t[13],c=[],u=f=>{try{f()}catch(p){c.push(p)}};do{s.f&&u(s.f);const f=new Set,p=f.add.bind(f);r.forEach(g=>{var y;return(y=n.get(g))==null?void 0:y.l.forEach(p)}),r.clear(),i.forEach(p),i.clear(),o.forEach(p),o.clear(),f.forEach(u),r.size&&a(e)}while(r.size||i.size||o.size);if(c.length)throw new AggregateError(c)},sTe=e=>{const t=wr(e),n=t[1],r=t[2],o=t[3],i=t[11],s=t[14],a=t[17],c=[],u=new WeakSet,f=new WeakSet,p=Array.from(o);for(;p.length;){const g=p[p.length-1],y=i(e,g);if(f.has(g)){p.pop();continue}if(u.has(g)){if(r.get(g)===y.n)c.push([g,y]);else if((Wf?"production":void 0)!=="production"&&r.has(g))throw new Error("[Bug] invalidated atom exists");f.add(g),p.pop();continue}u.add(g);for(const v of XH(g,y,n))u.has(v)||p.push(v)}for(let g=c.length-1;g>=0;--g){const[y,v]=c[g];let x=!1;for(const S of v.d.keys())if(S!==y&&o.has(S)){x=!0;break}x&&(s(e,y),a(e,y)),r.delete(y)}},aTe=(e,t)=>{var n,r;const o=wr(e),i=o[1],s=o[2],a=o[3],c=o[6],u=o[7],f=o[11],p=o[12],g=o[13],y=o[14],v=o[16],x=o[17],S=f(e,t);if(dD(S)&&(i.has(t)&&s.get(t)!==S.n||Array.from(S.d).every(([R,V])=>y(e,R).n===V)))return S;S.d.clear();let E=!0;function C(){i.has(t)&&(x(e,t),g(e),p(e))}function _(R){var V;if(R===t){const F=f(e,R);if(!dD(F))if(JH(R))nx(e,R,R.init);else throw new Error("no atom init");return Zv(F)}const H=y(e,R);try{return Zv(H)}finally{S.d.set(R,H.n),YH(S.v)&&KH(t,S.v,H),(V=i.get(R))==null||V.t.add(t),E||C()}}let j,A;const T={get signal(){return j||(j=new AbortController),j.signal},get setSelf(){return(Wf?"production":void 0)!=="production"&&!PC(t)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&PC(t)&&(A=(...R)=>{if((Wf?"production":void 0)!=="production"&&E&&console.warn("setSelf function cannot be called in sync"),!E)try{return v(e,t,...R)}finally{g(e),p(e)}}),A}},k=S.n;try{const R=u(e,t,_,T);return nx(e,t,R),tx(R)&&(DC(R,()=>j?.abort()),R.then(C,C)),(n=c.r)==null||n.call(c,t),S}catch(R){return delete S.v,S.e=R,++S.n,S}finally{E=!1,k!==S.n&&s.get(t)===k&&(s.set(t,S.n),a.add(t),(r=c.c)==null||r.call(c,t))}},lTe=(e,t)=>{const n=wr(e),r=n[1],o=n[2],i=n[11],s=[t];for(;s.length;){const a=s.pop(),c=i(e,a);for(const u of XH(a,c,r)){const f=i(e,u);o.set(u,f.n),s.push(u)}}},QH=(e,t,...n)=>{const r=wr(e),o=r[3],i=r[6],s=r[8],a=r[11],c=r[12],u=r[13],f=r[14],p=r[15],g=r[17];let y=!0;const v=S=>Zv(f(e,S)),x=(S,...E)=>{var C;const _=a(e,S);try{if(S===t){if(!JH(S))throw new Error("atom not writable");const j=_.n,A=E[0];nx(e,S,A),g(e,S),j!==_.n&&(o.add(S),(C=i.c)==null||C.call(i,S),p(e,S));return}else return QH(e,S,...E)}finally{y||(u(e),c(e))}};try{return s(e,t,v,x,...n)}finally{y=!1}},cTe=(e,t)=>{var n;const r=wr(e),o=r[1],i=r[3],s=r[6],a=r[11],c=r[15],u=r[18],f=r[19],p=a(e,t),g=o.get(t);if(g&&!YH(p.v)){for(const[y,v]of p.d)if(!g.d.has(y)){const x=a(e,y);u(e,y).t.add(t),g.d.add(y),v!==x.n&&(i.add(y),(n=s.c)==null||n.call(s,y),c(e,y))}for(const y of g.d||[])if(!p.d.has(y)){g.d.delete(y);const v=f(e,y);v?.t.delete(t)}}},ZH=(e,t)=>{var n;const r=wr(e),o=r[1],i=r[4],s=r[6],a=r[10],c=r[11],u=r[12],f=r[13],p=r[14],g=r[16],y=c(e,t);let v=o.get(t);if(!v){p(e,t);for(const x of y.d.keys())ZH(e,x).t.add(t);if(v={l:new Set,d:new Set(y.d.keys()),t:new Set},o.set(t,v),(n=s.m)==null||n.call(s,t),PC(t)){const x=()=>{let S=!0;const E=(...C)=>{try{return g(e,t,...C)}finally{S||(f(e),u(e))}};try{const C=a(e,t,E);C&&(v.u=()=>{S=!0;try{C()}finally{S=!1}})}finally{S=!1}};i.add(x)}}return v},uTe=(e,t)=>{var n;const r=wr(e),o=r[1],i=r[5],s=r[6],a=r[11],c=r[19],u=a(e,t);let f=o.get(t);if(f&&!f.l.size&&!Array.from(f.t).some(p=>{var g;return(g=o.get(p))==null?void 0:g.d.has(t)})){f.u&&i.add(f.u),f=void 0,o.delete(t),(n=s.u)==null||n.call(s,t);for(const p of u.d.keys()){const g=c(e,p);g?.t.delete(t)}return}return f},nx=(e,t,n)=>{const r=wr(e)[11],o=r(e,t),i="v"in o,s=o.v;if(tx(n))for(const a of o.d.keys())KH(t,n,r(e,a));o.v=n,delete o.e,(!i||!Object.is(s,o.v))&&(++o.n,tx(s)&&ZAe(s))},dTe=(e,t)=>{const n=wr(e)[14];return Zv(n(e,t))},fTe=(e,t,...n)=>{const r=wr(e),o=r[12],i=r[13],s=r[16];try{return s(e,t,...n)}finally{i(e),o(e)}},hTe=(e,t,n)=>{const r=wr(e),o=r[12],i=r[18],s=r[19],c=i(e,t).l;return c.add(n),o(e),()=>{c.delete(n),s(e,t),o(e)}},eq=new WeakMap,wr=e=>{const t=eq.get(e);if((Wf?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function pTe(...e){const t={get(r){const o=wr(t)[21];return o(t,r)},set(r,...o){const i=wr(t)[22];return i(t,r,...o)},sub(r,o){const i=wr(t)[23];return i(t,r,o)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},eTe,tTe,nTe,rTe,oTe,iTe,sTe,aTe,lTe,QH,cTe,ZH,uTe,nx,dTe,fTe,hTe,void 0].map((r,o)=>e[o]||r);return eq.set(t,Object.freeze(n)),t}const tq={};let mTe=0;function Gf(e,t){const n=`atom${++mTe}`,r={toString(){return(tq?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?r.read=e:(r.init=e,r.read=gTe,r.write=yTe),t&&(r.write=t),r}function gTe(e){return e(this)}function yTe(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}function bTe(){return pTe()}let Gp;function nq(){return Gp||(Gp=bTe(),(tq?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Gp),globalThis.__JOTAI_DEFAULT_STORE__!==Gp&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Gp}const vTe={},xTe=w.createContext(void 0);function rq(e){return w.useContext(xTe)||nq()}const IC=e=>typeof e?.then=="function",LC=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},wTe=Ne.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(LC(e),e)}),EN=new WeakMap,fD=(e,t)=>{let n=EN.get(e);return n||(n=new Promise((r,o)=>{let i=e;const s=u=>f=>{i===u&&r(f)},a=u=>f=>{i===u&&o(f)},c=()=>{try{const u=t();IC(u)?(EN.set(u,n),i=u,u.then(s(u),a(u)),DC(u,c)):r(u)}catch(u){o(u)}};e.then(s(e),a(e)),DC(e,c)}),EN.set(e,n)),n};function DT(e,t){const{delay:n,unstable_promiseStatus:r=!Ne.use}={},o=rq(),[[i,s,a],c]=w.useReducer(f=>{const p=o.get(e);return Object.is(f[0],p)&&f[1]===o&&f[2]===e?f:[p,o,e]},void 0,()=>[o.get(e),o,e]);let u=i;if((s!==o||a!==e)&&(c(),u=o.get(e)),w.useEffect(()=>{const f=o.sub(e,()=>{if(r)try{const p=o.get(e);IC(p)&&LC(fD(p,()=>o.get(e)))}catch{}if(typeof n=="number"){setTimeout(c,n);return}c()});return c(),f},[o,e,n,r]),w.useDebugValue(u),IC(u)){const f=fD(u,()=>o.get(e));return r&&LC(f),wTe(f)}return u}function IT(e,t){const n=rq();return w.useCallback((...o)=>{if((vTe?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...o)},[n,e])}function kh(e,t){return[DT(e),IT(e)]}const LT={},STe=Symbol((LT?"production":void 0)!=="production"?"RESET":""),NN=(e,t,n)=>(t.has(n)?t:t.set(n,e())).get(n),ETe=new WeakMap,NTe=(e,t,n,r)=>{const o=NN(()=>new WeakMap,ETe,t),i=NN(()=>new WeakMap,o,n);return NN(e,i,r)};function cy(e,t,n=Object.is){return NTe(()=>{const r=Symbol(),o=([s,a])=>{if(a===r)return t(s);const c=t(s,a);return n(a,c)?a:c},i=Gf(s=>{const a=s(i),c=s(e);return o([c,a])});return i.init=r,i},e,t,n)}const oq=e=>typeof e?.then=="function";function _Te(e=()=>{try{return window.localStorage}catch(n){(LT?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},t){var n;let r,o;const i={getItem:(c,u)=>{var f,p;const g=v=>{if(v=v||"",r!==v){try{o=JSON.parse(v,t?.reviver)}catch{return u}r=v}return o},y=(p=(f=e())==null?void 0:f.getItem(c))!=null?p:null;return oq(y)?y.then(g):g(y)},setItem:(c,u)=>{var f;return(f=e())==null?void 0:f.setItem(c,JSON.stringify(u,void 0))},removeItem:c=>{var u;return(u=e())==null?void 0:u.removeItem(c)}},s=c=>(u,f,p)=>c(u,g=>{let y;try{y=JSON.parse(g||"")}catch{y=p}f(y)});let a;try{a=(n=e())==null?void 0:n.subscribe}catch{}return!a&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(a=(c,u)=>{if(!(e()instanceof window.Storage))return()=>{};const f=p=>{p.storageArea===e()&&p.key===c&&u(p.newValue)};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}}),a&&(i.subscribe=s(a)),i}const CTe=_Te();function OTe(e,t,n=CTe,r){const o=Gf(t);return(LT?"production":void 0)!=="production"&&(o.debugPrivate=!0),o.onMount=s=>{s(n.getItem(e,t));let a;return n.subscribe&&(a=n.subscribe(e,s,t)),a},Gf(s=>s(o),(s,a,c)=>{const u=typeof c=="function"?c(s(o)):c;return u===STe?(a(o,t),n.removeItem(e)):oq(u)?u.then(f=>(a(o,f),n.setItem(e,f))):(a(o,u),n.setItem(e,u))})}const jTe={AdditionalItemsError:"Array at `{{pointer}}` may not have an additional item `{{key}}`",AdditionalPropertiesError:"Additional property `{{property}}` on `{{pointer}}` does not match schema `{{schema}}`",AllOfError:"Value `{{value}}` at `{{pointer}}` does not match schema of `{{allOf}}`",AnyOfError:"Value `{{value}}` at `{{pointer}}` does not match any schema of `{{anyOf}}`",ConstError:"Expected value at `{{pointer}}` to be `{{expected}}`, but value given is `{{value}}`",containsAnyError:"The array at `{{pointer}}` must contain at least one item",ContainsArrayError:"The property at `{{pointer}}` must not be an array",ContainsError:"The array at `{{pointer}}` must contain an element that matches `{{schema}}`",ContainsMinError:"The array at `{{pointer}}` contains {{delta}} too few items matching `{{schema}}`",ContainsMaxError:"The array at `{{pointer}}` contains {{delta}} too many items matching `{{schema}}`",EnumError:"Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`",ForbiddenPropertyError:"Property name `{{property}}` at `{{pointer}}` is not allowed",FormatDateError:"Value `{{value}}` at `{{pointer}}` is not a valid date",FormatDateTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid date-time",FormatDurationError:"Value `{{value}}` at `{{pointer}}` is not a valid duration",FormatEmailError:"Value `{{value}}` at `{{pointer}}` is not a valid email",FormatHostnameError:"Value `{{value}}` at `{{pointer}}` is not a valid hostname",FormatIPV4Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv4 address",FormatIPV4LeadingZeroError:"IPv4 addresses starting with zero are invalid, since they are interpreted as octals",FormatIPV6Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv6 address",FormatIPV6LeadingZeroError:"IPv6 addresses starting with zero are invalid, since they are interpreted as octals",FormatJsonPointerError:"Value `{{value}}` at `{{pointer}}` is not a valid json-pointer",FormatRegExError:"Value `{{value}}` at `{{pointer}}` is not a valid regular expression",FormatTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid time",FormatURIError:"Value `{{value}}` at `{{pointer}}` is not a valid uri",FormatURIReferenceError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-reference",FormatURITemplateError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-template",FormatURLError:"Value `{{value}}` at `{{pointer}}` is not a valid url",FormatUUIDError:"Value `{{value}}` at `{{pointer}}` is not a valid uuid",InvalidDataError:"No value may be specified in `{{pointer}}`",InvalidPropertyNameError:"Invalid property name `{{property}}` at `{{pointer}}`",MaximumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{maximum}}` at maximum",MaxItemsError:"Too many items in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`",MaxLengthError:"Value `{{pointer}}` should have a maximum length of `{{maxLength}}`, but got `{{length}}`.",MaxPropertiesError:"Too many properties in `{{pointer}}`, should be `{{maxProperties}}` at most, but got `{{length}}`",MinimumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{minimum}}` at minimum",MinItemsError:"Too few items in `{{pointer}}`, should be at least `{{minItems}}`, but got `{{length}}`",MinItemsOneError:"At least one item is required in `{{pointer}}`",MinLengthError:"Value `{{pointer}}` should have a minimum length of `{{minLength}}`, but got `{{length}}`.",MinLengthOneError:"A value is required in `{{pointer}}`",MinPropertiesError:"Too few properties in `{{pointer}}`, should be at least `{{minProperties}}`, but got `{{length}}`",MissingDependencyError:"The required propery '{{missingProperty}}' in `{{pointer}}` is missing",MissingOneOfPropertyError:"Value at `{{pointer}}` property: `{{property}}`",MultipleOfError:"Expected `{{value}}` in `{{pointer}}` to be multiple of `{{multipleOf}}`",MultipleOneOfError:"Value `{{value}}` should not match multiple schemas in oneOf `{{matches}}`",NoAdditionalPropertiesError:"Additional property `{{property}}` in `{{pointer}}` is not allowed",NotError:"Value `{{value}}` at pointer should not match schema `{{not}}`",OneOfError:"Value `{{value}}` in `{{pointer}}` does not match any given oneof schema",OneOfPropertyError:"Failed finding a matching oneOfProperty schema in `{{pointer}}` where `{{property}}` matches `{{value}}`",PatternError:"Value in `{{pointer}}` should match `{{description}}`, but received `{{received}}`",PatternPropertiesError:"Property `{{key}}` does not match any patterns in `{{pointer}}`. Valid patterns are: {{patterns}}",RequiredPropertyError:"The required property `{{key}}` is missing at `{{pointer}}`",SchemaWarning:"Failed retrieving a schema from '{{pointer}}' to key '{{key}}'",TypeError:"Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`",UndefinedValueError:"Value must not be undefined in `{{pointer}}`",UnevaluatedPropertyError:"Invalid unevaluated property `{{pointer}}`",UnevaluatedItemsError:"Invalid unevaluated item `{{pointer}}`",UniqueItemsError:"Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.",UnknownPropertyError:"Could not find a valid schema for property `{{pointer}}` within object",ValueNotEmptyError:"A value for `{{property}}` is required at `{{pointer}}`"},ATe=Object.prototype.toString;function Ot(e){const t=ATe.call(e).match(/\s([^\]]+)\]/).pop().toLowerCase();return t==="file"?"object":t}const TTe="object",$Te="array";function RTe(e,t={}){return e.replace(/\{\{\w+\}\}/g,n=>{const r=n.replace(/[{}]/g,""),o=t[r],i=Ot(o);return i===TTe||i===$Te?JSON.stringify(o):o})}function kTe(e,t,n=e){var r;const o=(r=jTe[e])!==null&&r!==void 0?r:n;return RTe(o,t)}function MTe(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function PTe(e,t){return{type:"error",name:e,code:MTe(e),message:kTe(e,t),data:t}}function Je(e){return PTe.bind(null,e)}function hg(e,t=[]){for(let n=0;n<e.length;n+=1){const r=e[n];Array.isArray(r)?hg(r,t):t.push(r)}return t}const uy={DECLARATOR_ONEOF:"oneOfProperty",GET_TEMPLATE_RECURSION_LIMIT:1,propertyBlacklist:["_id"],templateDefaultOptions:{addOptionalProps:!1,removeInvalidData:!1,extendDefaults:!0}};function Un(e){return e?.type==="error"}function DTe(e){return e instanceof Promise}function rx(e){return Un(e)||DTe(e)}function Dt(e){return Ot(e)==="object"}const{DECLARATOR_ONEOF:vf}=uy;function Sm(e,t){Dt(e)&&(e.__oneOfIndex=t)}function ITe(e,t){const{schema:n,draft:r,pointer:o}=e;if(t!=null&&n[vf]){const a=[],c=n[vf],u=t[n[vf]];if(u===void 0)return r.errors.missingOneOfPropertyError({property:c,pointer:o,schema:n,value:t});for(let f=0;f<n.oneOf.length;f+=1){const p=e.next(n.oneOf[f]).resolveRef(),g=r.step(p,c,t);if(Un(g))return g;let y=hg(r.validate(g,u));if(y=y.filter(rx),y.length>0)a.push(...y);else return Sm(p.schema,f),g.next(p.schema)}return r.errors.oneOfPropertyError({property:c,value:u,pointer:o,schema:n,errors:a})}const i=[],s=[];for(let a=0;a<n.oneOf.length;a+=1){const c=r.resolveRef(e.next(n.oneOf[a]));let u=hg(r.validate(c,t));u=u.filter(rx),u.length>0?s.push(...u):i.push({index:a,schema:c.schema})}return i.length===1?(Sm(i[0].schema,i[0].index),e.next(i[0].schema)):i.length>1?r.errors.multipleOneOfError({value:t,pointer:o,schema:n,matches:i}):r.errors.oneOfError({value:JSON.stringify(t),pointer:o,schema:n,oneOf:n.oneOf,errors:s})}function LTe(e,t){const{draft:n,schema:r,pointer:o}=e;if(t==null||r.properties==null)return-1;let i=0;const s=Object.keys(r.properties);for(let a=0;a<s.length;a+=1){const c=s[a];t[c]&&n.isValid(t[c],r.properties[c],o)&&(i+=1)}return i}function FT(e,t){const{schema:n,pointer:r,draft:o}=e;if(!Array.isArray(n.oneOf))throw new Error("not a oneof schema");if(t!=null&&n[vf]){const s=[],a=n[vf],c=t[n[vf]];if(c===void 0)return o.errors.missingOneOfPropertyError({property:a,pointer:r,schema:n,value:t});for(let u=0;u<n.oneOf.length;u+=1){const f=o.resolveRef(e.next(n.oneOf[u])),p=o.step(f,a,t);if(Un(p))return p;let g=hg(o.validate(p,c));if(g=g.filter(rx),g.length>0)s.push(...g);else return Sm(f.schema,u),p.next(f.schema)}return o.errors.oneOfPropertyError({property:a,value:c,pointer:r,schema:n,errors:s})}const i=[];for(let s=0;s<n.oneOf.length;s+=1){const c=o.resolveRef(e.next(n.oneOf[s])).schema;o.isValid(t,c,r)&&i.push({schema:c,index:s})}if(i.length===1)return Sm(i[0].schema,i[0].index),e.next(i[0].schema);if(Dt(t)){let s,a=-1,c=0;for(let u=0;u<n.oneOf.length;u+=1){const f=o.resolveRef(e.next(n.oneOf[u])),p=LTe(f,t);c<p&&(c=p,s=f.schema,a=u)}return s===void 0?o.errors.oneOfError({value:JSON.stringify(t),pointer:r,schema:n,oneOf:n.oneOf}):(Sm(s,a),e.next(s))}return i.length>1?o.errors.multipleOneOfError({matches:i,pointer:r,schema:n,value:t}):o.errors.oneOfError({value:JSON.stringify(t),pointer:r,schema:n,oneOf:n.oneOf})}const FTe=(e,t)=>{if(Array.isArray(e.schema.oneOf)){const n=e.draft.resolveOneOf(e,t);if(Un(n))return n}};function ro(e,t,...n){if(t?.type==="error")return t;if(e?.type==="error")return e;const r=Ot(e),o=Ot(t);if(r!==o)return e;const i=Ub(e,t);for(let s=0;s<n.length;s+=1)delete i[n[s]];return i}function Ub(e,t,n){var r;if(Dt(e)&&Dt(t)){const o={};return[...Object.keys(e),...Object.keys(t)].filter((i,s,a)=>a.indexOf(i)===s).forEach(i=>o[i]=Ub(e[i],t[i],i)),o}if(Array.isArray(e)&&Array.isArray(t)){if(n==="required")return e.concat(t).filter((s,a,c)=>c.indexOf(s)===a);if(n==="items"){const s=[];for(let a=0;a<t.length;a+=1)Dt(e[a])&&Dt(t[a])&&e[a].type===t[a].type?s[a]=Ub(e[a],t[a]):s.push((r=t[a])!==null&&r!==void 0?r:e[a]);return s}const o=[],i=[];for(let s=0;s<Math.max(e.length,t.length);s+=1)Dt(e[s])&&Dt(t[s])?o[s]=Ub(e[s],t[s]):e[s]!==void 0&&t[s]!==void 0?(o[s]=e[s],i.push(t[s])):e[s]!==void 0?o[s]=e[s]:t[s]!==void 0&&i.push(t[s]);return[...o,...i].filter((s,a,c)=>c.indexOf(s)===a)}return Array.isArray(t)?t:Array.isArray(e)?e:t!==void 0?t:e}function FC(e,...t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function d1(e,t){if(e.schema.if!=null){if(e.schema.if===!1)return e.next(e.schema.else);if(e.schema.if&&(e.schema.then||e.schema.else)){const n=e.draft.resolveRef(e.next(e.schema.if)),r=e.draft.validate(n,t);if(r.length===0&&e.schema.then){const o=e.next(e.schema.then);return e.draft.resolveRef(o)}if(r.length!==0&&e.schema.else){const o=e.next(e.schema.else);return e.draft.resolveRef(o)}}}}const zTe=(e,t)=>{const n=d1(e,t);if(n)return e.draft.validate(n,t)};function iq(e){return{...e}}function sq(e,t){const n=d1(e,t);if(n)return n;const r=iq(e.schema);return e.next(FC(r,"if","then","else"))}function BTe(e,t){const{schema:n}=e;let r=iq(n);for(let o=0;o<n.allOf.length;o+=1){const i=e.next(n.allOf[o]).resolveRef(),s=sq(i,t).schema;r=ro(r,s)}return delete r.allOf,e.next(r)}function aq(e,t){const{allOf:n}=t;if(!Array.isArray(n)||n.length===0)return;let r={};return n.forEach(o=>{if(o==null)return;const i=e.createNode(o).resolveRef();r=ro(r,i.schema)}),r}const VTe=(e,t)=>{const{draft:n,schema:r}=e,{allOf:o}=r;if(!Array.isArray(o)||o.length===0)return;const i=[];return r.allOf.forEach(s=>{i.push(...n.validate(e.next(s),t))}),i};function UTe(e,...t){if(e==null)throw new Error("undefined schema");const n=this,r=ro(n.schema,e,...t);return{...n,schema:r,path:[...n.path,[n.pointer,n.schema]]}}function HTe(){const e=this;return e.draft.resolveRef(e)}function qTe(e,t){if(Un(e))return e;if(e==null)throw new Error("undefined schema");if(!Dt(e)&&Ot(e)!=="boolean")throw new Error(`bad schema type ${Ot(e)}`);const n=this;return{...n,pointer:t?`${n.pointer}/${t}`:n.pointer,schema:e,path:[...n.path,[n.pointer,n.schema]]}}function Ji(e){return Dt(e)&&e.next&&e.path&&e.draft}function WTe(e,t,n="#"){return{draft:e,pointer:n,schema:t,path:[],next:qTe,merge:UTe,resolveRef:HTe}}function GTe(e){const t=e.path;let n=0;for(let o=t.length-1;o>=0;o--){const i=t[o][1];if(i.$id&&/^https?:\/\//.test(i.$id)&&i.$recursiveAnchor!==!0){n=o;break}}const r=t.find((o,i)=>i>=n&&o[1].$recursiveAnchor===!0);if(r)return e.next(r[1]);for(let o=t.length-1;o>=0;o--){const i=t[o][1];if(i.$id)return e.next(i)}return e.next(e.draft.rootSchema)}function lq(e){if(!Ji(e))throw new Error("expected node");if(e.schema==null)return e;if(e.schema.$recursiveRef)return lq(GTe(e));if(e.schema.$ref==null)return e;const t=e.draft.rootSchema.getRef(e.schema);return t===!1?e.next(t):e.merge(t,"$ref")}function JTe(e){return e.filter((t,n)=>e.indexOf(t)===n)}function cq(e,t){var n;const{schema:r}=e,o=(n=r.dependencies)!==null&&n!==void 0?n:r.dependentSchemas;if(!Dt(o)||!Dt(t))return;let i=!1,s={required:[]};if(Object.keys(o).forEach(a=>{var c,u;if(t[a]==null&&!(!((c=r.required)===null||c===void 0)&&c.includes(a)||!((u=s.required)===null||u===void 0)&&u.includes(a)))return;const f=o[a];if(Array.isArray(f)){i=!0,s.required.push(...f);return}if(Dt(f)){i=!0;const p=e.next(f).resolveRef();s=ro(s,p.schema);return}}),i)return s.required=JTe(s.required),s}const YTe=(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=r.dependentRequired;if(!Dt(i))return;const s=[];return Object.keys(t).forEach(a=>{const c=i[a];if(c!==!0){if(c===!1){s.push(n.errors.missingDependencyError({pointer:o,schema:r,value:t}));return}if(Array.isArray(c))for(let u=0,f=c.length;u<f;u+=1)t[c[u]]===void 0&&s.push(n.errors.missingDependencyError({missingProperty:c[u],pointer:o,schema:r,value:t}))}}),s},KTe=(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=r.dependentSchemas;if(!Dt(i))return;const s=[];return Object.keys(t).forEach(a=>{const c=i[a];if(c!==!0){if(c===!1){s.push(n.errors.missingDependencyError({pointer:o,schema:r,value:t}));return}Dt(c)&&n.validate(e.next(c),t).map(u=>s.push(u))}}),s},XTe=(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=r.dependencies;if(!Dt(i))return;const s=[];return Object.keys(t).forEach(a=>{if(i[a]===void 0||i[a]===!0)return;if(i[a]===!1){s.push(n.errors.missingDependencyError({pointer:o,schema:r,value:t}));return}let c;const u=Ot(i[a]),f=i[a];if(Array.isArray(f))c=f.filter(p=>t[p]===void 0).map(p=>n.errors.missingDependencyError({missingProperty:p,pointer:o,schema:r,value:t}));else if(u==="object")c=n.validate(e.next(i[a]),t);else throw new Error(`Invalid dependency definition for ${o}/${a}. Must be string[] or schema`);s.push(...c)}),s.length>0?s:void 0};function uq(e,t){const{draft:n,schema:r}=e;if(!Array.isArray(r.anyOf)||r.anyOf.length===0)return;let o;if(r.anyOf.forEach(i=>{const s=n.resolveRef(e.next(i));n.validate(s,t).length===0&&(o=o?ro(o,s.schema):s.schema)}),o)return e.next(o)}function QTe(e,t){const{anyOf:n}=e.schema;if(!Array.isArray(n)||n.length===0)return e;const r=uq(e,t);if(r){const{pointer:o,schema:i}=e;return e.draft.errors.anyOfError({pointer:o,schema:i,value:t,anyOf:JSON.stringify(n)})}return e.merge(r.schema,"anyOf")}const ZTe=(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(!Array.isArray(r.anyOf)||r.anyOf.length===0)){for(let i=0;i<r.anyOf.length;i+=1){const s=n.resolveRef(e.next(r.anyOf[i]));if(n.validate(s,t).length===0)return}return n.errors.anyOfError({pointer:o,schema:r,value:t,anyOf:r.anyOf})}},hD=["allOf","anyOf","oneOf","dependencies","if","then","else"],e$e=["allOf","anyOf","oneOf","dependencies","if"];function t$e(e){const t=Object.keys(e);return e$e.findIndex(n=>t.includes(n))!==-1}function zC(e,t){let n,r;const o=e.draft.resolveRef(e),{draft:i}=o,s=Ji(o)?o.schema:o;if(s.oneOf){const g=FT(o,t);Un(g)?r=g:g&&(n=ro(n??{},g.schema))}if(Array.isArray(s.allOf)){const g=s.allOf.map(y=>{if(t$e(y)){const v=zC(o.next(y),t);if(v==null||Un(v))return v;const x=ro(y,v.schema);return FC(x,...hD)}return y});if(g.length>0){const y=aq(i,{allOf:g});n=ro(n??{},y)}}const a=uq(o,t);a&&a.schema&&(n=ro(n??{},a.schema));const c=cq(o,t);c&&(n=ro(n??{},c));const u=d1(o,t);if(Ji(u)&&(n=ro(n??{},u.schema)),n==null)return r;if(Un(n))return n;const f=zC(o.next(n),t);Ji(f)&&(n=ro(n,f.schema));const p=FC(n,...hD);return o.next(p)}const n$e=["allOf","anyOf","oneOf","dependencies","if","then","else"];function ox(e,t){const n=zC(e,t);return Ji(n)?e.merge(n.schema,...n$e):n||e}var r$e=Function.prototype.toString,_N=Object.create,o$e=Object.prototype.toString,i$e=function(){function e(){this._keys=[],this._values=[]}return e.prototype.has=function(t){return!!~this._keys.indexOf(t)},e.prototype.get=function(t){return this._values[this._keys.indexOf(t)]},e.prototype.set=function(t,n){this._keys.push(t),this._values.push(n)},e}();function s$e(){return new i$e}function a$e(){return new WeakMap}var l$e=typeof WeakMap<"u"?a$e:s$e;function zT(e){if(!e)return _N(null);var t=e.constructor;if(t===Object)return e===Object.prototype?{}:_N(e);if(t&&~r$e.call(t).indexOf("[native code]"))try{return new t}catch{}return _N(e)}function c$e(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}function u$e(e){return e.flags}var d$e=/test/g.flags==="g"?u$e:c$e;function dq(e){var t=o$e.call(e);return t.substring(8,t.length-1)}function f$e(e){return e[Symbol.toStringTag]||dq(e)}var h$e=typeof Symbol<"u"?f$e:dq,p$e=Object.defineProperty,m$e=Object.getOwnPropertyDescriptor,fq=Object.getOwnPropertyNames,BT=Object.getOwnPropertySymbols,hq=Object.prototype,pq=hq.hasOwnProperty,g$e=hq.propertyIsEnumerable,mq=typeof BT=="function";function y$e(e){return fq(e).concat(BT(e))}var b$e=mq?y$e:fq;function f1(e,t,n){for(var r=b$e(e),o=0,i=r.length,s=void 0,a=void 0;o<i;++o)if(s=r[o],!(s==="callee"||s==="caller")){if(a=m$e(e,s),!a){t[s]=n.copier(e[s],n);continue}!a.get&&!a.set&&(a.value=n.copier(a.value,n));try{p$e(t,s,a)}catch{t[s]=a.value}}return t}function v$e(e,t){var n=new t.Constructor;t.cache.set(e,n);for(var r=0,o=e.length;r<o;++r)n[r]=t.copier(e[r],t);return n}function x$e(e,t){var n=new t.Constructor;return t.cache.set(e,n),f1(e,n,t)}function gq(e,t){return e.slice(0)}function w$e(e,t){return e.slice(0,e.size,e.type)}function S$e(e,t){return new t.Constructor(gq(e.buffer))}function E$e(e,t){return new t.Constructor(e.getTime())}function yq(e,t){var n=new t.Constructor;return t.cache.set(e,n),e.forEach(function(r,o){n.set(o,t.copier(r,t))}),n}function N$e(e,t){return f1(e,yq(e,t),t)}function _$e(e,t){var n=zT(t.prototype);t.cache.set(e,n);for(var r in e)pq.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function C$e(e,t){var n=zT(t.prototype);t.cache.set(e,n);for(var r in e)pq.call(e,r)&&(n[r]=t.copier(e[r],t));for(var o=BT(e),i=0,s=o.length,a=void 0;i<s;++i)a=o[i],g$e.call(e,a)&&(n[a]=t.copier(e[a],t));return n}var O$e=mq?C$e:_$e;function j$e(e,t){var n=zT(t.prototype);return t.cache.set(e,n),f1(e,n,t)}function CN(e,t){return new t.Constructor(e.valueOf())}function A$e(e,t){var n=new t.Constructor(e.source,d$e(e));return n.lastIndex=e.lastIndex,n}function Hb(e,t){return e}function bq(e,t){var n=new t.Constructor;return t.cache.set(e,n),e.forEach(function(r){n.add(t.copier(r,t))}),n}function T$e(e,t){return f1(e,bq(e,t),t)}var $$e=Array.isArray,VT=Object.assign,R$e=Object.getPrototypeOf||function(e){return e.__proto__},vq={array:v$e,arrayBuffer:gq,blob:w$e,dataView:S$e,date:E$e,error:Hb,map:yq,object:O$e,regExp:A$e,set:bq},k$e=VT({},vq,{array:x$e,map:N$e,object:j$e,set:T$e});function M$e(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,Blob:e.blob,Boolean:CN,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:CN,Object:e.object,Promise:Hb,RegExp:e.regExp,Set:e.set,String:CN,WeakMap:Hb,WeakSet:Hb,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer,Uint64Array:e.arrayBuffer}}function xq(e){var t=VT({},vq,e),n=M$e(t),r=n.Array,o=n.Object;function i(s,a){if(a.prototype=a.Constructor=void 0,!s||typeof s!="object")return s;if(a.cache.has(s))return a.cache.get(s);if(a.prototype=R$e(s),a.Constructor=a.prototype&&a.prototype.constructor,!a.Constructor||a.Constructor===Object)return o(s,a);if($$e(s))return r(s,a);var c=n[h$e(s)];return c?c(s,a):typeof s.then=="function"?s:o(s,a)}return function(a){return i(a,{Constructor:void 0,cache:l$e(),copier:i,prototype:void 0})}}function P$e(e){return xq(VT({},k$e,e))}P$e({});var BC=xq({});class D$e{constructor(t,n){this.remotes={},this.errors={},this.typeKeywords={},this.validateKeyword={},this.validateType={},this.validateFormat={},this.config=t,this.typeKeywords=BC(t.typeKeywords),this.validateKeyword=Object.assign({},t.validateKeyword),this.validateType=Object.assign({},t.validateType),this.validateFormat=Object.assign({},t.validateFormat),this.errors=Object.assign({},t.errors),this.setSchema(n)}get rootSchema(){return this.__rootSchema}set rootSchema(t){t!=null&&(this.__rootSchema=this.config.compileSchema(this,t))}addRemoteSchema(t,n){this.config.addRemoteSchema(this,t,n)}compileSchema(t){var n;return this.config.compileSchema(this,t,(n=this.rootSchema)!==null&&n!==void 0?n:t)}createSchemaOf(t){return this.config.createSchemaOf(t)}each(t,n,r,o){const i=this.createNode(r??this.rootSchema,o);return this.config.each(i,t,n)}eachSchema(t,n=this.rootSchema){return this.config.eachSchema(n,t)}getChildSchemaSelection(t,n){return this.config.getChildSchemaSelection(this,t,n)}getSchema(t){const n=this.getSchemaNode(t);return Ji(n)?n.schema:n}getSchemaNode(t){return this.config.getSchema(this,t)}getTemplate(t,n,r=this.config.templateDefaultOptions){return this.config.getTemplate(this,t,n,r)}isValid(t,n,r){return this.config.isValid(this,t,n,r)}createNode(t,n="#"){return this.config.createNode(this,t,n)}resolveAnyOf(t,n){return this.config.resolveAnyOf(t,n)}resolveAllOf(t,n){return this.config.resolveAllOf(t,n)}resolveRef(t){return this.config.resolveRef(t)}resolveOneOf(t,n){return this.config.resolveOneOf(t,n)}setSchema(t){this.rootSchema=t}step(t,n,r){return this.config.step(t,n,r)}validate(t,n=this.rootSchema,r){if(Ji(t)){const i=n,s=t;return this.config.validate(s,i)}if(Un(t))return[t];const o=this.createNode(n,r);return this.config.validate(o,t)}}function rf(e,t,n,r){const o=t[e];Dt(o)&&Object.keys(o).forEach(i=>{Array.isArray(o[i])||(i==="$defs"?rf("$defs",o[i],n,`${r}/${e}/$defs`):Ri(o[i],n,`${r}/${e}/${i}`))})}function hb(e,t,n,r){const o=t[e];Array.isArray(o)&&o.forEach((i,s)=>Ri(i,n,`${r}/${e}/${s}`))}function Ri(e,t,n=""){e!==void 0&&t(e,n)!==!0&&Dt(e)&&(rf("properties",e,t,n),rf("patternProperties",e,t,n),Ri(e.not,t,`${n}/not`),Ri(e.additionalProperties,t,`${n}/additionalProperties`),rf("dependencies",e,t,n),Dt(e.items)&&Ri(e.items,t,`${n}/items`),hb("items",e,t,n),Ri(e.additionalItems,t,`${n}/additionalItems`),hb("allOf",e,t,n),hb("anyOf",e,t,n),hb("oneOf",e,t,n),Ri(e.if,t,`${n}/if`),Ri(e.then,t,`${n}/then`),Ri(e.else,t,`${n}/else`),rf("definitions",e,t,n),rf("$defs",e,t,n))}const I$e=/(#)+$/,ON=/#$/,pD=/^[#/]+/,mD=/^[^:]+:\/\/[^/]+\//,L$e=/\/[^/]*$/,F$e=/#.*$/,z$e=/^urn:uuid:[0-9A-Fa-f]/;function gD(e,t){return e==null&&t==null?"#":t==null?e.replace(ON,""):z$e.test(t)?t:e==null||e===""||e==="#"?t.replace(ON,""):t[0]==="#"?`${e.replace(F$e,"")}${t.replace(I$e,"")}`:mD.test(t)?t.replace(ON,""):mD.test(e)&&t.startsWith("/")?`${e.replace(/(^[^:]+:\/\/[^/]+)(.*)/,"$1")}/${t.replace(pD,"")}`:`${e.replace(L$e,"")}/${t.replace(pD,"")}`}var qb={exports:{}},B$e=qb.exports,yD;function V$e(){return yD||(yD=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:B$e,()=>(()=>{var n={d:(F,B)=>{for(var U in B)n.o(B,U)&&!n.o(F,U)&&Object.defineProperty(F,U,{enumerable:!0,get:B[U]})},o:(F,B)=>Object.prototype.hasOwnProperty.call(F,B),r:F=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(F,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(F,"__esModule",{value:!0})}},r={};function o(F){return F==="#"||F===""||Array.isArray(F)&&F.length===0||!1}n.r(r),n.d(r,{default:()=>H,get:()=>p,isRoot:()=>o,join:()=>R,remove:()=>j,removeUndefinedItems:()=>_,set:()=>S,split:()=>f,splitLast:()=>V});const i=/~1/g,s=/~0/g,a=/(^#?\/?)/g;function c(F){return F.replace(i,"/").replace(s,"~")}function u(F){return c(decodeURIComponent(F))}function f(F){if(F==null||typeof F!="string"||o(F))return Array.isArray(F)?F:[];const B=F.indexOf("#")>=0?u:c,U=(F=F.replace(a,"")).split("/");for(let M=0,z=U.length;M<z;M+=1)U[M]=B(U[M]);return U}function p(F,B,U=void 0){if(B==null||F==null)return U;if(o(B))return F;const M=g(F,f(B));return M===void 0?U:M}function g(F,B){const U=B.shift();if(F!==void 0)return U!==void 0?g(F[U],B):F}const y=/^\[.*\]$/,v=/^\[(.+)\]$/;function x(F,B){return F==="__proto__"||F=="constructor"&&B.length>0&&B[0]=="prototype"}function S(F,B,U){if(B==null)return F;const M=f(B);if(M.length===0)return F;F==null&&(F=y.test(M[0])?[]:{});let z,$,L=F;for(;M.length>1;)z=M.shift(),$=y.test(M[0]),x(z,M)||(L=C(L,z,$));return z=M.pop(),E(L,z,U),F}function E(F,B,U){let M;const z=B.match(v);B==="[]"&&Array.isArray(F)?F.push(U):z?(M=z.pop(),F[M]=U):F[B]=U}function C(F,B,U){var M,z;const $=(z=(M=B.match(v))===null||M===void 0?void 0:M.pop())!==null&&z!==void 0?z:B;if(F[$]!=null)return F[$];const L=U?[]:{};return E(F,B,L),L}function _(F){let B=0,U=0;for(;B+U<F.length;)F[B+U]===void 0&&(U+=1),F[B]=F[B+U],B+=1;return F.length=F.length-U,F}function j(F,B,U){const M=f(B),z=M.pop(),$=p(F,M);return $&&delete $[z],Array.isArray($)&&U!==!0&&_($),F}const A=/~/g,T=/\//g;function k(F,B){if(F.length===0)return B?"#":"";for(let U=0,M=F.length;U<M;U+=1)F[U]=F[U].replace(A,"~0").replace(T,"~1"),B&&(F[U]=encodeURIComponent(F[U]));return(B?"#/":"/")+F.join("/")}function R(F,...B){const U=[];if(Array.isArray(F))return k(F,arguments[1]===!0);const M=arguments[arguments.length-1],z=typeof M=="boolean"?M:F&&F[0]==="#";for(let L=0,P=arguments.length;L<P;L+=1)U.push.apply(U,f(arguments[L]));const $=[];for(let L=0,P=U.length;L<P;L+=1)if(U[L]===".."){if($.length===0)return z?"#":"";$.pop()}else $.push(U[L]);return k($,z)}function V(F){const B=f(F);if(B.length===0)return typeof F=="string"&&F[0]==="#"?["#",B[0]]:["",void 0];if(B.length===1)return F[0]==="#"?["#",B[0]]:["",B[0]];const U=B.pop();return[R(B,F[0]==="#"),U]}const H={get:p,set:S,remove:j,join:R,split:f,splitLast:V,isRoot:o,removeUndefinedItems:_};return r})())}(qb)),qb.exports}var cu=V$e();const U$e=es(cu),jN=/(#)+$/g,H$e=["",null,"#"];function q$e(e){if(H$e.includes(e))return[];if(e=e.replace(jN,""),e.indexOf("#")===-1)return[e.replace(/(#|\/)+$/g,"")];if(e.indexOf("#")===0)return[e.replace(jN,"")];const t=e.split("#");return t[0]=t[0].replace(/(#|\/)+$/g,""),t[1]=`#${t[1].replace(jN,"")}`,t}const W$e=/(#)+$/g,G$e=e=>Ot(e)==="object";function ca(e,t,n){var r,o,i,s,a;let c;if(G$e(n)?c=n.__ref||n.$ref:c=n,c==null)return t;let u;const f=c.replace(W$e,"");if(e.remotes[f]!=null)return u=e.remotes[f],u&&u.$ref?ca(e,u,u):u;const p=(r=e.anchors)===null||r===void 0?void 0:r[c];if(p)return cu.get(t,p);if(e.ids[c]!=null)return u=cu.get(t,e.ids[c]),u&&u.$ref?ca(e,t,u):u;const g=c,y=q$e(c);if(y.length===0)return t;if(y.length===1){if(c=y[0],e.remotes[c]&&(u=e.remotes[c],u&&u.$ref))return ca(e,t,u);if(e.ids[c])return u=cu.get(t,e.ids[c]),u&&u.$ref?ca(e,t,u):u;const v=(o=t.getContext)===null||o===void 0?void 0:o.call(t).ids[c];if(v)return ca(e,t,v)}if(y.length===2){const v=y[0];c=y[1];const x=(i=e.remotes[v])!==null&&i!==void 0?i:e.remotes[`${v}/`];if(x)return x.getContext&&x.getContext().anchors[g]!=null?x.getRef(g):x.getRef?x.getRef(c):ca(e,x,c);const S=(s=e.ids[v])!==null&&s!==void 0?s:e.ids[`${v}/`];if(S)return ca(e,cu.get(t,S),c)}return u=cu.get(t,(a=e.ids[c])!==null&&a!==void 0?a:c),u&&u.$ref?ca(e,t,u):u}function ha(e){if(e===void 0)return;const t={type:Ot(e)};return t.type==="object"&&Dt(e)&&(t.properties={},Object.keys(e).forEach(n=>t.properties[n]=ha(e[n]))),t.type==="array"&&Array.isArray(e)&&(e.length===1?t.items=ha(e[0]):t.items=e.map(ha)),t}const J$e={additionalItemsError:Je("AdditionalItemsError"),additionalPropertiesError:Je("AdditionalPropertiesError"),allOfError:Je("AllOfError"),anyOfError:Je("AnyOfError"),constError:Je("ConstError"),containsAnyError:Je("ContainsAnyError"),containsArrayError:Je("ContainsArrayError"),containsError:Je("ContainsError"),containsMaxError:Je("ContainsMaxError"),containsMinError:Je("ContainsMinError"),enumError:Je("EnumError"),forbiddenPropertyError:Je("ForbiddenPropertyError"),formatDateError:Je("FormatDateError"),formatDateTimeError:Je("FormatDateTimeError"),formatDurationError:Je("FormatDurationError"),formatEmailError:Je("FormatEmailError"),formatHostnameError:Je("FormatHostnameError"),formatIPV4Error:Je("FormatIPV4Error"),formatIPV4LeadingZeroError:Je("FormatIPV4LeadingZeroError"),formatIPV6Error:Je("FormatIPV6Error"),formatIPV6LeadingZeroError:Je("FormatIPV6LeadingZeroError"),formatJsonPointerError:Je("FormatJsonPointerError"),formatRegExError:Je("FormatRegExError"),formatTimeError:Je("FormatTimeError"),formatURIError:Je("FormatURIError"),formatURIReferenceError:Je("FormatURIReferenceError"),formatURITemplateError:Je("FormatURITemplateError"),formatURLError:Je("FormatURLError"),formatUUIDError:Je("FormatUUIDError"),invalidDataError:Je("InvalidDataError"),invalidPropertyNameError:Je("InvalidPropertyNameError"),invalidSchemaError:Je("InvalidSchemaError"),invalidTypeError:Je("InvalidTypeError"),maximumError:Je("MaximumError"),maxItemsError:Je("MaxItemsError"),maxLengthError:Je("MaxLengthError"),maxPropertiesError:Je("MaxPropertiesError"),minimumError:Je("MinimumError"),minItemsError:Je("MinItemsError"),minItemsOneError:Je("MinItemsOneError"),minLengthError:Je("MinLengthError"),minLengthOneError:Je("MinLengthOneError"),minPropertiesError:Je("MinPropertiesError"),missingDependencyError:Je("MissingDependencyError"),missingOneOfPropertyError:Je("MissingOneOfPropertyError"),multipleOfError:Je("MultipleOfError"),multipleOneOfError:Je("MultipleOneOfError"),noAdditionalPropertiesError:Je("NoAdditionalPropertiesError"),notError:Je("NotError"),oneOfError:Je("OneOfError"),oneOfPropertyError:Je("OneOfPropertyError"),patternError:Je("PatternError"),patternPropertiesError:Je("PatternPropertiesError"),requiredPropertyError:Je("RequiredPropertyError"),schemaWarning:Je("SchemaWarning"),typeError:Je("TypeError"),undefinedValueError:Je("UndefinedValueError"),unevaluatedItemsError:Je("UnevaluatedItemsError"),unevaluatedPropertyError:Je("UnevaluatedPropertyError"),uniqueItemsError:Je("UniqueItemsError"),unknownPropertyError:Je("UnknownPropertyError"),valueNotEmptyError:Je("ValueNotEmptyError")};var AN={exports:{}},bD;function Y$e(){return bD||(bD=1,function(e){(function(t){t.exports.is_uri=r,t.exports.is_http_uri=o,t.exports.is_https_uri=i,t.exports.is_web_uri=s,t.exports.isUri=r,t.exports.isHttpUri=o,t.exports.isHttpsUri=i,t.exports.isWebUri=s;var n=function(a){var c=a.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return c};function r(a){if(a&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(a)&&!/%[^0-9a-f]/i.test(a)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(a)){var c=[],u="",f="",p="",g="",y="",v="";if(c=n(a),u=c[1],f=c[2],p=c[3],g=c[4],y=c[5],!!(u&&u.length&&p.length>=0)){if(f&&f.length){if(!(p.length===0||/^\//.test(p)))return}else if(/^\/\//.test(p))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(u.toLowerCase()))return v+=u+":",f&&f.length&&(v+="//"+f),v+=p,g&&g.length&&(v+="?"+g),y&&y.length&&(v+="#"+y),v}}}function o(a,c){if(r(a)){var u=[],f="",p="",g="",y="",v="",x="",S="";if(u=n(a),f=u[1],p=u[2],g=u[3],v=u[4],x=u[5],!!f){if(c){if(f.toLowerCase()!="https")return}else if(f.toLowerCase()!="http")return;if(p)return/:(\d+)$/.test(p)&&(y=p.match(/:(\d+)$/)[0],p=p.replace(/:\d+$/,"")),S+=f+":",S+="//"+p,y&&(S+=y),S+=g,v&&v.length&&(S+="?"+v),x&&x.length&&(S+="#"+x),S}}}function i(a){return o(a,!0)}function s(a){return o(a)||i(a)}})(e)}(AN)),AN.exports}var K$e=Y$e();const vD=es(K$e);var $r={},Wb={exports:{}},X$e=Wb.exports,xD;function Q$e(){return xD||(xD=1,function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(X$e,function(){function t(u,f,p){return this.id=++t.highestId,this.name=u,this.symbols=f,this.postprocess=p,this}t.highestId=0,t.prototype.toString=function(u){var f=typeof u>"u"?this.symbols.map(c).join(" "):this.symbols.slice(0,u).map(c).join(" ")+" ● "+this.symbols.slice(u).map(c).join(" ");return this.name+" → "+f};function n(u,f,p,g){this.rule=u,this.dot=f,this.reference=p,this.data=[],this.wantedBy=g,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var f=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return f.left=this,f.right=u,f.isComplete&&(f.data=f.build(),f.right=void 0),f},n.prototype.build=function(){var u=[],f=this;do u.push(f.right.data),f=f.left;while(f.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))};function r(u,f){this.grammar=u,this.index=f,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var f=this.states,p=this.wants,g=this.completed,y=0;y<f.length;y++){var v=f[y];if(v.isComplete){if(v.finish(),v.data!==s.fail){for(var x=v.wantedBy,S=x.length;S--;){var E=x[S];this.complete(E,v)}if(v.reference===this.index){var C=v.rule.name;(this.completed[C]=this.completed[C]||[]).push(v)}}}else{var C=v.rule.symbols[v.dot];if(typeof C!="string"){this.scannable.push(v);continue}if(p[C]){if(p[C].push(v),g.hasOwnProperty(C))for(var _=g[C],S=0;S<_.length;S++){var j=_[S];this.complete(v,j)}}else p[C]=[v],this.predict(C)}}},r.prototype.predict=function(u){for(var f=this.grammar.byName[u]||[],p=0;p<f.length;p++){var g=f[p],y=this.wants[u],v=new n(g,0,this.index,y);this.states.push(v)}},r.prototype.complete=function(u,f){var p=u.nextState(f);this.states.push(p)};function o(u,f){this.rules=u,this.start=f||this.rules[0].name;var p=this.byName={};this.rules.forEach(function(g){p.hasOwnProperty(g.name)||(p[g.name]=[]),p[g.name].push(g)})}o.fromCompiled=function(g,f){var p=g.Lexer;g.ParserStart&&(f=g.ParserStart,g=g.ParserRules);var g=g.map(function(v){return new t(v.name,v.symbols,v.postprocess)}),y=new o(g,f);return y.lexer=p,y};function i(){this.reset("")}i.prototype.reset=function(u,f){this.buffer=u,this.index=0,this.line=f?f.line:1,this.lastLineBreak=f?-f.col:0},i.prototype.next=function(){if(this.index<this.buffer.length){var u=this.buffer[this.index++];return u===`
`&&(this.line+=1,this.lastLineBreak=this.index),{value:u}}},i.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},i.prototype.formatError=function(u,f){var p=this.buffer;if(typeof p=="string"){var g=p.split(`
`).slice(Math.max(0,this.line-5),this.line),y=p.indexOf(`
`,this.index);y===-1&&(y=p.length);var v=this.index-this.lastLineBreak,x=String(this.line).length;return f+=" at line "+this.line+" col "+v+`:
`,f+=g.map(function(E,C){return S(this.line-g.length+C+1,x)+" "+E},this).join(`
`),f+=`
`+S("",x+v)+`^
`,f}else return f+" at index "+(this.index-1);function S(E,C){var _=String(E);return Array(C-_.length+1).join(" ")+_}};function s(u,f,p){if(u instanceof o)var g=u,p=f;else var g=o.fromCompiled(u,f);this.grammar=g,this.options={keepHistory:!1,lexer:g.lexer||new i};for(var y in p||{})this.options[y]=p[y];this.lexer=this.options.lexer,this.lexerState=void 0;var v=new r(g,0);this.table=[v],v.wants[g.start]=[],v.predict(g.start),v.process(),this.current=0}s.fail={},s.prototype.feed=function(u){var f=this.lexer;f.reset(u,this.lexerState);for(var p;;){try{if(p=f.next(),!p)break}catch(k){var x=new r(this.grammar,this.current+1);this.table.push(x);var g=new Error(this.reportLexerError(k));throw g.offset=this.current,g.token=k.token,g}var y=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var v=this.current+1,x=new r(this.grammar,v);this.table.push(x);for(var S=p.text!==void 0?p.text:p.value,E=f.constructor===i?p.value:p,C=y.scannable,_=C.length;_--;){var j=C[_],A=j.rule.symbols[j.dot];if(A.test?A.test(E):A.type?A.type===p.type:A.literal===S){var T=j.nextState({data:E,token:p,isToken:!0,reference:v-1});x.states.push(T)}}if(x.process(),x.states.length===0){var g=new Error(this.reportError(p));throw g.offset=this.current,g.token=p,g}this.options.keepHistory&&(y.lexerState=f.save()),this.current++}return y&&(this.lexerState=f.save()),this.results=this.finish(),this},s.prototype.reportLexerError=function(u){var f,p,g=u.token;return g?(f="input "+JSON.stringify(g.text[0])+" (lexer error)",p=this.lexer.formatError(g,"Syntax error")):(f="input (lexer error)",p=u.message),this.reportErrorCommon(p,f)},s.prototype.reportError=function(u){var f=(u.type?u.type+" token: ":"")+JSON.stringify(u.value!==void 0?u.value:u),p=this.lexer.formatError(u,"Syntax error");return this.reportErrorCommon(p,f)},s.prototype.reportErrorCommon=function(u,f){var p=[];p.push(u);var g=this.table.length-2,y=this.table[g],v=y.states.filter(function(S){var E=S.rule.symbols[S.dot];return E&&typeof E!="string"});if(v.length===0)p.push("Unexpected "+f+`. I did not expect any more input. Here is the state of my parse table:
`),this.displayStateStack(y.states,p);else{p.push("Unexpected "+f+`. Instead, I was expecting to see one of the following:
`);var x=v.map(function(S){return this.buildFirstStateStack(S,[])||[S]},this);x.forEach(function(S){var E=S[0],C=E.rule.symbols[E.dot],_=this.getSymbolDisplay(C);p.push("A "+_+" based on:"),this.displayStateStack(S,p)},this)}return p.push(""),p.join(`
`)},s.prototype.displayStateStack=function(u,f){for(var p,g=0,y=0;y<u.length;y++){var v=u[y],x=v.rule.toString(v.dot);x===p?g++:(g>0&&f.push(" ^ "+g+" more lines identical to this"),g=0,f.push(" "+x)),p=x}},s.prototype.getSymbolDisplay=function(u){return a(u)},s.prototype.buildFirstStateStack=function(u,f){if(f.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var p=u.wantedBy[0],g=[u].concat(f),y=this.buildFirstStateStack(p,g);return y===null?null:[u].concat(y)},s.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},s.prototype.restore=function(u){var f=u.index;this.current=f,this.table[f]=u,this.table.splice(f+1),this.lexerState=u.lexerState,this.results=this.finish()},s.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},s.prototype.finish=function(){var u=[],f=this.grammar.start,p=this.table[this.table.length-1];return p.states.forEach(function(g){g.rule.name===f&&g.dot===g.rule.symbols.length&&g.reference===0&&g.data!==s.fail&&u.push(g)}),u.map(function(g){return g.data})};function a(u){var f=typeof u;if(f==="string")return u;if(f==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function c(u){var f=typeof u;if(f==="string")return u;if(f==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:s,Grammar:o,Rule:t}})}(Wb)),Wb.exports}var pb={},wD;function Z$e(){if(wD)return pb;wD=1,Object.defineProperty(pb,"__esModule",{value:!0});function e(o){return o[0]}const t=o=>[].concat(...o.map(i=>Array.isArray(i)?t(i):i));function n(o){return o?Array.isArray(o)?t(o).join(""):o:""}const r={Lexer:void 0,ParserRules:[{name:"Reverse_path",symbols:["Path"]},{name:"Reverse_path$string$1",symbols:[{literal:"<"},{literal:">"}],postprocess:o=>o.join("")},{name:"Reverse_path",symbols:["Reverse_path$string$1"]},{name:"Forward_path$subexpression$1$subexpression$1",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:"@"}],postprocess:function(o){return o.join("")}},{name:"Forward_path$subexpression$1",symbols:["Forward_path$subexpression$1$subexpression$1","Domain",{literal:">"}]},{name:"Forward_path",symbols:["Forward_path$subexpression$1"]},{name:"Forward_path$subexpression$2",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:">"}],postprocess:function(o){return o.join("")}},{name:"Forward_path",symbols:["Forward_path$subexpression$2"]},{name:"Forward_path",symbols:["Path"]},{name:"Path$ebnf$1$subexpression$1",symbols:["A_d_l",{literal:":"}]},{name:"Path$ebnf$1",symbols:["Path$ebnf$1$subexpression$1"],postprocess:e},{name:"Path$ebnf$1",symbols:[],postprocess:()=>null},{name:"Path",symbols:[{literal:"<"},"Path$ebnf$1","Mailbox",{literal:">"}]},{name:"A_d_l$ebnf$1",symbols:[]},{name:"A_d_l$ebnf$1$subexpression$1",symbols:[{literal:","},"At_domain"]},{name:"A_d_l$ebnf$1",symbols:["A_d_l$ebnf$1","A_d_l$ebnf$1$subexpression$1"],postprocess:o=>o[0].concat([o[1]])},{name:"A_d_l",symbols:["At_domain","A_d_l$ebnf$1"]},{name:"At_domain",symbols:[{literal:"@"},"Domain"]},{name:"Domain$ebnf$1",symbols:[]},{name:"Domain$ebnf$1$subexpression$1",symbols:[{literal:"."},"sub_domain"]},{name:"Domain$ebnf$1",symbols:["Domain$ebnf$1","Domain$ebnf$1$subexpression$1"],postprocess:o=>o[0].concat([o[1]])},{name:"Domain",symbols:["sub_domain","Domain$ebnf$1"]},{name:"sub_domain",symbols:["U_label"]},{name:"Let_dig",symbols:["ALPHA_DIGIT"],postprocess:e},{name:"Ldh_str$ebnf$1",symbols:[]},{name:"Ldh_str$ebnf$1",symbols:["Ldh_str$ebnf$1","ALPHA_DIG_DASH"],postprocess:o=>o[0].concat([o[1]])},{name:"Ldh_str",symbols:["Ldh_str$ebnf$1","Let_dig"]},{name:"U_Let_dig",symbols:["ALPHA_DIGIT_U"],postprocess:e},{name:"U_Ldh_str$ebnf$1",symbols:[]},{name:"U_Ldh_str$ebnf$1",symbols:["U_Ldh_str$ebnf$1","ALPHA_DIG_DASH_U"],postprocess:o=>o[0].concat([o[1]])},{name:"U_Ldh_str",symbols:["U_Ldh_str$ebnf$1","U_Let_dig"]},{name:"U_label$ebnf$1$subexpression$1",symbols:["U_Ldh_str"]},{name:"U_label$ebnf$1",symbols:["U_label$ebnf$1$subexpression$1"],postprocess:e},{name:"U_label$ebnf$1",symbols:[],postprocess:()=>null},{name:"U_label",symbols:["U_Let_dig","U_label$ebnf$1"]},{name:"address_literal$subexpression$1",symbols:["IPv4_address_literal"]},{name:"address_literal$subexpression$1",symbols:["IPv6_address_literal"]},{name:"address_literal$subexpression$1",symbols:["General_address_literal"]},{name:"address_literal",symbols:[{literal:"["},"address_literal$subexpression$1",{literal:"]"}]},{name:"non_local_part",symbols:["Domain"],postprocess:function(o){return{DomainName:n(o[0])}}},{name:"non_local_part",symbols:["address_literal"],postprocess:function(o){return{AddressLiteral:n(o[0])}}},{name:"Mailbox",symbols:["Local_part",{literal:"@"},"non_local_part"],postprocess:function(o){return{localPart:n(o[0]),domainPart:n(o[2])}}},{name:"Local_part",symbols:["Dot_string"],postprocess:function(o){return{DotString:n(o[0])}}},{name:"Local_part",symbols:["Quoted_string"],postprocess:function(o){return{QuotedString:n(o[0])}}},{name:"Dot_string$ebnf$1",symbols:[]},{name:"Dot_string$ebnf$1$subexpression$1",symbols:[{literal:"."},"Atom"]},{name:"Dot_string$ebnf$1",symbols:["Dot_string$ebnf$1","Dot_string$ebnf$1$subexpression$1"],postprocess:o=>o[0].concat([o[1]])},{name:"Dot_string",symbols:["Atom","Dot_string$ebnf$1"]},{name:"Atom$ebnf$1",symbols:[/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/]},{name:"Atom$ebnf$1",symbols:["Atom$ebnf$1",/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/],postprocess:o=>o[0].concat([o[1]])},{name:"Atom",symbols:["Atom$ebnf$1"]},{name:"Quoted_string$ebnf$1",symbols:[]},{name:"Quoted_string$ebnf$1",symbols:["Quoted_string$ebnf$1","QcontentSMTP"],postprocess:o=>o[0].concat([o[1]])},{name:"Quoted_string",symbols:["DQUOTE","Quoted_string$ebnf$1","DQUOTE"]},{name:"QcontentSMTP",symbols:["qtextSMTP"]},{name:"QcontentSMTP",symbols:["quoted_pairSMTP"]},{name:"quoted_pairSMTP",symbols:[{literal:"\\"},/[\x20-\x7e]/]},{name:"qtextSMTP",symbols:[/[\x20-\x21\x23-\x5b\x5d-\x7e\u0080-\uFFFF]/],postprocess:e},{name:"IPv4_address_literal$macrocall$2",symbols:[{literal:"."},"Snum"]},{name:"IPv4_address_literal$macrocall$1",symbols:["IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2"]},{name:"IPv4_address_literal",symbols:["Snum","IPv4_address_literal$macrocall$1"]},{name:"IPv6_address_literal$subexpression$1",symbols:[/[iI]/,/[pP]/,/[vV]/,{literal:"6"},{literal:":"}],postprocess:function(o){return o.join("")}},{name:"IPv6_address_literal",symbols:["IPv6_address_literal$subexpression$1","IPv6_addr"]},{name:"General_address_literal$ebnf$1",symbols:["dcontent"]},{name:"General_address_literal$ebnf$1",symbols:["General_address_literal$ebnf$1","dcontent"],postprocess:o=>o[0].concat([o[1]])},{name:"General_address_literal",symbols:["Standardized_tag",{literal:":"},"General_address_literal$ebnf$1"]},{name:"Standardized_tag",symbols:["Ldh_str"]},{name:"dcontent",symbols:[/[\x21-\x5a\x5e-\x7e]/],postprocess:e},{name:"Snum",symbols:["DIGIT"]},{name:"Snum$subexpression$1",symbols:[/[1-9]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$1"]},{name:"Snum$subexpression$2",symbols:[{literal:"1"},"DIGIT","DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$2"]},{name:"Snum$subexpression$3",symbols:[{literal:"2"},/[0-4]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$3"]},{name:"Snum$subexpression$4",symbols:[{literal:"2"},{literal:"5"},/[0-5]/]},{name:"Snum",symbols:["Snum$subexpression$4"]},{name:"IPv6_addr",symbols:["IPv6_full"]},{name:"IPv6_addr",symbols:["IPv6_comp"]},{name:"IPv6_addr",symbols:["IPv6v4_full"]},{name:"IPv6_addr",symbols:["IPv6v4_comp"]},{name:"IPv6_hex",symbols:["HEXDIG"]},{name:"IPv6_hex$subexpression$1",symbols:["HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$1"]},{name:"IPv6_hex$subexpression$2",symbols:["HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$2"]},{name:"IPv6_hex$subexpression$3",symbols:["HEXDIG","HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$3"]},{name:"IPv6_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_full$macrocall$1",symbols:["IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2"]},{name:"IPv6_full",symbols:["IPv6_hex","IPv6_full$macrocall$1"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$1",symbols:["IPv6_comp$ebnf$1$subexpression$1"],postprocess:e},{name:"IPv6_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:o=>o.join("")},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$2$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$2",symbols:["IPv6_comp$ebnf$2$subexpression$1"],postprocess:e},{name:"IPv6_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6_comp",symbols:["IPv6_comp$ebnf$1","IPv6_comp$string$1","IPv6_comp$ebnf$2"]},{name:"IPv6v4_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_full$macrocall$1",symbols:["IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2"]},{name:"IPv6v4_full",symbols:["IPv6_hex","IPv6v4_full$macrocall$1",{literal:":"},"IPv4_address_literal"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6v4_comp$ebnf$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1"],postprocess:e},{name:"IPv6v4_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:o=>o.join("")},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",{literal:":"}]},{name:"IPv6v4_comp$ebnf$2",symbols:["IPv6v4_comp$ebnf$2$subexpression$1"],postprocess:e},{name:"IPv6v4_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp",symbols:["IPv6v4_comp$ebnf$1","IPv6v4_comp$string$1","IPv6v4_comp$ebnf$2","IPv4_address_literal"]},{name:"DIGIT",symbols:[/[0-9]/],postprocess:e},{name:"ALPHA_DIGIT_U",symbols:[/[0-9A-Za-z\u0080-\uFFFF]/],postprocess:e},{name:"ALPHA_DIGIT",symbols:[/[0-9A-Za-z]/],postprocess:e},{name:"ALPHA_DIG_DASH",symbols:[/[-0-9A-Za-z]/],postprocess:e},{name:"ALPHA_DIG_DASH_U",symbols:[/[-0-9A-Za-z\u0080-\uFFFF]/],postprocess:e},{name:"HEXDIG",symbols:[/[0-9A-Fa-f]/],postprocess:e},{name:"DQUOTE",symbols:[{literal:'"'}],postprocess:e}],ParserStart:"Reverse_path"};return pb.default=r,pb}var SD;function e3e(){if(SD)return $r;SD=1;var e=$r&&$r.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty($r,"__esModule",{value:!0}),$r.canonicalize=$r.canonicalize_quoted_string=$r.normalize=$r.normalize_dot_string=$r.parse=void 0;const t=Q$e(),n=e(Z$e());n.default.ParserStart="Mailbox";const r=t.Grammar.fromCompiled(n.default);function o(u){const f=new t.Parser(r);if(f.feed(u),f.results.length!==1)throw new Error("address parsing failed: ambiguous grammar");return f.results[0]}$r.parse=o;function i(u){return function(){const g=u.indexOf("+");return g===-1?u:u.substr(0,g)}().replace(/\./g,"").toLowerCase()}$r.normalize_dot_string=i;function s(u){var f,p;const g=o(u),y=(f=g.domainPart.AddressLiteral)!==null&&f!==void 0?f:g.domainPart.DomainName.toLowerCase();return`${(p=g.localPart.QuotedString)!==null&&p!==void 0?p:i(g.localPart.DotString)}@${y}`}$r.normalize=s;function a(u){return`"${u.substr(1).substr(0,u.length-2).replace(/(?:\\(.))/g,"$1").replace(/(?:(["\\]))/g,"\\$1")}"`}$r.canonicalize_quoted_string=a;function c(u){var f;const p=o(u),g=(f=p.domainPart.AddressLiteral)!==null&&f!==void 0?f:p.domainPart.DomainName.toLowerCase();return`${p.localPart.QuotedString?a(p.localPart.QuotedString):p.localPart.DotString}@${g}`}return $r.canonicalize=c,$r}var t3e=e3e();const n3e=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,r3e=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,o3e=/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,i3e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s3e=/^(?<time>(?:([0-1]\d|2[0-3]):[0-5]\d:(?<second>[0-5]\d|60)))(?:\.\d+)?(?<offset>(?:z|[+-]([0-1]\d|2[0-3])(?::?[0-5]\d)?))$/i,a3e=[0,31,28,31,30,31,30,31,31,30,31,30,31],l3e=/^(?:\/(?:[^~/]|~0|~1)*)*$/,c3e=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,u3e=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,d3e=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,f3e=/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,VC={date:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(typeof t!="string"||t==="")return;const i=t.match(i3e);if(!i)return n.errors.formatDateTimeError({value:t,pointer:o,schema:r});const s=+i[1],a=+i[2],c=+i[3],u=s%4===0&&(s%100!==0||s%400===0);if(!(a>=1&&a<=12&&c>=1&&c<=(a==2&&u?29:a3e[a])))return n.errors.formatDateError({value:t,pointer:o,schema:r})},"date-time":(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(typeof t!="string"||t==="")return;const i=t.split(/t/i);if(i.length===2){const s=VC.date(e,i[0])===void 0,a=VC.time(e,i[1])===void 0;if(s&&a)return}return n.errors.formatDateTimeError({value:t,pointer:o,schema:r})},duration:(e,t)=>{if(Ot(t)!=="string")return;const r=/(\d+M)(\d+W)|(\d+Y)(\d+W)/;if(!f3e.test(t)||r.test(t))return e.draft.errors.formatDurationError({value:t,pointer:e.pointer,schema:e.schema})},email:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(typeof t!="string"||t==="")return;if(t[0]==='"')return n.errors.formatEmailError({value:t,pointer:o,schema:r});const[i,s,...a]=t.split("@");if(!i||!s||a.length!==0||i.length>64||s.length>253)return n.errors.formatEmailError({value:t,pointer:o,schema:r});if(i[0]==="."||i.endsWith(".")||i.includes(".."))return n.errors.formatEmailError({value:t,pointer:o,schema:r});if(!/^[a-z0-9.-]+$/i.test(s)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(i))return n.errors.formatEmailError({value:t,pointer:o,schema:r});if(!s.split(".").every(c=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(c)))return n.errors.formatEmailError({value:t,pointer:o,schema:r})},"idn-email":(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(typeof t!="string"||t===""))try{t3e.parse(t);return}catch{return n.errors.formatEmailError({value:t,pointer:o,schema:r})}},hostname:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(typeof t=="string"&&!(t===""||o3e.test(t)))return n.errors.formatHostnameError({value:t,pointer:o,schema:r})},ipv4:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(typeof t!="string"||t==="")){if(t&&t[0]==="0")return n.errors.formatIPV4LeadingZeroError({value:t,pointer:o,schema:r});if(!(t.length<=15&&n3e.test(t)))return n.errors.formatIPV4Error({value:t,pointer:o,schema:r})}},ipv6:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(typeof t!="string"||t==="")){if(t&&t[0]==="0")return n.errors.formatIPV6LeadingZeroError({value:t,pointer:o,schema:r});if(!(t.length<=45&&r3e.test(t)))return n.errors.formatIPV6Error({value:t,pointer:o,schema:r})}},"json-pointer":(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(typeof t!="string"||t==="")&&!l3e.test(t))return n.errors.formatJsonPointerError({value:t,pointer:o,schema:r})},"relative-json-pointer":(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(typeof t=="string"&&!c3e.test(t))return n.errors.formatJsonPointerError({value:t,pointer:o,schema:r})},regex:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(typeof t=="string"&&/\\Z$/.test(t)===!1){try{new RegExp(t);return}catch{}return n.errors.formatRegExError({value:t,pointer:o,schema:r})}if(!(typeof t=="object"||typeof t=="number"||Array.isArray(t)))return n.errors.formatRegExError({value:t,pointer:o,schema:r})},time:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(typeof t!="string"||t==="")return;const i=t.match(s3e);if(!i)return n.errors.formatDateTimeError({value:t,pointer:o,schema:r});if(i.groups.second==="60"){if(/23:59:60(z|\+00:00)/i.test(t))return;const s=i.groups.time.match(/(\d+):(\d+):/),a=i.groups.offset.match(/(\d+):(\d+)/);if(a){const c=parseInt(s[1]),u=parseInt(a[1]),f=parseInt(s[2]),p=parseInt(a[2]);let g;/^-/.test(i.groups.offset)?g=(c+u)*60+(f+p):g=(24+c-u)*60+(f-p);const y=Math.floor(g/60),v=y%24,x=g-y*60;if(v===23&&x===59)return}return n.errors.formatDateTimeError({value:t,pointer:o,schema:r})}},uri:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(typeof t!="string"||t==="")&&!vD.isUri(t))return n.errors.formatURIError({value:t,pointer:o,schema:r})},"uri-reference":(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(typeof t!="string"||t==="")&&!u3e.test(t))return n.errors.formatURIReferenceError({value:t,pointer:o,schema:r})},"uri-template":(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(typeof t!="string"||t==="")&&!d3e.test(t))return n.errors.formatURITemplateError({value:t,pointer:o,schema:r})},url:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(t===""||vD.isWebUri(t)))return n.errors.formatURLError({value:t,pointer:o,schema:r})},uuid:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!(typeof t!="string"||t==="")&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))return n.errors.formatUUIDError({value:t,pointer:o,schema:r})}};function h3e(e,t,n=e.rootSchema){var r;if(n.oneOf)return n.oneOf.map(i=>e.createNode(i).resolveRef().schema);if(!((r=n.items)===null||r===void 0)&&r.oneOf)return n.items.oneOf.map(i=>e.createNode(i).resolveRef().schema);if(Array.isArray(n.items)&&n.items.length>+t)return[e.step(e.createNode(n),t,{}).schema];if(n.additionalItems&&!Dt(n.items)){const i=n.additionalItems===!0?{type:"string"}:n.additionalItems;return[e.createNode(i).resolveRef().schema]}if(Array.isArray(n.items)&&n.items.length<=+t)return[];const o=e.step(e.createNode(n),t,{});return Un(o)?o:[o.schema]}const wq={};function p3e(e,t=wq){const{pointer:n="#",data:r,schema:o=e.rootSchema,withSchemaWarning:i=!1}=t,s=U$e.split(n),a=e.createNode(o).resolveRef(),c=Sq(a,s,r);return!i&&Un(c)&&c.code==="schema-warning"?e.createNode(void 0):c}function Sq(e,t,n=wq){if(t.length===0)return e.resolveRef();const r=t.shift(),o=e.draft.step(e,r,n);return Un(o)?o:(n=n[r],Sq(o,t,n))}var TN,ED;function m3e(){if(ED)return TN;ED=1;var e=function(C){return t(C)&&!n(C)};function t(E){return!!E&&typeof E=="object"}function n(E){var C=Object.prototype.toString.call(E);return C==="[object RegExp]"||C==="[object Date]"||i(E)}var r=typeof Symbol=="function"&&Symbol.for,o=r?Symbol.for("react.element"):60103;function i(E){return E.$$typeof===o}function s(E){return Array.isArray(E)?[]:{}}function a(E,C){return C.clone!==!1&&C.isMergeableObject(E)?x(s(E),E,C):E}function c(E,C,_){return E.concat(C).map(function(j){return a(j,_)})}function u(E,C){if(!C.customMerge)return x;var _=C.customMerge(E);return typeof _=="function"?_:x}function f(E){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(E).filter(function(C){return Object.propertyIsEnumerable.call(E,C)}):[]}function p(E){return Object.keys(E).concat(f(E))}function g(E,C){try{return C in E}catch{return!1}}function y(E,C){return g(E,C)&&!(Object.hasOwnProperty.call(E,C)&&Object.propertyIsEnumerable.call(E,C))}function v(E,C,_){var j={};return _.isMergeableObject(E)&&p(E).forEach(function(A){j[A]=a(E[A],_)}),p(C).forEach(function(A){y(E,A)||(g(E,A)&&_.isMergeableObject(C[A])?j[A]=u(A,_)(E[A],C[A],_):j[A]=a(C[A],_))}),j}function x(E,C,_){_=_||{},_.arrayMerge=_.arrayMerge||c,_.isMergeableObject=_.isMergeableObject||e,_.cloneUnlessOtherwiseSpecified=a;var j=Array.isArray(C),A=Array.isArray(E),T=j===A;return T?j?_.arrayMerge(E,C,_):v(E,C,_):a(C,_)}x.all=function(C,_){if(!Array.isArray(C))throw new Error("first argument should be an array");return C.reduce(function(j,A){return x(j,A,_)},{})};var S=x;return TN=S,TN}var g3e=m3e();const y3e=es(g3e),b3e=(e,t)=>t,Eq=(e,t)=>y3e(e,t,{arrayMerge:b3e});function v3e(e){switch(Ot(e)){case"string":case"array":return e?.length===0;case"null":case"undefined":return!0;case"object":return Object.keys(e).length===0;default:return!1}}const ND=uy.templateDefaultOptions;let pa;function $N(e,t){const{$ref:n}=e;return n==null?!0:(pa[t]==null||pa[t][n]==null?0:pa[t][n])<uy.GET_TEMPLATE_RECURSION_LIMIT}function _D(e,t,n){const{$ref:r}=t;return r==null?t:(pa[n]=pa[n]||{},pa[n][r]=pa[n][r]||0,pa[n][r]+=1,e.createNode(t,n).resolveRef().schema)}function x3e(e,t){if(e==="string")return JSON.stringify(t);if(typeof t!="string")return null;try{if(t=JSON.parse(t),typeof t===e)return t}catch{}return null}function Nq(e,t,n,r,o){if(Ot(t)!=="object")return Object.assign({pointer:r},t);if($N(t,r)===!1&&n==null)return!1;let i=BC(_D(e,t,r));if(Array.isArray(t.anyOf)&&t.anyOf.length>0){if($N(t.anyOf[0],`${r}/anyOf/0`)){const s=_D(e,t.anyOf[0],`${r}/anyOf/0`);i=Eq(i,s),i.pointer=t.anyOf[0].$ref||i.pointer}delete i.anyOf}if(Array.isArray(t.allOf)&&t.allOf.map((a,c)=>$N(a,`${r}/allOf/${c}`)).reduceRight((a,c)=>a&&c,!0)){const a=[];let c=BC(n);for(let f=0;f<t.allOf.length;f+=1){const p=e.createNode(t.allOf[f],r);a.push(sq(p,c).schema),c=Oo(e,c,{type:t.type,...a[f]},`${r}/allOf/${f}`,o)}const u=aq(e,{allOf:a});u&&(i=ro(i,u))}return i.pointer=i.pointer||t.$ref||r,i}const CD=e=>e&&typeof e=="object";function Oo(e,t,n,r,o){var i;if(n==null)throw new Error(`getTemplate: missing schema for data: ${JSON.stringify(t)}`);if(r==null)throw new Error("Missing pointer");let s=Nq(e,n,t,r,o);if(!CD(s))return;if(r=s.pointer,s?.const)return s.const;if(Array.isArray(s.oneOf))if(v3e(t)){const f=s.oneOf[0].type||s.type||s.const&&typeof s.const||Ot(t);s={...s.oneOf[0],type:f}}else{const f=e.createNode(s,r),p=FT(f,t);if(Un(p)){if(t!=null&&o.removeInvalidData!==!0)return t;s=s.oneOf[0],t=void 0}else{const g=p.schema;g.type=(i=g.type)!==null&&i!==void 0?i:s.type,s=g}}if(!CD(s)||s.type==null)return;if(t instanceof File)return t;const a=Array.isArray(s.type)?w3e(s.type,t,s.default):s.type,c=Ot(t);return t!=null&&c!==a&&!(c==="number"&&a==="integer")&&(t=x3e(a,t)),OD[a]==null?o.removeInvalidData?void 0:t:OD[a](e,s,t,r,o)}function w3e(e,t,n){if(t==null){if(n!=null){const o=Ot(n);if(e.includes(o))return o}return e[0]}const r=Ot(t);return e.includes(r)?r:e[0]}const OD={null:(e,t,n)=>Jp(t,n,null),string:(e,t,n)=>Jp(t,n,""),number:(e,t,n)=>Jp(t,n,0),integer:(e,t,n)=>Jp(t,n,0),boolean:(e,t,n)=>Jp(t,n,!1),object:(e,t,n,r,o)=>{var i;const s=t.default===void 0?{}:t.default,a={},c=o.extendDefaults===!1&&t.default!==void 0?[]:(i=t.required)!==null&&i!==void 0?i:[];t.properties&&Object.keys(t.properties).forEach(y=>{const v=n==null||n[y]==null?s[y]:n[y],x=c.includes(y);(v!=null||x||o.addOptionalProps)&&(a[y]=Oo(e,v,t.properties[y],`${r}/properties/${y}`,o))});const u=e.createNode(t,r);let f=cq(u,a);if(f){f=ro(t,f),delete f.dependencies;const y=Oo(e,n,f,`${r}/dependencies`,o);Object.assign(a,y)}n&&(o.removeInvalidData===!0&&(t.additionalProperties===!1||Ot(t.additionalProperties)==="object")?Ot(t.additionalProperties)==="object"&&Object.keys(n).forEach(y=>{a[y]==null&&e.isValid(n[y],t.additionalProperties)&&(a[y]=n[y])}):Object.keys(n).forEach(y=>a[y]==null&&(a[y]=n[y])));const p=e.createNode(t,r),g=d1(p,a);if(Ji(g)){const y=Oo(e,a,{type:"object",...g.schema},r,o);Object.assign(a,y)}return a},array:(e,t,n,r,o)=>{var i,s,a;const c=t.default===void 0?[]:t.default,u=n||c,f=o.extendDefaults===!1&&t.default!==void 0?0:(i=t.minItems)!==null&&i!==void 0?i:0;if(t.items==null){if(t.additionalItems){const g=Math.max(f,u.length);for(let y=0;y<g;y+=1)u[y]=Oo(e,u[y],t.additionalItems,`${r}/additionalItems`,o)}return n||[]}if(Array.isArray(t.items)){const g=Math.max(f??0,(a=(s=t.items)===null||s===void 0?void 0:s.length)!==null&&a!==void 0?a:0);for(let y=0;y<g;y+=1)t.items[y]?u[y]=Oo(e,u[y]==null?c[y]:u[y],t.items[y],`${r}/items/${y}`,o):t.additionalItems&&(u[y]=Oo(e,u[y]==null?c[y]:u[y],t.additionalItems,`${r}/additionalItems`,o));return u}if(Ot(t.items)!=="object")return u;const p=Nq(e,t.items,n,r,o);if(p===!1)return u;if(r=p.pointer||r,p.oneOf&&u.length===0){const g=p.oneOf[0];for(let y=0;y<f;y+=1)u[y]=Oo(e,u[y]==null?c[y]:u[y],g,`${r}/oneOf/0`,o);return u}if(p.oneOf&&u.length>0){const g=Math.max(f,u.length);for(let y=0;y<g;y+=1){let v=u[y]==null?c[y]:u[y];const x=e.createNode(p,r);let S=FT(x,v);S==null||Un(S)?v!=null&&o.removeInvalidData!==!0?u[y]=v:(v=void 0,S=p.oneOf[0],u[y]=Oo(e,v,S,`${r}/oneOf/${y}`,o)):u[y]=Oo(e,v,S.schema,`${r}/oneOf/${y}`,o)}return u}if(p.type){for(let g=0,y=Math.max(f,u.length);g<y;g+=1)u[g]=Oo(e,u[g]==null?c[g]:u[g],p,`${r}/items`,o);return u}return u}};function Jp(e,t,n){return t??(e.const?e.const:e.default===void 0&&Array.isArray(e.enum)?e.enum[0]:e.default===void 0?n:e.default)}const S3e=(e,t,n=e.rootSchema,r)=>(pa={},r?Oo(e,t,n,"#",{...ND,...r}):Oo(e,t,n,"#",ND));function E3e(e,t,n=e.rootSchema,r="#"){const o=e.createNode(n,r);return e.validate(o,t).length===0}function jD(e){const t=[];let n=0;const r=e.length;for(;n<r;){const o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){const i=e.charCodeAt(n++);(i&64512)==56320?t.push(((o&1023)<<10)+(i&1023)+65536):(t.push(o),n--)}else t.push(o)}return t}function AD(e){const t=`${e}`;if(t.includes("e-"))return parseInt(t.replace(/.*e-/,""));const n=t.indexOf(".");return n===-1?0:t.length-(n+1)}var RN,TD;function N3e(){return TD||(TD=1,RN=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){var s=i[o];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n}),RN}var _3e=N3e();const _q=es(_3e),C3e=Object.prototype.hasOwnProperty,$D=(e,t)=>!(e[t]===void 0||!C3e.call(e,t)),O3e={additionalProperties:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(r.additionalProperties===!0||r.additionalProperties==null||Ot(r.patternProperties)==="object"&&r.additionalProperties===!1)return;const i=[];let s=Object.keys(t).filter(c=>uy.propertyBlacklist.includes(c)===!1);const a=Object.keys(r.properties||{});if(Ot(r.patternProperties)==="object"){const c=Object.keys(r.patternProperties).map(u=>new RegExp(u));s=s.filter(u=>{for(let f=0;f<c.length;f+=1)if(c[f].test(u))return!1;return!0})}for(let c=0,u=s.length;c<u;c+=1){const f=s[c];if(a.indexOf(f)===-1){const p=Dt(r.additionalProperties);if(p&&Array.isArray(r.additionalProperties.oneOf)){const g=n.resolveOneOf(e.next(r.additionalProperties),t[f]);Un(g)?i.push(n.errors.additionalPropertiesError({pointer:o,schema:r.additionalProperties,value:t,property:s[c],properties:a,errors:g.data.errors})):i.push(...n.validate(e.next(g,f),t[f]))}else if(p){const g=n.validate(e.next(r.additionalProperties,f),t[f]);i.push(...g)}else i.push(n.errors.noAdditionalPropertiesError({pointer:o,schema:r,value:t,property:s[c],properties:a}))}}return i},allOf:VTe,anyOf:ZTe,dependencies:XTe,enum:(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=Ot(t);if(i==="object"||i==="array"){const s=JSON.stringify(t);for(let a=0;a<r.enum.length;a+=1)if(JSON.stringify(r.enum[a])===s)return}else if(r.enum.includes(t))return;return n.errors.enumError({pointer:o,schema:r,value:t,values:r.enum})},format:(e,t)=>{const{draft:n,schema:r}=e;if(n.validateFormat[r.format])return n.validateFormat[r.format](e,t)},items:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(r.items===!1)return Array.isArray(t)&&t.length===0?void 0:n.errors.invalidDataError({pointer:o,value:t,schema:r});const i=[];for(let s=0;s<t.length;s+=1){const a=t[s],c=n.step(e.next(r),s,t);if(Un(c))return[c];const u=n.validate(c,a);i.push(...u)}return i},maximum:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!isNaN(r.maximum)){if(r.maximum&&r.maximum<t)return n.errors.maximumError({maximum:r.maximum,length:t,value:t,pointer:o,schema:r});if(r.maximum&&r.exclusiveMaximum===!0&&r.maximum===t)return n.errors.maximumError({maximum:r.maximum,length:t,pointer:o,schema:r,value:t})}},maxItems:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!isNaN(r.maxItems)&&r.maxItems<t.length)return n.errors.maxItemsError({maximum:r.maxItems,length:t.length,schema:r,value:t,pointer:o})},maxLength:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(isNaN(r.maxLength))return;const i=jD(t).length;if(r.maxLength<i)return n.errors.maxLengthError({maxLength:r.maxLength,length:i,pointer:o,schema:r,value:t})},maxProperties:(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=Object.keys(t).length;if(isNaN(r.maxProperties)===!1&&r.maxProperties<i)return n.errors.maxPropertiesError({maxProperties:r.maxProperties,length:i,pointer:o,schema:r,value:t})},minLength:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(isNaN(r.minLength))return;const i=jD(t).length;if(r.minLength>i)return r.minLength===1?n.errors.minLengthOneError({minLength:r.minLength,length:i,pointer:o,schema:r,value:t}):n.errors.minLengthError({minLength:r.minLength,length:i,pointer:o,schema:r,value:t})},minimum:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!isNaN(r.minimum)){if(r.minimum>t)return n.errors.minimumError({minimum:r.minimum,length:t,pointer:o,schema:r,value:t});if(r.exclusiveMinimum===!0&&r.minimum===t)return n.errors.minimumError({minimum:r.minimum,length:t,pointer:o,schema:r,value:t})}},minItems:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!isNaN(r.minItems)&&r.minItems>t.length)return r.minItems===1?n.errors.minItemsOneError({minItems:r.minItems,length:t.length,pointer:o,schema:r,value:t}):n.errors.minItemsError({minItems:r.minItems,length:t.length,pointer:o,schema:r,value:t})},minProperties:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(isNaN(r.minProperties))return;const i=Object.keys(t).length;if(r.minProperties>i)return n.errors.minPropertiesError({minProperties:r.minProperties,length:i,pointer:o,schema:r,value:t})},multipleOf:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(isNaN(r.multipleOf)||typeof t!="number")return;const i=AD(t),s=AD(r.multipleOf);if(i>s)return n.errors.multipleOfError({multipleOf:r.multipleOf,value:t,pointer:o,schema:r});const a=Math.pow(10,s),c=Math.round(t*a),u=Math.round(r.multipleOf*a);if(c%u/a!==0)return n.errors.multipleOfError({multipleOf:r.multipleOf,value:t,pointer:o,schema:r})},not:(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=[];return n.validate(e.next(r.not),t).length===0&&i.push(n.errors.notError({value:t,not:r.not,pointer:o,schema:r})),i},oneOf:FTe,pattern:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(new RegExp(r.pattern,"u").test(t)===!1)return n.errors.patternError({pattern:r.pattern,description:r.patternExample||r.pattern,received:t,schema:r,value:t,pointer:o})},patternProperties:(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=r.properties||{},s=r.patternProperties;if(Ot(s)!=="object")return;const a=[],c=Object.keys(t),u=Object.keys(s).map(f=>({regex:new RegExp(f),patternSchema:s[f]}));return c.forEach(f=>{let p=!1;for(let g=0,y=u.length;g<y;g+=1)if(u[g].regex.test(f)){p=!0;const v=n.validate(e.next(u[g].patternSchema,f),t[f]);v&&v.length>0&&a.push(...v)}i[f]||p===!1&&r.additionalProperties===!1&&a.push(n.errors.patternPropertiesError({key:f,pointer:o,schema:r,value:t,patterns:Object.keys(s).join(",")}))}),a},properties:(e,t)=>{const{draft:n,schema:r}=e,o=[],i=Object.keys(r.properties||{});for(let s=0;s<i.length;s+=1){const a=i[s];if($D(t,a)){const c=n.step(e,a,t);if(Un(c))o.push(c);else{const u=n.validate(c,t[a]);o.push(...u)}}}return o},propertiesRequired:(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=[],s=Object.keys(r.properties||{});for(let a=0;a<s.length;a+=1){const c=s[a];if(t[c]===void 0)i.push(n.errors.requiredPropertyError({key:c,pointer:o,schema:r,value:t}));else{const u=n.step(e,c,t),f=n.validate(u,t[c]);i.push(...f)}}return i},required:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(Array.isArray(r.required)!==!1)return r.required.map(i=>{if(!$D(t,i))return n.errors.requiredPropertyError({key:i,pointer:o,schema:r,value:t})})},requiredNotEmpty:(e,t)=>{const{schema:n}=e;if(Array.isArray(n.required)!==!1)return n.required.map(r=>{const{draft:o,schema:i,pointer:s}=e;if(t[r]==null||t[r]==="")return o.errors.valueNotEmptyError({property:r,pointer:`${s}/${r}`,schema:i,value:t})})},uniqueItems:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if((Array.isArray(t)&&r.uniqueItems)===!1)return;const i=[],s=[];return t.forEach((a,c)=>{for(let u=c+1;u<t.length;u+=1)_q(a,t[u])&&!i.includes(u)&&(s.push(n.errors.uniqueItemsError({pointer:`${o}/${u}`,duplicatePointer:`${o}/${c}`,arrayPointer:o,value:JSON.stringify(a),schema:r})),i.push(u))}),s}},j3e={array:(e,t,n)=>{const{draft:r,schema:o,pointer:i}=e,s=n?.[t],a=Ot(o.items);if(a==="object")return ox(e.next(o.items,t),s);if(a==="array"){if(o.items[t]===!0)return e.next(ha(s),t);if(o.items[t]===!1)return r.errors.invalidDataError({key:t,value:s,pointer:i,schema:o});if(o.items[t])return r.resolveRef(e.next(o.items[t],t));if(o.additionalItems===!1)return r.errors.additionalItemsError({key:t,value:s,pointer:i,schema:o});if(o.additionalItems===!0||o.additionalItems===void 0)return e.next(ha(s),t);if(Ot(o.additionalItems)==="object")return e.next(o.additionalItems,t);throw new Error(`Invalid schema ${JSON.stringify(o,null,2)} for ${JSON.stringify(n,null,2)}`)}return o.additionalItems!==!1&&s?e.next(ha(s),t):new Error(`Invalid array schema for ${t} at ${i}`)},object:(e,t,n)=>{var r,o;const{draft:i,pointer:s}=e,a=ox(e,n),c=(r=a.schema)!==null&&r!==void 0?r:a,u=(o=c?.properties)===null||o===void 0?void 0:o[t];if(u!==void 0){if(u===!1)return i.errors.forbiddenPropertyError({property:t,value:n,pointer:s,schema:c});if(u===!0)return e.next(ha(n?.[t]),t);const g=i.resolveRef(e.next(u,t));if(Un(g))return g;if(g&&Array.isArray(g.schema.oneOf)){const y=e.next(g.schema,t),v=i.resolveOneOf(y,n[t]);return Un(v)?v:y.merge(v.schema,"oneOf")}if(g)return g}const{patternProperties:f}=c;if(Ot(f)==="object"){let g;const y=Object.keys(f);for(let v=0,x=y.length;v<x;v+=1)if(g=new RegExp(y[v]),g.test(t))return e.next(f[y[v]],t)}const{additionalProperties:p}=c;if(Ot(p)==="object")return e.next(c.additionalProperties,t);if(n&&(p===void 0||p===!0)){const g=ha(n[t]);return g?e.next(g,t):void 0}return i.errors.unknownPropertyError({property:t,value:n,pointer:`${s}`,schema:c})}};function A3e(e,t,n){var r;const{draft:o,schema:i,pointer:s}=e,a=Ot(n);let c=(r=i.type)!==null&&r!==void 0?r:a;if(Array.isArray(c)){if(!c.includes(a))return o.errors.typeError({value:n,pointer:s,expected:i.type,received:a,schema:i});c=a}const u=j3e[c];if(u){const f=u(e,`${t}`,n);return f===void 0?o.errors.schemaWarning({pointer:s,value:n,schema:i,key:t}):f}return new Error(`Unsupported schema type ${i.type} for key ${t}`)}const T3e={array:(e,t)=>e.draft.typeKeywords.array.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),object:(e,t)=>e.draft.typeKeywords.object.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),string:(e,t)=>e.draft.typeKeywords.string.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),integer:(e,t)=>e.draft.typeKeywords.number.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),number:(e,t)=>e.draft.typeKeywords.number.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),boolean:(e,t)=>e.draft.typeKeywords.boolean.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t)),null:(e,t)=>e.draft.typeKeywords.null.filter(n=>e.schema&&e.schema[n]!=null).map(n=>e.draft.validateKeyword[n](e,t))};function $3e(e,t){const n=Ot(e);return n==="number"&&(t==="integer"||Array.isArray(t)&&t.includes("integer"))?Number.isInteger(e)||isNaN(e)?"integer":"number":n}function R3e(e,t){if(!Ji(e))throw new Error("node expected");const{draft:n,pointer:r}=e;e=e.resolveRef();const o=e.schema;if(o==null)throw new Error("missing schema");if(Ot(o)==="boolean")return o?[]:[n.errors.invalidDataError({pointer:r,schema:o,value:t})];if(Un(o))return[o];if(o.const!==void 0)return _q(o.const,t)?[]:[n.errors.constError({pointer:r,schema:o,value:t,expected:o.const})];const i=$3e(t,o.type),s=o.type||i;return i!==s&&(!Array.isArray(s)||!s.includes(i))?[n.errors.typeError({pointer:r,schema:o,value:t,received:i,expected:s})]:n.validateType[i]==null?[n.errors.invalidTypeError({pointer:r,schema:o,value:t,receivedType:i})]:hg(n.validateType[i](e,t)).filter(rx)}function UC(e,t,n){const r=e.resolveRef(),{draft:o,schema:i,pointer:s}=r;n(i,t,s);const a=Ot(t);a==="object"?Object.keys(t).forEach(c=>{const u=o.step(r,c,t);Ji(u)&&UC(u,t[c],n)}):a==="array"&&t.forEach((c,u)=>{const f=o.step(r,u,t);Ji(f)&&UC(f,t[u],n)})}function k3e(e,t,n){n.$id=n.$id||t,e.remotes[t]=e.compileSchema(n)}const RD="__compiled",kD="__ref",M3e="getRef",P3e="getRoot",D3e="getContext",I3e=/(#|\/)+$/g;function L3e(e,t,n=t,r=!1){if(t===!0||t===!1||t===void 0||t[RD]!==void 0)return t;const o={ids:{},anchors:{},remotes:e.remotes},i=JSON.stringify(t),s=JSON.parse(i);if(Object.defineProperties(s,{[RD]:{enumerable:!1,value:!0},[D3e]:{enumerable:!1,value:()=>o},[M3e]:{enumerable:!1,value:ca.bind(null,o,s)}}),r===!1&&i.includes("$ref")===!1)return s;s!==n&&Object.defineProperty(s,"$defs",{enumerable:!0,value:Object.assign({},n.definitions,n.$defs,s.definitions,s.$defs)});const a={},c=()=>s;return Ri(s,(u,f)=>{var p;if(u.$id){if(u.$id.startsWith("http")&&/(allOf|anyOf|oneOf|if)\/\d+$/.test(f)){const S=f.replace(/\/(allOf|anyOf|oneOf|if)\/\d+$/,""),E=cu.get(s,S);u.$id=(p=E.$id)!==null&&p!==void 0?p:u.$id}o.ids[u.$id.replace(I3e,"")]=f}f=`#${f}`.replace(/##+/,"#");const g=f.replace(/\/[^/]+$/,""),y=f.replace(/\/[^/]+\/[^/]+$/,""),v=a[g]||a[y],x=gD(v,u.$id);a[f]=x,o.ids[x]==null&&(o.ids[x]=f),u.$anchor&&(o.anchors[`${x}#${u.$anchor}`]=f),u.$ref&&!u[kD]&&(Object.defineProperty(u,kD,{enumerable:!1,value:gD(x,u.$ref)}),Object.defineProperty(u,P3e,{enumerable:!1,value:c}))}),s}const F3e={...O3e,contains:(e,t)=>{var n,r;const{draft:o,schema:i,pointer:s}=e;if(i.contains===!1)return o.errors.containsArrayError({pointer:s,value:t,schema:i});if(i.contains===!0)return Array.isArray(t)&&t.length===0?o.errors.containsAnyError({pointer:s,value:t,schema:i}):void 0;if(Ot(i.contains)!=="object")return;let a=0;for(let f=0;f<t.length;f+=1)o.validate(e.next(i.contains,f),t[f]).length===0&&a++;const c=(n=i.maxContains)!==null&&n!==void 0?n:1/0,u=(r=i.minContains)!==null&&r!==void 0?r:1;if(!(c>=a&&u<=a))return c<a?o.errors.containsMaxError({pointer:s,schema:i,delta:a-c,value:t}):u>a?o.errors.containsMinError({pointer:s,schema:i,delta:u-a,value:t}):o.errors.containsError({pointer:s,schema:i,value:t})},exclusiveMaximum:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!isNaN(r.exclusiveMaximum)&&r.exclusiveMaximum<=t)return n.errors.maximumError({maximum:r.exclusiveMaximum,length:t,pointer:o,schema:r,value:t})},exclusiveMinimum:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!isNaN(r.exclusiveMinimum)&&r.exclusiveMinimum>=t)return n.errors.minimumError({minimum:r.exclusiveMinimum,length:t,pointer:o,schema:r,value:t})},if:zTe,maximum:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!isNaN(r.maximum)&&r.maximum&&r.maximum<t)return n.errors.maximumError({maximum:r.maximum,length:t,pointer:o,schema:r,value:t})},minimum:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(!isNaN(r.minimum)&&r.minimum>t)return n.errors.minimumError({minimum:r.minimum,length:t,pointer:o,schema:r,value:t})},patternProperties:(e,t)=>{const{draft:n,schema:r,pointer:o}=e,i=r.properties||{},s=r.patternProperties;if(Ot(s)!=="object")return;const a=[],c=Object.keys(t),u=Object.keys(s).map(f=>({regex:new RegExp(f),patternSchema:s[f]}));return c.forEach(f=>{let p=!1;for(let g=0,y=u.length;g<y;g+=1)if(u[g].regex.test(f)){if(p=!0,u[g].patternSchema===!1){a.push(n.errors.patternPropertiesError({key:f,pointer:o,patterns:Object.keys(s).join(","),schema:r,value:t}));return}const v=n.validate(e.next(u[g].patternSchema,f),t[f]);v&&v.length>0&&a.push(...v)}i[f]||p===!1&&r.additionalProperties===!1&&a.push(n.errors.patternPropertiesError({key:f,pointer:o,patterns:Object.keys(s).join(","),schema:r,value:t}))}),a},propertyNames:(e,t)=>{const{draft:n,schema:r,pointer:o}=e;if(r.propertyNames===!1)return Object.keys(t).length===0?void 0:n.errors.invalidPropertyNameError({property:Object.keys(t),pointer:o,value:t,schema:r});if(r.propertyNames===!0||Ot(r.propertyNames)!=="object")return;const i=[],s=Object.keys(t),a={...r.propertyNames,type:"string"};return s.forEach(c=>{const u=e.next(a,c),f=n.validate(u,c);f.length>0&&i.push(n.errors.invalidPropertyNameError({property:c,pointer:o,validationError:f[0],value:t[c],schema:r}))}),i}},Cq=e=>Dt(e)?Object.keys(e).map(t=>new RegExp(t)):[];function z3e(e,t,n){var r,o;const i=e.draft.resolveRef(e),{schema:s}=i;if(s.additionalProperties===!0)return!0;if(!((r=s.properties)===null||r===void 0)&&r[t]){const c=(o=s.properties)===null||o===void 0?void 0:o[t];if(i.draft.isValid(n,c))return!0}if(Cq(s.patternProperties).find(c=>c.test(t)))return!0;if(Dt(s.additionalProperties)){const c=s.additionalProperties;return i.draft.validate(i.next(c),n)}return!1}const B3e={...F3e,dependencies:void 0,dependentSchemas:KTe,dependentRequired:YTe,unevaluatedProperties:(e,t)=>{var n;const{draft:r,schema:o,pointer:i}=e;if(!Dt(t)||o.unevaluatedProperties==null)return;let s=Object.keys(t);if(s.length===0)return;const a=ox(e,t),c=(n=a.schema)!==null&&n!==void 0?n:a;if(c.unevaluatedProperties===!0)return;const u=Cq(c.patternProperties);if(s=s.filter(p=>{var g;return!(!((g=c.properties)===null||g===void 0)&&g[p]||Dt(o.if)&&z3e(e.next({type:"object",...o.if}),p,t[p])||u.find(y=>y.test(p))||c.additionalProperties)}),s.length===0)return;const f=[];return c.unevaluatedProperties===!1?(s.forEach(p=>{f.push(r.errors.unevaluatedPropertyError({pointer:`${i}/${p}`,value:JSON.stringify(t[p]),schema:o}))}),f):(s.forEach(p=>{if(Dt(c.unevaluatedProperties)){const g=r.validate(e.next(c.unevaluatedProperties,p),t[p]);f.push(...g)}}),f)},unevaluatedItems:(e,t)=>{var n;const{draft:r,schema:o,pointer:i}=e;if(!Array.isArray(t)||t.length===0||o.unevaluatedItems==null||o.unevaluatedItems===!0)return;const s=ox(r.resolveRef(e),t),a=(n=s.schema)!==null&&n!==void 0?n:s;if(a.unevaluatedItems===!0||a.additionalItems===!0)return;if(Dt(o.if)){const u={type:"array",...o.if};if(r.isValid(t,u)&&Array.isArray(u.items)&&u.items.length===t.length)return}if(Dt(a.items)){const u={...a,unevaluatedItems:void 0};return r.validate(e.next(u),t).map(p=>r.errors.unevaluatedItemsError({...p.data}))}if(Array.isArray(a.items)){const u=[];for(let f=a.items.length;f<t.length;f+=1)f<a.items.length?r.validate(e.next(a.items[f],f),t[f]).length>0&&u.push({index:f,value:t[f]}):u.push({index:f,value:t[f]});return u.map(f=>r.errors.unevaluatedItemsError({pointer:`${i}/${f.index}`,value:JSON.stringify(f.value),schema:a.unevaluatedItems}))}if(Dt(a.unevaluatedItems))return t.map((u,f)=>{if(!r.isValid(u,a.unevaluatedItems))return r.errors.unevaluatedItemsError({pointer:`${i}/${f}`,value:JSON.stringify(u),schema:a.unevaluatedItems})});const c=[];return t.forEach((u,f)=>{c.push(r.errors.unevaluatedItemsError({pointer:`${i}/${f}`,value:JSON.stringify(u),schema:o}))}),c}},V3e={typeKeywords:{array:["allOf","anyOf","contains","enum","if","items","maxItems","minItems","not","oneOf","unevaluatedItems","uniqueItems"],boolean:["allOf","anyOf","enum","not","oneOf"],object:["additionalProperties","allOf","anyOf","dependentSchemas","dependentRequired","enum","format","if","maxProperties","minProperties","not","oneOf","patternProperties","properties","propertyNames","required","unevaluatedProperties"],string:["allOf","anyOf","enum","format","if","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","exclusiveMaximum","exclusiveMinimum","format","if","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:B3e,validateType:T3e,validateFormat:VC,errors:J$e,createNode:WTe,addRemoteSchema:k3e,compileSchema:L3e,createSchemaOf:ha,each:UC,eachSchema:Ri,getChildSchemaSelection:h3e,getSchema:p3e,getTemplate:S3e,isValid:E3e,resolveAllOf:BTe,resolveAnyOf:QTe,resolveOneOf:ITe,resolveRef:lq,step:A3e,validate:R3e,templateDefaultOptions:uy.templateDefaultOptions};class UT extends D$e{constructor(t,n={}){super(Eq(V3e,n),t)}}/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/function MD(e){return Object.prototype.toString.call(e)==="[object Object]"}function PD(e){var t,n;return MD(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(MD(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Gb={exports:{}},U3e=Gb.exports,DD;function H3e(){return DD||(DD=1,function(e){(function(t,n){e.exports=n()})(U3e,function(){var t=Object.prototype.toString;function n(p,g){return p==null?!1:Object.prototype.hasOwnProperty.call(p,g)}function r(p){if(!p||s(p)&&p.length===0)return!0;if(typeof p!="string"){for(var g in p)if(n(p,g))return!1;return!0}return!1}function o(p){return t.call(p)}function i(p){return typeof p=="object"&&o(p)==="[object Object]"}var s=Array.isArray||function(p){return t.call(p)==="[object Array]"};function a(p){return typeof p=="boolean"||o(p)==="[object Boolean]"}function c(p){var g=parseInt(p);return g.toString()===p?g:p}function u(p){p=p||{};var g=function(E){return Object.keys(g).reduce(function(C,_){return _==="create"||typeof g[_]=="function"&&(C[_]=g[_].bind(g,E)),C},{})},y;p.includeInheritedProps?y=function(){return!0}:y=function(E,C){return typeof C=="number"&&Array.isArray(E)||n(E,C)};function v(E,C){if(y(E,C))return E[C]}var x;p.includeInheritedProps?x=function(E,C){typeof C!="string"&&typeof C!="number"&&(C=String(C));var _=v(E,C);if(C==="__proto__"||C==="prototype"||C==="constructor"&&typeof _=="function")throw new Error("For security reasons, object's magic properties cannot be set");return _}:x=function(E,C){return v(E,C)};function S(E,C,_,j){if(typeof C=="number"&&(C=[C]),!C||C.length===0)return E;if(typeof C=="string")return S(E,C.split(".").map(c),_,j);var A=C[0],T=x(E,A);return C.length===1?((T===void 0||!j)&&(E[A]=_),T):(T===void 0&&(typeof C[1]=="number"?E[A]=[]:E[A]={}),S(E[A],C.slice(1),_,j))}return g.has=function(E,C){if(typeof C=="number"?C=[C]:typeof C=="string"&&(C=C.split(".")),!C||C.length===0)return!!E;for(var _=0;_<C.length;_++){var j=c(C[_]);if(typeof j=="number"&&s(E)&&j<E.length||(p.includeInheritedProps?j in Object(E):n(E,j)))E=E[j];else return!1}return!0},g.ensureExists=function(E,C,_){return S(E,C,_,!0)},g.set=function(E,C,_,j){return S(E,C,_,j)},g.insert=function(E,C,_,j){var A=g.get(E,C);j=~~j,s(A)||(A=[],g.set(E,C,A)),A.splice(j,0,_)},g.empty=function(E,C){if(!r(C)&&E!=null){var _,j;if(_=g.get(E,C)){if(typeof _=="string")return g.set(E,C,"");if(a(_))return g.set(E,C,!1);if(typeof _=="number")return g.set(E,C,0);if(s(_))_.length=0;else if(i(_))for(j in _)y(_,j)&&delete _[j];else return g.set(E,C,null)}}},g.push=function(E,C){var _=g.get(E,C);s(_)||(_=[],g.set(E,C,_)),_.push.apply(_,Array.prototype.slice.call(arguments,2))},g.coalesce=function(E,C,_){for(var j,A=0,T=C.length;A<T;A++)if((j=g.get(E,C[A]))!==void 0)return j;return _},g.get=function(E,C,_){if(typeof C=="number"&&(C=[C]),!C||C.length===0)return E;if(E==null)return _;if(typeof C=="string")return g.get(E,C.split("."),_);var j=c(C[0]),A=x(E,j);return A===void 0?_:C.length===1?A:g.get(E[j],C.slice(1),_)},g.del=function(C,_){if(typeof _=="number"&&(_=[_]),C==null||r(_))return C;if(typeof _=="string")return g.del(C,_.split("."));var j=c(_[0]);if(x(C,j),!y(C,j))return C;if(_.length===1)s(C)?C.splice(j,1):delete C[j];else return g.del(C[j],_.slice(1));return C},g}var f=u();return f.create=u,f.withInheritedProps=u({includeInheritedProps:!0}),f})}(Gb)),Gb.exports}var q3e=H3e();const W3e=es(q3e);var xf=Object.prototype.hasOwnProperty;function Ts(e){if(HC(e))return!1;if(!e||Jf(e)&&e.length===0)return!0;if(!Oq(e)){for(var t in e)if(xf.call(e,t))return!1;return!0}return!1}function HC(e){return typeof e=="number"}function Oq(e){return typeof e=="string"}function Jf(e){return Array.isArray(e)}function qC(e,t){for(var n in t)xf.call(t,n)&&(e[n]=t[n]);return e}function G3e(e){var t=parseInt(e);return t.toString()===e?t:e}function ix(e,t,n){return e==null?t?n?[]:{}:e:Jf(e)?e.slice():qC({},e)}function sx(e,t){if(e!==t&&PD(e)&&PD(t)){var n={};for(var r in e)xf.call(e,r)&&(xf.call(t,r)?n[r]=sx(e[r],t[r]):n[r]=e[r]);for(r in t)xf.call(t,r)&&(n[r]=sx(e[r],t[r]));return n}return t}function ka(e,t,n,r){if(HC(n)&&(n=[n]),Ts(n))return t;if(Oq(n))return ka(e,t,n.split(".").map(G3e),r);var o=n[0];return(!e||e===t)&&(e=ix(t,!0,HC(o))),n.length===1?r(e,o):(t!=null&&(t=t[o]),e[o]=ka(e[o],t,n.slice(1),r),e)}var bo={};bo.set=function(t,n,r,o){return Ts(r)?o:ka(t,n,r,function(i,s){return i[s]=o,i})};bo.update=function(t,n,r,o){return Ts(r)?o(ix(n)):ka(t,n,r,function(i,s){return i[s]=o(i[s]),i})};bo.push=function(t,n,r){var o=Array.prototype.slice.call(arguments,3);return Ts(r)?Jf(n)?n.concat(o):o:ka(t,n,r,function(i,s){return Jf(i[s])?i[s]=i[s].concat(o):i[s]=o,i})};bo.insert=function(t,n,r,o,i){if(i=~~i,Ts(r)){if(!Jf(n))return[o];var s=n.slice(0,i);return s.push(o),s.concat(n.slice(i))}return ka(t,n,r,function(a,c){var u=a[c];if(!Jf(u)){if(u!=null&&typeof u<"u")throw new Error("Expected "+r+"to be an array. Instead got "+typeof r);u=[]}var f=u.slice(0,i);return f.push(o),a[c]=f.concat(u.slice(i)),a})};bo.del=function(t,n,r){if(!Ts(r))return ka(t,n,r,function(o,i){return Array.isArray(o)?o[i]!==void 0&&o.splice(i,1):xf.call(o,i)&&delete o[i],o})};bo.assign=function(t,n,r,o){return Ts(r)?Ts(o)?n:qC(ix(n),o):ka(t,n,r,function(i,s){o=Object(o);var a=ix(i[s],!0);return qC(a,o),i[s]=a,i})};bo.merge=function(t,n,r,o){return Ts(r)?Ts(o)?n:sx(n,o):ka(t,n,r,function(i,s){return o=Object(o),i[s]=sx(i[s],o),i})};var J3e=bo.set.bind(null,null);bo.update.bind(null,null);bo.push.bind(null,null);bo.insert.bind(null,null);var Y3e=bo.del.bind(null,null);bo.assign.bind(null,null);bo.merge.bind(null,null);W3e.get;function K3e(e){return e==null||e===""}function X3e(e,t,n){if(!(K3e(e)&&typeof n?.required=="boolean"&&!n.required)){switch(t.type){case"string":return String(e);case"integer":case"number":return Number(e);case"boolean":return["true","1",1,"on",!0].includes(e);case"null":return null}return e}}const HT=e=>typeof e<"u"&&e!==null&&e!=="";function ax(e){return"#"+(e.includes(".")?e.split("."):[e]).filter(HT).map(n=>"/"+n).join("")}function qT(e="",t=""){const n=e.includes(".")?e.split("."):[e];return[t,...n].filter(HT).join(".")}function jq(e="",t=""){return[...e.includes(".")?e.split("."):[e],t].filter(HT).join(".")}function Q3e(e){return e.substring(0,e.lastIndexOf("/"))}function Z3e(e,t,n,r){try{if(t==="#/"||!n)return!1;try{const c=e.getSchema({pointer:t,data:r,schema:n});if(typeof c=="object"&&"const"in c)return!0}catch{return!1}const o=Q3e(t),i=e.getSchema({pointer:o,data:r}),s=t.split("/").pop();return!!i?.required?.includes(s)}catch(o){return console.warn("isRequired",{pointer:t,schema:n,data:r,e:o}),!1}}function mu(e,t){if(!e||!t)return!1;const n=Array.isArray(e)?e:[e];return(Array.isArray(t)?t:[t]).some(o=>n.includes(o))}function Aq(e,t){if(typeof t=="object"&&"title"in t)return t.title;if(!e)return"";const n=e.includes(".")?e.split(".").pop()??"":e;return Ta(n)}function WT(e){if(!(!e||typeof e!="object"))return e.anyOf??e.oneOf}function Tq(e,t){const n=WT(e);if(!n)return[-1,[],void 0];const r=n.findIndex(o=>new UT(o).validate(t,o).length===0);return r===-1?[-1,n,void 0]:[r,n,n[r]]}function e5e(e,t,n){if(typeof e!="object"||!("properties"in e)||t.length===0)return[e,n];const r=JSON.parse(JSON.stringify(e)),o=n?JSON.parse(JSON.stringify(n)):void 0,i={...r,properties:mo(r.properties,t)};i.required&&(i.required=i.required.filter(a=>!t.includes(a)));const s=mo(o,t);return[i,s]}function $q(e){return typeof e=="object"&&"type"in e&&!mu(e.type,"error")}function t5e(...e){for(const t of e)if(typeof t<"u")return t}const h1=w.createContext(void 0);h1.displayName="FormContext";function dy({schema:e,initialValues:t,initialOpts:n,children:r,onChange:o,onSubmit:i,onInvalidSubmit:s,validateOn:a="submit",hiddenSubmit:c=!0,beforeSubmit:u,ignoreKeys:f=[],options:p={},readOnly:g=!1,...y}){const[v,x]=e5e(e,f,t),S=w.useMemo(()=>new UT(v),[JSON.stringify(v)]),E=x??S.getTemplate(void 0,v,n),C=w.useMemo(()=>Gf({dirty:!1,submitting:!1,errors:[],data:E}),[E]),_=IT(C),j=w.useRef(null);w.useEffect(()=>{E&&a==="change"&&H()},[E]);async function A(B){const{data:U,errors:M}=H();if(i){B.preventDefault(),_(z=>({...z,submitting:!0}));try{M.length===0?await i(U):(console.error("form: invalid",{data:U,errors:M}),s?.(M,U))}catch(z){console.warn(z)}return _(z=>({...z,submitting:!1})),!1}else if(M.length>0)return B.preventDefault(),s?.(M,U),!1}const T=It((B,U)=>{_(M=>{const z=M.data,$=J3e(z,B,U);return o?.($,B,U,F),{...M,data:$}}),V()}),k=It(B=>{_(U=>{const M=U.data,z=Y3e(M,B);return o?.(z,B,void 0,F),{...U,data:z}}),V()}),R=It(()=>nq().get(C)),V=It(()=>{const B=R();_(U=>({...U,dirty:!va(E,B.data)})),(a==="change"||B?.errors?.length>0)&&H()}),H=It(B=>{const M=(u??($=>$))(B??R()?.data),z=S.validate(M,v);return _($=>({...$,errors:z})),{data:M,errors:z}}),F=w.useMemo(()=>({_formStateAtom:C,setValue:T,deleteValue:k,schema:v,lib:S,options:p,root:"",path:"",readOnly:g}),[v,E,p,g]);return h.jsxs("form",{...y,ref:j,onSubmit:A,children:[h.jsxs(h1.Provider,{value:F,children:[r||h.jsx(_r,{name:""}),p?.debug&&h.jsx(hy,{})]}),c&&h.jsx("button",{style:{visibility:"hidden"},type:"submit",children:"Submit"})]})}function Wa(){return w.useContext(h1)}function fy({children:e,overrideData:t,prefix:n,...r}){const o=Wa(),i={};n&&(i.root=n);const s={...o,...r,...i};return h.jsx(h1.Provider,{value:s,children:e})}function jc(e,t){const{_formStateAtom:n,root:r}=Wa();if((typeof e!="string"||e.length===0)&&t?.strict===!0)return{value:void 0,errors:[]};const o=cy(n,w.useCallback(i=>{const s=qT(e,r),a=ax(s);return{value:Bn(i.data,s),errors:i.errors.filter(c=>c.data.pointer.startsWith(a))}},[e]),va);return kh(o)[0]}function Mh(e,t){const{_formStateAtom:n,root:r}=Wa(),o=cy(n,w.useCallback(i=>{const s=qT(e,r),a=ax(s);return i.errors.filter(c=>t?.strict?c.data.pointer===a:c.data.pointer.startsWith(a))},[e]),va);return kh(o)[0]}function Rq(e,t=[]){const{_formStateAtom:n}=Wa(),r=cy(n,w.useCallback(e,t),va);return kh(r)[0]}function Si(e,t,n){const{_formStateAtom:r,root:o,lib:i,...s}=Wa(),a=s.schema,c=cy(r,w.useCallback(u=>{const f=ax(e),p=qT(e,o),g=ax(p),y=Bn(u.data,p),v=f==="#/"?a:i.getSchema({pointer:f,data:y,schema:a}),x=Z3e(i,g,a,u.data),S={...s,path:p,root:o,schema:v,pointer:f,required:x},E=t?.({...S,_formStateAtom:r,lib:i,value:y});return{...S,value:E}},[e,a??{},o]),va);return{...DT(c),_formStateAtom:r,lib:i}}function Ph({children:e,selector:t}){return e(Rq(t??(n=>n)))}function hy({force:e=!1}){const{options:t}=Wa();if(t?.debug!==!0&&e!==!0)return null;const n=Rq(r=>r);return h.jsx(Vr,{json:n,expand:99,showCopy:!0})}function pg({name:e,label:t,required:n,schema:r,wrapper:o,hidden:i,errorPlacement:s="bottom",descriptionPlacement:a="bottom",children:c,fieldId:u,className:f,...p}){const g=Mh(e,{strict:!0}),y=r?.examples||[],v=`${e}-examples`,x=p?.description??r?.description,S=typeof t<"u"?t:r?Aq(e,r):e,E=g.length>0&&h.jsx(jH,{children:g.map(_=>_.message).join(", ")}),C=x?["top","bottom"].includes(a)?h.jsx(Lje,{className:a==="top"?"-mt-1 mb-1":"mb-2",children:x}):h.jsx(ns,{label:x,children:h.jsx($B,{className:"size-4 opacity-50"})}):null;return h.jsxs(mi,{error:g.length>0,as:o==="fieldset"?"fieldset":"div",className:Be(i?"hidden":"relative",f),children:[s==="top"&&E,h.jsx(n5e,{name:e,schema:r,required:n}),S&&h.jsxs(uc,{as:o==="fieldset"?"legend":"label",htmlFor:u,className:"self-start flex flex-row gap-1 items-center",children:[S," ",n&&h.jsx("span",{className:"font-medium opacity-30",children:"*"}),a==="label"&&C]}),a==="top"&&C,h.jsx("div",{className:"flex flex-row flex-grow gap-2",children:h.jsxs("div",{className:"flex flex-1 flex-col gap-3",children:[w.Children.count(c)===1&&w.isValidElement(c)?w.cloneElement(c,{list:y.length>0?v:void 0}):c,y.length>0&&h.jsx("datalist",{id:v,children:y.map((_,j)=>h.jsx("option",{value:_},j))})]})}),a==="bottom"&&C,s==="bottom"&&E]})}const n5e=({name:e,schema:t,required:n})=>{const{options:r}=Wa();if(!r?.debug)return null;const{value:o}=jc(e),i=Mh(e,{strict:!0});return h.jsx("div",{className:"absolute top-0 right-0",children:h.jsx(o1,{overlayProps:{className:"max-w-none"},position:"bottom-end",target:({toggle:s})=>h.jsx(Vr,{className:"bg-background pr-3 text-sm",json:{name:e,value:o,required:n,schema:t,errors:i},expand:6}),children:h.jsx(ft,{Icon:TB,size:"xs",className:"opacity-30",tabIndex:-1})})})},r5e=({path:e="",labelAdd:t="Add",wrapperProps:n={wrapper:"fieldset"}})=>{const{setValue:r,pointer:o,required:i,schema:s,...a}=Si(e);return!s||typeof s>"u"?`ArrayField(${e}): no schema ${o}`:s.uniqueItems&&typeof s.items=="object"&&"enum"in s.items?h.jsx(pg,{...n,name:e,schema:s,children:h.jsx(JT,{required:!0,name:e,schema:s.items,multiple:!0,className:"h-auto",onChange:c=>{const u=Array.from(c.target.selectedOptions).map(f=>f.value);r(a.path,u)}})}):h.jsxs(pg,{...n,name:e,schema:s,children:[h.jsx(s5e,{name:e,children:({value:c})=>c?.map((u,f)=>h.jsx(o5e,{path:e,index:f,schema:s},f))}),h.jsx("div",{className:"flex flex-row",children:h.jsx(a5e,{path:e,schema:s,label:t})})]})},o5e=w.memo(({path:e,index:t,schema:n})=>{const{value:r,path:o,...i}=Si(e,p=>p.value?.[t]),s=jq(o,t);let a=n.items;if(WT(n.items)){const[,,p]=Tq(n.items,r);a=p}const u=It(p=>{i.deleteValue(p)}),f=w.useMemo(()=>h.jsx(ft,{Icon:kB,onClick:()=>u(s),size:"sm"}),[s]);return h.jsx(fy,{prefix:s,schema:a,children:h.jsxs("div",{className:"flex flex-row gap-2 w-full",children:[h.jsx(i5e,{label:!1}),f]})})},va),i5e=e=>{const{value:t}=jc(""),n={value:["string","number","boolean"].includes(typeof t)?t:void 0};return h.jsx(_r,{name:"",label:!1,...e,inputProps:n})},s5e=w.memo(({name:e,children:t})=>t(jc(e)),(e,t)=>e.value?.length===t.value?.length),a5e=({schema:e,path:t,label:n="Add"})=>{const{setValue:r,value:{currentIndex:o},path:i,...s}=Si(t,f=>({currentIndex:f.value?.length??0})),a=WT(e.items),c={addOptionalProps:!0};function u(f){const p=jq(i,o);r(p,f??s.lib.getTemplate(void 0,e.items,c))}return a?h.jsx(Nr,{dropdownWrapperProps:{className:"min-w-0"},items:a.map((f,p)=>({label:f.title??`Option ${p+1}`,onClick:()=>u(s.lib.getTemplate(void 0,f,c))})),onClickItem:console.log,children:h.jsx(Xe,{IconLeft:Zve,children:n})}):h.jsx(Xe,{onClick:()=>u(),children:n})},kq=w.createContext(void 0),GT=()=>w.useContext(kq),l5e=Gf(null),c5e=({path:e="",children:t})=>{const{setValue:n,lib:r,pointer:o,value:{matchedIndex:i,schemas:s},schema:a}=Si(e,x=>{const[S,E=[]]=Tq(x.schema,x.value);return{matchedIndex:S,schemas:E}}),c=Mh(e,{strict:!0});if(!a)return`AnyOfField(${e}): no schema ${o}`;const[u,f]=kh(l5e),{options:{anyOfNoneSelectedMode:p}}=Wa(),g=u!==null?u:i>-1?i:p==="first"?0:null,y=It(x=>{n(e,x!==null?r.getTemplate(void 0,s[x]):void 0),f(x)}),v=w.useMemo(()=>{const x=s.map((C,_)=>C.title??`Option ${_+1}`),S={type:"string",enum:x},E=g!==null?s[g]:void 0;return{options:x,selectSchema:S,selectedSchema:E,schema:a,schemas:s,selected:g}},[g]);return h.jsx(kq.Provider,{value:{...v,select:y,path:e,errors:c},children:t},g)},u5e=()=>{const{selected:e,select:t,path:n,schema:r,options:o,selectSchema:i}=GT(),s=It(c=>{const u=c.target.value?Number(c.target.value):null;t(u)}),a=w.useMemo(()=>o.map((c,u)=>({label:c,value:u})),[]);return h.jsxs(h.Fragment,{children:[h.jsx(uc,{children:Aq(n,r)}),h.jsx(JT,{schema:i,options:a,onChange:s,value:e??void 0,className:"h-8 py-1"})]})},d5e=({name:e,label:t,...n})=>{const{selected:r,selectedSchema:o,path:i,errors:s}=GT();return r===null?null:h.jsx(fy,{prefix:i,schema:o,children:h.jsx("div",{className:Be(s.length>0&&"bg-red-500/10"),children:h.jsx(f5e,{label:!1,...n},`${i}_${r}`)})})},f5e=e=>{const{value:t}=jc(""),n={value:["string","number","boolean"].includes(typeof t)?t:void 0};return h.jsx(_r,{name:"",label:!1,...e,inputProps:n})},Em={Root:c5e,Select:u5e,Field:d5e,useContext:GT},h5e=e=>h.jsx("fieldset",{children:h.jsxs(Em.Root,{...e,children:[h.jsx("legend",{className:"flex flex-row gap-2 items-center py-2",children:h.jsx(Em.Select,{})}),h.jsx(Em.Field,{})]})}),p5e=w.lazy(()=>Kw(()=>import("./CodeEditor-BSbZC6_t.js"),[]));function Mq({editable:e,className:t,value:n,onChange:r,onBlur:o,emptyAs:i=void 0,onInvalid:s,...a}){const[c,u]=w.useState(n?JSON.stringify(n,null,2):i),[f,p]=w.useState(!1),g=Og(v=>{try{p(!1),r?.(v?JSON.parse(v):i)}catch(x){s?.(x),p(!0)}},250),y=v=>{try{const x=JSON.stringify(n,null,2);u(x)}catch{}o?.(v)};return w.useEffect(()=>{c||u(n?JSON.stringify(n,null,2):i)},[n]),h.jsx(w.Suspense,{fallback:null,children:h.jsx(p5e,{className:Be("flex w-full border border-muted",!e&&"opacity-70",f&&"border-red-500",t),editable:e,_extensions:{json:!0},value:c??void 0,onChange:g,onBlur:y,...a})})}const p1=({path:e="",label:t,wrapperProps:n={}})=>{const{schema:r}=Si(e);if(!$q(r))return`ObjectField "${e}": no schema`;const o=Object.entries(r.properties??{});return h.jsx(pg,{name:e,schema:{...r,description:void 0},wrapper:"fieldset",errorPlacement:"top",...n,children:o.length===0?h.jsx(WC,{path:e}):o.map(([i,s])=>{const a=[e,i].filter(Boolean).join(".");if(!(typeof s>"u"||typeof s=="boolean"))return s.anyOf||s.oneOf?h.jsx(h5e,{path:a},a):h.jsx(_r,{name:a},a)})})},WC=({path:e})=>{const{value:t}=jc(e),{setValue:n,path:r}=Si(e);return h.jsx(Mq,{value:t,onChange:o=>n(r,o)})},_r=e=>h.jsx(Ch,{fallback:m5e(e),children:h.jsx(g5e,{...e})}),Pq=({as:e="div",className:t,...n})=>{const r=e;return h.jsx(r,{className:[t,"hidden"].filter(Boolean).join(" "),children:h.jsx(_r,{...n})})},m5e=({name:e})=>({error:t})=>h.jsxs(Dq,{children:['Field "',e,'" error: ',t.message]}),g5e=({name:e,onChange:t,placeholder:n,required:r,inputProps:o,...i})=>{const{path:s,setValue:a,schema:c,...u}=Si(e),f=`${e}-${w.useId()}`,p=typeof r=="boolean"?r:u.required;if(!c)return h.jsxs(Dq,{children:["[Field] ",s," has no schema (",JSON.stringify(c),")"]});if(mu(c.type,"object"))return h.jsx(p1,{path:e,wrapperProps:i});if(mu(c.type,"array"))return h.jsx(r5e,{path:e});w.useEffect(()=>{o?.defaultValue&&a(s,o.defaultValue)},[o?.defaultValue]);const g=t5e(u.readOnly,o?.disabled,i.disabled,c.readOnly,"const"in c,!1),y=It(v=>{const x=X3e(v.target.value,c,{required:p});typeof x>"u"&&!p&&u.options?.keepEmpty!==!0?u.deleteValue(s):a(s,x)});return h.jsx(pg,{name:e,required:p,schema:c,fieldId:f,...i,children:h.jsx(JT,{placeholder:n,...o,id:f,schema:c,name:e,required:p,disabled:g,onChange:t??y})})},Dq=({children:e})=>h.jsx("pre",{className:"dark:bg-red-950 bg-red-100 rounded-md px-3 py-1.5 text-wrap whitespace-break-spaces break-all",children:e}),JT=({schema:e,render:t,...n})=>{const{value:r}=jc(n.name,{strict:!0});if(!$q(e))return null;const o={...n,value:typeof n.value<"u"?n.value:r,placeholder:n.placeholder?n.placeholder:typeof e.default<"u"?String(e.default):""};if(t)return t({schema:e,...o});if(e.enum)return h.jsx(RH,{options:e.enum,...o});if(mu(e.type,["number","integer"])){const s={min:e.minimum,max:e.maximum,step:e.multipleOf};return h.jsx(qa,{type:"number",...o,value:o.value??"",...s})}if(mu(e.type,"boolean"))return h.jsx($H,{...o,checked:r===!0});if(mu(e.type,"string")&&e.format==="date-time"){const s=o.value?new Date(o.value).toISOString().slice(0,16):"";return h.jsx(AC,{...o,value:s,type:"datetime-local",onChange:a=>{const c=new Date(a.target.value);o.onChange?.({target:{value:c.toISOString()}})}})}if(mu(e.type,"string")&&e.format==="date")return h.jsx(AC,{...o,value:o.value??""});const i={maxLength:e.maxLength,minLength:e.minLength,pattern:e.pattern};return e.format&&["password","hidden","url","email","tel"].includes(e.format)&&(i.type=e.format),h.jsx(Fje,{...o,value:o.value??"",...i})};function y5e({path:e,valueStrict:t=!0,deriveFn:n,children:r}){const o=Si(e,n),i=jc(e,{strict:t});return r({...o,...i,setValue:a=>o.setValue(o.path,a),_setValue:o.setValue})}function YT({context:e,id:t,innerProps:{file:n}}){const{config:{entity_name:r,basepath:o}}=GH(),i=kw(r,void 0,{where:{path:n.path}}),s=()=>e.closeModal(t),a=i.data?.[0],c=window.location.origin,u=a?.reference?a?.reference.split(".")[0]:void 0,f=u?"/data"+st.data.entity.edit(u,a?.entity_id):void 0,p=a?.path?"/data"+st.data.entity.edit(r,a?.id):void 0;return h.jsxs("div",{className:"flex flex-col md:flex-row",children:[h.jsx("div",{className:"flex w-full md:w-[calc(100%-300px)] justify-center items-center bg-lightest min-w-50",children:h.jsx(v5e,{file:n})}),h.jsxs("div",{className:"w-full md:!w-[300px] flex flex-col",children:[h.jsx(kl,{title:"ID",value:a?.id,copyValue:c+p,first:!0,children:p&&h.jsxs(dC,{href:p,size:"small",className:"py-1.5 px-2 !leading-none font-mono",onClick:s,children:["#",String(a?.id)]})}),h.jsx(kl,{title:"Path",value:a?.path}),h.jsx(kl,{title:"Mime Type",value:a?.mime_type}),h.jsx(kl,{title:"Size",value:a?.size&&rw.fileSize(a.size,1),copyValue:a?.size}),h.jsx(kl,{title:"Etag",value:a?.etag}),h.jsx(kl,{title:"Entity",copyValue:c+f,children:f&&h.jsxs(dC,{href:f,size:"small",className:"py-1.5 px-2 !leading-none font-mono",onClick:s,children:[a?.reference," #",a?.entity_id]})}),h.jsx(kl,{title:"Modified At",value:a?.modified_at&&jL(a?.modified_at),copyValue:a?.modified_at}),h.jsx(kl,{title:"Metadata",value:a?.metadata,copyable:!1,children:a?.metadata&&h.jsx(Vr,{json:a?.metadata,expand:2,showCopy:!0,className:"w-full text-sm bg-primary/2 pt-2.5 rounded-lg",copyIconProps:{className:"size-6 opacity-20 group-hover:opacity-100 transition-all"}})})]})]})}const kl=({title:e,children:t,value:n,first:r,copyable:o=!0,copyValue:i})=>{const s=tX(),a=!t&&(n===null||typeof n>"u"),c=o&&!a&&s.copy!==void 0,u=n?typeof n=="object"&&!a?JSON.stringify(n):String(n):void 0;return h.jsxs("div",{className:Be("flex flex-col gap-1 py-3 pl-5 pr-3 group",!r&&"border-t border-muted"),children:[h.jsx("div",{className:"text-sm font-bold opacity-50",children:Ta(e)}),h.jsxs("div",{className:"flex flex-row gap-1 justify-between items-center",children:[t??h.jsx("div",{className:Be("font-mono truncate",a&&"opacity-30"),children:a?"null":u}),c&&h.jsx(ft,{Icon:s.copied?aSe:LV,className:Be("size-6 opacity-20 group-hover:opacity-100 transition-all",s.copied&&"text-success-foreground opacity-100"),onClick:()=>s.copy(i||n)})]})]})},b5e=[/^text\/.*$/,/application\/(x\-)?(json|json|yaml|javascript|xml|rtf|sql)/],v5e=({file:e})=>{const t=typeof e.body=="string"?e.body:URL.createObjectURL(e.body);return e.type.startsWith("image/")||e.type.startsWith("video/")?h.jsx(WH.Preview,{file:e,className:"max-h-[70dvh]",controls:!0,muted:!0}):e.type==="application/pdf"?h.jsx("iframe",{title:"PDF preview",src:`${t}#view=fitH&zoom=page-width&toolbar=1`,className:"w-250 max-w-[80dvw] h-[80dvh]"}):b5e.some(n=>n.test(e.type))?h.jsx(x5e,{file:e}):e.type.startsWith("audio/")?h.jsx("div",{className:"p-5",children:h.jsx("audio",{src:t,controls:!0})}):h.jsx("div",{className:"min-w-96 min-h-48 flex justify-center items-center h-full max-h-[70dvh]",children:h.jsx("span",{className:"opacity-50 font-mono",children:"No Preview Available"})})},x5e=({file:e})=>{const[t,n]=w.useState(""),r=typeof e.body=="string"?e.body:URL.createObjectURL(e.body),o=1024*256,i=e.size>o;return w.useEffect(()=>{let s=!1;return e?fetch(r,{headers:i?{Range:`bytes=0-${o-1}`}:void 0}).then(a=>a.text()).then(a=>{s||n(a)}):n(""),()=>{s=!0}},[e,i]),h.jsxs("pre",{className:"text-sm font-mono whitespace-pre-wrap break-all overflow-y-scroll w-250 md:max-w-[80dvw] h-[60dvh] md:h-[80dvh] py-4 px-6",children:[t,i&&h.jsxs("div",{className:"mt-3 opacity-50 text-xs text-center",children:["Showing first ",rw.fileSize(o)]})]})};YT.defaultTitle=void 0;YT.modalProps={withCloseButton:!1,size:"auto",centered:!0,styles:{content:{overflowY:"initial !important"}},classNames:{root:"bknd-admin w-full max-w-xl",content:"overflow-hidden",title:"font-bold !text-md",body:"max-h-inherit !p-0"}};const lx={test:PT,debug:kT,form:MT,overlay:nT,dataCreate:RT,mediaInfo:YT};function w5e({children:e}){return h.jsx(gEe,{modals:lx,children:e})}function S5e(e,t,{title:n,...r}={}){const o=n??lx[e].defaultTitle??void 0,i=lx[e].modalProps??{},s={title:o,...r,...i,modal:e,innerProps:t};return dEe({transitionProps:{transition:fAe,duration:300},...s}),{close:()=>Iq(e),closeAll:JV.closeAll}}function Iq(e){return fEe(e)}const vr={ids:Object.fromEntries(Object.keys(lx).map(e=>[e,e])),open:S5e,close:Iq,closeAll:JV.closeAll};function E5e(e){hr(["Auth","Roles"]);const{hasSecrets:t}=ot({withSecrets:!0});return t?h.jsx(N5e,{...e}):h.jsx(yo.MissingPermission,{what:"Auth Roles"})}function N5e(){const[e]=Pn(),{config:t,actions:n}=_c(),{readonly:r}=ot(),o=Object.values(Vt(t.roles??{},(a,c)=>({role:c,permissions:a.permissions?.map(u=>u.permission),policies:a.permissions?.flatMap(u=>u.policies?.length??0).reduce((u,f)=>u+f,0),is_default:a.is_default??!1,implicit_allow:a.implicit_allow??!1})));function i(a){e(st.auth.roles.edit(a.role))}function s(){r||vr.open("form",{schema:Ve({name:ju}),uiSchema:{name:{"ui:title":"Role name"}},onSubmit:async a=>{a.name.length>0&&await n.roles.add(a.name)&&e(st.auth.roles.edit(a.name))}},{title:"New Role"})}return h.jsxs(h.Fragment,{children:[h.jsx(An,{right:!r&&h.jsx(Xe,{variant:"primary",onClick:s,children:"Create new"}),children:"Roles & Permissions"}),h.jsxs(Zn,{children:[h.jsx(ai.Warning,{visible:!t.enabled,title:"Auth not enabled",message:"To use authentication features, please enable it in the settings."}),h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:h.jsx(s1,{data:o,renderValue:_5e,renderHeader:Dg,onClickRow:i})})]})]})}const _5e=({value:e,property:t})=>{if(["is_default","implicit_allow"].includes(t))return e?h.jsx("span",{children:"Yes"}):h.jsx("span",{className:"opacity-50",children:"No"});if(t==="policies")return e?h.jsx("span",{children:e}):h.jsx("span",{className:"opacity-50",children:"0"});if(t==="permissions"){let r=e||[];const o=r.length;return o>3&&(r=[...r.slice(0,3),`+${o-3}`]),h.jsx("div",{className:"flex flex-row gap-1",children:r.map((i,s)=>h.jsx("span",{className:"inline-block px-2 py-1.5 text-sm bg-primary/5 rounded font-mono leading-none",children:i},s))})}return h.jsx(a1,{value:e,property:t})},m1=({path:e,backTo:t,onBack:n})=>{const[,,r]=Pn(),o=Array.isArray(e)?e:[e],i=o.length>1,s=n||(()=>r({fallback:t})),a=w.useMemo(()=>o.map((c,u)=>({last:u===o.length-1,...c})),[o]);return h.jsxs("div",{className:"flex flex-row flex-grow items-center gap-2 text-lg",children:[i&&h.jsx(ft,{onClick:s,Icon:JA,variant:"default",size:"lg",className:"mr-1"}),h.jsx("div",{className:"hidden md:flex gap-1.5",children:h.jsx(Lq,{crumbs:a})}),h.jsx("div",{className:"flex md:hidden gap-2",children:h.jsx(C5e,{crumbs:a})})]})},Lq=({crumbs:e})=>e.map((t,n)=>t.last?h.jsx(Fq,{...t},n):h.jsx(zq,{...t},n)),C5e=({crumbs:e})=>{const[,t]=Uo();if(e.length<=2)return h.jsx(Lq,{crumbs:e});const n=e[0],r=e[e.length-1],o=w.useMemo(()=>e.slice(1,-1).map(s=>({label:s.string,href:s.href})),[e]),i=It(s=>t(`~/${s.href}`));return h.jsxs(h.Fragment,{children:[h.jsx(zq,{...n}),h.jsx(Nr,{onClickItem:i,items:o,children:h.jsx(ft,{Icon:Ha,variant:"ghost"})}),h.jsx("span",{className:"opacity-25 dark:font-bold font-semibold",children:"/"}),h.jsx(Fq,{...r})]})},Fq=({label:e})=>h.jsx("span",{className:"text-nowrap dark:font-bold font-semibold",children:e}),zq=({href:e,label:t})=>h.jsxs("div",{className:"opacity-50 flex flex-row gap-1.5 dark:font-bold font-semibold",children:[h.jsx(Dw,{to:e,className:"text-nowrap",children:t}),h.jsx("span",{className:"opacity-50",children:"/"})]});function wf(...e){return Be(e)}async function O5e(e,t){if(!window[e]){const n=document.createElement("script");n.type="module",n.async=!0,n.textContent=`import * as ${e} from '${t}';window.${e} = ${e};`,document.head.appendChild(n);const r=50;let o=0;for(;!window[e]&&o<r;)await new Promise(i=>setTimeout(i,100)),o++;if(!window[e])throw new Error(`Browser module "${e}" failed to load`)}return window[e]}const j5e=({code:e,className:t,lang:n="typescript",theme:r,enabled:o=!0})=>{const[i,s]=w.useState(null),a=Va(),c=r??a.theme==="dark"?"github-dark":"github-light";return w.useEffect(()=>{if(!o)return;let u=!1;s(null);async function f(){try{const{codeToHtml:p}=await O5e("shiki","https://esm.sh/shiki@3.13.0");if(u)return;const g=await p(e,{lang:n,theme:c,structure:"inline"});if(u)return;s(g)}catch(p){console.error("Failed to load Shiki:",p),u||s(e)}}return f(),()=>{u=!0}},[e,o]),i?h.jsx("pre",{className:wf("select-text cursor-text",t),dangerouslySetInnerHTML:{__html:i}}):h.jsx("pre",{className:wf("select-text cursor-text",t),children:e})};function A5e(e){hr(["Auth","Roles",e.params.role]);const{hasSecrets:t}=ot({withSecrets:!0});return t?h.jsx(R5e,{...e}):h.jsx(yo.MissingPermission,{what:"Roles & Permissions"})}function T5e(e){const t=e.properties.roles.additionalProperties;return{...t,properties:{...t.properties,permissions:{...t.properties.permissions.anyOf[1]}}}}const $5e={options:{debug:ir()}};function R5e({params:e}){const[t]=Pn(),{config:n,schema:r,actions:o}=_c(),[i,s]=w.useState(),a=e.role,c=n.roles?.[a],{readonly:u,permissions:f}=ot(),p=T5e(r),g={...c,permissions:f.map(x=>c?.permissions?.find(S=>S.permission===x.name))};async function y(){await o.roles.delete(a)&&t(st.auth.roles.list())}async function v(x){s(void 0),await o.roles.patch(a,x)}return h.jsxs(dy,{schema:p,initialValues:g,...$5e,beforeSubmit:x=>({...x,permissions:[...Object.values(x.permissions).filter(Boolean)]}),onSubmit:v,onInvalidSubmit:x=>{s(x)},children:[h.jsx(An,{right:h.jsxs(h.Fragment,{children:[h.jsx(Nr,{items:[{label:"Advanced Settings",onClick:()=>t(st.settings.path(["auth","roles",a]),{absolute:!0})},!u&&{label:"Delete",onClick:y,destructive:!0}],position:"bottom-end",children:h.jsx(ft,{Icon:Ha})}),!u&&h.jsx(Ph,{selector:x=>({dirty:x.dirty,errors:x.errors.length>0,submitting:x.submitting}),children:({dirty:x,errors:S,submitting:E})=>h.jsx(Xe,{variant:"primary",type:"submit",disabled:!x||S||E,children:"Update"})})]}),className:"pl-3",children:h.jsx(m1,{path:[{label:"Roles & Permissions",href:st.auth.roles.list()},{label:a}]})}),h.jsxs(Zn,{children:[i&&h.jsx(ai.Exception,{message:"Invalid form data"}),h.jsxs("div",{className:"flex flex-col flex-grow px-5 py-5 gap-8",children:[h.jsx("div",{className:"flex flex-col gap-2",children:h.jsx(k5e,{})}),h.jsxs("div",{className:"flex flex-col gap-4",children:[h.jsx(_r,{label:"Should this role be the default?",name:"is_default",description:"In case an user is not assigned any role, this role will be assigned by default.",descriptionPlacement:"top"}),h.jsx(_r,{label:"Implicit allow missing permissions?",name:"implicit_allow",description:"This should be only used for admins. If a permission is not explicitly denied, it will be allowed.",descriptionPlacement:"top"})]})]}),h.jsx(hy,{})]})]})}const k5e=()=>{const{permissions:e}=ot(),t=e.reduce((n,r,o)=>{const[i,s]=r.name.split(".");return n[i]||(n[i]=[]),n[i].push({index:o,permission:r}),n},{});return h.jsx("div",{className:"flex flex-col gap-10",children:Object.entries(t).map(([n,r])=>h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("h3",{className:"font-semibold",children:[Io(n)," Permissions"]}),h.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3 items-start",children:r.map(({index:o,permission:i})=>h.jsx(M5e,{permission:i,index:o},i.name))})]},n))})},M5e=({permission:e,index:t})=>{const n=`permissions.${t}`,{value:r}=Si("permissions",p=>{const g=p.value;if(!Array.isArray(g))return;const y=g.find(v=>v&&v.permission===e.name);return{set:!!y,policies:y?.policies?.length??0}}),{setValue:o}=Wa(),[i,s]=w.useState(!1),a=r?.policies??0,c=r?.set??!1;async function u(){c?(o(n,void 0),s(!1)):o(n,{permission:e.name,policies:[],effect:"allow"})}function f(){s(p=>!p)}return h.jsx(h.Fragment,{children:h.jsxs("div",{className:wf("flex flex-col border border-muted",i&&"border-primary/20"),children:[h.jsxs("div",{className:wf("flex flex-row gap-2 justify-between",i&&"bg-primary/5"),children:[h.jsxs("div",{className:"py-4 px-4 font-mono leading-none flex flex-row gap-2 items-center",children:[e.name,e.filterable&&h.jsx(ns,{label:"Permission supports filtering",children:h.jsx(CSe,{className:"opacity-50"})})]}),h.jsx("div",{className:"flex flex-grow"}),h.jsxs("div",{className:"flex flex-row gap-1 items-center px-2",children:[h.jsxs("div",{className:"relative flex flex-row gap-1 items-center",children:[a>0&&h.jsx("div",{className:"bg-primary/80 text-background rounded-full size-5 flex items-center justify-center text-sm font-bold pointer-events-none",children:a}),h.jsx(ft,{size:"md",variant:"ghost",disabled:!c,Icon:X1e,className:wf("disabled:opacity-20"),onClick:f})]}),h.jsx($H,{size:"sm",checked:c,onChange:u})]})]}),i&&h.jsx("div",{className:"px-3.5 py-3.5",children:h.jsx(P5e,{path:`permissions.${t}.policies`,permission:e})})]},e.name)})},P5e=({path:e,permission:t})=>{const{setValue:n,schema:r,lib:o,deleteValue:i,value:s}=Si(e,({value:f})=>({policies:f?.length??0})),a=s?.policies??0;function c(){n(`${e}.${a}`,o.getTemplate(void 0,r.items,{addOptionalProps:!0}))}function u(f){i(`${e}.${f}`)}return h.jsxs("div",{className:wf("flex flex-col",a>0&&"gap-8"),children:[h.jsx("div",{className:"flex flex-col gap-5",children:a>0&&Array.from({length:a}).map((f,p)=>h.jsxs(fy,{prefix:`${e}.${p}`,schema:r.items,children:[p>0&&h.jsx("div",{className:"h-px bg-muted"}),h.jsxs("div",{className:"flex flex-row gap-2 items-start",children:[h.jsx("div",{className:"flex flex-col flex-grow w-full",children:h.jsx(L5e,{permission:t})}),h.jsx(ft,{Icon:XA,onClick:()=>u(p),size:"sm"})]})]},p))}),h.jsx("div",{className:"flex flex-row justify-center",children:h.jsx(Xe,{onClick:c,children:"Add Policy"})})]})},D5e=(...e)=>_ae(e.filter(Boolean).map(Pi));function I5e(e,t){return!_u(e)||!Array.isArray(t)||t.length===0?e:Vt(e,(n,r)=>r==="properties"?Vt(n,(o,i)=>i==="entity"&&o.type==="string"?{...o,enum:t}:o):n)}const L5e=({permission:e})=>{const{value:t}=Si("",({value:s})=>({effect:s?.effect??"allow"})),n=ot(),r=Zg(s=>s.system.permissions(),{use:[fve]}),o=Object.keys(n.config.data.entities??{}),i=r.data?D5e(r.data.context,I5e(e.context??null,o)):void 0;return h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsx(_r,{name:"description"}),h.jsx(ID,{name:"condition",label:"Condition",description:"The condition that must be met for the policy to be applied.",schema:i&&{name:"Context",content:Rk(i,"Context")},children:h.jsx(WC,{path:"condition"})}),h.jsx(y5e,{path:"effect",children:({value:s,setValue:a})=>h.jsx(pg,{name:"effect",label:"Effect",descriptionPlacement:"label",description:"The effect of the policy to take effect on met condition.",children:h.jsx(bc,{className:"border border-muted",defaultValue:s,onChange:c=>a(c),data:["allow","deny",e.filterable?"filter":void 0].filter(Boolean).map(c=>({label:Io(c??""),value:c}))})})}),t?.effect==="filter"&&h.jsx(ID,{name:"filter",label:"Filter",description:"Filter to apply to all queries on met condition.",schema:i&&{name:"Variables",content:Rk(i,"Variables")},children:h.jsx(WC,{path:"filter"})})]})},ID=({children:e,name:t,label:n,description:r,schema:o})=>{const i=Mh(t,{strict:!0}),s=i.length>0&&h.jsx(jH,{children:i.map(a=>a.message).join(", ")});return h.jsxs(mi,{as:"div",children:[h.jsxs(uc,{as:"label",htmlFor:t,className:"flex flex-row gap-1 justify-between items-center",children:[h.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[n,r&&h.jsx(ns,{label:r,children:h.jsx(VV,{className:"size-4 opacity-50"})})]}),o&&h.jsx("div",{children:h.jsx(o1,{overlayProps:{className:"max-w-none"},position:"bottom-end",target:()=>h.jsx("div",{className:"w-auto max-w-[80vw] md:max-w-120 bg-background overflow-scroll",children:typeof o.content=="object"?h.jsx(Vr,{className:"pr-3 text-sm",json:o.content,title:o.name,expand:5}):h.jsx(j5e,{code:o.content,lang:"typescript",className:"p-3 text-sm"})}),children:h.jsx(Xe,{variant:"ghost",size:"smaller",IconLeft:pSe,children:Ta(o.name)})})})]}),e,s]})},Bq=Lw(ey({advanced:[]},e=>({toggleAdvanced:t=>e(n=>({advanced:n.advanced.includes(t)?n.advanced.filter(r=>r!==t):[...n.advanced,t]}))})));function F5e(e){hr(["Auth","Settings"]);const{hasSecrets:t}=ot({withSecrets:!0});return t?h.jsx(B5e,{...e}):h.jsx(yo.MissingPermission,{what:"Auth Settings"})}const z5e={ignoreKeys:["roles","strategies"],options:{keepEmpty:!0,debug:ir()}};function B5e(){const{config:e,schema:t,actions:n,$auth:r}=_c(),{readonly:o}=ot(),i=JSON.parse(JSON.stringify(t));i.properties.jwt.required=["alg"];async function s(a){await n.config.set(a)}return h.jsxs(dy,{schema:i,initialValues:e,onSubmit:s,...z5e,readOnly:o,children:[h.jsx(Ph,{selector:a=>({dirty:a.dirty,errors:a.errors.length>0,submitting:a.submitting}),children:({dirty:a,errors:c,submitting:u})=>h.jsx(An,{className:"pl-4",right:!o&&h.jsx(Xe,{variant:"primary",type:"submit",disabled:!a||c||u,children:"Update"}),children:"Settings"})}),h.jsxs(Zn,{children:[h.jsxs(kN,{className:"pt-4 pl-0 pb-0",children:[h.jsx("div",{className:"pl-4",children:h.jsx(Qr,{name:"enabled",label:"Authentication Enabled",description:"Only after enabling authentication, all settings below will take effect.",descriptionPlacement:"top"})}),h.jsxs("div",{className:"flex flex-col gap-6 relative pl-4 pb-2",children:[h.jsx(FD,{}),h.jsx(Qr,{name:"guard.enabled",label:h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[h.jsx("span",{children:"Guard Enabled"}),!r.roles.has_admin&&h.jsx(Hw.Warning,{title:"No admin roles defined. Enabling the guard will likely block all requests."})]}),disabled:r.roles.none,description:"When enabled, enforces permissions on all routes. Make sure to create roles first.",descriptionPlacement:"top"}),h.jsx(Qr,{name:"allow_register",label:"Allow User Registration",description:"When enabled, allows users to register autonomously. New users use the default role.",descriptionPlacement:"top"})]})]}),h.jsxs("div",{className:"flex flex-col gap-3 relative mt-3 pb-4",children:[h.jsx(FD,{}),h.jsx(hC,{}),h.jsxs(kN,{title:"JWT",children:[h.jsx(Qr,{name:"jwt.issuer"}),h.jsx(Qr,{name:"jwt.secret",description:"The secret used to sign the JWT token. If not set, a random key will be generated after enabling authentication.",advanced:"jwt",inputProps:{type:"password"}}),h.jsx(Qr,{name:"jwt.alg",advanced:"jwt"}),h.jsx(Qr,{name:"jwt.expires",advanced:"jwt"}),h.jsx(LD,{which:"jwt"})]}),h.jsx(hC,{}),h.jsxs(kN,{title:"Cookie",children:[h.jsx(Qr,{name:"cookie.path",advanced:"cookie"}),h.jsx(Qr,{name:"cookie.sameSite",advanced:"cookie"}),h.jsx(Qr,{name:"cookie.secure",advanced:"cookie"}),h.jsx(Qr,{name:"cookie.expires",advanced:"cookie"}),h.jsx(Qr,{name:"cookie.renew",label:"Renew Cookie",description:"Automatically renew users cookie on every request.",descriptionPlacement:"top"}),h.jsx(Qr,{name:"cookie.pathSuccess",advanced:"cookie"}),h.jsx(Qr,{name:"cookie.pathLoggedOut"}),h.jsx(LD,{which:"cookie"})]})]}),h.jsx(hy,{})]})]})}const LD=({which:e})=>{const{advanced:t,toggleAdvanced:n}=Bq(),r=t.includes(e);return h.jsx(Xe,{IconLeft:r?uSe:IV,onClick:()=>n(e),variant:r?"default":"ghost",className:"self-start",size:"small",children:r?"Hide advanced settings":"Show advanced settings"})},FD=()=>h.jsx(Ph,{selector:e=>({enabled:e.data.enabled}),children:({enabled:e})=>!e&&h.jsx("div",{className:"absolute w-full h-full z-50 inset-0 bg-background opacity-90"})});function kN(e){const{children:t,title:n,className:r}=e;return h.jsx(h.Fragment,{children:h.jsxs("div",{className:pn("flex flex-col gap-6 px-4",n&&"pt-0",r),children:[n&&h.jsx("h3",{className:"text-lg font-bold",children:n}),t]})})}function Qr(e){const{advanced:t,...n}=e,r=Bq(o=>o.advanced);return t&&!r.includes(t)?null:h.jsx(_r,{...n})}const V5e=({className:e,...t})=>h.jsx("div",{className:Be("flex flex-col gap-2 max-w-4xl",e),...t}),U5e=({className:e,hasError:t,disabled:n,...r})=>h.jsx("div",{className:Be("flex flex-col border border-muted rounded bg-background",t&&"border-error",e),...r}),H5e=({className:e,left:t,right:n,children:r,...o})=>h.jsxs("div",{...o,className:Be("flex flex-row justify-between p-3 gap-3 items-center",e),children:[t&&h.jsx("div",{className:"flex flex-row items-center p-2 bg-primary/5 rounded",children:t}),h.jsx("div",{className:"font-mono flex-grow flex flex-row gap-3",children:r}),n&&h.jsx("div",{className:"flex flex-row gap-4 items-center",children:n})]}),q5e=({className:e,open:t,...n})=>t&&h.jsx("div",{...n,className:Be("flex flex-col border-t border-t-muted px-4 pt-3 pb-4 bg-lightest/50 gap-4",e)}),Jb={Root:V5e,Item:U5e,Preview:H5e,Detail:q5e};function W5e(e){hr(["Auth","Strategies"]);const{hasSecrets:t,config:{auth:{enabled:n}}}=ot({withSecrets:!0});if(t){if(!n)return h.jsx(yo.NotEnabled,{description:"Enable Auth first."})}else return h.jsx(yo.MissingPermission,{what:"Auth Strategies"});return h.jsx(J5e,{...e})}const G5e={keepEmpty:!0,debug:ir()};function J5e(){const{readonly:e}=ot(),t=_c(),n=t.config.strategies,r=t.schema.properties.strategies;Object.fromEntries(t.schema.properties.strategies?.additionalProperties?.anyOf.map(i=>[i.properties.type.const,i]));async function o(i){await t.actions.config.set({strategies:i})}return h.jsxs(dy,{schema:r,initialValues:n,onSubmit:o,options:G5e,readOnly:e,children:[h.jsx(Ph,{selector:i=>({dirty:i.dirty,errors:i.errors.length>0,submitting:i.submitting}),children:({dirty:i,errors:s,submitting:a})=>h.jsx(An,{className:"pl-4",right:!e&&h.jsx(Xe,{variant:"primary",type:"submit",disabled:!i||s||a,children:"Update"}),children:"Strategies"})}),h.jsxs(Zn,{children:[h.jsxs("div",{className:"flex flex-col p-4 gap-4",children:[h.jsx("p",{className:"opacity-70",children:"Allow users to sign in or sign up using different strategies."}),h.jsxs(Jb.Root,{children:[h.jsx(Ml,{type:"password",name:"password"}),h.jsx(Ml,{type:"oauth",name:"google"}),h.jsx(Ml,{type:"oauth",name:"github"}),h.jsx(Ml,{type:"oauth",name:"facebook",unavailable:!0}),h.jsx(Ml,{type:"oauth",name:"x",unavailable:!0}),h.jsx(Ml,{type:"oauth",name:"instagram",unavailable:!0}),h.jsx(Ml,{type:"oauth",name:"apple",unavailable:!0}),h.jsx(Ml,{type:"oauth",name:"discord",unavailable:!0})]})]}),h.jsx(hy,{})]})]})}const Ml=({type:e,name:t,unavailable:n})=>{const r=Mh(t,{strict:!0}),o=_c(),s=Object.fromEntries(o.schema.properties.strategies.additionalProperties.anyOf.map(u=>[u.properties.type.const,u]))[e],{active:a,toggle:c}=GA("/strategies/:strategy?",t);return s?h.jsx(fy,{schema:s,prefix:t,children:h.jsxs(Jb.Item,{hasError:r.length>0,className:n?"opacity-20 pointer-events-none cursor-not-allowed":void 0,children:[h.jsx(Jb.Preview,{left:h.jsx(K5e,{type:e,provider:t}),right:h.jsxs(h.Fragment,{children:[h.jsx(Y5e,{type:e}),h.jsx(ft,{Icon:_h,size:"lg",iconProps:{strokeWidth:1.5},variant:a?"primary":"ghost",onClick:()=>c(!a)})]}),children:h.jsx("span",{className:"leading-none",children:Ta(t)})}),h.jsx(Jb.Detail,{open:a,children:h.jsx(X5e,{type:e,name:t})})]})}):null},Y5e=({type:e})=>{const t=Si(""),{value:n}=jc("");function r(o){const i=o.target.value,s=Object.keys(n??{}),a=s.length===0||s.length===1&&s[0]==="enabled";!i&&a?t.deleteValue(t.path):t.setValue([t.path,"enabled"].join("."),i)}return h.jsx(_r,{name:"enabled",label:!1,required:!0,onChange:r})},K5e=({type:e,provider:t})=>{if(e==="password")return h.jsx(tSe,{className:"size-5"});if(t&&t in zD){const n=zD[t];return h.jsx(n,{className:"size-5"})}return h.jsx(iSe,{className:"size-5"})},zD={google:G1e,github:W1e,facebook:q1e,x:sSe,instagram:oSe,apple:U1e,discord:H1e},X5e=({type:e,name:t})=>{let n=r=>h.jsx(p1,{path:"",wrapperProps:{wrapper:"group",label:!1}});switch(e){case"password":n=Q5e;break;case"oauth":n=Z5e;break}return h.jsxs(h.Fragment,{children:[h.jsx(Pq,{name:"type",inputProps:{disabled:!0,defaultValue:e}}),h.jsx(n,{type:e,name:t})]})},Q5e=()=>h.jsx(p1,{path:"config",wrapperProps:{wrapper:"group",label:!1}}),Z5e=({type:e,name:t})=>h.jsxs(h.Fragment,{children:[h.jsx(Pq,{name:"config.name",inputProps:{disabled:!0,defaultValue:t}}),h.jsx(_r,{name:"config.client.client_id",required:!0,inputProps:{type:"password"}}),h.jsx(_r,{name:"config.client.client_secret",required:!0,inputProps:{type:"password"}})]});function e4e(){return null}function t4e(){return h.jsxs(nEe,{children:[h.jsx(tt,{path:"/",component:aEe}),h.jsx(tt,{path:"/users",component:e4e}),h.jsx(tt,{path:"/roles",component:E5e}),h.jsx(tt,{path:"/roles/edit/:role",component:A5e}),h.jsx(tt,{path:"/strategies/:strategy?",component:W5e}),h.jsx(tt,{path:"/settings",component:F5e})]})}function n4e(){return hr(["Login"]),h.jsx(FH.Screen,{action:"login",logo:h.jsx(Nn,{href:"/",className:"link",children:h.jsx(Fw,{scale:.25})})})}const Vq={data:{btnCreateEntity:"data-btns-create-entity"},media:{switchEnabled:"media-switch-enabled"}};function r4e({children:e}){const{entities:t,$data:n}=Ho(),r={regular:[],generated:[],system:[]},[o]=Pn(),i=window.location.href.match(/\/schema/)?"schema":"data";for(const a of Object.values(t))r[a.getType()].push(a);function s(a){if(!a)return;const c=window.location.href.match(/\/entity\/([^/]+)/)?.[1]||null;switch(a){case"data":c?o(st.data.entity.list(c)):o(st.data.root(),{absolute:!0});break;case"schema":o(c?st.data.schema.entity(c):st.data.schema.root());break}}return h.jsxs(h.Fragment,{children:[h.jsxs(Wu,{children:[h.jsx(An,{right:h.jsxs(h.Fragment,{children:[h.jsx(bc,{data:[{value:"data",label:"Data"},{value:"schema",label:"Schema"}],value:i,onChange:s}),h.jsx(Iw,{children:h.jsx(ns,{label:"New Entity",children:h.jsx(ft,{Icon:FV,onClick:n.modals.createEntity})})})]}),children:"Entities"}),h.jsx(Zn,{initialOffset:96,children:h.jsxs("div",{className:"flex flex-col flex-grow py-3 gap-3",children:[h.jsx(MN,{entities:r.regular,context:i,suggestCreate:!0}),h.jsx(MN,{entities:r.system,context:i,title:"System"}),h.jsx(MN,{entities:r.generated,context:i,title:"Generated"})]})})]}),h.jsx(ry,{children:e})]})}const MN=({entities:e,title:t,context:n,suggestCreate:r=!1})=>{const{$data:o}=Ho(),{readonly:i}=ot(),s=Twe();if(e.length===0)return r?i?h.jsx(Hn,{className:"py-10",description:"No entities created."}):h.jsx(Hn,{className:"py-10",description:"Create your first entity to get started.",secondary:{children:"Create entity",onClick:()=>o.modals.createEntity()}}):null;function a(c){return u=>{switch(u.stopPropagation(),u.preventDefault(),n){case"schema":s(f=>f.data.entity.list(c.name));break;case"data":s(f=>f.data.schema.entity(c.name));break}}}return h.jsxs("nav",{className:Be("flex flex-col flex-1 gap-1 px-3",t&&"border-t border-primary/10 pt-2"),children:[t&&h.jsx("div",{className:"text-sm text-primary/50 ml-3.5 mb-1",children:t}),e.map(c=>{const u=n==="data"?st.data.entity.list(c.name):st.data.schema.entity(c.name);return h.jsx(o4e,{entity:c,children:h.jsxs(oo,{as:Nn,href:u,className:"justify-between items-center",children:[h.jsx("span",{className:"truncate",children:c.label}),wwe(u)&&h.jsx(Xe,{IconLeft:fxe,size:"small",onClick:a(c),children:n==="schema"?"Data":"Fields"})]})},c.name)})]})},o4e=({entity:e,children:t,enabled:n=!0})=>{if(!n)return t;const[r]=Pn(),{$data:o}=Ho(),i=t.props.href,s=()=>h.jsx("div",{className:"h-px my-1 w-full bg-primary/5"});return h.jsx(Nr,{className:"flex flex-col w-full",dropdownWrapperProps:{className:"min-w-fit"},title:e.label+" Actions",items:[i&&{icon:Vve,label:"Open in tab",onClick:()=>{r(i,{target:"_blank",absolute:!0})}},s,!o.system(e.name).any&&{icon:FA,label:"Create new",onClick:()=>r(st.data.entity.create(e.name))},{icon:Ru,label:"List entries",onClick:()=>r(st.data.entity.list(e.name))},s,{icon:IA,label:"Manage fields",onClick:()=>r(st.data.schema.entity(e.name))},{icon:LA,label:"Add relation",onClick:()=>o.modals.createRelation(e.name)},!o.system(e.name).media&&{icon:RB,label:"Add media",onClick:()=>o.modals.createMedia(e.name)},s,{icon:rg,label:"Advanced",onClick:()=>r(st.settings.path(["data","entities",e.name]),{absolute:!0})}],openEvent:"onContextMenu",position:"bottom-start",children:t})};function i4e(){hr(["Data"]);const[e]=Pn(),{$data:t}=Ho(),{readonly:n}=ot();function r(){e(st.data.schema.root())}return n?h.jsx(Hn,{Icon:Ru,title:"No entity selected",description:"Please select an entity from the left sidebar.",primary:{children:"Go to schema",onClick:r}}):h.jsx(Hn,{Icon:Ru,title:"No entity selected",description:"Please select an entity from the left sidebar or create a new one to continue.",secondary:{children:"Go to schema",onClick:r},primary:{children:"Create entity","data-testid":Vq.data.btnCreateEntity,onClick:t.modals.createEntity}})}var PN={exports:{}},DN={};/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var BD;function s4e(){if(BD)return DN;BD=1;var e=dc(),t=u1e();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return DN.useSyncExternalStoreWithSelector=function(u,f,p,g,y){var v=i(null);if(v.current===null){var x={hasValue:!1,value:null};v.current=x}else x=v.current;v=a(function(){function E(T){if(!C){if(C=!0,_=T,T=g(T),y!==void 0&&x.hasValue){var k=x.value;if(y(k,T))return j=k}return j=T}if(k=j,r(_,T))return k;var R=g(T);return y!==void 0&&y(k,R)?(_=T,k):(_=T,j=R)}var C=!1,_,j,A=p===void 0?null:p;return[function(){return E(f())},A===null?void 0:function(){return E(A())}]},[f,p,g,y]);var S=o(u,v[0],v[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),c(S),S},DN}var VD;function a4e(){return VD||(VD=1,PN.exports=s4e()),PN.exports}var Uq=a4e();function l4e(e,t=r=>r,n={}){const r=n.equal??c4e;return Uq.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,r)}function c4e(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=UD(e);if(n.length!==UD(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function UD(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}function u4e({fieldApi:e,field:t,data:n,disabled:r,...o}){function i(a){r||e.setValue(a)}const s=n?.[t.name];return h.jsxs(mi,{children:[h.jsx(Rh,{htmlFor:e.name,field:t}),h.jsx("div",{"data-disabled":r?1:void 0,className:"data-[disabled]:opacity-70 data-[disabled]:pointer-events-none",children:h.jsx(jh,{schema:t.getJsonSchema(),onChange:i,direction:"horizontal",formData:s,uiSchema:{"ui:globalOptions":{flexDirection:"row"},...t.getJsonUiSchema()}})})]})}function KT({entity:e,select:t,...n}){const r=t??e.getSelect(),o=e.getFields();function i(c){return o.find(u=>u.name===c)}function s(c){try{return i(c).getLabel()}catch(u){return console.warn("Couldn't render header",{entity:e,select:t,...n},u),c}}function a({value:c,property:u}){let f=c;try{f=i(u).getValue(c,"table")}catch(p){console.warn("Couldn't render value",{value:c,property:u,entity:e,select:t,columns:r,...n},p)}return h.jsx(Ch,{fallback:String(f),children:h.jsx(a1,{value:f,property:u})})}return h.jsx(s1,{...n,columns:r,renderHeader:s,renderValue:a})}function d4e({fieldApi:e,field:t,data:n,disabled:r,tabIndex:o}){const{app:i}=ot(),s=i.entity(t.target()),[a,c]=w.useState({limit:10,page:1,perPage:10,select:s.getSelect(void 0,"table")});Uo();const u=w.useRef(null),f=kw(t.target(),void 0,{select:a.select,limit:a.limit+1,offset:(a.page-1)*a.limit}),[p,g]=w.useState(),y=n?.[t.reference()],v=n?.[t.name];w.useEffect(()=>{const S=n?.[t.reference()];g(S)},[y]),w.useEffect(()=>{(async()=>{if(!t.target()||!v)return;const E=await f.api.readOne(t.target(),v);E.ok&&E.data&&g(E.data)})()},[v]),w.useEffect(()=>{if(t.isRequired()&&!e.state.value){const S=f.data?.[0];if(!S)return;console.warn("setting first value because field is required",t.name,S.id),e.setValue(S.id),g(S)}},[f.data]);const x=f.isLoading||f.isValidating;return h.jsxs(mi,{children:[h.jsx(Rh,{htmlFor:e.name,field:t,label:t.getLabel({fallback:!1})??s.label}),h.jsx("div",{"data-disabled":x||r?1:void 0,className:"data-[disabled]:opacity-70 data-[disabled]:pointer-events-none",children:h.jsx(o1,{backdrop:!0,className:"",target:({toggle:S})=>h.jsx(f4e,{container:f.data,entity:s,query:a,toggle:S,onClickRow:E=>{e.setValue(E.id),g(E),S()},onClickPage:E=>{console.log("setting page",E),c(C=>({...C,page:E}))}}),children:h.jsx("div",{ref:u,className:"bg-muted/40 w-full h-11 focus:bg-muted rounded-md items-center px-2.5 outline-none focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-transparent transition-all disabled:bg-muted/50 disabled:text-primary/50 cursor-pointer active:bg-muted/80 hover:bg-muted/60 flex flex-row gap-2",tabIndex:o,onKeyDown:EX([["Enter",()=>{u.current?.click()}]]),children:p?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"flex bg-primary/10 px-2 leading-none py-1.5 rounded-lg font-mono text-sm",children:Io(s.name)}),h.jsx("div",{className:"flex flex-row gap-3 overflow-clip w-1 flex-grow",children:p&&Object.entries(p).map(([S,E])=>{const C=s.getField(S);if(C.isHidden("table"))return null;const _=C.getValue(E,"table");return h.jsxs("div",{className:"flex flex-row gap-1 items-center flex-nowrap",children:[h.jsxs("span",{className:"opacity-60 text-nowrap",children:[C.getLabel(),":"]})," ",_!==null&&typeof _<"u"?h.jsx(Ch,{fallback:JSON.stringify(_),suppressError:!0,children:h.jsx("span",{className:"text-nowrap truncate",children:_})}):h.jsx("span",{className:"opacity-30 text-nowrap font-mono mt-0.5",children:"null"})]},S)})}),h.jsx(Nn,{to:st.data.entity.edit(s.name,p.id),children:h.jsx(Xe,{IconLeft:zV,size:"small",children:"View"})})]}):h.jsx("div",{className:"pl-2",children:"- Select -"})})})}),h.jsx(qa,{type:"hidden",name:e.name,id:e.name,value:e.state.value??"",onChange:console.log,tabIndex:-1})]})}const f4e=({container:e,entity:t,query:n,toggle:r,onClickRow:o,onClickPage:i})=>{function s(){n.limit*n.page<e.meta?.count&&i?.(n.page+1)}function a(){n.page>1&&i?.(n.page-1)}return bO([["ArrowRight",s],["ArrowLeft",a],["Escape",r]]),h.jsx("div",{children:h.jsx(KT,{classNames:{value:"line-clamp-1 truncate max-w-52 text-nowrap"},data:e??[],entity:t,select:n.select,total:e.body.meta?.count,page:n.page,onClickRow:o,onClickPage:i})})};function Hq({entity:e,entityId:t,handleSubmit:n,fieldsDisabled:r,Form:o,data:i,className:s,action:a}){const c=e.getFillableFields(a,!0),u=Uw(e,a);return h.jsxs("form",{onSubmit:n,children:[h.jsx(o.Subscribe,{selector:f=>[f.canSubmit,f.isValid,f.errors],children:([f,p,g])=>!p&&h.jsxs("div",{className:"flex flex-col dark:bg-red-950 bg-red-100 p-4",children:[h.jsx("p",{children:"Form is invalid."}),Array.isArray(g)&&h.jsx("ul",{className:"list-disc",children:g.map((y,v)=>h.jsx("li",{className:"ml-6",children:y},v))})]})}),h.jsx("div",{className:s,children:c.map((f,p)=>{if(f instanceof Ym)return h.jsx(p4e,{entity:e,entityId:t,formApi:o,field:f},f.name+p);if(!f.isFillable(a))return;const g=`${e.name}-${f.name}-${p}`;return h.jsx(Ch,{fallback:h.jsxs(ai.Exception,{className:"font-mono",children:["Field error: ",f.name]}),children:h.jsx(o.Field,{name:f.name,children:y=>{const v=u.field(f.name);if(v?.render){const x=v.render(a,e,f,{handleChange:y.handleChange,value:y.state.value,data:i});if(x)return x}if(!f.isHidden(a))return h.jsx(h4e,{field:f,fieldApi:y,disabled:r,tabIndex:p+1,action:a,data:i})}})},g)})}),h.jsx("div",{className:"hidden",children:h.jsx("button",{type:"submit"})})]})}function h4e({fieldApi:e,field:t,action:n,data:r,...o}){const i=It(u=>{typeof u=="object"&&"target"in u?e.handleChange(u.target.value):e.handleChange(u)});if(t.type==="relation")return h.jsx(d4e,{fieldApi:e,field:t,data:r,disabled:o.disabled,tabIndex:o.tabIndex});if(t.type==="json")return h.jsx(m4e,{fieldApi:e,field:t,...o});if(t.type==="jsonschema")return h.jsx(u4e,{fieldApi:e,field:t,data:r,disabled:o.disabled,tabIndex:o.tabIndex,...o});if(t.type==="enum")return h.jsx(g4e,{fieldApi:e,field:t,...o});const s=t.getHtmlConfig().element,a=t.getHtmlConfig().props,c=zje(s??"input");return h.jsxs(mi,{children:[h.jsx(Rh,{htmlFor:e.name,field:t}),h.jsx(c,{...a,name:e.name,id:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:i,required:t.isRequired(),...o})]})}function p4e({formApi:e,field:t,entity:n,entityId:r,disabled:o}){if(!r)return;const i=50,s=t.getMaxItems(),a=s===1,c=a?1:s&&s>i?i:s,u=l4e(e.store,g=>{const y=g.values[t.name];return!y||typeof y>"u"?[]:Array.isArray(y)?y:[y]}),f=JSON.stringify([n,r,t.name,u.length]),p=g=>{vr.open(vr.ids.mediaInfo,{file:g})};return h.jsxs(mi,{children:[h.jsx(Rh,{field:t}),h.jsx(WH.Dropzone,{maxItems:s,allowedMimeTypes:t.getAllowedMimeTypes(),initialItems:a?u:void 0,onClick:p,entity:{name:n.name,id:r,field:t.name},query:{sort:"-id",limit:c}},f)]})}function m4e({fieldApi:e,field:t,...n}){const[r,o]=w.useState(null),i=It(s=>{o(null),e.handleChange(s)});return h.jsxs(mi,{error:!!r,children:[h.jsx(Rh,{htmlFor:e.name,field:t}),h.jsx(w.Suspense,{children:h.jsx(Mq,{id:e.name,value:e.state.value,onChange:i,onBlur:e.handleBlur,onInvalid:o,minHeight:"100",...n})})]})}function g4e({fieldApi:e,field:t,...n}){const r=It(o=>{e.handleChange(o.target.value)});return h.jsxs(mi,{children:[h.jsx(Rh,{htmlFor:e.name,field:t}),h.jsxs(RH,{name:e.name,id:e.name,value:e.state.value,onBlur:e.handleBlur,onChange:r,required:t.isRequired(),...n,children:[!t.isRequired()&&h.jsx("option",{value:"",children:"- Select -"}),t.getOptions().map((o,i)=>h.jsx("option",{value:o.value,children:o.label},`${o.value}-${i}`))]})]})}const Sf=new WeakMap,Yb=new WeakMap,cx={current:[]};let IN=!1,Nm=0;const rm=new Set,mb=new Map;function qq(e){const t=Array.from(e).sort((n,r)=>n instanceof Ea&&n.options.deps.includes(r)?1:r instanceof Ea&&r.options.deps.includes(n)?-1:0);for(const n of t){if(cx.current.includes(n))continue;cx.current.push(n),n.recompute();const r=Yb.get(n);if(r)for(const o of r){const i=Sf.get(o);i&&qq(i)}}}function y4e(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function b4e(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function Wq(e){if(Nm>0&&!mb.has(e)&&mb.set(e,e.prevState),rm.add(e),!(Nm>0)&&!IN)try{for(IN=!0;rm.size>0;){const t=Array.from(rm);rm.clear();for(const n of t){const r=mb.get(n)??n.prevState;n.prevState=r,y4e(n)}for(const n of t){const r=Sf.get(n);r&&(cx.current.push(n),qq(r))}for(const n of t){const r=Sf.get(n);if(r)for(const o of r)b4e(o)}}}finally{IN=!1,cx.current=[],mb.clear()}}function ms(e){Nm++;try{e()}finally{if(Nm--,Nm===0){const t=rm.values().next().value;t&&Wq(t)}}}function v4e(e){return typeof e=="function"}class ux{constructor(t,n){this.listeners=new Set,this.subscribe=r=>{var o,i;this.listeners.add(r);const s=(i=(o=this.options)==null?void 0:o.onSubscribe)==null?void 0:i.call(o,r,this);return()=>{this.listeners.delete(r),s?.()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,r,o;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):v4e(t)?this.state=t(this.prevState):this.state=t,(o=(r=this.options)==null?void 0:r.onUpdate)==null||o.call(r),Wq(this)}}class Ea{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),o=new Array(n);for(let i=0;i<n;i++){const s=this.options.deps[i];r[i]=s.prevState,o[i]=s.state}return this.lastSeenDepValues=o,{prevDepVals:r,currDepVals:o,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const o=this.getDepVals();this.state=this.options.fn(o),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const i of this.options.deps)i instanceof Ea&&i.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:o}=this.getDepVals();for(let i=0;i<o.length;i++)if(o[i]!==r[i]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,o;this.listeners.add(n);const i=(o=(r=this.options).onSubscribe)==null?void 0:o.call(r,n,this);return()=>{this.listeners.delete(n),i?.()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(const n of t)if(n instanceof Ea)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof ux){let r=Sf.get(n);r||(r=new Set,Sf.set(n,r)),r.add(this);let o=Yb.get(this);o||(o=new Set,Yb.set(this,o)),o.add(n)}}unregisterFromGraph(t=this.options.deps){for(const n of t)if(n instanceof Ea)this.unregisterFromGraph(n.options.deps);else if(n instanceof ux){const r=Sf.get(n);r&&r.delete(this);const o=Yb.get(this);o&&o.delete(n)}}}function x4e(e){return typeof e=="function"}function HD(e,...t){return x4e(e)?e(...t):e}function w4e(e){return e||(typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"")}class Gq{#e=!0;#t;#n;#i;#r;#o;#a;#s;#l=0;#c=5;#d=()=>{this.debugLog("Connected to event bus"),this.#o=!0,this.debugLog("Emitting queued events",this.#r),this.#r.forEach(t=>this.emitEventToBus(t)),this.#r=[],this.stopConnectLoop(),this.#n().removeEventListener("tanstack-connect-success",this.#d)};#u=()=>{if(this.#n().addEventListener("tanstack-connect-success",this.#d),this.#l<this.#c){this.#l++,this.dispatchCustomEvent("tanstack-connect",{});return}this.#n().removeEventListener("tanstack-connect",this.#u),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()};constructor({pluginId:t,debug:n=!1,enabled:r=!0,reconnectEveryMs:o=1e3}){this.#t=t,this.#e=r,this.#n=this.getGlobalTarget,this.#i=n,this.debugLog(" Initializing event subscription for plugin",this.#t),this.#r=[],this.#o=!1,this.#a=null,this.#s=o}startConnectLoop(){this.#a!==null||this.#o||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#a=setInterval(this.#u,this.#s))}stopConnectLoop(){this.#a!==null&&(clearInterval(this.#a),this.#a=null,this.debugLog("Stopped connect loop"))}debugLog(...t){this.#i&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...t)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const t=typeof EventTarget<"u"?new EventTarget:void 0;return typeof t>"u"||typeof t.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),t)}getPluginId(){return this.#t}dispatchCustomEventShim(t,n){try{const r=new Event(t,{detail:n});this.#n().dispatchEvent(r)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(t,n){try{this.#n().dispatchEvent(new CustomEvent(t,{detail:n}))}catch{this.dispatchCustomEventShim(t,n)}}emitEventToBus(t){this.debugLog("Emitting event to client bus",t),this.dispatchCustomEvent("tanstack-dispatch-event",t)}emit(t,n){if(!this.#e){this.debugLog("Event bus client is disabled, not emitting event",t,n);return}if(!this.#o){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#r.push({type:`${this.#t}:${t}`,payload:n,pluginId:this.#t}),typeof CustomEvent<"u"&&(this.#u(),this.startConnectLoop());return}return this.emitEventToBus({type:`${this.#t}:${t}`,payload:n,pluginId:this.#t})}on(t,n){const r=`${this.#t}:${t}`;if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event",r),()=>{};const o=i=>{this.debugLog("Received event from bus",i.detail),n(i.detail)};return this.#n().addEventListener(r,o),this.debugLog("Registered event to bus",r),()=>{this.#n().removeEventListener(r,o)}}onAll(t){if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const n=r=>{const o=r.detail;t(o)};return this.#n().addEventListener("tanstack-devtools-global",n),()=>this.#n().removeEventListener("tanstack-devtools-global",n)}onAllPluginEvents(t){if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const n=r=>{const o=r.detail;this.#t&&o.pluginId!==this.#t||t(o)};return this.#n().addEventListener("tanstack-devtools-global",n),()=>this.#n().removeEventListener("tanstack-devtools-global",n)}}class S4e extends Gq{constructor(t){super({pluginId:"pacer",debug:t?.debug})}}const E4e=(e,t)=>{Jq.emit(e,t)},Jq=new S4e;function qD(){return{executionCount:0,isPending:!1,lastArgs:void 0,lastExecutionTime:0,nextExecutionTime:0,status:"idle",maybeExecuteCount:0}}const N4e={enabled:!0,leading:!0,trailing:!0,wait:0};class _4e{constructor(t,n){this.fn=t,this.store=new ux(qD()),this.setOptions=r=>{this.options={...this.options,...r},this.#n()||this.cancel()},this.#t=r=>{this.store.setState(o=>{const i={...o,...r},{isPending:s}=i;return{...i,status:this.#n()?s?"pending":"idle":"disabled"}}),E4e("Throttler",this)},this.#n=()=>!!HD(this.options.enabled,this),this.#i=()=>HD(this.options.wait,this),this.maybeExecute=(...r)=>{this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});const o=Date.now(),i=o-this.store.state.lastExecutionTime,s=this.#i();if(this.options.leading&&i>=s)this.#r(...r);else if(this.#t({lastArgs:r}),!this.#e&&this.options.trailing){const a=this.store.state.lastExecutionTime?o-this.store.state.lastExecutionTime:0,c=s-a;this.#t({isPending:!0}),this.#e=setTimeout(()=>{const{lastArgs:u}=this.store.state;u!==void 0&&this.#r(...u)},c)}},this.#r=(...r)=>{if(!this.#n())return;this.fn(...r);const o=Date.now(),i=o+this.#i();this.#o(),this.#t({executionCount:this.store.state.executionCount+1,lastExecutionTime:o,nextExecutionTime:i,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(r,this),setTimeout(()=>{this.store.state.isPending||this.#t({nextExecutionTime:void 0})},this.#i())},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&this.#r(...this.store.state.lastArgs)},this.#o=()=>{this.#e&&(clearTimeout(this.#e),this.#e=void 0)},this.cancel=()=>{this.#o(),this.#t({lastArgs:void 0,isPending:!1})},this.reset=()=>{this.#t(qD())},this.key=w4e(n.key),this.options={...N4e,...n},this.#t(this.options.initialState??{}),Jq.on("d-Throttler",r=>{r.payload.key===this.key&&(this.#t(r.payload.store.state),this.setOptions(r.payload.options))})}#e;#t;#n;#i;#r;#o}function C4e(e,t){return new _4e(e,t).maybeExecute}function g1(e,t){return typeof e=="function"?e(t):e}function om(e,t){return XT(t).reduce((r,o)=>{if(r===null)return null;if(typeof r<"u")return r[o]},e)}function gb(e,t,n){const r=XT(t);function o(i){if(!r.length)return g1(n,i);const s=r.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(i))return typeof i=="object"?(i===null&&(i={}),{...i,[s]:o(i[s])}):{[s]:o()};if(Array.isArray(i)&&typeof s=="number"){const a=i.slice(0,s);return[...a.length?a:new Array(s),o(i[s]),...i.slice(s+1)]}return[...new Array(s),o()]}return o(e)}function O4e(e,t){const n=XT(t);function r(o){if(!o)return;if(n.length===1){const s=n[0];if(Array.isArray(o)&&typeof s=="number")return o.filter((u,f)=>f!==s);const{[s]:a,...c}=o;return c}const i=n.shift();if(typeof i=="string"&&typeof o=="object")return{...o,[i]:r(o[i])};if(typeof i=="number"&&Array.isArray(o)){if(i>=o.length)return o;const s=o.slice(0,i);return[...s.length?s:new Array(i),r(o[i]),...o.slice(i+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return r(e)}const j4e=/^(\d+)$/gm,A4e=/\.(\d+)(?=\.)/gm,T4e=/^(\d+)\./gm,$4e=/\.(\d+$)/gm,R4e=/\.{2,}/gm,GC="__int__",yb=`${GC}$1`;function XT(e){if(Array.isArray(e))return[...e];if(typeof e!="string")throw new Error("Path must be a string.");return e.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(j4e,yb).replace(A4e,`.${yb}.`).replace(T4e,`${yb}.`).replace($4e,`.${yb}`).replace(R4e,".").split(".").map(t=>{if(t.startsWith(GC)){const n=t.substring(GC.length),r=parseInt(n,10);return String(r)===n?r:n}return t})}function k4e(e){return!(Array.isArray(e)&&e.length===0)}function JC(e,t){const n=r=>r.validators.filter(Boolean).map(o=>({cause:o.cause,validate:o.fn}));return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!1},runValidation:n})}function YC(e,t){const{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:o,onDynamicAsyncDebounceMs:i}=t.validators||{},s=n??0,a=c=>c.validators.filter(Boolean).map(u=>{const f=u?.cause||e;let p=s;switch(f){case"change":p=o??s;break;case"blur":p=r??s;break;case"dynamic":p=i??s;break;case"submit":p=0;break}return e==="submit"&&(p=0),{cause:f,validate:u.fn,debounceMs:p}});return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!0},runValidation:a})}const KC=e=>!!e&&typeof e=="object"&&"fields"in e;function of(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,i]of e)if(!t.has(o)||!Object.is(i,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!r.includes(o)||!of(e[o],t[o]))return!1;return!0}const WD=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:"form"}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},GD=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function no(e,t){return e==null?t:{...e,...t}}let gu=256;const Kb=[];let bb;for(;gu--;)Kb[gu]=(gu+256).toString(16).substring(1);function M4e(){let e=0,t,n="";if(!bb||gu+16>256){for(bb=new Array(256),e=256;e--;)bb[e]=256*Math.random()|0;e=0,gu=0}for(;e<16;e++)t=bb[gu+e],e===6?n+=Kb[t&15|64]:e===8?n+=Kb[t&63|128]:n+=Kb[t],e&1&&e>1&&e<11&&(n+="-");return gu++,n}const ff=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});const t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:"mount"},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:"change"},o={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:"blur"},i={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:"submit"},s=t?void 0:{fn:()=>{},cause:"server"};switch(e.event.type){case"mount":return e.runValidation({validators:[n],form:e.form});case"submit":return e.runValidation({validators:[r,o,i,s],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[o,s],form:e.form});case"change":return e.runValidation({validators:[r,s],form:e.form});default:throw new Error(`Unknown validation event type: ${e.event.type}`)}};function P4e(e,t){const n=new Map;for(const r of e){const o=r.path??[];let i=t,s="";for(let a=0;a<o.length;a++){const c=o[a];if(c===void 0)continue;const u=typeof c=="object"?c.key:c,f=Number(u);Array.isArray(i)&&!Number.isNaN(f)?s+=`[${f}]`:s+=(a>0?".":"")+String(u),typeof i=="object"&&i!==null?i=i[u]:i=void 0}n.set(s,(n.get(s)??[]).concat(r))}return Object.fromEntries(n)}const JD=(e,t)=>{const n=P4e(e,t);return{form:n,fields:n}},Ef={validate({value:e,validationSource:t},n){const r=n["~standard"].validate(e);if(r instanceof Promise)throw new Error("async function passed to sync validator");if(r.issues)return t==="field"?r.issues:JD(r.issues,e)},async validateAsync({value:e,validationSource:t},n){const r=await n["~standard"].validate(e);if(r.issues)return t==="field"?r.issues:JD(r.issues,e)}},Yq=e=>!!e&&"~standard"in e,dx={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function vb(e){function t(p,g,y,v){const x=r(p,g,y,v);({insert:()=>a(x,p,g),remove:()=>c(x),swap:()=>v!==void 0&&f(x,p,g,v),move:()=>v!==void 0&&u(x,p,g,v)})[y]()}function n(p,g){return`${p}[${g}]`}function r(p,g,y,v){const x=[n(p,g)];if(y==="swap")x.push(n(p,v));else if(y==="move"){const[S,E]=[Math.min(g,v),Math.max(g,v)];for(let C=S;C<=E;C++)x.push(n(p,C))}else{const S=e.getFieldValue(p),E=Array.isArray(S)?S.length:0;for(let C=g+1;C<E;C++)x.push(n(p,C))}return Object.keys(e.fieldInfo).filter(S=>x.some(E=>S.startsWith(E)))}function o(p,g){return p.replace(/\[(\d+)\]/,(y,v)=>{const x=parseInt(v,10);return`[${g==="up"?x+1:Math.max(0,x-1)}]`})}function i(p,g){(g==="up"?p:[...p].reverse()).forEach(v=>{const x=o(v.toString(),g),S=e.getFieldMeta(x);S?e.setFieldMeta(v,S):e.setFieldMeta(v,s())})}const s=()=>dx,a=(p,g,y)=>{i(p,"down"),p.forEach(v=>{v.toString().startsWith(n(g,y))&&e.setFieldMeta(v,s())})},c=p=>{i(p,"up")},u=(p,g,y,v)=>{const x=new Map(Object.keys(e.fieldInfo).filter(S=>S.startsWith(n(g,y))).map(S=>[S,e.getFieldMeta(S)]));i(p,y<v?"up":"down"),Object.keys(e.fieldInfo).filter(S=>S.startsWith(n(g,v))).forEach(S=>{const E=S.replace(n(g,v),n(g,y)),C=x.get(E);C&&e.setFieldMeta(S,C)})},f=(p,g,y,v)=>{p.forEach(x=>{if(!x.toString().startsWith(n(g,y)))return;const S=x.toString().replace(n(g,y),n(g,v)),[E,C]=[e.getFieldMeta(x),e.getFieldMeta(S)];E&&e.setFieldMeta(S,E),C&&e.setFieldMeta(x,C)})};return{handleArrayFieldMetaShift:t}}class D4e extends Gq{constructor(){super({pluginId:"form-devtools"})}}const ni=new D4e;function LN(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class I4e{constructor(t){this.options={},this.fieldInfo={},this.prevTransformArray=[],this.mount=()=>{const r=this.fieldMetaDerived.mount(),o=this.store.mount(),i=()=>{r(),o(),ni.emit("form-unmounted",{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});const{onMount:s}=this.options.validators||{};return ni.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),s&&this.validateSync("mount"),i},this.update=r=>{if(!r)return;const o=this.options;this.options=r;const i=!!r.transform?.deps?.some((c,u)=>c!==this.prevTransformArray[u]),s=r.defaultValues&&!of(r.defaultValues,o.defaultValues)&&!this.state.isTouched,a=!of(r.defaultState,o.defaultState)&&!this.state.isTouched;!s&&!a&&!i||(ms(()=>{this.baseStore.setState(()=>LN(Object.assign({},this.state,a?r.defaultState:{},s?{values:r.defaultValues}:{},i?{_force_re_eval:!this.state._force_re_eval}:{})))}),ni.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(r,o)=>{const{fieldMeta:i}=this.state,s=this.resetFieldMeta(i);r&&!o?.keepDefaultValues&&(this.options={...this.options,defaultValues:r}),this.baseStore.setState(()=>LN({...this.options.defaultState,values:r??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:s}))},this.validateAllFields=async r=>{const o=[];return ms(()=>{Object.values(this.fieldInfo).forEach(s=>{if(!s.instance)return;const a=s.instance;o.push(Promise.resolve().then(()=>a.validate(r,{skipFormValidation:!0}))),s.instance.state.meta.isTouched||s.instance.setMeta(c=>({...c,isTouched:!0}))})}),(await Promise.all(o)).flat()},this.validateArrayFieldsStartingFrom=async(r,o,i)=>{const s=this.getFieldValue(r),a=Array.isArray(s)?Math.max(s.length-1,0):null,c=[`${r}[${o}]`];for(let g=o+1;g<=(a??0);g++)c.push(`${r}[${g}]`);const u=Object.keys(this.fieldInfo).filter(g=>c.some(y=>g.startsWith(y))),f=[];return ms(()=>{u.forEach(g=>{f.push(Promise.resolve().then(()=>this.validateField(g,i)))})}),(await Promise.all(f)).flat()},this.validateField=(r,o)=>{const i=this.fieldInfo[r]?.instance;return i?(i.state.meta.isTouched||i.setMeta(s=>({...s,isTouched:!0})),i.validate(o)):[]},this.validateSync=r=>{const o=JC(r,{...this.options,form:this,validationLogic:this.options.validationLogic||ff});let i=!1;const s={};return ms(()=>{for(const u of o){if(!u.validate)continue;const f=this.runValidator({validate:u.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:p,fieldErrors:g}=Xb(f),y=Yp(u.cause);for(const v of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[v]===void 0)continue;const x=this.getFieldMeta(v);if(!x)continue;const{errorMap:S,errorSourceMap:E}=x,C=g?.[v],{newErrorValue:_,newSource:j}=WD({newFormValidatorError:C,isPreviousErrorFromFormValidator:E?.[y]==="form",previousErrorValue:S?.[y]});j==="form"&&(s[v]={...s[v],[y]:C}),S?.[y]!==_&&this.setFieldMeta(v,A=>({...A,errorMap:{...A.errorMap,[y]:_},errorSourceMap:{...A.errorSourceMap,[y]:j}}))}this.state.errorMap?.[y]!==p&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[y]:p}})),(p||g)&&(i=!0)}const a=Yp("submit");this.state.errorMap?.[a]&&r!=="submit"&&!i&&this.baseStore.setState(u=>({...u,errorMap:{...u.errorMap,[a]:void 0}}));const c=Yp("server");this.state.errorMap?.[c]&&r!=="server"&&!i&&this.baseStore.setState(u=>({...u,errorMap:{...u.errorMap,[c]:void 0}}))}),{hasErrored:i,fieldsErrorMap:s}},this.validateAsync=async r=>{const o=YC(r,{...this.options,form:this,validationLogic:this.options.validationLogic||ff});this.state.isFormValidating||this.baseStore.setState(u=>({...u,isFormValidating:!0}));const i=[];let s;for(const u of o){if(!u.validate)continue;const f=Yp(u.cause);this.state.validationMetaMap[f]?.lastAbortController.abort();const g=new AbortController;this.state.validationMetaMap[f]={lastAbortController:g},i.push(new Promise(async y=>{let v;try{v=await new Promise((C,_)=>{setTimeout(async()=>{if(g.signal.aborted)return C(void 0);try{C(await this.runValidator({validate:u.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:g.signal},type:"validateAsync"}))}catch(j){_(j)}},u.debounceMs)})}catch(C){v=C}const{formError:x,fieldErrors:S}=Xb(v);S&&(s=s?{...s,...S}:S);const E=Yp(u.cause);for(const C of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[C]===void 0)continue;const _=this.getFieldMeta(C);if(!_)continue;const{errorMap:j,errorSourceMap:A}=_,T=s?.[C],{newErrorValue:k,newSource:R}=WD({newFormValidatorError:T,isPreviousErrorFromFormValidator:A?.[E]==="form",previousErrorValue:j?.[E]});j?.[E]!==k&&this.setFieldMeta(C,V=>({...V,errorMap:{...V.errorMap,[E]:k},errorSourceMap:{...V.errorSourceMap,[E]:R}}))}this.baseStore.setState(C=>({...C,errorMap:{...C.errorMap,[E]:x}})),y(s?{fieldErrors:s,errorMapKey:E}:void 0)}))}let a=[];const c={};if(i.length){a=await Promise.all(i);for(const u of a)if(u?.fieldErrors){const{errorMapKey:f}=u;for(const[p,g]of Object.entries(u.fieldErrors)){const v={...c[p]||{},[f]:g};c[p]=v}}}return this.baseStore.setState(u=>({...u,isFormValidating:!1})),c},this.validate=r=>{const{hasErrored:o,fieldsErrorMap:i}=this.validateSync(r);return o&&!this.options.asyncAlways?i:this.validateAsync(r)},this.getFieldValue=r=>om(this.state.values,r),this.getFieldMeta=r=>this.state.fieldMeta[r],this.getFieldInfo=r=>this.fieldInfo[r]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(r,o)=>{this.baseStore.setState(i=>({...i,fieldMetaBase:{...i.fieldMetaBase,[r]:g1(o,i.fieldMetaBase[r])}}))},this.resetFieldMeta=r=>Object.keys(r).reduce((o,i)=>{const s=i;return o[s]=dx,o},{}),this.setFieldValue=(r,o,i)=>{const s=i?.dontUpdateMeta??!1,a=i?.dontRunListeners??!1,c=i?.dontValidate??!1;ms(()=>{s||this.setFieldMeta(r,u=>({...u,isTouched:!0,isDirty:!0,errorMap:{...u?.errorMap,onMount:void 0}})),this.baseStore.setState(u=>({...u,values:gb(u.values,r,o)}))}),a||this.getFieldInfo(r).instance?.triggerOnChangeListener(),c||this.validateField(r,"change")},this.deleteField=r=>{const i=[...Object.keys(this.fieldInfo).filter(s=>{const a=r.toString();return s!==a&&s.startsWith(a)}),r];this.baseStore.setState(s=>{const a={...s};return i.forEach(c=>{a.values=O4e(a.values,c),delete this.fieldInfo[c],delete a.fieldMetaBase[c]}),a})},this.pushFieldValue=(r,o,i)=>{this.setFieldValue(r,s=>[...Array.isArray(s)?s:[],o],i)},this.insertFieldValue=async(r,o,i,s)=>{this.setFieldValue(r,c=>[...c.slice(0,o),i,...c.slice(o)],no(s,{dontValidate:!0}));const a=s?.dontValidate??!1;a||await this.validateField(r,"change"),vb(this).handleArrayFieldMetaShift(r,o,"insert"),a||await this.validateArrayFieldsStartingFrom(r,o,"change")},this.replaceFieldValue=async(r,o,i,s)=>{this.setFieldValue(r,c=>c.map((u,f)=>f===o?i:u),no(s,{dontValidate:!0})),(s?.dontValidate??!1)||(await this.validateField(r,"change"),await this.validateArrayFieldsStartingFrom(r,o,"change"))},this.removeFieldValue=async(r,o,i)=>{const s=this.getFieldValue(r),a=Array.isArray(s)?Math.max(s.length-1,0):null;if(this.setFieldValue(r,u=>u.filter((f,p)=>p!==o),no(i,{dontValidate:!0})),vb(this).handleArrayFieldMetaShift(r,o,"remove"),a!==null){const u=`${r}[${a}]`;this.deleteField(u)}(i?.dontValidate??!1)||(await this.validateField(r,"change"),await this.validateArrayFieldsStartingFrom(r,o,"change"))},this.swapFieldValues=(r,o,i,s)=>{this.setFieldValue(r,c=>{const u=c[o],f=c[i];return gb(gb(c,`${o}`,f),`${i}`,u)},no(s,{dontValidate:!0})),vb(this).handleArrayFieldMetaShift(r,o,"swap",i),(s?.dontValidate??!1)||(this.validateField(r,"change"),this.validateField(`${r}[${o}]`,"change"),this.validateField(`${r}[${i}]`,"change"))},this.moveFieldValues=(r,o,i,s)=>{this.setFieldValue(r,c=>{const u=[...c];return u.splice(i,0,u.splice(o,1)[0]),u},no(s,{dontValidate:!0})),vb(this).handleArrayFieldMetaShift(r,o,"move",i),(s?.dontValidate??!1)||(this.validateField(r,"change"),this.validateField(`${r}[${o}]`,"change"),this.validateField(`${r}[${i}]`,"change"))},this.clearFieldValues=(r,o)=>{const i=this.getFieldValue(r),s=Array.isArray(i)?Math.max(i.length-1,0):null;if(this.setFieldValue(r,[],no(o,{dontValidate:!0})),s!==null)for(let c=0;c<=s;c++){const u=`${r}[${c}]`;this.deleteField(u)}(o?.dontValidate??!1)||this.validateField(r,"change")},this.resetField=r=>{this.baseStore.setState(o=>({...o,fieldMetaBase:{...o.fieldMetaBase,[r]:dx},values:this.options.defaultValues?gb(o.values,r,om(this.options.defaultValues,r)):o.values}))},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((r,[o,i])=>(Object.keys(i).length&&i.errors.length&&(r[o]={errors:i.errors,errorMap:i.errorMap}),r),{})}),this.parseValuesWithSchema=r=>Ef.validate({value:this.state.values,validationSource:"form"},r),this.parseValuesWithSchemaAsync=r=>Ef.validateAsync({value:this.state.values,validationSource:"form"},r),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=t?.formId??M4e(),this._devtoolsSubmissionOverride=!1,this.baseStore=new ux(LN({...t?.defaultState,values:t?.defaultValues??t?.defaultState?.values})),this.fieldMetaDerived=new Ea({deps:[this.baseStore],fn:({prevDepVals:r,currDepVals:o,prevVal:i})=>{const s=i,a=r?.[0],c=o[0];let u=0;const f={};for(const p of Object.keys(c.fieldMetaBase)){const g=c.fieldMetaBase[p],y=a?.fieldMetaBase[p],v=s?.[p],x=om(c.values,p);let S=v?.errors;if(!y||g.errorMap!==y.errorMap){S=Object.values(g.errorMap??{}).filter(A=>A!==void 0);const j=this.getFieldInfo(p)?.instance;j&&!j.options.disableErrorFlat&&(S=S?.flat(1))}const E=!k4e(S??[]),C=!g.isDirty,_=of(x,om(this.options.defaultValues,p))||of(x,this.getFieldInfo(p)?.instance?.options.defaultValue);if(v&&v.isPristine===C&&v.isValid===E&&v.isDefaultValue===_&&v.errors===S&&g===y){f[p]=v,u++;continue}f[p]={...g,errors:S,isPristine:C,isValid:E,isDefaultValue:_}}return Object.keys(c.fieldMetaBase).length&&s&&u===Object.keys(c.fieldMetaBase).length?s:f}}),this.store=new Ea({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:r,currDepVals:o,prevVal:i})=>{const s=i,a=r?.[0],c=o[0],u=o[1],f=Object.values(u).filter(Boolean),p=f.some(M=>M.isValidating),g=f.every(M=>M.isValid),y=f.some(M=>M.isTouched),v=f.some(M=>M.isBlurred),x=f.every(M=>M.isDefaultValue),S=y&&c.errorMap?.onMount,E=f.some(M=>M.isDirty),C=!E,_=!!(c.errorMap?.onMount||f.some(M=>M?.errorMap?.onMount)),j=!!p;let A=s?.errors??[];(!a||c.errorMap!==a.errorMap)&&(A=Object.values(c.errorMap).reduce((M,z)=>z===void 0?M:z&&KC(z)?(M.push(z.form),M):(M.push(z),M),[]));const T=A.length===0,k=g&&T,R=this.options.canSubmitWhenInvalid??!1,V=c.submissionAttempts===0&&!y&&!_||!j&&!c.isSubmitting&&k||R;let H=c.errorMap;if(S&&(A=A.filter(M=>M!==c.errorMap.onMount),H=Object.assign(H,{onMount:void 0})),s&&a&&s.errorMap===H&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===A&&s.isFieldsValidating===p&&s.isFieldsValid===g&&s.isFormValid===T&&s.isValid===k&&s.canSubmit===V&&s.isTouched===y&&s.isBlurred===v&&s.isPristine===C&&s.isDefaultValue===x&&s.isDirty===E&&of(a,c))return s;let F={...c,errorMap:H,fieldMeta:this.fieldMetaDerived.state,errors:A,isFieldsValidating:p,isFieldsValid:g,isFormValid:T,isValid:k,canSubmit:V,isTouched:y,isBlurred:v,isPristine:C,isDefaultValue:x,isDirty:E};const B=this.options.transform?.deps??[];if(B.length!==this.prevTransformArray.length||B.some((M,z)=>M!==this.prevTransformArray[z])){const M=Object.assign({},this,{state:F});this.options.transform?.fn(M),F=M.state,this.prevTransformArray=B}return F}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(t||{});const n=C4e(r=>ni.emit("form-state",{id:this._formId,state:r}),{wait:300});this.store.subscribe(()=>{n(this.store.state)}),ni.on("request-form-state",r=>{r.payload.id===this._formId&&ni.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),ni.on("request-form-reset",r=>{r.payload.id===this._formId&&this.reset()}),ni.on("request-form-force-submit",r=>{r.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)})}get state(){return this.store.state}get formId(){return this._formId}runValidator(t){return Yq(t.validate)?Ef[t.type](t.value,t.validate):t.validate(t.value)}async handleSubmit(t){this.baseStore.setState(o=>({...o,isSubmitted:!1,submissionAttempts:o.submissionAttempts+1,isSubmitSuccessful:!1})),ms(()=>{Object.values(this.fieldInfo).forEach(o=>{o.instance&&(o.instance.state.meta.isTouched||o.instance.setMeta(i=>({...i,isTouched:!0})))})});const n=t??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:n});return}this.baseStore.setState(o=>({...o,isSubmitting:!0}));const r=()=>{this.baseStore.setState(o=>({...o,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){r(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:n}),ni.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(o=>o.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){r(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:n}),ni.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}ms(()=>{Object.values(this.fieldInfo).forEach(o=>{o.instance?.options.listeners?.onSubmit?.({value:o.instance.state.value,fieldApi:o.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:n});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:n}),ms(()=>{this.baseStore.setState(o=>({...o,isSubmitted:!0,isSubmitSuccessful:!0})),ni.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),r()})}catch(o){throw this.baseStore.setState(i=>({...i,isSubmitSuccessful:!1})),ni.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:o}),r(),o}}setErrorMap(t){ms(()=>{Object.entries(t).forEach(([n,r])=>{const o=n;if(KC(r)){const{formError:i,fieldErrors:s}=Xb(r);for(const a of Object.keys(this.fieldInfo))this.getFieldMeta(a)&&this.setFieldMeta(a,u=>({...u,errorMap:{...u.errorMap,[o]:s?.[a]},errorSourceMap:{...u.errorSourceMap,[o]:"form"}}));this.baseStore.setState(a=>({...a,errorMap:{...a.errorMap,[o]:i}}))}else this.baseStore.setState(i=>({...i,errorMap:{...i.errorMap,[o]:r}}))})})}}function Xb(e){if(e){if(KC(e)){const t=Xb(e.form).formError,n=e.fields;return{formError:t,fieldErrors:n}}return{formError:e}}return{formError:void 0}}function Yp(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class L4e{constructor(t){this.options={},this.mount=()=>{const n=this.store.mount();this.options.defaultValue!==void 0&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const r=this.getInfo();r.instance=this,this.update(this.options);const{onMount:o}=this.options.validators||{};if(o){const i=this.runValidator({validate:o,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});i&&this.setMeta(s=>({...s,errorMap:{...s?.errorMap,onMount:i},errorSourceMap:{...s?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),n},this.update=n=>{this.options=n;const r=this.name!==n.name;if(this.name=n.name,this.state.value===void 0){const o=om(n.form.options.defaultValues,n.name),i=n.defaultValue??o;r?this.setValue(s=>s||i,{dontUpdateMeta:!0}):i!==void 0&&this.setValue(i,{dontUpdateMeta:!0})}this.form.getFieldMeta(this.name)===void 0&&this.setMeta(this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(n,r)=>{this.form.setFieldValue(this.name,n,no(r,{dontRunListeners:!0,dontValidate:!0})),r?.dontRunListeners||this.triggerOnChangeListener(),r?.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=n=>this.form.setFieldMeta(this.name,n),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(n,r)=>{this.form.pushFieldValue(this.name,n,no(r,{dontRunListeners:!0})),r?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(n,r,o)=>{this.form.insertFieldValue(this.name,n,r,no(o,{dontRunListeners:!0})),o?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(n,r,o)=>{this.form.replaceFieldValue(this.name,n,r,no(o,{dontRunListeners:!0})),o?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(n,r)=>{this.form.removeFieldValue(this.name,n,no(r,{dontRunListeners:!0})),r?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(n,r,o)=>{this.form.swapFieldValues(this.name,n,r,no(o,{dontRunListeners:!0})),o?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(n,r,o)=>{this.form.moveFieldValues(this.name,n,r,no(o,{dontRunListeners:!0})),o?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=n=>{this.form.clearFieldValues(this.name,no(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=n=>{const r=Object.values(this.form.fieldInfo),o=[];for(const i of r){if(!i.instance)continue;const{onChangeListenTo:s,onBlurListenTo:a}=i.instance.options.validators||{};n==="change"&&s?.includes(this.name)&&o.push(i.instance),n==="blur"&&a?.includes(this.name)&&o.push(i.instance)}return o},this.validateSync=(n,r)=>{const o=JC(n,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||ff}),s=this.getLinkedFields(n).reduce((u,f)=>{const p=JC(n,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||ff});return p.forEach(g=>{g.field=f}),u.concat(p)},[]);let a=!1;ms(()=>{const u=(f,p)=>{const g=xb(p.cause),y=p.validate?YD(f.runValidator({validate:p.validate,value:{value:f.store.state.value,validationSource:"field",fieldApi:f},type:"validate"})):void 0,v=r[g],{newErrorValue:x,newSource:S}=GD({formLevelError:v,fieldLevelError:y});f.state.meta.errorMap?.[g]!==x&&f.setMeta(E=>({...E,errorMap:{...E.errorMap,[g]:x},errorSourceMap:{...E.errorSourceMap,[g]:S}})),x&&(a=!0)};for(const f of o)u(this,f);for(const f of s)f.validate&&u(f.field,f)});const c=xb("submit");return this.state.meta.errorMap?.[c]&&n!=="submit"&&!a&&this.setMeta(u=>({...u,errorMap:{...u.errorMap,[c]:void 0},errorSourceMap:{...u.errorSourceMap,[c]:void 0}})),{hasErrored:a}},this.validateAsync=async(n,r)=>{const o=YC(n,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||ff}),i=await r,s=this.getLinkedFields(n),a=s.reduce((g,y)=>{const v=YC(n,{...y.options,form:y.form,validationLogic:y.form.options.validationLogic||ff});return v.forEach(x=>{x.field=y}),g.concat(v)},[]);this.state.meta.isValidating||this.setMeta(g=>({...g,isValidating:!0}));for(const g of s)g.setMeta(y=>({...y,isValidating:!0}));const c=[],u=[],f=(g,y,v)=>{const x=xb(y.cause);g.getInfo().validationMetaMap[x]?.lastAbortController.abort();const E=new AbortController;this.getInfo().validationMetaMap[x]={lastAbortController:E},v.push(new Promise(async C=>{let _;try{_=await new Promise((R,V)=>{this.timeoutIds.validations[y.cause]&&clearTimeout(this.timeoutIds.validations[y.cause]),this.timeoutIds.validations[y.cause]=setTimeout(async()=>{if(E.signal.aborted)return R(void 0);try{R(await this.runValidator({validate:y.validate,value:{value:g.store.state.value,fieldApi:g,signal:E.signal,validationSource:"field"},type:"validateAsync"}))}catch(H){V(H)}},y.debounceMs)})}catch(R){_=R}if(E.signal.aborted)return C(void 0);const j=YD(_),A=i[this.name]?.[x],{newErrorValue:T,newSource:k}=GD({formLevelError:A,fieldLevelError:j});g.setMeta(R=>({...R,errorMap:{...R?.errorMap,[x]:T},errorSourceMap:{...R.errorSourceMap,[x]:k}})),C(T)}))};for(const g of o)g.validate&&f(this,g,c);for(const g of a)g.validate&&f(g.field,g,u);let p=[];(c.length||u.length)&&(p=await Promise.all(c),await Promise.all(u)),this.setMeta(g=>({...g,isValidating:!1}));for(const g of s)g.setMeta(y=>({...y,isValidating:!1}));return p.filter(Boolean)},this.validate=(n,r)=>{if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:o}=r?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(n),{hasErrored:i}=this.validateSync(n,o[this.name]??{});if(i&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[xb(n)]?.lastAbortController.abort(),this.state.meta.errors;const s=r?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(n);return this.validateAsync(n,s)},this.handleChange=n=>{this.setValue(n)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(r=>({...r,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(r=>({...r,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.parseValueWithSchema=n=>Ef.validate({value:this.state.value,validationSource:"field"},n),this.parseValueWithSchemaAsync=n=>Ef.validateAsync({value:this.state.value,validationSource:"field"},n),this.form=t.form,this.name=t.name,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=new Ea({deps:[this.form.store],fn:()=>{const n=this.form.getFieldValue(this.name),r=this.form.getFieldMeta(this.name)??{...dx,...t.defaultMeta};return{value:n,meta:r}}}),this.options=t}get state(){return this.store.state}runValidator(t){return Yq(t.validate)?Ef[t.type](t.value,t.validate):t.validate(t.value)}setErrorMap(t){this.setMeta(n=>({...n,errorMap:{...n.errorMap,...t}}))}triggerOnBlurListener(){const t=this.form.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},t)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});const n=this.options.listeners?.onBlurDebounceMs;n&&n>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},n)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}triggerOnChangeListener(){const t=this.form.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},t)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});const n=this.options.listeners?.onChangeDebounceMs;n&&n>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},n)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})}}function YD(e){if(e)return e}function xb(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function Kq(e,t=n=>n){return Uq.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,F4e)}function F4e(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!t.has(r)||!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=KD(e);if(n.length!==KD(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function KD(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const fx=typeof window<"u"?w.useLayoutEffect:w.useEffect;function z4e(e){const[t]=w.useState(()=>{const r=new L4e({...e,form:e.form,name:e.name});return r.Field=Xq,r});return fx(t.mount,[t]),fx(()=>{t.update(e)}),Kq(t.store,e.mode==="array"?n=>[n.meta,Object.keys(n.value??[]).length]:void 0),t}const Xq=({children:e,...t})=>{const n=z4e(t),r=w.useMemo(()=>g1(e,n),[e,n,n.state.value,n.state.meta]);return h.jsx(h.Fragment,{children:r})};function B4e({form:e,selector:t,children:n}){const r=Kq(e.store,t);return g1(n,r)}function V4e(e){const t=w.useId(),[n]=w.useState(()=>{const r=new I4e({...e,formId:t}),o=r;return o.Field=function(s){return h.jsx(Xq,{...s,form:r})},o.Subscribe=function(s){return h.jsx(B4e,{form:r,selector:s.selector,children:s.children})},o});return fx(n.mount,[]),fx(()=>{n.update(e)}),n}function U4e(e,t){return Vi(e,(n,r)=>{n[r.name]=r.getValue(t?.[r.name],"form")??""},{})}function H4e(e,t,n,r){return Vi(t,(o,i,s)=>{const a=r.find(f=>f.name===s);if(!a||a.isVirtual())return;const c=i===""?null:i,u=a.getValue(c,"submit")??null;(e==="create"||u!==n[s])&&(o[s]=u)},{})}function Qq({action:e="update",entity:t,initialData:n,onSubmitted:r}){const o=n??{},i=t.getFillableFields(e,!0),s=U4e(i,o),a=V4e({defaultValues:s,validators:{onSubmitAsync:async({value:u})=>{try{t.isValidData(u,e,{explain:!0,ignoreUnknown:!0});return}catch(f){return f.message}}},onSubmit:async({value:u,formApi:f})=>{if(!t.isValidData(u,e)){console.error("invalid data",u);return}if(!o)return;const p=H4e(e,u,o,i);await r?.(Object.keys(p).length===0?void 0:p)}});async function c(u){u.preventDefault(),u.stopPropagation(),a.handleSubmit()}return{Form:a,handleSubmit:c,fields:i,action:e,values:s,initialData:n}}function q4e({params:e}){return h.jsx(W4e,{params:e},e.entity)}function W4e({params:e}){const{$data:t,relations:n}=Ho(),r=t.entity(e.entity);if(!r)return h.jsx(yo.NotFound,{description:`Entity "${e.entity}" doesn't exist.`});const o=e.id,[i,s]=w.useState(null),[a,c,u]=Pn();hr(["Data",r.label,`#${o}`]);const f=n.listableRelationsOf(r),p=n.sourceRelationsOf(r)?.map(k=>k.other(r).reference),g=kw(r.name,o,{with:p},{keepPreviousData:!1,revalidateOnFocus:!1,shouldRetryOnError:!1}),y=Uw(r,"update",g.data),v=st.data.entity.list(r.name),x=()=>u({fallback:v});async function S(k){if(!k){ci.show({title:`Updating ${r?.label}`,message:"No changes to update",color:"yellow"});return}try{await g.update(k),i&&s(null),ci.show({title:`Updating ${r?.label}`,message:`Successfully updated ID ${o}`,color:"green"}),_.reset()}catch(R){s(R instanceof Error?R.message:"Failed to update")}}async function E(){if(confirm("Are you sure to delete?"))try{await g._delete(),i&&s(null),ci.show({title:`Deleting ${r?.label}`,message:`Successfully deleted ID ${o}`,color:"green"}),x()}catch(k){s(k instanceof Error?k.message:"Failed to delete")}}const C=g.data,{Form:_,handleSubmit:j}=Qq({action:"update",entity:r,initialData:g.data?.toJSON(),onSubmitted:S});if(!C&&!g.isLoading)return h.jsx(yo.NotFound,{description:`Entity "${e.entity}" with ID "${o}" doesn't exist.`});const A=(k="")=>`${r.name}_${o}_${String(k)}`,T=g.isLoading||g.isValidating||_.state.isSubmitting;return h.jsxs(w.Fragment,{children:[h.jsx(An,{right:h.jsxs(h.Fragment,{children:[h.jsx(Nr,{position:"bottom-end",items:[...y.actions?.context??[],{label:"Inspect",onClick:()=>{vr.open("debug",{data:{data:C,entity:r.toJSON(),schema:r.toSchema({clean:!0}),form:_.state.values,state:_.state}})}},{label:"Settings",onClick:()=>a(st.settings.path(["data","entities",r.name]),{absolute:!0})},{label:"Delete",onClick:E,destructive:!0,disabled:T}],children:h.jsx(ft,{Icon:Ha})}),y.actions?.primary?.map((k,R)=>k&&w.createElement(Xe,{variant:"primary",...k,type:"button",key:R})),h.jsx(_.Subscribe,{selector:k=>[k.canSubmit,k.isSubmitting],children:([k,R])=>h.jsx(Xe,{type:"button",onClick:_.handleSubmit,variant:"primary",tabIndex:r.fields.length+1,disabled:!k||R||T,children:"Update"})})]}),className:"pl-3",children:h.jsx(m1,{backTo:v,path:[{label:r.label,href:v},{label:`Edit #${o}`}]})}),g.isLoading?h.jsx("div",{className:"w-full h-full flex justify-center items-center font-mono opacity-30",children:"Loading..."}):h.jsxs(Zn,{children:[y.header,i&&h.jsxs("div",{className:"flex flex-row dark:bg-red-950 bg-red-100 p-4",children:[h.jsx("b",{className:"mr-2",children:"Update failed: "})," ",i]}),h.jsx(Hq,{entity:r,entityId:o,handleSubmit:j,fieldsDisabled:T,data:C??void 0,Form:_,action:"update",className:"flex flex-grow flex-col gap-3 p-3"}),y.footer,f.length>0?h.jsx(G4e,{id:o,entity:r,relations:f}):null]})]},A())}function G4e({id:e,entity:t,relations:n}){const[r,o]=w.useState(n.length>0?n[0]:void 0);function i(s){o(s)}return n.length===0?null:h.jsxs("div",{className:"flex flex-col max-w-full",children:[h.jsx(GV,{title:"Relations",items:n.map(s=>{const a=s.other(t);return{as:"button",type:"button",label:Io(a.reference),onClick:()=>i(s),active:r?.other(t).reference===a.reference,badge:s.type()}})}),h.jsx("div",{className:"flex flex-grow flex-col gap-3 p-3",children:h.jsx(J4e,{id:e,entity:t,relation:r},JSON.stringify(r?.toJSON()))})]})}function J4e({id:e,entity:t,relation:n}){const r=n.other(t),[o]=Pn(),[i,s]=w.useState({select:r.entity.getSelect(void 0,"table"),sort:r.entity.getDefaultSort(),limit:10,offset:0}),a=Zg(g=>g.data.readManyByReference(t.name,e,r.reference,{...i,limit:i.limit+1}),{keepPreviousData:!0,revalidateOnFocus:!0});function c(g){o(st.data.entity.edit(r.entity.name,g.id))}let u;try{if(r.entity.type!=="system"){const g=n.getReferenceQuery(r.entity,e,r.reference);u=()=>{o(st.data.entity.create(r.entity.name),{query:g.where})}}}catch{}if(!a.data)return null;const f=a.isValidating||a.isLoading,p=a.data?.body.meta;return h.jsx("div",{"data-updating":f?1:void 0,className:"transition-opacity data-[updating]:opacity-50",children:h.jsx(KT,{select:i.select,data:a.data??null,entity:r.entity,sort:i.sort,onClickRow:c,onClickNew:u,page:Math.floor(i.offset/i.limit)+1,total:p?.count,onClickPage:g=>{s(y=>({...y,offset:(g-1)*y.limit}))}})})}function Zq(e,t){const n=gwe(),[r,o]=Uo(),i=w.useMemo(()=>PL(e.template({withOptional:!0}),t?.defaultValue??{}),[JSON.stringify({schema:e,dflt:t?.defaultValue})]),[s,a]=w.useState(i);w.useEffect(()=>{const u=n.length>0?Eie(n):t?.defaultValue??{},f=Cn(e,Object.assign({},i,u));a(f)},[n,JSON.stringify(t?.defaultValue),r]);function c(u){const f=Y4e(Object.assign({},s,u),i),p=t?.beforeEncode?.(f)??f,g=tw(p,{encode:!1});o(r+(g.length>0?"?"+g:""))}return{value:s,set:c}}function Y4e(e,t){return Vi(e,(n,r,o)=>{t&&BF(r,t[o])||(n[o]=r)},{})}function K4e({params:e}){const{$data:t}=Ho(),[n,r,o]=Pn(),i=t.entity(e.entity);if(i){if(i.type==="system")return h.jsx(yo.NotAllowed,{description:`Entity "${e.entity}" cannot be created.`})}else return h.jsx(yo.NotFound,{description:`Entity "${e.entity}" doesn't exist.`});const s=Uw(i,"create"),[a,c]=w.useState(null);hr(["Data",i.label,"Create"]);const u=mve(i.name),f=Zq(ke({}),{}),p=st.data.entity.list(i.name),g=()=>o({fallback:p});async function y(E){if(console.log("create:changeSet",E),!!E)try{const C=await u.create(E);a&&c(null),C.id?(ci.show({title:`Creating ${i?.label}`,message:`Successfully created with ID ${C.id}`,color:"green"}),n(st.data.entity.edit(e.entity,C.id))):g()}catch(C){c(C instanceof Error?C.message:"Failed to create")}}const{Form:v,handleSubmit:x}=Qq({action:"create",entity:i,initialData:f.value,onSubmitted:y}),S=u.isLoading||u.isValidating||v.state.isSubmitting;return h.jsxs(h.Fragment,{children:[h.jsx(An,{right:h.jsxs(h.Fragment,{children:[s.actions?.context&&h.jsx(Nr,{position:"bottom-end",items:s.actions.context,children:h.jsx(ft,{Icon:Ha})}),h.jsx(Xe,{onClick:g,children:"Cancel"}),s.actions?.primary?.map((E,C)=>E&&w.createElement(Xe,{...E,type:"button",key:C,variant:"primary"})),h.jsx(v.Subscribe,{selector:E=>[E.canSubmit,E.isSubmitting],children:([E,C])=>h.jsx(Xe,{type:"button",onClick:v.handleSubmit,variant:"primary",tabIndex:i.fields.length,disabled:!E||C,children:"Create"})})]}),className:"pl-3",children:h.jsx(m1,{backTo:p,path:[{label:i.label,href:p},{label:"Create"}]})}),h.jsxs(Zn,{children:[s.header,a&&h.jsxs("div",{className:"flex flex-row dark:bg-red-950 bg-red-100 p-4",children:[h.jsx("b",{className:"mr-2",children:"Create failed: "})," ",a]}),h.jsx(Hq,{entity:i,handleSubmit:x,fieldsDisabled:S,data:f.value,Form:v,action:"create",className:"flex flex-grow flex-col gap-3 p-3"}),s.footer]},i.name)]})}function X4e(){const e=ss(),{config:t}=_c(),n=PA(),[r]=Pn();return{open:async()=>{const i=vr.open("overlay",{content:"Loading..."}),s=await e.auth.actionSchema("password","create");i.closeAll(),vr.open("form",{schema:s,uiSchema:{password:{"ui:widget":"password"}},autoCloseAfterSubmit:!1,onSubmit:async(a,c)=>{console.log("submitted:",a,c);const u=await e.auth.action("password","create",a);console.log(u),u.ok?(n(),r(st.data.entity.edit(t.entity_name,u.data.id)),c.close()):"error"in u?c.setError(u.error):c.setError("Unknown error")}},{title:"Create User"})}}}const Q4e=QL({...IL(oi.properties,["select","where","sort"]),page:bt({default:1}).optional(),perPage:bt({default:10}).optional()}),Z4e=[5,10,25,50,100];function eRe({params:e}){return h.jsx(tRe,{params:e},e.entity)}function tRe({params:e}){const{$data:t}=Ho(),n=t.entity(e.entity);if(!n)return h.jsx(yo.NotFound,{description:`Entity "${e.entity}" doesn't exist.`});const r=Uw(n,"list");hr(["Data",n?.label??e.entity]);const[o]=Pn(),i=Zq(Q4e,{defaultValue:{select:n.getSelect(void 0,"table"),sort:n.getDefaultSort()},beforeEncode:v=>"sort"in v&&v.sort?{...v,sort:`${v.sort.dir==="asc"?"":"-"}${v.sort.by}`}:v}),s=Zg(v=>v.data.readMany(n?.name,{select:i.value.select,limit:i.value.perPage+1,offset:(i.value.page-1)*i.value.perPage,sort:`${i.value.sort.dir==="asc"?"":"-"}${i.value.sort.by}`}),{enabled:!!n,revalidateOnFocus:!0,keepPreviousData:!0}),a=s.data?.data,c=s.data?.body.meta;function u(v){n&&o(st.data.entity.edit(n.name,v.id))}function f(v){i.set({page:v})}function p(v){const x=i.value.sort,S={by:v,dir:x.by===v&&x.dir==="asc"?"desc":"asc"};i.set({sort:S})}function g(v){i.set({perPage:v,page:1})}const y=s.isLoading||s.isValidating;return h.jsxs(w.Fragment,{children:[h.jsx(An,{right:h.jsxs(h.Fragment,{children:[h.jsx(Nr,{items:[...r.actions?.context??[],{label:"Settings",onClick:()=>o(st.data.schema.entity(n.name))},{label:"Data Schema",onClick:()=>o(st.data.schema.root())},{label:"Advanced Settings",onClick:()=>o(st.settings.path(["data","entities",n.name]),{absolute:!0})}],position:"bottom-end",children:h.jsx(ft,{Icon:Ha})}),r.actions?.primary?.map((v,x)=>v&&w.createElement(Xe,{variant:"primary",...v,type:"button",key:x})),h.jsx(nRe,{entity:n})]}),children:h.jsx(oy,{children:n.label})}),h.jsxs(Zn,{children:[r.header,h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:h.jsx("div",{"data-updating":y?1:void 0,className:"data-[updating]:opacity-50 transition-opacity",children:h.jsx(KT,{data:a??null,entity:n,select:i.value.select,onClickRow:u,page:i.value.page,sort:i.value.sort,onClickSort:p,perPage:i.value.perPage,perPageOptions:Z4e,total:c?.count,onClickPage:f,onClickPerPage:g})})}),r.footer]},n.name)]},n.name)}function nRe({entity:e}){const t=ot(),n=X4e(),[r]=Pn();return e?e.type==="system"?{users:t.app.config.auth.entity_name,media:t.app.config.media.entity_name}.users===e.name?h.jsx(Xe,{onClick:n.open,variant:"primary",children:"New User"}):null:h.jsx(Xe,{onClick:()=>{r(st.data.entity.create(e.name))},variant:"primary",children:"Create new"}):null}function rRe({params:e}){const{$data:t}=Ho(),[n]=Pn(),r=t.entity(e.entity);return r?h.jsxs($V,{path:`/entity/${r.name}/:setting?`,defaultIdentifier:"fields",children:[h.jsx(An,{right:h.jsxs(h.Fragment,{children:[h.jsx(Nr,{items:[{label:"Data",onClick:()=>n(st.data.root()+st.data.entity.list(r.name),{absolute:!0})},{label:"Advanced Settings",onClick:()=>n(st.settings.path(["data","entities",r.name]),{absolute:!0})}],position:"bottom-end",children:h.jsx(ft,{Icon:Ha})}),h.jsx(Iw,{children:h.jsx(Nr,{items:[{icon:YA,label:"Add relation",onClick:()=>t.modals.createRelation(r.name)},{icon:ny,label:"Add media",onClick:()=>t.modals.createMedia(r.name)},()=>h.jsx("div",{className:"h-px my-1 w-full bg-primary/5"}),{icon:FV,label:"Create Entity",onClick:()=>t.modals.createEntity()}],position:"bottom-end",children:h.jsx(Xe,{IconRight:UV,children:"Add"})})})]}),className:"pl-3",children:h.jsxs("div",{className:"flex flex-row gap-4",children:[h.jsx(m1,{path:[{label:"Schema",href:"/"},{label:r.label}],backTo:"/"}),h.jsx(Nn,{to:"/",className:"hidden md:inline",children:h.jsx(Xe,{IconLeft:fC,children:"Overview"})})]})}),h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsx(oRe,{entity:r}),h.jsx(iRe,{entity:r}),h.jsx(Vf,{identifier:"relations",title:"Relations",ActiveIcon:LA,children:h.jsx(Hn,{title:"Relations",description:"This will soon be available here. Meanwhile, check advanced settings.",primary:{children:"Advanced Settings",onClick:()=>n(st.settings.path(["data","relations"]),{absolute:!0})}})}),h.jsx(Vf,{identifier:"indices",title:"Indices",ActiveIcon:Eve,children:h.jsx(Hn,{title:"Indices",description:"This will soon be available here. Meanwhile, check advanced settings.",primary:{children:"Advanced Settings",onClick:()=>n(st.settings.path(["data","indices"]),{absolute:!0})}})})]},r.name)]}):h.jsx(yo.NotFound,{description:`Entity "${e.entity}" doesn't exist.`})}const oRe=({entity:e})=>{const[t,n]=w.useState(!1),[r,o]=w.useState(0),{actions:i,$data:s,config:a}=Ho(),{readonly:c}=ot(),[u,f]=w.useState(),p=w.useRef(null);async function g(){if(t)return;n(!0);const v=p.current?.getData();await i.entity.patch(e.name).fields.set(v),n(!1),o(x=>x+1)}const y=Object.fromEntries(e.fields.map(v=>[v.name,v.toJSON()]));return h.jsx(Vf,{identifier:"fields",title:"Fields",ActiveIcon:IA,renderHeaderRight:({open:v})=>v&&!c?h.jsx(Xe,{variant:"primary",disabled:!v,onClick:g,children:"Update"}):null,children:h.jsxs("div",{className:"flex flex-col flex-grow py-3 px-4 max-w-4xl gap-3 relative",children:[t&&h.jsx("div",{className:"animate-fade-in absolute w-full h-full top-0 bottom-0 left-0 right-0 bg-background/65 z-50"}),h.jsx(MH,{readonly:c,routePattern:`/entity/${e.name}/fields/:sub?`,fields:y,ref:p,sortable:!c,additionalFieldTypes:i1.filter(v=>["relation","media"].includes(v.type)).map(v=>({...v,onClick:()=>{switch(v.type){case"relation":s.modals.createRelation(e.name);break;case"media":s.modals.createMedia(e.name);break}}})),defaultPrimaryFormat:a?.default_primary_format,isNew:!1},String(r)),ir()&&!c&&h.jsxs("div",{children:[h.jsxs("div",{className:"flex flex-row gap-1 justify-center",children:[h.jsx(Xe,{size:"small",onClick:()=>f(p.current?.isValid()),children:"valid"}),h.jsx(Xe,{size:"small",onClick:()=>f(p.current?.getValues()),children:"values"}),h.jsx(Xe,{size:"small",onClick:()=>f(p.current?.getData()),children:"data"}),h.jsx(Xe,{size:"small",onClick:()=>f(p.current?.getErrors()),children:"errors"}),h.jsx(Xe,{size:"small",onClick:g,children:"update"})]}),h.jsx("pre",{className:"select-text",children:JSON.stringify(u,null,2)})]})]})})},iRe=({entity:e})=>{const t=Ho(),n=t.entities?.[e.name]?.config,r=w.useRef(null),{readonly:o}=ot(),i=Nw(t.schema.properties.entities.additionalProperties?.properties?.config),[s,a]=OH(i,n,["fields"]);try{s.properties.sort_field.enum=e.getFields().map(u=>u.name)}catch(u){console.error("error setting sort_field enum",u)}async function c(){console.log("update",r.current?.formData()),await t.actions.entity.patch(e.name).config(r.current?.formData())}return h.jsx(Vf,{identifier:"settings",title:"Settings",ActiveIcon:rg,renderHeaderRight:({open:u})=>u&&!o?h.jsx(Xe,{variant:"primary",disabled:!u,onClick:c,children:"Update"}):null,children:h.jsx("div",{className:"flex flex-col flex-grow py-3 px-4 max-w-4xl gap-3 relative",children:h.jsx(jh,{ref:r,schema:s,formData:a,onSubmit:console.log,className:"legacy hide-required-mark fieldset-alternative mute-root",readonly:o})})})},sRe=w.lazy(()=>Kw(()=>import("./DataSchemaCanvas-Bidf4HWW.js"),[]).then(e=>({default:e.DataSchemaCanvas})));function aRe(){const{$data:e}=Ho();return h.jsxs(h.Fragment,{children:[h.jsx(An,{right:h.jsx(Iw,{children:h.jsx(Xe,{type:"button",variant:"primary",onClick:e.modals.createAny,children:"Create new"})}),children:"Schema Overview"}),h.jsx("div",{className:"w-full h-full",children:h.jsx(w.Suspense,{children:h.jsx(sRe,{})})})]})}function lRe(){return h.jsx(r4e,{children:h.jsxs(As,{children:[h.jsx(tt,{path:"/",component:i4e}),h.jsx(tt,{path:"/entity/:entity",component:eRe}),h.jsx(tt,{path:"/entity/:entity/create",component:K4e}),h.jsx(tt,{path:"/entity/:entity/edit/:id",component:q4e}),h.jsxs(tt,{path:"/schema",nest:!0,children:[h.jsx(tt,{path:"/",component:aRe}),h.jsx(tt,{path:"/entity/:entity/:setting?/:sub?",component:rRe})]})]})})}const XD=()=>h.jsx("span",{className:"text-xs bg-primary/10 flex rounded-full px-2.5 py-1 leading-none",children:"coming soon"});function cRe(e){return ir()?h.jsx(uRe,{...e}):h.jsx(dRe,{})}function uRe({children:e}){const{app:t}=ot();return h.jsxs(h.Fragment,{children:[h.jsxs(Wu,{children:[h.jsx(An,{right:h.jsx(Nn,{href:t.getSettingsPath(["flows"]),children:h.jsx(ft,{Icon:_h})}),children:"Flows"}),h.jsx(Zn,{initialOffset:96,children:h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:h.jsxs("nav",{className:"flex flex-col flex-1 gap-1",children:[h.jsx(oo,{as:Nn,href:st.flows.flows.list(),children:"All Flows"}),h.jsxs(oo,{disabled:!0,className:"justify-between",children:["Endpoints",h.jsx(XD,{})]}),h.jsxs(oo,{disabled:!0,className:"justify-between",children:["Executions",h.jsx(XD,{})]}),h.jsx(oo,{as:Nn,href:t.getSettingsPath(["flows"]),children:"Settings"})]})})})]}),h.jsx(ry,{children:e})]})}function dRe(){return hr(["Flows"]),h.jsx(Hn,{Icon:Wve,title:"Flows",description:"Flows are coming very soon!"})}function qn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=qn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var fRe={value:()=>{}};function y1(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Qb(n)}function Qb(e){this._=e}function hRe(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Qb.prototype=y1.prototype={constructor:Qb,on:function(e,t){var n=this._,r=hRe(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=pRe(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=QD(n[o],e.name,t);else if(t==null)for(o in n)n[o]=QD(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Qb(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function pRe(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function QD(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=fRe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var XC="http://www.w3.org/1999/xhtml";const ZD={svg:"http://www.w3.org/2000/svg",xhtml:XC,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function b1(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ZD.hasOwnProperty(t)?{space:ZD[t],local:e}:e}function mRe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===XC&&t.documentElement.namespaceURI===XC?t.createElement(e):t.createElementNS(n,e)}}function gRe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function eW(e){var t=b1(e);return(t.local?gRe:mRe)(t)}function yRe(){}function QT(e){return e==null?yRe:function(){return this.querySelector(e)}}function bRe(e){typeof e!="function"&&(e=QT(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,u,f=0;f<s;++f)(c=i[f])&&(u=e.call(c,c.__data__,f,i))&&("__data__"in c&&(u.__data__=c.__data__),a[f]=u);return new Fo(r,this._parents)}function vRe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xRe(){return[]}function tW(e){return e==null?xRe:function(){return this.querySelectorAll(e)}}function wRe(e){return function(){return vRe(e.apply(this,arguments))}}function SRe(e){typeof e=="function"?e=wRe(e):e=tW(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&(r.push(e.call(c,c.__data__,u,s)),o.push(c));return new Fo(r,o)}function nW(e){return function(){return this.matches(e)}}function rW(e){return function(t){return t.matches(e)}}var ERe=Array.prototype.find;function NRe(e){return function(){return ERe.call(this.children,e)}}function _Re(){return this.firstElementChild}function CRe(e){return this.select(e==null?_Re:NRe(typeof e=="function"?e:rW(e)))}var ORe=Array.prototype.filter;function jRe(){return Array.from(this.children)}function ARe(e){return function(){return ORe.call(this.children,e)}}function TRe(e){return this.selectAll(e==null?jRe:ARe(typeof e=="function"?e:rW(e)))}function $Re(e){typeof e!="function"&&(e=nW(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new Fo(r,this._parents)}function oW(e){return new Array(e.length)}function RRe(){return new Fo(this._enter||this._groups.map(oW),this._parents)}function hx(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}hx.prototype={constructor:hx,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function kRe(e){return function(){return e}}function MRe(e,t,n,r,o,i){for(var s=0,a,c=t.length,u=i.length;s<u;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new hx(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function PRe(e,t,n,r,o,i,s){var a,c,u=new Map,f=t.length,p=i.length,g=new Array(f),y;for(a=0;a<f;++a)(c=t[a])&&(g[a]=y=s.call(c,c.__data__,a,t)+"",u.has(y)?o[a]=c:u.set(y,c));for(a=0;a<p;++a)y=s.call(e,i[a],a,i)+"",(c=u.get(y))?(r[a]=c,c.__data__=i[a],u.delete(y)):n[a]=new hx(e,i[a]);for(a=0;a<f;++a)(c=t[a])&&u.get(g[a])===c&&(o[a]=c)}function DRe(e){return e.__data__}function IRe(e,t){if(!arguments.length)return Array.from(this,DRe);var n=t?PRe:MRe,r=this._parents,o=this._groups;typeof e!="function"&&(e=kRe(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var f=r[u],p=o[u],g=p.length,y=LRe(e.call(f,f&&f.__data__,u,r)),v=y.length,x=a[u]=new Array(v),S=s[u]=new Array(v),E=c[u]=new Array(g);n(f,p,x,S,E,y,t);for(var C=0,_=0,j,A;C<v;++C)if(j=x[C]){for(C>=_&&(_=C+1);!(A=S[_])&&++_<v;);j._next=A||null}}return s=new Fo(s,r),s._enter=a,s._exit=c,s}function LRe(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function FRe(){return new Fo(this._exit||this._groups.map(oW),this._parents)}function zRe(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function BRe(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var u=n[c],f=r[c],p=u.length,g=a[c]=new Array(p),y,v=0;v<p;++v)(y=u[v]||f[v])&&(g[v]=y);for(;c<o;++c)a[c]=n[c];return new Fo(a,this._parents)}function VRe(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function URe(e){e||(e=HRe);function t(p,g){return p&&g?e(p.__data__,g.__data__):!p-!g}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),u,f=0;f<a;++f)(u=s[f])&&(c[f]=u);c.sort(t)}return new Fo(o,this._parents).order()}function HRe(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function qRe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function WRe(){return Array.from(this)}function GRe(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function JRe(){let e=0;for(const t of this)++e;return e}function YRe(){return!this.node()}function KRe(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function XRe(e){return function(){this.removeAttribute(e)}}function QRe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ZRe(e,t){return function(){this.setAttribute(e,t)}}function eke(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function tke(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function nke(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function rke(e,t){var n=b1(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?QRe:XRe:typeof t=="function"?n.local?nke:tke:n.local?eke:ZRe)(n,t))}function iW(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function oke(e){return function(){this.style.removeProperty(e)}}function ike(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ske(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function ake(e,t,n){return arguments.length>1?this.each((t==null?oke:typeof t=="function"?ske:ike)(e,t,n??"")):Yf(this.node(),e)}function Yf(e,t){return e.style.getPropertyValue(t)||iW(e).getComputedStyle(e,null).getPropertyValue(t)}function lke(e){return function(){delete this[e]}}function cke(e,t){return function(){this[e]=t}}function uke(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function dke(e,t){return arguments.length>1?this.each((t==null?lke:typeof t=="function"?uke:cke)(e,t)):this.node()[e]}function sW(e){return e.trim().split(/^|\s+/)}function ZT(e){return e.classList||new aW(e)}function aW(e){this._node=e,this._names=sW(e.getAttribute("class")||"")}aW.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function lW(e,t){for(var n=ZT(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function cW(e,t){for(var n=ZT(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function fke(e){return function(){lW(this,e)}}function hke(e){return function(){cW(this,e)}}function pke(e,t){return function(){(t.apply(this,arguments)?lW:cW)(this,e)}}function mke(e,t){var n=sW(e+"");if(arguments.length<2){for(var r=ZT(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?pke:t?fke:hke)(n,t))}function gke(){this.textContent=""}function yke(e){return function(){this.textContent=e}}function bke(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function vke(e){return arguments.length?this.each(e==null?gke:(typeof e=="function"?bke:yke)(e)):this.node().textContent}function xke(){this.innerHTML=""}function wke(e){return function(){this.innerHTML=e}}function Ske(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Eke(e){return arguments.length?this.each(e==null?xke:(typeof e=="function"?Ske:wke)(e)):this.node().innerHTML}function Nke(){this.nextSibling&&this.parentNode.appendChild(this)}function _ke(){return this.each(Nke)}function Cke(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Oke(){return this.each(Cke)}function jke(e){var t=typeof e=="function"?e:eW(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ake(){return null}function Tke(e,t){var n=typeof e=="function"?e:eW(e),r=t==null?Ake:typeof t=="function"?t:QT(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function $ke(){var e=this.parentNode;e&&e.removeChild(this)}function Rke(){return this.each($ke)}function kke(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Mke(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Pke(e){return this.select(e?Mke:kke)}function Dke(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ike(e){return function(t){e.call(this,t,this.__data__)}}function Lke(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Fke(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function zke(e,t,n){return function(){var r=this.__on,o,i=Ike(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Bke(e,t,n){var r=Lke(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,f;c<u;++c)for(o=0,f=a[c];o<i;++o)if((s=r[o]).type===f.type&&s.name===f.name)return f.value}return}for(a=t?zke:Fke,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function uW(e,t,n){var r=iW(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Vke(e,t){return function(){return uW(this,e,t)}}function Uke(e,t){return function(){return uW(this,e,t.apply(this,arguments))}}function Hke(e,t){return this.each((typeof t=="function"?Uke:Vke)(e,t))}function*qke(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var dW=[null];function Fo(e,t){this._groups=e,this._parents=t}function py(){return new Fo([[document.documentElement]],dW)}function Wke(){return this}Fo.prototype=py.prototype={constructor:Fo,select:bRe,selectAll:SRe,selectChild:CRe,selectChildren:TRe,filter:$Re,data:IRe,enter:RRe,exit:FRe,join:zRe,merge:BRe,selection:Wke,order:VRe,sort:URe,call:qRe,nodes:WRe,node:GRe,size:JRe,empty:YRe,each:KRe,attr:rke,style:ake,property:dke,classed:mke,text:vke,html:Eke,raise:_ke,lower:Oke,append:jke,insert:Tke,remove:Rke,clone:Pke,datum:Dke,on:Bke,dispatch:Hke,[Symbol.iterator]:qke};function Ro(e){return typeof e=="string"?new Fo([[document.querySelector(e)]],[document.documentElement]):new Fo([[e]],dW)}function Gke(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ki(e,t){if(e=Gke(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Jke={passive:!1},mg={capture:!0,passive:!1};function FN(e){e.stopImmediatePropagation()}function Nf(e){e.preventDefault(),e.stopImmediatePropagation()}function fW(e){var t=e.document.documentElement,n=Ro(e).on("dragstart.drag",Nf,mg);"onselectstart"in t?n.on("selectstart.drag",Nf,mg):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function hW(e,t){var n=e.document.documentElement,r=Ro(e).on("dragstart.drag",null);t&&(r.on("click.drag",Nf,mg),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const wb=e=>()=>e;function QC(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}QC.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Yke(e){return!e.ctrlKey&&!e.button}function Kke(){return this.parentNode}function Xke(e,t){return t??{x:e.x,y:e.y}}function Qke(){return navigator.maxTouchPoints||"ontouchstart"in this}function pW(){var e=Yke,t=Kke,n=Xke,r=Qke,o={},i=y1("start","drag","end"),s=0,a,c,u,f,p=0;function g(j){j.on("mousedown.drag",y).filter(r).on("touchstart.drag",S).on("touchmove.drag",E,Jke).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(j,A){if(!(f||!e.call(this,j,A))){var T=_(this,t.call(this,j,A),j,A,"mouse");T&&(Ro(j.view).on("mousemove.drag",v,mg).on("mouseup.drag",x,mg),fW(j.view),FN(j),u=!1,a=j.clientX,c=j.clientY,T("start",j))}}function v(j){if(Nf(j),!u){var A=j.clientX-a,T=j.clientY-c;u=A*A+T*T>p}o.mouse("drag",j)}function x(j){Ro(j.view).on("mousemove.drag mouseup.drag",null),hW(j.view,u),Nf(j),o.mouse("end",j)}function S(j,A){if(e.call(this,j,A)){var T=j.changedTouches,k=t.call(this,j,A),R=T.length,V,H;for(V=0;V<R;++V)(H=_(this,k,j,A,T[V].identifier,T[V]))&&(FN(j),H("start",j,T[V]))}}function E(j){var A=j.changedTouches,T=A.length,k,R;for(k=0;k<T;++k)(R=o[A[k].identifier])&&(Nf(j),R("drag",j,A[k]))}function C(j){var A=j.changedTouches,T=A.length,k,R;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),k=0;k<T;++k)(R=o[A[k].identifier])&&(FN(j),R("end",j,A[k]))}function _(j,A,T,k,R,V){var H=i.copy(),F=ki(V||T,A),B,U,M;if((M=n.call(j,new QC("beforestart",{sourceEvent:T,target:g,identifier:R,active:s,x:F[0],y:F[1],dx:0,dy:0,dispatch:H}),k))!=null)return B=M.x-F[0]||0,U=M.y-F[1]||0,function z($,L,P){var q=F,Y;switch($){case"start":o[R]=z,Y=s++;break;case"end":delete o[R],--s;case"drag":F=ki(P||L,A),Y=s;break}H.call($,j,new QC($,{sourceEvent:L,subject:M,target:g,identifier:R,active:Y,x:F[0]+B,y:F[1]+U,dx:F[0]-q[0],dy:F[1]-q[1],dispatch:H}),k)}}return g.filter=function(j){return arguments.length?(e=typeof j=="function"?j:wb(!!j),g):e},g.container=function(j){return arguments.length?(t=typeof j=="function"?j:wb(j),g):t},g.subject=function(j){return arguments.length?(n=typeof j=="function"?j:wb(j),g):n},g.touchable=function(j){return arguments.length?(r=typeof j=="function"?j:wb(!!j),g):r},g.on=function(){var j=i.on.apply(i,arguments);return j===i?g:j},g.clickDistance=function(j){return arguments.length?(p=(j=+j)*j,g):Math.sqrt(p)},g}function e$(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mW(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function my(){}var gg=.7,px=1/gg,_f="\\s*([+-]?\\d+)\\s*",yg="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Zke=/^#([0-9a-f]{3,8})$/,eMe=new RegExp(`^rgb\\(${_f},${_f},${_f}\\)$`),tMe=new RegExp(`^rgb\\(${Cs},${Cs},${Cs}\\)$`),nMe=new RegExp(`^rgba\\(${_f},${_f},${_f},${yg}\\)$`),rMe=new RegExp(`^rgba\\(${Cs},${Cs},${Cs},${yg}\\)$`),oMe=new RegExp(`^hsl\\(${yg},${Cs},${Cs}\\)$`),iMe=new RegExp(`^hsla\\(${yg},${Cs},${Cs},${yg}\\)$`),eI={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};e$(my,Mu,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:tI,formatHex:tI,formatHex8:sMe,formatHsl:aMe,formatRgb:nI,toString:nI});function tI(){return this.rgb().formatHex()}function sMe(){return this.rgb().formatHex8()}function aMe(){return gW(this).formatHsl()}function nI(){return this.rgb().formatRgb()}function Mu(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Zke.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?rI(t):n===3?new ao(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Sb(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Sb(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=eMe.exec(e))?new ao(t[1],t[2],t[3],1):(t=tMe.exec(e))?new ao(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nMe.exec(e))?Sb(t[1],t[2],t[3],t[4]):(t=rMe.exec(e))?Sb(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=oMe.exec(e))?sI(t[1],t[2]/100,t[3]/100,1):(t=iMe.exec(e))?sI(t[1],t[2]/100,t[3]/100,t[4]):eI.hasOwnProperty(e)?rI(eI[e]):e==="transparent"?new ao(NaN,NaN,NaN,0):null}function rI(e){return new ao(e>>16&255,e>>8&255,e&255,1)}function Sb(e,t,n,r){return r<=0&&(e=t=n=NaN),new ao(e,t,n,r)}function lMe(e){return e instanceof my||(e=Mu(e)),e?(e=e.rgb(),new ao(e.r,e.g,e.b,e.opacity)):new ao}function ZC(e,t,n,r){return arguments.length===1?lMe(e):new ao(e,t,n,r??1)}function ao(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}e$(ao,ZC,mW(my,{brighter(e){return e=e==null?px:Math.pow(px,e),new ao(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gg:Math.pow(gg,e),new ao(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ao(wu(this.r),wu(this.g),wu(this.b),mx(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:oI,formatHex:oI,formatHex8:cMe,formatRgb:iI,toString:iI}));function oI(){return`#${yu(this.r)}${yu(this.g)}${yu(this.b)}`}function cMe(){return`#${yu(this.r)}${yu(this.g)}${yu(this.b)}${yu((isNaN(this.opacity)?1:this.opacity)*255)}`}function iI(){const e=mx(this.opacity);return`${e===1?"rgb(":"rgba("}${wu(this.r)}, ${wu(this.g)}, ${wu(this.b)}${e===1?")":`, ${e})`}`}function mx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function yu(e){return e=wu(e),(e<16?"0":"")+e.toString(16)}function sI(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Fi(e,t,n,r)}function gW(e){if(e instanceof Fi)return new Fi(e.h,e.s,e.l,e.opacity);if(e instanceof my||(e=Mu(e)),!e)return new Fi;if(e instanceof Fi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new Fi(s,a,c,e.opacity)}function uMe(e,t,n,r){return arguments.length===1?gW(e):new Fi(e,t,n,r??1)}function Fi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}e$(Fi,uMe,mW(my,{brighter(e){return e=e==null?px:Math.pow(px,e),new Fi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gg:Math.pow(gg,e),new Fi(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,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ao(zN(e>=240?e-240:e+120,o,r),zN(e,o,r),zN(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Fi(aI(this.h),Eb(this.s),Eb(this.l),mx(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=mx(this.opacity);return`${e===1?"hsl(":"hsla("}${aI(this.h)}, ${Eb(this.s)*100}%, ${Eb(this.l)*100}%${e===1?")":`, ${e})`}`}}));function aI(e){return e=(e||0)%360,e<0?e+360:e}function Eb(e){return Math.max(0,Math.min(1,e||0))}function zN(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 t$=e=>()=>e;function dMe(e,t){return function(n){return e+n*t}}function fMe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function hMe(e){return(e=+e)==1?yW:function(t,n){return n-t?fMe(t,n,e):t$(isNaN(t)?n:t)}}function yW(e,t){var n=t-e;return n?dMe(e,n):t$(isNaN(e)?t:e)}const gx=function e(t){var n=hMe(t);function r(o,i){var s=n((o=ZC(o)).r,(i=ZC(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),u=yW(o.opacity,i.opacity);return function(f){return o.r=s(f),o.g=a(f),o.b=c(f),o.opacity=u(f),o+""}}return r.gamma=e,r}(1);function pMe(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function mMe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gMe(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=_m(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function yMe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function vs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function bMe(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=_m(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var eO=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,BN=new RegExp(eO.source,"g");function vMe(e){return function(){return e}}function xMe(e){return function(t){return e(t)+""}}function bW(e,t){var n=eO.lastIndex=BN.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=eO.exec(e))&&(o=BN.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:vs(r,o)})),n=BN.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?xMe(c[0].x):vMe(t):(t=c.length,function(u){for(var f=0,p;f<t;++f)a[(p=c[f]).i]=p.x(u);return a.join("")})}function _m(e,t){var n=typeof t,r;return t==null||n==="boolean"?t$(t):(n==="number"?vs:n==="string"?(r=Mu(t))?(t=r,gx):bW:t instanceof Mu?gx:t instanceof Date?yMe:mMe(t)?pMe:Array.isArray(t)?gMe:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?bMe:vs)(e,t)}var lI=180/Math.PI,tO={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vW(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*lI,skewX:Math.atan(c)*lI,scaleX:s,scaleY:a}}var Nb;function wMe(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?tO:vW(t.a,t.b,t.c,t.d,t.e,t.f)}function SMe(e){return e==null||(Nb||(Nb=document.createElementNS("http://www.w3.org/2000/svg","g")),Nb.setAttribute("transform",e),!(e=Nb.transform.baseVal.consolidate()))?tO:(e=e.matrix,vW(e.a,e.b,e.c,e.d,e.e,e.f))}function xW(e,t,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,f,p,g,y,v){if(u!==p||f!==g){var x=y.push("translate(",null,t,null,n);v.push({i:x-4,x:vs(u,p)},{i:x-2,x:vs(f,g)})}else(p||g)&&y.push("translate("+p+t+g+n)}function s(u,f,p,g){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),g.push({i:p.push(o(p)+"rotate(",null,r)-2,x:vs(u,f)})):f&&p.push(o(p)+"rotate("+f+r)}function a(u,f,p,g){u!==f?g.push({i:p.push(o(p)+"skewX(",null,r)-2,x:vs(u,f)}):f&&p.push(o(p)+"skewX("+f+r)}function c(u,f,p,g,y,v){if(u!==p||f!==g){var x=y.push(o(y)+"scale(",null,",",null,")");v.push({i:x-4,x:vs(u,p)},{i:x-2,x:vs(f,g)})}else(p!==1||g!==1)&&y.push(o(y)+"scale("+p+","+g+")")}return function(u,f){var p=[],g=[];return u=e(u),f=e(f),i(u.translateX,u.translateY,f.translateX,f.translateY,p,g),s(u.rotate,f.rotate,p,g),a(u.skewX,f.skewX,p,g),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,p,g),u=f=null,function(y){for(var v=-1,x=g.length,S;++v<x;)p[(S=g[v]).i]=S.x(y);return p.join("")}}}var EMe=xW(wMe,"px, ","px)","deg)"),NMe=xW(SMe,", ",")",")"),_Me=1e-12;function cI(e){return((e=Math.exp(e))+1/e)/2}function CMe(e){return((e=Math.exp(e))-1/e)/2}function OMe(e){return((e=Math.exp(2*e))-1)/(e+1)}const Zb=function e(t,n,r){function o(i,s){var a=i[0],c=i[1],u=i[2],f=s[0],p=s[1],g=s[2],y=f-a,v=p-c,x=y*y+v*v,S,E;if(x<_Me)E=Math.log(g/u)/t,S=function(k){return[a+k*y,c+k*v,u*Math.exp(t*k*E)]};else{var C=Math.sqrt(x),_=(g*g-u*u+r*x)/(2*u*n*C),j=(g*g-u*u-r*x)/(2*g*n*C),A=Math.log(Math.sqrt(_*_+1)-_),T=Math.log(Math.sqrt(j*j+1)-j);E=(T-A)/t,S=function(k){var R=k*E,V=cI(A),H=u/(n*C)*(V*OMe(t*R+A)-CMe(A));return[a+H*y,c+H*v,u*V/cI(t*R+A)]}}return S.duration=E*1e3*t/Math.SQRT2,S}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o}(Math.SQRT2,2,4);var Kf=0,im=0,Kp=0,wW=1e3,yx,sm,bx=0,Pu=0,v1=0,bg=typeof performance=="object"&&performance.now?performance:Date,SW=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function n$(){return Pu||(SW(jMe),Pu=bg.now()+v1)}function jMe(){Pu=0}function vx(){this._call=this._time=this._next=null}vx.prototype=EW.prototype={constructor:vx,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?n$():+n)+(t==null?0:+t),!this._next&&sm!==this&&(sm?sm._next=this:yx=this,sm=this),this._call=e,this._time=n,nO()},stop:function(){this._call&&(this._call=null,this._time=1/0,nO())}};function EW(e,t,n){var r=new vx;return r.restart(e,t,n),r}function AMe(){n$(),++Kf;for(var e=yx,t;e;)(t=Pu-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Kf}function uI(){Pu=(bx=bg.now())+v1,Kf=im=0;try{AMe()}finally{Kf=0,$Me(),Pu=0}}function TMe(){var e=bg.now(),t=e-bx;t>wW&&(v1-=t,bx=e)}function $Me(){for(var e,t=yx,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:yx=n);sm=e,nO(r)}function nO(e){if(!Kf){im&&(im=clearTimeout(im));var t=e-Pu;t>24?(e<1/0&&(im=setTimeout(uI,e-bg.now()-v1)),Kp&&(Kp=clearInterval(Kp))):(Kp||(bx=bg.now(),Kp=setInterval(TMe,wW)),Kf=1,SW(uI))}}function dI(e,t,n){var r=new vx;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var RMe=y1("start","end","cancel","interrupt"),kMe=[],NW=0,fI=1,rO=2,ev=3,hI=4,oO=5,tv=6;function x1(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;MMe(e,n,{name:t,index:r,group:o,on:RMe,tween:kMe,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:NW})}function r$(e,t){var n=as(e,t);if(n.state>NW)throw new Error("too late; already scheduled");return n}function Ds(e,t){var n=as(e,t);if(n.state>ev)throw new Error("too late; already running");return n}function as(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function MMe(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=EW(i,0,n.time);function i(u){n.state=fI,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var f,p,g,y;if(n.state!==fI)return c();for(f in r)if(y=r[f],y.name===n.name){if(y.state===ev)return dI(s);y.state===hI?(y.state=tv,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[f]):+f<t&&(y.state=tv,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[f])}if(dI(function(){n.state===ev&&(n.state=hI,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=rO,n.on.call("start",e,e.__data__,n.index,n.group),n.state===rO){for(n.state=ev,o=new Array(g=n.tween.length),f=0,p=-1;f<g;++f)(y=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(o[++p]=y);o.length=p+1}}function a(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=oO,1),p=-1,g=o.length;++p<g;)o[p].call(e,f);n.state===oO&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=tv,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function nv(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>rO&&r.state<oO,r.state=tv,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function PMe(e){return this.each(function(){nv(this,e)})}function DMe(e,t){var n,r;return function(){var o=Ds(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function IMe(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Ds(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,u=o.length;c<u;++c)if(o[c].name===t){o[c]=a;break}c===u&&o.push(a)}i.tween=o}}function LMe(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=as(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?DMe:IMe)(n,e,t))}function o$(e,t,n){var r=e._id;return e.each(function(){var o=Ds(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return as(o,r).value[t]}}function _W(e,t){var n;return(typeof t=="number"?vs:t instanceof Mu?gx:(n=Mu(t))?(t=n,gx):bW)(e,t)}function FMe(e){return function(){this.removeAttribute(e)}}function zMe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function BMe(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function VMe(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function UMe(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function HMe(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function qMe(e,t){var n=b1(e),r=n==="transform"?NMe:_W;return this.attrTween(e,typeof t=="function"?(n.local?HMe:UMe)(n,r,o$(this,"attr."+e,t)):t==null?(n.local?zMe:FMe)(n):(n.local?VMe:BMe)(n,r,t))}function WMe(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function GMe(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function JMe(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&GMe(e,i)),n}return o._value=t,o}function YMe(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&WMe(e,i)),n}return o._value=t,o}function KMe(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=b1(e);return this.tween(n,(r.local?JMe:YMe)(r,t))}function XMe(e,t){return function(){r$(this,e).delay=+t.apply(this,arguments)}}function QMe(e,t){return t=+t,function(){r$(this,e).delay=t}}function ZMe(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?XMe:QMe)(t,e)):as(this.node(),t).delay}function e6e(e,t){return function(){Ds(this,e).duration=+t.apply(this,arguments)}}function t6e(e,t){return t=+t,function(){Ds(this,e).duration=t}}function n6e(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?e6e:t6e)(t,e)):as(this.node(),t).duration}function r6e(e,t){if(typeof t!="function")throw new Error;return function(){Ds(this,e).ease=t}}function o6e(e){var t=this._id;return arguments.length?this.each(r6e(t,e)):as(this.node(),t).ease}function i6e(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ds(this,e).ease=n}}function s6e(e){if(typeof e!="function")throw new Error;return this.each(i6e(this._id,e))}function a6e(e){typeof e!="function"&&(e=nW(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new Ma(r,this._parents,this._name,this._id)}function l6e(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],u=n[a],f=c.length,p=s[a]=new Array(f),g,y=0;y<f;++y)(g=c[y]||u[y])&&(p[y]=g);for(;a<r;++a)s[a]=t[a];return new Ma(s,this._parents,this._name,this._id)}function c6e(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function u6e(e,t,n){var r,o,i=c6e(t)?r$:Ds;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function d6e(e,t){var n=this._id;return arguments.length<2?as(this.node(),n).on.on(e):this.each(u6e(n,e,t))}function f6e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function h6e(){return this.on("end.remove",f6e(this._id))}function p6e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=QT(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,u=i[s]=new Array(c),f,p,g=0;g<c;++g)(f=a[g])&&(p=e.call(f,f.__data__,g,a))&&("__data__"in f&&(p.__data__=f.__data__),u[g]=p,x1(u[g],t,n,g,u,as(f,n)));return new Ma(i,this._parents,t,n)}function m6e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tW(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],u=c.length,f,p=0;p<u;++p)if(f=c[p]){for(var g=e.call(f,f.__data__,p,c),y,v=as(f,n),x=0,S=g.length;x<S;++x)(y=g[x])&&x1(y,t,n,x,g,v);i.push(g),s.push(f)}return new Ma(i,s,t,n)}var g6e=py.prototype.constructor;function y6e(){return new g6e(this._groups,this._parents)}function b6e(e,t){var n,r,o;return function(){var i=Yf(this,e),s=(this.style.removeProperty(e),Yf(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function CW(e){return function(){this.style.removeProperty(e)}}function v6e(e,t,n){var r,o=n+"",i;return function(){var s=Yf(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function x6e(e,t,n){var r,o,i;return function(){var s=Yf(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Yf(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function w6e(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=Ds(this,e),u=c.on,f=c.value[i]==null?a||(a=CW(t)):void 0;(u!==n||o!==f)&&(r=(n=u).copy()).on(s,o=f),c.on=r}}function S6e(e,t,n){var r=(e+="")=="transform"?EMe:_W;return t==null?this.styleTween(e,b6e(e,r)).on("end.style."+e,CW(e)):typeof t=="function"?this.styleTween(e,x6e(e,r,o$(this,"style."+e,t))).each(w6e(this._id,e)):this.styleTween(e,v6e(e,r,t),n).on("end.style."+e,null)}function E6e(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function N6e(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&E6e(e,s,n)),r}return i._value=t,i}function _6e(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,N6e(e,t,n??""))}function C6e(e){return function(){this.textContent=e}}function O6e(e){return function(){var t=e(this);this.textContent=t??""}}function j6e(e){return this.tween("text",typeof e=="function"?O6e(o$(this,"text",e)):C6e(e==null?"":e+""))}function A6e(e){return function(t){this.textContent=e.call(this,t)}}function T6e(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&A6e(o)),t}return r._value=e,r}function $6e(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,T6e(e))}function R6e(){for(var e=this._name,t=this._id,n=OW(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)if(c=s[u]){var f=as(c,t);x1(c,e,n,u,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ma(r,this._parents,e,n)}function k6e(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var u=Ds(this,r),f=u.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),u.on=t}),o===0&&i()})}var M6e=0;function Ma(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function OW(){return++M6e}var ia=py.prototype;Ma.prototype={constructor:Ma,select:p6e,selectAll:m6e,selectChild:ia.selectChild,selectChildren:ia.selectChildren,filter:a6e,merge:l6e,selection:y6e,transition:R6e,call:ia.call,nodes:ia.nodes,node:ia.node,size:ia.size,empty:ia.empty,each:ia.each,on:d6e,attr:qMe,attrTween:KMe,style:S6e,styleTween:_6e,text:j6e,textTween:$6e,remove:h6e,tween:LMe,delay:ZMe,duration:n6e,ease:o6e,easeVarying:s6e,end:k6e,[Symbol.iterator]:ia[Symbol.iterator]};function P6e(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var D6e={time:null,delay:0,duration:250,ease:P6e};function I6e(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function L6e(e){var t,n;e instanceof Ma?(t=e._id,e=e._name):(t=OW(),(n=D6e).time=n$(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&x1(c,e,t,u,s,n||I6e(c,t));return new Ma(r,this._parents,e,t)}py.prototype.interrupt=PMe;py.prototype.transition=L6e;const _b=e=>()=>e;function F6e(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function ga(e,t,n){this.k=e,this.x=t,this.y=n}ga.prototype={constructor:ga,scale:function(e){return e===1?this:new ga(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ga(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var w1=new ga(1,0,0);jW.prototype=ga.prototype;function jW(e){for(;!e.__zoom;)if(!(e=e.parentNode))return w1;return e.__zoom}function VN(e){e.stopImmediatePropagation()}function Xp(e){e.preventDefault(),e.stopImmediatePropagation()}function z6e(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function B6e(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function pI(){return this.__zoom||w1}function V6e(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function U6e(){return navigator.maxTouchPoints||"ontouchstart"in this}function H6e(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function AW(){var e=z6e,t=B6e,n=H6e,r=V6e,o=U6e,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Zb,u=y1("start","zoom","end"),f,p,g,y=500,v=150,x=0,S=10;function E(M){M.property("__zoom",pI).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",V).on("dblclick.zoom",H).filter(o).on("touchstart.zoom",F).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(M,z,$,L){var P=M.selection?M.selection():M;P.property("__zoom",pI),M!==P?A(M,z,$,L):P.interrupt().each(function(){T(this,arguments).event(L).start().zoom(null,typeof z=="function"?z.apply(this,arguments):z).end()})},E.scaleBy=function(M,z,$,L){E.scaleTo(M,function(){var P=this.__zoom.k,q=typeof z=="function"?z.apply(this,arguments):z;return P*q},$,L)},E.scaleTo=function(M,z,$,L){E.transform(M,function(){var P=t.apply(this,arguments),q=this.__zoom,Y=$==null?j(P):typeof $=="function"?$.apply(this,arguments):$,D=q.invert(Y),W=typeof z=="function"?z.apply(this,arguments):z;return n(_(C(q,W),Y,D),P,s)},$,L)},E.translateBy=function(M,z,$,L){E.transform(M,function(){return n(this.__zoom.translate(typeof z=="function"?z.apply(this,arguments):z,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),s)},null,L)},E.translateTo=function(M,z,$,L,P){E.transform(M,function(){var q=t.apply(this,arguments),Y=this.__zoom,D=L==null?j(q):typeof L=="function"?L.apply(this,arguments):L;return n(w1.translate(D[0],D[1]).scale(Y.k).translate(typeof z=="function"?-z.apply(this,arguments):-z,typeof $=="function"?-$.apply(this,arguments):-$),q,s)},L,P)};function C(M,z){return z=Math.max(i[0],Math.min(i[1],z)),z===M.k?M:new ga(z,M.x,M.y)}function _(M,z,$){var L=z[0]-$[0]*M.k,P=z[1]-$[1]*M.k;return L===M.x&&P===M.y?M:new ga(M.k,L,P)}function j(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function A(M,z,$,L){M.on("start.zoom",function(){T(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(L).end()}).tween("zoom",function(){var P=this,q=arguments,Y=T(P,q).event(L),D=t.apply(P,q),W=$==null?j(D):typeof $=="function"?$.apply(P,q):$,K=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),Q=P.__zoom,ie=typeof z=="function"?z.apply(P,q):z,pe=c(Q.invert(W).concat(K/Q.k),ie.invert(W).concat(K/ie.k));return function(ue){if(ue===1)ue=ie;else{var se=pe(ue),me=K/se[2];ue=new ga(me,W[0]-se[0]*me,W[1]-se[1]*me)}Y.zoom(null,ue)}})}function T(M,z,$){return!$&&M.__zooming||new k(M,z)}function k(M,z){this.that=M,this.args=z,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,z),this.taps=0}k.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,z){return this.mouse&&M!=="mouse"&&(this.mouse[1]=z.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=z.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=z.invert(this.touch1[0])),this.that.__zoom=z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var z=Ro(this.that).datum();u.call(M,this.that,new F6e(M,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:u}),z)}};function R(M,...z){if(!e.apply(this,arguments))return;var $=T(this,z).event(M),L=this.__zoom,P=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,r.apply(this,arguments)))),q=ki(M);if($.wheel)($.mouse[0][0]!==q[0]||$.mouse[0][1]!==q[1])&&($.mouse[1]=L.invert($.mouse[0]=q)),clearTimeout($.wheel);else{if(L.k===P)return;$.mouse=[q,L.invert(q)],nv(this),$.start()}Xp(M),$.wheel=setTimeout(Y,v),$.zoom("mouse",n(_(C(L,P),$.mouse[0],$.mouse[1]),$.extent,s));function Y(){$.wheel=null,$.end()}}function V(M,...z){if(g||!e.apply(this,arguments))return;var $=M.currentTarget,L=T(this,z,!0).event(M),P=Ro(M.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",K,!0),q=ki(M,$),Y=M.clientX,D=M.clientY;fW(M.view),VN(M),L.mouse=[q,this.__zoom.invert(q)],nv(this),L.start();function W(Q){if(Xp(Q),!L.moved){var ie=Q.clientX-Y,pe=Q.clientY-D;L.moved=ie*ie+pe*pe>x}L.event(Q).zoom("mouse",n(_(L.that.__zoom,L.mouse[0]=ki(Q,$),L.mouse[1]),L.extent,s))}function K(Q){P.on("mousemove.zoom mouseup.zoom",null),hW(Q.view,L.moved),Xp(Q),L.event(Q).end()}}function H(M,...z){if(e.apply(this,arguments)){var $=this.__zoom,L=ki(M.changedTouches?M.changedTouches[0]:M,this),P=$.invert(L),q=$.k*(M.shiftKey?.5:2),Y=n(_(C($,q),L,P),t.apply(this,z),s);Xp(M),a>0?Ro(this).transition().duration(a).call(A,Y,L,M):Ro(this).call(E.transform,Y,L,M)}}function F(M,...z){if(e.apply(this,arguments)){var $=M.touches,L=$.length,P=T(this,z,M.changedTouches.length===L).event(M),q,Y,D,W;for(VN(M),Y=0;Y<L;++Y)D=$[Y],W=ki(D,this),W=[W,this.__zoom.invert(W),D.identifier],P.touch0?!P.touch1&&P.touch0[2]!==W[2]&&(P.touch1=W,P.taps=0):(P.touch0=W,q=!0,P.taps=1+!!f);f&&(f=clearTimeout(f)),q&&(P.taps<2&&(p=W[0],f=setTimeout(function(){f=null},y)),nv(this),P.start())}}function B(M,...z){if(this.__zooming){var $=T(this,z).event(M),L=M.changedTouches,P=L.length,q,Y,D,W;for(Xp(M),q=0;q<P;++q)Y=L[q],D=ki(Y,this),$.touch0&&$.touch0[2]===Y.identifier?$.touch0[0]=D:$.touch1&&$.touch1[2]===Y.identifier&&($.touch1[0]=D);if(Y=$.that.__zoom,$.touch1){var K=$.touch0[0],Q=$.touch0[1],ie=$.touch1[0],pe=$.touch1[1],ue=(ue=ie[0]-K[0])*ue+(ue=ie[1]-K[1])*ue,se=(se=pe[0]-Q[0])*se+(se=pe[1]-Q[1])*se;Y=C(Y,Math.sqrt(ue/se)),D=[(K[0]+ie[0])/2,(K[1]+ie[1])/2],W=[(Q[0]+pe[0])/2,(Q[1]+pe[1])/2]}else if($.touch0)D=$.touch0[0],W=$.touch0[1];else return;$.zoom("touch",n(_(Y,D,W),$.extent,s))}}function U(M,...z){if(this.__zooming){var $=T(this,z).event(M),L=M.changedTouches,P=L.length,q,Y;for(VN(M),g&&clearTimeout(g),g=setTimeout(function(){g=null},y),q=0;q<P;++q)Y=L[q],$.touch0&&$.touch0[2]===Y.identifier?delete $.touch0:$.touch1&&$.touch1[2]===Y.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(Y=ki(Y,this),Math.hypot(p[0]-Y[0],p[1]-Y[1])<S)){var D=Ro(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return E.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:_b(+M),E):r},E.filter=function(M){return arguments.length?(e=typeof M=="function"?M:_b(!!M),E):e},E.touchable=function(M){return arguments.length?(o=typeof M=="function"?M:_b(!!M),E):o},E.extent=function(M){return arguments.length?(t=typeof M=="function"?M:_b([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),E):t},E.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],E):[i[0],i[1]]},E.translateExtent=function(M){return arguments.length?(s[0][0]=+M[0][0],s[1][0]=+M[1][0],s[0][1]=+M[0][1],s[1][1]=+M[1][1],E):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},E.constrain=function(M){return arguments.length?(n=M,E):n},E.duration=function(M){return arguments.length?(a=+M,E):a},E.interpolate=function(M){return arguments.length?(c=M,E):c},E.on=function(){var M=u.on.apply(u,arguments);return M===u?E:M},E.clickDistance=function(M){return arguments.length?(x=(M=+M)*M,E):Math.sqrt(x)},E.tapDistance=function(M){return arguments.length?(S=+M,E):S},E}const $s={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},vg=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],TW=["Enter"," ","Escape"],$W={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Xf;(function(e){e.Strict="strict",e.Loose="loose"})(Xf||(Xf={}));var Su;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Su||(Su={}));var xg;(function(e){e.Partial="partial",e.Full="full"})(xg||(xg={}));const RW={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Vl;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Vl||(Vl={}));var Du;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Du||(Du={}));var nt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(nt||(nt={}));const mI={[nt.Left]:nt.Right,[nt.Right]:nt.Left,[nt.Top]:nt.Bottom,[nt.Bottom]:nt.Top};function kW(e){return e===null?null:e?"valid":"invalid"}const MW=e=>"id"in e&&"source"in e&&"target"in e,q6e=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),i$=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),gy=(e,t=[0,0])=>{const{width:n,height:r}=Ga(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},W6e=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):i$(o)?o:t.nodeLookup.get(o.id));const a=s?xx(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return S1(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return E1(n)},yy=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=S1(n,xx(o)),r=!0)}),r?E1(n):{x:0,y:0,width:0,height:0}},s$=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...vy(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const u of e.values()){const{measured:f,selectable:p=!0,hidden:g=!1}=u;if(s&&!p||g)continue;const y=f.width??u.width??u.initialWidth??null,v=f.height??u.height??u.initialHeight??null,x=wg(a,Zf(u)),S=(y??0)*(v??0),E=i&&x>0;(!u.internals.handleBounds||E||x>=S||u.dragging)&&c.push(u)}return c},G6e=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function J6e(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&(t?.includeHiddenNodes||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Y6e({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=J6e(e,s),c=yy(a),u=a$(c,t,n,s?.minZoom??o,s?.maxZoom??i,s?.padding??.1);return await r.setViewport(u,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function PW({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??r;let p=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",$s.error005());else{const y=a.measured.width,v=a.measured.height;y&&v&&(p=[[c,u],[c+y,u+v]])}else a&&eh(s.extent)&&(p=[[s.extent[0][0]+c,s.extent[0][1]+u],[s.extent[1][0]+c,s.extent[1][1]+u]]);const g=eh(p)?Iu(t,p,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",$s.error015()),{position:{x:g.x-c+(s.measured.width??0)*f[0],y:g.y-u+(s.measured.height??0)*f[1]},positionAbsolute:g}}async function K6e({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(g=>g.id)),s=[];for(const g of n){if(g.deletable===!1)continue;const y=i.has(g.id),v=!y&&g.parentId&&s.find(x=>x.id===g.parentId);(y||v)&&s.push(g)}const a=new Set(t.map(g=>g.id)),c=r.filter(g=>g.deletable!==!1),f=G6e(s,c);for(const g of c)a.has(g.id)&&!f.find(v=>v.id===g.id)&&f.push(g);if(!o)return{edges:f,nodes:s};const p=await o({nodes:s,edges:f});return typeof p=="boolean"?p?{edges:f,nodes:s}:{edges:[],nodes:[]}:p}const Qf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Iu=(e={x:0,y:0},t,n)=>({x:Qf(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Qf(e.y,t[0][1],t[1][1]-(n?.height??0))});function DW(e,t,n){const{width:r,height:o}=Ga(n),{x:i,y:s}=n.internals.positionAbsolute;return Iu(e,[[i,s],[i+r,s+o]],t)}const gI=(e,t,n)=>e<t?Qf(Math.abs(e-t),1,t)/t:e>n?-Qf(Math.abs(e-n),1,t)/t:0,IW=(e,t,n=15,r=40)=>{const o=gI(e.x,r,t.width-r)*n,i=gI(e.y,r,t.height-r)*n;return[o,i]},S1=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),iO=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),E1=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Zf=(e,t=[0,0])=>{const{x:n,y:r}=i$(e)?e.internals.positionAbsolute:gy(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},xx=(e,t=[0,0])=>{const{x:n,y:r}=i$(e)?e.internals.positionAbsolute:gy(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},LW=(e,t)=>E1(S1(iO(e),iO(t))),wg=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},yI=e=>qi(e.width)&&qi(e.height)&&qi(e.x)&&qi(e.y),qi=e=>!isNaN(e)&&isFinite(e),X6e=(e,t)=>{},by=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),vy=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?by(a,s):a},wx=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Yd(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Q6e(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Yd(e,n),o=Yd(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Yd(e.top??e.y??0,n),o=Yd(e.bottom??e.y??0,n),i=Yd(e.left??e.x??0,t),s=Yd(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Z6e(e,t,n,r,o,i){const{x:s,y:a}=wx(e,[t,n,r]),{x:c,y:u}=wx({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=o-c,p=i-u;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(p)}}const a$=(e,t,n,r,o,i)=>{const s=Q6e(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,u=Math.min(a,c),f=Qf(u,r,o),p=e.x+e.width/2,g=e.y+e.height/2,y=t/2-p*f,v=n/2-g*f,x=Z6e(e,y,v,f,t,n),S={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:y-S.left+S.right,y:v-S.top+S.bottom,zoom:f}},Sg=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function eh(e){return e!=null&&e!=="parent"}function Ga(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function FW(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function zW(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function bI(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ePe(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function tPe(e){return{...$W,...e||{}}}function Cm(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=Wi(e),a=vy({x:i-(o?.left??0),y:s-(o?.top??0)},r),{x:c,y:u}=n?by(a,t):a;return{xSnapped:c,ySnapped:u,...a}}const l$=e=>({width:e.offsetWidth,height:e.offsetHeight}),BW=e=>e?.getRootNode?.()||window?.document,nPe=["INPUT","SELECT","TEXTAREA"];function VW(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:nPe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const UW=e=>"clientX"in e,Wi=(e,t)=>{const n=UW(e),r=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:o-(t?.top??0)}},vI=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...l$(s)}})};function HW({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,u=t*.125+i*.375+a*.375+r*.125,f=Math.abs(c-e),p=Math.abs(u-t);return[c,u,f,p]}function Cb(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function xI({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case nt.Left:return[t-Cb(t-r,i),n];case nt.Right:return[t+Cb(r-t,i),n];case nt.Top:return[t,n-Cb(n-o,i)];case nt.Bottom:return[t,n+Cb(o-n,i)]}}function qW({sourceX:e,sourceY:t,sourcePosition:n=nt.Bottom,targetX:r,targetY:o,targetPosition:i=nt.Top,curvature:s=.25}){const[a,c]=xI({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,f]=xI({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[p,g,y,v]=HW({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${t} C${a},${c} ${u},${f} ${r},${o}`,p,g,y,v]}function WW({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function rPe({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:o=!1}){if(r!==void 0)return r;const i=o&&n?1e3:0,s=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+s}function oPe({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=S1(xx(e),xx(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return wg(s,E1(i))>0}const iPe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,sPe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),GW=(e,t)=>{if(!e.source||!e.target)return t;let n;return MW(e)?n={...e}:n={...e,id:iPe(e)},sPe(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function JW({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=WW({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const wI={[nt.Left]:{x:-1,y:0},[nt.Right]:{x:1,y:0},[nt.Top]:{x:0,y:-1},[nt.Bottom]:{x:0,y:1}},aPe=({source:e,sourcePosition:t=nt.Bottom,target:n})=>t===nt.Left||t===nt.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},SI=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function lPe({source:e,sourcePosition:t=nt.Bottom,target:n,targetPosition:r=nt.Top,center:o,offset:i,stepPosition:s}){const a=wI[t],c=wI[r],u={x:e.x+a.x*i,y:e.y+a.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},p=aPe({source:u,sourcePosition:t,target:f}),g=p.x!==0?"x":"y",y=p[g];let v=[],x,S;const E={x:0,y:0},C={x:0,y:0},[,,_,j]=WW({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[g]*c[g]===-1){g==="x"?(x=o.x??u.x+(f.x-u.x)*s,S=o.y??(u.y+f.y)/2):(x=o.x??(u.x+f.x)/2,S=o.y??u.y+(f.y-u.y)*s);const T=[{x,y:u.y},{x,y:f.y}],k=[{x:u.x,y:S},{x:f.x,y:S}];a[g]===y?v=g==="x"?T:k:v=g==="x"?k:T}else{const T=[{x:u.x,y:f.y}],k=[{x:f.x,y:u.y}];if(g==="x"?v=a.x===y?k:T:v=a.y===y?T:k,t===r){const B=Math.abs(e[g]-n[g]);if(B<=i){const U=Math.min(i-1,i-B);a[g]===y?E[g]=(u[g]>e[g]?-1:1)*U:C[g]=(f[g]>n[g]?-1:1)*U}}if(t!==r){const B=g==="x"?"y":"x",U=a[g]===c[B],M=u[B]>f[B],z=u[B]<f[B];(a[g]===1&&(!U&&M||U&&z)||a[g]!==1&&(!U&&z||U&&M))&&(v=g==="x"?T:k)}const R={x:u.x+E.x,y:u.y+E.y},V={x:f.x+C.x,y:f.y+C.y},H=Math.max(Math.abs(R.x-v[0].x),Math.abs(V.x-v[0].x)),F=Math.max(Math.abs(R.y-v[0].y),Math.abs(V.y-v[0].y));H>=F?(x=(R.x+V.x)/2,S=v[0].y):(x=v[0].x,S=(R.y+V.y)/2)}return[[e,{x:u.x+E.x,y:u.y+E.y},...v,{x:f.x+C.x,y:f.y+C.y},n],x,S,_,j]}function cPe(e,t,n,r){const o=Math.min(SI(e,t)/2,SI(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*f}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function sO({sourceX:e,sourceY:t,sourcePosition:n=nt.Bottom,targetX:r,targetY:o,targetPosition:i=nt.Top,borderRadius:s=5,centerX:a,centerY:c,offset:u=20,stepPosition:f=.5}){const[p,g,y,v,x]=lPe({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:u,stepPosition:f});return[p.reduce((E,C,_)=>{let j="";return _>0&&_<p.length-1?j=cPe(p[_-1],C,p[_+1],s):j=`${_===0?"M":"L"}${C.x} ${C.y}`,E+=j,E},""),g,y,v,x]}function EI(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function uPe(e){const{sourceNode:t,targetNode:n}=e;if(!EI(t)||!EI(n))return null;const r=t.internals.handleBounds||NI(t.handles),o=n.internals.handleBounds||NI(n.handles),i=_I(r?.source??[],e.sourceHandle),s=_I(e.connectionMode===Xf.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",$s.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||nt.Bottom,c=s?.position||nt.Top,u=Eg(t,i,a),f=Eg(n,s,c);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:c}}function NI(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Eg(e,t,n=nt.Left,r=!1){const o=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ga(e);if(r)return{x:o+s/2,y:i+a/2};switch(t?.position??n){case nt.Top:return{x:o+s/2,y:i};case nt.Right:return{x:o+s,y:i+a/2};case nt.Bottom:return{x:o+s/2,y:i+a};case nt.Left:return{x:o,y:i+a/2}}}function _I(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function aO(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function dPe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const u=aO(c,t);i.has(u)||(s.push({id:u,color:c.color||n,...c}),i.add(u))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const YW=1e3,fPe=10,c$={nodeOrigin:[0,0],nodeExtent:vg,elevateNodesOnSelect:!0,defaults:{}},hPe={...c$,checkEquality:!0};function u$(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function pPe(e,t,n){const r=u$(c$,n);for(const o of e.values())if(o.parentId)d$(o,e,t,r);else{const i=gy(o,r.nodeOrigin),s=eh(o.extent)?o.extent:r.nodeExtent,a=Iu(i,s,Ga(o));o.internals.positionAbsolute=a}}function mPe(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function lO(e,t,n,r){const o=u$(hPe,r);let i={i:-1},s=e.length>0;const a=new Map(t),c=o?.elevateNodesOnSelect?YW:0;t.clear(),n.clear();for(const u of e){let f=a.get(u.id);if(o.checkEquality&&u===f?.internals.userNode)t.set(u.id,f);else{const p=gy(u,o.nodeOrigin),g=eh(u.extent)?u.extent:o.nodeExtent,y=Iu(p,g,Ga(u));f={...o.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:y,handleBounds:mPe(u,f),z:KW(u,c),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(s=!1),u.parentId&&d$(f,t,n,r,i)}return s}function gPe(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function d$(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a}=u$(c$,r),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}gPe(e,n),o&&!u.parentId&&u.internals.rootParentIndex===void 0&&(u.internals.rootParentIndex=++o.i,u.internals.z=u.internals.z+o.i*fPe),o&&u.internals.rootParentIndex!==void 0&&(o.i=u.internals.rootParentIndex);const f=i?YW:0,{x:p,y:g,z:y}=yPe(e,u,s,a,f),{positionAbsolute:v}=e.internals,x=p!==v.x||g!==v.y;(x||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:p,y:g}:v,z:y}})}function KW(e,t){return(qi(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function yPe(e,t,n,r,o){const{x:i,y:s}=t.internals.positionAbsolute,a=Ga(e),c=gy(e,n),u=eh(e.extent)?Iu(c,e.extent,a):c;let f=Iu({x:i+u.x,y:s+u.y},r,a);e.extent==="parent"&&(f=DW(f,a,t));const p=KW(e,o),g=t.internals.z??0;return{x:f.x,y:f.y,z:g>=p?g+1:p}}function f$(e,t,n,r=[0,0]){const o=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const c=i.get(s.parentId)?.expandedRect??Zf(a),u=LW(c,s.rect);i.set(s.parentId,{expandedRect:u,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{const u=a.internals.positionAbsolute,f=Ga(a),p=a.origin??r,g=s.x<u.x?Math.round(Math.abs(u.x-s.x)):0,y=s.y<u.y?Math.round(Math.abs(u.y-s.y)):0,v=Math.max(f.width,Math.round(s.width)),x=Math.max(f.height,Math.round(s.height)),S=(v-f.width)*p[0],E=(x-f.height)*p[1];(g>0||y>0||S||E)&&(o.push({id:c,type:"position",position:{x:a.position.x-g+S,y:a.position.y-y+E}}),n.get(c)?.forEach(C=>{e.some(_=>_.id===C.id)||o.push({id:C.id,type:"position",position:{x:C.position.x+g,y:C.position.y+y}})})),(f.width<s.width||f.height<s.height||g||y)&&o.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:v+(g?p[0]*g-S:0),height:x+(y?p[1]*y-E:0)}})}),o}function bPe(e,t,n,r,o,i){const s=r?.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const c=[],u=window.getComputedStyle(s),{m22:f}=new window.DOMMatrixReadOnly(u.transform),p=[];for(const g of e.values()){const y=t.get(g.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),a=!0;continue}const v=l$(g.nodeElement),x=y.measured.width!==v.width||y.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!y.internals.handleBounds||g.force))){const E=g.nodeElement.getBoundingClientRect(),C=eh(y.extent)?y.extent:i;let{positionAbsolute:_}=y.internals;y.parentId&&y.extent==="parent"?_=DW(_,v,t.get(y.parentId)):C&&(_=Iu(_,C,v));const j={...y,measured:v,internals:{...y.internals,positionAbsolute:_,handleBounds:{source:vI("source",g.nodeElement,E,f,y.id),target:vI("target",g.nodeElement,E,f,y.id)}}};t.set(y.id,j),y.parentId&&d$(j,t,n,{nodeOrigin:o}),a=!0,x&&(c.push({id:y.id,type:"dimensions",dimensions:v}),y.expandParent&&y.parentId&&p.push({id:y.id,parentId:y.parentId,rect:Zf(j,o)}))}}if(p.length>0){const g=f$(p,t,n,o);c.push(...g)}return{changes:c,updatedInternals:a}}async function vPe({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function CI(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,t))}}function XW(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},u=`${o}-${s}--${i}-${a}`,f=`${i}-${a}--${o}-${s}`;CI("source",c,f,e,o,s),CI("target",c,u,e,i,a),t.set(r.id,r)}}function QW(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:QW(n,t):!1}function OI(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function xPe(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!QW(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function UN({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const o=[];for(const[s,a]of t){const c=n.get(s)?.internals.userNode;c&&o.push({...c,position:a.position,dragging:r})}if(!e)return[o[0],o];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:r}:o[0],o]}function wPe({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=by(i,t);return{x:s.x-i.x,y:s.y-i.y}}function SPe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,u={x:0,y:0},f=null,p=!1,g=null,y=!1,v=!1,x=null;function S({noDragClassName:C,handleSelector:_,domNode:j,isSelectable:A,nodeId:T,nodeClickDistance:k=0}){g=Ro(j);function R({x:B,y:U}){const{nodeLookup:M,nodeExtent:z,snapGrid:$,snapToGrid:L,nodeOrigin:P,onNodeDrag:q,onSelectionDrag:Y,onError:D,updateNodePositions:W}=t();i={x:B,y:U};let K=!1;const Q=a.size>1,ie=Q&&z?iO(yy(a)):null,pe=Q&&L?wPe({dragItems:a,snapGrid:$,x:B,y:U}):null;for(const[ue,se]of a){if(!M.has(ue))continue;let me={x:B-se.distance.x,y:U-se.distance.y};L&&(me=pe?{x:Math.round(me.x+pe.x),y:Math.round(me.y+pe.y)}:by(me,$));let xe=null;if(Q&&z&&!se.extent&&ie){const{positionAbsolute:Ee}=se.internals,Re=Ee.x-ie.x+z[0][0],Me=Ee.x+se.measured.width-ie.x2+z[1][0],ze=Ee.y-ie.y+z[0][1],ve=Ee.y+se.measured.height-ie.y2+z[1][1];xe=[[Re,ze],[Me,ve]]}const{position:je,positionAbsolute:_e}=PW({nodeId:ue,nextPosition:me,nodeLookup:M,nodeExtent:xe||z,nodeOrigin:P,onError:D});K=K||se.position.x!==je.x||se.position.y!==je.y,se.position=je,se.internals.positionAbsolute=_e}if(v=v||K,!!K&&(W(a,!0),x&&(r||q||!T&&Y))){const[ue,se]=UN({nodeId:T,dragItems:a,nodeLookup:M});r?.(x,a,ue,se),q?.(x,ue,se),T||Y?.(x,se)}}async function V(){if(!f)return;const{transform:B,panBy:U,autoPanSpeed:M,autoPanOnNodeDrag:z}=t();if(!z){c=!1,cancelAnimationFrame(s);return}const[$,L]=IW(u,f,M);($!==0||L!==0)&&(i.x=(i.x??0)-$/B[2],i.y=(i.y??0)-L/B[2],await U({x:$,y:L})&&R(i)),s=requestAnimationFrame(V)}function H(B){const{nodeLookup:U,multiSelectionActive:M,nodesDraggable:z,transform:$,snapGrid:L,snapToGrid:P,selectNodesOnDrag:q,onNodeDragStart:Y,onSelectionDragStart:D,unselectNodesAndEdges:W}=t();p=!0,(!q||!A)&&!M&&T&&(U.get(T)?.selected||W()),A&&q&&T&&e?.(T);const K=Cm(B.sourceEvent,{transform:$,snapGrid:L,snapToGrid:P,containerBounds:f});if(i=K,a=xPe(U,z,K,T),a.size>0&&(n||Y||!T&&D)){const[Q,ie]=UN({nodeId:T,dragItems:a,nodeLookup:U});n?.(B.sourceEvent,a,Q,ie),Y?.(B.sourceEvent,Q,ie),T||D?.(B.sourceEvent,ie)}}const F=pW().clickDistance(k).on("start",B=>{const{domNode:U,nodeDragThreshold:M,transform:z,snapGrid:$,snapToGrid:L}=t();f=U?.getBoundingClientRect()||null,y=!1,v=!1,x=B.sourceEvent,M===0&&H(B),i=Cm(B.sourceEvent,{transform:z,snapGrid:$,snapToGrid:L,containerBounds:f}),u=Wi(B.sourceEvent,f)}).on("drag",B=>{const{autoPanOnNodeDrag:U,transform:M,snapGrid:z,snapToGrid:$,nodeDragThreshold:L,nodeLookup:P}=t(),q=Cm(B.sourceEvent,{transform:M,snapGrid:z,snapToGrid:$,containerBounds:f});if(x=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||T&&!P.has(T))&&(y=!0),!y){if(!c&&U&&p&&(c=!0,V()),!p){const Y=Wi(B.sourceEvent,f),D=Y.x-u.x,W=Y.y-u.y;Math.sqrt(D*D+W*W)>L&&H(B)}(i.x!==q.xSnapped||i.y!==q.ySnapped)&&a&&p&&(u=Wi(B.sourceEvent,f),R(q))}}).on("end",B=>{if(!(!p||y)&&(c=!1,p=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:U,updateNodePositions:M,onNodeDragStop:z,onSelectionDragStop:$}=t();if(v&&(M(a,!1),v=!1),o||z||!T&&$){const[L,P]=UN({nodeId:T,dragItems:a,nodeLookup:U,dragging:!1});o?.(B.sourceEvent,a,L,P),z?.(B.sourceEvent,L,P),T||$?.(B.sourceEvent,P)}}}).filter(B=>{const U=B.target;return!B.button&&(!C||!OI(U,`.${C}`,j))&&(!_||OI(U,_,j))});g.call(F)}function E(){g?.on(".drag",null)}return{update:S,destroy:E}}function EPe(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())wg(o,Zf(i))>0&&r.push(i);return r}const NPe=250;function _Pe(e,t,n,r){let o=[],i=1/0;const s=EPe(e,n,t+NPe);for(const a of s){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const u of c){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:p}=Eg(a,u,u.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(p-e.y,2));g>t||(g<i?(o=[{...u,x:f,y:p}],i=g):g===i&&o.push({...u,x:f,y:p}))}}if(!o.length)return null;if(o.length>1){const a=r.type==="source"?"target":"source";return o.find(c=>c.type===a)??o[0]}return o[0]}function ZW(e,t,n,r,o,i=!1){const s=r.get(e);if(!s)return null;const a=o==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(u=>u.id===n):a?.[0])??null;return c&&i?{...c,...Eg(s,c,c.position,!0)}:c}function eG(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function CPe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const tG=()=>!0;function OPe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:f,flowId:p,panBy:g,cancelConnection:y,onConnectStart:v,onConnect:x,onConnectEnd:S,isValidConnection:E=tG,onReconnectEnd:C,updateConnection:_,getTransform:j,getFromHandle:A,autoPanSpeed:T,dragThreshold:k=1,handleDomNode:R}){const V=BW(e.target);let H=0,F;const{x:B,y:U}=Wi(e),M=eG(i,R),z=a?.getBoundingClientRect();let $=!1;if(!z||!M)return;const L=ZW(o,M,r,c,t);if(!L)return;let P=Wi(e,z),q=!1,Y=null,D=!1,W=null;function K(){if(!f||!z)return;const[je,_e]=IW(P,z,T);g({x:je,y:_e}),H=requestAnimationFrame(K)}const Q={...L,nodeId:o,type:M,position:L.position},ie=c.get(o);let ue={inProgress:!0,isValid:null,from:Eg(ie,Q,nt.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:ie,to:P,toHandle:null,toPosition:mI[Q.position],toNode:null};function se(){$=!0,_(ue),v?.(e,{nodeId:o,handleId:r,handleType:M})}k===0&&se();function me(je){if(!$){const{x:Me,y:ze}=Wi(je),ve=Me-B,Ce=ze-U;if(!(ve*ve+Ce*Ce>k*k))return;se()}if(!A()||!Q){xe(je);return}const _e=j();P=Wi(je,z),F=_Pe(vy(P,_e,!1,[1,1]),n,c,Q),q||(K(),q=!0);const Ee=nG(je,{handle:F,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:E,doc:V,lib:u,flowId:p,nodeLookup:c});W=Ee.handleDomNode,Y=Ee.connection,D=CPe(!!F,Ee.isValid);const Re={...ue,isValid:D,to:Ee.toHandle&&D?wx({x:Ee.toHandle.x,y:Ee.toHandle.y},_e):P,toHandle:Ee.toHandle,toPosition:D&&Ee.toHandle?Ee.toHandle.position:mI[Q.position],toNode:Ee.toHandle?c.get(Ee.toHandle.nodeId):null};D&&F&&ue.toHandle&&Re.toHandle&&ue.toHandle.type===Re.toHandle.type&&ue.toHandle.nodeId===Re.toHandle.nodeId&&ue.toHandle.id===Re.toHandle.id&&ue.to.x===Re.to.x&&ue.to.y===Re.to.y||(_(Re),ue=Re)}function xe(je){if(!("touches"in je&&je.touches.length>0)){if($){(F||W)&&Y&&D&&x?.(Y);const{inProgress:_e,...Ee}=ue,Re={...Ee,toPosition:ue.toHandle?ue.toPosition:null};S?.(je,Re),i&&C?.(je,Re)}y(),cancelAnimationFrame(H),q=!1,D=!1,Y=null,W=null,V.removeEventListener("mousemove",me),V.removeEventListener("mouseup",xe),V.removeEventListener("touchmove",me),V.removeEventListener("touchend",xe)}}V.addEventListener("mousemove",me),V.addEventListener("mouseup",xe),V.addEventListener("touchmove",me),V.addEventListener("touchend",xe)}function nG(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:u=tG,nodeLookup:f}){const p=i==="target",g=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:y,y:v}=Wi(e),x=s.elementFromPoint(y,v),S=x?.classList.contains(`${a}-flow__handle`)?x:g,E={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const C=eG(void 0,S),_=S.getAttribute("data-nodeid"),j=S.getAttribute("data-handleid"),A=S.classList.contains("connectable"),T=S.classList.contains("connectableend");if(!_||!C)return E;const k={source:p?_:r,sourceHandle:p?j:o,target:p?r:_,targetHandle:p?o:j};E.connection=k;const V=A&&T&&(n===Xf.Strict?p&&C==="source"||!p&&C==="target":_!==r||j!==o);E.isValid=V&&u(k),E.toHandle=ZW(_,C,j,f,n,!0)}return E}const cO={onPointerDown:OPe,isValid:nG};function jPe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Ro(e);function i({translateExtent:a,width:c,height:u,zoomStep:f=1,pannable:p=!0,zoomable:g=!0,inversePan:y=!1}){const v=_=>{if(_.sourceEvent.type!=="wheel"||!t)return;const j=n(),A=_.sourceEvent.ctrlKey&&Sg()?10:1,T=-_.sourceEvent.deltaY*(_.sourceEvent.deltaMode===1?.05:_.sourceEvent.deltaMode?1:.002)*f,k=j[2]*Math.pow(2,T*A);t.scaleTo(k)};let x=[0,0];const S=_=>{(_.sourceEvent.type==="mousedown"||_.sourceEvent.type==="touchstart")&&(x=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY])},E=_=>{const j=n();if(_.sourceEvent.type!=="mousemove"&&_.sourceEvent.type!=="touchmove"||!t)return;const A=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY],T=[A[0]-x[0],A[1]-x[1]];x=A;const k=r()*Math.max(j[2],Math.log(j[2]))*(y?-1:1),R={x:j[0]-T[0]*k,y:j[1]-T[1]*k},V=[[0,0],[c,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:j[2]},V,a)},C=AW().on("start",S).on("zoom",p?E:null).on("zoom.wheel",g?v:null);o.call(C,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:ki}}const N1=e=>({x:e.x,y:e.y,zoom:e.k}),HN=({x:e,y:t,zoom:n})=>w1.translate(e,t).scale(n),hf=(e,t)=>e.target.closest(`.${t}`),rG=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),APe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,qN=(e,t=0,n=APe,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},oG=e=>{const t=e.ctrlKey&&Sg()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function TPe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return f=>{if(hf(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const p=n.property("__zoom").k||1;if(f.ctrlKey&&s){const S=ki(f),E=oG(f),C=p*Math.pow(2,E);r.scaleTo(n,C,S,f);return}const g=f.deltaMode===1?20:1;let y=o===Su.Vertical?0:f.deltaX*g,v=o===Su.Horizontal?0:f.deltaY*g;!Sg()&&f.shiftKey&&o!==Su.Vertical&&(y=f.deltaY*g,v=0),r.translateBy(n,-(y/p)*i,-(v/p)*i,{internal:!0});const x=N1(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(f,x),e.panScrollTimeout=setTimeout(()=>{u?.(f,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(f,x))}}function $Pe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=hf(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function RPe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const o=N1(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,o)}}function kPe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{e.usedRightMouseButton=!!(n&&rG(t,e.mouseButton??0)),i.sourceEvent?.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!i.sourceEvent?.internal&&o?.(i.sourceEvent,N1(i.transform))}}function MPe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&rG(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const a=N1(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(s.sourceEvent,a)},n?150:0)}}}function PPe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:f}){return p=>{const g=e||t,y=n&&p.ctrlKey,v=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(hf(p,`${u}-flow__node`)||hf(p,`${u}-flow__edge`)))return!0;if(!r&&!g&&!o&&!i&&!n||s||f&&!v||hf(p,a)&&v||hf(p,c)&&(!v||o&&v&&!e)||!n&&p.ctrlKey&&v)return!1;if(!n&&p.type==="touchstart"&&p.touches?.length>1)return p.preventDefault(),!1;if(!g&&!o&&!y&&v||!r&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(r)&&!r.includes(p.button)&&p.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||v)&&x}}function DPe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),p=AW().scaleExtent([t,n]).translateExtent(r),g=Ro(e).call(p);C({x:o.x,y:o.y,zoom:Qf(o.zoom,t,n)},[[0,0],[f.width,f.height]],r);const y=g.on("wheel.zoom"),v=g.on("dblclick.zoom");p.wheelDelta(oG);function x(F,B){return g?new Promise(U=>{p?.interpolate(B?.interpolate==="linear"?_m:Zb).transform(qN(g,B?.duration,B?.ease,()=>U(!0)),F)}):Promise.resolve(!1)}function S({noWheelClassName:F,noPanClassName:B,onPaneContextMenu:U,userSelectionActive:M,panOnScroll:z,panOnDrag:$,panOnScrollMode:L,panOnScrollSpeed:P,preventScrolling:q,zoomOnPinch:Y,zoomOnScroll:D,zoomOnDoubleClick:W,zoomActivationKeyPressed:K,lib:Q,onTransformChange:ie,connectionInProgress:pe,paneClickDistance:ue,selectionOnDrag:se}){M&&!u.isZoomingOrPanning&&E();const me=z&&!K&&!M;p.clickDistance(se?1/0:!qi(ue)||ue<0?0:ue);const xe=me?TPe({zoomPanValues:u,noWheelClassName:F,d3Selection:g,d3Zoom:p,panOnScrollMode:L,panOnScrollSpeed:P,zoomOnPinch:Y,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):$Pe({noWheelClassName:F,preventScrolling:q,d3ZoomHandler:y});if(g.on("wheel.zoom",xe,{passive:!1}),!M){const _e=RPe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});p.on("start",_e);const Ee=kPe({zoomPanValues:u,panOnDrag:$,onPaneContextMenu:!!U,onPanZoom:i,onTransformChange:ie});p.on("zoom",Ee);const Re=MPe({zoomPanValues:u,panOnDrag:$,panOnScroll:z,onPaneContextMenu:U,onPanZoomEnd:a,onDraggingChange:c});p.on("end",Re)}const je=PPe({zoomActivationKeyPressed:K,panOnDrag:$,zoomOnScroll:D,panOnScroll:z,zoomOnDoubleClick:W,zoomOnPinch:Y,userSelectionActive:M,noPanClassName:B,noWheelClassName:F,lib:Q,connectionInProgress:pe});p.filter(je),W?g.on("dblclick.zoom",v):g.on("dblclick.zoom",null)}function E(){p.on("zoom",null)}async function C(F,B,U){const M=HN(F),z=p?.constrain()(M,B,U);return z&&await x(z),new Promise($=>$(z))}async function _(F,B){const U=HN(F);return await x(U,B),new Promise(M=>M(U))}function j(F){if(g){const B=HN(F),U=g.property("__zoom");(U.k!==F.zoom||U.x!==F.x||U.y!==F.y)&&p?.transform(g,B,null,{sync:!0})}}function A(){const F=g?jW(g.node()):{x:0,y:0,k:1};return{x:F.x,y:F.y,zoom:F.k}}function T(F,B){return g?new Promise(U=>{p?.interpolate(B?.interpolate==="linear"?_m:Zb).scaleTo(qN(g,B?.duration,B?.ease,()=>U(!0)),F)}):Promise.resolve(!1)}function k(F,B){return g?new Promise(U=>{p?.interpolate(B?.interpolate==="linear"?_m:Zb).scaleBy(qN(g,B?.duration,B?.ease,()=>U(!0)),F)}):Promise.resolve(!1)}function R(F){p?.scaleExtent(F)}function V(F){p?.translateExtent(F)}function H(F){const B=!qi(F)||F<0?0:F;p?.clickDistance(B)}return{update:S,destroy:E,setViewport:_,setViewportConstrained:C,getViewport:A,scaleTo:T,scaleBy:k,setScaleExtent:R,setTranslateExtent:V,syncViewport:j,setClickDistance:H}}var th;(function(e){e.Line="line",e.Handle="handle"})(th||(th={}));function IPe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function jI(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Pl(e,t){return Math.max(0,t-e)}function Dl(e,t){return Math.max(0,e-t)}function Ob(e,t,n){return Math.max(0,t-e,e-n)}function AI(e,t){return e?!t:t}function LPe(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:u}=t;const{isHorizontal:f,isVertical:p}=t,g=f&&p,{xSnapped:y,ySnapped:v}=n,{minWidth:x,maxWidth:S,minHeight:E,maxHeight:C}=r,{x:_,y:j,width:A,height:T,aspectRatio:k}=e;let R=Math.floor(f?y-e.pointerX:0),V=Math.floor(p?v-e.pointerY:0);const H=A+(c?-R:R),F=T+(u?-V:V),B=-i[0]*A,U=-i[1]*T;let M=Ob(H,x,S),z=Ob(F,E,C);if(s){let P=0,q=0;c&&R<0?P=Pl(_+R+B,s[0][0]):!c&&R>0&&(P=Dl(_+H+B,s[1][0])),u&&V<0?q=Pl(j+V+U,s[0][1]):!u&&V>0&&(q=Dl(j+F+U,s[1][1])),M=Math.max(M,P),z=Math.max(z,q)}if(a){let P=0,q=0;c&&R>0?P=Dl(_+R,a[0][0]):!c&&R<0&&(P=Pl(_+H,a[1][0])),u&&V>0?q=Dl(j+V,a[0][1]):!u&&V<0&&(q=Pl(j+F,a[1][1])),M=Math.max(M,P),z=Math.max(z,q)}if(o){if(f){const P=Ob(H/k,E,C)*k;if(M=Math.max(M,P),s){let q=0;!c&&!u||c&&!u&&g?q=Dl(j+U+H/k,s[1][1])*k:q=Pl(j+U+(c?R:-R)/k,s[0][1])*k,M=Math.max(M,q)}if(a){let q=0;!c&&!u||c&&!u&&g?q=Pl(j+H/k,a[1][1])*k:q=Dl(j+(c?R:-R)/k,a[0][1])*k,M=Math.max(M,q)}}if(p){const P=Ob(F*k,x,S)/k;if(z=Math.max(z,P),s){let q=0;!c&&!u||u&&!c&&g?q=Dl(_+F*k+B,s[1][0])/k:q=Pl(_+(u?V:-V)*k+B,s[0][0])/k,z=Math.max(z,q)}if(a){let q=0;!c&&!u||u&&!c&&g?q=Pl(_+F*k,a[1][0])/k:q=Dl(_+(u?V:-V)*k,a[0][0])/k,z=Math.max(z,q)}}}V=V+(V<0?z:-z),R=R+(R<0?M:-M),o&&(g?H>F*k?V=(AI(c,u)?-R:R)/k:R=(AI(c,u)?-V:V)*k:f?(V=R/k,u=c):(R=V*k,c=u));const $=c?_+R:_,L=u?j+V:j;return{width:A+(c?-R:R),height:T+(u?-V:V),x:i[0]*R*(c?-1:1)+$,y:i[1]*V*(u?-1:1)+L}}const iG={width:0,height:0,x:0,y:0},FPe={...iG,pointerX:0,pointerY:0,aspectRatio:1};function zPe(e){return[[0,0],[e.measured.width,e.measured.height]]}function BPe(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function VPe({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=Ro(e);let s={controlDirection:jI("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:f,keepAspectRatio:p,resizeDirection:g,onResizeStart:y,onResize:v,onResizeEnd:x,shouldResize:S}){let E={...iG},C={...FPe};s={boundaries:f,resizeDirection:g,keepAspectRatio:p,controlDirection:jI(u)};let _,j=null,A=[],T,k,R,V=!1;const H=pW().on("start",F=>{const{nodeLookup:B,transform:U,snapGrid:M,snapToGrid:z,nodeOrigin:$,paneDomNode:L}=n();if(_=B.get(t),!_)return;j=L?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:q}=Cm(F.sourceEvent,{transform:U,snapGrid:M,snapToGrid:z,containerBounds:j});E={width:_.measured.width??0,height:_.measured.height??0,x:_.position.x??0,y:_.position.y??0},C={...E,pointerX:P,pointerY:q,aspectRatio:E.width/E.height},T=void 0,_.parentId&&(_.extent==="parent"||_.expandParent)&&(T=B.get(_.parentId),k=T&&_.extent==="parent"?zPe(T):void 0),A=[],R=void 0;for(const[Y,D]of B)if(D.parentId===t&&(A.push({id:Y,position:{...D.position},extent:D.extent}),D.extent==="parent"||D.expandParent)){const W=BPe(D,_,D.origin??$);R?R=[[Math.min(W[0][0],R[0][0]),Math.min(W[0][1],R[0][1])],[Math.max(W[1][0],R[1][0]),Math.max(W[1][1],R[1][1])]]:R=W}y?.(F,{...E})}).on("drag",F=>{const{transform:B,snapGrid:U,snapToGrid:M,nodeOrigin:z}=n(),$=Cm(F.sourceEvent,{transform:B,snapGrid:U,snapToGrid:M,containerBounds:j}),L=[];if(!_)return;const{x:P,y:q,width:Y,height:D}=E,W={},K=_.origin??z,{width:Q,height:ie,x:pe,y:ue}=LPe(C,s.controlDirection,$,s.boundaries,s.keepAspectRatio,K,k,R),se=Q!==Y,me=ie!==D,xe=pe!==P&&se,je=ue!==q&&me;if(!xe&&!je&&!se&&!me)return;if((xe||je||K[0]===1||K[1]===1)&&(W.x=xe?pe:E.x,W.y=je?ue:E.y,E.x=W.x,E.y=W.y,A.length>0)){const Me=pe-P,ze=ue-q;for(const ve of A)ve.position={x:ve.position.x-Me+K[0]*(Q-Y),y:ve.position.y-ze+K[1]*(ie-D)},L.push(ve)}if((se||me)&&(W.width=se&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Q:E.width,W.height=me&&(!s.resizeDirection||s.resizeDirection==="vertical")?ie:E.height,E.width=W.width,E.height=W.height),T&&_.expandParent){const Me=K[0]*(W.width??0);W.x&&W.x<Me&&(E.x=Me,C.x=C.x-(W.x-Me));const ze=K[1]*(W.height??0);W.y&&W.y<ze&&(E.y=ze,C.y=C.y-(W.y-ze))}const _e=IPe({width:E.width,prevWidth:Y,height:E.height,prevHeight:D,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Ee={...E,direction:_e};S?.(F,Ee)!==!1&&(V=!0,v?.(F,Ee),r(W,L))}).on("end",F=>{V&&(x?.(F,{...E}),o?.({...E}),V=!1)});i.call(H)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const{useDebugValue:UPe}=Ne,{useSyncExternalStoreWithSelector:HPe}=oV,qPe=e=>e;function sG(e,t=qPe,n){const r=HPe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return UPe(r),r}const TI=(e,t)=>{const n=UA(e),r=(o,i=t)=>sG(n,o,i);return Object.assign(r,n),r},WPe=(e,t)=>e?TI(e,t):TI;function mn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const _1=w.createContext(null),GPe=_1.Provider,aG=$s.error001();function Nt(e,t){const n=w.useContext(_1);if(n===null)throw new Error(aG);return sG(n,e,t)}function gn(){const e=w.useContext(_1);if(e===null)throw new Error(aG);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const $I={display:"none"},JPe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},lG="react-flow__node-desc",cG="react-flow__edge-desc",YPe="react-flow__aria-live",KPe=e=>e.ariaLiveMessage,XPe=e=>e.ariaLabelConfig;function QPe({rfId:e}){const t=Nt(KPe);return h.jsx("div",{id:`${YPe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:JPe,children:t})}function ZPe({rfId:e,disableKeyboardA11y:t}){const n=Nt(XPe);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${lG}-${e}`,style:$I,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${cG}-${e}`,style:$I,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(QPe,{rfId:e})]})}const nh=w.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return h.jsx("div",{className:qn(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});nh.displayName="Panel";function eDe({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(nh,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:h.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const tDe=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},jb=e=>e.id;function nDe(e,t){return mn(e.selectedNodes.map(jb),t.selectedNodes.map(jb))&&mn(e.selectedEdges.map(jb),t.selectedEdges.map(jb))}function rDe({onSelectionChange:e}){const t=gn(),{selectedNodes:n,selectedEdges:r}=Nt(tDe,nDe);return w.useEffect(()=>{const o={nodes:n,edges:r};e?.(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const oDe=e=>!!e.onSelectionChangeHandlers;function iDe({onSelectionChange:e}){const t=Nt(oDe);return e||t?h.jsx(rDe,{onSelectionChange:e}):null}const uG=[0,0],sDe={x:0,y:0,zoom:1},aDe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig"],RI=[...aDe,"rfId"],lDe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),kI={translateExtent:vg,nodeOrigin:uG,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function cDe(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=Nt(lDe,mn),u=gn();w.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=kI,a()}),[]);const f=w.useRef(kI);return w.useEffect(()=>{for(const p of RI){const g=e[p],y=f.current[p];g!==y&&(typeof e[p]>"u"||(p==="nodes"?t(g):p==="edges"?n(g):p==="minZoom"?r(g):p==="maxZoom"?o(g):p==="translateExtent"?i(g):p==="nodeExtent"?s(g):p==="ariaLabelConfig"?u.setState({ariaLabelConfig:tPe(g)}):p==="fitView"?u.setState({fitViewQueued:g}):p==="fitViewOptions"?u.setState({fitViewOptions:g}):u.setState({[p]:g})))}f.current=e},RI.map(p=>e[p])),null}function MI(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function uDe(e){const[t,n]=w.useState(e==="system"?null:e);return w.useEffect(()=>{if(e!=="system"){n(e);return}const r=MI(),o=()=>n(r?.matches?"dark":"light");return o(),r?.addEventListener("change",o),()=>{r?.removeEventListener("change",o)}},[e]),t!==null?t:MI()?.matches?"dark":"light"}const PI=typeof document<"u"?document:null;function Ng(e=null,t={target:PI,actInsideInputWithModifier:!0}){const[n,r]=w.useState(!1),o=w.useRef(!1),i=w.useRef(new Set([])),[s,a]=w.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",`
`).replace(`
`,`
+`).split(`
`)),f=u.reduce((p,g)=>p.concat(...g),[]);return[u,f]}return[[],[]]},[e]);return w.useEffect(()=>{const c=t?.target??PI,u=t?.actInsideInputWithModifier??!0;if(e!==null){const f=y=>{if(o.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!o.current||o.current&&!u)&&VW(y))return!1;const x=II(y.code,a);if(i.current.add(y[x]),DI(s,i.current,!1)){const S=y.composedPath?.()?.[0]||y.target,E=S?.nodeName==="BUTTON"||S?.nodeName==="A";t.preventDefault!==!1&&(o.current||!E)&&y.preventDefault(),r(!0)}},p=y=>{const v=II(y.code,a);DI(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(y[v]),y.key==="Meta"&&i.current.clear(),o.current=!1},g=()=>{i.current.clear(),r(!1)};return c?.addEventListener("keydown",f),c?.addEventListener("keyup",p),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{c?.removeEventListener("keydown",f),c?.removeEventListener("keyup",p),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function DI(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function II(e,t){return t.includes(e)?"code":"key"}const dDe=()=>{const e=gn();return w.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),c=a$(t,r,o,i,s,n?.padding??.1);return a?(await a.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:c}=s.getBoundingClientRect(),u={x:t.x-a,y:t.y-c},f=n.snapGrid??o,p=n.snapToGrid??i;return vy(u,r,p,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=wx(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function dG(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const c of s)fDe(c,a);n.push(a)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function fDe(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function fG(e,t){return dG(e,t)}function hG(e,t){return dG(e,t)}function nu(e,t){return{id:e,type:"select",selected:t}}function pf(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push(nu(i.id,s)))}return r}function LI({items:e=[],lookup:t}){const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,i]of e.entries()){const s=t.get(i.id),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===void 0&&n.push({item:i,type:"add",index:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function FI(e){return{id:e.id,type:"remove"}}const zI=e=>q6e(e),hDe=e=>MW(e);function pG(e){return w.forwardRef(e)}const pDe=typeof window<"u"?w.useLayoutEffect:w.useEffect;function BI(e){const[t,n]=w.useState(BigInt(0)),[r]=w.useState(()=>mDe(()=>n(o=>o+BigInt(1))));return pDe(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function mDe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const mG=w.createContext(null);function gDe({children:e}){const t=gn(),n=w.useCallback(a=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:f,onNodesChange:p,nodeLookup:g,fitViewQueued:y}=t.getState();let v=c;for(const S of a)v=typeof S=="function"?S(v):S;const x=LI({items:v,lookup:g});f&&u(v),x.length>0?p?.(x):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:E,setNodes:C}=t.getState();S&&C(E)})},[]),r=BI(n),o=w.useCallback(a=>{const{edges:c=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:p,edgeLookup:g}=t.getState();let y=c;for(const v of a)y=typeof v=="function"?v(y):v;f?u(y):p&&p(LI({items:y,lookup:g}))},[]),i=BI(o),s=w.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return h.jsx(mG.Provider,{value:s,children:e})}function yDe(){const e=w.useContext(mG);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const bDe=e=>!!e.panZoom;function Dh(){const e=dDe(),t=gn(),n=yDe(),r=Nt(bDe),o=w.useMemo(()=>{const i=p=>t.getState().nodeLookup.get(p),s=p=>{n.nodeQueue.push(p)},a=p=>{n.edgeQueue.push(p)},c=p=>{const{nodeLookup:g,nodeOrigin:y}=t.getState(),v=zI(p)?p:g.get(p.id),x=v.parentId?zW(v.position,v.measured,v.parentId,g,y):v.position,S={...v,position:x,width:v.measured?.width??v.width,height:v.measured?.height??v.height};return Zf(S)},u=(p,g,y={replace:!1})=>{s(v=>v.map(x=>{if(x.id===p){const S=typeof g=="function"?g(x):g;return y.replace&&zI(S)?S:{...x,...S}}return x}))},f=(p,g,y={replace:!1})=>{a(v=>v.map(x=>{if(x.id===p){const S=typeof g=="function"?g(x):g;return y.replace&&hDe(S)?S:{...x,...S}}return x}))};return{getNodes:()=>t.getState().nodes.map(p=>({...p})),getNode:p=>i(p)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:p=[]}=t.getState();return p.map(g=>({...g}))},getEdge:p=>t.getState().edgeLookup.get(p),setNodes:s,setEdges:a,addNodes:p=>{const g=Array.isArray(p)?p:[p];n.nodeQueue.push(y=>[...y,...g])},addEdges:p=>{const g=Array.isArray(p)?p:[p];n.edgeQueue.push(y=>[...y,...g])},toObject:()=>{const{nodes:p=[],edges:g=[],transform:y}=t.getState(),[v,x,S]=y;return{nodes:p.map(E=>({...E})),edges:g.map(E=>({...E})),viewport:{x:v,y:x,zoom:S}}},deleteElements:async({nodes:p=[],edges:g=[]})=>{const{nodes:y,edges:v,onNodesDelete:x,onEdgesDelete:S,triggerNodeChanges:E,triggerEdgeChanges:C,onDelete:_,onBeforeDelete:j}=t.getState(),{nodes:A,edges:T}=await K6e({nodesToRemove:p,edgesToRemove:g,nodes:y,edges:v,onBeforeDelete:j}),k=T.length>0,R=A.length>0;if(k){const V=T.map(FI);S?.(T),C(V)}if(R){const V=A.map(FI);x?.(A),E(V)}return(R||k)&&_?.({nodes:A,edges:T}),{deletedNodes:A,deletedEdges:T}},getIntersectingNodes:(p,g=!0,y)=>{const v=yI(p),x=v?p:c(p),S=y!==void 0;return x?(y||t.getState().nodes).filter(E=>{const C=t.getState().nodeLookup.get(E.id);if(C&&!v&&(E.id===p.id||!C.internals.positionAbsolute))return!1;const _=Zf(S?E:C),j=wg(_,x);return g&&j>0||j>=_.width*_.height||j>=x.width*x.height}):[]},isNodeIntersecting:(p,g,y=!0)=>{const x=yI(p)?p:c(p);if(!x)return!1;const S=wg(x,g);return y&&S>0||S>=g.width*g.height||S>=x.width*x.height},updateNode:u,updateNodeData:(p,g,y={replace:!1})=>{u(p,v=>{const x=typeof g=="function"?g(v):g;return y.replace?{...v,data:x}:{...v,data:{...v.data,...x}}},y)},updateEdge:f,updateEdgeData:(p,g,y={replace:!1})=>{f(p,v=>{const x=typeof g=="function"?g(v):g;return y.replace?{...v,data:x}:{...v,data:{...v.data,...x}}},y)},getNodesBounds:p=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return W6e(p,{nodeLookup:g,nodeOrigin:y})},getHandleConnections:({type:p,id:g,nodeId:y})=>Array.from(t.getState().connectionLookup.get(`${y}-${p}${g?`-${g}`:""}`)?.values()??[]),getNodeConnections:({type:p,handleId:g,nodeId:y})=>Array.from(t.getState().connectionLookup.get(`${y}${p?g?`-${p}-${g}`:`-${p}`:""}`)?.values()??[]),fitView:async p=>{const g=t.getState().fitViewResolver??ePe();return t.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:g}),n.nodeQueue.push(y=>[...y]),g.promise}}},[]);return w.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const VI=e=>e.selected,vDe=typeof window<"u"?window:void 0;function xDe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=gn(),{deleteElements:r}=Dh(),o=Ng(e,{actInsideInputWithModifier:!1}),i=Ng(t,{target:vDe});w.useEffect(()=>{if(o){const{edges:s,nodes:a}=n.getState();r({nodes:a.filter(VI),edges:s.filter(VI)}),n.setState({nodesSelectionActive:!1})}},[o]),w.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function wDe(e){const t=gn();w.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const r=l$(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",$s.error004()),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const C1={position:"absolute",width:"100%",height:"100%",top:0,left:0},SDe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function EDe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Su.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:u,minZoom:f,maxZoom:p,zoomActivationKeyCode:g,preventScrolling:y=!0,children:v,noWheelClassName:x,noPanClassName:S,onViewportChange:E,isControlledViewport:C,paneClickDistance:_,selectionOnDrag:j}){const A=gn(),T=w.useRef(null),{userSelectionActive:k,lib:R,connectionInProgress:V}=Nt(SDe,mn),H=Ng(g),F=w.useRef();wDe(T);const B=w.useCallback(U=>{E?.({x:U[0],y:U[1],zoom:U[2]}),C||A.setState({transform:U})},[E,C]);return w.useEffect(()=>{if(T.current){F.current=DPe({domNode:T.current,minZoom:f,maxZoom:p,translateExtent:u,viewport:c,onDraggingChange:$=>A.setState({paneDragging:$}),onPanZoomStart:($,L)=>{const{onViewportChangeStart:P,onMoveStart:q}=A.getState();q?.($,L),P?.(L)},onPanZoom:($,L)=>{const{onViewportChange:P,onMove:q}=A.getState();q?.($,L),P?.(L)},onPanZoomEnd:($,L)=>{const{onViewportChangeEnd:P,onMoveEnd:q}=A.getState();q?.($,L),P?.(L)}});const{x:U,y:M,zoom:z}=F.current.getViewport();return A.setState({panZoom:F.current,transform:[U,M,z],domNode:T.current.closest(".react-flow")}),()=>{F.current?.destroy()}}},[]),w.useEffect(()=>{F.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:H,preventScrolling:y,noPanClassName:S,userSelectionActive:k,noWheelClassName:x,lib:R,onTransformChange:B,connectionInProgress:V,selectionOnDrag:j,paneClickDistance:_})},[e,t,n,r,o,i,s,a,H,y,S,k,x,R,B,V,j,_]),h.jsx("div",{className:"react-flow__renderer",ref:T,style:C1,children:v})}const NDe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function _De(){const{userSelectionActive:e,userSelectionRect:t}=Nt(NDe,mn);return e&&t?h.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const WN=(e,t)=>n=>{n.target===t.current&&e?.(n)},CDe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function ODe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=xg.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:f,onPaneMouseEnter:p,onPaneMouseMove:g,onPaneMouseLeave:y,children:v}){const x=gn(),{userSelectionActive:S,elementsSelectable:E,dragging:C,connectionInProgress:_}=Nt(CDe,mn),j=E&&(e||S),A=w.useRef(null),T=w.useRef(),k=w.useRef(new Set),R=w.useRef(new Set),V=w.useRef(!1),H=P=>{if(V.current||_){V.current=!1;return}c?.(P),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},F=P=>{if(Array.isArray(r)&&r?.includes(2)){P.preventDefault();return}u?.(P)},B=f?P=>f(P):void 0,U=P=>{V.current&&(P.stopPropagation(),V.current=!1)},M=P=>{const{domNode:q}=x.getState();if(T.current=q?.getBoundingClientRect(),!T.current)return;const Y=P.target===A.current;if(!Y&&!!P.target.closest(".nokey")||!e||!(i&&Y||t)||P.button!==0||!P.isPrimary)return;P.target?.setPointerCapture?.(P.pointerId),V.current=!1;const{x:K,y:Q}=Wi(P.nativeEvent,T.current);x.setState({userSelectionRect:{width:0,height:0,startX:K,startY:Q,x:K,y:Q}}),Y||(P.stopPropagation(),P.preventDefault())},z=P=>{const{userSelectionRect:q,transform:Y,nodeLookup:D,edgeLookup:W,connectionLookup:K,triggerNodeChanges:Q,triggerEdgeChanges:ie,defaultEdgeOptions:pe,resetSelectedElements:ue}=x.getState();if(!T.current||!q)return;const{x:se,y:me}=Wi(P.nativeEvent,T.current),{startX:xe,startY:je}=q;if(!V.current){const ze=t?0:o;if(Math.hypot(se-xe,me-je)<=ze)return;ue(),s?.(P)}V.current=!0;const _e={startX:xe,startY:je,x:se<xe?se:xe,y:me<je?me:je,width:Math.abs(se-xe),height:Math.abs(me-je)},Ee=k.current,Re=R.current;k.current=new Set(s$(D,_e,Y,n===xg.Partial,!0).map(ze=>ze.id)),R.current=new Set;const Me=pe?.selectable??!0;for(const ze of k.current){const ve=K.get(ze);if(ve)for(const{edgeId:Ce}of ve.values()){const Ae=W.get(Ce);Ae&&(Ae.selectable??Me)&&R.current.add(Ce)}}if(!bI(Ee,k.current)){const ze=pf(D,k.current,!0);Q(ze)}if(!bI(Re,R.current)){const ze=pf(W,R.current);ie(ze)}x.setState({userSelectionRect:_e,userSelectionActive:!0,nodesSelectionActive:!1})},$=P=>{P.button===0&&(P.target?.releasePointerCapture?.(P.pointerId),!S&&P.target===A.current&&x.getState().userSelectionRect&&H?.(P),x.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(a?.(P),x.setState({nodesSelectionActive:k.current.size>0})))},L=r===!0||Array.isArray(r)&&r.includes(0);return h.jsxs("div",{className:qn(["react-flow__pane",{draggable:L,dragging:C,selection:e}]),onClick:j?void 0:WN(H,A),onContextMenu:WN(F,A),onWheel:WN(B,A),onPointerEnter:j?void 0:p,onPointerMove:j?z:g,onPointerUp:j?$:void 0,onPointerDownCapture:j?M:void 0,onClickCapture:j?U:void 0,onPointerLeave:y,ref:A,style:C1,children:[v,h.jsx(_De,{})]})}function uO({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:c}=t.getState(),u=a.get(e);if(!u){c?.("012",$s.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&s)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):o([e])}function gG({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const a=gn(),[c,u]=w.useState(!1),f=w.useRef();return w.useEffect(()=>{f.current=SPe({getStoreItems:()=>a.getState(),onNodeMouseDown:p=>{uO({id:p,store:a,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),w.useEffect(()=>{if(t)f.current?.destroy();else if(e.current)return f.current?.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{f.current?.destroy()}},[n,r,t,i,e,o]),c}const jDe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function yG(){const e=gn();return w.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:c,nodeLookup:u,nodeOrigin:f}=e.getState(),p=new Map,g=jDe(s),y=o?i[0]:5,v=o?i[1]:5,x=n.direction.x*y*n.factor,S=n.direction.y*v*n.factor;for(const[,E]of u){if(!g(E))continue;let C={x:E.internals.positionAbsolute.x+x,y:E.internals.positionAbsolute.y+S};o&&(C=by(C,i));const{position:_,positionAbsolute:j}=PW({nodeId:E.id,nextPosition:C,nodeLookup:u,nodeExtent:r,nodeOrigin:f,onError:a});E.position=_,E.internals.positionAbsolute=j,p.set(E.id,E)}c(p)},[])}const h$=w.createContext(null),ADe=h$.Provider;h$.Consumer;const bG=()=>w.useContext(h$),TDe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),$De=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:a,toHandle:c,isValid:u}=s,f=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:f,clickConnecting:o?.nodeId===e&&o?.id===t&&o?.type===n,isPossibleEndHandle:i===Xf.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!o,valid:f&&u}};function RDe({type:e="source",position:t=nt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:c,className:u,onMouseDown:f,onTouchStart:p,...g},y){const v=s||null,x=e==="target",S=gn(),E=bG(),{connectOnClick:C,noPanClassName:_,rfId:j}=Nt(TDe,mn),{connectingFrom:A,connectingTo:T,clickConnecting:k,isPossibleEndHandle:R,connectionInProcess:V,clickConnectionInProcess:H,valid:F}=Nt($De(E,v,e),mn);E||S.getState().onError?.("010",$s.error010());const B=z=>{const{defaultEdgeOptions:$,onConnect:L,hasDefaultEdges:P}=S.getState(),q={...$,...z};if(P){const{edges:Y,setEdges:D}=S.getState();D(GW(q,Y))}L?.(q),a?.(q)},U=z=>{if(!E)return;const $=UW(z.nativeEvent);if(o&&($&&z.button===0||!$)){const L=S.getState();cO.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:x,handleId:v,nodeId:E,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:L.onConnectEnd,updateConnection:L.updateConnection,onConnect:B,isValidConnection:n||L.isValidConnection,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}$?f?.(z):p?.(z)},M=z=>{const{onClickConnectStart:$,onClickConnectEnd:L,connectionClickStartHandle:P,connectionMode:q,isValidConnection:Y,lib:D,rfId:W,nodeLookup:K,connection:Q}=S.getState();if(!E||!P&&!o)return;if(!P){$?.(z.nativeEvent,{nodeId:E,handleId:v,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:E,type:e,id:v}});return}const ie=BW(z.target),pe=n||Y,{connection:ue,isValid:se}=cO.isValid(z.nativeEvent,{handle:{nodeId:E,id:v,type:e},connectionMode:q,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:pe,flowId:W,doc:ie,lib:D,nodeLookup:K});se&&ue&&B(ue);const me=structuredClone(Q);delete me.inProgress,me.toPosition=me.toHandle?me.toHandle.position:null,L?.(z,me),S.setState({connectionClickStartHandle:null})};return h.jsx("div",{"data-handleid":v,"data-nodeid":E,"data-handlepos":t,"data-id":`${j}-${E}-${v}-${e}`,className:qn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,u,{source:!x,target:x,connectable:r,connectablestart:o,connectableend:i,clickconnecting:k,connectingfrom:A,connectingto:T,valid:F,connectionindicator:r&&(!V||R)&&(V||H?i:o)}]),onMouseDown:U,onTouchStart:U,onClick:C?M:void 0,ref:y,...g,children:c})}const _g=w.memo(pG(RDe));function kDe({data:e,isConnectable:t,sourcePosition:n=nt.Bottom}){return h.jsxs(h.Fragment,{children:[e?.label,h.jsx(_g,{type:"source",position:n,isConnectable:t})]})}function MDe({data:e,isConnectable:t,targetPosition:n=nt.Top,sourcePosition:r=nt.Bottom}){return h.jsxs(h.Fragment,{children:[h.jsx(_g,{type:"target",position:n,isConnectable:t}),e?.label,h.jsx(_g,{type:"source",position:r,isConnectable:t})]})}function PDe(){return null}function DDe({data:e,isConnectable:t,targetPosition:n=nt.Top}){return h.jsxs(h.Fragment,{children:[h.jsx(_g,{type:"target",position:n,isConnectable:t}),e?.label]})}const Sx={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},UI={input:kDe,default:MDe,output:DDe,group:PDe};function IDe(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const LDe=e=>{const{width:t,height:n,x:r,y:o}=yy(e.nodeLookup,{filter:i=>!!i.selected});return{width:qi(t)?t:null,height:qi(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function FDe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=gn(),{width:o,height:i,transformString:s,userSelectionActive:a}=Nt(LDe,mn),c=yG(),u=w.useRef(null);if(w.useEffect(()=>{n||u.current?.focus({preventScroll:!0})},[n]),gG({nodeRef:u}),a||!o||!i)return null;const f=e?g=>{const y=r.getState().nodes.filter(v=>v.selected);e(g,y)}:void 0,p=g=>{Object.prototype.hasOwnProperty.call(Sx,g.key)&&(g.preventDefault(),c({direction:Sx[g.key],factor:g.shiftKey?4:1}))};return h.jsx("div",{className:qn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:h.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:o,height:i}})})}const HI=typeof window<"u"?window:void 0,zDe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function vG({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:f,selectionMode:p,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:v,panActivationKeyCode:x,zoomActivationKeyCode:S,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:_,panOnScroll:j,panOnScrollSpeed:A,panOnScrollMode:T,zoomOnDoubleClick:k,panOnDrag:R,defaultViewport:V,translateExtent:H,minZoom:F,maxZoom:B,preventScrolling:U,onSelectionContextMenu:M,noWheelClassName:z,noPanClassName:$,disableKeyboardA11y:L,onViewportChange:P,isControlledViewport:q}){const{nodesSelectionActive:Y,userSelectionActive:D}=Nt(zDe),W=Ng(u,{target:HI}),K=Ng(x,{target:HI}),Q=K||R,ie=K||j,pe=f&&Q!==!0,ue=W||D||pe;return xDe({deleteKeyCode:c,multiSelectionKeyCode:v}),h.jsx(EDe,{onPaneContextMenu:i,elementsSelectable:E,zoomOnScroll:C,zoomOnPinch:_,panOnScroll:ie,panOnScrollSpeed:A,panOnScrollMode:T,zoomOnDoubleClick:k,panOnDrag:!W&&Q,defaultViewport:V,translateExtent:H,minZoom:F,maxZoom:B,zoomActivationKeyCode:S,preventScrolling:U,noWheelClassName:z,noPanClassName:$,onViewportChange:P,isControlledViewport:q,paneClickDistance:a,selectionOnDrag:pe,children:h.jsxs(ODe,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:Q,isSelecting:!!ue,selectionMode:p,selectionKeyPressed:W,paneClickDistance:a,selectionOnDrag:pe,children:[e,Y&&h.jsx(FDe,{onSelectionContextMenu:M,noPanClassName:$,disableKeyboardA11y:L})]})})}vG.displayName="FlowRenderer";const BDe=w.memo(vG),VDe=e=>t=>e?s$(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function UDe(e){return Nt(w.useCallback(VDe(e),[e]),mn)}const HDe=e=>e.updateNodeInternals;function qDe(){const e=Nt(HDe),[t]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return w.useEffect(()=>()=>{t?.disconnect()},[t]),t}function WDe({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=gn(),i=w.useRef(null),s=w.useRef(null),a=w.useRef(e.sourcePosition),c=w.useRef(e.targetPosition),u=w.useRef(t),f=n&&!!e.internals.handleBounds;return w.useEffect(()=>{i.current&&!e.hidden&&(!f||s.current!==i.current)&&(s.current&&r?.unobserve(s.current),r?.observe(i.current),s.current=i.current)},[f,e.hidden]),w.useEffect(()=>()=>{s.current&&(r?.unobserve(s.current),s.current=null)},[]),w.useEffect(()=>{if(i.current){const p=u.current!==t,g=a.current!==e.sourcePosition,y=c.current!==e.targetPosition;(p||g||y)&&(u.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function GDe({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:c,nodesConnectable:u,nodesFocusable:f,resizeObserver:p,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:v,rfId:x,nodeTypes:S,nodeClickDistance:E,onError:C}){const{node:_,internals:j,isParent:A}=Nt(se=>{const me=se.nodeLookup.get(e),xe=se.parentLookup.has(e);return{node:me,internals:me.internals,isParent:xe}},mn);let T=_.type||"default",k=S?.[T]||UI[T];k===void 0&&(C?.("003",$s.error003(T)),T="default",k=S?.default||UI.default);const R=!!(_.draggable||a&&typeof _.draggable>"u"),V=!!(_.selectable||c&&typeof _.selectable>"u"),H=!!(_.connectable||u&&typeof _.connectable>"u"),F=!!(_.focusable||f&&typeof _.focusable>"u"),B=gn(),U=FW(_),M=WDe({node:_,nodeType:T,hasDimensions:U,resizeObserver:p}),z=gG({nodeRef:M,disabled:_.hidden||!R,noDragClassName:g,handleSelector:_.dragHandle,nodeId:e,isSelectable:V,nodeClickDistance:E}),$=yG();if(_.hidden)return null;const L=Ga(_),P=IDe(_),q=V||R||t||n||r||o,Y=n?se=>n(se,{...j.userNode}):void 0,D=r?se=>r(se,{...j.userNode}):void 0,W=o?se=>o(se,{...j.userNode}):void 0,K=i?se=>i(se,{...j.userNode}):void 0,Q=s?se=>s(se,{...j.userNode}):void 0,ie=se=>{const{selectNodesOnDrag:me,nodeDragThreshold:xe}=B.getState();V&&(!me||!R||xe>0)&&uO({id:e,store:B,nodeRef:M}),t&&t(se,{...j.userNode})},pe=se=>{if(!(VW(se.nativeEvent)||v)){if(TW.includes(se.key)&&V){const me=se.key==="Escape";uO({id:e,store:B,unselect:me,nodeRef:M})}else if(R&&_.selected&&Object.prototype.hasOwnProperty.call(Sx,se.key)){se.preventDefault();const{ariaLabelConfig:me}=B.getState();B.setState({ariaLiveMessage:me["node.a11yDescription.ariaLiveMessage"]({direction:se.key.replace("Arrow","").toLowerCase(),x:~~j.positionAbsolute.x,y:~~j.positionAbsolute.y})}),$({direction:Sx[se.key],factor:se.shiftKey?4:1})}}},ue=()=>{if(v||!M.current?.matches(":focus-visible"))return;const{transform:se,width:me,height:xe,autoPanOnNodeFocus:je,setCenter:_e}=B.getState();if(!je)return;s$(new Map([[e,_]]),{x:0,y:0,width:me,height:xe},se,!0).length>0||_e(_.position.x+L.width/2,_.position.y+L.height/2,{zoom:se[2]})};return h.jsx("div",{className:qn(["react-flow__node",`react-flow__node-${T}`,{[y]:R},_.className,{selected:_.selected,selectable:V,parent:A,draggable:R,dragging:z}]),ref:M,style:{zIndex:j.z,transform:`translate(${j.positionAbsolute.x}px,${j.positionAbsolute.y}px)`,pointerEvents:q?"all":"none",visibility:U?"visible":"hidden",..._.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Y,onMouseMove:D,onMouseLeave:W,onContextMenu:K,onClick:ie,onDoubleClick:Q,onKeyDown:F?pe:void 0,tabIndex:F?0:void 0,onFocus:F?ue:void 0,role:_.ariaRole??(F?"group":void 0),"aria-roledescription":"node","aria-describedby":v?void 0:`${lG}-${x}`,"aria-label":_.ariaLabel,..._.domAttributes,children:h.jsx(ADe,{value:e,children:h.jsx(k,{id:e,data:_.data,type:T,positionAbsoluteX:j.positionAbsolute.x,positionAbsoluteY:j.positionAbsolute.y,selected:_.selected??!1,selectable:V,draggable:R,deletable:_.deletable??!0,isConnectable:H,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:z,dragHandle:_.dragHandle,zIndex:j.z,parentId:_.parentId,...L})})})}var JDe=w.memo(GDe);const YDe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function xG(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=Nt(YDe,mn),s=UDe(e.onlyRenderVisibleElements),a=qDe();return h.jsx("div",{className:"react-flow__nodes",style:C1,children:s.map(c=>h.jsx(JDe,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}xG.displayName="NodeRenderer";const KDe=w.memo(xG);function XDe(e){return Nt(w.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&oPe({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),mn)}const QDe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return h.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ZDe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return h.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},qI={[Du.Arrow]:QDe,[Du.ArrowClosed]:ZDe};function eIe(e){const t=gn();return w.useMemo(()=>Object.prototype.hasOwnProperty.call(qI,e)?qI[e]:(t.getState().onError?.("009",$s.error009(e)),null),[e])}const tIe=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const c=eIe(t);return c?h.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:h.jsx(c,{color:n,strokeWidth:s})}):null},wG=({defaultColor:e,rfId:t})=>{const n=Nt(i=>i.edges),r=Nt(i=>i.defaultEdgeOptions),o=w.useMemo(()=>dPe(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return o.length?h.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:h.jsx("defs",{children:o.map(i=>h.jsx(tIe,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};wG.displayName="MarkerDefinitions";var nIe=w.memo(wG);function SG({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:c,className:u,...f}){const[p,g]=w.useState({x:1,y:0,width:0,height:0}),y=qn(["react-flow__edge-textwrapper",u]),v=w.useRef(null);return w.useEffect(()=>{if(v.current){const x=v.current.getBBox();g({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?h.jsxs("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:y,visibility:p.width?"visible":"hidden",...f,children:[o&&h.jsx("rect",{width:p.width+2*s[0],x:-s[0],y:-s[1],height:p.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),h.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:v,style:r,children:n}),c]}):null}SG.displayName="EdgeText";const rIe=w.memo(SG);function O1({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:u=20,...f}){return h.jsxs(h.Fragment,{children:[h.jsx("path",{...f,d:e,fill:"none",className:qn(["react-flow__edge-path",f.className])}),u?h.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&qi(t)&&qi(n)?h.jsx(rIe,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function WI({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===nt.Left||e===nt.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function EG({sourceX:e,sourceY:t,sourcePosition:n=nt.Bottom,targetX:r,targetY:o,targetPosition:i=nt.Top}){const[s,a]=WI({pos:n,x1:e,y1:t,x2:r,y2:o}),[c,u]=WI({pos:i,x1:r,y1:o,x2:e,y2:t}),[f,p,g,y]=HW({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:u});return[`M${e},${t} C${s},${a} ${c},${u} ${r},${o}`,f,p,g,y]}function NG(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:a,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:y,style:v,markerEnd:x,markerStart:S,interactionWidth:E})=>{const[C,_,j]=EG({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:a}),A=e.isInternal?void 0:t;return h.jsx(O1,{id:A,path:C,labelX:_,labelY:j,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:y,style:v,markerEnd:x,markerStart:S,interactionWidth:E})})}const oIe=NG({isInternal:!1}),_G=NG({isInternal:!0});oIe.displayName="SimpleBezierEdge";_G.displayName="SimpleBezierEdgeInternal";function CG(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:g,sourcePosition:y=nt.Bottom,targetPosition:v=nt.Top,markerEnd:x,markerStart:S,pathOptions:E,interactionWidth:C})=>{const[_,j,A]=sO({sourceX:n,sourceY:r,sourcePosition:y,targetX:o,targetY:i,targetPosition:v,borderRadius:E?.borderRadius,offset:E?.offset,stepPosition:E?.stepPosition}),T=e.isInternal?void 0:t;return h.jsx(O1,{id:T,path:_,labelX:j,labelY:A,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:x,markerStart:S,interactionWidth:C})})}const OG=CG({isInternal:!1}),jG=CG({isInternal:!0});OG.displayName="SmoothStepEdge";jG.displayName="SmoothStepEdgeInternal";function AG(e){return w.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return h.jsx(OG,{...n,id:r,pathOptions:w.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const iIe=AG({isInternal:!1}),TG=AG({isInternal:!0});iIe.displayName="StepEdge";TG.displayName="StepEdgeInternal";function $G(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:y,markerStart:v,interactionWidth:x})=>{const[S,E,C]=JW({sourceX:n,sourceY:r,targetX:o,targetY:i}),_=e.isInternal?void 0:t;return h.jsx(O1,{id:_,path:S,labelX:E,labelY:C,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:y,markerStart:v,interactionWidth:x})})}const sIe=$G({isInternal:!1}),RG=$G({isInternal:!0});sIe.displayName="StraightEdge";RG.displayName="StraightEdgeInternal";function kG(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=nt.Bottom,targetPosition:a=nt.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:y,style:v,markerEnd:x,markerStart:S,pathOptions:E,interactionWidth:C})=>{const[_,j,A]=qW({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:a,curvature:E?.curvature}),T=e.isInternal?void 0:t;return h.jsx(O1,{id:T,path:_,labelX:j,labelY:A,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:y,style:v,markerEnd:x,markerStart:S,interactionWidth:C})})}const aIe=kG({isInternal:!1}),MG=kG({isInternal:!0});aIe.displayName="BezierEdge";MG.displayName="BezierEdgeInternal";const GI={default:MG,straight:RG,step:TG,smoothstep:jG,simplebezier:_G},JI={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},lIe=(e,t,n)=>n===nt.Left?e-t:n===nt.Right?e+t:e,cIe=(e,t,n)=>n===nt.Top?e-t:n===nt.Bottom?e+t:e,YI="react-flow__edgeupdater";function KI({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:a}){return h.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:qn([YI,`${YI}-${a}`]),cx:lIe(t,r,e),cy:cIe(n,r,e),r,stroke:"transparent",fill:"transparent"})}function uIe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:a,targetPosition:c,onReconnect:u,onReconnectStart:f,onReconnectEnd:p,setReconnecting:g,setUpdateHover:y}){const v=gn(),x=(j,A)=>{if(j.button!==0)return;const{autoPanOnConnect:T,domNode:k,isValidConnection:R,connectionMode:V,connectionRadius:H,lib:F,onConnectStart:B,onConnectEnd:U,cancelConnection:M,nodeLookup:z,rfId:$,panBy:L,updateConnection:P}=v.getState(),q=A.type==="target",Y=(K,Q)=>{g(!1),p?.(K,n,A.type,Q)},D=K=>u?.(n,K),W=(K,Q)=>{g(!0),f?.(j,n,A.type),B?.(K,Q)};cO.onPointerDown(j.nativeEvent,{autoPanOnConnect:T,connectionMode:V,connectionRadius:H,domNode:k,handleId:A.id,nodeId:A.nodeId,nodeLookup:z,isTarget:q,edgeUpdaterType:A.type,lib:F,flowId:$,cancelConnection:M,panBy:L,isValidConnection:R,onConnect:D,onConnectStart:W,onConnectEnd:U,onReconnectEnd:Y,updateConnection:P,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,dragThreshold:v.getState().connectionDragThreshold,handleDomNode:j.currentTarget})},S=j=>x(j,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),E=j=>x(j,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),C=()=>y(!0),_=()=>y(!1);return h.jsxs(h.Fragment,{children:[(e===!0||e==="source")&&h.jsx(KI,{position:a,centerX:r,centerY:o,radius:t,onMouseDown:S,onMouseEnter:C,onMouseOut:_,type:"source"}),(e===!0||e==="target")&&h.jsx(KI,{position:c,centerX:i,centerY:s,radius:t,onMouseDown:E,onMouseEnter:C,onMouseOut:_,type:"target"})]})}function dIe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:u,reconnectRadius:f,onReconnect:p,onReconnectStart:g,onReconnectEnd:y,rfId:v,edgeTypes:x,noPanClassName:S,onError:E,disableKeyboardA11y:C}){let _=Nt(_e=>_e.edgeLookup.get(e));const j=Nt(_e=>_e.defaultEdgeOptions);_=j?{...j,..._}:_;let A=_.type||"default",T=x?.[A]||GI[A];T===void 0&&(E?.("011",$s.error011(A)),A="default",T=x?.default||GI.default);const k=!!(_.focusable||t&&typeof _.focusable>"u"),R=typeof p<"u"&&(_.reconnectable||n&&typeof _.reconnectable>"u"),V=!!(_.selectable||r&&typeof _.selectable>"u"),H=w.useRef(null),[F,B]=w.useState(!1),[U,M]=w.useState(!1),z=gn(),{zIndex:$,sourceX:L,sourceY:P,targetX:q,targetY:Y,sourcePosition:D,targetPosition:W}=Nt(w.useCallback(_e=>{const Ee=_e.nodeLookup.get(_.source),Re=_e.nodeLookup.get(_.target);if(!Ee||!Re)return{zIndex:_.zIndex,...JI};const Me=uPe({id:e,sourceNode:Ee,targetNode:Re,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:_e.connectionMode,onError:E});return{zIndex:rPe({selected:_.selected,zIndex:_.zIndex,sourceNode:Ee,targetNode:Re,elevateOnSelect:_e.elevateEdgesOnSelect}),...Me||JI}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex]),mn),K=w.useMemo(()=>_.markerStart?`url('#${aO(_.markerStart,v)}')`:void 0,[_.markerStart,v]),Q=w.useMemo(()=>_.markerEnd?`url('#${aO(_.markerEnd,v)}')`:void 0,[_.markerEnd,v]);if(_.hidden||L===null||P===null||q===null||Y===null)return null;const ie=_e=>{const{addSelectedEdges:Ee,unselectNodesAndEdges:Re,multiSelectionActive:Me}=z.getState();V&&(z.setState({nodesSelectionActive:!1}),_.selected&&Me?(Re({nodes:[],edges:[_]}),H.current?.blur()):Ee([e])),o&&o(_e,_)},pe=i?_e=>{i(_e,{..._})}:void 0,ue=s?_e=>{s(_e,{..._})}:void 0,se=a?_e=>{a(_e,{..._})}:void 0,me=c?_e=>{c(_e,{..._})}:void 0,xe=u?_e=>{u(_e,{..._})}:void 0,je=_e=>{if(!C&&TW.includes(_e.key)&&V){const{unselectNodesAndEdges:Ee,addSelectedEdges:Re}=z.getState();_e.key==="Escape"?(H.current?.blur(),Ee({edges:[_]})):Re([e])}};return h.jsx("svg",{style:{zIndex:$},children:h.jsxs("g",{className:qn(["react-flow__edge",`react-flow__edge-${A}`,_.className,S,{selected:_.selected,animated:_.animated,inactive:!V&&!o,updating:F,selectable:V}]),onClick:ie,onDoubleClick:pe,onContextMenu:ue,onMouseEnter:se,onMouseMove:me,onMouseLeave:xe,onKeyDown:k?je:void 0,tabIndex:k?0:void 0,role:_.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":_.ariaLabel===null?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":k?`${cG}-${v}`:void 0,ref:H,..._.domAttributes,children:[!U&&h.jsx(T,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:V,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:L,sourceY:P,targetX:q,targetY:Y,sourcePosition:D,targetPosition:W,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:K,markerEnd:Q,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),R&&h.jsx(uIe,{edge:_,isReconnectable:R,reconnectRadius:f,onReconnect:p,onReconnectStart:g,onReconnectEnd:y,sourceX:L,sourceY:P,targetX:q,targetY:Y,sourcePosition:D,targetPosition:W,setUpdateHover:B,setReconnecting:M})]})})}var fIe=w.memo(dIe);const hIe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function PG({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:p,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:v,disableKeyboardA11y:x}){const{edgesFocusable:S,edgesReconnectable:E,elementsSelectable:C,onError:_}=Nt(hIe,mn),j=XDe(t);return h.jsxs("div",{className:"react-flow__edges",children:[h.jsx(nIe,{defaultColor:e,rfId:n}),j.map(A=>h.jsx(fIe,{id:A,edgesFocusable:S,edgesReconnectable:E,elementsSelectable:C,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:u,onClick:f,reconnectRadius:p,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:v,rfId:n,onError:_,edgeTypes:r,disableKeyboardA11y:x},A))]})}PG.displayName="EdgeRenderer";const pIe=w.memo(PG),mIe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function gIe({children:e}){const t=Nt(mIe);return h.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function yIe(e){const t=Dh(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const bIe=e=>e.panZoom?.syncViewport;function vIe(e){const t=Nt(bIe),n=gn();return w.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function xIe(e){return e.connection.inProgress?{...e.connection,to:vy(e.connection.to,e.transform)}:{...e.connection}}function wIe(e){return xIe}function SIe(e){const t=wIe();return Nt(t,mn)}const EIe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function NIe({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:a,inProgress:c}=Nt(EIe,mn);return!(i&&o&&c)?null:h.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:h.jsx("g",{className:qn(["react-flow__connection",kW(a)]),children:h.jsx(DG,{style:t,type:n,CustomComponent:r,isValid:a})})})}const DG=({style:e,type:t=Vl.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:a,fromPosition:c,to:u,toNode:f,toHandle:p,toPosition:g}=SIe();if(!o)return;if(n)return h.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:g,connectionStatus:kW(r),toNode:f,toHandle:p});let y="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:g};switch(t){case Vl.Bezier:[y]=qW(v);break;case Vl.SimpleBezier:[y]=EG(v);break;case Vl.Step:[y]=sO({...v,borderRadius:0});break;case Vl.SmoothStep:[y]=sO(v);break;default:[y]=JW(v)}return h.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};DG.displayName="ConnectionLine";const _Ie={};function XI(e=_Ie){w.useRef(e),gn(),w.useEffect(()=>{},[e])}function CIe(){gn(),w.useRef(!1),w.useEffect(()=>{},[])}function IG({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:p,onSelectionStart:g,onSelectionEnd:y,connectionLineType:v,connectionLineStyle:x,connectionLineComponent:S,connectionLineContainerStyle:E,selectionKeyCode:C,selectionOnDrag:_,selectionMode:j,multiSelectionKeyCode:A,panActivationKeyCode:T,zoomActivationKeyCode:k,deleteKeyCode:R,onlyRenderVisibleElements:V,elementsSelectable:H,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:M,preventScrolling:z,defaultMarkerColor:$,zoomOnScroll:L,zoomOnPinch:P,panOnScroll:q,panOnScrollSpeed:Y,panOnScrollMode:D,zoomOnDoubleClick:W,panOnDrag:K,onPaneClick:Q,onPaneMouseEnter:ie,onPaneMouseMove:pe,onPaneMouseLeave:ue,onPaneScroll:se,onPaneContextMenu:me,paneClickDistance:xe,nodeClickDistance:je,onEdgeContextMenu:_e,onEdgeMouseEnter:Ee,onEdgeMouseMove:Re,onEdgeMouseLeave:Me,reconnectRadius:ze,onReconnect:ve,onReconnectStart:Ce,onReconnectEnd:Ae,noDragClassName:G,noWheelClassName:re,noPanClassName:ne,disableKeyboardA11y:ce,nodeExtent:te,rfId:Z,viewport:de,onViewportChange:Te}){return XI(e),XI(t),CIe(),yIe(n),vIe(de),h.jsx(BDe,{onPaneClick:Q,onPaneMouseEnter:ie,onPaneMouseMove:pe,onPaneMouseLeave:ue,onPaneContextMenu:me,onPaneScroll:se,paneClickDistance:xe,deleteKeyCode:R,selectionKeyCode:C,selectionOnDrag:_,selectionMode:j,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:A,panActivationKeyCode:T,zoomActivationKeyCode:k,elementsSelectable:H,zoomOnScroll:L,zoomOnPinch:P,zoomOnDoubleClick:W,panOnScroll:q,panOnScrollSpeed:Y,panOnScrollMode:D,panOnDrag:K,defaultViewport:F,translateExtent:B,minZoom:U,maxZoom:M,onSelectionContextMenu:p,preventScrolling:z,noDragClassName:G,noWheelClassName:re,noPanClassName:ne,disableKeyboardA11y:ce,onViewportChange:Te,isControlledViewport:!!de,children:h.jsxs(gIe,{children:[h.jsx(pIe,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:ve,onReconnectStart:Ce,onReconnectEnd:Ae,onlyRenderVisibleElements:V,onEdgeContextMenu:_e,onEdgeMouseEnter:Ee,onEdgeMouseMove:Re,onEdgeMouseLeave:Me,reconnectRadius:ze,defaultMarkerColor:$,noPanClassName:ne,disableKeyboardA11y:ce,rfId:Z}),h.jsx(NIe,{style:x,type:v,component:S,containerStyle:E}),h.jsx("div",{className:"react-flow__edgelabel-renderer"}),h.jsx(KDe,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:je,onlyRenderVisibleElements:V,noPanClassName:ne,noDragClassName:G,disableKeyboardA11y:ce,nodeExtent:te,rfId:Z}),h.jsx("div",{className:"react-flow__viewport-portal"})]})})}IG.displayName="GraphView";const OIe=w.memo(IG),QI=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c=.5,maxZoom:u=2,nodeOrigin:f,nodeExtent:p}={})=>{const g=new Map,y=new Map,v=new Map,x=new Map,S=r??t??[],E=n??e??[],C=f??[0,0],_=p??vg;XW(v,x,S);const j=lO(E,g,y,{nodeOrigin:C,nodeExtent:_,elevateNodesOnSelect:!1});let A=[0,0,1];if(s&&o&&i){const T=yy(g,{filter:H=>!!((H.width||H.initialWidth)&&(H.height||H.initialHeight))}),{x:k,y:R,zoom:V}=a$(T,o,i,c,u,a?.padding??.1);A=[k,R,V]}return{rfId:"1",width:o??0,height:i??0,transform:A,nodes:E,nodesInitialized:j,nodeLookup:g,parentLookup:y,edges:S,edgeLookup:x,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:vg,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Xf.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...RW},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:X6e,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:$W}},jIe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:p})=>WPe((g,y)=>{async function v(){const{nodeLookup:x,panZoom:S,fitViewOptions:E,fitViewResolver:C,width:_,height:j,minZoom:A,maxZoom:T}=y();S&&(await Y6e({nodes:x,width:_,height:j,panZoom:S,minZoom:A,maxZoom:T},E),C?.resolve(!0),g({fitViewResolver:null}))}return{...QI({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:p,defaultNodes:n,defaultEdges:r}),setNodes:x=>{const{nodeLookup:S,parentLookup:E,nodeOrigin:C,elevateNodesOnSelect:_,fitViewQueued:j}=y(),A=lO(x,S,E,{nodeOrigin:C,nodeExtent:p,elevateNodesOnSelect:_,checkEquality:!0});j&&A?(v(),g({nodes:x,nodesInitialized:A,fitViewQueued:!1,fitViewOptions:void 0})):g({nodes:x,nodesInitialized:A})},setEdges:x=>{const{connectionLookup:S,edgeLookup:E}=y();XW(S,E,x),g({edges:x})},setDefaultNodesAndEdges:(x,S)=>{if(x){const{setNodes:E}=y();E(x),g({hasDefaultNodes:!0})}if(S){const{setEdges:E}=y();E(S),g({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:S,nodeLookup:E,parentLookup:C,domNode:_,nodeOrigin:j,nodeExtent:A,debug:T,fitViewQueued:k}=y(),{changes:R,updatedInternals:V}=bPe(x,E,C,_,j,A);V&&(pPe(E,C,{nodeOrigin:j,nodeExtent:A}),k?(v(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),R?.length>0&&(T&&console.log("React Flow: trigger node changes",R),S?.(R)))},updateNodePositions:(x,S=!1)=>{const E=[],C=[],{nodeLookup:_,triggerNodeChanges:j}=y();for(const[A,T]of x){const k=_.get(A),R=!!(k?.expandParent&&k?.parentId&&T?.position),V={id:A,type:"position",position:R?{x:Math.max(0,T.position.x),y:Math.max(0,T.position.y)}:T.position,dragging:S};R&&k.parentId&&E.push({id:A,parentId:k.parentId,rect:{...T.internals.positionAbsolute,width:T.measured.width??0,height:T.measured.height??0}}),C.push(V)}if(E.length>0){const{parentLookup:A,nodeOrigin:T}=y(),k=f$(E,_,A,T);C.push(...k)}j(C)},triggerNodeChanges:x=>{const{onNodesChange:S,setNodes:E,nodes:C,hasDefaultNodes:_,debug:j}=y();if(x?.length){if(_){const A=fG(x,C);E(A)}j&&console.log("React Flow: trigger node changes",x),S?.(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:S,setEdges:E,edges:C,hasDefaultEdges:_,debug:j}=y();if(x?.length){if(_){const A=hG(x,C);E(A)}j&&console.log("React Flow: trigger edge changes",x),S?.(x)}},addSelectedNodes:x=>{const{multiSelectionActive:S,edgeLookup:E,nodeLookup:C,triggerNodeChanges:_,triggerEdgeChanges:j}=y();if(S){const A=x.map(T=>nu(T,!0));_(A);return}_(pf(C,new Set([...x]),!0)),j(pf(E))},addSelectedEdges:x=>{const{multiSelectionActive:S,edgeLookup:E,nodeLookup:C,triggerNodeChanges:_,triggerEdgeChanges:j}=y();if(S){const A=x.map(T=>nu(T,!0));j(A);return}j(pf(E,new Set([...x]))),_(pf(C,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:S}={})=>{const{edges:E,nodes:C,nodeLookup:_,triggerNodeChanges:j,triggerEdgeChanges:A}=y(),T=x||C,k=S||E,R=T.map(H=>{const F=_.get(H.id);return F&&(F.selected=!1),nu(H.id,!1)}),V=k.map(H=>nu(H.id,!1));j(R),A(V)},setMinZoom:x=>{const{panZoom:S,maxZoom:E}=y();S?.setScaleExtent([x,E]),g({minZoom:x})},setMaxZoom:x=>{const{panZoom:S,minZoom:E}=y();S?.setScaleExtent([E,x]),g({maxZoom:x})},setTranslateExtent:x=>{y().panZoom?.setTranslateExtent(x),g({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:S,triggerNodeChanges:E,triggerEdgeChanges:C,elementsSelectable:_}=y();if(!_)return;const j=S.reduce((T,k)=>k.selected?[...T,nu(k.id,!1)]:T,[]),A=x.reduce((T,k)=>k.selected?[...T,nu(k.id,!1)]:T,[]);E(j),C(A)},setNodeExtent:x=>{const{nodes:S,nodeLookup:E,parentLookup:C,nodeOrigin:_,elevateNodesOnSelect:j,nodeExtent:A}=y();x[0][0]===A[0][0]&&x[0][1]===A[0][1]&&x[1][0]===A[1][0]&&x[1][1]===A[1][1]||(lO(S,E,C,{nodeOrigin:_,nodeExtent:x,elevateNodesOnSelect:j,checkEquality:!1}),g({nodeExtent:x}))},panBy:x=>{const{transform:S,width:E,height:C,panZoom:_,translateExtent:j}=y();return vPe({delta:x,panZoom:_,transform:S,translateExtent:j,width:E,height:C})},setCenter:async(x,S,E)=>{const{width:C,height:_,maxZoom:j,panZoom:A}=y();if(!A)return Promise.resolve(!1);const T=typeof E?.zoom<"u"?E.zoom:j;return await A.setViewport({x:C/2-x*T,y:_/2-S*T,zoom:T},{duration:E?.duration,ease:E?.ease,interpolate:E?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{...RW}})},updateConnection:x=>{g({connection:x})},reset:()=>g({...QI()})}},Object.is);function LG({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:c,fitView:u,nodeOrigin:f,nodeExtent:p,children:g}){const[y]=w.useState(()=>jIe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:u,minZoom:s,maxZoom:a,fitViewOptions:c,nodeOrigin:f,nodeExtent:p}));return h.jsx(GPe,{value:y,children:h.jsx(gDe,{children:g})})}function AIe({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:a,fitViewOptions:c,minZoom:u,maxZoom:f,nodeOrigin:p,nodeExtent:g}){return w.useContext(_1)?h.jsx(h.Fragment,{children:e}):h.jsx(LG,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:p,nodeExtent:g,children:e})}const TIe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function $Ie({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:c,onInit:u,onMove:f,onMoveStart:p,onMoveEnd:g,onConnect:y,onConnectStart:v,onConnectEnd:x,onClickConnectStart:S,onClickConnectEnd:E,onNodeMouseEnter:C,onNodeMouseMove:_,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:T,onNodeDragStart:k,onNodeDrag:R,onNodeDragStop:V,onNodesDelete:H,onEdgesDelete:F,onDelete:B,onSelectionChange:U,onSelectionDragStart:M,onSelectionDrag:z,onSelectionDragStop:$,onSelectionContextMenu:L,onSelectionStart:P,onSelectionEnd:q,onBeforeDelete:Y,connectionMode:D,connectionLineType:W=Vl.Bezier,connectionLineStyle:K,connectionLineComponent:Q,connectionLineContainerStyle:ie,deleteKeyCode:pe="Backspace",selectionKeyCode:ue="Shift",selectionOnDrag:se=!1,selectionMode:me=xg.Full,panActivationKeyCode:xe="Space",multiSelectionKeyCode:je=Sg()?"Meta":"Control",zoomActivationKeyCode:_e=Sg()?"Meta":"Control",snapToGrid:Ee,snapGrid:Re,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:ze,nodesDraggable:ve,autoPanOnNodeFocus:Ce,nodesConnectable:Ae,nodesFocusable:G,nodeOrigin:re=uG,edgesFocusable:ne,edgesReconnectable:ce,elementsSelectable:te=!0,defaultViewport:Z=sDe,minZoom:de=.5,maxZoom:Te=2,translateExtent:$e=vg,preventScrolling:Ke=!0,nodeExtent:At,defaultMarkerColor:yn="#b1b1b7",zoomOnScroll:ls=!0,zoomOnPinch:pr=!0,panOnScroll:dn=!1,panOnScrollSpeed:Ut=.5,panOnScrollMode:nn=Su.Free,zoomOnDoubleClick:qo=!0,panOnDrag:cs=!0,onPaneClick:Ku,onPaneMouseEnter:Ja,onPaneMouseMove:Is,onPaneMouseLeave:Ya,onPaneScroll:Wn,onPaneContextMenu:Ka,paneClickDistance:Xa=0,nodeClickDistance:Ih=0,children:Xu,onReconnect:rn,onReconnectStart:Cr,onReconnectEnd:Ei,onEdgeContextMenu:Qu,onEdgeDoubleClick:Ni,onEdgeMouseEnter:Qa,onEdgeMouseMove:Za,onEdgeMouseLeave:el,reconnectRadius:Ac=10,onNodesChange:Zu,onEdgesChange:Wo,noDragClassName:Tn="nodrag",noWheelClassName:er="nowheel",noPanClassName:lt="nopan",fitView:tr,fitViewOptions:vo,connectOnClick:wy,attributionPosition:Sy,proOptions:Tc,defaultEdgeOptions:Lh,elevateNodesOnSelect:tl,elevateEdgesOnSelect:nl,disableKeyboardA11y:rl=!1,autoPanOnConnect:ol,autoPanOnNodeDrag:Dn,autoPanSpeed:Ey,connectionRadius:Ny,isValidConnection:Ls,onError:il,style:j1,id:Fh,nodeDragThreshold:_y,connectionDragThreshold:A1,viewport:ed,onViewportChange:td,width:_i,height:Hr,colorMode:Cy="light",debug:T1,onScroll:nd,ariaLabelConfig:Oy,...rd},$1){const mr=Fh||"1",zh=uDe(Cy),jy=w.useCallback(od=>{od.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),nd?.(od)},[nd]);return h.jsx("div",{"data-testid":"rf__wrapper",...rd,onScroll:jy,style:{...j1,...TIe},ref:$1,className:qn(["react-flow",o,zh]),id:Fh,role:"application",children:h.jsxs(AIe,{nodes:e,edges:t,width:_i,height:Hr,fitView:tr,fitViewOptions:vo,minZoom:de,maxZoom:Te,nodeOrigin:re,nodeExtent:At,children:[h.jsx(OIe,{onInit:u,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:C,onNodeMouseMove:_,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:T,nodeTypes:i,edgeTypes:s,connectionLineType:W,connectionLineStyle:K,connectionLineComponent:Q,connectionLineContainerStyle:ie,selectionKeyCode:ue,selectionOnDrag:se,selectionMode:me,deleteKeyCode:pe,multiSelectionKeyCode:je,panActivationKeyCode:xe,zoomActivationKeyCode:_e,onlyRenderVisibleElements:Me,defaultViewport:Z,translateExtent:$e,minZoom:de,maxZoom:Te,preventScrolling:Ke,zoomOnScroll:ls,zoomOnPinch:pr,zoomOnDoubleClick:qo,panOnScroll:dn,panOnScrollSpeed:Ut,panOnScrollMode:nn,panOnDrag:cs,onPaneClick:Ku,onPaneMouseEnter:Ja,onPaneMouseMove:Is,onPaneMouseLeave:Ya,onPaneScroll:Wn,onPaneContextMenu:Ka,paneClickDistance:Xa,nodeClickDistance:Ih,onSelectionContextMenu:L,onSelectionStart:P,onSelectionEnd:q,onReconnect:rn,onReconnectStart:Cr,onReconnectEnd:Ei,onEdgeContextMenu:Qu,onEdgeDoubleClick:Ni,onEdgeMouseEnter:Qa,onEdgeMouseMove:Za,onEdgeMouseLeave:el,reconnectRadius:Ac,defaultMarkerColor:yn,noDragClassName:Tn,noWheelClassName:er,noPanClassName:lt,rfId:mr,disableKeyboardA11y:rl,nodeExtent:At,viewport:ed,onViewportChange:td}),h.jsx(cDe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:v,onConnectEnd:x,onClickConnectStart:S,onClickConnectEnd:E,nodesDraggable:ve,autoPanOnNodeFocus:Ce,nodesConnectable:Ae,nodesFocusable:G,edgesFocusable:ne,edgesReconnectable:ce,elementsSelectable:te,elevateNodesOnSelect:tl,elevateEdgesOnSelect:nl,minZoom:de,maxZoom:Te,nodeExtent:At,onNodesChange:Zu,onEdgesChange:Wo,snapToGrid:Ee,snapGrid:Re,connectionMode:D,translateExtent:$e,connectOnClick:wy,defaultEdgeOptions:Lh,fitView:tr,fitViewOptions:vo,onNodesDelete:H,onEdgesDelete:F,onDelete:B,onNodeDragStart:k,onNodeDrag:R,onNodeDragStop:V,onSelectionDrag:z,onSelectionDragStart:M,onSelectionDragStop:$,onMove:f,onMoveStart:p,onMoveEnd:g,noPanClassName:lt,nodeOrigin:re,rfId:mr,autoPanOnConnect:ol,autoPanOnNodeDrag:Dn,autoPanSpeed:Ey,onError:il,connectionRadius:Ny,isValidConnection:Ls,selectNodesOnDrag:ze,nodeDragThreshold:_y,connectionDragThreshold:A1,onBeforeDelete:Y,debug:T1,ariaLabelConfig:Oy}),h.jsx(iDe,{onSelectionChange:U}),Xu,h.jsx(eDe,{proOptions:Tc,position:Sy}),h.jsx(ZPe,{rfId:mr,disableKeyboardA11y:rl})]})})}var RIe=pG($Ie);const kIe=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function MIe(){return Nt(kIe,mn)}function PIe(e){const[t,n]=w.useState(e),r=w.useCallback(o=>n(i=>fG(o,i)),[]);return[t,n,r]}function DIe(e){const[t,n]=w.useState(e),r=w.useCallback(o=>n(i=>hG(o,i)),[]);return[t,n,r]}function IIe({dimensions:e,lineWidth:t,variant:n,className:r}){return h.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:qn(["react-flow__background-pattern",n,r])})}function LIe({radius:e,className:t}){return h.jsx("circle",{cx:e,cy:e,r:e,className:qn(["react-flow__background-pattern","dots",t])})}var Na;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Na||(Na={}));const FIe={[Na.Dots]:1,[Na.Lines]:1,[Na.Cross]:6},zIe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function FG({id:e,variant:t=Na.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:a,style:c,className:u,patternClassName:f}){const p=w.useRef(null),{transform:g,patternId:y}=Nt(zIe,mn),v=r||FIe[t],x=t===Na.Dots,S=t===Na.Cross,E=Array.isArray(n)?n:[n,n],C=[E[0]*g[2]||1,E[1]*g[2]||1],_=v*g[2],j=Array.isArray(i)?i:[i,i],A=S?[_,_]:C,T=[j[0]*g[2]||1+A[0]/2,j[1]*g[2]||1+A[1]/2],k=`${y}${e||""}`;return h.jsxs("svg",{className:qn(["react-flow__background",u]),style:{...c,...C1,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:p,"data-testid":"rf__background",children:[h.jsx("pattern",{id:k,x:g[0]%C[0],y:g[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:x?h.jsx(LIe,{radius:_/2,className:f}):h.jsx(IIe,{dimensions:A,lineWidth:o,variant:t,className:f})}),h.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}FG.displayName="Background";const ZI=w.memo(FG);function BIe(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:h.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function VIe(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:h.jsx("path",{d:"M0 0h32v4.2H0z"})})}function UIe(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:h.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function HIe(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function qIe(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Ab({children:e,className:t,...n}){return h.jsx("button",{type:"button",className:qn(["react-flow__controls-button",t]),...n,children:e})}const WIe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function zG({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:c,className:u,children:f,position:p="bottom-left",orientation:g="vertical","aria-label":y}){const v=gn(),{isInteractive:x,minZoomReached:S,maxZoomReached:E,ariaLabelConfig:C}=Nt(WIe,mn),{zoomIn:_,zoomOut:j,fitView:A}=Dh(),T=()=>{_(),i?.()},k=()=>{j(),s?.()},R=()=>{A(o),a?.()},V=()=>{v.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),c?.(!x)},H=g==="horizontal"?"horizontal":"vertical";return h.jsxs(nh,{className:qn(["react-flow__controls",H,u]),position:p,style:e,"data-testid":"rf__controls","aria-label":y??C["controls.ariaLabel"],children:[t&&h.jsxs(h.Fragment,{children:[h.jsx(Ab,{onClick:T,className:"react-flow__controls-zoomin",title:C["controls.zoomIn.ariaLabel"],"aria-label":C["controls.zoomIn.ariaLabel"],disabled:E,children:h.jsx(BIe,{})}),h.jsx(Ab,{onClick:k,className:"react-flow__controls-zoomout",title:C["controls.zoomOut.ariaLabel"],"aria-label":C["controls.zoomOut.ariaLabel"],disabled:S,children:h.jsx(VIe,{})})]}),n&&h.jsx(Ab,{className:"react-flow__controls-fitview",onClick:R,title:C["controls.fitView.ariaLabel"],"aria-label":C["controls.fitView.ariaLabel"],children:h.jsx(UIe,{})}),r&&h.jsx(Ab,{className:"react-flow__controls-interactive",onClick:V,title:C["controls.interactive.ariaLabel"],"aria-label":C["controls.interactive.ariaLabel"],children:x?h.jsx(qIe,{}):h.jsx(HIe,{})}),f]})}zG.displayName="Controls";w.memo(zG);function GIe({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:a,strokeWidth:c,className:u,borderRadius:f,shapeRendering:p,selected:g,onClick:y}){const{background:v,backgroundColor:x}=i||{},S=s||v||x;return h.jsx("rect",{className:qn(["react-flow__minimap-node",{selected:g},u]),x:t,y:n,rx:f,ry:f,width:r,height:o,style:{fill:S,stroke:a,strokeWidth:c},shapeRendering:p,onClick:y?E=>y(E,e):void 0})}const JIe=w.memo(GIe),YIe=e=>e.nodes.map(t=>t.id),GN=e=>e instanceof Function?e:()=>e;function KIe({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=JIe,onClick:s}){const a=Nt(YIe,mn),c=GN(t),u=GN(e),f=GN(n),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return h.jsx(h.Fragment,{children:a.map(g=>h.jsx(QIe,{id:g,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:p},g))})}function XIe({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:c}){const{node:u,x:f,y:p,width:g,height:y}=Nt(v=>{const{internals:x}=v.nodeLookup.get(e),S=x.userNode,{x:E,y:C}=x.positionAbsolute,{width:_,height:j}=Ga(S);return{node:S,x:E,y:C,width:_,height:j}},mn);return!u||u.hidden||!FW(u)?null:h.jsx(a,{x:f,y:p,width:g,height:y,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:o,strokeColor:n(u),strokeWidth:i,shapeRendering:s,onClick:c,id:u.id})}const QIe=w.memo(XIe);var ZIe=w.memo(KIe);const e9e=200,t9e=150,n9e=e=>!e.hidden,r9e=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?LW(yy(e.nodeLookup,{filter:n9e}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},o9e="react-flow__minimap-desc";function BG({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:c,maskColor:u,maskStrokeColor:f,maskStrokeWidth:p,position:g="bottom-right",onClick:y,onNodeClick:v,pannable:x=!1,zoomable:S=!1,ariaLabel:E,inversePan:C,zoomStep:_=1,offsetScale:j=5}){const A=gn(),T=w.useRef(null),{boundingRect:k,viewBB:R,rfId:V,panZoom:H,translateExtent:F,flowWidth:B,flowHeight:U,ariaLabelConfig:M}=Nt(r9e,mn),z=e?.width??e9e,$=e?.height??t9e,L=k.width/z,P=k.height/$,q=Math.max(L,P),Y=q*z,D=q*$,W=j*q,K=k.x-(Y-k.width)/2-W,Q=k.y-(D-k.height)/2-W,ie=Y+W*2,pe=D+W*2,ue=`${o9e}-${V}`,se=w.useRef(0),me=w.useRef();se.current=q,w.useEffect(()=>{if(T.current&&H)return me.current=jPe({domNode:T.current,panZoom:H,getTransform:()=>A.getState().transform,getViewScale:()=>se.current}),()=>{me.current?.destroy()}},[H]),w.useEffect(()=>{me.current?.update({translateExtent:F,width:B,height:U,inversePan:C,pannable:x,zoomStep:_,zoomable:S})},[x,S,C,_,F,B,U]);const xe=y?Ee=>{const[Re,Me]=me.current?.pointer(Ee)||[0,0];y(Ee,{x:Re,y:Me})}:void 0,je=v?w.useCallback((Ee,Re)=>{const Me=A.getState().nodeLookup.get(Re).internals.userNode;v(Ee,Me)},[]):void 0,_e=E??M["minimap.ariaLabel"];return h.jsx(nh,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof p=="number"?p*q:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:qn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:h.jsxs("svg",{width:z,height:$,viewBox:`${K} ${Q} ${ie} ${pe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ue,ref:T,onClick:xe,children:[_e&&h.jsx("title",{id:ue,children:_e}),h.jsx(ZIe,{onClick:je,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:a}),h.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-W},${Q-W}h${ie+W*2}v${pe+W*2}h${-ie-W*2}z
M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}BG.displayName="MiniMap";const VG=w.memo(BG),i9e=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,s9e={[th.Line]:"right",[th.Handle]:"bottom-right"};function a9e({nodeId:e,position:t,variant:n=th.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:a=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:y=!0,shouldResize:v,onResizeStart:x,onResize:S,onResizeEnd:E}){const C=bG(),_=typeof e=="string"?e:C,j=gn(),A=w.useRef(null),T=n===th.Handle,k=Nt(w.useCallback(i9e(T&&y),[T,y]),mn),R=w.useRef(null),V=t??s9e[n];w.useEffect(()=>{if(!(!A.current||!_))return R.current||(R.current=VPe({domNode:A.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:F,transform:B,snapGrid:U,snapToGrid:M,nodeOrigin:z,domNode:$}=j.getState();return{nodeLookup:F,transform:B,snapGrid:U,snapToGrid:M,nodeOrigin:z,paneDomNode:$}},onChange:(F,B)=>{const{triggerNodeChanges:U,nodeLookup:M,parentLookup:z,nodeOrigin:$}=j.getState(),L=[],P={x:F.x,y:F.y},q=M.get(_);if(q&&q.expandParent&&q.parentId){const Y=q.origin??$,D=F.width??q.measured.width??0,W=F.height??q.measured.height??0,K={id:q.id,parentId:q.parentId,rect:{width:D,height:W,...zW({x:F.x??q.position.x,y:F.y??q.position.y},{width:D,height:W},q.parentId,M,Y)}},Q=f$([K],M,z,$);L.push(...Q),P.x=F.x?Math.max(Y[0]*D,F.x):void 0,P.y=F.y?Math.max(Y[1]*W,F.y):void 0}if(P.x!==void 0&&P.y!==void 0){const Y={id:_,type:"position",position:{...P}};L.push(Y)}if(F.width!==void 0&&F.height!==void 0){const D={id:_,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:F.width,height:F.height}};L.push(D)}for(const Y of B){const D={...Y,type:"position"};L.push(D)}U(L)},onEnd:({width:F,height:B})=>{const U={id:_,type:"dimensions",resizing:!1,dimensions:{width:F,height:B}};j.getState().triggerNodeChanges([U])}})),R.current.update({controlPosition:V,boundaries:{minWidth:a,minHeight:c,maxWidth:u,maxHeight:f},keepAspectRatio:p,resizeDirection:g,onResizeStart:x,onResize:S,onResizeEnd:E,shouldResize:v}),()=>{R.current?.destroy()}},[V,a,c,u,f,p,x,S,E,v]);const H=V.split("-");return h.jsx("div",{className:qn(["react-flow__resize-control","nodrag",...H,n,r]),ref:A,style:{...o,scale:k,...s&&{[T?"backgroundColor":"borderColor"]:s}},children:i})}w.memo(a9e);function l9e({nodes:e,edges:t,externalProvider:n,backgroundStyle:r="lines",minimap:o=!1,children:i,onDropNewNode:s,onDropNewEdge:a,...c}){const[u,f,p]=PIe(e??[]),[g,y,v]=DIe(t??[]),{screenToFlowPosition:x}=Dh(),{theme:S}=Va(),[E,C]=w.useState(!1),[_,j]=w.useState(!1),[A,T]=w.useState(!1),k=U=>{U.metaKey&&C(!0),U.key===" "&&j(!0)},R=U=>{U.metaKey||C(!1),U.key===" "&&j(!1)},V=()=>{if(_){T(!1);return}T(!0)},H=()=>{if(_){T(!1);return}T(!1)};w.useEffect(()=>(document.querySelector("html")?.classList.add("fixed"),window.addEventListener("keydown",k),window.addEventListener("keyup",R),window.addEventListener("pointerdown",V),window.addEventListener("pointerup",H),()=>{window.removeEventListener("keydown",k),window.removeEventListener("keyup",R),window.removeEventListener("pointerdown",V),window.removeEventListener("pointerup",H),document.querySelector("html")?.classList.remove("fixed")}),[]),w.useEffect(()=>{f(e??[]),y(t??[])},[e,t]);const F=w.useCallback(U=>y(M=>GW(U,M)),[]),B=w.useCallback((U,M)=>{if(!s||!a)return;const{fromNode:z,fromHandle:$,fromPosition:L}=M;if(!M.isValid){console.log("conn",{event:U,connectionState:M});const{clientX:P,clientY:q}="changedTouches"in U?U.changedTouches[0]:U,Y=s({id:"select",type:"default",data:{label:""},position:x({x:P,y:q}),origin:[0,0]});f(D=>D.concat(Y)),y(D=>D.concat(s({id:Y.id,source:M.fromNode.id,target:Y.id})))}},[x]);return h.jsxs(RIe,{colorMode:S,onConnect:F,onConnectEnd:B,className:E?"cursor-zoom-in":_?A?"cursor-grabbing":"cursor-grab":"",proOptions:{hideAttribution:!0},fitView:!0,fitViewOptions:{maxZoom:1.5,...c.fitViewOptions},nodeDragThreshold:25,panOnScrollSpeed:1,snapToGrid:!0,nodes:u,edges:g,onNodesChange:p,onEdgesChange:v,nodesConnectable:!1,panOnDrag:!0,zoomOnScroll:E,panOnScroll:!E,zoomOnDoubleClick:!1,selectionOnDrag:!_,...c,children:[r==="lines"&&h.jsx(ZI,{color:S==="light"?"rgba(0,0,0,.05)":"rgba(255,255,255,.1)",gap:[50,50],variant:Na.Lines}),r==="dots"&&h.jsx(ZI,{color:S==="light"?"rgba(0,0,0,.5)":"rgba(255,255,255,.2)"}),o&&h.jsx(VG,{...typeof o=="object"?o:{}}),i]})}function br({position:e,className:t,children:n,unstyled:r,...o}){return r?h.jsx(nh,{position:e,className:Be("flex flex-row p-1 gap-4",t),...o,children:n}):h.jsx(nh,{position:e,...o,children:h.jsx(UG,{className:t,children:n})})}const UG=({children:e,className:t,...n})=>h.jsx("div",{...n,className:Be("flex flex-row bg-lightest border ring-2 ring-muted/5 border-muted rounded-full items-center p-1",t),children:e}),c9e=({Icon:e,size:t="lg",variant:n="ghost",onClick:r,disabled:o,className:i,round:s,...a})=>h.jsx(ft,{Icon:e,size:t,variant:n,onClick:r,disabled:o,className:Be(s?"rounded-full":"",i),...a}),u9e=w.forwardRef(({children:e,className:t,mono:n,...r},o)=>h.jsx("span",{...r,ref:o,className:Be("text-md font-medium leading-none",n&&"font-mono",t),children:e}));br.Wrapper=UG;br.IconButton=c9e;br.Text=u9e;function d9e({children:e,...t}){const[n,r]=w.useState(!1),o=Dh(),{zoom:i,x:s,y:a}=MIe(),c=Math.round(i*100),u=async()=>await o.zoomIn(),f=async()=>o.zoomTo(1),p=async()=>await o.zoomOut();function g(){r(y=>!y)}return h.jsxs(h.Fragment,{children:[e,t.coordinates&&h.jsx(br,{position:"bottom-center",children:h.jsxs(br.Text,{className:"px-2",mono:!0,children:[s.toFixed(2),",",a.toFixed(2)]})}),h.jsxs(br,{unstyled:!0,position:"bottom-right",children:[t.zoom&&h.jsxs(br.Wrapper,{className:"px-1.5",children:[h.jsx(br.IconButton,{Icon:UV,round:!0,onClick:u}),h.jsxs(br.Text,{className:"px-2",mono:!0,onClick:f,children:[c,"%"]}),h.jsx(br.IconButton,{Icon:PSe,round:!0,onClick:p}),h.jsx(br.IconButton,{Icon:kSe,round:!0,onClick:f})]}),t.minimap&&h.jsxs(h.Fragment,{children:[h.jsx(br.Wrapper,{children:h.jsx(br.IconButton,{Icon:fC,round:!0,onClick:g,variant:n?"default":"ghost"})}),n&&h.jsx(VG,{style:{bottom:50,right:-5},ariaLabel:null})]})]})]})}function tc({selected:e,children:t,className:n,...r}){return Va(),h.jsx("div",{...r,className:Be("relative w-80 shadow-lg rounded-lg bg-background",e&&"outline outline-blue-500/25",n),children:t})}const f9e=({className:e,label:t,children:n,...r})=>h.jsx("div",{...r,className:Be("flex flex-row bg-primary/15 justify-center items-center rounded-tl-lg rounded-tr-lg py-1 px-2 drag-handle",e),children:n||h.jsx("span",{className:"font-semibold opacity-75 font-mono",children:t??"Untitled node"})}),h9e=({children:e,className:t,...n})=>h.jsx("div",{...n,className:Be("px-2 py-1.5 pb-2 flex flex-col",t),children:e});tc.Header=f9e;tc.Content=h9e;const p$=Gf({dirty:!1,name:void 0,flow:void 0}),HG=w.createContext(void 0),JN={trigger:{type:"manual"},tasks:{},connections:{}};function p9e({children:e,name:t}){const n=IT(p$),r=ot(),o=t?r.config.flows.flows[t]:void 0,i=r.schema.flows.properties.flows;w.useEffect(()=>{t&&n({dirty:!1,name:t,flow:o})},[t]);const s={flow:{setName:async a=>{console.log("set name",a),n(c=>({...c,name:a,dirty:!0}))}},trigger:{update:async a=>{console.log("update trigger",a),n(c=>{const u=c.flow||JN;return{...c,dirty:!0,flow:{...u,trigger:a}}})}},task:{create:async(a,c={})=>{console.log("create task",a,c),n(u=>{const f=u.flow||JN,p={...f.tasks,[a]:c};return{...u,dirty:!0,flow:{...f,tasks:p}}})},update:async(a,c)=>{console.log("update task",a,c),n(u=>{const f=u.flow||JN,p={...u.flow?.tasks?.[a],params:c};return{...u,dirty:!0,flow:{...f,tasks:{...f.tasks,[a]:p}}}})}}};return h.jsx(HG.Provider,{value:{name:t,data:o,schema:i,actions:s},children:e})}function xy(){return w.useContext(HG)}function m9e(){return DT(p$)}function m$(e,t=BF){const n=cy(p$,w.useCallback(e,[]),t);return kh(n)[0]}function g9e(e,t){const n=[{id:"trigger",data:{label:t,type:e.trigger.type},type:"trigger",dragHandle:".drag-handle",position:{x:0,y:0}}];let r=1;const o=Object.keys(e.tasks??{}).length;for(const[i,s]of Object.entries(e.tasks??{})){const a=r===o,c=r===1,u=a;n.push({id:`task-${i}`,data:{label:i,type:s.type,last:a,start:c,responding:u},type:"task",dragHandle:".drag-handle",position:{x:450*r+(r-1)*64,y:0}}),r++}return n}function y9e(e){const t=Object.entries(e.tasks??{});if(t.length===0)return[];const n=t.length>=1?[{id:"trigger-task",source:"trigger",target:`task-${t[0]?.[0]}`,style:{strokeWidth:2},markerEnd:{type:Du.ArrowClosed,width:10,height:10}}]:[];for(const[r,o]of Object.entries(e.connections??{}))n.push({id:r,source:"task-"+o.source,target:"task-"+o.target,style:{strokeWidth:2},markerEnd:{type:Du.ArrowClosed,width:10,height:10}});return n}function Ex(e){const t={top:16,width:10,height:10,background:"transparent",border:"2px solid #999"},n=-10,r={target:{...t,left:n},source:{...t,right:n}};return h.jsx(_g,{...e,position:e.type==="source"?nt.Right:nt.Left,style:r[e.type]})}const e9=[{type:"fetch",label:"Fetch",description:"Fetch data from a URL",template:{type:"fetch",params:{method:"GET",headers:[],url:""}}},{type:"render",label:"Render",description:"Render data using LiquidJS"}];function b9e(e){const[t,n]=w.useState(),r=Dh(),{actions:o}=xy(),i=e.id;async function s(){const a=e9.find(u=>u.type===t),c="untitled";await o.task.create(c,a.template),r.setNodes(u=>u.map(f=>f.id===i?{...f,id:"task-"+c,type:"task",data:{...a.template,label:c}}:f)),setTimeout(()=>{r.setEdges(u=>u.map(f=>(console.log("edge?",f,i,f.target===i),f.target===i?{...f,id:"task-"+c,target:"task-"+c}:f)))},100),console.log("make",a)}return h.jsxs(tc,{className:"w-96",children:[h.jsx(Ex,{type:"target",id:"select-in"}),h.jsxs(tc.Header,{className:"gap-3 justify-start py-2",children:[h.jsx("div",{className:"bg-primary/10 rounded-full w-4 h-4"}),h.jsx("div",{className:"bg-primary/5 rounded-full w-1/2 h-4"})]}),h.jsxs(tc.Content,{children:[h.jsx("div",{children:"select"}),h.jsx("div",{className:"grid grid-cols-3 gap-2",children:e9.map(a=>h.jsx("button",{type:"button",className:Be("border border-primary/10 rounded-md py-2 px-4 hover:bg-primary/10",t===a.type&&"bg-primary/10"),onClick:()=>n(a.type),children:a.label},a.type))}),h.jsx("button",{onClick:s,children:"make"})]})]})}function v9e({label:e,description:t,size:n,...r}){return h.jsxs(Lt.Wrapper,{className:"relative",children:[e&&h.jsxs("div",{className:"flex flex-col",children:[h.jsx(Lt.Label,{size:n,children:e}),t&&h.jsx(Lt.Description,{size:n,children:t})]}),h.jsx(bc,{...r,size:n})]})}const dO={key:"",value:""};function x9e(e){return!e||Array.isArray(e)?[dO]:Object.entries(e).map(([t,n])=>({key:t,value:n}))}const Tb=({label:e,initialValue:t,onChange:n,error:r,classNames:o,mode:i="object"})=>{const[s,a]=w.useState(t?x9e(t):[dO]);w.useEffect(()=>{if(n)if(i==="object"){const p=s.reduce((g,y)=>(y.key&&typeof y.value<"u"&&(g[y.key]=y.value),g),{});n(p)}else n(s)},[s]);function c(){a(p=>[...p,dO])}function u(p,g){return y=>{const v=y.currentTarget.value;a(x=>x.map((S,E)=>E===p?{...S,[g]:v}:S))}}function f(p){return()=>{a(g=>g.filter((y,v)=>v!==p))}}return h.jsxs(Lt.Wrapper,{className:"w-full",children:[h.jsxs("div",{className:"flex flex-row w-full justify-between",children:[e?h.jsx(Lt.Label,{className:o?.label,children:e}):h.jsx("div",{}),h.jsx(ft,{Icon:FA,size:"xs",onClick:c})]}),h.jsxs("div",{className:Be("flex flex-col gap-2",o?.itemWrapper),children:[s.map(({key:p,value:g},y)=>h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[s.length>1&&h.jsx(ft,{Icon:kB,size:"xs",onClick:f(y)}),h.jsx(_n,{className:"w-36",placeholder:"key",value:p,classNames:{wrapper:"font-mono pt-px"},onChange:u(y,"key")}),h.jsx(_n,{className:"w-full",placeholder:"value",value:g,classNames:{wrapper:"font-mono pt-px"},onChange:u(y,"value")})]},y)),r&&h.jsx(Lt.Error,{children:r})]})]})};function g$({children:e,className:t,tabs:n,Icon:r,isInvalid:o,...i}){const{data:s}=i;function a(c){i.onChangeName&&i.onChangeName(c.target.value)}return h.jsxs(tc,{className:Be("w-96",o&&"ring-8 ring-red-500/15",t),children:[h.jsx(S9e,{Icon:r??bxe,initialValue:s.label,onChange:a}),h.jsx(tc.Content,{className:"gap-3",children:e}),h.jsx(w9e,{tabs:n})]})}const w9e=({tabs:e})=>{const[t,n]=w.useState();if(!e||e?.length===0)return null;function r(o){return()=>{n(i=>i===o?void 0:o)}}return h.jsxs("div",{className:"border-t border-t-muted mt-1",children:[h.jsx("div",{className:"flex flex-row justify-start bg-primary/5 px-3 py-2.5 gap-3",children:e.map((o,i)=>h.jsx("button",{type:"button",onClick:r(i),className:Be("text-sm leading-none",i===t?"font-bold opacity-80":"font-medium opacity-50"),children:o.label},o.id))}),typeof t<"u"?h.jsx("div",{className:"border-t border-t-muted",children:e[t]?.content()}):null]})},S9e=({Icon:e,iconProps:t,rightSection:n,initialValue:r,changable:o=!1,onChange:i})=>{const[s,a]=w.useState(r);function c(u){if(!o)return;const f=String(u.target.value);if(f.length>0&&!/^[a-zA-Z_][a-zA-Z0-9_ ]*$/.test(f)||f.length===25)return;const p=f.toLowerCase().replace(/ /g,"_").replace(/__+/g,"_");a(p),i?.({...u,target:{...u.target,value:p}})}return h.jsxs(tc.Header,{className:"justify-between gap-10",children:[h.jsxs("div",{className:"flex flex-row flex-grow gap-1 items-center",children:[h.jsx(e,{width:16,height:16,...t??{}}),o?h.jsx("input",{type:"text",value:s,disabled:!o,onChange:c,className:Be("font-mono font-semibold bg-transparent rounded-lg outline-none pl-1.5 w-full hover:bg-lightest/30 transition-colors focus:bg-lightest/60")}):h.jsx("span",{className:"font-mono font-semibold bg-transparent rounded-lg outline-none pl-1.5",children:s})]}),h.jsxs("div",{className:"flex flex-row gap-1",children:[h.jsx(ft,{Icon:Y1e,size:"sm"}),h.jsx(ft,{Icon:Ha,size:"sm"})]})]})},E9e=ke({query:Ou(le()).optional(),...Xz.schema.properties});function N9e({onChange:e,params:t,...n}){const[r,o]=w9([!0,!1]),[i,s]=w.useState("None"),{register:a,handleSubmit:c,setValue:u,getValues:f,formState:{isValid:p,errors:g},watch:y,control:v}=Cc({resolver:Oc(E9e),defaultValues:t,mode:"onChange"});function x(S){console.log("submit task",S),e(S)}return h.jsx(g$,{...n,isInvalid:!p,className:"w-[400px]",Icon:MB,tabs:_9e({watch:y}),onChangeName:console.log,children:h.jsxs("form",{onBlur:c(x),className:"flex flex-col gap-3",children:[h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[h.jsx(Sa,{className:"w-36",label:"Method",defaultValue:"GET",data:["GET","POST","PATCH","PUT","DEL"],name:"method",control:v}),h.jsx(_n,{className:"w-full",label:"Mapping Path",placeholder:"/path/to-be/mapped",classNames:{wrapper:"font-mono pt-px"},...a("url")})]}),h.jsx(Xe,{onClick:o,className:"justify-center",size:"small",variant:"ghost",iconSize:14,IconLeft:r?rxe:FA,children:"More options"}),r&&h.jsxs(h.Fragment,{children:[h.jsx(Tb,{label:"URL query",onChange:S=>u("query",S),error:g.query?.message}),h.jsx(Tb,{label:"Headers"}),h.jsx("div",{className:"flex flex-row gap-2 items-center mt-2",children:h.jsxs(Lt.Wrapper,{className:"w-full",children:[h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[h.jsx(Lt.Label,{children:"Body"}),h.jsx(v9e,{data:["None","Form","JSON","Code"],size:"xs",defaultValue:i,onChange:S=>s(S)})]}),i==="Form"&&h.jsx(Tb,{label:void 0}),i==="JSON"&&h.jsx(Tb,{label:void 0})]})})]})]})})}const _9e=({watch:e})=>[{id:"json",label:"JSON",content:()=>h.jsx("div",{className:"scroll-auto",children:h.jsx(Vr,{json:e(),expand:2,className:"bg-white break-all"})})},{id:"test",label:"test",content:()=>h.jsx("div",{children:"test"})}],C9e=w.lazy(()=>Kw(()=>import("./CodeEditor-BSbZC6_t.js"),[]));function O9e({editable:e,...t}){return h.jsx(w.Suspense,{fallback:null,children:h.jsx(C9e,{className:Be("flex w-full border border-muted bg-white rounded-lg",!e&&"opacity-70"),editable:e,_extensions:{html:!0},...t})})}function j9e(e){return h.jsx(g$,{...e,onChangeName:console.log,Icon:MB,className:"w-[400px]",children:h.jsx("form",{className:"flex flex-col gap-3",children:h.jsx(O9e,{value:e.params.render,onChange:console.log})})})}const t9={fetch:N9e,render:j9e},A9e=e=>{const{data:{label:t,start:n,last:r,responding:o}}=e,i=m$(u=>u.flow.tasks[t]),{actions:s}=xy(),a=i.type in t9?t9[i.type]:()=>h.jsx("div",{children:"unsupported"});function c(u){s.task.update(t,u)}return h.jsxs(h.Fragment,{children:[h.jsx(a,{...e,params:i.params,onChange:c}),h.jsx(Ex,{type:"target",id:`${t}-in`}),h.jsx(Ex,{type:"source",id:`${t}-out`})]})};function Cg({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o,onChange:i,label:s,size:a,description:c,error:u,...f}){const{field:{value:p,onChange:g,...y}}=Oh({name:e,control:t,defaultValue:n,rules:r,shouldUnregister:o});return h.jsxs(Lt.Wrapper,{className:"relative",children:[s&&h.jsxs("div",{className:"flex flex-col",children:[h.jsx(Lt.Label,{size:a,children:s}),c&&h.jsx(Lt.Description,{size:a,children:c})]}),h.jsx(bc,{value:p,onChange:v=>{g(v),i?.(v)},size:a,...y,...f})]})}const T9e=ke({trigger:Rt(Object.values(Vt(OA,(e,t)=>Ve({type:ui(t),config:e.cls.schema},{title:String(t)}))))}),$9e=e=>{const{data:{label:t,...n}}=e,r=m$(S=>S.flow.trigger),{actions:o}=xy(),{register:i,handleSubmit:s,setValue:a,getValues:c,formState:{isValid:u,errors:f},watch:p,control:g}=Cc({resolver:Oc(T9e),defaultValues:{trigger:r},mode:"onChange"}),y=p("trigger");async function v(S){console.log("submit",S.trigger),await o.trigger.update(S.trigger)}async function x(S){console.log("change name",S),await o.flow.setName(S)}return h.jsxs(g$,{...e,tabs:M9e({data:y}),onChangeName:x,children:[h.jsxs("form",{onBlur:s(v),className:"flex flex-col gap-3",children:[h.jsxs("div",{className:"flex flex-row justify-between items-center",children:[h.jsx(Cg,{label:"Trigger Type",defaultValue:"manual",data:[{label:"Manual",value:"manual"},{label:"HTTP",value:"http"},{label:"Event",value:"event",disabled:!0}],name:"trigger.type",control:g}),h.jsx(Cg,{label:"Execution Mode",defaultValue:"async",data:[{label:"Async",value:"async"},{label:"Sync",value:"sync"}],name:"trigger.config.mode",control:g})]}),y?.type==="manual"&&h.jsx(R9e,{}),y?.type==="http"&&h.jsx(k9e,{form:{watch:p,register:i,setValue:a,getValues:c,control:g}})]}),h.jsx(Ex,{type:"source",id:"trigger-out"})]})},R9e=()=>null,k9e=({form:e})=>h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[h.jsx(Sa,{className:"w-36",label:"Method",data:["GET","POST","PATCH","PUT","DEL"],name:"trigger.config.method",control:e.control}),h.jsx(_n,{className:"w-full",label:"Mapping Path",placeholder:"/trigger_http",classNames:{wrapper:"font-mono pt-px"},...e.register("trigger.config.path")})]}),h.jsx("div",{className:"flex flex-row gap-2 items-center",children:h.jsx(Cg,{className:"w-full",label:"Response Type",defaultValue:"json",data:[{label:"JSON",value:"json"},{label:"HTML",value:"html"},{label:"Text",value:"text"}],name:"trigger.config.response_type",control:e.control})})]}),M9e=({data:e,...t})=>[{id:"json",label:"JSON",content:()=>h.jsx(Vr,{json:e,expand:2,className:""})},{id:"test",label:"test",content:()=>h.jsx("div",{children:"test"})}],P9e={select:b9e,trigger:$9e,task:A9e};function D9e(e){return h.jsx(p9e,{name:e.params.flow,children:h.jsx(LG,{children:h.jsx(I9e,{})})})}function I9e(){const e=w.useRef(null),[t,n]=w.useState(),r=xy();if(!r.data||!r.name)return"no flow";w.useEffect(()=>{console.log("ref",e.current?.getBoundingClientRect()),n(e.current?.getBoundingClientRect())},[]);const o=g9e(r.data,r.name),i=y9e(r.data);console.log("nodes",o),console.log("edges",i);const c={zoom:1,x:t?.width?t.width*.1:0,y:t?.height?t.height/2-260/2-50:0};return h.jsx("div",{className:"flex flex-col w-full h-full",ref:e,children:t&&h.jsxs(h.Fragment,{children:[h.jsx(l9e,{externalProvider:!0,backgroundStyle:"dots",nodes:o,edges:i,nodeTypes:P9e,nodeDragThreshold:0,fitView:!1,defaultViewport:c,nodesConnectable:!0,onDropNewNode:u=>({...u,type:"select",data:{label:""}}),onDropNewEdge:u=>({...u,style:{strokeWidth:2},markerEnd:{type:Du.ArrowClosed,width:10,height:10}}),children:h.jsx(L9e,{})}),h.jsx(z9e,{})]})})}function L9e(){const e=m$(r=>UF(r,["name","dirty"])),[t]=Pn(),{goBack:n}=$we(()=>t(st.flows.flows.list()));return h.jsx(d9e,{minimap:!0,zoom:!0,children:h.jsxs(br,{position:"top-left",className:"gap-2 pr-6",children:[h.jsx(br.IconButton,{Icon:JA,round:!0,onClick:n}),h.jsxs(br.Text,{children:[e.name," ",e.dirty?"*":""]})]})})}const F9e=OTe("__dev_flow_debugger_tab",{tab:null}),z9e=()=>{const[e,t]=kh(F9e),n=xy(),r=m9e();function o(s){t(a=>({...a,tab:a.tab===s?null:s}))}const i=e.store?.expand||3;return h.jsx("div",{className:"flex fixed left-5 bottom-5 z-20",children:h.jsxs(xn,{value:e.tab,onChange:o,children:[h.jsx("div",{className:"max-h-96 overflow-y-scroll bg-background/70",children:h.jsxs(xn.Panel,{value:"store",children:[h.jsxs("div",{className:"flex flex-row text-sm",children:[h.jsx(Vr,{className:"max-w-96 break-all",title:"Context",json:{name:n.name,...n.data},expand:i}),h.jsx(Vr,{className:"max-w-96 break-all",title:"State",json:{name:r.name,...r.flow},expand:i})]}),h.jsx(_j,{className:"w-36",defaultValue:i,min:0,max:ML(r.flow??{}),onChange:lA(s=>t(a=>({...a,store:{...a.store,expand:s}})),250)})]})}),h.jsx(xn.List,{children:h.jsx(xn.Tab,{value:"store",children:"Store"})})]})})};function qG(){const{config:e,app:t,actions:n}=ot(),r={flow:{create:async(o,i)=>{const s=Cn(iB,i,{skipMark:!0,forceParse:!0});await n.add("flows",`flows.${o}`,s)}}};return{flows:t.flows,config:e.flows,actions:r}}const B9e=Object.keys(nB),V9e=Ve({name:ju,trigger:le({enum:B9e}),mode:le({enum:["async","sync"]})}),U9e=w.forwardRef(function(t,n){const[r,o]=w.useState([]);function i(){n?.current?.close()}return h.jsx(REe,{ref:n,size:"lg",children:h.jsx(eU,{path:r,lastBack:i,children:h.jsxs(eu,{id:"select",children:[h.jsx(Zc,{path:["Create New Flow"],onClose:i}),h.jsx(H9e,{})]})})})});function H9e(){const e=_x(),{actions:t}=qG(),{nextStep:n,stepBack:r,state:o,setState:i}=Yu(),{handleSubmit:s,watch:a,control:c,register:u,formState:{isValid:f,errors:p}}=Cc({resolver:Oc(V9e),defaultValues:{name:"",trigger:"manual",mode:"async"},mode:"onSubmit"});async function g(y){console.log(y,f),t.flow.create(y.name,{trigger:{type:y.trigger,config:{mode:y.mode}}})}return console.log("errors",p),h.jsxs("form",{ref:e,onSubmit:s(g),children:[h.jsxs(Gu,{className:"min-h-40",children:[h.jsx("div",{children:h.jsx(_n,{"data-autofocus":!0,label:"Flow Name",placeholder:"Enter flow name",error:p.name?.message,...u("name",{required:!0})})}),h.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[h.jsx(Cg,{label:"Trigger Type",name:"trigger",data:[{label:"Manual",value:"manual"},{label:"HTTP",value:"http"},{label:"Event",value:"event"}],control:c}),h.jsx(Cg,{label:"Execution mode",name:"mode",data:[{label:"Async",value:"async"},{label:"Sync",value:"sync"}],control:c})]}),h.jsx("pre",{children:JSON.stringify(a(),null,2)})]}),h.jsx(Ju,{next:{type:"submit",disabled:!f},nextLabel:"Create",prev:{onClick:r},prevLabel:"Cancel"})]})}function q9e(){const e=w.useRef(null),[t]=Pn(),{flows:n}=qG();console.log("flows",n);const r=n.map(i=>({flow:i.name,trigger:i.trigger.type,mode:i.trigger.config.mode,tasks:Object.keys(i.tasks).length,start_task:i.startTask?.name}));function o(i){t(st.flows.flows.edit(i.flow))}return h.jsxs(h.Fragment,{children:[h.jsx(U9e,{ref:e}),h.jsx(An,{right:h.jsx(Xe,{variant:"primary",onClick:()=>e.current?.open(),children:"Create new"}),children:"All Flows"}),h.jsx(Zn,{children:h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:h.jsx(s1,{data:r,renderValue:W9e,renderHeader:Dg,onClickRow:o})})})]})}const W9e=({value:e,property:t})=>["is_default","implicit_allow"].includes(t)?e?h.jsx("span",{children:"Yes"}):h.jsx("span",{className:"opacity-50",children:"No"}):t==="permissions"?[...e||[]].map((n,r)=>h.jsx("span",{className:"inline-block px-2 py-1.5 text-sm bg-primary/5 rounded font-mono leading-none",children:n},r)):h.jsx(a1,{value:e,property:t});function G9e(){return h.jsxs(As,{children:[h.jsx(tt,{path:"/flow/:flow",component:D9e}),h.jsx(cRe,{children:h.jsx(tt,{path:"/",component:q9e})})]})}function J9e({children:e}){const{app:t,config:n}=ot(),r=!n.media.enabled;return hr(["Media"]),h.jsxs(h.Fragment,{children:[h.jsxs(Wu,{children:[h.jsx(An,{right:h.jsx(Nn,{href:t.getSettingsPath(["media"]),children:h.jsx(ft,{Icon:_h})}),children:"Media"}),h.jsx(Zn,{initialOffset:96,children:h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:h.jsxs("nav",{className:"flex flex-col flex-1 gap-1",children:[h.jsxs(oo,{as:Nn,href:"/",className:"flex flex-row justify-between",children:["Main Bucket"," ",r&&h.jsx(Hw.Warning,{title:"Media not enabled.",className:"size-5"})]}),h.jsx(oo,{as:Nn,href:"/settings",children:"Settings"})]})})})]}),h.jsx(ry,{children:e})]})}function Y9e(){const{config:e}=ot(),[,t]=Uo();if(hr(["Media"]),!e.media.enabled)return h.jsx(Hn,{Icon:RB,title:"Media not enabled",description:"Please enable media in the settings to continue.",primary:{children:"Manage Settings",onClick:()=>t("/settings")}});const n=r=>{vr.open(vr.ids.mediaInfo,{file:r})};return h.jsx(Zn,{children:h.jsx("div",{className:"flex flex-1 p-3",children:h.jsx(qH,{onClick:n,infinite:!0,query:{sort:"-id"}})})})}function K9e(e){hr(["Media","Settings"]);const{hasSecrets:t}=ot({withSecrets:!0});return t?h.jsx(Q9e,{...e}):h.jsx(yo.MissingPermission,{what:"Media Settings"})}const X9e={ignoreKeys:["entity_name","basepath"],options:{debug:ir(),keepEmpty:!0}};function Q9e(){const{config:e,schema:t,actions:n}=GH(),{readonly:r}=ot(),o=JSON.parse(JSON.stringify(t));o.if={properties:{enabled:{const:!0}}},o.then={required:["adapter"]};async function i(s){console.log("submit",s),await n.config.patch(s)}return h.jsx(h.Fragment,{children:h.jsxs(dy,{schema:o,initialValues:e,onSubmit:i,...X9e,readOnly:r,children:[h.jsx(Ph,{selector:s=>({dirty:s.dirty,errors:s.errors.length>0,submitting:s.submitting}),children:({dirty:s,errors:a,submitting:c})=>h.jsx(An,{right:!r&&h.jsx(Xe,{variant:"primary",type:"submit",disabled:!s||a||c,children:"Update"}),children:"Settings"})}),h.jsxs(Zn,{children:[h.jsx(Z9e,{}),h.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[h.jsx(_r,{name:"enabled",inputProps:{"data-testId":Vq.media.switchEnabled}}),h.jsxs("div",{className:"flex flex-col gap-3 relative",children:[h.jsx(n9,{}),h.jsx(_r,{name:"storage.body_max_size",label:"Storage Body Max Size"})]})]}),h.jsx(hC,{}),h.jsxs("div",{className:"flex flex-col gap-3 p-3 relative",children:[h.jsx(n9,{}),h.jsx(Em.Root,{path:"adapter",children:h.jsx(n8e,{})})]}),h.jsx(hy,{})]})]})})}const Z9e=()=>{const e=Mh("",{strict:!0});return e.length===0?null:h.jsx(ai.Exception,{children:e.map((t,n)=>h.jsx("div",{children:t.message},n))})},e8e={s3:Ave,cloudinary:Fve,local:cxe,r2:$ve},t8e=({type:e})=>{const t=Object.entries(e8e).find(([n])=>e.startsWith(n))?.[1];return t?h.jsx(t,{}):null};function n8e(){const e=Em.useContext(),{readonly:t}=ot();return h.jsxs(mi,{children:[h.jsxs(uc,{className:"flex flex-row items-center gap-1",children:[h.jsx("span",{className:"font-bold",children:"Media Adapter:"}),e.selected===null&&h.jsx("span",{className:"opacity-70",children:" (Choose one)"})]}),h.jsx("div",{className:"grid grid-cols-2 md:flex flex-row gap-1 mb-2 flex-wrap",children:e.schemas?.map((n,r)=>h.jsxs(Xe,{onClick:()=>e.select(r),id:`adapter-${n.properties.type.const}`,variant:e.selected===r?"primary":"outline",className:Be("flex flex-row items-center justify-center gap-3 border",e.selected===r&&"border-primary"),disabled:t,children:[h.jsx("div",{children:h.jsx(t8e,{type:n.properties.type.const})}),h.jsxs("div",{className:"flex flex-col items-start justify-center",children:[h.jsx("span",{children:Ta(n.title)}),n.description&&h.jsx("span",{className:"text-xs opacity-70 text-left",children:n.description})]})]},r))}),e.selected!==null&&h.jsxs(mi,{as:"fieldset",error:e.errors.length>0,children:[h.jsx(uc,{as:"legend",className:"font-mono px-2 w-min-content",children:Ta(e.selectedSchema.title)}),h.jsxs(fy,{schema:e.selectedSchema,prefix:e.path,children:[h.jsx(_r,{name:"type",hidden:!0}),h.jsx(p1,{path:"config",wrapperProps:{label:!1,wrapper:"group"}})]})]})]})}const n9=()=>h.jsx(Ph,{selector:e=>({enabled:e.data.enabled}),children:({enabled:e})=>!e&&h.jsx("div",{className:"absolute w-full h-full z-50 inset-0 bg-background opacity-90"})});function r8e(){return h.jsxs(J9e,{children:[h.jsx(tt,{path:"/",component:Y9e}),h.jsx(tt,{path:"/settings",component:K9e})]})}function o8e(e,t){const n=w.useRef(!1),r=w.useRef(t);w.useEffect(()=>{if(!n.current||!i8e(r.current,t))return n.current=!0,r.current=t,e()},[t])}function i8e(e,t){return e&&e.length===0&&t.length===0||!e&&t.length===0?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>Object.is(n,t[r]))}const s8e=({children:e})=>{const{verify:t,user:n}=DA();return o8e(()=>{t()},[n?.id]),h.jsxs(qV,{children:[h.jsx(JSe,{}),h.jsx(WV,{children:e})]})};function a8e(){const[e]=Pn();return w.useEffect(()=>{e("/data")},[]),hr(),h.jsx(Hn,{Icon:Jve,title:"Not implemented yet",description:'Go checkout "Data" or "Media" for some action.'})}const Qp={jwt:{basepath:{"ui:options":{label:!1}},fields:{"ui:options":{orderable:!1}}},strategies:{additionalProperties:{"ui:widget":"select",type:{"ui:widget":"hidden"}},type:{"ui:widget":"hidden"}},roles:{"ui:options":{orderable:!1},permissions:{items:{"ui:widget":"checkboxes"},"ui:widget":"checkboxes"}}},l8e=({schema:e,config:t})=>{const n=ot(),r=Nw(e),o=n.app.getAbsolutePath("settings");try{const s=t.entity_name??"users",a=n.config.data.entities??{},c=Object.entries(a[s]?.fields??{}).map(([f,p])=>p.config?.virtual?void 0:f).filter(Boolean);c.length>0&&(r.properties.jwt.properties.fields.items.enum=c,r.properties.jwt.properties.fields.uniqueItems=!0,Qp.jwt.fields["ui:widget"]="checkboxes");const u=Object.keys(t.roles??{});u.length>0&&(r.properties.default_role_register.enum=u)}catch{}const i=r.properties.roles?.additionalProperties??{type:"object"};return h.jsx(tt,{path:"/auth",nest:!0,children:h.jsxs(As,{children:[h.jsx(tt,{path:"/roles/:role",component:({params:{role:s}})=>h.jsx(io,{schema:i,uiSchema:Qp.roles,config:t.roles?.[s],path:["auth","roles",s],prefix:`${o}/auth/roles/${s}`}),nest:!0}),h.jsx(tt,{path:"/strategies/:strategy",component:({params:{strategy:s}})=>{const a=t.strategies?.[s],c=r.properties.strategies.additionalProperties,u=c.anyOf.find(f=>f.properties.type.const===a?.type);return h.jsx(io,{schema:u??c,config:t.strategies?.[s],path:["auth","strategies",s],prefix:`${o}/auth/strategies/${s}`})},nest:!0}),h.jsx(tt,{path:"/",component:()=>h.jsx(io,{schema:r,uiSchema:Qp,config:t,options:{showAlert:s=>{if(!s.enabled)return"Auth is disabled. Enable it by toggling the switch below. Please also make sure set a secure secret to sign JWT tokens."},reloadOnSave:!0},properties:{strategies:{extract:!0,tableValues:s=>Object.values(Vt(s,(a,c)=>({key:c,type:a.type}))),new:{schema:r.properties.strategies.additionalProperties,uiSchema:Qp.strategies,generateKey:s=>s.type==="password"?"password":s.config.name?.toLowerCase()||""}},roles:{extract:!0,new:{schema:i,uiSchema:Qp.roles}}},prefix:`${o}/auth`,path:["auth"]}),nest:!0})]})})},c8e={jwt:{basepath:{"ui:options":{label:!1}},fields:{"ui:options":{orderable:!1}}},strategies:{additionalProperties:{"ui:widget":"select",type:{"ui:widget":"hidden"}},type:{"ui:widget":"hidden"}}},u8e=({schema:e,config:t})=>{const{app:n}=ot(),r=n.getAbsolutePath("settings");function o(i,s,a){const c=Object.keys(s.tasks??{});c.length!==0&&(i.properties&&a in i.properties&&(i.properties[a].enum=c),"anyOf"in i&&i.anyOf.forEach(u=>o(u,s,a)))}return h.jsx(tt,{path:"/flows",nest:!0,children:h.jsxs(As,{children:[h.jsx(tt,{path:"/flows/:flow/connections/:connection",component:({params:{flow:i,connection:s}})=>{const a=t.flows?.[i],c=t.flows?.[i]?.connections?.[s],u=e.properties.flows.additionalProperties.properties.connections.additionalProperties;return o(u,a,"source"),o(u,a,"target"),h.jsx(io,{schema:u,config:c,path:["flows","flows",i,"connections",s],prefix:`${r}/flows/flows/${i}/connections/${s}`})},nest:!0}),h.jsx(tt,{path:"/flows/:flow/tasks/:task",component:({params:{flow:i,task:s}})=>{const a=t.flows?.[i]?.tasks?.[s],u=e.properties.flows.additionalProperties.properties.tasks.additionalProperties.anyOf.find(f=>f.properties.type.const===a?.type);return h.jsx(io,{schema:u,config:a,path:["flows","flows",i,"tasks",s],prefix:`${r}/flows/flows/${i}/tasks/${s}`,uiSchema:{params:{render:{"ui:field":"HtmlField"}}}})},nest:!0}),h.jsx(tt,{path:"/flows/:flow",component:({params:{flow:i}})=>{const s=t.flows?.[i],a=e.properties.flows.additionalProperties,c=a.properties.tasks.additionalProperties,u=a.properties.connections.additionalProperties;return o(a,s,"start_task"),o(a,s,"responding_task"),o(u,s,"source"),o(u,s,"target"),h.jsx(io,{schema:a,config:s,path:["flows","flows",i],prefix:`${r}/flows/flows/${i}`,properties:{tasks:{extract:!0,new:{schema:c},tableValues:f=>Vi(f,(p,g,y)=>{p.push({name:y,type:g.type})},[])},connections:{extract:!0,new:{schema:u,generateKey:crypto.randomUUID()},tableValues:f=>Vi(f,(p,g,y)=>{p.push({id:y,source:g.source,target:g.target,condition:g.config.condition?.type})},[])}}})},nest:!0}),h.jsx(tt,{path:"/",component:()=>h.jsx(io,{schema:e,uiSchema:c8e,config:t,properties:{flows:{extract:!0,new:{schema:e.properties.flows.additionalProperties},tableValues:i=>Vi(i,(s,a,c)=>{s.push({name:c,trigger:a.trigger.type,mode:a.trigger.config.mode,start_task:a.start_task,responding_task:a.responding_task})},[])}},prefix:`${r}/flows`,path:["flows"]}),nest:!0})]})})},d8e={cors:{allow_methods:{"ui:widget":"checkboxes"},allow_headers:{"ui:options":{orderable:!1}}}},f8e=({schema:e,config:t})=>{const{app:n}=ot(),r=Nw(e),o=n.getAbsolutePath("settings"),i=r;return h.jsx(tt,{path:"/server",nest:!0,children:h.jsx(tt,{path:"/",component:()=>h.jsx(io,{schema:i,uiSchema:d8e,config:t,prefix:`${o}/server`,path:["server"]}),nest:!0})})};function h8e(){const{version:e,schema:t,actions:n,app:r}=ot();hr(["Settings"]);async function o(){await n.reload()}const i=Object.keys(t).map(s=>({title:t[s].title??Io(s),key:s}));return h.jsxs(Wu,{children:[h.jsx(An,{right:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("span",{className:"font-mono leading-none",children:["v",e]}),h.jsx(ft,{Icon:axe,onClick:o})]}),children:"Settings"}),h.jsx(Zn,{initialOffset:96,children:h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:h.jsx("nav",{className:"flex flex-col flex-1 gap-1",children:i.map((s,a)=>h.jsx(oo,{as:Nn,href:`/${s.key}`,children:s.title},a))})})})]})}function p8e(){return ot({withSecrets:!0}).hasSecrets?h.jsxs(h.Fragment,{children:[h.jsx(h8e,{}),h.jsx(ry,{children:h.jsxs(As,{children:[h.jsx(tt,{path:"/",component:()=>h.jsx(Hn,{Icon:rg,title:"No Setting selected",description:"Please select a setting from the left sidebar."})}),h.jsx(g8e,{}),h.jsx(tt,{path:"*",component:()=>h.jsx(Hn,{Icon:rg,title:"Settings not found",description:"Check other options."})})]})})]}):h.jsx(yo.MissingPermission,{what:"the settings"})}const m8e={media:{adapter:{"ui:options":{label:!1}}}},g8e=()=>{const{schema:e,config:t}=ot();return console.log("flows",{schema:e.flows,config:t.flows}),h.jsxs(h.Fragment,{children:[h.jsx(f8e,{schema:e.server,config:t.server}),h.jsx(Hje,{schema:e.data,config:t.data}),h.jsx(l8e,{schema:e.auth,config:t.auth}),h.jsx(y8e,{module:"media",schema:e,config:t,uiSchema:m8e.media,options:{reloadOnSave:!0}}),h.jsx(u8e,{schema:e.flows,config:t.flows})]})},y8e=({module:e,schema:t,config:n,...r})=>{const{app:o}=ot(),i=o.getAbsolutePath("settings");return h.jsx(tt,{path:e,nest:!0,children:h.jsx(As,{children:h.jsx(tt,{path:"/",component:()=>h.jsx(io,{...r,schema:t[e],config:n[e],prefix:`${i}/${e}`,path:[e]}),nest:!0})})})};function b8e(){const[e,t]=w.useState();if(w.useEffect(()=>{if(!e){const n=tye();n&&t(n)}},[]),e){let n=ai.Info;switch(e.type){case"error":n=ai.Exception;break;case"success":n=ai.Success;break;case"warning":n=ai.Warning;break}return h.jsx(n,{message:e.message,className:"justify-center"})}return null}function v8e(){return hr(["Register"]),h.jsx(FH.Screen,{action:"register",logo:h.jsx(Nn,{href:"/",className:"link",children:h.jsx(Fw,{scale:.25})})})}const bu=Lw(ey({tools:[],history:[],historyLimit:50,historyVisible:!1},e=>({setTools:t=>e({tools:t}),addHistory:(t,n)=>e(r=>({history:[{type:t,data:n},...r.history.slice(0,r.historyLimit-1)]})),setHistoryLimit:t=>e({historyLimit:t}),setHistoryVisible:t=>e({historyVisible:t})})));function r9(e){return!e||e===void 0||e===null?void 0:new UT(e).getTemplate(void 0,e)}const YN=new Map;function x8e(e){return YN.has(JSON.stringify(e))||YN.set(JSON.stringify(e),new tle(e)),YN.get(JSON.stringify(e))}function WG(){const{config:e}=ot(),t=ss(),n=t.getAuthState().token,r=t.token_transport==="header"&&n?{Authorization:`Bearer ${n}`}:void 0;return x8e({url:window.location.origin+e.server.mcp.path,fetch:t.fetcher,headers:r})}function w8e(){const e=WG(),t=wa(g=>g.closeSidebar("default")),n=bu(g=>g.tools),r=bu(g=>g.setTools),[o,i]=w.useState(!1),[s,a]=w.useState(""),[c,u]=w.useState(null),f=w.useRef(void 0),p=w.useCallback(async()=>{i(!0),u(null);try{const g=await e.listTools();g&&r(g.tools)}catch(g){console.error(g),u(String(g))}i(!1)},[]);return w.useEffect(()=>{p().then(()=>{if(f.current){const g=f.current.querySelector(".active");g&&g.scrollIntoView({behavior:"smooth",block:"center"})}})},[]),h.jsx(Vf,{scrollContainerRef:f,title:"Tools",identifier:"tools",renderHeaderRight:({active:g})=>h.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[c&&h.jsx(ns,{label:c,children:h.jsx(Hw.Err,{className:"size-5 pointer-events-auto"})}),h.jsx("span",{className:"flex-inline bg-primary/10 px-2 py-1.5 rounded-xl text-sm font-mono leading-none",children:n.length}),h.jsx(ft,{Icon:HV,disabled:!g||o,onClick:p})]}),children:h.jsxs("div",{className:"flex flex-col flex-grow p-3 gap-3",children:[h.jsx(qa,{type:"text",placeholder:"Search tools",value:s,onChange:g=>a(g.target.value),autoCapitalize:"none"}),h.jsx("nav",{className:"flex flex-col flex-1 gap-1",children:n.filter(g=>g.name.toLowerCase().includes(s.toLowerCase())).map(g=>h.jsxs(oo,{className:"flex flex-col items-start h-auto py-3 gap-px",as:Nn,href:`/tools/${g.name}`,onClick:()=>{t()},children:[h.jsx("span",{className:"font-mono",children:g.name}),h.jsx("span",{className:"text-sm text-primary/50",children:g.description})]},g.name))})]})})}function S8e(){const{toolName:e}=Mw(),n=bu(E=>E.tools).find(E=>E.name===e),r=bu(E=>E.addHistory),[o,i]=w.useState(r9(n?.inputSchema)),[s,a]=w.useState(null),c=bu(E=>E.historyVisible),u=bu(E=>E.setHistoryVisible),f=WG(),p=w.useRef(null),g=n?.inputSchema&&Object.keys(n.inputSchema.properties??{}).length>0,[y,v]=w.useTransition();w.useEffect(()=>{i(r9(n?.inputSchema)),a(null)},[e]);const x=w.useCallback(async()=>{if(!n?.name)return;const E={name:n.name,arguments:o};v(async()=>{r("request",E);const C=await f.callTool(E);C&&(a(C),r("response",C),p.current?.setSelected("Result"))})},[o]);if(!n)return null;let S=s;try{S=s?s.content?.[0].text?JSON.parse(s.content[0].text):s:null}catch{}return h.jsxs(dy,{className:"flex grow flex-col min-w-0 max-w-screen",schema:{title:"InputSchema",...n?.inputSchema},validateOn:"submit",initialValues:o,hiddenSubmit:!1,onChange:E=>{i(E)},onSubmit:x,children:[h.jsx(An,{className:"max-w-full min-w-0",right:h.jsxs("div",{className:"flex flex-row gap-2",children:[h.jsx(ft,{Icon:c?ASe:TSe,onClick:()=>u(!c)}),h.jsx(Xe,{type:"submit",disabled:!n?.name||y,variant:"primary",className:"whitespace-nowrap",children:"Call Tool"})]}),children:h.jsxs(oy,{className:"leading-tight",children:[h.jsxs("span",{className:"opacity-50",children:["Tools ",h.jsx("span",{className:"opacity-70",children:"/"})]})," ",h.jsx("span",{className:"truncate",children:n?.name})]})}),h.jsxs("div",{className:"flex grow flex-row w-vw",children:[h.jsx("div",{className:"flex grow flex-col max-w-full",style:{width:"calc(100% - var(--sidebar-width-right) - 1px)"},children:h.jsx(Zn,{children:h.jsxs("div",{className:"flex flex-col py-4 px-5 gap-4",children:[h.jsx("p",{className:"text-primary/80",children:n?.description}),g&&h.jsx(_r,{name:""}),h.jsx($Ee,{ref:p,expand:9,showCopy:!0,showSize:!0,tabs:{Arguments:{json:o,title:"Payload",enabled:g},Result:{json:S,title:"Result"},Configuration:{json:n??null,title:"Configuration"}}})]},JSON.stringify(n))})}),c&&h.jsx(Wu,{name:"right",handle:"left",maxWidth:window.innerWidth*.4,children:h.jsx(E8e,{})})]})]},n.name)}const E8e=()=>{const e=bu(t=>t.history.slice(0,50));return h.jsxs(h.Fragment,{children:[h.jsx(An,{children:"History"}),h.jsx(Zn,{children:h.jsx("div",{className:"flex grow flex-col p-3 gap-1",children:e.map((t,n)=>h.jsx(Vr,{json:t.data,title:t.type.substring(0,3),expand:2,showCopy:!0},`${t.type}-${n}`))})})]})};function N8e(){hr(["MCP UI"]);const{config:e}=ot(),t=wa(r=>r.toggleSidebar("default")),n=e.server.mcp.path;return e.server.mcp.enabled?h.jsx($V,{path:"/:type?",defaultIdentifier:"tools",children:h.jsxs("div",{className:"flex flex-col flex-grow max-w-screen",children:[h.jsx(An,{children:h.jsxs("div",{className:"flex flex-row gap-4 items-center",children:[h.jsx(ZA,{}),h.jsx(oy,{className:"whitespace-nowrap truncate",children:"MCP UI"}),h.jsxs("div",{className:"hidden md:flex flex-row gap-2 items-center bg-primary/5 rounded-full px-3 pr-3.5 py-2",children:[h.jsx(USe,{}),h.jsx("div",{className:"min-w-0 flex-1",children:h.jsx("span",{className:"block truncate text-sm font-mono leading-none select-text",children:window.location.origin+n})})]})]})}),h.jsxs("div",{className:"flex grow h-full",children:[h.jsxs(Wu,{children:[h.jsx(w8e,{}),h.jsx(Vf,{title:"Resources",identifier:"resources",children:h.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3 justify-center items-center opacity-40",children:h.jsx("i",{children:"Resources"})})})]}),h.jsxs(As,{children:[h.jsx(tt,{path:"/tools/:toolName?",component:S8e}),h.jsx(tt,{path:"*",children:h.jsx(Hn,{title:"No tool selected",description:"Please select a tool to continue.",children:h.jsx(Xe,{variant:"primary",onClick:()=>t(),className:"block md:hidden",children:"Open Tools"})})})]})]})]})}):h.jsx(Hn,{title:"MCP not enabled",description:"Please enable MCP in the settings to continue."})}function _8e(){return h.jsxs(h.Fragment,{children:[h.jsx(tt,{path:"/",component:C8e}),h.jsx(tt,{path:"/mcp*",component:N8e,nest:!0})]})}function C8e(){return h.jsx(Hn,{title:"Tools",description:"Select a tool to continue."})}let o9;function O8e({BkndWrapper:e,basePath:t="",children:n}){const{theme:r}=Va(),o=Rw(),i=t||o.admin_basepath;return h.jsxs("div",{id:"bknd-admin",className:r+" antialiased",children:[h.jsx(b8e,{}),h.jsx(ZB,{base:i,children:h.jsxs(As,{children:[h.jsx(tt,{path:"/auth/login",component:n4e}),h.jsx(tt,{path:"/auth/register",component:v8e}),h.jsx(e,{children:h.jsx(w5e,{children:h.jsx(tt,{path:"/",nest:!0,children:h.jsx(s8e,{children:h.jsxs(As,{children:[o9&&h.jsx(tt,{path:"/test*",nest:!0,children:h.jsx(w.Suspense,{fallback:null,children:h.jsx(o9,{})})}),n,h.jsx(tt,{path:"/",component:a8e}),h.jsx(tt,{path:"/data",nest:!0,children:h.jsx(w.Suspense,{fallback:null,children:h.jsx(lRe,{})})}),h.jsx(tt,{path:"/flows",nest:!0,children:h.jsx(w.Suspense,{fallback:null,children:h.jsx(G9e,{})})}),h.jsx(tt,{path:"/auth",nest:!0,children:h.jsx(w.Suspense,{fallback:null,children:h.jsx(t4e,{})})}),h.jsx(tt,{path:"/media",nest:!0,children:h.jsx(w.Suspense,{fallback:null,children:h.jsx(r8e,{})})}),h.jsx(tt,{path:"/settings",nest:!0,children:h.jsx(w.Suspense,{fallback:null,children:h.jsx(p8e,{})})}),h.jsx(tt,{path:"/tools",nest:!0,children:h.jsx(w.Suspense,{fallback:null,children:h.jsx(_8e,{})})}),h.jsx(tt,{path:"*",component:j8e})]})})})})})]})})]})}function j8e(){return h.jsx("div",{className:"flex w-full items-center justify-center",children:h.jsxs("p",{className:"text-2xl font-mono",children:[h.jsx("span",{className:"font-bold",children:"404"}),h.jsx("span",{className:"opacity-50",children:", Sorry :)"})]})})}function A8e(e){const t=({children:n})=>e.withProvider?h.jsx(jbe,{baseUrl:e.baseUrl,...typeof e.withProvider=="object"?e.withProvider:{},children:n}):n;return h.jsx(t,{children:h.jsx(T8e,{...e})})}function T8e(e){const{theme:t}=Va(),n={...e.config,...Rw()},r=({children:o})=>h.jsx(Rwe,{options:n,fallback:h.jsx($8e,{theme:n?.theme}),children:o});return h.jsxs(T9,{...ZSe(t),children:[h.jsx(ks,{position:"top-right"}),h.jsx(O8e,{BkndWrapper:r,basePath:n?.basepath,children:e.children})]})}const $8e=({theme:e})=>{const t=Va(),n=e&&["dark","light"].includes(e)?e:t.theme;return h.jsx("div",{id:"bknd-admin",className:n+" antialiased",children:h.jsxs(qV,{children:[h.jsxs("header",{"data-shell":"header",className:"flex flex-row w-full h-16 gap-2.5 border-muted border-b justify-start bg-muted/10",children:[h.jsx("div",{className:"max-h-full flex hover:bg-primary/5 link p-2.5 w-[134px] outline-none",children:h.jsx(Fw,{theme:n})}),h.jsx("nav",{className:"hidden md:flex flex-row gap-2.5 pl-0 p-2.5 items-center",children:[...new Array(4)].map((r,o)=>h.jsx(vm,{as:"span",className:"active h-full opacity-50",children:h.jsx("div",{className:"w-18 h-3"})},o))}),h.jsx("nav",{className:"flex md:hidden flex-row gap-2.5 pl-0 p-2.5 items-center",children:h.jsx(vm,{as:"span",className:"active h-full opacity-50",children:h.jsx("div",{className:"w-20 h-3"})})}),h.jsx("div",{className:"flex flex-grow"}),h.jsx("div",{className:"hidden lg:flex flex-row items-center px-4 gap-2 opacity-50",children:h.jsx("div",{className:"size-11 rounded-full bg-primary/10"})})]}),h.jsx(WV,{children:h.jsx("div",{className:"flex flex-col w-full h-full justify-center items-center"})})]})})};function i9(){aK.createRoot(document.getElementById("root")).render(h.jsx(w.StrictMode,{children:h.jsx(A8e,{withProvider:!0})}))}"startViewTransition"in document?document.startViewTransition(i9):i9();export{Pi as A,Xe as B,l9e as C,tc as D,Tf as E,_g as H,ft as I,Mq as J,Du as M,nt as P,LG as R,vc as S,J8e as T,uj as _,G8e as a,Va as b,d9e as c,go as d,Mf as e,vw as f,es as g,Um as h,bw as i,h as j,Mi as k,tA as l,ufe as m,R8e as n,tie as o,Wm as p,Cv as q,w as r,O9e as s,Be as t,ot as u,UV as v,XA as w,eSe as x,Q1e as y,Dg as z};