var Uv=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var j=(e,t,n)=>(Uv(e,t,"read from private field"),n?n.call(e):t.get(e)),ke=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},we=(e,t,n,r)=>(Uv(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Yf=(e,t,n,r)=>({set _(o){we(e,t,o,n)},get _(){return j(e,t,r)}}),tt=(e,t,n)=>(Uv(e,t,"access private method"),n);function R9(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var Qc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _$={exports:{}},mm={},E$={exports:{}},it={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Pd=Symbol.for("react.element"),P9=Symbol.for("react.portal"),T9=Symbol.for("react.fragment"),k9=Symbol.for("react.strict_mode"),A9=Symbol.for("react.profiler"),M9=Symbol.for("react.provider"),O9=Symbol.for("react.context"),N9=Symbol.for("react.forward_ref"),D9=Symbol.for("react.suspense"),I9=Symbol.for("react.memo"),L9=Symbol.for("react.lazy"),H_=Symbol.iterator;function F9(e){return e===null||typeof e!="object"?null:(e=H_&&e[H_]||e["@@iterator"],typeof e=="function"?e:null)}var C$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$$=Object.assign,R$={};function xc(e,t,n){this.props=e,this.context=t,this.refs=R$,this.updater=n||C$}xc.prototype.isReactComponent={};xc.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};xc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function P$(){}P$.prototype=xc.prototype;function sw(e,t,n){this.props=e,this.context=t,this.refs=R$,this.updater=n||C$}var aw=sw.prototype=new P$;aw.constructor=sw;$$(aw,xc.prototype);aw.isPureReactComponent=!0;var K_=Array.isArray,T$=Object.prototype.hasOwnProperty,lw={current:null},k$={key:!0,ref:!0,__self:!0,__source:!0};function A$(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)T$.call(t,r)&&!k$.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1>>1,L=G[le];if(0>>1;leo(Ke,Q))Meo(me,Ke)?(G[le]=me,G[Me]=Q,le=Me):(G[le]=Ke,G[Ne]=Q,le=Ne);else if(Meo(me,Q))G[le]=me,G[Me]=Q,le=Me;else break e}}return Z}function o(G,Z){var Q=G.sortIndex-Z.sortIndex;return Q!==0?Q:G.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var u=[],f=[],m=1,p=null,g=3,y=!1,x=!1,S=!1,E=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(G){for(var Z=n(f);Z!==null;){if(Z.callback===null)r(f);else if(Z.startTime<=G)r(f),Z.sortIndex=Z.expirationTime,t(u,Z);else break;Z=n(f)}}function R(G){if(S=!1,C(G),!x)if(n(u)!==null)x=!0,V(k);else{var Z=n(f);Z!==null&&J(R,Z.startTime-G)}}function k(G,Z){x=!1,S&&(S=!1,_(I),I=-1),y=!0;var Q=g;try{for(C(Z),p=n(u);p!==null&&(!(p.expirationTime>Z)||G&&!ie());){var le=p.callback;if(typeof le=="function"){p.callback=null,g=p.priorityLevel;var L=le(p.expirationTime<=Z);Z=e.unstable_now(),typeof L=="function"?p.callback=L:p===n(u)&&r(u),C(Z)}else r(u);p=n(u)}if(p!==null)var ue=!0;else{var Ne=n(f);Ne!==null&&J(R,Ne.startTime-Z),ue=!1}return ue}finally{p=null,g=Q,y=!1}}var O=!1,A=null,I=-1,z=5,H=-1;function ie(){return!(e.unstable_now()-HG||125le?(G.sortIndex=Q,t(f,G),n(u)===null&&G===n(f)&&(S?(_(I),I=-1):S=!0,J(R,Q-le))):(G.sortIndex=L,t(u,G),x||y||(x=!0,V(k))),G},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(G){var Z=g;return function(){var Q=g;g=Z;try{return G.apply(this,arguments)}finally{g=Q}}}})(D$);N$.exports=D$;var Z9=N$.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var I$=d,wr=Z9;function de(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Z0=Object.prototype.hasOwnProperty,q9=/^[: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]*$/,Y_={},X_={};function Q9(e){return Z0.call(X_,e)?!0:Z0.call(Y_,e)?!1:q9.test(e)?X_[e]=!0:(Y_[e]=!0,!1)}function J9(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function eD(e,t,n,r){if(t===null||typeof t>"u"||J9(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Un(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var wn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){wn[e]=new Un(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];wn[t]=new Un(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){wn[e]=new Un(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){wn[e]=new Un(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){wn[e]=new Un(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){wn[e]=new Un(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){wn[e]=new Un(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){wn[e]=new Un(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){wn[e]=new Un(e,5,!1,e.toLowerCase(),null,!1,!1)});var uw=/[\-:]([a-z])/g;function dw(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(uw,dw);wn[t]=new Un(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(uw,dw);wn[t]=new Un(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(uw,dw);wn[t]=new Un(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){wn[e]=new Un(e,1,!1,e.toLowerCase(),null,!1,!1)});wn.xlinkHref=new Un("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){wn[e]=new Un(e,1,!1,e.toLowerCase(),null,!0,!0)});function fw(e,t,n,r){var o=wn.hasOwnProperty(t)?wn[t]:null;(o!==null?o.type!==0:r||!(2l||o[s]!==i[l]){var u=` `+o[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=l);break}}}finally{Hv=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?gu(e):""}function tD(e){switch(e.tag){case 5:return gu(e.type);case 16:return gu("Lazy");case 13:return gu("Suspense");case 19:return gu("SuspenseList");case 0:case 2:case 15:return e=Kv(e.type,!1),e;case 11:return e=Kv(e.type.render,!1),e;case 1:return e=Kv(e.type,!0),e;default:return""}}function ey(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case yl:return"Fragment";case vl:return"Portal";case q0:return"Profiler";case hw:return"StrictMode";case Q0:return"Suspense";case J0:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case j$:return(e.displayName||"Context")+".Consumer";case F$:return(e._context.displayName||"Context")+".Provider";case pw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case mw:return t=e.displayName||null,t!==null?t:ey(e.type)||"Memo";case ns:t=e._payload,e=e._init;try{return ey(e(t))}catch{}}return null}function nD(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ey(t);case 8:return t===hw?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function As(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function z$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rD(e){var t=z$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function qf(e){e._valueTracker||(e._valueTracker=rD(e))}function U$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=z$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function up(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ty(e,t){var n=t.checked;return jt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function q_(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=As(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function V$(e,t){t=t.checked,t!=null&&fw(e,"checked",t,!1)}function ny(e,t){V$(e,t);var n=As(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ry(e,t.type,n):t.hasOwnProperty("defaultValue")&&ry(e,t.type,As(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Q_(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ry(e,t,n){(t!=="number"||up(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var vu=Array.isArray;function kl(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=Qf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ju(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Eu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},oD=["Webkit","ms","Moz","O"];Object.keys(Eu).forEach(function(e){oD.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Eu[t]=Eu[e]})});function G$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Eu.hasOwnProperty(e)&&Eu[e]?(""+t).trim():t+"px"}function Y$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=G$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var iD=jt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function sy(e,t){if(t){if(iD[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(de(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(de(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(de(61))}if(t.style!=null&&typeof t.style!="object")throw Error(de(62))}}function ay(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ly=null;function gw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var cy=null,Al=null,Ml=null;function tE(e){if(e=Ad(e)){if(typeof cy!="function")throw Error(de(280));var t=e.stateNode;t&&(t=xm(t),cy(e.stateNode,e.type,t))}}function X$(e){Al?Ml?Ml.push(e):Ml=[e]:Al=e}function Z$(){if(Al){var e=Al,t=Ml;if(Ml=Al=null,tE(e),t)for(e=0;e>>=0,e===0?32:31-(gD(e)/vD|0)|0}var Jf=64,eh=4194304;function yu(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function pp(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=yu(l):(i&=s,i!==0&&(r=yu(i)))}else s=n&~o,s!==0?r=yu(s):i!==0&&(r=yu(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Td(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-bo(t),e[t]=n}function bD(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=$u),uE=" ",dE=!1;function g5(e,t){switch(e){case"keyup":return XD.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function v5(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wl=!1;function qD(e,t){switch(e){case"compositionend":return v5(t);case"keypress":return t.which!==32?null:(dE=!0,uE);case"textInput":return e=t.data,e===uE&&dE?null:e;default:return null}}function QD(e,t){if(wl)return e==="compositionend"||!Ew&&g5(e,t)?(e=p5(),Ih=bw=hs=null,wl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=mE(n)}}function b5(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?b5(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function S5(){for(var e=window,t=up();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=up(e.document)}return t}function Cw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function aI(e){var t=S5(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&b5(n.ownerDocument.documentElement,n)){if(r!==null&&Cw(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=gE(n,i);var s=gE(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,xl=null,my=null,Pu=null,gy=!1;function vE(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;gy||xl==null||xl!==up(r)||(r=xl,"selectionStart"in r&&Cw(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pu&&Hu(Pu,r)||(Pu=r,r=vp(my,"onSelect"),0_l||(e.current=Sy[_l],Sy[_l]=null,_l--)}function Rt(e,t){_l++,Sy[_l]=e.current,e.current=t}var Ms={},Rn=Fs(Ms),Qn=Fs(!1),Ta=Ms;function ec(e,t){var n=e.type.contextTypes;if(!n)return Ms;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Jn(e){return e=e.childContextTypes,e!=null}function wp(){At(Qn),At(Rn)}function EE(e,t,n){if(Rn.current!==Ms)throw Error(de(168));Rt(Rn,t),Rt(Qn,n)}function A5(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(de(108,nD(e)||"Unknown",o));return jt({},n,r)}function xp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ms,Ta=Rn.current,Rt(Rn,e),Rt(Qn,Qn.current),!0}function CE(e,t,n){var r=e.stateNode;if(!r)throw Error(de(169));n?(e=A5(e,t,Ta),r.__reactInternalMemoizedMergedChildContext=e,At(Qn),At(Rn),Rt(Rn,e)):At(Qn),Rt(Qn,n)}var vi=null,bm=!1,s0=!1;function M5(e){vi===null?vi=[e]:vi.push(e)}function wI(e){bm=!0,M5(e)}function js(){if(!s0&&vi!==null){s0=!0;var e=0,t=bt;try{var n=vi;for(bt=1;e>=s,o-=s,yi=1<<32-bo(t)+o|n<I?(z=A,A=null):z=A.sibling;var H=g(_,A,C[I],R);if(H===null){A===null&&(A=z);break}e&&A&&H.alternate===null&&t(_,A),b=i(H,b,I),O===null?k=H:O.sibling=H,O=H,A=z}if(I===C.length)return n(_,A),Nt&&ra(_,I),k;if(A===null){for(;II?(z=A,A=null):z=A.sibling;var ie=g(_,A,H.value,R);if(ie===null){A===null&&(A=z);break}e&&A&&ie.alternate===null&&t(_,A),b=i(ie,b,I),O===null?k=ie:O.sibling=ie,O=ie,A=z}if(H.done)return n(_,A),Nt&&ra(_,I),k;if(A===null){for(;!H.done;I++,H=C.next())H=p(_,H.value,R),H!==null&&(b=i(H,b,I),O===null?k=H:O.sibling=H,O=H);return Nt&&ra(_,I),k}for(A=r(_,A);!H.done;I++,H=C.next())H=y(A,_,I,H.value,R),H!==null&&(e&&H.alternate!==null&&A.delete(H.key===null?I:H.key),b=i(H,b,I),O===null?k=H:O.sibling=H,O=H);return e&&A.forEach(function(K){return t(_,K)}),Nt&&ra(_,I),k}function E(_,b,C,R){if(typeof C=="object"&&C!==null&&C.type===yl&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case Zf:e:{for(var k=C.key,O=b;O!==null;){if(O.key===k){if(k=C.type,k===yl){if(O.tag===7){n(_,O.sibling),b=o(O,C.props.children),b.return=_,_=b;break e}}else if(O.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===ns&&ME(k)===O.type){n(_,O.sibling),b=o(O,C.props),b.ref=ou(_,O,C),b.return=_,_=b;break e}n(_,O);break}else t(_,O);O=O.sibling}C.type===yl?(b=Pa(C.props.children,_.mode,R,C.key),b.return=_,_=b):(R=Wh(C.type,C.key,C.props,null,_.mode,R),R.ref=ou(_,b,C),R.return=_,_=R)}return s(_);case vl:e:{for(O=C.key;b!==null;){if(b.key===O)if(b.tag===4&&b.stateNode.containerInfo===C.containerInfo&&b.stateNode.implementation===C.implementation){n(_,b.sibling),b=o(b,C.children||[]),b.return=_,_=b;break e}else{n(_,b);break}else t(_,b);b=b.sibling}b=p0(C,_.mode,R),b.return=_,_=b}return s(_);case ns:return O=C._init,E(_,b,O(C._payload),R)}if(vu(C))return x(_,b,C,R);if(Jc(C))return S(_,b,C,R);ah(_,C)}return typeof C=="string"&&C!==""||typeof C=="number"?(C=""+C,b!==null&&b.tag===6?(n(_,b.sibling),b=o(b,C),b.return=_,_=b):(n(_,b),b=h0(C,_.mode,R),b.return=_,_=b),s(_)):n(_,b)}return E}var nc=B5(!0),z5=B5(!1),Md={},Yo=Fs(Md),Xu=Fs(Md),Zu=Fs(Md);function pa(e){if(e===Md)throw Error(de(174));return e}function Nw(e,t){switch(Rt(Zu,t),Rt(Xu,e),Rt(Yo,Md),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:iy(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=iy(t,e)}At(Yo),Rt(Yo,t)}function rc(){At(Yo),At(Xu),At(Zu)}function U5(e){pa(Zu.current);var t=pa(Yo.current),n=iy(t,e.type);t!==n&&(Rt(Xu,e),Rt(Yo,n))}function Dw(e){Xu.current===e&&(At(Yo),At(Xu))}var It=Fs(0);function $p(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var a0=[];function Iw(){for(var e=0;en?n:4,e(!0);var r=l0.transition;l0.transition={};try{e(!1),t()}finally{bt=n,l0.transition=r}}function oR(){return Qr().memoizedState}function _I(e,t,n){var r=$s(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},iR(e))sR(t,n);else if(n=I5(e,t,n,r),n!==null){var o=jn();So(n,e,r,o),aR(n,t,r)}}function EI(e,t,n){var r=$s(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(iR(e))sR(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,Eo(l,s)){var u=t.interleaved;u===null?(o.next=o,Mw(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=I5(e,t,o,r),n!==null&&(o=jn(),So(n,e,r,o),aR(n,t,r))}}function iR(e){var t=e.alternate;return e===Ft||t!==null&&t===Ft}function sR(e,t){Tu=Rp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function aR(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,yw(e,n)}}var Pp={readContext:qr,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useInsertionEffect:_n,useLayoutEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useMutableSource:_n,useSyncExternalStore:_n,useId:_n,unstable_isNewReconciler:!1},CI={readContext:qr,useCallback:function(e,t){return Mo().memoizedState=[e,t===void 0?null:t],e},useContext:qr,useEffect:NE,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bh(4194308,4,J5.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bh(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bh(4,2,e,t)},useMemo:function(e,t){var n=Mo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Mo();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=_I.bind(null,Ft,e),[r.memoizedState,e]},useRef:function(e){var t=Mo();return e={current:e},t.memoizedState=e},useState:OE,useDebugValue:zw,useDeferredValue:function(e){return Mo().memoizedState=e},useTransition:function(){var e=OE(!1),t=e[0];return e=SI.bind(null,e[1]),Mo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ft,o=Mo();if(Nt){if(n===void 0)throw Error(de(407));n=n()}else{if(n=t(),dn===null)throw Error(de(349));Aa&30||H5(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,NE(G5.bind(null,r,i,e),[e]),r.flags|=2048,Ju(9,K5.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Mo(),t=dn.identifierPrefix;if(Nt){var n=wi,r=yi;n=(r&~(1<<32-bo(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=qu++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[jo]=t,e[Yu]=r,gR(e,t,!1,!1),t.stateNode=e;e:{switch(s=ay(n,r),n){case"dialog":kt("cancel",e),kt("close",e),o=r;break;case"iframe":case"object":case"embed":kt("load",e),o=r;break;case"video":case"audio":for(o=0;oic&&(t.flags|=128,r=!0,iu(i,!1),t.lanes=4194304)}else{if(!r)if(e=$p(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),iu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Nt)return En(t),null}else 2*Gt()-i.renderingStartTime>ic&&n!==1073741824&&(t.flags|=128,r=!0,iu(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Gt(),t.sibling=null,n=It.current,Rt(It,r?n&1|2:n&1),t):(En(t),null);case 22:case 23:return Gw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?hr&1073741824&&(En(t),t.subtreeFlags&6&&(t.flags|=8192)):En(t),null;case 24:return null;case 25:return null}throw Error(de(156,t.tag))}function OI(e,t){switch(Rw(t),t.tag){case 1:return Jn(t.type)&&wp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rc(),At(Qn),At(Rn),Iw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Dw(t),null;case 13:if(At(It),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(de(340));tc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return At(It),null;case 4:return rc(),null;case 10:return Aw(t.type._context),null;case 22:case 23:return Gw(),null;case 24:return null;default:return null}}var ch=!1,$n=!1,NI=typeof WeakSet=="function"?WeakSet:Set,$e=null;function Rl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Vt(e,t,r)}else n.current=null}function Ny(e,t,n){try{n()}catch(r){Vt(e,t,r)}}var VE=!1;function DI(e,t){if(vy=mp,e=S5(),Cw(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,u=-1,f=0,m=0,p=e,g=null;t:for(;;){for(var y;p!==n||o!==0&&p.nodeType!==3||(l=s+o),p!==i||r!==0&&p.nodeType!==3||(u=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(y=p.firstChild)!==null;)g=p,p=y;for(;;){if(p===e)break t;if(g===n&&++f===o&&(l=s),g===i&&++m===r&&(u=s),(y=p.nextSibling)!==null)break;p=g,g=p.parentNode}p=y}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(yy={focusedElem:e,selectionRange:n},mp=!1,$e=t;$e!==null;)if(t=$e,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$e=e;else for(;$e!==null;){t=$e;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var S=x.memoizedProps,E=x.memoizedState,_=t.stateNode,b=_.getSnapshotBeforeUpdate(t.elementType===t.type?S:co(t.type,S),E);_.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var C=t.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(de(163))}}catch(R){Vt(t,t.return,R)}if(e=t.sibling,e!==null){e.return=t.return,$e=e;break}$e=t.return}return x=VE,VE=!1,x}function ku(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Ny(t,n,i)}o=o.next}while(o!==r)}}function Em(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Dy(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function wR(e){var t=e.alternate;t!==null&&(e.alternate=null,wR(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[jo],delete t[Yu],delete t[by],delete t[vI],delete t[yI])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function xR(e){return e.tag===5||e.tag===3||e.tag===4}function WE(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||xR(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Iy(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yp));else if(r!==4&&(e=e.child,e!==null))for(Iy(e,t,n),e=e.sibling;e!==null;)Iy(e,t,n),e=e.sibling}function Ly(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ly(e,t,n),e=e.sibling;e!==null;)Ly(e,t,n),e=e.sibling}var mn=null,ho=!1;function Xi(e,t,n){for(n=n.child;n!==null;)bR(e,t,n),n=n.sibling}function bR(e,t,n){if(Go&&typeof Go.onCommitFiberUnmount=="function")try{Go.onCommitFiberUnmount(gm,n)}catch{}switch(n.tag){case 5:$n||Rl(n,t);case 6:var r=mn,o=ho;mn=null,Xi(e,t,n),mn=r,ho=o,mn!==null&&(ho?(e=mn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):mn.removeChild(n.stateNode));break;case 18:mn!==null&&(ho?(e=mn,n=n.stateNode,e.nodeType===8?i0(e.parentNode,n):e.nodeType===1&&i0(e,n),Vu(e)):i0(mn,n.stateNode));break;case 4:r=mn,o=ho,mn=n.stateNode.containerInfo,ho=!0,Xi(e,t,n),mn=r,ho=o;break;case 0:case 11:case 14:case 15:if(!$n&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Ny(n,t,s),o=o.next}while(o!==r)}Xi(e,t,n);break;case 1:if(!$n&&(Rl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Vt(n,t,l)}Xi(e,t,n);break;case 21:Xi(e,t,n);break;case 22:n.mode&1?($n=(r=$n)||n.memoizedState!==null,Xi(e,t,n),$n=r):Xi(e,t,n);break;default:Xi(e,t,n)}}function HE(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new NI),t.forEach(function(r){var o=WI.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function ao(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=Gt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*LI(r/1960))-r,10e?16:e,ps===null)var r=!1;else{if(e=ps,ps=null,Ap=0,ft&6)throw Error(de(331));var o=ft;for(ft|=4,$e=e.current;$e!==null;){var i=$e,s=i.child;if($e.flags&16){var l=i.deletions;if(l!==null){for(var u=0;uGt()-Hw?Ra(e,0):Ww|=n),er(e,t)}function TR(e,t){t===0&&(e.mode&1?(t=eh,eh<<=1,!(eh&130023424)&&(eh=4194304)):t=1);var n=jn();e=Ci(e,t),e!==null&&(Td(e,t,n),er(e,n))}function VI(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),TR(e,n)}function WI(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(de(314))}r!==null&&r.delete(t),TR(e,n)}var kR;kR=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qn.current)qn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return qn=!1,AI(e,t,n);qn=!!(e.flags&131072)}else qn=!1,Nt&&t.flags&1048576&&O5(t,Sp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;zh(e,t),e=t.pendingProps;var o=ec(t,Rn.current);Nl(t,n),o=Fw(null,t,r,e,o,n);var i=jw();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jn(r)?(i=!0,xp(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Ow(t),o.updater=Sm,t.stateNode=o,o._reactInternals=t,Ry(t,r,e,n),t=ky(null,t,r,!0,i,n)):(t.tag=0,Nt&&i&&$w(t),In(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(zh(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=KI(r),e=co(r,e),o){case 0:t=Ty(null,t,r,e,n);break e;case 1:t=BE(null,t,r,e,n);break e;case 11:t=FE(null,t,r,e,n);break e;case 14:t=jE(null,t,r,co(r.type,e),n);break e}throw Error(de(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:co(r,o),Ty(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:co(r,o),BE(e,t,r,o,n);case 3:e:{if(hR(t),e===null)throw Error(de(387));r=t.pendingProps,i=t.memoizedState,o=i.element,L5(e,t),Cp(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=oc(Error(de(423)),t),t=zE(e,t,r,n,o);break e}else if(r!==o){o=oc(Error(de(424)),t),t=zE(e,t,r,n,o);break e}else for(gr=_s(t.stateNode.containerInfo.firstChild),vr=t,Nt=!0,go=null,n=z5(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(tc(),r===o){t=$i(e,t,n);break e}In(e,t,r,n)}t=t.child}return t;case 5:return U5(t),e===null&&Ey(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,wy(r,o)?s=null:i!==null&&wy(r,i)&&(t.flags|=32),fR(e,t),In(e,t,s,n),t.child;case 6:return e===null&&Ey(t),null;case 13:return pR(e,t,n);case 4:return Nw(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=nc(t,null,r,n):In(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:co(r,o),FE(e,t,r,o,n);case 7:return In(e,t,t.pendingProps,n),t.child;case 8:return In(e,t,t.pendingProps.children,n),t.child;case 12:return In(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,Rt(_p,r._currentValue),r._currentValue=s,i!==null)if(Eo(i.value,s)){if(i.children===o.children&&!Qn.current){t=$i(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=bi(-1,n&-n),u.tag=2;var f=i.updateQueue;if(f!==null){f=f.shared;var m=f.pending;m===null?u.next=u:(u.next=m.next,m.next=u),f.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Cy(i.return,n,t),l.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(de(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Cy(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}In(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Nl(t,n),o=qr(o),r=r(o),t.flags|=1,In(e,t,r,n),t.child;case 14:return r=t.type,o=co(r,t.pendingProps),o=co(r.type,o),jE(e,t,r,o,n);case 15:return uR(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:co(r,o),zh(e,t),t.tag=1,Jn(r)?(e=!0,xp(t)):e=!1,Nl(t,n),j5(t,r,o),Ry(t,r,o,n),ky(null,t,r,!0,e,n);case 19:return mR(e,t,n);case 22:return dR(e,t,n)}throw Error(de(156,t.tag))};function AR(e,t){return r5(e,t)}function HI(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kr(e,t,n,r){return new HI(e,t,n,r)}function Xw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function KI(e){if(typeof e=="function")return Xw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===pw)return 11;if(e===mw)return 14}return 2}function Rs(e,t){var n=e.alternate;return n===null?(n=Kr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Wh(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Xw(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case yl:return Pa(n.children,o,i,t);case hw:s=8,o|=8;break;case q0:return e=Kr(12,n,t,o|2),e.elementType=q0,e.lanes=i,e;case Q0:return e=Kr(13,n,t,o),e.elementType=Q0,e.lanes=i,e;case J0:return e=Kr(19,n,t,o),e.elementType=J0,e.lanes=i,e;case B$:return $m(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case F$:s=10;break e;case j$:s=9;break e;case pw:s=11;break e;case mw:s=14;break e;case ns:s=16,r=null;break e}throw Error(de(130,e==null?e:typeof e,""))}return t=Kr(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Pa(e,t,n,r){return e=Kr(7,e,r,t),e.lanes=n,e}function $m(e,t,n,r){return e=Kr(22,e,r,t),e.elementType=B$,e.lanes=n,e.stateNode={isHidden:!1},e}function h0(e,t,n){return e=Kr(6,e,null,t),e.lanes=n,e}function p0(e,t,n){return t=Kr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function GI(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yv(0),this.expirationTimes=Yv(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yv(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Zw(e,t,n,r,o,i,s,l,u){return e=new GI(e,t,n,l,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Kr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ow(i),e}function YI(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(DR)}catch(e){console.error(e)}}DR(),O$.exports=Sr;var Bs=O$.exports;const JI=pm(Bs);var JE=Bs;X0.createRoot=JE.createRoot,X0.hydrateRoot=JE.hydrateRoot;var Od=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},sc=typeof window>"u"||"Deno"in window;function Lr(){}function eL(e,t){return typeof e=="function"?e(t):e}function Uy(e){return typeof e=="number"&&e>=0&&e!==1/0}function IR(e,t){return Math.max(e+(t||0)-Date.now(),0)}function eC(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:l}=e;if(s){if(r){if(t.queryHash!==ex(s,t.options))return!1}else if(!nd(t.queryKey,s))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||typeof o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function tC(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(td(t.options.mutationKey)!==td(i))return!1}else if(!nd(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ex(e,t){return((t==null?void 0:t.queryKeyHashFn)||td)(e)}function td(e){return JSON.stringify(e,(t,n)=>Wy(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function nd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!nd(e[n],t[n])):!1}function LR(e,t){if(e===t)return e;const n=nC(e)&&nC(t);if(n||Wy(e)&&Wy(t)){const r=n?e.length:Object.keys(e).length,o=n?t:Object.keys(t),i=o.length,s=n?[]:{};let l=0;for(let u=0;u"u")return!0;const n=t.prototype;return!(!rC(n)||!n.hasOwnProperty("isPrototypeOf"))}function rC(e){return Object.prototype.toString.call(e)==="[object Object]"}function FR(e){return new Promise(t=>{setTimeout(t,e)})}function oC(e){FR(0).then(e)}function Hy(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?LR(e,t):t}function tL(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function nL(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ya,ss,Fl,p$,rL=(p$=class extends Od{constructor(){super();ke(this,ya,void 0);ke(this,ss,void 0);ke(this,Fl,void 0);we(this,Fl,t=>{if(!sc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){j(this,ss)||this.setEventListener(j(this,Fl))}onUnsubscribe(){var t;this.hasListeners()||((t=j(this,ss))==null||t.call(this),we(this,ss,void 0))}setEventListener(t){var n;we(this,Fl,t),(n=j(this,ss))==null||n.call(this),we(this,ss,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){j(this,ya)!==t&&(we(this,ya,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof j(this,ya)=="boolean"?j(this,ya):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ya=new WeakMap,ss=new WeakMap,Fl=new WeakMap,p$),Np=new rL,jl,as,Bl,m$,oL=(m$=class extends Od{constructor(){super();ke(this,jl,!0);ke(this,as,void 0);ke(this,Bl,void 0);we(this,Bl,t=>{if(!sc&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){j(this,as)||this.setEventListener(j(this,Bl))}onUnsubscribe(){var t;this.hasListeners()||((t=j(this,as))==null||t.call(this),we(this,as,void 0))}setEventListener(t){var n;we(this,Bl,t),(n=j(this,as))==null||n.call(this),we(this,as,t(this.setOnline.bind(this)))}setOnline(t){j(this,jl)!==t&&(we(this,jl,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return j(this,jl)}},jl=new WeakMap,as=new WeakMap,Bl=new WeakMap,m$),Dp=new oL;function iL(e){return Math.min(1e3*2**e,3e4)}function Am(e){return(e??"online")==="online"?Dp.isOnline():!0}var jR=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function m0(e){return e instanceof jR}function BR(e){let t=!1,n=0,r=!1,o,i,s;const l=new Promise((E,_)=>{i=E,s=_}),u=E=>{var _;r||(y(new jR(E)),(_=e.abort)==null||_.call(e))},f=()=>{t=!0},m=()=>{t=!1},p=()=>!Np.isFocused()||e.networkMode!=="always"&&!Dp.isOnline(),g=E=>{var _;r||(r=!0,(_=e.onSuccess)==null||_.call(e,E),o==null||o(),i(E))},y=E=>{var _;r||(r=!0,(_=e.onError)==null||_.call(e,E),o==null||o(),s(E))},x=()=>new Promise(E=>{var _;o=b=>{const C=r||!p();return C&&E(b),C},(_=e.onPause)==null||_.call(e)}).then(()=>{var E;o=void 0,r||(E=e.onContinue)==null||E.call(e)}),S=()=>{if(r)return;let E;try{E=e.fn()}catch(_){E=Promise.reject(_)}Promise.resolve(E).then(g).catch(_=>{var O;if(r)return;const b=e.retry??(sc?0:3),C=e.retryDelay??iL,R=typeof C=="function"?C(n,_):C,k=b===!0||typeof b=="number"&&n{if(p())return x()}).then(()=>{t?y(_):S()})})};return Am(e.networkMode)?S():x().then(S),{promise:l,cancel:u,continue:()=>(o==null?void 0:o())?l:Promise.resolve(),cancelRetry:f,continueRetry:m}}function sL(){let e=[],t=0,n=m=>{m()},r=m=>{m()};const o=m=>{let p;t++;try{p=m()}finally{t--,t||l()}return p},i=m=>{t?e.push(m):oC(()=>{n(m)})},s=m=>(...p)=>{i(()=>{m(...p)})},l=()=>{const m=e;e=[],m.length&&oC(()=>{r(()=>{m.forEach(p=>{n(p)})})})};return{batch:o,batchCalls:s,schedule:i,setNotifyFunction:m=>{n=m},setBatchNotifyFunction:m=>{r=m}}}var gn=sL(),wa,g$,zR=(g$=class{constructor(){ke(this,wa,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Uy(this.gcTime)&&we(this,wa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sc?1/0:5*60*1e3))}clearGcTimeout(){j(this,wa)&&(clearTimeout(j(this,wa)),we(this,wa,void 0))}},wa=new WeakMap,g$),zl,Ul,Nr,ls,Dr,cn,vd,xa,Vl,Hh,fo,pi,v$,aL=(v$=class extends zR{constructor(t){super();ke(this,Vl);ke(this,fo);ke(this,zl,void 0);ke(this,Ul,void 0);ke(this,Nr,void 0);ke(this,ls,void 0);ke(this,Dr,void 0);ke(this,cn,void 0);ke(this,vd,void 0);ke(this,xa,void 0);we(this,xa,!1),we(this,vd,t.defaultOptions),tt(this,Vl,Hh).call(this,t.options),we(this,cn,[]),we(this,Nr,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,we(this,zl,t.state||lL(this.options)),this.state=j(this,zl),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!j(this,cn).length&&this.state.fetchStatus==="idle"&&j(this,Nr).remove(this)}setData(t,n){const r=Hy(this.state.data,t,this.options);return tt(this,fo,pi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){tt(this,fo,pi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=j(this,ls);return(r=j(this,Dr))==null||r.cancel(t),n?n.then(Lr).catch(Lr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(j(this,zl))}isActive(){return j(this,cn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||j(this,cn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!IR(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=j(this,cn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=j(this,Dr))==null||n.continue()}onOnline(){var n;const t=j(this,cn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=j(this,Dr))==null||n.continue()}addObserver(t){j(this,cn).includes(t)||(j(this,cn).push(t),this.clearGcTimeout(),j(this,Nr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){j(this,cn).includes(t)&&(we(this,cn,j(this,cn).filter(n=>n!==t)),j(this,cn).length||(j(this,Dr)&&(j(this,xa)?j(this,Dr).cancel({revert:!0}):j(this,Dr).cancelRetry()),this.scheduleGc()),j(this,Nr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return j(this,cn).length}invalidate(){this.state.isInvalidated||tt(this,fo,pi).call(this,{type:"invalidate"})}fetch(t,n){var f,m,p,g;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(j(this,ls))return(f=j(this,Dr))==null||f.continueRetry(),j(this,ls)}if(t&&tt(this,Vl,Hh).call(this,t),!this.options.queryFn){const y=j(this,cn).find(x=>x.options.queryFn);y&&tt(this,Vl,Hh).call(this,y.options)}const r=new AbortController,o={queryKey:this.queryKey,meta:this.meta},i=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(we(this,xa,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(we(this,xa,!1),this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),l={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(l),(m=this.options.behavior)==null||m.onFetch(l,this),we(this,Ul,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=l.fetchOptions)==null?void 0:p.meta))&&tt(this,fo,pi).call(this,{type:"fetch",meta:(g=l.fetchOptions)==null?void 0:g.meta});const u=y=>{var x,S,E,_;m0(y)&&y.silent||tt(this,fo,pi).call(this,{type:"error",error:y}),m0(y)||((S=(x=j(this,Nr).config).onError)==null||S.call(x,y,this),(_=(E=j(this,Nr).config).onSettled)==null||_.call(E,this.state.data,y,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return we(this,Dr,BR({fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:y=>{var x,S,E,_;if(typeof y>"u"){u(new Error(`${this.queryHash} data is undefined`));return}this.setData(y),(S=(x=j(this,Nr).config).onSuccess)==null||S.call(x,y,this),(_=(E=j(this,Nr).config).onSettled)==null||_.call(E,y,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:u,onFail:(y,x)=>{tt(this,fo,pi).call(this,{type:"failed",failureCount:y,error:x})},onPause:()=>{tt(this,fo,pi).call(this,{type:"pause"})},onContinue:()=>{tt(this,fo,pi).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode})),we(this,ls,j(this,Dr).promise),j(this,ls)}},zl=new WeakMap,Ul=new WeakMap,Nr=new WeakMap,ls=new WeakMap,Dr=new WeakMap,cn=new WeakMap,vd=new WeakMap,xa=new WeakMap,Vl=new WeakSet,Hh=function(t){this.options={...j(this,vd),...t},this.updateGcTime(this.options.gcTime)},fo=new WeakSet,pi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:Am(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return m0(o)&&o.revert&&j(this,Ul)?{...j(this,Ul),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),gn.batch(()=>{j(this,cn).forEach(r=>{r.onQueryUpdate()}),j(this,Nr).notify({query:this,type:"updated",action:t})})},v$);function lL(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Do,y$,cL=(y$=class extends Od{constructor(t={}){super();ke(this,Do,void 0);this.config=t,we(this,Do,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??ex(o,n);let s=this.get(i);return s||(s=new aL({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){j(this,Do).has(t.queryHash)||(j(this,Do).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=j(this,Do).get(t.queryHash);n&&(t.destroy(),n===t&&j(this,Do).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){gn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return j(this,Do).get(t)}getAll(){return[...j(this,Do).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>eC(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>eC(t,r)):n}notify(t){gn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){gn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){gn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Do=new WeakMap,y$),Io,yd,fr,Wl,Lo,es,w$,uL=(w$=class extends zR{constructor(t){super();ke(this,Lo);ke(this,Io,void 0);ke(this,yd,void 0);ke(this,fr,void 0);ke(this,Wl,void 0);this.mutationId=t.mutationId,we(this,yd,t.defaultOptions),we(this,fr,t.mutationCache),we(this,Io,[]),this.state=t.state||dL(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...j(this,yd),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){j(this,Io).includes(t)||(j(this,Io).push(t),this.clearGcTimeout(),j(this,fr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){we(this,Io,j(this,Io).filter(n=>n!==t)),this.scheduleGc(),j(this,fr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){j(this,Io).length||(this.state.status==="pending"?this.scheduleGc():j(this,fr).remove(this))}continue(){var t;return((t=j(this,Wl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,l,u,f,m,p,g,y,x,S,E,_,b,C,R,k,O,A;const n=()=>(we(this,Wl,BR({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(I,z)=>{tt(this,Lo,es).call(this,{type:"failed",failureCount:I,error:z})},onPause:()=>{tt(this,Lo,es).call(this,{type:"pause"})},onContinue:()=>{tt(this,Lo,es).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),j(this,Wl).promise),r=this.state.status==="pending";try{if(!r){tt(this,Lo,es).call(this,{type:"pending",variables:t}),await((i=(o=j(this,fr).config).onMutate)==null?void 0:i.call(o,t,this));const z=await((l=(s=this.options).onMutate)==null?void 0:l.call(s,t));z!==this.state.context&&tt(this,Lo,es).call(this,{type:"pending",context:z,variables:t})}const I=await n();return await((f=(u=j(this,fr).config).onSuccess)==null?void 0:f.call(u,I,t,this.state.context,this)),await((p=(m=this.options).onSuccess)==null?void 0:p.call(m,I,t,this.state.context)),await((y=(g=j(this,fr).config).onSettled)==null?void 0:y.call(g,I,null,this.state.variables,this.state.context,this)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,I,null,t,this.state.context)),tt(this,Lo,es).call(this,{type:"success",data:I}),I}catch(I){try{throw await((_=(E=j(this,fr).config).onError)==null?void 0:_.call(E,I,t,this.state.context,this)),await((C=(b=this.options).onError)==null?void 0:C.call(b,I,t,this.state.context)),await((k=(R=j(this,fr).config).onSettled)==null?void 0:k.call(R,void 0,I,this.state.variables,this.state.context,this)),await((A=(O=this.options).onSettled)==null?void 0:A.call(O,void 0,I,t,this.state.context)),I}finally{tt(this,Lo,es).call(this,{type:"error",error:I})}}}},Io=new WeakMap,yd=new WeakMap,fr=new WeakMap,Wl=new WeakMap,Lo=new WeakSet,es=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!Am(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),gn.batch(()=>{j(this,Io).forEach(r=>{r.onMutationUpdate(t)}),j(this,fr).notify({mutation:this,type:"updated",action:t})})},w$);function dL(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ir,wd,ba,x$,fL=(x$=class extends Od{constructor(t={}){super();ke(this,Ir,void 0);ke(this,wd,void 0);ke(this,ba,void 0);this.config=t,we(this,Ir,[]),we(this,wd,0)}build(t,n,r){const o=new uL({mutationCache:this,mutationId:++Yf(this,wd)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){j(this,Ir).push(t),this.notify({type:"added",mutation:t})}remove(t){we(this,Ir,j(this,Ir).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){gn.batch(()=>{j(this,Ir).forEach(t=>{this.remove(t)})})}getAll(){return j(this,Ir)}find(t){const n={exact:!0,...t};return j(this,Ir).find(r=>tC(n,r))}findAll(t={}){return j(this,Ir).filter(n=>tC(t,n))}notify(t){gn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return we(this,ba,(j(this,ba)??Promise.resolve()).then(()=>{const t=j(this,Ir).filter(n=>n.state.isPaused);return gn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Lr)),Promise.resolve()))}).then(()=>{we(this,ba,void 0)})),j(this,ba)}},Ir=new WeakMap,wd=new WeakMap,ba=new WeakMap,x$);function hL(e){return{onFetch:(t,n)=>{const r=async()=>{var x,S,E,_,b;const o=t.options,i=(E=(S=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:S.fetchMore)==null?void 0:E.direction,s=((_=t.state.data)==null?void 0:_.pages)||[],l=((b=t.state.data)==null?void 0:b.pageParams)||[],u={pages:[],pageParams:[]};let f=!1;const m=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(t.signal.aborted?f=!0:t.signal.addEventListener("abort",()=>{f=!0}),t.signal)})},p=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),g=async(C,R,k)=>{if(f)return Promise.reject();if(R==null&&C.pages.length)return Promise.resolve(C);const O={queryKey:t.queryKey,pageParam:R,direction:k?"backward":"forward",meta:t.options.meta};m(O);const A=await p(O),{maxPages:I}=t.options,z=k?nL:tL;return{pages:z(C.pages,A,I),pageParams:z(C.pageParams,R,I)}};let y;if(i&&s.length){const C=i==="backward",R=C?pL:iC,k={pages:s,pageParams:l},O=R(o,k);y=await g(k,O,C)}else{y=await g(u,l[0]??o.initialPageParam);const C=e??s.length;for(let R=1;R{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function iC(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function pL(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var nn,cs,us,Hl,Kl,ds,Gl,Yl,b$,mL=(b$=class{constructor(e={}){ke(this,nn,void 0);ke(this,cs,void 0);ke(this,us,void 0);ke(this,Hl,void 0);ke(this,Kl,void 0);ke(this,ds,void 0);ke(this,Gl,void 0);ke(this,Yl,void 0);we(this,nn,e.queryCache||new cL),we(this,cs,e.mutationCache||new fL),we(this,us,e.defaultOptions||{}),we(this,Hl,new Map),we(this,Kl,new Map),we(this,ds,0)}mount(){Yf(this,ds)._++,j(this,ds)===1&&(we(this,Gl,Np.subscribe(()=>{Np.isFocused()&&(this.resumePausedMutations(),j(this,nn).onFocus())})),we(this,Yl,Dp.subscribe(()=>{Dp.isOnline()&&(this.resumePausedMutations(),j(this,nn).onOnline())})))}unmount(){var e,t;Yf(this,ds)._--,j(this,ds)===0&&((e=j(this,Gl))==null||e.call(this),we(this,Gl,void 0),(t=j(this,Yl))==null||t.call(this),we(this,Yl,void 0))}isFetching(e){return j(this,nn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return j(this,cs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=j(this,nn).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=j(this,nn).find({queryKey:e}),o=r==null?void 0:r.state.data,i=eL(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return j(this,nn).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return gn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=j(this,nn).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=j(this,nn);gn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=j(this,nn),r={type:"active",...e};return gn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=gn.batch(()=>j(this,nn).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Lr).catch(Lr)}invalidateQueries(e={},t={}){return gn.batch(()=>{if(j(this,nn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=gn.batch(()=>j(this,nn).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Lr)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Lr)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=j(this,nn).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Lr).catch(Lr)}fetchInfiniteQuery(e){return e.behavior=hL(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Lr).catch(Lr)}resumePausedMutations(){return j(this,cs).resumePausedMutations()}getQueryCache(){return j(this,nn)}getMutationCache(){return j(this,cs)}getDefaultOptions(){return j(this,us)}setDefaultOptions(e){we(this,us,e)}setQueryDefaults(e,t){j(this,Hl).set(td(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...j(this,Hl).values()];let n={};return t.forEach(r=>{nd(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){j(this,Kl).set(td(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...j(this,Kl).values()];let n={};return t.forEach(r=>{nd(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...j(this,us).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ex(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...j(this,us).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){j(this,nn).clear(),j(this,cs).clear()}},nn=new WeakMap,cs=new WeakMap,us=new WeakMap,Hl=new WeakMap,Kl=new WeakMap,ds=new WeakMap,Gl=new WeakMap,Yl=new WeakMap,b$),Gn,$t,Xl,Cn,Sa,Zl,Fo,xd,ql,Ql,_a,Ea,fs,Ca,$a,xu,bd,Ky,Sd,Gy,_d,Yy,Ed,Xy,Cd,Zy,$d,qy,Rd,Qy,hm,UR,S$,gL=(S$=class extends Od{constructor(t,n){super();ke(this,$a);ke(this,bd);ke(this,Sd);ke(this,_d);ke(this,Ed);ke(this,Cd);ke(this,$d);ke(this,Rd);ke(this,hm);ke(this,Gn,void 0);ke(this,$t,void 0);ke(this,Xl,void 0);ke(this,Cn,void 0);ke(this,Sa,void 0);ke(this,Zl,void 0);ke(this,Fo,void 0);ke(this,xd,void 0);ke(this,ql,void 0);ke(this,Ql,void 0);ke(this,_a,void 0);ke(this,Ea,void 0);ke(this,fs,void 0);ke(this,Ca,void 0);we(this,$t,void 0),we(this,Xl,void 0),we(this,Cn,void 0),we(this,Ca,new Set),we(this,Gn,t),this.options=n,we(this,Fo,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(j(this,$t).addObserver(this),sC(j(this,$t),this.options)?tt(this,$a,xu).call(this):this.updateResult(),tt(this,Ed,Xy).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Jy(j(this,$t),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Jy(j(this,$t),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,tt(this,Cd,Zy).call(this),tt(this,$d,qy).call(this),j(this,$t).removeObserver(this)}setOptions(t,n){const r=this.options,o=j(this,$t);if(this.options=j(this,Gn).defaultQueryOptions(t),Vy(r,this.options)||j(this,Gn).getQueryCache().notify({type:"observerOptionsUpdated",query:j(this,$t),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),tt(this,Rd,Qy).call(this);const i=this.hasListeners();i&&aC(j(this,$t),o,this.options,r)&&tt(this,$a,xu).call(this),this.updateResult(n),i&&(j(this,$t)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&tt(this,bd,Ky).call(this);const s=tt(this,Sd,Gy).call(this);i&&(j(this,$t)!==o||this.options.enabled!==r.enabled||s!==j(this,fs))&&tt(this,_d,Yy).call(this,s)}getOptimisticResult(t){const n=j(this,Gn).getQueryCache().build(j(this,Gn),t),r=this.createResult(n,t);return yL(this,r)&&(we(this,Cn,r),we(this,Zl,this.options),we(this,Sa,j(this,$t).state)),r}getCurrentResult(){return j(this,Cn)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(j(this,Ca).add(r),t[r])})}),n}getCurrentQuery(){return j(this,$t)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=j(this,Gn).defaultQueryOptions(t),r=j(this,Gn).getQueryCache().build(j(this,Gn),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return tt(this,$a,xu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),j(this,Cn)))}createResult(t,n){var O;const r=j(this,$t),o=this.options,i=j(this,Cn),s=j(this,Sa),l=j(this,Zl),f=t!==r?t.state:j(this,Xl),{state:m}=t;let{error:p,errorUpdatedAt:g,fetchStatus:y,status:x}=m,S=!1,E;if(n._optimisticResults){const A=this.hasListeners(),I=!A&&sC(t,n),z=A&&aC(t,r,n,o);(I||z)&&(y=Am(t.options.networkMode)?"fetching":"paused",m.dataUpdatedAt||(x="pending")),n._optimisticResults==="isRestoring"&&(y="idle")}if(n.select&&typeof m.data<"u")if(i&&m.data===(s==null?void 0:s.data)&&n.select===j(this,xd))E=j(this,ql);else try{we(this,xd,n.select),E=n.select(m.data),E=Hy(i==null?void 0:i.data,E,n),we(this,ql,E),we(this,Fo,null)}catch(A){we(this,Fo,A)}else E=m.data;if(typeof n.placeholderData<"u"&&typeof E>"u"&&x==="pending"){let A;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData))A=i.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((O=j(this,Ql))==null?void 0:O.state.data,j(this,Ql)):n.placeholderData,n.select&&typeof A<"u")try{A=n.select(A),we(this,Fo,null)}catch(I){we(this,Fo,I)}typeof A<"u"&&(x="success",E=Hy(i==null?void 0:i.data,A,n),S=!0)}j(this,Fo)&&(p=j(this,Fo),E=j(this,ql),g=Date.now(),x="error");const _=y==="fetching",b=x==="pending",C=x==="error",R=b&&_;return{status:x,fetchStatus:y,isPending:b,isSuccess:x==="success",isError:C,isInitialLoading:R,isLoading:R,data:E,dataUpdatedAt:m.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>f.dataUpdateCount||m.errorUpdateCount>f.errorUpdateCount,isFetching:_,isRefetching:_&&!b,isLoadingError:C&&m.dataUpdatedAt===0,isPaused:y==="paused",isPlaceholderData:S,isRefetchError:C&&m.dataUpdatedAt!==0,isStale:tx(t,n),refetch:this.refetch}}updateResult(t){const n=j(this,Cn),r=this.createResult(j(this,$t),this.options);if(we(this,Sa,j(this,$t).state),we(this,Zl,this.options),j(this,Sa).data!==void 0&&we(this,Ql,j(this,$t)),Vy(r,n))return;we(this,Cn,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,l=typeof s=="function"?s():s;if(l==="all"||!l&&!j(this,Ca).size)return!0;const u=new Set(l??j(this,Ca));return this.options.throwOnError&&u.add("error"),Object.keys(j(this,Cn)).some(f=>{const m=f;return j(this,Cn)[m]!==n[m]&&u.has(m)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),tt(this,hm,UR).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&tt(this,Ed,Xy).call(this)}},Gn=new WeakMap,$t=new WeakMap,Xl=new WeakMap,Cn=new WeakMap,Sa=new WeakMap,Zl=new WeakMap,Fo=new WeakMap,xd=new WeakMap,ql=new WeakMap,Ql=new WeakMap,_a=new WeakMap,Ea=new WeakMap,fs=new WeakMap,Ca=new WeakMap,$a=new WeakSet,xu=function(t){tt(this,Rd,Qy).call(this);let n=j(this,$t).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Lr)),n},bd=new WeakSet,Ky=function(){if(tt(this,Cd,Zy).call(this),sc||j(this,Cn).isStale||!Uy(this.options.staleTime))return;const n=IR(j(this,Cn).dataUpdatedAt,this.options.staleTime)+1;we(this,_a,setTimeout(()=>{j(this,Cn).isStale||this.updateResult()},n))},Sd=new WeakSet,Gy=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(j(this,$t)):this.options.refetchInterval)??!1},_d=new WeakSet,Yy=function(t){tt(this,$d,qy).call(this),we(this,fs,t),!(sc||this.options.enabled===!1||!Uy(j(this,fs))||j(this,fs)===0)&&we(this,Ea,setInterval(()=>{(this.options.refetchIntervalInBackground||Np.isFocused())&&tt(this,$a,xu).call(this)},j(this,fs)))},Ed=new WeakSet,Xy=function(){tt(this,bd,Ky).call(this),tt(this,_d,Yy).call(this,tt(this,Sd,Gy).call(this))},Cd=new WeakSet,Zy=function(){j(this,_a)&&(clearTimeout(j(this,_a)),we(this,_a,void 0))},$d=new WeakSet,qy=function(){j(this,Ea)&&(clearInterval(j(this,Ea)),we(this,Ea,void 0))},Rd=new WeakSet,Qy=function(){const t=j(this,Gn).getQueryCache().build(j(this,Gn),this.options);if(t===j(this,$t))return;const n=j(this,$t);we(this,$t,t),we(this,Xl,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},hm=new WeakSet,UR=function(t){gn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(j(this,Cn))}),j(this,Gn).getQueryCache().notify({query:j(this,$t),type:"observerResultsUpdated"})})},S$);function vL(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function sC(e,t){return vL(e,t)||e.state.dataUpdatedAt>0&&Jy(e,t,t.refetchOnMount)}function Jy(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&tx(e,t)}return!1}function aC(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&tx(e,n)}function tx(e,t){return e.isStaleByTime(t.staleTime)}function yL(e,t){return!Vy(e.getCurrentResult(),t)}var VR=d.createContext(void 0),wL=e=>{const t=d.useContext(VR);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},xL=({client:e,children:t})=>(d.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),d.createElement(VR.Provider,{value:e},t)),WR=d.createContext(!1),bL=()=>d.useContext(WR);WR.Provider;function SL(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var _L=d.createContext(SL()),EL=()=>d.useContext(_L);function CL(e,t){return typeof e=="function"?e(...t):!!e}var $L=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},RL=e=>{d.useEffect(()=>{e.clearReset()},[e])},PL=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&CL(n,[e.error,r]),TL=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},kL=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,AL=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function ML(e,t,n){const r=wL(n),o=bL(),i=EL(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",TL(s),$L(s,i),RL(i);const[l]=d.useState(()=>new t(r,s)),u=l.getOptimisticResult(s);if(d.useSyncExternalStore(d.useCallback(f=>{const m=o?()=>{}:l.subscribe(gn.batchCalls(f));return l.updateResult(),m},[l,o]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),d.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),kL(s,u))throw l.setOptions(s,{listeners:!1}),AL(s,l,i);if(PL({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:l.getCurrentQuery()}))throw u.error;return s.notifyOnChangeProps?u:l.trackResult(u)}function OL(e,t){return ML(e,gL,t)}var Oo=(e=>(e.RemoveBG="RemoveBG",e.AnimeSeg="AnimeSeg",e.RealESRGAN="RealESRGAN",e.GFPGAN="GFPGAN",e.RestoreFormer="RestoreFormer",e.InteractiveSeg="InteractiveSeg",e))(Oo||{}),Ps=(e=>(e.NAME="name",e.CTIME="ctime",e.MTIME="mtime",e))(Ps||{}),Ou=(e=>(e.DESCENDING="desc",e.ASCENDING="asc",e))(Ou||{}),nx=(e=>(e.ddim="ddim",e.plms="plms",e))(nx||{}),rx=(e=>(e.INPAINT_NS="INPAINT_NS",e.INPAINT_TELEA="INPAINT_TELEA",e))(rx||{}),Ln=(e=>(e.x="x",e.y="y",e.xy="xy",e))(Ln||{}),ma=(e=>(e.text_guided="text-guided",e.shape_guided="shape-guided",e.context_aware="context-aware",e.object_remove="object-remove",e.outpainting="outpainting",e))(ma||{});function HR(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tl(i)))==null?void 0:s.classGroupId}const lC=/^\[(.+)\]$/;function DL(e){if(lC.test(e)){const t=lC.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function IL(e){const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return FL(Object.entries(e.classGroups),n).forEach(([i,s])=>{e1(s,r,i,t)}),r}function e1(e,t,n,r){e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:cC(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(LL(o)){e1(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{e1(s,cC(t,i),n,r)})})}function cC(e,t){let n=e;return t.split(ox).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function LL(e){return e.isThemeGetter}function FL(e,t){return t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,l])=>[t+s,l])):i);return[n,o]}):e}function jL(e){if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;function 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)}}}const YR="!";function BL(e){const t=e.separator,n=t.length===1,r=t[0],o=t.length;return function(s){const l=[];let u=0,f=0,m;for(let S=0;Sf?m-f:void 0;return{modifiers:l,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:x}}}function zL(e){if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t}function UL(e){return{cache:jL(e.cacheSize),splitModifiers:BL(e),...NL(e)}}const VL=/\s+/;function WL(e,t){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=new Set;return e.trim().split(VL).map(s=>{const{modifiers:l,hasImportantModifier:u,baseClassName:f,maybePostfixModifierPosition:m}=n(s);let p=r(m?f.substring(0,m):f),g=!!m;if(!p){if(!m)return{isTailwindClass:!1,originalClassName:s};if(p=r(f),!p)return{isTailwindClass:!1,originalClassName:s};g=!1}const y=zL(l).join(":");return{isTailwindClass:!0,modifierId:u?y+YR:y,classGroupId:p,originalClassName:s,hasPostfixModifier:g}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:l,classGroupId:u,hasPostfixModifier:f}=s,m=l+u;return i.has(m)?!1:(i.add(m),o(u,f).forEach(p=>i.add(l+p)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function HL(){let e=0,t,n,r="";for(;ep(m),e());return n=UL(f),r=n.cache.get,o=n.cache.set,i=l,l(u)}function l(u){const f=r(u);if(f)return f;const m=WL(u,n);return o(u,m),m}return function(){return i(HL.apply(null,arguments))}}function Tt(e){const t=n=>n[e]||[];return t.isThemeGetter=!0,t}const ZR=/^\[(?:([a-z-]+):)?(.+)\]$/i,GL=/^\d+\/\d+$/,YL=new Set(["px","full","screen"]),XL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZL=/\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$/,qL=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,QL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function lo(e){return ga(e)||YL.has(e)||GL.test(e)}function Zi(e){return _c(e,"length",sF)}function ga(e){return!!e&&!Number.isNaN(Number(e))}function fh(e){return _c(e,"number",ga)}function au(e){return!!e&&Number.isInteger(Number(e))}function JL(e){return e.endsWith("%")&&ga(e.slice(0,-1))}function Je(e){return ZR.test(e)}function qi(e){return XL.test(e)}const eF=new Set(["length","size","percentage"]);function tF(e){return _c(e,eF,qR)}function nF(e){return _c(e,"position",qR)}const rF=new Set(["image","url"]);function oF(e){return _c(e,rF,lF)}function iF(e){return _c(e,"",aF)}function lu(){return!0}function _c(e,t,n){const r=ZR.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1}function sF(e){return ZL.test(e)}function qR(){return!1}function aF(e){return qL.test(e)}function lF(e){return QL.test(e)}function cF(){const e=Tt("colors"),t=Tt("spacing"),n=Tt("blur"),r=Tt("brightness"),o=Tt("borderColor"),i=Tt("borderRadius"),s=Tt("borderSpacing"),l=Tt("borderWidth"),u=Tt("contrast"),f=Tt("grayscale"),m=Tt("hueRotate"),p=Tt("invert"),g=Tt("gap"),y=Tt("gradientColorStops"),x=Tt("gradientColorStopPositions"),S=Tt("inset"),E=Tt("margin"),_=Tt("opacity"),b=Tt("padding"),C=Tt("saturate"),R=Tt("scale"),k=Tt("sepia"),O=Tt("skew"),A=Tt("space"),I=Tt("translate"),z=()=>["auto","contain","none"],H=()=>["auto","hidden","clip","visible","scroll"],ie=()=>["auto",Je,t],K=()=>[Je,t],te=()=>["",lo,Zi],U=()=>["auto",ga,Je],re=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],G=()=>["start","end","center","between","around","evenly","stretch"],Z=()=>["","0",Je],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],le=()=>[ga,fh],L=()=>[ga,Je];return{cacheSize:500,separator:":",theme:{colors:[lu],spacing:[lo,Zi],blur:["none","",qi,Je],brightness:le(),borderColor:[e],borderRadius:["none","","full",qi,Je],borderSpacing:K(),borderWidth:te(),contrast:le(),grayscale:Z(),hueRotate:L(),invert:Z(),gap:K(),gradientColorStops:[e],gradientColorStopPositions:[JL,Zi],inset:ie(),margin:ie(),opacity:le(),padding:K(),saturate:le(),scale:le(),sepia:Z(),skew:L(),space:K(),translate:K()},classGroups:{aspect:[{aspect:["auto","square","video",Je]}],container:["container"],columns:[{columns:[qi]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...re(),Je]}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",au,Je]}],basis:[{basis:ie()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Je]}],grow:[{grow:Z()}],shrink:[{shrink:Z()}],order:[{order:["first","last","none",au,Je]}],"grid-cols":[{"grid-cols":[lu]}],"col-start-end":[{col:["auto",{span:["full",au,Je]},Je]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[lu]}],"row-start-end":[{row:["auto",{span:[au,Je]},Je]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Je]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Je]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...G()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...G(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...G(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[E]}],mx:[{mx:[E]}],my:[{my:[E]}],ms:[{ms:[E]}],me:[{me:[E]}],mt:[{mt:[E]}],mr:[{mr:[E]}],mb:[{mb:[E]}],ml:[{ml:[E]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",Je,t]}],"min-w":[{"min-w":["min","max","fit",Je,lo]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[qi]},qi,Je]}],h:[{h:[Je,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",lo,Je]}],"max-h":[{"max-h":[Je,t,"min","max","fit"]}],"font-size":[{text:["base",qi,Zi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fh]}],"font-family":[{font:[lu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Je]}],"line-clamp":[{"line-clamp":["none",ga,fh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",lo,Je]}],"list-image":[{"list-image":["none",Je]}],"list-style-type":[{list:["none","disc","decimal",Je]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",lo,Zi]}],"underline-offset":[{"underline-offset":["auto",lo,Je]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:K()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...re(),nF]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tF]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},oF]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:V()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[lo,Je]}],"outline-w":[{outline:[lo,Zi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[lo,Zi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",qi,iF]}],"shadow-color":[{shadow:[lu]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":J()}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",qi,Je]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[p]}],saturate:[{saturate:[C]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[C]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Je]}],duration:[{duration:L()}],ease:[{ease:["linear","in","out","in-out",Je]}],delay:[{delay:L()}],animate:[{animate:["none","spin","ping","pulse","bounce",Je]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[au,Je]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Je]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],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",Je]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":K()}],"scroll-mx":[{"scroll-mx":K()}],"scroll-my":[{"scroll-my":K()}],"scroll-ms":[{"scroll-ms":K()}],"scroll-me":[{"scroll-me":K()}],"scroll-mt":[{"scroll-mt":K()}],"scroll-mr":[{"scroll-mr":K()}],"scroll-mb":[{"scroll-mb":K()}],"scroll-ml":[{"scroll-ml":K()}],"scroll-p":[{"scroll-p":K()}],"scroll-px":[{"scroll-px":K()}],"scroll-py":[{"scroll-py":K()}],"scroll-ps":[{"scroll-ps":K()}],"scroll-pe":[{"scroll-pe":K()}],"scroll-pt":[{"scroll-pt":K()}],"scroll-pr":[{"scroll-pr":K()}],"scroll-pb":[{"scroll-pb":K()}],"scroll-pl":[{"scroll-pl":K()}],"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",Je]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[lo,Zi,fh]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},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"],"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"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const ix=KL(cF),uF=40,dF=3,QR=200,ms="inpaint",hh="diffusers_sd",uC="diffusers_sdxl",ph="diffusers_sd_inpaint",dC="diffusers_sdxl_inpaint",g0="diffusers_other",Kh="#ffcc00bb",fC="ldm",hC="cv2",JR="Fantasy-Studio/Paint-by-Example",fF="timbrooks/instruct-pix2pix",hF="Sanster/PowerPaint-V1-stable-diffusion-inpainting",pF="Sanster/AnyText",mF="out of frame, lowres, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, disfigured, gross proportions, malformed limbs, watermark, signature";function xe(...e){return ix(KR(e))}function gF(){async function e(r=""){return(await fetch(r,{method:"GET",cache:"no-cache"})).json()}const t=()=>{const r=document.location;e(r+"/flaskwebgui-keep-server-alive").then(i=>i)},n=3*1e3;t(),setInterval(t,n)}function pC(e){const t=e.split(",")[0].split(":")[1].split(";")[0],n=atob(e.split(",")[1]),r=[];for(let o=0;o{const o=e.src,i=e;i.onload=n,i.onerror=s=>{i.src=o,r(s)},i.src=t})}async function vF(e){const t=URL.createObjectURL(e),n=new Image;return await bu(n,t),n}function mC(e){return new Promise((t,n)=>{const r=new Image;r.addEventListener("load",()=>{t(r)}),r.addEventListener("error",o=>{n(o)}),r.src=e.toDataURL()})}function yF(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const o=new Image;o.onload=()=>{t(o)},o.onerror=()=>{n("无法加载图像。")},o.src=r.result},r.onerror=()=>{n("无法读取文件。")},r.readAsDataURL(e)})}function Nu(e,t,n){return fetch(e).then(function(r){return r.arrayBuffer()}).then(function(r){return new File([r],t,{type:n})})}async function wF(){try{const{state:e}=await navigator.permissions.query({name:"clipboard-write"});return e==="granted"}catch{return!1}}function xF(e,t){return new Promise((n,r)=>e.toBlob(async o=>{o?n(o):r(new Error("Expected toBlob() to be defined"))},t))}const bF=async e=>{const t=[new ClipboardItem({[e.type]:e})];await navigator.clipboard.write(t)};function gC(e){return e.nativeEvent.button===2}function vC(e){return e.nativeEvent.button===1}async function SF(e){const t=await xF(e,"image/png");try{await bF(t)}catch{console.log("Copy image failed!")}}function _F(e,t){const n=document.createElement("a");n.href=e,n.download=t,n.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window})),setTimeout(()=>{n.remove()},100)}function v0(e){const t=e.nativeEvent;if("touches"in e){const n=e.target.getBoundingClientRect(),o=e.touches[0];return{x:(o.clientX-n.x)/n.width*o.target.offsetWidth,y:(o.clientY-n.y)/n.height*o.target.offsetHeight}}return{x:t.offsetX,y:t.offsetY}}function eP(e,t,n=Kh){e.strokeStyle=n,e.lineCap="round",e.lineJoin="round",t.forEach(r=>{!(r!=null&&r.pts.length)||!r.size||(e.lineWidth=r.size,e.beginPath(),e.moveTo(r.pts[0].x,r.pts[0].y),r.pts.forEach(o=>e.lineTo(o.x,o.y)),e.stroke())})}const Gh=(e,t,n,r=[],o="white")=>{const i=document.createElement("canvas");i.width=e,i.height=t;const s=i.getContext("2d");if(!s)throw new Error("could not retrieve mask canvas");return r.forEach(l=>{s.drawImage(l,0,0,e,t)}),n.forEach(l=>{eP(s,l,o)}),i},Du=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=o=>{var s;const i=(s=o.target)==null?void 0:s.result;t(i)},r.onerror=o=>{n(o)},r.readAsDataURL(e)});function tP(e,t){return function(){return e.apply(t,arguments)}}const{toString:EF}=Object.prototype,{getPrototypeOf:sx}=Object,Mm=(e=>t=>{const n=EF.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ni=e=>(e=e.toLowerCase(),t=>Mm(t)===e),Om=e=>t=>typeof t===e,{isArray:Ec}=Array,rd=Om("undefined");function CF(e){return e!==null&&!rd(e)&&e.constructor!==null&&!rd(e.constructor)&&Zr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const nP=ni("ArrayBuffer");function $F(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&nP(e.buffer),t}const RF=Om("string"),Zr=Om("function"),rP=Om("number"),Nm=e=>e!==null&&typeof e=="object",PF=e=>e===!0||e===!1,Yh=e=>{if(Mm(e)!=="object")return!1;const t=sx(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},TF=ni("Date"),kF=ni("File"),AF=ni("Blob"),MF=ni("FileList"),OF=e=>Nm(e)&&Zr(e.pipe),NF=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Zr(e.append)&&((t=Mm(e))==="formdata"||t==="object"&&Zr(e.toString)&&e.toString()==="[object FormData]"))},DF=ni("URLSearchParams"),IF=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Nd(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!="object"&&(e=[e]),Ec(e))for(r=0,o=e.length;r0;)if(o=n[r],t===o.toLowerCase())return o;return null}const iP=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,sP=e=>!rd(e)&&e!==iP;function t1(){const{caseless:e}=sP(this)&&this||{},t={},n=(r,o)=>{const i=e&&oP(t,o)||o;Yh(t[i])&&Yh(r)?t[i]=t1(t[i],r):Yh(r)?t[i]=t1({},r):Ec(r)?t[i]=r.slice():t[i]=r};for(let r=0,o=arguments.length;r(Nd(t,(o,i)=>{n&&Zr(o)?e[i]=tP(o,n):e[i]=o},{allOwnKeys:r}),e),FF=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),jF=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},BF=(e,t,n,r)=>{let o,i,s;const l={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)s=o[i],(!r||r(s,e,t))&&!l[s]&&(t[s]=e[s],l[s]=!0);e=n!==!1&&sx(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},zF=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},UF=e=>{if(!e)return null;if(Ec(e))return e;let t=e.length;if(!rP(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},VF=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&sx(Uint8Array)),WF=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=r.next())&&!o.done;){const i=o.value;t.call(e,i[0],i[1])}},HF=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},KF=ni("HTMLFormElement"),GF=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),yC=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),YF=ni("RegExp"),aP=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Nd(n,(o,i)=>{let s;(s=t(o,i,e))!==!1&&(r[i]=s||o)}),Object.defineProperties(e,r)},XF=e=>{aP(e,(t,n)=>{if(Zr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Zr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},ZF=(e,t)=>{const n={},r=o=>{o.forEach(i=>{n[i]=!0})};return Ec(e)?r(e):r(String(e).split(t)),n},qF=()=>{},QF=(e,t)=>(e=+e,Number.isFinite(e)?e:t),y0="abcdefghijklmnopqrstuvwxyz",wC="0123456789",lP={DIGIT:wC,ALPHA:y0,ALPHA_DIGIT:y0+y0.toUpperCase()+wC},JF=(e=16,t=lP.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function ej(e){return!!(e&&Zr(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const tj=e=>{const t=new Array(10),n=(r,o)=>{if(Nm(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;const i=Ec(r)?[]:{};return Nd(r,(s,l)=>{const u=n(s,o+1);!rd(u)&&(i[l]=u)}),t[o]=void 0,i}}return r};return n(e,0)},nj=ni("AsyncFunction"),rj=e=>e&&(Nm(e)||Zr(e))&&Zr(e.then)&&Zr(e.catch),ae={isArray:Ec,isArrayBuffer:nP,isBuffer:CF,isFormData:NF,isArrayBufferView:$F,isString:RF,isNumber:rP,isBoolean:PF,isObject:Nm,isPlainObject:Yh,isUndefined:rd,isDate:TF,isFile:kF,isBlob:AF,isRegExp:YF,isFunction:Zr,isStream:OF,isURLSearchParams:DF,isTypedArray:VF,isFileList:MF,forEach:Nd,merge:t1,extend:LF,trim:IF,stripBOM:FF,inherits:jF,toFlatObject:BF,kindOf:Mm,kindOfTest:ni,endsWith:zF,toArray:UF,forEachEntry:WF,matchAll:HF,isHTMLForm:KF,hasOwnProperty:yC,hasOwnProp:yC,reduceDescriptors:aP,freezeMethods:XF,toObjectSet:ZF,toCamelCase:GF,noop:qF,toFiniteNumber:QF,findKey:oP,global:iP,isContextDefined:sP,ALPHABET:lP,generateString:JF,isSpecCompliantForm:ej,toJSONObject:tj,isAsyncFn:nj,isThenable:rj};function ct(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}ae.inherits(ct,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ae.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const cP=ct.prototype,uP={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{uP[e]={value:e}});Object.defineProperties(ct,uP);Object.defineProperty(cP,"isAxiosError",{value:!0});ct.from=(e,t,n,r,o,i)=>{const s=Object.create(cP);return ae.toFlatObject(e,s,function(u){return u!==Error.prototype},l=>l!=="isAxiosError"),ct.call(s,e.message,t,n,r,o),s.cause=e,s.name=e.name,i&&Object.assign(s,i),s};const oj=null;function n1(e){return ae.isPlainObject(e)||ae.isArray(e)}function dP(e){return ae.endsWith(e,"[]")?e.slice(0,-2):e}function xC(e,t,n){return e?e.concat(t).map(function(o,i){return o=dP(o),!n&&i?"["+o+"]":o}).join(n?".":""):t}function ij(e){return ae.isArray(e)&&!e.some(n1)}const sj=ae.toFlatObject(ae,{},null,function(t){return/^is[A-Z]/.test(t)});function Dm(e,t,n){if(!ae.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ae.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,E){return!ae.isUndefined(E[S])});const r=n.metaTokens,o=n.visitor||m,i=n.dots,s=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&ae.isSpecCompliantForm(t);if(!ae.isFunction(o))throw new TypeError("visitor must be a function");function f(x){if(x===null)return"";if(ae.isDate(x))return x.toISOString();if(!u&&ae.isBlob(x))throw new ct("Blob is not supported. Use a Buffer instead.");return ae.isArrayBuffer(x)||ae.isTypedArray(x)?u&&typeof Blob=="function"?new Blob([x]):Buffer.from(x):x}function m(x,S,E){let _=x;if(x&&!E&&typeof x=="object"){if(ae.endsWith(S,"{}"))S=r?S:S.slice(0,-2),x=JSON.stringify(x);else if(ae.isArray(x)&&ij(x)||(ae.isFileList(x)||ae.endsWith(S,"[]"))&&(_=ae.toArray(x)))return S=dP(S),_.forEach(function(C,R){!(ae.isUndefined(C)||C===null)&&t.append(s===!0?xC([S],R,i):s===null?S:S+"[]",f(C))}),!1}return n1(x)?!0:(t.append(xC(E,S,i),f(x)),!1)}const p=[],g=Object.assign(sj,{defaultVisitor:m,convertValue:f,isVisitable:n1});function y(x,S){if(!ae.isUndefined(x)){if(p.indexOf(x)!==-1)throw Error("Circular reference detected in "+S.join("."));p.push(x),ae.forEach(x,function(_,b){(!(ae.isUndefined(_)||_===null)&&o.call(t,_,ae.isString(b)?b.trim():b,S,g))===!0&&y(_,S?S.concat(b):[b])}),p.pop()}}if(!ae.isObject(e))throw new TypeError("data must be an object");return y(e),t}function bC(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ax(e,t){this._pairs=[],e&&Dm(e,this,t)}const fP=ax.prototype;fP.append=function(t,n){this._pairs.push([t,n])};fP.toString=function(t){const n=t?function(r){return t.call(this,r,bC)}:bC;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function aj(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function hP(e,t,n){if(!t)return e;const r=n&&n.encode||aj,o=n&&n.serialize;let i;if(o?i=o(t,n):i=ae.isURLSearchParams(t)?t.toString():new ax(t,n).toString(r),i){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class lj{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ae.forEach(this.handlers,function(r){r!==null&&t(r)})}}const SC=lj,pP={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},cj=typeof URLSearchParams<"u"?URLSearchParams:ax,uj=typeof FormData<"u"?FormData:null,dj=typeof Blob<"u"?Blob:null,fj={isBrowser:!0,classes:{URLSearchParams:cj,FormData:uj,Blob:dj},protocols:["http","https","file","blob","url","data"]},mP=typeof window<"u"&&typeof document<"u",hj=(e=>mP&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),pj=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",mj=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:mP,hasStandardBrowserEnv:hj,hasStandardBrowserWebWorkerEnv:pj},Symbol.toStringTag,{value:"Module"})),Wo={...mj,...fj};function gj(e,t){return Dm(e,new Wo.classes.URLSearchParams,Object.assign({visitor:function(n,r,o,i){return Wo.isNode&&ae.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function vj(e){return ae.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function yj(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r=n.length;return s=!s&&ae.isArray(o)?o.length:s,u?(ae.hasOwnProp(o,s)?o[s]=[o[s],r]:o[s]=r,!l):((!o[s]||!ae.isObject(o[s]))&&(o[s]=[]),t(n,r,o[s],i)&&ae.isArray(o[s])&&(o[s]=yj(o[s])),!l)}if(ae.isFormData(e)&&ae.isFunction(e.entries)){const n={};return ae.forEachEntry(e,(r,o)=>{t(vj(r),o,n,0)}),n}return null}function wj(e,t,n){if(ae.isString(e))try{return(t||JSON.parse)(e),ae.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const lx={transitional:pP,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,i=ae.isObject(t);if(i&&ae.isHTMLForm(t)&&(t=new FormData(t)),ae.isFormData(t))return o&&o?JSON.stringify(gP(t)):t;if(ae.isArrayBuffer(t)||ae.isBuffer(t)||ae.isStream(t)||ae.isFile(t)||ae.isBlob(t))return t;if(ae.isArrayBufferView(t))return t.buffer;if(ae.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return gj(t,this.formSerializer).toString();if((l=ae.isFileList(t))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Dm(l?{"files[]":t}:t,u&&new u,this.formSerializer)}}return i||o?(n.setContentType("application/json",!1),wj(t)):t}],transformResponse:[function(t){const n=this.transitional||lx.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(t&&ae.isString(t)&&(r&&!this.responseType||o)){const s=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(l){if(s)throw l.name==="SyntaxError"?ct.from(l,ct.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Wo.classes.FormData,Blob:Wo.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],e=>{lx.headers[e]={}});const cx=lx,xj=ae.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),bj=e=>{const t={};let n,r,o;return e&&e.split(` `).forEach(function(s){o=s.indexOf(":"),n=s.substring(0,o).trim().toLowerCase(),r=s.substring(o+1).trim(),!(!n||t[n]&&xj[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},_C=Symbol("internals");function cu(e){return e&&String(e).trim().toLowerCase()}function Xh(e){return e===!1||e==null?e:ae.isArray(e)?e.map(Xh):String(e)}function Sj(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const _j=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function w0(e,t,n,r,o){if(ae.isFunction(r))return r.call(this,t,n);if(o&&(t=n),!!ae.isString(t)){if(ae.isString(r))return t.indexOf(r)!==-1;if(ae.isRegExp(r))return r.test(t)}}function Ej(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Cj(e,t){const n=ae.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(o,i,s){return this[r].call(this,t,o,i,s)},configurable:!0})})}class Im{constructor(t){t&&this.set(t)}set(t,n,r){const o=this;function i(l,u,f){const m=cu(u);if(!m)throw new Error("header name must be a non-empty string");const p=ae.findKey(o,m);(!p||o[p]===void 0||f===!0||f===void 0&&o[p]!==!1)&&(o[p||u]=Xh(l))}const s=(l,u)=>ae.forEach(l,(f,m)=>i(f,m,u));return ae.isPlainObject(t)||t instanceof this.constructor?s(t,n):ae.isString(t)&&(t=t.trim())&&!_j(t)?s(bj(t),n):t!=null&&i(n,t,r),this}get(t,n){if(t=cu(t),t){const r=ae.findKey(this,t);if(r){const o=this[r];if(!n)return o;if(n===!0)return Sj(o);if(ae.isFunction(n))return n.call(this,o,r);if(ae.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=cu(t),t){const r=ae.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||w0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let o=!1;function i(s){if(s=cu(s),s){const l=ae.findKey(r,s);l&&(!n||w0(r,r[l],l,n))&&(delete r[l],o=!0)}}return ae.isArray(t)?t.forEach(i):i(t),o}clear(t){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const i=n[r];(!t||w0(this,this[i],i,t,!0))&&(delete this[i],o=!0)}return o}normalize(t){const n=this,r={};return ae.forEach(this,(o,i)=>{const s=ae.findKey(r,i);if(s){n[s]=Xh(o),delete n[i];return}const l=t?Ej(i):String(i).trim();l!==i&&delete n[i],n[l]=Xh(o),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ae.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=t&&ae.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[_C]=this[_C]={accessors:{}}).accessors,o=this.prototype;function i(s){const l=cu(s);r[l]||(Cj(o,s),r[l]=!0)}return ae.isArray(t)?t.forEach(i):i(t),this}}Im.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ae.reduceDescriptors(Im.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});ae.freezeMethods(Im);const Si=Im;function x0(e,t){const n=this||cx,r=t||n,o=Si.from(r.headers);let i=r.data;return ae.forEach(e,function(l){i=l.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function vP(e){return!!(e&&e.__CANCEL__)}function Dd(e,t,n){ct.call(this,e??"canceled",ct.ERR_CANCELED,t,n),this.name="CanceledError"}ae.inherits(Dd,ct,{__CANCEL__:!0});function $j(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new ct("Request failed with status code "+n.status,[ct.ERR_BAD_REQUEST,ct.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const Rj=Wo.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];ae.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ae.isString(r)&&s.push("path="+r),ae.isString(o)&&s.push("domain="+o),i===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Pj(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Tj(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function yP(e,t){return e&&!Pj(t)?Tj(e,t):t}const kj=Wo.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(i){let s=i;return t&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(s){const l=ae.isString(s)?o(s):s;return l.protocol===r.protocol&&l.host===r.host}}():function(){return function(){return!0}}();function Aj(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Mj(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,i=0,s;return t=t!==void 0?t:1e3,function(u){const f=Date.now(),m=r[i];s||(s=f),n[o]=u,r[o]=f;let p=i,g=0;for(;p!==o;)g+=n[p++],p=p%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),f-s{const i=o.loaded,s=o.lengthComputable?o.total:void 0,l=i-n,u=r(l),f=i<=s;n=i;const m={loaded:i,total:s,progress:s?i/s:void 0,bytes:l,rate:u||void 0,estimated:u&&s&&f?(s-i)/u:void 0,event:o};m[t?"download":"upload"]=!0,e(m)}}const Oj=typeof XMLHttpRequest<"u",Nj=Oj&&function(e){return new Promise(function(n,r){let o=e.data;const i=Si.from(e.headers).normalize();let{responseType:s,withXSRFToken:l}=e,u;function f(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}let m;if(ae.isFormData(o)){if(Wo.hasStandardBrowserEnv||Wo.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if((m=i.getContentType())!==!1){const[S,...E]=m?m.split(";").map(_=>_.trim()).filter(Boolean):[];i.setContentType([S||"multipart/form-data",...E].join("; "))}}let p=new XMLHttpRequest;if(e.auth){const S=e.auth.username||"",E=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(S+":"+E))}const g=yP(e.baseURL,e.url);p.open(e.method.toUpperCase(),hP(g,e.params,e.paramsSerializer),!0),p.timeout=e.timeout;function y(){if(!p)return;const S=Si.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),_={data:!s||s==="text"||s==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:S,config:e,request:p};$j(function(C){n(C),f()},function(C){r(C),f()},_),p=null}if("onloadend"in p?p.onloadend=y:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(y)},p.onabort=function(){p&&(r(new ct("Request aborted",ct.ECONNABORTED,e,p)),p=null)},p.onerror=function(){r(new ct("Network Error",ct.ERR_NETWORK,e,p)),p=null},p.ontimeout=function(){let E=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const _=e.transitional||pP;e.timeoutErrorMessage&&(E=e.timeoutErrorMessage),r(new ct(E,_.clarifyTimeoutError?ct.ETIMEDOUT:ct.ECONNABORTED,e,p)),p=null},Wo.hasStandardBrowserEnv&&(l&&ae.isFunction(l)&&(l=l(e)),l||l!==!1&&kj(g))){const S=e.xsrfHeaderName&&e.xsrfCookieName&&Rj.read(e.xsrfCookieName);S&&i.set(e.xsrfHeaderName,S)}o===void 0&&i.setContentType(null),"setRequestHeader"in p&&ae.forEach(i.toJSON(),function(E,_){p.setRequestHeader(_,E)}),ae.isUndefined(e.withCredentials)||(p.withCredentials=!!e.withCredentials),s&&s!=="json"&&(p.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&p.addEventListener("progress",EC(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&p.upload&&p.upload.addEventListener("progress",EC(e.onUploadProgress)),(e.cancelToken||e.signal)&&(u=S=>{p&&(r(!S||S.type?new Dd(null,e,p):S),p.abort(),p=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u)));const x=Aj(g);if(x&&Wo.protocols.indexOf(x)===-1){r(new ct("Unsupported protocol "+x+":",ct.ERR_BAD_REQUEST,e));return}p.send(o||null)})},r1={http:oj,xhr:Nj};ae.forEach(r1,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const CC=e=>`- ${e}`,Dj=e=>ae.isFunction(e)||e===null||e===!1,wP={getAdapter:e=>{e=ae.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let i=0;i`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let s=t?i.length>1?`since : `+i.map(CC).join(` `):" "+CC(i[0]):"as no adapter specified";throw new ct("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:r1};function b0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Dd(null,e)}function $C(e){return b0(e),e.headers=Si.from(e.headers),e.data=x0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),wP.getAdapter(e.adapter||cx.adapter)(e).then(function(r){return b0(e),r.data=x0.call(e,e.transformResponse,r),r.headers=Si.from(r.headers),r},function(r){return vP(r)||(b0(e),r&&r.response&&(r.response.data=x0.call(e,e.transformResponse,r.response),r.response.headers=Si.from(r.response.headers))),Promise.reject(r)})}const RC=e=>e instanceof Si?e.toJSON():e;function ac(e,t){t=t||{};const n={};function r(f,m,p){return ae.isPlainObject(f)&&ae.isPlainObject(m)?ae.merge.call({caseless:p},f,m):ae.isPlainObject(m)?ae.merge({},m):ae.isArray(m)?m.slice():m}function o(f,m,p){if(ae.isUndefined(m)){if(!ae.isUndefined(f))return r(void 0,f,p)}else return r(f,m,p)}function i(f,m){if(!ae.isUndefined(m))return r(void 0,m)}function s(f,m){if(ae.isUndefined(m)){if(!ae.isUndefined(f))return r(void 0,f)}else return r(void 0,m)}function l(f,m,p){if(p in t)return r(f,m);if(p in e)return r(void 0,f)}const u={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:l,headers:(f,m)=>o(RC(f),RC(m),!0)};return ae.forEach(Object.keys(Object.assign({},e,t)),function(m){const p=u[m]||o,g=p(e[m],t[m],m);ae.isUndefined(g)&&p!==l||(n[m]=g)}),n}const xP="1.6.2",ux={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ux[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const PC={};ux.transitional=function(t,n,r){function o(i,s){return"[Axios v"+xP+"] Transitional option '"+i+"'"+s+(r?". "+r:"")}return(i,s,l)=>{if(t===!1)throw new ct(o(s," has been removed"+(n?" in "+n:"")),ct.ERR_DEPRECATED);return n&&!PC[s]&&(PC[s]=!0,console.warn(o(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,s,l):!0}};function Ij(e,t,n){if(typeof e!="object")throw new ct("options must be an object",ct.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const l=e[i],u=l===void 0||s(l,i,e);if(u!==!0)throw new ct("option "+i+" must be "+u,ct.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ct("Unknown option "+i,ct.ERR_BAD_OPTION)}}const o1={assertOptions:Ij,validators:ux},Qi=o1.validators;class Ip{constructor(t){this.defaults=t,this.interceptors={request:new SC,response:new SC}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ac(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&o1.assertOptions(r,{silentJSONParsing:Qi.transitional(Qi.boolean),forcedJSONParsing:Qi.transitional(Qi.boolean),clarifyTimeoutError:Qi.transitional(Qi.boolean)},!1),o!=null&&(ae.isFunction(o)?n.paramsSerializer={serialize:o}:o1.assertOptions(o,{encode:Qi.function,serialize:Qi.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=i&&ae.merge(i.common,i[n.method]);i&&ae.forEach(["delete","get","head","post","put","patch","common"],x=>{delete i[x]}),n.headers=Si.concat(s,i);const l=[];let u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(n)===!1||(u=u&&S.synchronous,l.unshift(S.fulfilled,S.rejected))});const f=[];this.interceptors.response.forEach(function(S){f.push(S.fulfilled,S.rejected)});let m,p=0,g;if(!u){const x=[$C.bind(this),void 0];for(x.unshift.apply(x,l),x.push.apply(x,f),g=x.length,m=Promise.resolve(n);p{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i;const s=new Promise(l=>{r.subscribe(l),i=l}).then(o);return s.cancel=function(){r.unsubscribe(i)},s},t(function(i,s,l){r.reason||(r.reason=new Dd(i,s,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new dx(function(o){t=o}),cancel:t}}}const Lj=dx;function Fj(e){return function(n){return e.apply(null,n)}}function jj(e){return ae.isObject(e)&&e.isAxiosError===!0}const i1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(i1).forEach(([e,t])=>{i1[t]=e});const Bj=i1;function bP(e){const t=new Zh(e),n=tP(Zh.prototype.request,t);return ae.extend(n,Zh.prototype,t,{allOwnKeys:!0}),ae.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return bP(ac(e,o))},n}const Qt=bP(cx);Qt.Axios=Zh;Qt.CanceledError=Dd;Qt.CancelToken=Lj;Qt.isCancel=vP;Qt.VERSION=xP;Qt.toFormData=Dm;Qt.AxiosError=ct;Qt.Cancel=Qt.CanceledError;Qt.all=function(t){return Promise.all(t)};Qt.spread=Fj;Qt.isAxiosError=jj;Qt.mergeConfig=ac;Qt.AxiosHeaders=Si;Qt.formToJSON=e=>gP(ae.isHTMLForm(e)?new FormData(e):e);Qt.getAdapter=wP.getAdapter;Qt.HttpStatusCode=Bj;Qt.default=Qt;const zj=Qt,Ni="/api/v1",Cc=zj.create({baseURL:Ni});async function Uj(e,t,n,r,o,i=null){const s=await Du(e),l=await Du(o),u=i?await Du(i):null,f=await fetch(`${Ni}/inpaint`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:s,mask:l,ldm_steps:t.ldmSteps,ldm_sampler:t.ldmSampler,zits_wireframe:t.zitsWireframe,cv2_flag:t.cv2Flag,cv2_radius:t.cv2Radius,hd_strategy:"Crop",hd_strategy_crop_triger_size:640,hd_strategy_crop_margin:128,hd_trategy_resize_imit:2048,prompt:t.prompt,negative_prompt:t.negativePrompt,use_croper:t.showCropper,croper_x:n.x,croper_y:n.y,croper_height:n.height,croper_width:n.width,use_extender:t.showExtender,extender_x:r.x,extender_y:r.y,extender_height:r.height,extender_width:r.width,sd_mask_blur:t.sdMaskBlur,sd_strength:t.sdStrength,sd_steps:t.sdSteps,sd_guidance_scale:t.sdGuidanceScale,sd_sampler:t.sdSampler,sd_seed:t.seedFixed?t.seed:-1,sd_match_histograms:t.sdMatchHistograms,sd_lcm_lora:t.enableLCMLora,paint_by_example_example_image:u,p2p_image_guidance_scale:t.p2pImageGuidanceScale,enable_controlnet:t.enableControlnet,controlnet_conditioning_scale:t.controlnetConditioningScale,controlnet_method:t.controlnetMethod?t.controlnetMethod:"",enable_brushnet:t.enableBrushNet,brushnet_method:t.brushnetMethod?t.brushnetMethod:"",brushnet_conditioning_scale:t.brushnetConditioningScale,enable_powerpaint_v2:t.enablePowerPaintV2,powerpaint_task:t.showExtender?ma.outpainting:t.powerpaintTask})});if(f.ok){const p=await f.blob();return{blob:URL.createObjectURL(p),seed:f.headers.get("X-Seed")}}const m=await f.json();throw new Error(`Something went wrong: ${m.errors}`)}async function SP(){return(await Cc.get("/server-config")).data}async function Vj(e){return(await Cc.post("/model",{name:e})).data}async function S0(e,t){return Cc.post("/switch_plugin_model",{plugin_name:e,model_name:t})}async function Wj(){return(await Cc.get("/model")).data}async function _P(e,t,n,r,o){const i=await Du(n),l=await fetch(`${Ni}/${e?"run_plugin_gen_mask":"run_plugin_gen_image"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,image:i,scale:r,clicks:o})});if(l.ok){const f=await l.blob();return{blob:URL.createObjectURL(f)}}const u=await l.json();throw new Error(u)}async function Hj(e,t){const n=await fetch(`${Ni}/media_file?tab=${e}&filename=${encodeURIComponent(t)}`,{method:"GET"});if(n.ok){const o=await n.blob();return new File([o],t,{type:n.headers.get("Content-Type")??"image/png"})}const r=await n.json();throw new Error(r.errors)}async function Kj(e,t){const n=await fetch(`${Ni}/media_file?tab=${e}&filename=${encodeURIComponent(t)}`,{method:"GET"});if(n.ok)return await n.blob();const r=await n.json();throw new Error(r.errors)}async function Gj(e){return(await Cc.get("medias",{params:{tab:e}})).data}async function Yj(e,t,n){const r=await Nu(e.src,t,n),o=new FormData;o.append("file",r);try{const i=await fetch(`${Ni}/save_image`,{method:"POST",body:o});if(!i.ok){const s=await i.text();throw new Error(s)}}catch(i){throw new Error(`Something went wrong: ${i}`)}}async function Xj(e){const t=new FormData;return t.append("file",e),(await Cc.post("/gen-info",t)).data}async function Zj(e,t,n){const r=await Du(e),o=await fetch(`${Ni}/adjust_mask`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mask:r,operate:t,kernel_size:n})});if(o.ok)return await o.blob();const i=await o.json();throw new Error(i)}function qj(){const[e,t]=d.useState(null),n=d.useCallback(()=>{const r=new Headers;r.append("pragma","no-cache"),r.append("cache-control","no-cache"),fetch(`${Ni}/inputimage`,{headers:r}).then(async o=>{var l;if(!o.ok)return;const i=(l=o.headers.get("content-disposition"))==null?void 0:l.split("filename=")[1].split(";")[0],s=await o.blob();if(s&&s.type.startsWith("image")){const u=new File([s],i!==void 0?i:"inputImage");t(u)}}).catch(o=>{console.log(o)})},[t]);return d.useEffect(()=>{n()},[n]),e}function Co(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}var Qj=["color"],Jj=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,Qj);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("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:r,fillRule:"evenodd",clipRule:"evenodd"}))}),eB=["color"],EP=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,eB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),tB=["color"],nB=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,tB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("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:r,fillRule:"evenodd",clipRule:"evenodd"}))}),rB=["color"],oB=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,rB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),iB=["color"],sB=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,iB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("path",{d:"M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),aB=["color"],CP=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,aB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("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:r,fillRule:"evenodd",clipRule:"evenodd"}))}),lB=["color"],cB=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,lB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:r}))}),uB=["color"],dB=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,uB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("path",{d:"M10 6.5C10 8.433 8.433 10 6.5 10C4.567 10 3 8.433 3 6.5C3 4.567 4.567 3 6.5 3C8.433 3 10 4.567 10 6.5ZM9.30884 10.0159C8.53901 10.6318 7.56251 11 6.5 11C4.01472 11 2 8.98528 2 6.5C2 4.01472 4.01472 2 6.5 2C8.98528 2 11 4.01472 11 6.5C11 7.56251 10.6318 8.53901 10.0159 9.30884L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L9.30884 10.0159Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),fB=["color"],hB=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,fB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("path",{d:"M3.24182 2.32181C3.3919 2.23132 3.5784 2.22601 3.73338 2.30781L12.7334 7.05781C12.8974 7.14436 13 7.31457 13 7.5C13 7.68543 12.8974 7.85564 12.7334 7.94219L3.73338 12.6922C3.5784 12.774 3.3919 12.7687 3.24182 12.6782C3.09175 12.5877 3 12.4252 3 12.25V2.75C3 2.57476 3.09175 2.4123 3.24182 2.32181ZM4 3.57925V11.4207L11.4288 7.5L4 3.57925Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),pB=["color"],mB=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,pB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("path",{d:"M7 2H1.5C1.22386 2 1 2.22386 1 2.5V7H7V2ZM8 2V7H14V2.5C14 2.22386 13.7761 2 13.5 2H8ZM7 8H1V12.5C1 12.7761 1.22386 13 1.5 13H7V8ZM8 13V8H14V12.5C14 12.7761 13.7761 13 13.5 13H8ZM1.5 1C0.671573 1 0 1.67157 0 2.5V12.5C0 13.3284 0.671573 14 1.5 14H13.5C14.3284 14 15 13.3284 15 12.5V2.5C15 1.67157 14.3284 1 13.5 1H1.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),gB=["color"],vB=d.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Co(e,gB);return d.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),d.createElement("path",{d:"M1.5 2H13.5C13.7761 2 14 2.22386 14 2.5V7H1V2.5C1 2.22386 1.22386 2 1.5 2ZM1 8V12.5C1 12.7761 1.22386 13 1.5 13H13.5C13.7761 13 14 12.7761 14 12.5V8H1ZM0 2.5C0 1.67157 0.671573 1 1.5 1H13.5C14.3284 1 15 1.67157 15 2.5V12.5C15 13.3284 14.3284 14 13.5 14H1.5C0.671573 14 0 13.3284 0 12.5V2.5Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;te.forEach(n=>yB(n,t))}function Ve(...e){return d.useCallback(Lm(...e),e)}const Qo=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),i=o.find(wB);if(i){const s=i.props.children,l=o.map(u=>u===i?d.Children.count(s)>1?d.Children.only(null):d.isValidElement(s)?s.props.children:null:u);return d.createElement(s1,Y({},r,{ref:t}),d.isValidElement(s)?d.cloneElement(s,void 0,l):null)}return d.createElement(s1,Y({},r,{ref:t}),n)});Qo.displayName="Slot";const s1=d.forwardRef((e,t)=>{const{children:n,...r}=e;return d.isValidElement(n)?d.cloneElement(n,{...xB(r,n.props),ref:t?Lm(t,n.ref):n.ref}):d.Children.count(n)>1?d.Children.only(null):null});s1.displayName="SlotClone";const fx=({children:e})=>d.createElement(d.Fragment,null,e);function wB(e){return d.isValidElement(e)&&e.type===fx}function xB(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]=(...l)=>{i(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const TC=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,kC=KR,Fm=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return kC(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(f=>{const m=n==null?void 0:n[f],p=i==null?void 0:i[f];if(m===null)return null;const g=TC(m)||TC(p);return o[f][g]}),l=n&&Object.entries(n).reduce((f,m)=>{let[p,g]=m;return g===void 0||(f[p]=g),f},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:p,className:g,...y}=m;return Object.entries(y).every(x=>{let[S,E]=x;return Array.isArray(E)?E.includes({...i,...l}[S]):{...i,...l}[S]===E})?[...f,p,g]:f},[]);return kC(e,s,u,n==null?void 0:n.class,n==null?void 0:n.className)};var bB={VITE_BACKEND:"http://127.0.0.1:8080",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function SB(e,t){let n;try{n=e()}catch{return}return{getItem:o=>{var i;const s=u=>u===null?null:JSON.parse(u,t==null?void 0:t.reviver),l=(i=n.getItem(o))!=null?i:null;return l instanceof Promise?l.then(s):s(l)},setItem:(o,i)=>n.setItem(o,JSON.stringify(i,t==null?void 0:t.replacer)),removeItem:o=>n.removeItem(o)}}const od=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return od(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return od(r)(n)}}}},_B=(e,t)=>(n,r,o)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:E=>E,version:0,merge:(E,_)=>({..._,...E}),...t},s=!1;const l=new Set,u=new Set;let f;try{f=i.getStorage()}catch{}if(!f)return e((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...E)},r,o);const m=od(i.serialize),p=()=>{const E=i.partialize({...r()});let _;const b=m({state:E,version:i.version}).then(C=>f.setItem(i.name,C)).catch(C=>{_=C});if(_)throw _;return b},g=o.setState;o.setState=(E,_)=>{g(E,_),p()};const y=e((...E)=>{n(...E),p()},r,o);let x;const S=()=>{var E;if(!f)return;s=!1,l.forEach(b=>b(r()));const _=((E=i.onRehydrateStorage)==null?void 0:E.call(i,r()))||void 0;return od(f.getItem.bind(f))(i.name).then(b=>{if(b)return i.deserialize(b)}).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==i.version){if(i.migrate)return i.migrate(b.state,b.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return b.state}).then(b=>{var C;return x=i.merge(b,(C=r())!=null?C:y),n(x,!0),p()}).then(()=>{_==null||_(x,void 0),s=!0,u.forEach(b=>b(x))}).catch(b=>{_==null||_(void 0,b)})};return o.persist={setOptions:E=>{i={...i,...E},E.getStorage&&(f=E.getStorage())},clearStorage:()=>{f==null||f.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>S(),hasHydrated:()=>s,onHydrate:E=>(l.add(E),()=>{l.delete(E)}),onFinishHydration:E=>(u.add(E),()=>{u.delete(E)})},S(),x||y},EB=(e,t)=>(n,r,o)=>{let i={storage:SB(()=>localStorage),partialize:S=>S,version:0,merge:(S,E)=>({...E,...S}),...t},s=!1;const l=new Set,u=new Set;let f=i.storage;if(!f)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 m=()=>{const S=i.partialize({...r()});return f.setItem(i.name,{state:S,version:i.version})},p=o.setState;o.setState=(S,E)=>{p(S,E),m()};const g=e((...S)=>{n(...S),m()},r,o);let y;const x=()=>{var S,E;if(!f)return;s=!1,l.forEach(b=>{var C;return b((C=r())!=null?C:g)});const _=((E=i.onRehydrateStorage)==null?void 0:E.call(i,(S=r())!=null?S:g))||void 0;return od(f.getItem.bind(f))(i.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==i.version){if(i.migrate)return i.migrate(b.state,b.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return b.state}).then(b=>{var C;return y=i.merge(b,(C=r())!=null?C:g),n(y,!0),m()}).then(()=>{_==null||_(y,void 0),y=r(),s=!0,u.forEach(b=>b(y))}).catch(b=>{_==null||_(void 0,b)})};return o.persist={setOptions:S=>{i={...i,...S},S.storage&&(f=S.storage)},clearStorage:()=>{f==null||f.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:S=>(l.add(S),()=>{l.delete(S)}),onFinishHydration:S=>(u.add(S),()=>{u.delete(S)})},i.skipHydration||x(),y||g},CB=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((bB?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),_B(e,t)):EB(e,t),$B=CB;function RB(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(let r=0;r{t(n,r,e)}):e.forEach((n,r)=>t(r,n,e))}function jm(e){const t=e[xr];return t?t.type_:Array.isArray(e)?1:Bm(e)?2:zm(e)?3:0}function a1(e,t){return jm(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function PP(e,t,n){const r=jm(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function TB(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Bm(e){return e instanceof Map}function zm(e){return e instanceof Set}function ia(e){return e.copy_||e.base_}function l1(e,t){if(Bm(e))return new Map(e);if(zm(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&RP(e))return lc(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[xr];let r=Reflect.ownKeys(n);for(let o=0;o1&&(e.set=e.add=e.clear=e.delete=kB),Object.freeze(e),t&&id(e,(n,r)=>hx(r,!0))),e}function kB(){vo(2)}function Um(e){return Object.isFrozen(e)}var AB={};function Da(e){const t=AB[e];return t||vo(0,e),t}var sd;function TP(){return sd}function MB(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function MC(e,t){t&&(Da("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function c1(e){u1(e),e.drafts_.forEach(OB),e.drafts_=null}function u1(e){e===sd&&(sd=e.parent_)}function OC(e){return sd=MB(sd,e)}function OB(e){const t=e[xr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function NC(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[xr].modified_&&(c1(t),vo(4)),Na(e)&&(e=Lp(t,e),t.parent_||Fp(t,e)),t.patches_&&Da("Patches").generateReplacementPatches_(n[xr].base_,e,t.patches_,t.inversePatches_)):e=Lp(t,n,[]),c1(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$P?e:void 0}function Lp(e,t,n){if(Um(t))return t;const r=t[xr];if(!r)return id(t,(o,i)=>DC(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Fp(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),id(i,(l,u)=>DC(e,r,o,l,u,n,s)),Fp(e,o,!1),n&&e.patches_&&Da("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function DC(e,t,n,r,o,i,s){if(cc(o)){const l=i&&t&&t.type_!==3&&!a1(t.assigned_,r)?i.concat(r):void 0,u=Lp(e,o,l);if(PP(n,r,u),cc(u))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(Na(o)&&!Um(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Lp(e,o),(!t||!t.scope_.parent_)&&Fp(e,o)}}function Fp(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&hx(t,n)}function NB(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:TP(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=px;n&&(o=[r],i=ad);const{revoke:s,proxy:l}=Proxy.revocable(o,i);return r.draft_=l,r.revoke_=s,l}var px={get(e,t){if(t===xr)return e;const n=ia(e);if(!a1(n,t))return DB(e,n,t);const r=n[t];return e.finalized_||!Na(r)?r:r===_0(e.base_,t)?(E0(e),e.copy_[t]=f1(r,e)):r},has(e,t){return t in ia(e)},ownKeys(e){return Reflect.ownKeys(ia(e))},set(e,t,n){const r=kP(ia(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=_0(ia(e),t),i=o==null?void 0:o[xr];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(TB(n,o)&&(n!==void 0||a1(e.base_,t)))return!0;E0(e),d1(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return _0(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,E0(e),d1(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ia(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){vo(11)},getPrototypeOf(e){return lc(e.base_)},setPrototypeOf(){vo(12)}},ad={};id(px,(e,t)=>{ad[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ad.deleteProperty=function(e,t){return ad.set.call(this,e,t,void 0)};ad.set=function(e,t,n){return px.set.call(this,e[0],t,n,e[0])};function _0(e,t){const n=e[xr];return(n?ia(n):e)[t]}function DB(e,t,n){var o;const r=kP(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function kP(e,t){if(!(t in e))return;let n=lc(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=lc(n)}}function d1(e){e.modified_||(e.modified_=!0,e.parent_&&d1(e.parent_))}function E0(e){e.copy_||(e.copy_=l1(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var IB=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(u=i,...f){return s.produce(u,m=>n.call(this,m,...f))}}typeof n!="function"&&vo(6),r!==void 0&&typeof r!="function"&&vo(7);let o;if(Na(t)){const i=OC(this),s=f1(t,void 0);let l=!0;try{o=n(s),l=!1}finally{l?c1(i):u1(i)}return MC(i,r),NC(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===$P&&(o=void 0),this.autoFreeze_&&hx(o,!0),r){const i=[],s=[];Da("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else vo(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...l)=>this.produceWithPatches(s,u=>t(u,...l));let r,o;return[this.produce(t,n,(s,l)=>{r=s,o=l}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Na(e)||vo(8),cc(e)&&(e=LB(e));const t=OC(this),n=f1(e,void 0);return n[xr].isManual_=!0,u1(t),n}finishDraft(e,t){const n=e&&e[xr];(!n||!n.isManual_)&&vo(9);const{scope_:r}=n;return MC(r,t),NC(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=Da("Patches").applyPatches_;return cc(e)?r(e,t):this.produce(e,o=>r(o,t))}};function f1(e,t){const n=Bm(e)?Da("MapSet").proxyMap_(e,t):zm(e)?Da("MapSet").proxySet_(e,t):NB(e,t);return(t?t.scope_:TP()).drafts_.push(n),n}function LB(e){return cc(e)||vo(10,e),AP(e)}function AP(e){if(!Na(e)||Um(e))return e;const t=e[xr];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=l1(e,t.scope_.immer_.useStrictShallowCopy_)}else n=l1(e,!0);return id(n,(r,o)=>{PP(n,r,AP(o))}),t&&(t.finalized_=!1),n}var br=new IB,FB=br.produce;br.produceWithPatches.bind(br);br.setAutoFreeze.bind(br);br.setUseStrictShallowCopy.bind(br);br.applyPatches.bind(br);br.createDraft.bind(br);br.finishDraft.bind(br);const jB=e=>(t,n,r)=>(r.setState=(o,i,...s)=>{const l=typeof o=="function"?FB(o):o;return t(l,i,...s)},e(r.setState,n,r)),BB=jB;var MP={exports:{}},OP={},NP={exports:{}},DP={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var uc=d;function zB(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var UB=typeof Object.is=="function"?Object.is:zB,VB=uc.useState,WB=uc.useEffect,HB=uc.useLayoutEffect,KB=uc.useDebugValue;function GB(e,t){var n=t(),r=VB({inst:{value:n,getSnapshot:t}}),o=r[0].inst,i=r[1];return HB(function(){o.value=n,o.getSnapshot=t,C0(o)&&i({inst:o})},[e,n,t]),WB(function(){return C0(o)&&i({inst:o}),e(function(){C0(o)&&i({inst:o})})},[e]),KB(n),n}function C0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!UB(e,n)}catch{return!0}}function YB(e,t){return t()}var XB=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?YB:GB;DP.useSyncExternalStore=uc.useSyncExternalStore!==void 0?uc.useSyncExternalStore:XB;NP.exports=DP;var ZB=NP.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Vm=d,qB=ZB;function QB(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var JB=typeof Object.is=="function"?Object.is:QB,ez=qB.useSyncExternalStore,tz=Vm.useRef,nz=Vm.useEffect,rz=Vm.useMemo,oz=Vm.useDebugValue;OP.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=tz(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=rz(function(){function u(y){if(!f){if(f=!0,m=y,y=r(y),o!==void 0&&s.hasValue){var x=s.value;if(o(x,y))return p=x}return p=y}if(x=p,JB(m,y))return x;var S=r(y);return o!==void 0&&o(x,S)?x:(m=y,p=S)}var f=!1,m,p,g=n===void 0?null:n;return[function(){return u(t())},g===null?void 0:function(){return u(g())}]},[t,n,r,o]);var l=ez(e,i[0],i[1]);return nz(function(){s.hasValue=!0,s.value=l},[l]),oz(l),l};MP.exports=OP;var iz=MP.exports;const sz=pm(iz);var az={VITE_BACKEND:"http://127.0.0.1:8080",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const IC=e=>{let t;const n=new Set,r=(u,f)=>{const m=typeof u=="function"?u(t):u;if(!Object.is(m,t)){const p=t;t=f??typeof m!="object"?m:Object.assign({},t,m),n.forEach(g=>g(t,p))}},o=()=>t,l={setState:r,getState:o,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(az?"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()}};return t=e(r,o,l),l},lz=e=>e?IC(e):IC,{useDebugValue:cz}=Be,{useSyncExternalStoreWithSelector:uz}=sz;function dz(e,t=e.getState,n){const r=uz(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return cz(r),r}const LC=(e,t)=>{const n=lz(e),r=(o,i=t)=>dz(n,o,i);return Object.assign(r,n),r},fz=(e,t)=>e?LC(e,t):LC,hz=1,pz=1e6;let $0=0;function mz(){return $0=($0+1)%Number.MAX_VALUE,$0.toString()}const R0=new Map,FC=e=>{if(R0.has(e))return;const t=setTimeout(()=>{R0.delete(e),Iu({type:"REMOVE_TOAST",toastId:e})},pz);R0.set(e,t)},gz=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,hz)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?FC(n):e.toasts.forEach(r=>{FC(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},qh=[];let Qh={toasts:[]};function Iu(e){Qh=gz(Qh,e),qh.forEach(t=>{t(Qh)})}function hl({...e}){const t=mz(),n=o=>Iu({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>Iu({type:"DISMISS_TOAST",toastId:t});return Iu({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function Id(){const[e,t]=d.useState(Qh);return d.useEffect(()=>(qh.push(t),()=>{const n=qh.indexOf(t);n>-1&&qh.splice(n,1)}),[e]),{...e,toast:hl,dismiss:n=>Iu({type:"DISMISS_TOAST",toastId:n})}}const na={file:null,paintByExampleFile:null,customMask:null,imageHeight:0,imageWidth:0,isInpainting:!1,isPluginRunning:!1,isAdjustingMask:!1,disableShortCuts:!1,windowSize:{height:600,width:800},editorState:{baseBrushSize:uF,brushSizeScale:1,renders:[],extraMasks:[],prevExtraMasks:[],temporaryMasks:[],lineGroups:[],lastLineGroup:[],curLineGroup:[],redoRenders:[],redoCurLines:[],redoLineGroups:[]},interactiveSegState:{isInteractiveSeg:!1,tmpInteractiveSegMask:null,clicks:[]},cropperState:{x:0,y:0,width:512,height:512},extenderState:{x:0,y:0,width:512,height:512},isCropperExtenderResizing:!1,fileManagerState:{sortBy:Ps.CTIME,sortOrder:Ou.DESCENDING,layout:"masonry",searchText:"",inputDirectory:"",outputDirectory:""},serverConfig:{plugins:[],modelInfos:[],removeBGModel:"briaai/RMBG-1.4",removeBGModels:[],realesrganModel:"realesr-general-x4v3",realesrganModels:[],interactiveSegModel:"vit_b",interactiveSegModels:[],enableFileManager:!1,enableAutoSaving:!1,enableControlnet:!1,controlnetMethod:"lllyasviel/control_v11p_sd15_canny",disableModelSwitch:!1,isDesktop:!1,samplers:["DPM++ 2M SDE Karras"]},settings:{model:{name:"lama",path:"lama",model_type:"inpaint",support_controlnet:!1,support_brushnet:!1,support_strength:!1,support_outpainting:!1,support_powerpaint_v2:!1,controlnets:[],brushnets:[],support_lcm_lora:!1,is_single_file_diffusers:!1,need_prompt:!1},showCropper:!1,showExtender:!1,extenderDirection:Ln.xy,enableDownloadMask:!1,enableManualInpainting:!1,enableUploadMask:!1,enableAutoExtractPrompt:!0,ldmSteps:30,ldmSampler:nx.ddim,zitsWireframe:!0,cv2Radius:5,cv2Flag:rx.INPAINT_NS,prompt:"",negativePrompt:mF,seed:42,seedFixed:!1,sdMaskBlur:12,sdStrength:1,sdSteps:50,sdGuidanceScale:7.5,sdSampler:"DPM++ 2M",sdMatchHistograms:!1,sdScale:1,p2pImageGuidanceScale:1.5,enableControlnet:!1,controlnetMethod:"lllyasviel/control_v11p_sd15_canny",controlnetConditioningScale:.4,enableBrushNet:!1,brushnetMethod:"random_mask",brushnetConditioningScale:1,enableLCMLora:!1,enablePowerPaintV2:!1,powerpaintTask:ma.text_guided,adjustMaskKernelSize:12}},xt=fz()($B(BB((e,t)=>({...na,showPrevMask:async()=>{if(t().settings.showExtender)return;const{lastLineGroup:n,curLineGroup:r,prevExtraMasks:o,extraMasks:i}=t().editorState;if(r.length!==0||i.length!==0)return;const{imageWidth:s,imageHeight:l}=t(),u=Gh(s,l,[n],o,Kh);try{const f=await mC(u);e(m=>{m.editorState.temporaryMasks.push(f)})}catch(f){console.error(f);return}},hidePrevMask:()=>{e(n=>{n.editorState.temporaryMasks=[]})},getCurrentTargetFile:async()=>{const n=t().file,r=t().editorState.renders;let o=n;if(r.length>0){const i=r[r.length-1];o=await Nu(i.currentSrc,n.name,n.type)}return o},runInpainting:async()=>{const{isInpainting:n,file:r,paintByExampleFile:o,imageWidth:i,imageHeight:s,settings:l,cropperState:u,extenderState:f}=t();if(n||r===null||t().settings.model.support_outpainting&&l.showExtender&&f.x===0&&f.y===0&&f.height===s&&f.width===i)return;const{lastLineGroup:m,curLineGroup:p,lineGroups:g,renders:y,prevExtraMasks:x,extraMasks:S}=t().editorState,E=p.length===0&&S.length===0&&!l.showExtender;let _=[],b=[];if(E===!0?(b=m,_=x):(b=p,_=S),b.length===0&&_===null&&!l.showExtender){hl({variant:"destructive",description:"Please draw mask on picture"});return}const C=[...g,b];e(O=>{O.isInpainting=!0});let R=r;if(E===!0){if(y.length>1){const O=y[y.length-2];R=await Nu(O.currentSrc,r.name,r.type)}}else if(y.length>0){const O=y[y.length-1];R=await Nu(O.currentSrc,r.name,r.type)}const k=Gh(i,s,[b],_,Kh);if(E){const O=await mC(k);e(A=>{A.editorState.temporaryMasks=[O]})}try{const O=await Uj(R,l,u,f,pC(k.toDataURL()),o),{blob:A,seed:I}=O;I&&t().setSeed(parseInt(I,10));const z=new Image;await bu(z,A);const H=[...y,z];t().setImageSize(z.width,z.height),t().updateEditorState({renders:H,lineGroups:C,lastLineGroup:b,curLineGroup:[],extraMasks:[],prevExtraMasks:_})}catch(O){hl({variant:"destructive",description:O.message?O.message:O.toString()})}t().resetRedoState(),e(O=>{O.isInpainting=!1,O.editorState.temporaryMasks=[]})},runRenderablePlugin:async(n,r,o={upscale:1})=>{const{renders:i,lineGroups:s}=t().editorState;e(l=>{l.isPluginRunning=!0});try{const l=new Date,u=await t().getCurrentTargetFile(),f=await _P(n,r,u,o.upscale),{blob:m}=f;if(n){const y=new Image;await bu(y,m),e(x=>{x.editorState.extraMasks.push(y)})}else{const y=new Image;await bu(y,m),t().setImageSize(y.width,y.height);const x=[...i,y],S=[...s,[]];t().updateEditorState({renders:x,lineGroups:S})}const g=new Date().getTime()-l.getTime();hl({description:`Run ${r} successfully in ${g/1e3}s`})}catch(l){hl({variant:"destructive",description:l.message?l.message:l.toString()})}e(l=>{l.isPluginRunning=!1})},updateEditorState:n=>{e(r=>{r.editorState={...r.editorState,...n}})},cleanCurLineGroup:()=>{t().updateEditorState({curLineGroup:[]})},handleCanvasMouseDown:n=>{let r=[];const o=t();o.runMannually()&&(r=[...o.editorState.curLineGroup]),r.push({size:o.getBrushSize(),pts:[n]}),e(i=>{i.editorState.curLineGroup=r})},handleCanvasMouseMove:n=>{e(r=>{const o=r.editorState.curLineGroup;o.length&&o[o.length-1].pts.push(n)})},runMannually:()=>{const n=t();return n.settings.enableManualInpainting||n.settings.model.model_type!==ms},getIsProcessing:()=>t().isInpainting||t().isPluginRunning||t().isAdjustingMask,isSD:()=>t().settings.model.model_type!==ms,undoDisabled:()=>{const n=t().editorState;if(n.renders.length>0)return!1;if(t().runMannually()){if(n.curLineGroup.length===0)return!0}else if(n.renders.length===0)return!0;return!1},undo:()=>{t().runMannually()&&t().editorState.curLineGroup.length!==0?e(n=>{const r=n.editorState;if(r.curLineGroup.length===0)return;r.lastLineGroup=[];const o=r.curLineGroup.pop();r.redoCurLines.push(o)}):e(n=>{const r=n.editorState;if(r.renders.length===0||r.lineGroups.length===0)return;const o=r.lineGroups.pop();r.redoLineGroups.push(o),r.redoCurLines=[],r.curLineGroup=[];const i=r.renders.pop();r.redoRenders.push(i)})},redoDisabled:()=>{const n=t().editorState;if(n.redoRenders.length>0)return!1;if(t().runMannually()){if(n.redoCurLines.length===0)return!0}else if(n.redoRenders.length===0)return!0;return!1},redo:()=>{t().runMannually()&&t().editorState.redoCurLines.length!==0?e(n=>{const r=n.editorState;if(r.redoCurLines.length===0)return;const o=r.redoCurLines.pop();r.curLineGroup.push(o)}):e(n=>{const r=n.editorState;if(r.redoRenders.length===0||r.redoLineGroups.length===0)return;const o=r.redoLineGroups.pop();r.lineGroups.push(o),r.curLineGroup=[];const i=r.redoRenders.pop();r.renders.push(i)})},resetRedoState:()=>{e(n=>{n.editorState.redoCurLines=[],n.editorState.redoLineGroups=[],n.editorState.redoRenders=[]})},updateAppState:n=>{e(()=>n)},getBrushSize:()=>t().editorState.baseBrushSize*t().editorState.brushSizeScale,showPromptInput:()=>{const n=t().settings.model;return n.model_type!==ms&&n.name!==JR},setServerConfig:n=>{e(r=>{r.serverConfig=n,r.settings.enableControlnet=n.enableControlnet,r.settings.controlnetMethod=n.controlnetMethod})},updateSettings:n=>{e(r=>{r.settings={...r.settings,...n}})},updateEnablePowerPaintV2:n=>{t().updateSettings({enablePowerPaintV2:n}),n&&t().updateSettings({enableBrushNet:!1,enableControlnet:!1,enableLCMLora:!1})},updateEnableBrushNet:n=>{t().updateSettings({enableBrushNet:n}),n&&t().updateSettings({enablePowerPaintV2:!1,enableControlnet:!1,enableLCMLora:!1})},updateEnableControlnet(n){t().updateSettings({enableControlnet:n}),n&&t().updateSettings({enablePowerPaintV2:!1,enableBrushNet:!1})},updateLCMLora(n){t().updateSettings({enableLCMLora:n}),n&&t().updateSettings({enablePowerPaintV2:!1,enableBrushNet:!1})},setModel:n=>{e(r=>{r.settings.model=n,n.support_controlnet&&!n.controlnets.includes(r.settings.controlnetMethod)&&(r.settings.controlnetMethod=n.controlnets[0])})},updateFileManagerState:n=>{e(r=>{r.fileManagerState={...r.fileManagerState,...n}})},updateInteractiveSegState:n=>{e(r=>({...r,interactiveSegState:{...r.interactiveSegState,...n}}))},resetInteractiveSegState:()=>{t().updateInteractiveSegState(na.interactiveSegState)},handleInteractiveSegAccept:()=>{e(n=>{n.interactiveSegState.tmpInteractiveSegMask&&n.editorState.extraMasks.push(n.interactiveSegState.tmpInteractiveSegMask),n.interactiveSegState={...na.interactiveSegState}})},handleFileManagerMaskSelect:async n=>{const r=new Image;await bu(r,URL.createObjectURL(n)),e(o=>{o.editorState.extraMasks.push(r)}),t().runInpainting()},setIsInpainting:n=>e(r=>{r.isInpainting=n}),setFile:async n=>{if(t().settings.enableAutoExtractPrompt)try{const r=await Xj(n);r.prompt&&e(o=>{o.settings.prompt=r.prompt}),r.negative_prompt&&e(o=>{o.settings.negativePrompt=r.negative_prompt})}catch(r){hl({variant:"destructive",description:r.message?r.message:r.toString()})}e(r=>{r.file=n,r.interactiveSegState=na.interactiveSegState,r.editorState=na.editorState,r.cropperState=na.cropperState})},setCustomFile:n=>e(r=>{r.customMask=n}),setBaseBrushSize:n=>e(r=>{r.editorState.baseBrushSize=n}),decreaseBaseBrushSize:()=>{const n=t().editorState.baseBrushSize;let r=n;n>10&&(r=n-10),n<=10&&n>0&&(r=n-3),t().setBaseBrushSize(r)},increaseBaseBrushSize:()=>{const n=t().editorState.baseBrushSize,r=Math.min(n+10,QR);t().setBaseBrushSize(r)},setImageSize:(n,r)=>{e(o=>{o.imageWidth=n,o.imageHeight=r,o.editorState.brushSizeScale=Math.max(Math.min(n,r),512)/512}),t().resetExtender(n,r)},setCropperX:n=>e(r=>{r.cropperState.x=n}),setCropperY:n=>e(r=>{r.cropperState.y=n}),setCropperWidth:n=>e(r=>{r.cropperState.width=n}),setCropperHeight:n=>e(r=>{r.cropperState.height=n}),setExtenderX:n=>e(r=>{r.extenderState.x=n}),setExtenderY:n=>e(r=>{r.extenderState.y=n}),setExtenderWidth:n=>e(r=>{r.extenderState.width=n}),setExtenderHeight:n=>e(r=>{r.extenderState.height=n}),setIsCropperExtenderResizing:n=>e(r=>{r.isCropperExtenderResizing=n}),updateExtenderDirection:n=>{console.log(`updateExtenderDirection: ${JSON.stringify(t().extenderState)}`),e(r=>{r.settings.extenderDirection=n,r.extenderState.x=0,r.extenderState.y=0,r.extenderState.width=r.imageWidth,r.extenderState.height=r.imageHeight}),t().updateExtenderByBuiltIn(n,1.5)},updateExtenderByBuiltIn:(n,r)=>{const o={...na.extenderState};let{x:i,y:s,width:l,height:u}=o;const{imageWidth:f,imageHeight:m}=t();switch(l=f,u=m,n){case Ln.x:i=-Math.ceil(f*(r-1)/2),l=Math.ceil(f*r);break;case Ln.y:s=-Math.ceil(m*(r-1)/2),u=Math.ceil(m*r);break;case Ln.xy:i=-Math.ceil(f*(r-1)/2),s=-Math.ceil(m*(r-1)/2),l=Math.ceil(f*r),u=Math.ceil(m*r);break}e(p=>{p.extenderState.x=i,p.extenderState.y=s,p.extenderState.width=l,p.extenderState.height=u})},resetExtender:(n,r)=>{e(o=>{o.extenderState.x=0,o.extenderState.y=0,o.extenderState.width=n,o.extenderState.height=r})},setSeed:n=>e(r=>{r.settings.seed=n}),adjustMask:async n=>{const{imageWidth:r,imageHeight:o}=t(),{curLineGroup:i,extraMasks:s}=t().editorState,{adjustMaskKernelSize:l}=t().settings;if(i.length===0&&s.length===0)return;e(g=>{g.isAdjustingMask=!0});const u=Gh(r,o,[i],s,Kh),f=pC(u.toDataURL()),m=await Zj(f,n,l),p=await vF(m);e(g=>{g.editorState.extraMasks=[p],g.editorState.curLineGroup=[]}),e(g=>{g.isAdjustingMask=!1})},clearMask:()=>{e(n=>{n.editorState.extraMasks=[],n.editorState.curLineGroup=[]})}})),{name:"ZUSTAND_STATE",version:2,partialize:e=>Object.fromEntries(Object.entries(e).filter(([t])=>["fileManagerState","settings"].includes(t)))}),RB),Wm=d.forwardRef(({className:e,type:t,...n},r)=>{const o=xt(l=>l.updateAppState),i=()=>{o({disableShortCuts:!0})},s=()=>{o({disableShortCuts:!1})};return v.jsx("input",{type:t,className:xe("flex h-8 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,autoComplete:"off",tabIndex:-1,onFocus:i,onBlur:s,...n})});Wm.displayName="Input";const No=d.forwardRef(({numberValue:e,allowFloat:t,onNumberValueChange:n,className:r,...o},i)=>{const[s,l]=d.useState(e.toString());d.useEffect(()=>{s!==e.toString()+"."&&l(e.toString())},[e]);const u=f=>{let p=f.target.value;if(t){if(p=p.replace(/[^0-9.]/g,"").replace(/(\..*?)\..*/g,"$1"),p.length===0){n(0);return}n(parseFloat(p))}else{if(p=p.replace(/\D/g,""),p.length===0){n(0);return}n(parseInt(p,10))}l(p)};return v.jsx(Wm,{ref:i,value:s,onInput:u,className:xe("text-center h-7 px-1",r),...o})});function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function vz(e,t){const n=d.createContext(t);function r(i){const{children:s,...l}=i,u=d.useMemo(()=>l,Object.values(l));return d.createElement(n.Provider,{value:u},s)}function o(i){const s=d.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",[r,o]}function Tn(e,t=[]){let n=[];function r(i,s){const l=d.createContext(s),u=n.length;n=[...n,s];function f(p){const{scope:g,children:y,...x}=p,S=(g==null?void 0:g[e][u])||l,E=d.useMemo(()=>x,Object.values(x));return d.createElement(S.Provider,{value:E},y)}function m(p,g){const y=(g==null?void 0:g[e][u])||l,x=d.useContext(y);if(x)return x;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${i}\``)}return f.displayName=i+"Provider",[f,m]}const o=()=>{const i=n.map(s=>d.createContext(s));return function(l){const u=(l==null?void 0:l[e])||i;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,yz(o,...t)]}function yz(...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((l,{useScope:u,scopeName:f})=>{const p=u(i)[`__scope${f}`];return{...l,...p}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}const wz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ae=wz.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:i,...s}=r,l=i?Qo:t;return d.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),d.createElement(l,Y({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function mx(e,t){e&&Bs.flushSync(()=>e.dispatchEvent(t))}function Lt(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function xz(e,t=globalThis==null?void 0:globalThis.document){const n=Lt(e);d.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const h1="dismissableLayer.update",bz="dismissableLayer.pointerDownOutside",Sz="dismissableLayer.focusOutside";let jC;const IP=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$c=d.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:u,...f}=e,m=d.useContext(IP),[p,g]=d.useState(null),y=(n=p==null?void 0:p.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,x]=d.useState({}),S=Ve(t,I=>g(I)),E=Array.from(m.layers),[_]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),b=E.indexOf(_),C=p?E.indexOf(p):-1,R=m.layersWithOutsidePointerEventsDisabled.size>0,k=C>=b,O=Ez(I=>{const z=I.target,H=[...m.branches].some(ie=>ie.contains(z));!k||H||(i==null||i(I),l==null||l(I),I.defaultPrevented||u==null||u())},y),A=Cz(I=>{const z=I.target;[...m.branches].some(ie=>ie.contains(z))||(s==null||s(I),l==null||l(I),I.defaultPrevented||u==null||u())},y);return xz(I=>{C===m.layers.size-1&&(o==null||o(I),!I.defaultPrevented&&u&&(I.preventDefault(),u()))},y),d.useEffect(()=>{if(p)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(jC=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(p)),m.layers.add(p),BC(),()=>{r&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=jC)}},[p,y,r,m]),d.useEffect(()=>()=>{p&&(m.layers.delete(p),m.layersWithOutsidePointerEventsDisabled.delete(p),BC())},[p,m]),d.useEffect(()=>{const I=()=>x({});return document.addEventListener(h1,I),()=>document.removeEventListener(h1,I)},[]),d.createElement(Ae.div,Y({},f,{ref:S,style:{pointerEvents:R?k?"auto":"none":void 0,...e.style},onFocusCapture:fe(e.onFocusCapture,A.onFocusCapture),onBlurCapture:fe(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:fe(e.onPointerDownCapture,O.onPointerDownCapture)}))}),_z=d.forwardRef((e,t)=>{const n=d.useContext(IP),r=d.useRef(null),o=Ve(t,r);return d.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),d.createElement(Ae.div,Y({},e,{ref:o}))});function Ez(e,t=globalThis==null?void 0:globalThis.document){const n=Lt(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let m=function(){LP(bz,n,f,{discrete:!0})};var u=m;const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=m,t.addEventListener("click",o.current,{once:!0})):m()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Cz(e,t=globalThis==null?void 0:globalThis.document){const n=Lt(e),r=d.useRef(!1);return d.useEffect(()=>{const o=i=>{i.target&&!r.current&&LP(Sz,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function BC(){const e=new CustomEvent(h1);document.dispatchEvent(e)}function LP(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?mx(o,i):o.dispatchEvent(i)}const $z=$c,Rz=_z,Pn=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{},Pz=V9.useId||(()=>{});let Tz=0;function tr(e){const[t,n]=d.useState(Pz());return Pn(()=>{e||n(r=>r??String(Tz++))},[e]),e||(t?`radix-${t}`:"")}const kz=["top","right","bottom","left"],Os=Math.min,pr=Math.max,jp=Math.round,mh=Math.floor,Ns=e=>({x:e,y:e}),Az={left:"right",right:"left",bottom:"top",top:"bottom"},Mz={start:"end",end:"start"};function p1(e,t,n){return pr(e,Os(t,n))}function Ri(e,t){return typeof e=="function"?e(t):e}function Pi(e){return e.split("-")[0]}function Rc(e){return e.split("-")[1]}function gx(e){return e==="x"?"y":"x"}function vx(e){return e==="y"?"height":"width"}function Pc(e){return["top","bottom"].includes(Pi(e))?"y":"x"}function yx(e){return gx(Pc(e))}function Oz(e,t,n){n===void 0&&(n=!1);const r=Rc(e),o=yx(e),i=vx(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Bp(s)),[s,Bp(s)]}function Nz(e){const t=Bp(e);return[m1(e),t,m1(t)]}function m1(e){return e.replace(/start|end/g,t=>Mz[t])}function Dz(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 Iz(e,t,n,r){const o=Rc(e);let i=Dz(Pi(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(m1)))),i}function Bp(e){return e.replace(/left|right|bottom|top/g,t=>Az[t])}function Lz(e){return{top:0,right:0,bottom:0,left:0,...e}}function FP(e){return typeof e!="number"?Lz(e):{top:e,right:e,bottom:e,left:e}}function zp(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function zC(e,t,n){let{reference:r,floating:o}=e;const i=Pc(t),s=yx(t),l=vx(s),u=Pi(t),f=i==="y",m=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,g=r[l]/2-o[l]/2;let y;switch(u){case"top":y={x:m,y:r.y-o.height};break;case"bottom":y={x:m,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(Rc(t)){case"start":y[s]-=g*(n&&f?-1:1);break;case"end":y[s]+=g*(n&&f?-1:1);break}return y}const Fz=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:p}=zC(f,r,u),g=r,y={},x=0;for(let S=0;S({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:u}=t,{element:f,padding:m=0}=Ri(e,t)||{};if(f==null)return{};const p=FP(m),g={x:n,y:r},y=yx(o),x=vx(y),S=await s.getDimensions(f),E=y==="y",_=E?"top":"left",b=E?"bottom":"right",C=E?"clientHeight":"clientWidth",R=i.reference[x]+i.reference[y]-g[y]-i.floating[x],k=g[y]-i.reference[y],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let A=O?O[C]:0;(!A||!await(s.isElement==null?void 0:s.isElement(O)))&&(A=l.floating[C]||i.floating[x]);const I=R/2-k/2,z=A/2-S[x]/2-1,H=Os(p[_],z),ie=Os(p[b],z),K=H,te=A-S[x]-ie,U=A/2-S[x]/2+I,re=p1(K,U,te),V=!u.arrow&&Rc(o)!=null&&U!=re&&i.reference[x]/2-(UK<=0)){var z,H;const K=(((z=i.flip)==null?void 0:z.index)||0)+1,te=k[K];if(te)return{data:{index:K,overflows:I},reset:{placement:te}};let U=(H=I.filter(re=>re.overflows[0]<=0).sort((re,V)=>re.overflows[1]-V.overflows[1])[0])==null?void 0:H.placement;if(!U)switch(y){case"bestFit":{var ie;const re=(ie=I.map(V=>[V.placement,V.overflows.filter(J=>J>0).reduce((J,G)=>J+G,0)]).sort((V,J)=>V[1]-J[1])[0])==null?void 0:ie[0];re&&(U=re);break}case"initialPlacement":U=l;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function VC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function WC(e){return kz.some(t=>e[t]>=0)}const Bz=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ri(e,t);switch(r){case"referenceHidden":{const i=await ld(t,{...o,elementContext:"reference"}),s=VC(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:WC(s)}}}case"escaped":{const i=await ld(t,{...o,altBoundary:!0}),s=VC(i,n.floating);return{data:{escapedOffsets:s,escaped:WC(s)}}}default:return{}}}}};async function zz(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Pi(n),l=Rc(n),u=Pc(n)==="y",f=["left","top"].includes(s)?-1:1,m=i&&u?-1:1,p=Ri(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return l&&typeof x=="number"&&(y=l==="end"?x*-1:x),u?{x:y*m,y:g*f}:{x:g*f,y:y*m}}const Uz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await zz(t,e);return{x:n+o.x,y:r+o.y,data:o}}}},Vz=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:l={fn:E=>{let{x:_,y:b}=E;return{x:_,y:b}}},...u}=Ri(e,t),f={x:n,y:r},m=await ld(t,u),p=Pc(Pi(o)),g=gx(p);let y=f[g],x=f[p];if(i){const E=g==="y"?"top":"left",_=g==="y"?"bottom":"right",b=y+m[E],C=y-m[_];y=p1(b,y,C)}if(s){const E=p==="y"?"top":"left",_=p==="y"?"bottom":"right",b=x+m[E],C=x-m[_];x=p1(b,x,C)}const S=l.fn({...t,[g]:y,[p]:x});return{...S,data:{x:S.x-n,y:S.y-r}}}}},Wz=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=Ri(e,t),m={x:n,y:r},p=Pc(o),g=gx(p);let y=m[g],x=m[p];const S=Ri(l,t),E=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(u){const C=g==="y"?"height":"width",R=i.reference[g]-i.floating[C]+E.mainAxis,k=i.reference[g]+i.reference[C]-E.mainAxis;yk&&(y=k)}if(f){var _,b;const C=g==="y"?"width":"height",R=["top","left"].includes(Pi(o)),k=i.reference[p]-i.floating[C]+(R&&((_=s.offset)==null?void 0:_[p])||0)+(R?0:E.crossAxis),O=i.reference[p]+i.reference[C]+(R?0:((b=s.offset)==null?void 0:b[p])||0)-(R?E.crossAxis:0);xO&&(x=O)}return{[g]:y,[p]:x}}}},Hz=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...l}=Ri(e,t),u=await ld(t,l),f=Pi(n),m=Rc(n),p=Pc(n)==="y",{width:g,height:y}=r.floating;let x,S;f==="top"||f==="bottom"?(x=f,S=m===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(S=f,x=m==="end"?"top":"bottom");const E=y-u[x],_=g-u[S],b=!t.middlewareData.shift;let C=E,R=_;if(p){const O=g-u.left-u.right;R=m||b?Os(_,O):O}else{const O=y-u.top-u.bottom;C=m||b?Os(E,O):O}if(b&&!m){const O=pr(u.left,0),A=pr(u.right,0),I=pr(u.top,0),z=pr(u.bottom,0);p?R=g-2*(O!==0||A!==0?O+A:pr(u.left,u.right)):C=y-2*(I!==0||z!==0?I+z:pr(u.top,u.bottom))}await s({...t,availableWidth:R,availableHeight:C});const k=await o.getDimensions(i.floating);return g!==k.width||y!==k.height?{reset:{rects:!0}}:{}}}};function Ds(e){return jP(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Di(e){var t;return(t=(jP(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jP(e){return e instanceof Node||e instanceof yr(e).Node}function Ti(e){return e instanceof Element||e instanceof yr(e).Element}function Jo(e){return e instanceof HTMLElement||e instanceof yr(e).HTMLElement}function HC(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yr(e).ShadowRoot}function Ld(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Jr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Kz(e){return["table","td","th"].includes(Ds(e))}function wx(e){const t=xx(),n=Jr(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Gz(e){let t=dc(e);for(;Jo(t)&&!Hm(t);){if(wx(t))return t;t=dc(t)}return null}function xx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Hm(e){return["html","body","#document"].includes(Ds(e))}function Jr(e){return yr(e).getComputedStyle(e)}function Km(e){return Ti(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function dc(e){if(Ds(e)==="html")return e;const t=e.assignedSlot||e.parentNode||HC(e)&&e.host||Di(e);return HC(t)?t.host:t}function BP(e){const t=dc(e);return Hm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Jo(t)&&Ld(t)?t:BP(t)}function cd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=BP(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=yr(o);return i?t.concat(s,s.visualViewport||[],Ld(o)?o:[],s.frameElement&&n?cd(s.frameElement):[]):t.concat(o,cd(o,[],n))}function zP(e){const t=Jr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Jo(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=jp(n)!==i||jp(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function bx(e){return Ti(e)?e:e.contextElement}function Il(e){const t=bx(e);if(!Jo(t))return Ns(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=zP(t);let s=(i?jp(n.width):n.width)/r,l=(i?jp(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const Yz=Ns(0);function UP(e){const t=yr(e);return!xx()||!t.visualViewport?Yz:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Xz(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yr(e)?!1:t}function Ia(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=bx(e);let s=Ns(1);t&&(r?Ti(r)&&(s=Il(r)):s=Il(e));const l=Xz(i,n,r)?UP(i):Ns(0);let u=(o.left+l.x)/s.x,f=(o.top+l.y)/s.y,m=o.width/s.x,p=o.height/s.y;if(i){const g=yr(i),y=r&&Ti(r)?yr(r):r;let x=g.frameElement;for(;x&&r&&y!==g;){const S=Il(x),E=x.getBoundingClientRect(),_=Jr(x),b=E.left+(x.clientLeft+parseFloat(_.paddingLeft))*S.x,C=E.top+(x.clientTop+parseFloat(_.paddingTop))*S.y;u*=S.x,f*=S.y,m*=S.x,p*=S.y,u+=b,f+=C,x=yr(x).frameElement}}return zp({width:m,height:p,x:u,y:f})}function Zz(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Jo(n),i=Di(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},l=Ns(1);const u=Ns(0);if((o||!o&&r!=="fixed")&&((Ds(n)!=="body"||Ld(i))&&(s=Km(n)),Jo(n))){const f=Ia(n);l=Il(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-s.scrollLeft*l.x+u.x,y:t.y*l.y-s.scrollTop*l.y+u.y}}function qz(e){return Array.from(e.getClientRects())}function VP(e){return Ia(Di(e)).left+Km(e).scrollLeft}function Qz(e){const t=Di(e),n=Km(e),r=e.ownerDocument.body,o=pr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=pr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+VP(e);const l=-n.scrollTop;return Jr(r).direction==="rtl"&&(s+=pr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}function Jz(e,t){const n=yr(e),r=Di(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,u=0;if(o){i=o.width,s=o.height;const f=xx();(!f||f&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:i,height:s,x:l,y:u}}function eU(e,t){const n=Ia(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Jo(e)?Il(e):Ns(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,u=o*i.x,f=r*i.y;return{width:s,height:l,x:u,y:f}}function KC(e,t,n){let r;if(t==="viewport")r=Jz(e,n);else if(t==="document")r=Qz(Di(e));else if(Ti(t))r=eU(t,n);else{const o=UP(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return zp(r)}function WP(e,t){const n=dc(e);return n===t||!Ti(n)||Hm(n)?!1:Jr(n).position==="fixed"||WP(n,t)}function tU(e,t){const n=t.get(e);if(n)return n;let r=cd(e,[],!1).filter(l=>Ti(l)&&Ds(l)!=="body"),o=null;const i=Jr(e).position==="fixed";let s=i?dc(e):e;for(;Ti(s)&&!Hm(s);){const l=Jr(s),u=wx(s);!u&&l.position==="fixed"&&(o=null),(i?!u&&!o:!u&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ld(s)&&!u&&WP(e,s))?r=r.filter(m=>m!==s):o=l,s=dc(s)}return t.set(e,r),r}function nU(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?tU(t,this._c):[].concat(n),r],l=s[0],u=s.reduce((f,m)=>{const p=KC(t,m,o);return f.top=pr(p.top,f.top),f.right=Os(p.right,f.right),f.bottom=Os(p.bottom,f.bottom),f.left=pr(p.left,f.left),f},KC(t,l,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function rU(e){return zP(e)}function oU(e,t,n){const r=Jo(t),o=Di(t),i=n==="fixed",s=Ia(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=Ns(0);if(r||!r&&!i)if((Ds(t)!=="body"||Ld(o))&&(l=Km(t)),r){const f=Ia(t,!0,i,t);u.x=f.x+t.clientLeft,u.y=f.y+t.clientTop}else o&&(u.x=VP(o));return{x:s.left+l.scrollLeft-u.x,y:s.top+l.scrollTop-u.y,width:s.width,height:s.height}}function GC(e,t){return!Jo(e)||Jr(e).position==="fixed"?null:t?t(e):e.offsetParent}function HP(e,t){const n=yr(e);if(!Jo(e))return n;let r=GC(e,t);for(;r&&Kz(r)&&Jr(r).position==="static";)r=GC(r,t);return r&&(Ds(r)==="html"||Ds(r)==="body"&&Jr(r).position==="static"&&!wx(r))?n:r||Gz(e)||n}const iU=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||HP,i=this.getDimensions;return{reference:oU(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function sU(e){return Jr(e).direction==="rtl"}const aU={convertOffsetParentRelativeRectToViewportRelativeRect:Zz,getDocumentElement:Di,getClippingRect:nU,getOffsetParent:HP,getElementRects:iU,getClientRects:qz,getDimensions:rU,getScale:Il,isElement:Ti,isRTL:sU};function lU(e,t){let n=null,r;const o=Di(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const{left:f,top:m,width:p,height:g}=e.getBoundingClientRect();if(l||t(),!p||!g)return;const y=mh(m),x=mh(o.clientWidth-(f+p)),S=mh(o.clientHeight-(m+g)),E=mh(f),b={rootMargin:-y+"px "+-x+"px "+-S+"px "+-E+"px",threshold:pr(0,Os(1,u))||1};let C=!0;function R(k){const O=k[0].intersectionRatio;if(O!==u){if(!C)return s();O?s(!1,O):r=setTimeout(()=>{s(!1,1e-7)},100)}C=!1}try{n=new IntersectionObserver(R,{...b,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,b)}n.observe(e)}return s(!0),i}function cU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=bx(e),m=o||i?[...f?cd(f):[],...cd(t)]:[];m.forEach(_=>{o&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const p=f&&l?lU(f,n):null;let g=-1,y=null;s&&(y=new ResizeObserver(_=>{let[b]=_;b&&b.target===f&&y&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),f&&!u&&y.observe(f),y.observe(t));let x,S=u?Ia(e):null;u&&E();function E(){const _=Ia(e);S&&(_.x!==S.x||_.y!==S.y||_.width!==S.width||_.height!==S.height)&&n(),S=_,x=requestAnimationFrame(E)}return n(),()=>{m.forEach(_=>{o&&_.removeEventListener("scroll",n),i&&_.removeEventListener("resize",n)}),p&&p(),y&&y.disconnect(),y=null,u&&cancelAnimationFrame(x)}}const uU=(e,t,n)=>{const r=new Map,o={platform:aU,...n},i={...o.platform,_c:r};return Fz(e,t,{...o,platform:i})},dU=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?UC({element:r.current,padding:o}).fn(n):{}:r?UC({element:r,padding:o}).fn(n):{}}}};var Jh=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Up(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(!Up(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)&&!Up(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function KP(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function YC(e,t){const n=KP(e);return Math.round(t*n)/n}function XC(e){const t=d.useRef(e);return Jh(()=>{t.current=e}),t}function fU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:u,open:f}=e,[m,p]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=d.useState(r);Up(g,r)||y(r);const[x,S]=d.useState(null),[E,_]=d.useState(null),b=d.useCallback(V=>{V!=O.current&&(O.current=V,S(V))},[S]),C=d.useCallback(V=>{V!==A.current&&(A.current=V,_(V))},[_]),R=i||x,k=s||E,O=d.useRef(null),A=d.useRef(null),I=d.useRef(m),z=XC(u),H=XC(o),ie=d.useCallback(()=>{if(!O.current||!A.current)return;const V={placement:t,strategy:n,middleware:g};H.current&&(V.platform=H.current),uU(O.current,A.current,V).then(J=>{const G={...J,isPositioned:!0};K.current&&!Up(I.current,G)&&(I.current=G,Bs.flushSync(()=>{p(G)}))})},[g,t,n,H]);Jh(()=>{f===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,p(V=>({...V,isPositioned:!1})))},[f]);const K=d.useRef(!1);Jh(()=>(K.current=!0,()=>{K.current=!1}),[]),Jh(()=>{if(R&&(O.current=R),k&&(A.current=k),R&&k){if(z.current)return z.current(R,k,ie);ie()}},[R,k,ie,z]);const te=d.useMemo(()=>({reference:O,floating:A,setReference:b,setFloating:C}),[b,C]),U=d.useMemo(()=>({reference:R,floating:k}),[R,k]),re=d.useMemo(()=>{const V={position:n,left:0,top:0};if(!U.floating)return V;const J=YC(U.floating,m.x),G=YC(U.floating,m.y);return l?{...V,transform:"translate("+J+"px, "+G+"px)",...KP(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:G}},[n,l,U.floating,m.x,m.y]);return d.useMemo(()=>({...m,update:ie,refs:te,elements:U,floatingStyles:re}),[m,ie,te,U,re])}function Sx(e){const[t,n]=d.useState(void 0);return Pn(()=>{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,l;if("borderBoxSize"in i){const u=i.borderBoxSize,f=Array.isArray(u)?u[0]:u;s=f.inlineSize,l=f.blockSize}else s=e.offsetWidth,l=e.offsetHeight;n({width:s,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const GP="Popper",[YP,zs]=Tn(GP),[hU,XP]=YP(GP),pU=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return d.createElement(hU,{scope:t,anchor:r,onAnchorChange:o},n)},mU="PopperAnchor",gU=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=XP(mU,n),s=d.useRef(null),l=Ve(t,s);return d.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:d.createElement(Ae.div,Y({},o,{ref:l}))}),ZP="PopperContent",[vU,ute]=YP(ZP),yU=d.forwardRef((e,t)=>{var n,r,o,i,s,l,u,f;const{__scopePopper:m,side:p="bottom",sideOffset:g=0,align:y="center",alignOffset:x=0,arrowPadding:S=0,avoidCollisions:E=!0,collisionBoundary:_=[],collisionPadding:b=0,sticky:C="partial",hideWhenDetached:R=!1,updatePositionStrategy:k="optimized",onPlaced:O,...A}=e,I=XP(ZP,m),[z,H]=d.useState(null),ie=Ve(t,Yt=>H(Yt)),[K,te]=d.useState(null),U=Sx(K),re=(n=U==null?void 0:U.width)!==null&&n!==void 0?n:0,V=(r=U==null?void 0:U.height)!==null&&r!==void 0?r:0,J=p+(y!=="center"?"-"+y:""),G=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},Z=Array.isArray(_)?_:[_],Q=Z.length>0,le={padding:G,boundary:Z.filter(wU),altBoundary:Q},{refs:L,floatingStyles:ue,placement:Ne,isPositioned:Ke,middlewareData:Me}=fU({strategy:"fixed",placement:J,whileElementsMounted:(...Yt)=>cU(...Yt,{animationFrame:k==="always"}),elements:{reference:I.anchor},middleware:[Uz({mainAxis:g+V,alignmentAxis:x}),E&&Vz({mainAxis:!0,crossAxis:!1,limiter:C==="partial"?Wz():void 0,...le}),E&&jz({...le}),Hz({...le,apply:({elements:Yt,rects:rr,availableWidth:Jt,availableHeight:Li})=>{const{width:N,height:X}=rr.reference,ee=Yt.floating.style;ee.setProperty("--radix-popper-available-width",`${Jt}px`),ee.setProperty("--radix-popper-available-height",`${Li}px`),ee.setProperty("--radix-popper-anchor-width",`${N}px`),ee.setProperty("--radix-popper-anchor-height",`${X}px`)}}),K&&dU({element:K,padding:S}),xU({arrowWidth:re,arrowHeight:V}),R&&Bz({strategy:"referenceHidden",...le})]}),[me,be]=qP(Ne),Ee=Lt(O);Pn(()=>{Ke&&(Ee==null||Ee())},[Ke,Ee]);const Oe=(o=Me.arrow)===null||o===void 0?void 0:o.x,Ie=(i=Me.arrow)===null||i===void 0?void 0:i.y,ze=((s=Me.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[ht,st]=d.useState();return Pn(()=>{z&&st(window.getComputedStyle(z).zIndex)},[z]),d.createElement("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...ue,transform:Ke?ue.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ht,"--radix-popper-transform-origin":[(l=Me.transformOrigin)===null||l===void 0?void 0:l.x,(u=Me.transformOrigin)===null||u===void 0?void 0:u.y].join(" ")},dir:e.dir},d.createElement(vU,{scope:m,placedSide:me,onArrowChange:te,arrowX:Oe,arrowY:Ie,shouldHideArrow:ze},d.createElement(Ae.div,Y({"data-side":me,"data-align":be},A,{ref:ie,style:{...A.style,animation:Ke?void 0:"none",opacity:(f=Me.hide)!==null&&f!==void 0&&f.referenceHidden?0:void 0}}))))});function wU(e){return e!==null}const xU=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,s;const{placement:l,rects:u,middlewareData:f}=t,p=((n=f.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,g=p?0:e.arrowWidth,y=p?0:e.arrowHeight,[x,S]=qP(l),E={start:"0%",center:"50%",end:"100%"}[S],_=((r=(o=f.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+g/2,b=((i=(s=f.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+y/2;let C="",R="";return x==="bottom"?(C=p?E:`${_}px`,R=`${-y}px`):x==="top"?(C=p?E:`${_}px`,R=`${u.floating.height+y}px`):x==="right"?(C=`${-y}px`,R=p?E:`${b}px`):x==="left"&&(C=`${u.floating.width+y}px`,R=p?E:`${b}px`),{data:{x:C,y:R}}}});function qP(e){const[t,n="center"]=e.split("-");return[t,n]}const Fd=pU,Gm=gU,Ym=yU,jd=d.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?JI.createPortal(d.createElement(Ae.div,Y({},o,{ref:t})),r):null});function bU(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const xn=e=>{const{present:t,children:n}=e,r=SU(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),i=Ve(r.ref,o.ref);return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:i}):null};xn.displayName="Presence";function SU(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),i=d.useRef("none"),s=e?"mounted":"unmounted",[l,u]=bU(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const f=gh(r.current);i.current=l==="mounted"?f:"none"},[l]),Pn(()=>{const f=r.current,m=o.current;if(m!==e){const g=i.current,y=gh(f);e?u("MOUNT"):y==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(m&&g!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Pn(()=>{if(t){const f=p=>{const y=gh(r.current).includes(p.animationName);p.target===t&&y&&Bs.flushSync(()=>u("ANIMATION_END"))},m=p=>{p.target===t&&(i.current=gh(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(f=>{f&&(r.current=getComputedStyle(f)),n(f)},[])}}function gh(e){return(e==null?void 0:e.animationName)||"none"}function eo({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=_U({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,l=Lt(n),u=d.useCallback(f=>{if(i){const p=typeof f=="function"?f(e):f;p!==e&&l(p)}else o(f)},[i,e,o,l]);return[s,u]}function _U({defaultProp:e,onChange:t}){const n=d.useState(e),[r]=n,o=d.useRef(r),i=Lt(t);return d.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const Xm=d.forwardRef((e,t)=>d.createElement(Ae.span,Y({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),EU=Xm,[Zm,dte]=Tn("Tooltip",[zs]),_x=zs(),CU="TooltipProvider",$U=700,g1="tooltip.open",[RU,Ex]=Zm(CU),PU=e=>{const{__scopeTooltip:t,delayDuration:n=$U,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,l]=d.useState(!0),u=d.useRef(!1),f=d.useRef(0);return d.useEffect(()=>{const m=f.current;return()=>window.clearTimeout(m)},[]),d.createElement(RU,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(f.current),l(!1)},[]),onClose:d.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>l(!0),r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:d.useCallback(m=>{u.current=m},[]),disableHoverableContent:o},i)},Cx="Tooltip",[TU,qm]=Zm(Cx),kU=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:l}=e,u=Ex(Cx,e.__scopeTooltip),f=_x(t),[m,p]=d.useState(null),g=tr(),y=d.useRef(0),x=s??u.disableHoverableContent,S=l??u.delayDuration,E=d.useRef(!1),[_=!1,b]=eo({prop:r,defaultProp:o,onChange:A=>{A?(u.onOpen(),document.dispatchEvent(new CustomEvent(g1))):u.onClose(),i==null||i(A)}}),C=d.useMemo(()=>_?E.current?"delayed-open":"instant-open":"closed",[_]),R=d.useCallback(()=>{window.clearTimeout(y.current),E.current=!1,b(!0)},[b]),k=d.useCallback(()=>{window.clearTimeout(y.current),b(!1)},[b]),O=d.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{E.current=!0,b(!0)},S)},[S,b]);return d.useEffect(()=>()=>window.clearTimeout(y.current),[]),d.createElement(Fd,f,d.createElement(TU,{scope:t,contentId:g,open:_,stateAttribute:C,trigger:m,onTriggerChange:p,onTriggerEnter:d.useCallback(()=>{u.isOpenDelayed?O():R()},[u.isOpenDelayed,O,R]),onTriggerLeave:d.useCallback(()=>{x?k():window.clearTimeout(y.current)},[k,x]),onOpen:R,onClose:k,disableHoverableContent:x},n))},ZC="TooltipTrigger",AU=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=qm(ZC,n),i=Ex(ZC,n),s=_x(n),l=d.useRef(null),u=Ve(t,l,o.onTriggerChange),f=d.useRef(!1),m=d.useRef(!1),p=d.useCallback(()=>f.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),d.createElement(Gm,Y({asChild:!0},s),d.createElement(Ae.button,Y({"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute},r,{ref:u,onPointerMove:fe(e.onPointerMove,g=>{g.pointerType!=="touch"&&!m.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),m.current=!0)}),onPointerLeave:fe(e.onPointerLeave,()=>{o.onTriggerLeave(),m.current=!1}),onPointerDown:fe(e.onPointerDown,()=>{f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:fe(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:fe(e.onBlur,o.onClose),onClick:fe(e.onClick,o.onClose)})))}),MU="TooltipPortal",[fte,OU]=Zm(MU,{forceMount:void 0}),ud="TooltipContent",NU=d.forwardRef((e,t)=>{const n=OU(ud,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=qm(ud,e.__scopeTooltip);return d.createElement(xn,{present:r||s.open},s.disableHoverableContent?d.createElement(QP,Y({side:o},i,{ref:t})):d.createElement(DU,Y({side:o},i,{ref:t})))}),DU=d.forwardRef((e,t)=>{const n=qm(ud,e.__scopeTooltip),r=Ex(ud,e.__scopeTooltip),o=d.useRef(null),i=Ve(t,o),[s,l]=d.useState(null),{trigger:u,onClose:f}=n,m=o.current,{onPointerInTransitChange:p}=r,g=d.useCallback(()=>{l(null),p(!1)},[p]),y=d.useCallback((x,S)=>{const E=x.currentTarget,_={x:x.clientX,y:x.clientY},b=LU(_,E.getBoundingClientRect()),C=FU(_,b),R=jU(S.getBoundingClientRect()),k=zU([...C,...R]);l(k),p(!0)},[p]);return d.useEffect(()=>()=>g(),[g]),d.useEffect(()=>{if(u&&m){const x=E=>y(E,m),S=E=>y(E,u);return u.addEventListener("pointerleave",x),m.addEventListener("pointerleave",S),()=>{u.removeEventListener("pointerleave",x),m.removeEventListener("pointerleave",S)}}},[u,m,y,g]),d.useEffect(()=>{if(s){const x=S=>{const E=S.target,_={x:S.clientX,y:S.clientY},b=(u==null?void 0:u.contains(E))||(m==null?void 0:m.contains(E)),C=!BU(_,s);b?g():C&&(g(),f())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,m,s,f,g]),d.createElement(QP,Y({},e,{ref:i}))}),[IU,hte]=Zm(Cx,{isInside:!1}),QP=d.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...l}=e,u=qm(ud,n),f=_x(n),{onClose:m}=u;return d.useEffect(()=>(document.addEventListener(g1,m),()=>document.removeEventListener(g1,m)),[m]),d.useEffect(()=>{if(u.trigger){const p=g=>{const y=g.target;y!=null&&y.contains(u.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[u.trigger,m]),d.createElement($c,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:p=>p.preventDefault(),onDismiss:m},d.createElement(Ym,Y({"data-state":u.stateAttribute},f,l,{ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),d.createElement(fx,null,r),d.createElement(IU,{scope:n,isInside:!0},d.createElement(EU,{id:u.contentId,role:"tooltip"},o||r))))});function LU(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function FU(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function jU(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function BU(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=m>r&&n<(f-l)*(r-u)/(m-u)+l&&(o=!o)}return o}function zU(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),UU(t)}function UU(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const VU=PU,WU=kU,HU=AU,JP=NU,KU=VU,eT=WU,tT=HU,$x=d.forwardRef(({className:e,sideOffset:t=4,...n},r)=>v.jsx(JP,{ref:r,sideOffset:t,className:xe("z-50 border overflow-hidden rounded-md bg-background text-foreground px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));$x.displayName=JP.displayName;const Rx=Fm("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),vn=d.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?Qo:"button";return v.jsx(s,{className:xe(Rx({variant:t,size:n,className:e}),"outline-none cursor-default select-none"),ref:i,tabIndex:-1,...o})});vn.displayName="Button";const Zn=d.forwardRef(({tooltip:e,children:t,...n},r)=>v.jsxs(eT,{children:[v.jsx(tT,{asChild:!0,children:v.jsx(vn,{variant:"ghost",size:"icon",...n,ref:r,tabIndex:-1,className:"cursor-default bg-background",children:v.jsx("div",{className:"icon-button-icon-wrapper",children:t})})}),v.jsx($x,{children:v.jsx("p",{children:e})})]})),nT=e=>{const{onFileUpload:t,children:n,...r}=e,[o]=d.useState(`file-upload-${Math.random().toString()}`),i=s=>{var u;const l=(u=s.currentTarget.files)==null?void 0:u[0];l&&t(l)};return v.jsxs(v.Fragment,{children:[v.jsx("label",{htmlFor:o,children:v.jsx(Zn,{...r,asChild:!0,children:n})}),v.jsx(Wm,{style:{display:"none"},id:o,name:o,type:"file",onChange:i,accept:"image/png, image/jpeg"})]})};function GU(e,t){const[n,r]=d.useState(e);return d.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}function rT(e){const[t,n]=d.useState(()=>typeof e=="boolean"?e:!!e),r=d.useCallback(o=>n(typeof o=="boolean"?o:i=>!i),[]);return[t,r]}const P0="focusScope.autoFocusOnMount",T0="focusScope.autoFocusOnUnmount",qC={bubbles:!1,cancelable:!0},Qm=d.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[l,u]=d.useState(null),f=Lt(o),m=Lt(i),p=d.useRef(null),g=Ve(t,S=>u(S)),y=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let b=function(O){if(y.paused||!l)return;const A=O.target;l.contains(A)?p.current=A:ts(p.current,{select:!0})},C=function(O){if(y.paused||!l)return;const A=O.relatedTarget;A!==null&&(l.contains(A)||ts(p.current,{select:!0}))},R=function(O){if(document.activeElement===document.body)for(const I of O)I.removedNodes.length>0&&ts(l)};var S=b,E=C,_=R;document.addEventListener("focusin",b),document.addEventListener("focusout",C);const k=new MutationObserver(R);return l&&k.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",C),k.disconnect()}}},[r,l,y.paused]),d.useEffect(()=>{if(l){JC.add(y);const S=document.activeElement;if(!l.contains(S)){const _=new CustomEvent(P0,qC);l.addEventListener(P0,f),l.dispatchEvent(_),_.defaultPrevented||(YU(JU(oT(l)),{select:!0}),document.activeElement===S&&ts(l))}return()=>{l.removeEventListener(P0,f),setTimeout(()=>{const _=new CustomEvent(T0,qC);l.addEventListener(T0,m),l.dispatchEvent(_),_.defaultPrevented||ts(S??document.body,{select:!0}),l.removeEventListener(T0,m),JC.remove(y)},0)}}},[l,f,m,y]);const x=d.useCallback(S=>{if(!n&&!r||y.paused)return;const E=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,_=document.activeElement;if(E&&_){const b=S.currentTarget,[C,R]=XU(b);C&&R?!S.shiftKey&&_===R?(S.preventDefault(),n&&ts(C,{select:!0})):S.shiftKey&&_===C&&(S.preventDefault(),n&&ts(R,{select:!0})):_===b&&S.preventDefault()}},[n,r,y.paused]);return d.createElement(Ae.div,Y({tabIndex:-1},s,{ref:g,onKeyDown:x}))});function YU(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ts(r,{select:t}),document.activeElement!==n)return}function XU(e){const t=oT(e),n=QC(t,e),r=QC(t.reverse(),e);return[n,r]}function oT(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function QC(e,t){for(const n of e)if(!ZU(n,{upTo:t}))return n}function ZU(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function qU(e){return e instanceof HTMLInputElement&&"select"in e}function ts(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qU(e)&&t&&e.select()}}const JC=QU();function QU(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=e2(e,t),e.unshift(t)},remove(t){var n;e=e2(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function e2(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function JU(e){return e.filter(t=>t.tagName!=="A")}let k0=0;function Jm(){d.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:t2()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:t2()),k0++,()=>{k0===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),k0--}},[])}function t2(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Bo=function(){return Bo=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return gV;var t=vV(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])}},wV=lT(),xV=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),` .`.concat(tV,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } body { 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(l,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(ep,` { right: `).concat(l,"px ").concat(r,`; } .`).concat(tp,` { margin-right: `).concat(l,"px ").concat(r,`; } .`).concat(ep," .").concat(ep,` { right: 0 `).concat(r,`; } .`).concat(tp," .").concat(tp,` { margin-right: 0 `).concat(r,`; } body { `).concat(nV,": ").concat(l,`px; } `)},bV=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,i=d.useMemo(function(){return yV(o)},[o]);return d.createElement(wV,{styles:xV(i,!t,o,n?"":"!important")})},v1=!1;if(typeof window<"u")try{var vh=Object.defineProperty({},"passive",{get:function(){return v1=!0,!0}});window.addEventListener("test",vh,vh),window.removeEventListener("test",vh,vh)}catch{v1=!1}var sl=v1?{passive:!1}:!1,SV=function(e){return e.tagName==="TEXTAREA"},cT=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!SV(e)&&n[t]==="visible")},_V=function(e){return cT(e,"overflowY")},EV=function(e){return cT(e,"overflowX")},r2=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=uT(e,n);if(r){var o=dT(e,n),i=o[1],s=o[2];if(i>s)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},CV=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},$V=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},uT=function(e,t){return e==="v"?_V(t):EV(t)},dT=function(e,t){return e==="v"?CV(t):$V(t)},RV=function(e,t){return e==="h"&&t==="rtl"?-1:1},PV=function(e,t,n,r,o){var i=RV(e,window.getComputedStyle(t).direction),s=i*r,l=n.target,u=t.contains(l),f=!1,m=s>0,p=0,g=0;do{var y=dT(e,l),x=y[0],S=y[1],E=y[2],_=S-E-i*x;(x||_)&&uT(e,l)&&(p+=_,g+=x),l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(m&&(o&&p===0||!o&&s>p)||!m&&(o&&g===0||!o&&-s>g))&&(f=!0),f},yh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},o2=function(e){return[e.deltaX,e.deltaY]},i2=function(e){return e&&"current"in e?e.current:e},TV=function(e,t){return e[0]===t[0]&&e[1]===t[1]},kV=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},AV=0,al=[];function MV(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(AV++)[0],i=d.useState(function(){return lT()})[0],s=d.useRef(e);d.useEffect(function(){s.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var S=eV([e.lockRef.current],(e.shards||[]).map(i2),!0).filter(Boolean);return S.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),S.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=d.useCallback(function(S,E){if("touches"in S&&S.touches.length===2)return!s.current.allowPinchZoom;var _=yh(S),b=n.current,C="deltaX"in S?S.deltaX:b[0]-_[0],R="deltaY"in S?S.deltaY:b[1]-_[1],k,O=S.target,A=Math.abs(C)>Math.abs(R)?"h":"v";if("touches"in S&&A==="h"&&O.type==="range")return!1;var I=r2(A,O);if(!I)return!0;if(I?k=A:(k=A==="v"?"h":"v",I=r2(A,O)),!I)return!1;if(!r.current&&"changedTouches"in S&&(C||R)&&(r.current=k),!k)return!0;var z=r.current||k;return PV(z,E,S,z==="h"?C:R,!0)},[]),u=d.useCallback(function(S){var E=S;if(!(!al.length||al[al.length-1]!==i)){var _="deltaY"in E?o2(E):yh(E),b=t.current.filter(function(k){return k.name===E.type&&k.target===E.target&&TV(k.delta,_)})[0];if(b&&b.should){E.cancelable&&E.preventDefault();return}if(!b){var C=(s.current.shards||[]).map(i2).filter(Boolean).filter(function(k){return k.contains(E.target)}),R=C.length>0?l(E,C[0]):!s.current.noIsolation;R&&E.cancelable&&E.preventDefault()}}},[]),f=d.useCallback(function(S,E,_,b){var C={name:S,delta:E,target:_,should:b};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(R){return R!==C})},1)},[]),m=d.useCallback(function(S){n.current=yh(S),r.current=void 0},[]),p=d.useCallback(function(S){f(S.type,o2(S),S.target,l(S,e.lockRef.current))},[]),g=d.useCallback(function(S){f(S.type,yh(S),S.target,l(S,e.lockRef.current))},[]);d.useEffect(function(){return al.push(i),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:g}),document.addEventListener("wheel",u,sl),document.addEventListener("touchmove",u,sl),document.addEventListener("touchstart",m,sl),function(){al=al.filter(function(S){return S!==i}),document.removeEventListener("wheel",u,sl),document.removeEventListener("touchmove",u,sl),document.removeEventListener("touchstart",m,sl)}},[]);var y=e.removeScrollBar,x=e.inert;return d.createElement(d.Fragment,null,x?d.createElement(i,{styles:kV(o)}):null,y?d.createElement(bV,{gapMode:"margin"}):null)}const OV=cV(aT,MV);var fT=d.forwardRef(function(e,t){return d.createElement(eg,Bo({},e,{ref:t,sideCar:OV}))});fT.classNames=eg.classNames;const tg=fT;var NV=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ll=new WeakMap,wh=new WeakMap,xh={},O0=0,hT=function(e){return e&&(e.host||hT(e.parentNode))},DV=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=hT(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},IV=function(e,t,n,r){var o=DV(t,Array.isArray(e)?e:[e]);xh[n]||(xh[n]=new WeakMap);var i=xh[n],s=[],l=new Set,u=new Set(o),f=function(p){!p||l.has(p)||(l.add(p),f(p.parentNode))};o.forEach(f);var m=function(p){!p||u.has(p)||Array.prototype.forEach.call(p.children,function(g){if(l.has(g))m(g);else{var y=g.getAttribute(r),x=y!==null&&y!=="false",S=(ll.get(g)||0)+1,E=(i.get(g)||0)+1;ll.set(g,S),i.set(g,E),s.push(g),S===1&&x&&wh.set(g,!0),E===1&&g.setAttribute(n,"true"),x||g.setAttribute(r,"true")}})};return m(t),l.clear(),O0++,function(){s.forEach(function(p){var g=ll.get(p)-1,y=i.get(p)-1;ll.set(p,g),i.set(p,y),g||(wh.has(p)||p.removeAttribute(r),wh.delete(p)),y||p.removeAttribute(n)}),O0--,O0||(ll=new WeakMap,ll=new WeakMap,wh=new WeakMap,xh={})}},ng=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||NV(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),IV(r,o,n,"aria-hidden")):function(){return null}};const pT="Dialog",[mT,gT]=Tn(pT),[LV,$o]=mT(pT),FV=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,l=d.useRef(null),u=d.useRef(null),[f=!1,m]=eo({prop:r,defaultProp:o,onChange:i});return d.createElement(LV,{scope:t,triggerRef:l,contentRef:u,contentId:tr(),titleId:tr(),descriptionId:tr(),open:f,onOpenChange:m,onOpenToggle:d.useCallback(()=>m(p=>!p),[m]),modal:s},n)},jV="DialogTrigger",vT=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$o(jV,n),i=Ve(t,o.triggerRef);return d.createElement(Ae.button,Y({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Px(o.open)},r,{ref:i,onClick:fe(e.onClick,o.onOpenToggle)}))}),yT="DialogPortal",[BV,wT]=mT(yT,{forceMount:void 0}),zV=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=$o(yT,t);return d.createElement(BV,{scope:t,forceMount:n},d.Children.map(r,s=>d.createElement(xn,{present:n||i.open},d.createElement(jd,{asChild:!0,container:o},s))))},y1="DialogOverlay",UV=d.forwardRef((e,t)=>{const n=wT(y1,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=$o(y1,e.__scopeDialog);return i.modal?d.createElement(xn,{present:r||i.open},d.createElement(VV,Y({},o,{ref:t}))):null}),VV=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$o(y1,n);return d.createElement(tg,{as:Qo,allowPinchZoom:!0,shards:[o.contentRef]},d.createElement(Ae.div,Y({"data-state":Px(o.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),fc="DialogContent",WV=d.forwardRef((e,t)=>{const n=wT(fc,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=$o(fc,e.__scopeDialog);return d.createElement(xn,{present:r||i.open},i.modal?d.createElement(HV,Y({},o,{ref:t})):d.createElement(KV,Y({},o,{ref:t})))}),HV=d.forwardRef((e,t)=>{const n=$o(fc,e.__scopeDialog),r=d.useRef(null),o=Ve(t,n.contentRef,r);return d.useEffect(()=>{const i=r.current;if(i)return ng(i)},[]),d.createElement(xT,Y({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&i.preventDefault()}),onFocusOutside:fe(e.onFocusOutside,i=>i.preventDefault())}))}),KV=d.forwardRef((e,t)=>{const n=$o(fc,e.__scopeDialog),r=d.useRef(!1),o=d.useRef(!1);return d.createElement(xT,Y({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,i),!i.defaultPrevented){var l;r.current||(l=n.triggerRef.current)===null||l===void 0||l.focus(),i.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:i=>{var s,l;(s=e.onInteractOutside)===null||s===void 0||s.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=i.target;((l=n.triggerRef.current)===null||l===void 0?void 0:l.contains(u))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}}))}),xT=d.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,l=$o(fc,n),u=d.useRef(null),f=Ve(t,u);return Jm(),d.createElement(d.Fragment,null,d.createElement(Qm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i},d.createElement($c,Y({role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Px(l.open)},s,{ref:f,onDismiss:()=>l.onOpenChange(!1)}))),!1)}),bT="DialogTitle",GV=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$o(bT,n);return d.createElement(Ae.h2,Y({id:o.titleId},r,{ref:t}))}),YV="DialogDescription",XV=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$o(YV,n);return d.createElement(Ae.p,Y({id:o.descriptionId},r,{ref:t}))}),ZV="DialogClose",qV=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=$o(ZV,n);return d.createElement(Ae.button,Y({type:"button"},r,{ref:t,onClick:fe(e.onClick,()=>o.onOpenChange(!1))}))});function Px(e){return e?"open":"closed"}const QV="DialogTitleWarning",[JV,pte]=vz(QV,{contentName:fc,titleName:bT,docsSlug:"dialog"}),Tx=FV,ST=vT,kx=zV,Bd=UV,zd=WV,Ud=GV,Vd=XV,Ax=qV,Mx=Tx,_T=ST,eW=kx,ET=d.forwardRef(({className:e,...t},n)=>v.jsx(Bd,{ref:n,className:xe("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));ET.displayName=Bd.displayName;const rg=d.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(eW,{children:[v.jsx(ET,{}),v.jsxs(zd,{ref:r,className:xe("fixed left-[50%] top-[50%] z-50 flex flex-col w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e,"outline-none"),onCloseAutoFocus:o=>o.preventDefault(),...n,children:[t,v.jsxs(Ax,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[v.jsx(CP,{className:"h-4 w-4"}),v.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));rg.displayName=zd.displayName;const CT=({className:e,...t})=>v.jsx("div",{className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});CT.displayName="DialogHeader";const og=d.forwardRef(({className:e,...t},n)=>v.jsx(Ud,{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));og.displayName=Ud.displayName;const tW=d.forwardRef(({className:e,...t},n)=>v.jsx(Vd,{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));tW.displayName=Vd.displayName;function w1(){return w1=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var cW=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,i=n.meta,s=n.mod,l=n.shift,u=n.ctrl,f=n.keys,m=t.key,p=t.code,g=t.ctrlKey,y=t.metaKey,x=t.shiftKey,S=t.altKey,E=gs(p),_=m.toLowerCase();if(!r){if(o===!S&&_!=="alt"||l===!x&&_!=="shift")return!1;if(s){if(!y&&!g)return!1}else if(i===!y&&_!=="meta"&&_!=="os"||u===!g&&_!=="ctrl"&&_!=="control")return!1}return f&&f.length===1&&(f.includes(_)||f.includes(E))?!0:f?oW(f):!f},uW=d.createContext(void 0),dW=function(){return d.useContext(uW)};function kT(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&kT(e[r],t[r])},!0):e===t}var fW=d.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),hW=function(){return d.useContext(fW)};function pW(e){var t=d.useRef(void 0);return kT(t.current,e)||(t.current=e),t.current}var s2=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},mW=typeof window<"u"?d.useLayoutEffect:d.useEffect;function gW(e,t,n,r){var o=d.useRef(null),i=d.useRef(!1),s=n instanceof Array?r instanceof Array?void 0:r:n,l=Ox(e)?e.join(s==null?void 0:s.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,f=d.useCallback(t,u??[]),m=d.useRef(f);u?m.current=f:m.current=t;var p=pW(s),g=hW(),y=g.enabledScopes,x=dW();return mW(function(){if(!((p==null?void 0:p.enabled)===!1||!lW(y,p==null?void 0:p.scopes))){var S=function(R,k){var O;if(k===void 0&&(k=!1),!(aW(R)&&!TT(R,p==null?void 0:p.enableOnFormTags))&&!(p!=null&&p.ignoreEventWhen!=null&&p.ignoreEventWhen(R))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){s2(R);return}(O=R.target)!=null&&O.isContentEditable&&!(p!=null&&p.enableOnContentEditable)||N0(l,p==null?void 0:p.splitKey).forEach(function(A){var I,z=D0(A,p==null?void 0:p.combinationKey);if(cW(R,z,p==null?void 0:p.ignoreModifiers)||(I=z.keys)!=null&&I.includes("*")){if(k&&i.current)return;if(iW(R,z,p==null?void 0:p.preventDefault),!sW(R,z,p==null?void 0:p.enabled)){s2(R);return}m.current(R,z),k||(i.current=!0)}})}},E=function(R){R.key!==void 0&&(RT(gs(R.code)),((p==null?void 0:p.keydown)===void 0&&(p==null?void 0:p.keyup)!==!0||p!=null&&p.keydown)&&S(R))},_=function(R){R.key!==void 0&&(PT(gs(R.code)),i.current=!1,p!=null&&p.keyup&&S(R,!0))},b=o.current||(s==null?void 0:s.document)||document;return b.addEventListener("keyup",_),b.addEventListener("keydown",E),x&&N0(l,p==null?void 0:p.splitKey).forEach(function(C){return x.addHotkey(D0(C,p==null?void 0:p.combinationKey,p==null?void 0:p.description))}),function(){b.removeEventListener("keyup",_),b.removeEventListener("keydown",E),x&&N0(l,p==null?void 0:p.splitKey).forEach(function(C){return x.removeHotkey(D0(C,p==null?void 0:p.combinationKey,p==null?void 0:p.description))})}}},[l,p,y]),o}const Yn=(e,t,n)=>{const r=xt(i=>i.disableShortCuts);return gW(e,t,{enabled:!r},n)};function dr(e){const{content:t,keys:n}=e;return v.jsxs("div",{className:"flex justify-between",children:[v.jsx("div",{children:t}),v.jsx("div",{className:"flex gap-[8px]",children:n.map(r=>v.jsx("div",{className:"border px-2 py-1 rounded-lg",children:r},r))})]})}const vW=function(){return/macintosh|mac os x/i.test(navigator.userAgent)},bh=()=>vW()?"Cmd":"Ctrl";function yW(){const[e,t]=rT(!1);return Yn("h",()=>{t()}),v.jsxs(Mx,{open:e,onOpenChange:t,children:[v.jsx(_T,{asChild:!0}),v.jsx(rg,{children:v.jsxs(CT,{children:[v.jsx(og,{children:"Hotkeys"}),v.jsxs("div",{className:"flex gap-2 flex-col pt-4",children:[v.jsx(dr,{content:"Pan",keys:["Space + Drag"]}),v.jsx(dr,{content:"Reset Zoom/Pan",keys:["Esc"]}),v.jsx(dr,{content:"Decrease Brush Size",keys:["["]}),v.jsx(dr,{content:"Increase Brush Size",keys:["]"]}),v.jsx(dr,{content:"View Original Image",keys:["Hold Tab"]}),v.jsx(dr,{content:"Undo",keys:[bh(),"Z"]}),v.jsx(dr,{content:"Redo",keys:[bh(),"Shift","Z"]}),v.jsx(dr,{content:"Copy Result",keys:[bh(),"C"]}),v.jsx(dr,{content:"Paste Image",keys:[bh(),"V"]}),v.jsx(dr,{content:"Trigger Manually Inpainting",keys:["Shift","R"]}),v.jsx(dr,{content:"Toggle Hotkeys Dialog",keys:["H"]}),v.jsx(dr,{content:"Toggle Settings Dialog",keys:["S"]}),v.jsx(dr,{content:"Toggle File Manager",keys:["F"]})]})]})})]})}function Nx(e){const[t]=d.useState(new Image),[n,r]=d.useState(!1);return d.useEffect(()=>{if(e)return t.onload=()=>{r(!0)},r(!1),t.src=URL.createObjectURL(e),()=>{t.onload=null}},[e,t]),[t,n]}const AT="Popover",[MT,mte]=Tn(AT,[zs]),Dx=zs(),[wW,Tc]=MT(AT),xW=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,l=Dx(t),u=d.useRef(null),[f,m]=d.useState(!1),[p=!1,g]=eo({prop:r,defaultProp:o,onChange:i});return d.createElement(Fd,l,d.createElement(wW,{scope:t,contentId:tr(),triggerRef:u,open:p,onOpenChange:g,onOpenToggle:d.useCallback(()=>g(y=>!y),[g]),hasCustomAnchor:f,onCustomAnchorAdd:d.useCallback(()=>m(!0),[]),onCustomAnchorRemove:d.useCallback(()=>m(!1),[]),modal:s},n))},bW="PopoverTrigger",SW=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Tc(bW,n),i=Dx(n),s=Ve(t,o.triggerRef),l=d.createElement(Ae.button,Y({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":DT(o.open)},r,{ref:s,onClick:fe(e.onClick,o.onOpenToggle)}));return o.hasCustomAnchor?l:d.createElement(Gm,Y({asChild:!0},i),l)}),OT="PopoverPortal",[_W,EW]=MT(OT,{forceMount:void 0}),CW=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=Tc(OT,t);return d.createElement(_W,{scope:t,forceMount:n},d.createElement(xn,{present:n||i.open},d.createElement(jd,{asChild:!0,container:o},r)))},dd="PopoverContent",$W=d.forwardRef((e,t)=>{const n=EW(dd,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=Tc(dd,e.__scopePopover);return d.createElement(xn,{present:r||i.open},i.modal?d.createElement(RW,Y({},o,{ref:t})):d.createElement(PW,Y({},o,{ref:t})))}),RW=d.forwardRef((e,t)=>{const n=Tc(dd,e.__scopePopover),r=d.useRef(null),o=Ve(t,r),i=d.useRef(!1);return d.useEffect(()=>{const s=r.current;if(s)return ng(s)},[]),d.createElement(tg,{as:Qo,allowPinchZoom:!0},d.createElement(NT,Y({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),i.current||(l=n.triggerRef.current)===null||l===void 0||l.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,f=l.button===2||u;i.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:fe(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})))}),PW=d.forwardRef((e,t)=>{const n=Tc(dd,e.__scopePopover),r=d.useRef(!1),o=d.useRef(!1);return d.createElement(NT,Y({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,i),!i.defaultPrevented){var l;r.current||(l=n.triggerRef.current)===null||l===void 0||l.focus(),i.preventDefault()}r.current=!1,o.current=!1},onInteractOutside:i=>{var s,l;(s=e.onInteractOutside)===null||s===void 0||s.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=i.target;((l=n.triggerRef.current)===null||l===void 0?void 0:l.contains(u))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}}))}),NT=d.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:m,...p}=e,g=Tc(dd,n),y=Dx(n);return Jm(),d.createElement(Qm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i},d.createElement($c,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:m,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onDismiss:()=>g.onOpenChange(!1)},d.createElement(Ym,Y({"data-state":DT(g.open),role:"dialog",id:g.contentId},y,p,{ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))});function DT(e){return e?"open":"closed"}const TW=xW,kW=SW,AW=CW,IT=$W,MW=TW,OW=kW,LT=d.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>v.jsx(AW,{children:v.jsx(IT,{ref:o,align:t,tabIndex:-1,sideOffset:n,className:xe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));LT.displayName=IT.displayName;function NW(){var e=d.useRef(!0);return e.current?(e.current=!1,!0):e.current}var DW=function(e,t){var n=NW();d.useEffect(function(){if(!n)return e()},t)};const IW=DW;var LW=function(){};function Ix(e){for(var t=[],n=1;n{const r=xt(s=>s.updateAppState),o=()=>{r({disableShortCuts:!0})},i=()=>{r({disableShortCuts:!1})};return v.jsx("textarea",{className:xe("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50","overflow-auto",e),tabIndex:-1,ref:n,onFocus:o,onBlur:i,...t})});jx.displayName="Textarea";const oH=()=>{const[e,t,n,r,o,i]=xt(x=>[x.getIsProcessing(),x.settings.prompt,x.updateSettings,x.runInpainting,x.showPrevMask,x.hidePrevMask]),[s,l]=Fx(!1),u=d.useRef(null);FT(u,()=>{u!=null&&u.current&&u.current.blur()});const f=x=>{x.preventDefault(),x.stopPropagation();const S=x.target;n({prompt:S.value})},m=()=>{e||r()},p=x=>{x.key==="Enter"&&x.ctrlKey&&t.length!==0&&m()},g=()=>{o()},y=()=>{i()};return v.jsx("div",{className:"flex gap-4 relative w-full justify-center h-full",children:v.jsxs("div",{className:"absolute flex gap-4",children:[v.jsx(jx,{ref:u,placeholder:"I want to repaint of...",className:xe(s?"focus:overflow-y-auto":"overflow-y-hidden","min-h-[32px] h-[32px] overflow-x-hidden focus:h-[120px] overflow-y-hidden transition-[height] w-[500px] py-1 px-3 bg-background resize-none"),style:{scrollbarGutter:"stable"},value:t,onInput:f,onKeyUp:p,onTransitionEnd:l}),v.jsx(vn,{size:"sm",onClick:m,disabled:e,onMouseEnter:g,onMouseLeave:y,children:"Paint"})]})})};var iH={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"};const sH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kn=(e,t)=>{const n=d.forwardRef(({color:r="currentColor",size:o=24,strokeWidth:i=2,absoluteStrokeWidth:s,children:l,...u},f)=>d.createElement("svg",{ref:f,...iH,width:o,height:o,stroke:r,strokeWidth:s?Number(i)*24/Number(o):i,className:`lucide lucide-${sH(e)}`,...u},[...t.map(([m,p])=>d.createElement(m,p)),...(Array.isArray(l)?l:[l])||[]]));return n.displayName=`${e}`,n},aH=kn("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]),lH=kn("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),cH=kn("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),uH=kn("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),dH=kn("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]),fH=kn("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]),hH=kn("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),pH=kn("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]),jT=kn("Fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]),mH=kn("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]]),gH=kn("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]),vH=kn("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),u2=kn("Slice",[["path",{d:"m8 14-6 6h9v-3",key:"zo3j9a"}],["path",{d:"M18.37 3.63 8 14l3 3L21.37 6.63a2.12 2.12 0 1 0-3-3Z",key:"1dzx0j"}]]),d2=kn("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]),yH=kn("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]),BT=kn("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);var Vp={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */Vp.exports;(function(e,t){(function(){var n,r="4.17.21",o=200,i="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",l="Invalid `variable` option passed into `_.template`",u="__lodash_hash_undefined__",f=500,m="__lodash_placeholder__",p=1,g=2,y=4,x=1,S=2,E=1,_=2,b=4,C=8,R=16,k=32,O=64,A=128,I=256,z=512,H=30,ie="...",K=800,te=16,U=1,re=2,V=3,J=1/0,G=9007199254740991,Z=17976931348623157e292,Q=NaN,le=4294967295,L=le-1,ue=le>>>1,Ne=[["ary",A],["bind",E],["bindKey",_],["curry",C],["curryRight",R],["flip",z],["partial",k],["partialRight",O],["rearg",I]],Ke="[object Arguments]",Me="[object Array]",me="[object AsyncFunction]",be="[object Boolean]",Ee="[object Date]",Oe="[object DOMException]",Ie="[object Error]",ze="[object Function]",ht="[object GeneratorFunction]",st="[object Map]",Yt="[object Number]",rr="[object Null]",Jt="[object Object]",Li="[object Promise]",N="[object Proxy]",X="[object RegExp]",ee="[object Set]",Se="[object String]",pe="[object Symbol]",he="[object Undefined]",Te="[object WeakMap]",ut="[object WeakSet]",gt="[object ArrayBuffer]",An="[object DataView]",Mn="[object Float32Array]",Fi="[object Float64Array]",Ro="[object Int8Array]",Cr="[object Int16Array]",Ks="[object Int32Array]",ri="[object Uint8Array]",ji="[object Uint8ClampedArray]",or="[object Uint16Array]",Zd="[object Uint32Array]",$g=/\b__p \+= '';/g,qd=/\b(__p \+=) '' \+/g,Rg=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Qd=/&(?:amp|lt|gt|quot|#39);/g,Nc=/[&<>"']/g,Jd=RegExp(Qd.source),ef=RegExp(Nc.source),tf=/<%-([\s\S]+?)%>/g,nf=/<%([\s\S]+?)%>/g,Va=/<%=([\s\S]+?)%>/g,Pg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dc=/^\w*$/,rf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wa=/[\\^$.*+?()[\]{}|]/g,Tg=RegExp(Wa.source),Ic=/^\s+/,kg=/\s/,Ag=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,W=/\{\n\/\* \[wrapped with (.+)\] \*/,We=/,? & /,dt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,no=/[()=,{}\[\]\/\s]/,an=/\\(\\)?/g,of=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,wb=/\w*$/,hM=/^[-+]0x[0-9a-f]+$/i,pM=/^0b[01]+$/i,mM=/^\[object .+?Constructor\]$/,gM=/^0o[0-7]+$/i,vM=/^(?:0|[1-9]\d*)$/,yM=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,sf=/($^)/,wM=/['\n\r\u2028\u2029\\]/g,af="\\ud800-\\udfff",xM="\\u0300-\\u036f",bM="\\ufe20-\\ufe2f",SM="\\u20d0-\\u20ff",xb=xM+bM+SM,bb="\\u2700-\\u27bf",Sb="a-z\\xdf-\\xf6\\xf8-\\xff",_M="\\xac\\xb1\\xd7\\xf7",EM="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",CM="\\u2000-\\u206f",$M=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",_b="A-Z\\xc0-\\xd6\\xd8-\\xde",Eb="\\ufe0e\\ufe0f",Cb=_M+EM+CM+$M,Mg="['’]",RM="["+af+"]",$b="["+Cb+"]",lf="["+xb+"]",Rb="\\d+",PM="["+bb+"]",Pb="["+Sb+"]",Tb="[^"+af+Cb+Rb+bb+Sb+_b+"]",Og="\\ud83c[\\udffb-\\udfff]",TM="(?:"+lf+"|"+Og+")",kb="[^"+af+"]",Ng="(?:\\ud83c[\\udde6-\\uddff]){2}",Dg="[\\ud800-\\udbff][\\udc00-\\udfff]",Ha="["+_b+"]",Ab="\\u200d",Mb="(?:"+Pb+"|"+Tb+")",kM="(?:"+Ha+"|"+Tb+")",Ob="(?:"+Mg+"(?:d|ll|m|re|s|t|ve))?",Nb="(?:"+Mg+"(?:D|LL|M|RE|S|T|VE))?",Db=TM+"?",Ib="["+Eb+"]?",AM="(?:"+Ab+"(?:"+[kb,Ng,Dg].join("|")+")"+Ib+Db+")*",MM="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",OM="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lb=Ib+Db+AM,NM="(?:"+[PM,Ng,Dg].join("|")+")"+Lb,DM="(?:"+[kb+lf+"?",lf,Ng,Dg,RM].join("|")+")",IM=RegExp(Mg,"g"),LM=RegExp(lf,"g"),Ig=RegExp(Og+"(?="+Og+")|"+DM+Lb,"g"),FM=RegExp([Ha+"?"+Pb+"+"+Ob+"(?="+[$b,Ha,"$"].join("|")+")",kM+"+"+Nb+"(?="+[$b,Ha+Mb,"$"].join("|")+")",Ha+"?"+Mb+"+"+Ob,Ha+"+"+Nb,OM,MM,Rb,NM].join("|"),"g"),jM=RegExp("["+Ab+af+xb+Eb+"]"),BM=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,zM=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],UM=-1,Pt={};Pt[Mn]=Pt[Fi]=Pt[Ro]=Pt[Cr]=Pt[Ks]=Pt[ri]=Pt[ji]=Pt[or]=Pt[Zd]=!0,Pt[Ke]=Pt[Me]=Pt[gt]=Pt[be]=Pt[An]=Pt[Ee]=Pt[Ie]=Pt[ze]=Pt[st]=Pt[Yt]=Pt[Jt]=Pt[X]=Pt[ee]=Pt[Se]=Pt[Te]=!1;var Ct={};Ct[Ke]=Ct[Me]=Ct[gt]=Ct[An]=Ct[be]=Ct[Ee]=Ct[Mn]=Ct[Fi]=Ct[Ro]=Ct[Cr]=Ct[Ks]=Ct[st]=Ct[Yt]=Ct[Jt]=Ct[X]=Ct[ee]=Ct[Se]=Ct[pe]=Ct[ri]=Ct[ji]=Ct[or]=Ct[Zd]=!0,Ct[Ie]=Ct[ze]=Ct[Te]=!1;var VM={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},WM={"&":"&","<":"<",">":">",'"':""","'":"'"},HM={"&":"&","<":"<",">":">",""":'"',"'":"'"},KM={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},GM=parseFloat,YM=parseInt,Fb=typeof Qc=="object"&&Qc&&Qc.Object===Object&&Qc,XM=typeof self=="object"&&self&&self.Object===Object&&self,fn=Fb||XM||Function("return this")(),Lg=t&&!t.nodeType&&t,Gs=Lg&&!0&&e&&!e.nodeType&&e,jb=Gs&&Gs.exports===Lg,Fg=jb&&Fb.process,$r=function(){try{var F=Gs&&Gs.require&&Gs.require("util").types;return F||Fg&&Fg.binding&&Fg.binding("util")}catch{}}(),Bb=$r&&$r.isArrayBuffer,zb=$r&&$r.isDate,Ub=$r&&$r.isMap,Vb=$r&&$r.isRegExp,Wb=$r&&$r.isSet,Hb=$r&&$r.isTypedArray;function ir(F,ne,q){switch(q.length){case 0:return F.call(ne);case 1:return F.call(ne,q[0]);case 2:return F.call(ne,q[0],q[1]);case 3:return F.call(ne,q[0],q[1],q[2])}return F.apply(ne,q)}function ZM(F,ne,q,Ce){for(var Ge=-1,pt=F==null?0:F.length;++Ge-1}function jg(F,ne,q){for(var Ce=-1,Ge=F==null?0:F.length;++Ce-1;);return q}function Jb(F,ne){for(var q=F.length;q--&&Ka(ne,F[q],0)>-1;);return q}function i6(F,ne){for(var q=F.length,Ce=0;q--;)F[q]===ne&&++Ce;return Ce}var s6=Vg(VM),a6=Vg(WM);function l6(F){return"\\"+KM[F]}function c6(F,ne){return F==null?n:F[ne]}function Ga(F){return jM.test(F)}function u6(F){return BM.test(F)}function d6(F){for(var ne,q=[];!(ne=F.next()).done;)q.push(ne.value);return q}function Gg(F){var ne=-1,q=Array(F.size);return F.forEach(function(Ce,Ge){q[++ne]=[Ge,Ce]}),q}function eS(F,ne){return function(q){return F(ne(q))}}function Ui(F,ne){for(var q=-1,Ce=F.length,Ge=0,pt=[];++q-1}function Q6(a,c){var h=this.__data__,w=$f(h,a);return w<0?(++this.size,h.push([a,c])):h[w][1]=c,this}oi.prototype.clear=Y6,oi.prototype.delete=X6,oi.prototype.get=Z6,oi.prototype.has=q6,oi.prototype.set=Q6;function ii(a){var c=-1,h=a==null?0:a.length;for(this.clear();++c=c?a:c)),a}function kr(a,c,h,w,$,T){var M,D=c&p,B=c&g,oe=c&y;if(h&&(M=$?h(a,w,$,T):h(a)),M!==n)return M;if(!Dt(a))return a;var se=Ye(a);if(se){if(M=nO(a),!D)return Vn(a,M)}else{var ce=Sn(a),ve=ce==ze||ce==ht;if(Yi(a))return IS(a,D);if(ce==Jt||ce==Ke||ve&&!$){if(M=B||ve?{}:t_(a),!D)return B?H7(a,p7(M,a)):W7(a,fS(M,a))}else{if(!Ct[ce])return $?a:{};M=rO(a,ce,D)}}T||(T=new oo);var Pe=T.get(a);if(Pe)return Pe;T.set(a,M),k_(a)?a.forEach(function(je){M.add(kr(je,c,h,je,a,T))}):P_(a)&&a.forEach(function(je,nt){M.set(nt,kr(je,c,h,nt,a,T))});var Fe=oe?B?wv:yv:B?Hn:ln,Qe=se?n:Fe(a);return Rr(Qe||a,function(je,nt){Qe&&(nt=je,je=a[nt]),Vc(M,nt,kr(je,c,h,nt,a,T))}),M}function m7(a){var c=ln(a);return function(h){return hS(h,a,c)}}function hS(a,c,h){var w=h.length;if(a==null)return!w;for(a=St(a);w--;){var $=h[w],T=c[$],M=a[$];if(M===n&&!($ in a)||!T(M))return!1}return!0}function pS(a,c,h){if(typeof a!="function")throw new Pr(s);return Zc(function(){a.apply(n,h)},c)}function Wc(a,c,h,w){var $=-1,T=cf,M=!0,D=a.length,B=[],oe=c.length;if(!D)return B;h&&(c=Mt(c,sr(h))),w?(T=jg,M=!1):c.length>=o&&(T=Lc,M=!1,c=new Zs(c));e:for(;++$$?0:$+h),w=w===n||w>$?$:qe(w),w<0&&(w+=$),w=h>w?0:M_(w);h0&&h(D)?c>1?hn(D,c-1,h,w,$):zi($,D):w||($[$.length]=D)}return $}var ev=US(),vS=US(!0);function Po(a,c){return a&&ev(a,c,ln)}function tv(a,c){return a&&vS(a,c,ln)}function Pf(a,c){return Bi(c,function(h){return ui(a[h])})}function Qs(a,c){c=Ki(c,a);for(var h=0,w=c.length;a!=null&&hc}function y7(a,c){return a!=null&&yt.call(a,c)}function w7(a,c){return a!=null&&c in St(a)}function x7(a,c,h){return a>=bn(c,h)&&a=120&&se.length>=120)?new Zs(M&&se):n}se=a[0];var ce=-1,ve=D[0];e:for(;++ce<$&&oe.length-1;)D!==a&&wf.call(D,B,1),wf.call(a,B,1);return a}function PS(a,c){for(var h=a?c.length:0,w=h-1;h--;){var $=c[h];if(h==w||$!==T){var T=$;ci($)?wf.call(a,$,1):dv(a,$)}}return a}function lv(a,c){return a+Sf(lS()*(c-a+1))}function O7(a,c,h,w){for(var $=-1,T=tn(bf((c-a)/(h||1)),0),M=q(T);T--;)M[w?T:++$]=a,a+=h;return M}function cv(a,c){var h="";if(!a||c<1||c>G)return h;do c%2&&(h+=a),c=Sf(c/2),c&&(a+=a);while(c);return h}function et(a,c){return $v(o_(a,c,Kn),a+"")}function N7(a){return dS(ol(a))}function D7(a,c){var h=ol(a);return jf(h,qs(c,0,h.length))}function Gc(a,c,h,w){if(!Dt(a))return a;c=Ki(c,a);for(var $=-1,T=c.length,M=T-1,D=a;D!=null&&++$$?0:$+c),h=h>$?$:h,h<0&&(h+=$),$=c>h?0:h-c>>>0,c>>>=0;for(var T=q($);++w<$;)T[w]=a[w+c];return T}function F7(a,c){var h;return Wi(a,function(w,$,T){return h=c(w,$,T),!h}),!!h}function kf(a,c,h){var w=0,$=a==null?w:a.length;if(typeof c=="number"&&c===c&&$<=ue){for(;w<$;){var T=w+$>>>1,M=a[T];M!==null&&!lr(M)&&(h?M<=c:M=o){var oe=c?null:X7(a);if(oe)return df(oe);M=!1,$=Lc,B=new Zs}else B=c?[]:D;e:for(;++w=w?a:Ar(a,c,h)}var DS=$6||function(a){return fn.clearTimeout(a)};function IS(a,c){if(c)return a.slice();var h=a.length,w=rS?rS(h):new a.constructor(h);return a.copy(w),w}function mv(a){var c=new a.constructor(a.byteLength);return new vf(c).set(new vf(a)),c}function B7(a,c){var h=c?mv(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.byteLength)}function z7(a){var c=new a.constructor(a.source,wb.exec(a));return c.lastIndex=a.lastIndex,c}function U7(a){return Uc?St(Uc.call(a)):{}}function LS(a,c){var h=c?mv(a.buffer):a.buffer;return new a.constructor(h,a.byteOffset,a.length)}function FS(a,c){if(a!==c){var h=a!==n,w=a===null,$=a===a,T=lr(a),M=c!==n,D=c===null,B=c===c,oe=lr(c);if(!D&&!oe&&!T&&a>c||T&&M&&B&&!D&&!oe||w&&M&&B||!h&&B||!$)return 1;if(!w&&!T&&!oe&&a=D)return B;var oe=h[w];return B*(oe=="desc"?-1:1)}}return a.index-c.index}function jS(a,c,h,w){for(var $=-1,T=a.length,M=h.length,D=-1,B=c.length,oe=tn(T-M,0),se=q(B+oe),ce=!w;++D1?h[$-1]:n,M=$>2?h[2]:n;for(T=a.length>3&&typeof T=="function"?($--,T):n,M&&Nn(h[0],h[1],M)&&(T=$<3?n:T,$=1),c=St(c);++w<$;){var D=h[w];D&&a(c,D,w,T)}return c})}function zS(a,c){return function(h,w){if(h==null)return h;if(!Wn(h))return a(h,w);for(var $=h.length,T=c?$:-1,M=St(h);(c?T--:++T<$)&&w(M[T],T,M)!==!1;);return h}}function US(a){return function(c,h,w){for(var $=-1,T=St(c),M=w(c),D=M.length;D--;){var B=M[a?D:++$];if(h(T[B],B,T)===!1)break}return c}}function K7(a,c,h){var w=c&E,$=Yc(a);function T(){var M=this&&this!==fn&&this instanceof T?$:a;return M.apply(w?h:this,arguments)}return T}function VS(a){return function(c){c=vt(c);var h=Ga(c)?ro(c):n,w=h?h[0]:c.charAt(0),$=h?Gi(h,1).join(""):c.slice(1);return w[a]()+$}}function tl(a){return function(c){return Bg(z_(B_(c).replace(IM,"")),a,"")}}function Yc(a){return function(){var c=arguments;switch(c.length){case 0:return new a;case 1:return new a(c[0]);case 2:return new a(c[0],c[1]);case 3:return new a(c[0],c[1],c[2]);case 4:return new a(c[0],c[1],c[2],c[3]);case 5:return new a(c[0],c[1],c[2],c[3],c[4]);case 6:return new a(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new a(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var h=Ja(a.prototype),w=a.apply(h,c);return Dt(w)?w:h}}function G7(a,c,h){var w=Yc(a);function $(){for(var T=arguments.length,M=q(T),D=T,B=nl($);D--;)M[D]=arguments[D];var oe=T<3&&M[0]!==B&&M[T-1]!==B?[]:Ui(M,B);if(T-=oe.length,T-1?$[T?c[M]:M]:n}}function HS(a){return li(function(c){var h=c.length,w=h,$=Tr.prototype.thru;for(a&&c.reverse();w--;){var T=c[w];if(typeof T!="function")throw new Pr(s);if($&&!M&&Lf(T)=="wrapper")var M=new Tr([],!0)}for(w=M?w:h;++w1&&at.reverse(),se&&BD))return!1;var oe=T.get(a),se=T.get(c);if(oe&&se)return oe==c&&se==a;var ce=-1,ve=!0,Pe=h&S?new Zs:n;for(T.set(a,c),T.set(c,a);++ce1?"& ":"")+c[w],c=c.join(h>2?", ":" "),a.replace(Ag,`{ /* [wrapped with `+c+`] */ `)}function iO(a){return Ye(a)||ta(a)||!!(sS&&a&&a[sS])}function ci(a,c){var h=typeof a;return c=c??G,!!c&&(h=="number"||h!="symbol"&&vM.test(a))&&a>-1&&a%1==0&&a0){if(++c>=K)return arguments[0]}else c=0;return a.apply(n,arguments)}}function jf(a,c){var h=-1,w=a.length,$=w-1;for(c=c===n?w:c;++h1?a[c-1]:n;return h=typeof h=="function"?(a.pop(),h):n,g_(a,h)});function v_(a){var c=P(a);return c.__chain__=!0,c}function gN(a,c){return c(a),a}function Bf(a,c){return c(a)}var vN=li(function(a){var c=a.length,h=c?a[0]:0,w=this.__wrapped__,$=function(T){return Jg(T,a)};return c>1||this.__actions__.length||!(w instanceof ot)||!ci(h)?this.thru($):(w=w.slice(h,+h+(c?1:0)),w.__actions__.push({func:Bf,args:[$],thisArg:n}),new Tr(w,this.__chain__).thru(function(T){return c&&!T.length&&T.push(n),T}))});function yN(){return v_(this)}function wN(){return new Tr(this.value(),this.__chain__)}function xN(){this.__values__===n&&(this.__values__=A_(this.value()));var a=this.__index__>=this.__values__.length,c=a?n:this.__values__[this.__index__++];return{done:a,value:c}}function bN(){return this}function SN(a){for(var c,h=this;h instanceof Cf;){var w=u_(h);w.__index__=0,w.__values__=n,c?$.__wrapped__=w:c=w;var $=w;h=h.__wrapped__}return $.__wrapped__=a,c}function _N(){var a=this.__wrapped__;if(a instanceof ot){var c=a;return this.__actions__.length&&(c=new ot(this)),c=c.reverse(),c.__actions__.push({func:Bf,args:[Rv],thisArg:n}),new Tr(c,this.__chain__)}return this.thru(Rv)}function EN(){return OS(this.__wrapped__,this.__actions__)}var CN=Mf(function(a,c,h){yt.call(a,h)?++a[h]:si(a,h,1)});function $N(a,c,h){var w=Ye(a)?Kb:g7;return h&&Nn(a,c,h)&&(c=n),w(a,Le(c,3))}function RN(a,c){var h=Ye(a)?Bi:gS;return h(a,Le(c,3))}var PN=WS(d_),TN=WS(f_);function kN(a,c){return hn(zf(a,c),1)}function AN(a,c){return hn(zf(a,c),J)}function MN(a,c,h){return h=h===n?1:qe(h),hn(zf(a,c),h)}function y_(a,c){var h=Ye(a)?Rr:Wi;return h(a,Le(c,3))}function w_(a,c){var h=Ye(a)?qM:mS;return h(a,Le(c,3))}var ON=Mf(function(a,c,h){yt.call(a,h)?a[h].push(c):si(a,h,[c])});function NN(a,c,h,w){a=Wn(a)?a:ol(a),h=h&&!w?qe(h):0;var $=a.length;return h<0&&(h=tn($+h,0)),Kf(a)?h<=$&&a.indexOf(c,h)>-1:!!$&&Ka(a,c,h)>-1}var DN=et(function(a,c,h){var w=-1,$=typeof c=="function",T=Wn(a)?q(a.length):[];return Wi(a,function(M){T[++w]=$?ir(c,M,h):Hc(M,c,h)}),T}),IN=Mf(function(a,c,h){si(a,h,c)});function zf(a,c){var h=Ye(a)?Mt:SS;return h(a,Le(c,3))}function LN(a,c,h,w){return a==null?[]:(Ye(c)||(c=c==null?[]:[c]),h=w?n:h,Ye(h)||(h=h==null?[]:[h]),$S(a,c,h))}var FN=Mf(function(a,c,h){a[h?0:1].push(c)},function(){return[[],[]]});function jN(a,c,h){var w=Ye(a)?Bg:Zb,$=arguments.length<3;return w(a,Le(c,4),h,$,Wi)}function BN(a,c,h){var w=Ye(a)?QM:Zb,$=arguments.length<3;return w(a,Le(c,4),h,$,mS)}function zN(a,c){var h=Ye(a)?Bi:gS;return h(a,Wf(Le(c,3)))}function UN(a){var c=Ye(a)?dS:N7;return c(a)}function VN(a,c,h){(h?Nn(a,c,h):c===n)?c=1:c=qe(c);var w=Ye(a)?d7:D7;return w(a,c)}function WN(a){var c=Ye(a)?f7:L7;return c(a)}function HN(a){if(a==null)return 0;if(Wn(a))return Kf(a)?Ya(a):a.length;var c=Sn(a);return c==st||c==ee?a.size:iv(a).length}function KN(a,c,h){var w=Ye(a)?zg:F7;return h&&Nn(a,c,h)&&(c=n),w(a,Le(c,3))}var GN=et(function(a,c){if(a==null)return[];var h=c.length;return h>1&&Nn(a,c[0],c[1])?c=[]:h>2&&Nn(c[0],c[1],c[2])&&(c=[c[0]]),$S(a,hn(c,1),[])}),Uf=R6||function(){return fn.Date.now()};function YN(a,c){if(typeof c!="function")throw new Pr(s);return a=qe(a),function(){if(--a<1)return c.apply(this,arguments)}}function x_(a,c,h){return c=h?n:c,c=a&&c==null?a.length:c,ai(a,A,n,n,n,n,c)}function b_(a,c){var h;if(typeof c!="function")throw new Pr(s);return a=qe(a),function(){return--a>0&&(h=c.apply(this,arguments)),a<=1&&(c=n),h}}var Tv=et(function(a,c,h){var w=E;if(h.length){var $=Ui(h,nl(Tv));w|=k}return ai(a,w,c,h,$)}),S_=et(function(a,c,h){var w=E|_;if(h.length){var $=Ui(h,nl(S_));w|=k}return ai(c,w,a,h,$)});function __(a,c,h){c=h?n:c;var w=ai(a,C,n,n,n,n,n,c);return w.placeholder=__.placeholder,w}function E_(a,c,h){c=h?n:c;var w=ai(a,R,n,n,n,n,n,c);return w.placeholder=E_.placeholder,w}function C_(a,c,h){var w,$,T,M,D,B,oe=0,se=!1,ce=!1,ve=!0;if(typeof a!="function")throw new Pr(s);c=Or(c)||0,Dt(h)&&(se=!!h.leading,ce="maxWait"in h,T=ce?tn(Or(h.maxWait)||0,c):T,ve="trailing"in h?!!h.trailing:ve);function Pe(Kt){var so=w,fi=$;return w=$=n,oe=Kt,M=a.apply(fi,so),M}function Fe(Kt){return oe=Kt,D=Zc(nt,c),se?Pe(Kt):M}function Qe(Kt){var so=Kt-B,fi=Kt-oe,W_=c-so;return ce?bn(W_,T-fi):W_}function je(Kt){var so=Kt-B,fi=Kt-oe;return B===n||so>=c||so<0||ce&&fi>=T}function nt(){var Kt=Uf();if(je(Kt))return at(Kt);D=Zc(nt,Qe(Kt))}function at(Kt){return D=n,ve&&w?Pe(Kt):(w=$=n,M)}function cr(){D!==n&&DS(D),oe=0,w=B=$=D=n}function Dn(){return D===n?M:at(Uf())}function ur(){var Kt=Uf(),so=je(Kt);if(w=arguments,$=this,B=Kt,so){if(D===n)return Fe(B);if(ce)return DS(D),D=Zc(nt,c),Pe(B)}return D===n&&(D=Zc(nt,c)),M}return ur.cancel=cr,ur.flush=Dn,ur}var XN=et(function(a,c){return pS(a,1,c)}),ZN=et(function(a,c,h){return pS(a,Or(c)||0,h)});function qN(a){return ai(a,z)}function Vf(a,c){if(typeof a!="function"||c!=null&&typeof c!="function")throw new Pr(s);var h=function(){var w=arguments,$=c?c.apply(this,w):w[0],T=h.cache;if(T.has($))return T.get($);var M=a.apply(this,w);return h.cache=T.set($,M)||T,M};return h.cache=new(Vf.Cache||ii),h}Vf.Cache=ii;function Wf(a){if(typeof a!="function")throw new Pr(s);return function(){var c=arguments;switch(c.length){case 0:return!a.call(this);case 1:return!a.call(this,c[0]);case 2:return!a.call(this,c[0],c[1]);case 3:return!a.call(this,c[0],c[1],c[2])}return!a.apply(this,c)}}function QN(a){return b_(2,a)}var JN=j7(function(a,c){c=c.length==1&&Ye(c[0])?Mt(c[0],sr(Le())):Mt(hn(c,1),sr(Le()));var h=c.length;return et(function(w){for(var $=-1,T=bn(w.length,h);++$=c}),ta=wS(function(){return arguments}())?wS:function(a){return Bt(a)&&yt.call(a,"callee")&&!iS.call(a,"callee")},Ye=q.isArray,p4=Bb?sr(Bb):S7;function Wn(a){return a!=null&&Hf(a.length)&&!ui(a)}function Ht(a){return Bt(a)&&Wn(a)}function m4(a){return a===!0||a===!1||Bt(a)&&On(a)==be}var Yi=T6||zv,g4=zb?sr(zb):_7;function v4(a){return Bt(a)&&a.nodeType===1&&!qc(a)}function y4(a){if(a==null)return!0;if(Wn(a)&&(Ye(a)||typeof a=="string"||typeof a.splice=="function"||Yi(a)||rl(a)||ta(a)))return!a.length;var c=Sn(a);if(c==st||c==ee)return!a.size;if(Xc(a))return!iv(a).length;for(var h in a)if(yt.call(a,h))return!1;return!0}function w4(a,c){return Kc(a,c)}function x4(a,c,h){h=typeof h=="function"?h:n;var w=h?h(a,c):n;return w===n?Kc(a,c,n,h):!!w}function Av(a){if(!Bt(a))return!1;var c=On(a);return c==Ie||c==Oe||typeof a.message=="string"&&typeof a.name=="string"&&!qc(a)}function b4(a){return typeof a=="number"&&aS(a)}function ui(a){if(!Dt(a))return!1;var c=On(a);return c==ze||c==ht||c==me||c==N}function R_(a){return typeof a=="number"&&a==qe(a)}function Hf(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=G}function Dt(a){var c=typeof a;return a!=null&&(c=="object"||c=="function")}function Bt(a){return a!=null&&typeof a=="object"}var P_=Ub?sr(Ub):C7;function S4(a,c){return a===c||ov(a,c,bv(c))}function _4(a,c,h){return h=typeof h=="function"?h:n,ov(a,c,bv(c),h)}function E4(a){return T_(a)&&a!=+a}function C4(a){if(lO(a))throw new Ge(i);return xS(a)}function $4(a){return a===null}function R4(a){return a==null}function T_(a){return typeof a=="number"||Bt(a)&&On(a)==Yt}function qc(a){if(!Bt(a)||On(a)!=Jt)return!1;var c=yf(a);if(c===null)return!0;var h=yt.call(c,"constructor")&&c.constructor;return typeof h=="function"&&h instanceof h&&pf.call(h)==_6}var Mv=Vb?sr(Vb):$7;function P4(a){return R_(a)&&a>=-G&&a<=G}var k_=Wb?sr(Wb):R7;function Kf(a){return typeof a=="string"||!Ye(a)&&Bt(a)&&On(a)==Se}function lr(a){return typeof a=="symbol"||Bt(a)&&On(a)==pe}var rl=Hb?sr(Hb):P7;function T4(a){return a===n}function k4(a){return Bt(a)&&Sn(a)==Te}function A4(a){return Bt(a)&&On(a)==ut}var M4=If(sv),O4=If(function(a,c){return a<=c});function A_(a){if(!a)return[];if(Wn(a))return Kf(a)?ro(a):Vn(a);if(Fc&&a[Fc])return d6(a[Fc]());var c=Sn(a),h=c==st?Gg:c==ee?df:ol;return h(a)}function di(a){if(!a)return a===0?a:0;if(a=Or(a),a===J||a===-J){var c=a<0?-1:1;return c*Z}return a===a?a:0}function qe(a){var c=di(a),h=c%1;return c===c?h?c-h:c:0}function M_(a){return a?qs(qe(a),0,le):0}function Or(a){if(typeof a=="number")return a;if(lr(a))return Q;if(Dt(a)){var c=typeof a.valueOf=="function"?a.valueOf():a;a=Dt(c)?c+"":c}if(typeof a!="string")return a===0?a:+a;a=qb(a);var h=pM.test(a);return h||gM.test(a)?YM(a.slice(2),h?2:8):hM.test(a)?Q:+a}function O_(a){return To(a,Hn(a))}function N4(a){return a?qs(qe(a),-G,G):a===0?a:0}function vt(a){return a==null?"":ar(a)}var D4=el(function(a,c){if(Xc(c)||Wn(c)){To(c,ln(c),a);return}for(var h in c)yt.call(c,h)&&Vc(a,h,c[h])}),N_=el(function(a,c){To(c,Hn(c),a)}),Gf=el(function(a,c,h,w){To(c,Hn(c),a,w)}),I4=el(function(a,c,h,w){To(c,ln(c),a,w)}),L4=li(Jg);function F4(a,c){var h=Ja(a);return c==null?h:fS(h,c)}var j4=et(function(a,c){a=St(a);var h=-1,w=c.length,$=w>2?c[2]:n;for($&&Nn(c[0],c[1],$)&&(w=1);++h1),T}),To(a,wv(a),h),w&&(h=kr(h,p|g|y,Z7));for(var $=c.length;$--;)dv(h,c[$]);return h});function r8(a,c){return I_(a,Wf(Le(c)))}var o8=li(function(a,c){return a==null?{}:A7(a,c)});function I_(a,c){if(a==null)return{};var h=Mt(wv(a),function(w){return[w]});return c=Le(c),RS(a,h,function(w,$){return c(w,$[0])})}function i8(a,c,h){c=Ki(c,a);var w=-1,$=c.length;for($||($=1,a=n);++w<$;){var T=a==null?n:a[ko(c[w])];T===n&&(w=$,T=h),a=ui(T)?T.call(a):T}return a}function s8(a,c,h){return a==null?a:Gc(a,c,h)}function a8(a,c,h,w){return w=typeof w=="function"?w:n,a==null?a:Gc(a,c,h,w)}var L_=XS(ln),F_=XS(Hn);function l8(a,c,h){var w=Ye(a),$=w||Yi(a)||rl(a);if(c=Le(c,4),h==null){var T=a&&a.constructor;$?h=w?new T:[]:Dt(a)?h=ui(T)?Ja(yf(a)):{}:h={}}return($?Rr:Po)(a,function(M,D,B){return c(h,M,D,B)}),h}function c8(a,c){return a==null?!0:dv(a,c)}function u8(a,c,h){return a==null?a:MS(a,c,pv(h))}function d8(a,c,h,w){return w=typeof w=="function"?w:n,a==null?a:MS(a,c,pv(h),w)}function ol(a){return a==null?[]:Kg(a,ln(a))}function f8(a){return a==null?[]:Kg(a,Hn(a))}function h8(a,c,h){return h===n&&(h=c,c=n),h!==n&&(h=Or(h),h=h===h?h:0),c!==n&&(c=Or(c),c=c===c?c:0),qs(Or(a),c,h)}function p8(a,c,h){return c=di(c),h===n?(h=c,c=0):h=di(h),a=Or(a),x7(a,c,h)}function m8(a,c,h){if(h&&typeof h!="boolean"&&Nn(a,c,h)&&(c=h=n),h===n&&(typeof c=="boolean"?(h=c,c=n):typeof a=="boolean"&&(h=a,a=n)),a===n&&c===n?(a=0,c=1):(a=di(a),c===n?(c=a,a=0):c=di(c)),a>c){var w=a;a=c,c=w}if(h||a%1||c%1){var $=lS();return bn(a+$*(c-a+GM("1e-"+(($+"").length-1))),c)}return lv(a,c)}var g8=tl(function(a,c,h){return c=c.toLowerCase(),a+(h?j_(c):c)});function j_(a){return Dv(vt(a).toLowerCase())}function B_(a){return a=vt(a),a&&a.replace(yM,s6).replace(LM,"")}function v8(a,c,h){a=vt(a),c=ar(c);var w=a.length;h=h===n?w:qs(qe(h),0,w);var $=h;return h-=c.length,h>=0&&a.slice(h,$)==c}function y8(a){return a=vt(a),a&&ef.test(a)?a.replace(Nc,a6):a}function w8(a){return a=vt(a),a&&Tg.test(a)?a.replace(Wa,"\\$&"):a}var x8=tl(function(a,c,h){return a+(h?"-":"")+c.toLowerCase()}),b8=tl(function(a,c,h){return a+(h?" ":"")+c.toLowerCase()}),S8=VS("toLowerCase");function _8(a,c,h){a=vt(a),c=qe(c);var w=c?Ya(a):0;if(!c||w>=c)return a;var $=(c-w)/2;return Df(Sf($),h)+a+Df(bf($),h)}function E8(a,c,h){a=vt(a),c=qe(c);var w=c?Ya(a):0;return c&&w>>0,h?(a=vt(a),a&&(typeof c=="string"||c!=null&&!Mv(c))&&(c=ar(c),!c&&Ga(a))?Gi(ro(a),0,h):a.split(c,h)):[]}var A8=tl(function(a,c,h){return a+(h?" ":"")+Dv(c)});function M8(a,c,h){return a=vt(a),h=h==null?0:qs(qe(h),0,a.length),c=ar(c),a.slice(h,h+c.length)==c}function O8(a,c,h){var w=P.templateSettings;h&&Nn(a,c,h)&&(c=n),a=vt(a),c=Gf({},c,w,ZS);var $=Gf({},c.imports,w.imports,ZS),T=ln($),M=Kg($,T),D,B,oe=0,se=c.interpolate||sf,ce="__p += '",ve=Yg((c.escape||sf).source+"|"+se.source+"|"+(se===Va?of:sf).source+"|"+(c.evaluate||sf).source+"|$","g"),Pe="//# sourceURL="+(yt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++UM+"]")+` `;a.replace(ve,function(je,nt,at,cr,Dn,ur){return at||(at=cr),ce+=a.slice(oe,ur).replace(wM,l6),nt&&(D=!0,ce+=`' + __e(`+nt+`) + '`),Dn&&(B=!0,ce+=`'; `+Dn+`; __p += '`),at&&(ce+=`' + ((__t = (`+at+`)) == null ? '' : __t) + '`),oe=ur+je.length,je}),ce+=`'; `;var Fe=yt.call(c,"variable")&&c.variable;if(!Fe)ce=`with (obj) { `+ce+` } `;else if(no.test(Fe))throw new Ge(l);ce=(B?ce.replace($g,""):ce).replace(qd,"$1").replace(Rg,"$1;"),ce="function("+(Fe||"obj")+`) { `+(Fe?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(D?", __e = _.escape":"")+(B?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+ce+`return __p }`;var Qe=U_(function(){return pt(T,Pe+"return "+ce).apply(n,M)});if(Qe.source=ce,Av(Qe))throw Qe;return Qe}function N8(a){return vt(a).toLowerCase()}function D8(a){return vt(a).toUpperCase()}function I8(a,c,h){if(a=vt(a),a&&(h||c===n))return qb(a);if(!a||!(c=ar(c)))return a;var w=ro(a),$=ro(c),T=Qb(w,$),M=Jb(w,$)+1;return Gi(w,T,M).join("")}function L8(a,c,h){if(a=vt(a),a&&(h||c===n))return a.slice(0,tS(a)+1);if(!a||!(c=ar(c)))return a;var w=ro(a),$=Jb(w,ro(c))+1;return Gi(w,0,$).join("")}function F8(a,c,h){if(a=vt(a),a&&(h||c===n))return a.replace(Ic,"");if(!a||!(c=ar(c)))return a;var w=ro(a),$=Qb(w,ro(c));return Gi(w,$).join("")}function j8(a,c){var h=H,w=ie;if(Dt(c)){var $="separator"in c?c.separator:$;h="length"in c?qe(c.length):h,w="omission"in c?ar(c.omission):w}a=vt(a);var T=a.length;if(Ga(a)){var M=ro(a);T=M.length}if(h>=T)return a;var D=h-Ya(w);if(D<1)return w;var B=M?Gi(M,0,D).join(""):a.slice(0,D);if($===n)return B+w;if(M&&(D+=B.length-D),Mv($)){if(a.slice(D).search($)){var oe,se=B;for($.global||($=Yg($.source,vt(wb.exec($))+"g")),$.lastIndex=0;oe=$.exec(se);)var ce=oe.index;B=B.slice(0,ce===n?D:ce)}}else if(a.indexOf(ar($),D)!=D){var ve=B.lastIndexOf($);ve>-1&&(B=B.slice(0,ve))}return B+w}function B8(a){return a=vt(a),a&&Jd.test(a)?a.replace(Qd,m6):a}var z8=tl(function(a,c,h){return a+(h?" ":"")+c.toUpperCase()}),Dv=VS("toUpperCase");function z_(a,c,h){return a=vt(a),c=h?n:c,c===n?u6(a)?y6(a):t6(a):a.match(c)||[]}var U_=et(function(a,c){try{return ir(a,n,c)}catch(h){return Av(h)?h:new Ge(h)}}),U8=li(function(a,c){return Rr(c,function(h){h=ko(h),si(a,h,Tv(a[h],a))}),a});function V8(a){var c=a==null?0:a.length,h=Le();return a=c?Mt(a,function(w){if(typeof w[1]!="function")throw new Pr(s);return[h(w[0]),w[1]]}):[],et(function(w){for(var $=-1;++$G)return[];var h=le,w=bn(a,le);c=Le(c),a-=le;for(var $=Hg(w,c);++h0||c<0)?new ot(h):(a<0?h=h.takeRight(-a):a&&(h=h.drop(a)),c!==n&&(c=qe(c),h=c<0?h.dropRight(-c):h.take(c-a)),h)},ot.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},ot.prototype.toArray=function(){return this.take(le)},Po(ot.prototype,function(a,c){var h=/^(?:filter|find|map|reject)|While$/.test(c),w=/^(?:head|last)$/.test(c),$=P[w?"take"+(c=="last"?"Right":""):c],T=w||/^find/.test(c);$&&(P.prototype[c]=function(){var M=this.__wrapped__,D=w?[1]:arguments,B=M instanceof ot,oe=D[0],se=B||Ye(M),ce=function(nt){var at=$.apply(P,zi([nt],D));return w&&ve?at[0]:at};se&&h&&typeof oe=="function"&&oe.length!=1&&(B=se=!1);var ve=this.__chain__,Pe=!!this.__actions__.length,Fe=T&&!ve,Qe=B&&!Pe;if(!T&&se){M=Qe?M:new ot(this);var je=a.apply(M,D);return je.__actions__.push({func:Bf,args:[ce],thisArg:n}),new Tr(je,ve)}return Fe&&Qe?a.apply(this,D):(je=this.thru(ce),Fe?w?je.value()[0]:je.value():je)})}),Rr(["pop","push","shift","sort","splice","unshift"],function(a){var c=ff[a],h=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",w=/^(?:pop|shift)$/.test(a);P.prototype[a]=function(){var $=arguments;if(w&&!this.__chain__){var T=this.value();return c.apply(Ye(T)?T:[],$)}return this[h](function(M){return c.apply(Ye(M)?M:[],$)})}}),Po(ot.prototype,function(a,c){var h=P[c];if(h){var w=h.name+"";yt.call(Qa,w)||(Qa[w]=[]),Qa[w].push({name:c,func:h})}}),Qa[Of(n,_).name]=[{name:"wrapper",func:n}],ot.prototype.clone=B6,ot.prototype.reverse=z6,ot.prototype.value=U6,P.prototype.at=vN,P.prototype.chain=yN,P.prototype.commit=wN,P.prototype.next=xN,P.prototype.plant=SN,P.prototype.reverse=_N,P.prototype.toJSON=P.prototype.valueOf=P.prototype.value=EN,P.prototype.first=P.prototype.head,Fc&&(P.prototype[Fc]=bN),P},Xa=w6();Gs?((Gs.exports=Xa)._=Xa,Lg._=Xa):fn._=Xa}).call(Qc)})(Vp,Vp.exports);var wH=Vp.exports;const xH=pm(wH);function Gr({width:e,height:t}){return e/t}function Wp(e,t=0){const n=10**t;return Math.round((e+Number.EPSILON)*n)/n}function bH(e){return(t,n)=>e(n)-e(t)}class SH{constructor(t){this.comparator=t,this.heap=[],this.n=0}greater(t,n){return this.comparator(this.heap[t],this.heap[n])<0}swap(t,n){const r=this.heap[t];this.heap[t]=this.heap[n],this.heap[n]=r}swim(t){let n=t,r=Math.floor(n/2);for(;n>1&&this.greater(r,n);)this.swap(r,n),n=r,r=Math.floor(n/2)}sink(t){let n=t,r=n*2;for(;r<=this.n&&(rl.weight));for(s.push({id:t,weight:0});s.size()>0;){const{id:l,weight:u}=s.pop();if(!o.has(l)){const f=e(l);o.add(l),f.forEach((m,p)=>{const g=u+m,y=r.get(p),x=i.get(p);(x===void 0||x>g&&(x/g>1.005||y!==void 0&&yMath.min(Gr(i),o),Number.MAX_VALUE);return Wp(n/t/r)+2}function zT(e,t,n,r){const o=t-(e.length-1)*n-2*r*e.length,i=e.reduce((s,l)=>s+Gr(l),0);return o/i}function RH(e,t,n,r,o,i,s){const l=e.slice(t,n),u=zT(l,r,i,s);return u>0?(u-o)**2*l.length:void 0}function PH({photos:e,layoutOptions:t,targetRowHeight:n,limitNodeSearch:r,rowConstraints:o}){return i=>{var s,l;const{containerWidth:u,spacing:f,padding:m}=t,p=new Map;p.set(i,0);const g=(s=o==null?void 0:o.minPhotos)!=null?s:1,y=Math.min(r,(l=o==null?void 0:o.maxPhotos)!=null?l:1/0);for(let x=i+g;xy);x+=1){const S=RH(e,i,x,u,n,f,m);if(S===void 0)break;p.set(x,S)}return p}}function TH({photos:e,layoutOptions:t}){const{spacing:n,padding:r,containerWidth:o,targetRowHeight:i,rowConstraints:s}=t,l=$H({photos:e,containerWidth:o,targetRowHeight:i}),u=PH({photos:e,layoutOptions:t,targetRowHeight:i,limitNodeSearch:l,rowConstraints:s}),f=CH(u,0,e.length);if(f===void 0)return;const m=[];for(let p=1;p({photo:x,index:S})).slice(f[p-1],f[p]),y=zT(g.map(({photo:x})=>x),o,n,r);m.push(g.map(({photo:x,index:S},E)=>({photo:x,layout:{height:y,width:y*Gr(x),index:S,photoIndex:E,photosCount:g.length}})))}return m}function ig(...e){return[...e].filter(t=>!!t).join(" ")}function UT(e,{width:t,photosCount:n},{spacing:r,padding:o,containerWidth:i}){const s=r*(n-1)+2*o*n;return`calc((${e} - ${s}px) / ${Wp((i-s)/t,5)})`}function kH(e,t){return t.layout!=="rows"?`calc(100% - ${2*t.padding}px)`:UT("100%",e,t)}function f2(e,t,n){var r,o;return UT((o=(r=e.match(/calc\((.*)\)/))==null?void 0:r[1])!=null?o:e,t,n)}function AH(e,t,n){let r,o;const i=e.srcSet||e.images;return i&&i.length>0&&(r=i.concat(i.find(({width:s})=>s===e.width)?[]:[{src:e.src,width:e.width,height:e.height}]).sort((s,l)=>s.width-l.width).map(s=>`${s.src} ${s.width}w`).join(", ")),n.sizes?o=(n.sizes.sizes||[]).map(({viewport:s,size:l})=>`${s} ${f2(l,t,n)}`).concat(f2(n.sizes.size,t,n)).join(", "):r&&(o=`${Math.ceil(t.width/n.containerWidth*100)}vw`),{srcSet:r,sizes:o}}function Bx(e){var t,n;const{photo:r,layout:o,layoutOptions:i,imageProps:{style:s,className:l,...u}={},renderPhoto:f}=e,{onClick:m}=i,p={display:"block",boxSizing:"content-box",width:kH(o,i),height:"auto",aspectRatio:`${r.width} / ${r.height}`,...i.padding?{padding:`${i.padding}px`}:null,...(i.layout==="columns"||i.layout==="masonry")&&o.photoIndex{m({event:E,photo:r,index:o.index})}:void 0,y={src:r.src,alt:(t=r.alt)!=null?t:"",title:r.title,onClick:g,style:p,className:ig("react-photo-album--photo",l),loading:"lazy",decoding:"async",...AH(r,o,i),...u},x=E=>{const{src:_,alt:b,srcSet:C,sizes:R,style:k,...O}=y;return d.createElement("img",{alt:b,...C?{srcSet:C,sizes:R}:null,src:_,style:E!=null&&E.wrapped?{display:"block",width:"100%",height:"100%"}:k,...O})},S=(({display:E,boxSizing:_,width:b,aspectRatio:C,padding:R,marginBottom:k,cursor:O})=>({display:E,boxSizing:_,width:b,aspectRatio:C,padding:R,marginBottom:k,cursor:O}))(p);return d.createElement(d.Fragment,null,(n=f==null?void 0:f({photo:r,layout:o,layoutOptions:i,imageProps:y,renderDefaultPhoto:x,wrapperStyle:S}))!=null?n:x())}function MH({rowContainerProps:e,children:t}){return d.createElement("div",{...e},t)}function OH(e){const{layoutOptions:t,rowIndex:n,rowsCount:r,renderRowContainer:o,rowContainerProps:{style:i,className:s,...l}={},children:u}=e,f={className:ig("react-photo-album--row",s),style:{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"flex-start",justifyContent:"space-between",...nd.createElement(OH,{key:`row-${f}`,layoutOptions:n,rowIndex:f,rowsCount:l.length,renderRowContainer:o,rowContainerProps:s},u.map(({photo:m,layout:p})=>d.createElement(Bx,{key:m.key||m.src,photo:m,layout:p,layoutOptions:n,renderPhoto:r,imageProps:i}))))):null}function DH(e,t,n,r){const o=new Map,i=new Set;i.add(n);for(let s=0;s{const f=s>0?o.get(u)[s].weight:0;e(u).forEach(({neighbor:m,weight:p})=>{let g=o.get(m);g||(g=[],o.set(m,g));const y=f+p,x=g[s+1];(!x||x.weight>y&&(x.weight/y>1.0001||u0;i-=1)o=e.get(o)[i].node,r.push(o);return r.reverse()}function LH(e,t,n,r){return IH(DH(e,t,n,r),t,r)}function FH({photos:e,spacing:t,padding:n,targetColumnWidth:r,targetColumnHeight:o}){return i=>{const s=[],l=o*1.5;let u=r/Gr(e[i])+2*n;for(let f=i+1;fl||f===e.length));f+=1)u+=r/Gr(e[f])+t+2*n;return s}}function h2({path:e,photos:t,containerWidth:n,columnsGaps:r,columnsRatios:o,spacing:i,padding:s}){const l=[],u=o.reduce((f,m)=>f+m,0);for(let f=0;f({photo:y,index:x})).slice(e[f],e[f+1]),p=o.reduce((y,x,S)=>y+(r[f]-r[S])*x,0),g=(n-(e.length-2)*i-2*(e.length-1)*s-p)*o[f]/u;l.push(m.map(({photo:y,index:x},S)=>({photo:y,layout:{width:g,height:g/Gr(y),index:x,photoIndex:S,photosCount:m.length}})))}return l}function jH({photos:e,layoutOptions:t,targetColumnWidth:n}){const{columns:r,spacing:o,padding:i,containerWidth:s}=t,l=[],u=[];if(e.length<=r){const y=e.length>0?e.reduce((S,E)=>S+Gr(E),0)/e.length:1;for(let S=0;SMath.min(E,e.length)),photos:e,columnsRatios:u,columnsGaps:l,containerWidth:s,spacing:o,padding:i});return{columnsGaps:l,columnsRatios:u,columnsModel:x}}const f=(e.reduce((y,x)=>y+n/Gr(x),0)+o*(e.length-r)+2*i*e.length)/r,m=FH({photos:e,targetColumnWidth:n,targetColumnHeight:f,spacing:o,padding:i}),p=LH(m,r,0,e.length);for(let y=0;yS+1/Gr(E),0)}const g=h2({path:p,photos:e,columnsRatios:u,columnsGaps:l,containerWidth:s,spacing:o,padding:i});return{columnsGaps:l,columnsRatios:u,columnsModel:g}}function VT(e){const{photos:t,layoutOptions:n}=e,{columns:r,spacing:o,padding:i,containerWidth:s}=n,l=(s-o*(r-1)-2*i*r)/r,{columnsGaps:u,columnsRatios:f,columnsModel:m}=jH({photos:t,layoutOptions:n,targetColumnWidth:l});return m.findIndex(p=>p.findIndex(({layout:{width:g,height:y}})=>g<0||y<0)>=0)>=0?r>1?VT({photos:t,layoutOptions:{...n,columns:r-1}}):void 0:{columnsModel:m,columnsGaps:u,columnsRatios:f}}function BH({photos:e,layoutOptions:t}){return VT({photos:e,layoutOptions:t})}function zH({columnContainerProps:e,children:t}){return d.createElement("div",{...e},t)}function UH(e){const{layoutOptions:t,columnIndex:n,columnsCount:r,columnsGaps:o,columnsRatios:i}=e,{layout:s,spacing:l,padding:u}=t;if(s==="masonry"||!o||!i)return`calc((100% - ${l*(r-1)}px) / ${r})`;const f=i.reduce((p,g)=>p+g,0),m=i.reduce((p,g,y)=>p+(o[n]-o[y])*g,0);return`calc((100% - ${Wp((r-1)*l+2*r*u+m,3)}px) * ${Wp(i[n]/f,5)} + ${2*u}px)`}function WT(e){const{layoutOptions:t,renderColumnContainer:n,children:r,columnContainerProps:{style:o,className:i,...s}={},...l}=e,u={className:ig("react-photo-album--column",i),style:{display:"flex",flexDirection:"column",flexWrap:"nowrap",alignItems:"flex-start",width:UH(e),justifyContent:t.layout==="columns"?"space-between":"flex-start",...o},...s};return d.createElement(d.Fragment,null,(n??zH)({layoutOptions:t,columnContainerProps:u,children:r,...l}))}function VH(e){const{photos:t,layoutOptions:n,renderPhoto:r,renderColumnContainer:o,componentsProps:{imageProps:i,columnContainerProps:s}}=e,l=BH({photos:t,layoutOptions:n});if(!l)return null;const{columnsModel:u,columnsRatios:f,columnsGaps:m}=l;return d.createElement(d.Fragment,null,u.map((p,g)=>d.createElement(WT,{key:`column-${g}`,layoutOptions:n,columnIndex:g,columnsCount:u.length,columnsGaps:m,columnsRatios:f,renderColumnContainer:o,columnContainerProps:s},p.map(({photo:y,layout:x})=>d.createElement(Bx,{key:y.key||y.src,photo:y,layout:x,layoutOptions:n,renderPhoto:r,imageProps:i})))))}function HT(e){const{photos:t,layoutOptions:n}=e,{columns:r,spacing:o,padding:i,containerWidth:s}=n,l=(s-o*(r-1)-2*i*r)/r;if(l<=0)return r>1?HT({...e,layoutOptions:{...n,columns:r-1}}):void 0;const u=[];for(let m=0;m{const y=u.reduce((x,S,E)=>S[])).map(m=>m.map(({photo:p,index:g},y)=>({photo:p,layout:{width:l,height:l/Gr(p),index:g,photoIndex:y,photosCount:m.length}})))}function WH(e){const{photos:t,layoutOptions:n,renderPhoto:r,renderColumnContainer:o,componentsProps:{imageProps:i,columnContainerProps:s}}=e,l=HT({photos:t,layoutOptions:n});return l?d.createElement(d.Fragment,null,l.map((u,f)=>d.createElement(WT,{key:`masonry-column-${f}`,layoutOptions:n,columnsCount:l.length,columnIndex:f,renderColumnContainer:o,columnContainerProps:s},u.map(({photo:m,layout:p})=>d.createElement(Bx,{key:m.key||m.src,photo:m,layout:p,layoutOptions:n,renderPhoto:r,imageProps:i}))))):null}function HH({containerProps:e,children:t,containerRef:n}){return d.createElement("div",{ref:n,...e},t)}function KH(e){const{layout:t,renderContainer:n,children:r,containerRef:o,containerProps:{style:i,className:s,...l}={}}=e,u={className:ig("react-photo-album",`react-photo-album--${t}`,s),style:{display:"flex",flexWrap:"nowrap",justifyContent:"space-between",flexDirection:t==="rows"?"column":"row",...i},...l};return d.createElement(d.Fragment,null,(n??HH)({containerProps:u,containerRef:o,layout:t,children:r}))}function GH(e){const t=d.useRef(e);return(!e||!t.current||e.join()!==t.current.join())&&(t.current=e),t.current}function YH(e,{newContainerWidth:t,newScrollbarWidth:n}){const{containerWidth:r,scrollbarWidth:o}=e;return r!==void 0&&o!==void 0&&t!==void 0&&n!==void 0&&t>r&&t-r<=20&&n0){const r=[...t.filter(i=>i>0)].sort((i,s)=>s-i);r.push(Math.floor(r[r.length-1]/2));const o=n;n=r.find((i,s)=>i<=o||s===r.length-1)}return n}function ZH(e,t){const[{containerWidth:n},r]=d.useReducer(YH,{containerWidth:t}),o=d.useRef(null),i=d.useRef();return{containerRef:d.useCallback(l=>{var u;(u=i.current)==null||u.disconnect(),i.current=void 0,o.current=l;const f=()=>r({newContainerWidth:XH(o.current,e),newScrollbarWidth:window.innerWidth-document.documentElement.clientWidth});f(),l&&typeof ResizeObserver<"u"&&(i.current=new ResizeObserver(f),i.current.observe(l))},[e]),containerWidth:n}}const qH=Object.freeze([1200,600,300,0]);function zx(e,t){return typeof e=="function"?e(t):e}function KT(e,t){return typeof e<"u"?zx(e,t):void 0}function QH(e,t){const n=qH.findIndex(r=>r<=t);return zx(e[n>=0?n:0],t)}function Sh(e,t,n,r=0){const o=KT(e,t);return Math.round(Math.max(o===void 0?QH(n,t):o,r))}function JH({layout:e,onClick:t,containerWidth:n,targetRowHeight:r,rowConstraints:o,columns:i,spacing:s,padding:l,sizes:u}){return{layout:e,onClick:t,containerWidth:n,columns:Sh(i,n,[5,4,3,2],1),spacing:Sh(s,n,[20,15,10,5]),padding:Sh(l,n,[0,0,0,0,0]),targetRowHeight:Sh(r,n,[f=>f/5,f=>f/4,f=>f/3,f=>f/2]),rowConstraints:KT(o,n),sizes:u}}function eK(e,t,n){const{photos:r,componentsProps:o}=e,i=zx(o,t)||{};if(n){const{layout:s,spacing:l,padding:u,rowConstraints:f}=n;if(s==="rows"){const{singleRowMaxHeight:m}=f||{};if(m){const p=Math.floor(r.reduce((g,{width:y,height:x})=>g+y/x*m-2*u,u*r.length*2+l*(r.length-1)));p>0&&(i.containerProps=i.containerProps||{},i.containerProps.style={maxWidth:p,...i.containerProps.style})}}}return i}function tK(e,t,n){const{photos:r,layout:o,renderPhoto:i,renderRowContainer:s,renderColumnContainer:l}=e,u={photos:r,renderPhoto:i,componentsProps:t};return o==="rows"?d.createElement(NH,{layoutOptions:n,renderRowContainer:s,...u}):o==="columns"?d.createElement(VH,{layoutOptions:n,renderColumnContainer:l,...u}):d.createElement(WH,{layoutOptions:n,renderColumnContainer:l,...u})}function nK(e){const{photos:t,layout:n,renderContainer:r,defaultContainerWidth:o,breakpoints:i}=e,{containerRef:s,containerWidth:l}=ZH(GH(i),o);if(!n||!["rows","columns","masonry"].includes(n)||!Array.isArray(t))return null;const u=l?JH({containerWidth:l,...e}):void 0,f=eK(e,l,u);return d.createElement(KH,{layout:n,containerRef:s,renderContainer:r,containerProps:f.containerProps},u&&tK(e,f,u))}function rK({title:e,titleId:t,...n},r){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25"}))}const oK=d.forwardRef(rK),iK=oK;function sK({title:e,titleId:t,...n},r){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4.5h14.25M3 9h9.75M3 13.5h5.25m5.25-.75L17.25 9m0 0L21 12.75M17.25 9v12"}))}const aK=d.forwardRef(sK),lK=aK;function cK({title:e,titleId:t,...n},r){return d.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:r,"aria-labelledby":t},n),e?d.createElement("title",{id:t},e):null,d.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"}))}const uK=d.forwardRef(cK),dK=uK;function ki(e){return Array.isArray?Array.isArray(e):XT(e)==="[object Array]"}const fK=1/0;function hK(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-fK?"-0":t}function pK(e){return e==null?"":hK(e)}function Ho(e){return typeof e=="string"}function GT(e){return typeof e=="number"}function mK(e){return e===!0||e===!1||gK(e)&&XT(e)=="[object Boolean]"}function YT(e){return typeof e=="object"}function gK(e){return YT(e)&&e!==null}function mr(e){return e!=null}function L0(e){return!e.trim().length}function XT(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const vK="Incorrect 'index' type",yK=e=>`Invalid value for key ${e}`,wK=e=>`Pattern length exceeds max of ${e}.`,xK=e=>`Missing ${e} property in key`,bK=e=>`Property 'weight' in key '${e}' must be a positive integer`,p2=Object.prototype.hasOwnProperty;class SK{constructor(t){this._keys=[],this._keyMap={};let n=0;t.forEach(r=>{let o=ZT(r);this._keys.push(o),this._keyMap[o.id]=o,n+=o.weight}),this._keys.forEach(r=>{r.weight/=n})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function ZT(e){let t=null,n=null,r=null,o=1,i=null;if(Ho(e)||ki(e))r=e,t=m2(e),n=x1(e);else{if(!p2.call(e,"name"))throw new Error(xK("name"));const s=e.name;if(r=s,p2.call(e,"weight")&&(o=e.weight,o<=0))throw new Error(bK(s));t=m2(s),n=x1(s),i=e.getFn}return{path:t,id:n,weight:o,src:r,getFn:i}}function m2(e){return ki(e)?e:e.split(".")}function x1(e){return ki(e)?e.join("."):e}function _K(e,t){let n=[],r=!1;const o=(i,s,l)=>{if(mr(i))if(!s[l])n.push(i);else{let u=s[l];const f=i[u];if(!mr(f))return;if(l===s.length-1&&(Ho(f)||GT(f)||mK(f)))n.push(pK(f));else if(ki(f)){r=!0;for(let m=0,p=f.length;me.score===t.score?e.idx{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Ho(this.docs[0])?this.docs.forEach((t,n)=>{this._addString(t,n)}):this.docs.forEach((t,n)=>{this._addObject(t,n)}),this.norm.clear())}add(t){const n=this.size();Ho(t)?this._addString(t,n):this._addObject(t,n)}removeAt(t){this.records.splice(t,1);for(let n=t,r=this.size();n{let s=o.getFn?o.getFn(t):this.getFn(t,o.path);if(mr(s)){if(ki(s)){let l=[];const u=[{nestedArrIndex:-1,value:s}];for(;u.length;){const{nestedArrIndex:f,value:m}=u.pop();if(mr(m))if(Ho(m)&&!L0(m)){let p={v:m,i:f,n:this.norm.get(m)};l.push(p)}else ki(m)&&m.forEach((p,g)=>{u.push({nestedArrIndex:g,value:p})})}r.$[i]=l}else if(Ho(s)&&!L0(s)){let l={v:s,n:this.norm.get(s)};r.$[i]=l}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function qT(e,t,{getFn:n=He.getFn,fieldNormWeight:r=He.fieldNormWeight}={}){const o=new Ux({getFn:n,fieldNormWeight:r});return o.setKeys(e.map(ZT)),o.setSources(t),o.create(),o}function kK(e,{getFn:t=He.getFn,fieldNormWeight:n=He.fieldNormWeight}={}){const{keys:r,records:o}=e,i=new Ux({getFn:t,fieldNormWeight:n});return i.setKeys(r),i.setIndexRecords(o),i}function _h(e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:o=He.distance,ignoreLocation:i=He.ignoreLocation}={}){const s=t/e.length;if(i)return s;const l=Math.abs(r-n);return o?s+l/o:l?1:s}function AK(e=[],t=He.minMatchCharLength){let n=[],r=-1,o=-1,i=0;for(let s=e.length;i=t&&n.push([r,o]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}const ua=32;function MK(e,t,n,{location:r=He.location,distance:o=He.distance,threshold:i=He.threshold,findAllMatches:s=He.findAllMatches,minMatchCharLength:l=He.minMatchCharLength,includeMatches:u=He.includeMatches,ignoreLocation:f=He.ignoreLocation}={}){if(t.length>ua)throw new Error(wK(ua));const m=t.length,p=e.length,g=Math.max(0,Math.min(r,p));let y=i,x=g;const S=l>1||u,E=S?Array(p):[];let _;for(;(_=e.indexOf(t,x))>-1;){let A=_h(t,{currentLocation:_,expectedLocation:g,distance:o,ignoreLocation:f});if(y=Math.min(A,y),x=_+m,S){let I=0;for(;I=H;U-=1){let re=U-1,V=n[e.charAt(re)];if(S&&(E[re]=+!!V),K[U]=(K[U+1]<<1|1)&V,A&&(K[U]|=(b[U+1]|b[U])<<1|1|b[U+1]),K[U]&k&&(C=_h(t,{errors:A,currentLocation:re,expectedLocation:g,distance:o,ignoreLocation:f}),C<=y)){if(y=C,x=re,x<=g)break;H=Math.max(1,2*g-x)}}if(_h(t,{errors:A+1,currentLocation:g,expectedLocation:g,distance:o,ignoreLocation:f})>y)break;b=K}const O={isMatch:x>=0,score:Math.max(.001,C)};if(S){const A=AK(E,l);A.length?u&&(O.indices=A):O.isMatch=!1}return O}function OK(e){let t={};for(let n=0,r=e.length;n{this.chunks.push({pattern:g,alphabet:OK(g),startIndex:y})},p=this.pattern.length;if(p>ua){let g=0;const y=p%ua,x=p-y;for(;g{const{isMatch:_,score:b,indices:C}=MK(t,x,S,{location:o+E,distance:i,threshold:s,findAllMatches:l,minMatchCharLength:u,includeMatches:r,ignoreLocation:f});_&&(g=!0),p+=b,_&&C&&(m=[...m,...C])});let y={isMatch:g,score:g?p/this.chunks.length:1};return g&&r&&(y.indices=m),y}}class Us{constructor(t){this.pattern=t}static isMultiMatch(t){return g2(t,this.multiRegex)}static isSingleMatch(t){return g2(t,this.singleRegex)}search(){}}function g2(e,t){const n=e.match(t);return n?n[1]:null}class NK extends Us{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const n=t===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class DK extends Us{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const r=t.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,t.length-1]}}}class IK extends Us{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const n=t.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class LK extends Us{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const n=!t.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class FK extends Us{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const n=t.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class jK extends Us{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const n=!t.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}}class JT extends Us{constructor(t,{location:n=He.location,threshold:r=He.threshold,distance:o=He.distance,includeMatches:i=He.includeMatches,findAllMatches:s=He.findAllMatches,minMatchCharLength:l=He.minMatchCharLength,isCaseSensitive:u=He.isCaseSensitive,ignoreLocation:f=He.ignoreLocation}={}){super(t),this._bitapSearch=new QT(t,{location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:s,minMatchCharLength:l,isCaseSensitive:u,ignoreLocation:f})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class ek extends Us{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let n=0,r;const o=[],i=this.pattern.length;for(;(r=t.indexOf(this.pattern,n))>-1;)n=r+i,o.push([r,n-1]);const s=!!o.length;return{isMatch:s,score:s?0:1,indices:o}}}const b1=[NK,ek,IK,LK,jK,FK,DK,JT],v2=b1.length,BK=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,zK="|";function UK(e,t={}){return e.split(zK).map(n=>{let r=n.trim().split(BK).filter(i=>i&&!!i.trim()),o=[];for(let i=0,s=r.length;i!!(e[Hp.AND]||e[Hp.OR]),KK=e=>!!e[E1.PATH],GK=e=>!ki(e)&&YT(e)&&!C1(e),y2=e=>({[Hp.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function tk(e,t,{auto:n=!0}={}){const r=o=>{let i=Object.keys(o);const s=KK(o);if(!s&&i.length>1&&!C1(o))return r(y2(o));if(GK(o)){const u=s?o[E1.PATH]:i[0],f=s?o[E1.PATTERN]:o[u];if(!Ho(f))throw new Error(yK(u));const m={keyId:x1(u),pattern:f};return n&&(m.searcher=_1(f,t)),m}let l={children:[],operator:i[0]};return i.forEach(u=>{const f=o[u];ki(f)&&f.forEach(m=>{l.children.push(r(m))})}),l};return C1(e)||(e=y2(e)),r(e)}function YK(e,{ignoreFieldNorm:t=He.ignoreFieldNorm}){e.forEach(n=>{let r=1;n.matches.forEach(({key:o,norm:i,score:s})=>{const l=o?o.weight:null;r*=Math.pow(s===0&&l?Number.EPSILON:s,(l||1)*(t?1:i))}),n.score=r})}function XK(e,t){const n=e.matches;t.matches=[],mr(n)&&n.forEach(r=>{if(!mr(r.indices)||!r.indices.length)return;const{indices:o,value:i}=r;let s={indices:o,value:i};r.key&&(s.key=r.key.src),r.idx>-1&&(s.refIndex=r.idx),t.matches.push(s)})}function ZK(e,t){t.score=e.score}function qK(e,t,{includeMatches:n=He.includeMatches,includeScore:r=He.includeScore}={}){const o=[];return n&&o.push(XK),r&&o.push(ZK),e.map(i=>{const{idx:s}=i,l={item:t[s],refIndex:s};return o.length&&o.forEach(u=>{u(i,l)}),l})}class kc{constructor(t,n={},r){this.options={...He,...n},this.options.useExtendedSearch,this._keyStore=new SK(this.options.keys),this.setCollection(t,r)}setCollection(t,n){if(this._docs=t,n&&!(n instanceof Ux))throw new Error(vK);this._myIndex=n||qT(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){mr(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const n=[];for(let r=0,o=this._docs.length;r-1&&(u=u.slice(0,n)),qK(u,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(t){const n=_1(t,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:i,i:s,n:l})=>{if(!mr(i))return;const{isMatch:u,score:f,indices:m}=n.searchIn(i);u&&o.push({item:i,idx:s,matches:[{score:f,value:i,norm:l,indices:m}]})}),o}_searchLogical(t){const n=tk(t,this.options),r=(l,u,f)=>{if(!l.children){const{keyId:p,searcher:g}=l,y=this._findMatches({key:this._keyStore.get(p),value:this._myIndex.getValueForItemAtKeyId(u,p),searcher:g});return y&&y.length?[{idx:f,item:u,matches:y}]:[]}const m=[];for(let p=0,g=l.children.length;p{if(mr(l)){let f=r(n,l,u);f.length&&(i[u]||(i[u]={idx:u,item:l,matches:[]},s.push(i[u])),f.forEach(({matches:m})=>{i[u].matches.push(...m)}))}}),s}_searchObjectList(t){const n=_1(t,this.options),{keys:r,records:o}=this._myIndex,i=[];return o.forEach(({$:s,i:l})=>{if(!mr(s))return;let u=[];r.forEach((f,m)=>{u.push(...this._findMatches({key:f,value:s[m],searcher:n}))}),u.length&&i.push({idx:l,item:s,matches:u})}),i}_findMatches({key:t,value:n,searcher:r}){if(!mr(n))return[];let o=[];if(ki(n))n.forEach(({v:i,i:s,n:l})=>{if(!mr(i))return;const{isMatch:u,score:f,indices:m}=r.searchIn(i);u&&o.push({score:f,key:t,value:i,idx:s,norm:l,indices:m})});else{const{v:i,n:s}=n,{isMatch:l,score:u,indices:f}=r.searchIn(i);l&&o.push({score:u,key:t,value:i,norm:s,indices:f})}return o}}kc.version="7.0.0";kc.createIndex=qT;kc.parseIndex=kK;kc.config=He;kc.parseQuery=tk;HK(WK);function Wd(e){const t=e+"CollectionProvider",[n,r]=Tn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:x,children:S}=y,E=Be.useRef(null),_=Be.useRef(new Map).current;return Be.createElement(o,{scope:x,itemMap:_,collectionRef:E},S)},l=e+"CollectionSlot",u=Be.forwardRef((y,x)=>{const{scope:S,children:E}=y,_=i(l,S),b=Ve(x,_.collectionRef);return Be.createElement(Qo,{ref:b},E)}),f=e+"CollectionItemSlot",m="data-radix-collection-item",p=Be.forwardRef((y,x)=>{const{scope:S,children:E,..._}=y,b=Be.useRef(null),C=Ve(x,b),R=i(f,S);return Be.useEffect(()=>(R.itemMap.set(b,{ref:b,..._}),()=>void R.itemMap.delete(b))),Be.createElement(Qo,{[m]:"",ref:C},E)});function g(y){const x=i(e+"CollectionConsumer",y);return Be.useCallback(()=>{const E=x.collectionRef.current;if(!E)return[];const _=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(x.itemMap.values()).sort((R,k)=>_.indexOf(R.ref.current)-_.indexOf(k.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:s,Slot:u,ItemSlot:p},g,r]}const QK=d.createContext(void 0);function Ac(e){const t=d.useContext(QK);return e||t||"ltr"}const F0="rovingFocusGroup.onEntryFocus",JK={bubbles:!1,cancelable:!0},Vx="RovingFocusGroup",[$1,nk,eG]=Wd(Vx),[tG,sg]=Tn(Vx,[eG]),[nG,rG]=tG(Vx),oG=d.forwardRef((e,t)=>d.createElement($1.Provider,{scope:e.__scopeRovingFocusGroup},d.createElement($1.Slot,{scope:e.__scopeRovingFocusGroup},d.createElement(iG,Y({},e,{ref:t}))))),iG=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:f,...m}=e,p=d.useRef(null),g=Ve(t,p),y=Ac(i),[x=null,S]=eo({prop:s,defaultProp:l,onChange:u}),[E,_]=d.useState(!1),b=Lt(f),C=nk(n),R=d.useRef(!1),[k,O]=d.useState(0);return d.useEffect(()=>{const A=p.current;if(A)return A.addEventListener(F0,b),()=>A.removeEventListener(F0,b)},[b]),d.createElement(nG,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:x,onItemFocus:d.useCallback(A=>S(A),[S]),onItemShiftTab:d.useCallback(()=>_(!0),[]),onFocusableItemAdd:d.useCallback(()=>O(A=>A+1),[]),onFocusableItemRemove:d.useCallback(()=>O(A=>A-1),[])},d.createElement(Ae.div,Y({tabIndex:E||k===0?-1:0,"data-orientation":r},m,{ref:g,style:{outline:"none",...e.style},onMouseDown:fe(e.onMouseDown,()=>{R.current=!0}),onFocus:fe(e.onFocus,A=>{const I=!R.current;if(A.target===A.currentTarget&&I&&!E){const z=new CustomEvent(F0,JK);if(A.currentTarget.dispatchEvent(z),!z.defaultPrevented){const H=C().filter(re=>re.focusable),ie=H.find(re=>re.active),K=H.find(re=>re.id===x),U=[ie,K,...H].filter(Boolean).map(re=>re.ref.current);rk(U)}}R.current=!1}),onBlur:fe(e.onBlur,()=>_(!1))})))}),sG="RovingFocusGroupItem",aG=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,l=tr(),u=i||l,f=rG(sG,n),m=f.currentTabStopId===u,p=nk(n),{onFocusableItemAdd:g,onFocusableItemRemove:y}=f;return d.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),d.createElement($1.ItemSlot,{scope:n,id:u,focusable:r,active:o},d.createElement(Ae.span,Y({tabIndex:m?0:-1,"data-orientation":f.orientation},s,{ref:t,onMouseDown:fe(e.onMouseDown,x=>{r?f.onItemFocus(u):x.preventDefault()}),onFocus:fe(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:fe(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const S=uG(x,f.orientation,f.dir);if(S!==void 0){x.preventDefault();let _=p().filter(b=>b.focusable).map(b=>b.ref.current);if(S==="last")_.reverse();else if(S==="prev"||S==="next"){S==="prev"&&_.reverse();const b=_.indexOf(x.currentTarget);_=f.loop?dG(_,b+1):_.slice(b+1)}setTimeout(()=>rk(_))}})})))}),lG={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cG(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function uG(e,t,n){const r=cG(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return lG[r]}function rk(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dG(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const ok=oG,ik=aG,sk="Tabs",[fG,gte]=Tn(sk,[sg]),ak=sg(),[hG,Wx]=fG(sk),pG=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:l,activationMode:u="automatic",...f}=e,m=Ac(l),[p,g]=eo({prop:r,onChange:o,defaultProp:i});return d.createElement(hG,{scope:n,baseId:tr(),value:p,onValueChange:g,orientation:s,dir:m,activationMode:u},d.createElement(Ae.div,Y({dir:m,"data-orientation":s},f,{ref:t})))}),mG="TabsList",gG=d.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Wx(mG,n),s=ak(n);return d.createElement(ok,Y({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),d.createElement(Ae.div,Y({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),vG="TabsTrigger",yG=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Wx(vG,n),l=ak(n),u=lk(s.baseId,r),f=ck(s.baseId,r),m=r===s.value;return d.createElement(ik,Y({asChild:!0},l,{focusable:!o,active:m}),d.createElement(Ae.button,Y({type:"button",role:"tab","aria-selected":m,"aria-controls":f,"data-state":m?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u},i,{ref:t,onMouseDown:fe(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?s.onValueChange(r):p.preventDefault()}),onKeyDown:fe(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(r)}),onFocus:fe(e.onFocus,()=>{const p=s.activationMode!=="manual";!m&&!o&&p&&s.onValueChange(r)})})))}),wG="TabsContent",xG=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,l=Wx(wG,n),u=lk(l.baseId,r),f=ck(l.baseId,r),m=r===l.value,p=d.useRef(m);return d.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),d.createElement(xn,{present:o||m},({present:g})=>d.createElement(Ae.div,Y({"data-state":m?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:f,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0}}),g&&i))});function lk(e,t){return`${e}-trigger-${t}`}function ck(e,t){return`${e}-content-${t}`}const bG=pG,uk=gG,dk=yG,fk=xG,hk=bG,Hx=d.forwardRef(({className:e,...t},n)=>v.jsx(uk,{ref:n,className:xe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),tabIndex:-1,...t}));Hx.displayName=uk.displayName;const ys=d.forwardRef(({className:e,...t},n)=>v.jsx(dk,{ref:n,className:xe("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),tabIndex:-1,...t}));ys.displayName=dk.displayName;const Su=d.forwardRef(({className:e,...t},n)=>v.jsx(fk,{ref:n,className:xe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),tabIndex:-1,...t}));Su.displayName=fk.displayName;function fd(e,[t,n]){return Math.min(n,Math.max(t,e))}function Kx(e){const t=d.useRef({value:e,previous:e});return d.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const SG=[" ","Enter","ArrowUp","ArrowDown"],_G=[" ","Enter"],ag="Select",[lg,cg,EG]=Wd(ag),[Mc,vte]=Tn(ag,[EG,zs]),Gx=zs(),[CG,Ba]=Mc(ag),[$G,RG]=Mc(ag),PG=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:l,onValueChange:u,dir:f,name:m,autoComplete:p,disabled:g,required:y}=e,x=Gx(t),[S,E]=d.useState(null),[_,b]=d.useState(null),[C,R]=d.useState(!1),k=Ac(f),[O=!1,A]=eo({prop:r,defaultProp:o,onChange:i}),[I,z]=eo({prop:s,defaultProp:l,onChange:u}),H=d.useRef(null),ie=S?!!S.closest("form"):!0,[K,te]=d.useState(new Set),U=Array.from(K).map(re=>re.props.value).join(";");return d.createElement(Fd,x,d.createElement(CG,{required:y,scope:t,trigger:S,onTriggerChange:E,valueNode:_,onValueNodeChange:b,valueNodeHasChildren:C,onValueNodeHasChildrenChange:R,contentId:tr(),value:I,onValueChange:z,open:O,onOpenChange:A,dir:k,triggerPointerDownPosRef:H,disabled:g},d.createElement(lg.Provider,{scope:t},d.createElement($G,{scope:e.__scopeSelect,onNativeOptionAdd:d.useCallback(re=>{te(V=>new Set(V).add(re))},[]),onNativeOptionRemove:d.useCallback(re=>{te(V=>{const J=new Set(V);return J.delete(re),J})},[])},n)),ie?d.createElement(yk,{key:U,"aria-hidden":!0,required:y,tabIndex:-1,name:m,autoComplete:p,value:I,onChange:re=>z(re.target.value),disabled:g},I===void 0?d.createElement("option",{value:""}):null,Array.from(K)):null))},TG="SelectTrigger",kG=d.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=Gx(n),s=Ba(TG,n),l=s.disabled||r,u=Ve(t,s.onTriggerChange),f=cg(n),[m,p,g]=wk(x=>{const S=f().filter(b=>!b.disabled),E=S.find(b=>b.value===s.value),_=xk(S,x,E);_!==void 0&&s.onValueChange(_.value)}),y=()=>{l||(s.onOpenChange(!0),g())};return d.createElement(Gm,Y({asChild:!0},i),d.createElement(Ae.button,Y({type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":vk(s.value)?"":void 0},o,{ref:u,onClick:fe(o.onClick,x=>{x.currentTarget.focus()}),onPointerDown:fe(o.onPointerDown,x=>{const S=x.target;S.hasPointerCapture(x.pointerId)&&S.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&(y(),s.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)},x.preventDefault())}),onKeyDown:fe(o.onKeyDown,x=>{const S=m.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&p(x.key),!(S&&x.key===" ")&&SG.includes(x.key)&&(y(),x.preventDefault())})})))}),AG="SelectValue",MG=d.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...l}=e,u=Ba(AG,n),{onValueNodeHasChildrenChange:f}=u,m=i!==void 0,p=Ve(t,u.onValueNodeChange);return Pn(()=>{f(m)},[f,m]),d.createElement(Ae.span,Y({},l,{ref:p,style:{pointerEvents:"none"}}),vk(u.value)?d.createElement(d.Fragment,null,s):i)}),OG=d.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return d.createElement(Ae.span,Y({"aria-hidden":!0},o,{ref:t}),r||"▼")}),NG=e=>d.createElement(jd,Y({asChild:!0},e)),hc="SelectContent",DG=d.forwardRef((e,t)=>{const n=Ba(hc,e.__scopeSelect),[r,o]=d.useState();if(Pn(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Bs.createPortal(d.createElement(pk,{scope:e.__scopeSelect},d.createElement(lg.Slot,{scope:e.__scopeSelect},d.createElement("div",null,e.children))),i):null}return d.createElement(IG,Y({},e,{ref:t}))}),gi=10,[pk,za]=Mc(hc),IG=d.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:u,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:g,collisionPadding:y,sticky:x,hideWhenDetached:S,avoidCollisions:E,..._}=e,b=Ba(hc,n),[C,R]=d.useState(null),[k,O]=d.useState(null),A=Ve(t,me=>R(me)),[I,z]=d.useState(null),[H,ie]=d.useState(null),K=cg(n),[te,U]=d.useState(!1),re=d.useRef(!1);d.useEffect(()=>{if(C)return ng(C)},[C]),Jm();const V=d.useCallback(me=>{const[be,...Ee]=K().map(ze=>ze.ref.current),[Oe]=Ee.slice(-1),Ie=document.activeElement;for(const ze of me)if(ze===Ie||(ze==null||ze.scrollIntoView({block:"nearest"}),ze===be&&k&&(k.scrollTop=0),ze===Oe&&k&&(k.scrollTop=k.scrollHeight),ze==null||ze.focus(),document.activeElement!==Ie))return},[K,k]),J=d.useCallback(()=>V([I,C]),[V,I,C]);d.useEffect(()=>{te&&J()},[te,J]);const{onOpenChange:G,triggerPointerDownPosRef:Z}=b;d.useEffect(()=>{if(C){let me={x:0,y:0};const be=Oe=>{var Ie,ze,ht,st;me={x:Math.abs(Math.round(Oe.pageX)-((Ie=(ze=Z.current)===null||ze===void 0?void 0:ze.x)!==null&&Ie!==void 0?Ie:0)),y:Math.abs(Math.round(Oe.pageY)-((ht=(st=Z.current)===null||st===void 0?void 0:st.y)!==null&&ht!==void 0?ht:0))}},Ee=Oe=>{me.x<=10&&me.y<=10?Oe.preventDefault():C.contains(Oe.target)||G(!1),document.removeEventListener("pointermove",be),Z.current=null};return Z.current!==null&&(document.addEventListener("pointermove",be),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",be),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[C,G,Z]),d.useEffect(()=>{const me=()=>G(!1);return window.addEventListener("blur",me),window.addEventListener("resize",me),()=>{window.removeEventListener("blur",me),window.removeEventListener("resize",me)}},[G]);const[Q,le]=wk(me=>{const be=K().filter(Ie=>!Ie.disabled),Ee=be.find(Ie=>Ie.ref.current===document.activeElement),Oe=xk(be,me,Ee);Oe&&setTimeout(()=>Oe.ref.current.focus())}),L=d.useCallback((me,be,Ee)=>{const Oe=!re.current&&!Ee;(b.value!==void 0&&b.value===be||Oe)&&(z(me),Oe&&(re.current=!0))},[b.value]),ue=d.useCallback(()=>C==null?void 0:C.focus(),[C]),Ne=d.useCallback((me,be,Ee)=>{const Oe=!re.current&&!Ee;(b.value!==void 0&&b.value===be||Oe)&&ie(me)},[b.value]),Ke=r==="popper"?w2:LG,Me=Ke===w2?{side:l,sideOffset:u,align:f,alignOffset:m,arrowPadding:p,collisionBoundary:g,collisionPadding:y,sticky:x,hideWhenDetached:S,avoidCollisions:E}:{};return d.createElement(pk,{scope:n,content:C,viewport:k,onViewportChange:O,itemRefCallback:L,selectedItem:I,onItemLeave:ue,itemTextRefCallback:Ne,focusSelectedItem:J,selectedItemText:H,position:r,isPositioned:te,searchRef:Q},d.createElement(tg,{as:Qo,allowPinchZoom:!0},d.createElement(Qm,{asChild:!0,trapped:b.open,onMountAutoFocus:me=>{me.preventDefault()},onUnmountAutoFocus:fe(o,me=>{var be;(be=b.trigger)===null||be===void 0||be.focus({preventScroll:!0}),me.preventDefault()})},d.createElement($c,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:me=>me.preventDefault(),onDismiss:()=>b.onOpenChange(!1)},d.createElement(Ke,Y({role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:me=>me.preventDefault()},_,Me,{onPlaced:()=>U(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:fe(_.onKeyDown,me=>{const be=me.ctrlKey||me.altKey||me.metaKey;if(me.key==="Tab"&&me.preventDefault(),!be&&me.key.length===1&&le(me.key),["ArrowUp","ArrowDown","Home","End"].includes(me.key)){let Oe=K().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(me.key)&&(Oe=Oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(me.key)){const Ie=me.target,ze=Oe.indexOf(Ie);Oe=Oe.slice(ze+1)}setTimeout(()=>V(Oe)),me.preventDefault()}})}))))))}),LG=d.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=Ba(hc,n),s=za(hc,n),[l,u]=d.useState(null),[f,m]=d.useState(null),p=Ve(t,A=>m(A)),g=cg(n),y=d.useRef(!1),x=d.useRef(!0),{viewport:S,selectedItem:E,selectedItemText:_,focusSelectedItem:b}=s,C=d.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&f&&S&&E&&_){const A=i.trigger.getBoundingClientRect(),I=f.getBoundingClientRect(),z=i.valueNode.getBoundingClientRect(),H=_.getBoundingClientRect();if(i.dir!=="rtl"){const Ie=H.left-I.left,ze=z.left-Ie,ht=A.left-ze,st=A.width+ht,Yt=Math.max(st,I.width),rr=window.innerWidth-gi,Jt=fd(ze,[gi,rr-Yt]);l.style.minWidth=st+"px",l.style.left=Jt+"px"}else{const Ie=I.right-H.right,ze=window.innerWidth-z.right-Ie,ht=window.innerWidth-A.right-ze,st=A.width+ht,Yt=Math.max(st,I.width),rr=window.innerWidth-gi,Jt=fd(ze,[gi,rr-Yt]);l.style.minWidth=st+"px",l.style.right=Jt+"px"}const ie=g(),K=window.innerHeight-gi*2,te=S.scrollHeight,U=window.getComputedStyle(f),re=parseInt(U.borderTopWidth,10),V=parseInt(U.paddingTop,10),J=parseInt(U.borderBottomWidth,10),G=parseInt(U.paddingBottom,10),Z=re+V+te+G+J,Q=Math.min(E.offsetHeight*5,Z),le=window.getComputedStyle(S),L=parseInt(le.paddingTop,10),ue=parseInt(le.paddingBottom,10),Ne=A.top+A.height/2-gi,Ke=K-Ne,Me=E.offsetHeight/2,me=E.offsetTop+Me,be=re+V+me,Ee=Z-be;if(be<=Ne){const Ie=E===ie[ie.length-1].ref.current;l.style.bottom="0px";const ze=f.clientHeight-S.offsetTop-S.offsetHeight,ht=Math.max(Ke,Me+(Ie?ue:0)+ze+J),st=be+ht;l.style.height=st+"px"}else{const Ie=E===ie[0].ref.current;l.style.top="0px";const ht=Math.max(Ne,re+S.offsetTop+(Ie?L:0)+Me)+Ee;l.style.height=ht+"px",S.scrollTop=be-Ne+S.offsetTop}l.style.margin=`${gi}px 0`,l.style.minHeight=Q+"px",l.style.maxHeight=K+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,i.trigger,i.valueNode,l,f,S,E,_,i.dir,r]);Pn(()=>C(),[C]);const[R,k]=d.useState();Pn(()=>{f&&k(window.getComputedStyle(f).zIndex)},[f]);const O=d.useCallback(A=>{A&&x.current===!0&&(C(),b==null||b(),x.current=!1)},[C,b]);return d.createElement(FG,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:y,onScrollButtonChange:O},d.createElement("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R}},d.createElement(Ae.div,Y({},o,{ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}}))))}),w2=d.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=gi,...i}=e,s=Gx(n);return d.createElement(Ym,Y({},s,i,{ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[FG,Yx]=Mc(hc,{}),x2="SelectViewport",jG=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=za(x2,n),i=Yx(x2,n),s=Ve(t,o.onViewportChange),l=d.useRef(0);return d.createElement(d.Fragment,null,d.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),d.createElement(lg.Slot,{scope:n},d.createElement(Ae.div,Y({"data-radix-select-viewport":"",role:"presentation"},r,{ref:s,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:fe(r.onScroll,u=>{const f=u.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&m){const g=Math.abs(l.current-f.scrollTop);if(g>0){const y=window.innerHeight-gi*2,x=parseFloat(m.style.minHeight),S=parseFloat(m.style.height),E=Math.max(x,S);if(E0?C:0,m.style.justifyContent="flex-end")}}}l.current=f.scrollTop})}))))}),BG="SelectGroup",[zG,UG]=Mc(BG),VG=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=tr();return d.createElement(zG,{scope:n,id:o},d.createElement(Ae.div,Y({role:"group","aria-labelledby":o},r,{ref:t})))}),WG="SelectLabel",HG=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=UG(WG,n);return d.createElement(Ae.div,Y({id:o.id},r,{ref:t}))}),R1="SelectItem",[KG,mk]=Mc(R1),GG=d.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,l=Ba(R1,n),u=za(R1,n),f=l.value===r,[m,p]=d.useState(i??""),[g,y]=d.useState(!1),x=Ve(t,_=>{var b;return(b=u.itemRefCallback)===null||b===void 0?void 0:b.call(u,_,r,o)}),S=tr(),E=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.createElement(KG,{scope:n,value:r,disabled:o,textId:S,isSelected:f,onItemTextChange:d.useCallback(_=>{p(b=>{var C;return b||((C=_==null?void 0:_.textContent)!==null&&C!==void 0?C:"").trim()})},[])},d.createElement(lg.ItemSlot,{scope:n,value:r,disabled:o,textValue:m},d.createElement(Ae.div,Y({role:"option","aria-labelledby":S,"data-highlighted":g?"":void 0,"aria-selected":f&&g,"data-state":f?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1},s,{ref:x,onFocus:fe(s.onFocus,()=>y(!0)),onBlur:fe(s.onBlur,()=>y(!1)),onPointerUp:fe(s.onPointerUp,E),onPointerMove:fe(s.onPointerMove,_=>{if(o){var b;(b=u.onItemLeave)===null||b===void 0||b.call(u)}else _.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fe(s.onPointerLeave,_=>{if(_.currentTarget===document.activeElement){var b;(b=u.onItemLeave)===null||b===void 0||b.call(u)}}),onKeyDown:fe(s.onKeyDown,_=>{var b;((b=u.searchRef)===null||b===void 0?void 0:b.current)!==""&&_.key===" "||(_G.includes(_.key)&&E(),_.key===" "&&_.preventDefault())})}))))}),Eh="SelectItemText",YG=d.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=Ba(Eh,n),l=za(Eh,n),u=mk(Eh,n),f=RG(Eh,n),[m,p]=d.useState(null),g=Ve(t,_=>p(_),u.onItemTextChange,_=>{var b;return(b=l.itemTextRefCallback)===null||b===void 0?void 0:b.call(l,_,u.value,u.disabled)}),y=m==null?void 0:m.textContent,x=d.useMemo(()=>d.createElement("option",{key:u.value,value:u.value,disabled:u.disabled},y),[u.disabled,u.value,y]),{onNativeOptionAdd:S,onNativeOptionRemove:E}=f;return Pn(()=>(S(x),()=>E(x)),[S,E,x]),d.createElement(d.Fragment,null,d.createElement(Ae.span,Y({id:u.textId},i,{ref:g})),u.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Bs.createPortal(i.children,s.valueNode):null)}),XG="SelectItemIndicator",ZG=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return mk(XG,n).isSelected?d.createElement(Ae.span,Y({"aria-hidden":!0},r,{ref:t})):null}),b2="SelectScrollUpButton",qG=d.forwardRef((e,t)=>{const n=za(b2,e.__scopeSelect),r=Yx(b2,e.__scopeSelect),[o,i]=d.useState(!1),s=Ve(t,r.onScrollButtonChange);return Pn(()=>{if(n.viewport&&n.isPositioned){let f=function(){const m=u.scrollTop>0;i(m)};var l=f;const u=n.viewport;return f(),u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[n.viewport,n.isPositioned]),o?d.createElement(gk,Y({},e,{ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop-u.offsetHeight)}})):null}),S2="SelectScrollDownButton",QG=d.forwardRef((e,t)=>{const n=za(S2,e.__scopeSelect),r=Yx(S2,e.__scopeSelect),[o,i]=d.useState(!1),s=Ve(t,r.onScrollButtonChange);return Pn(()=>{if(n.viewport&&n.isPositioned){let f=function(){const m=u.scrollHeight-u.clientHeight,p=Math.ceil(u.scrollTop)u.removeEventListener("scroll",f)}},[n.viewport,n.isPositioned]),o?d.createElement(gk,Y({},e,{ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop+u.offsetHeight)}})):null}),gk=d.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=za("SelectScrollButton",n),s=d.useRef(null),l=cg(n),u=d.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return d.useEffect(()=>()=>u(),[u]),Pn(()=>{var f;const m=l().find(p=>p.ref.current===document.activeElement);m==null||(f=m.ref.current)===null||f===void 0||f.scrollIntoView({block:"nearest"})},[l]),d.createElement(Ae.div,Y({"aria-hidden":!0},o,{ref:t,style:{flexShrink:0,...o.style},onPointerDown:fe(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:fe(o.onPointerMove,()=>{var f;(f=i.onItemLeave)===null||f===void 0||f.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:fe(o.onPointerLeave,()=>{u()})}))}),JG=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return d.createElement(Ae.div,Y({"aria-hidden":!0},r,{ref:t}))});function vk(e){return e===""||e===void 0}const yk=d.forwardRef((e,t)=>{const{value:n,...r}=e,o=d.useRef(null),i=Ve(t,o),s=Kx(n);return d.useEffect(()=>{const l=o.current,u=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(u,"value").set;if(s!==n&&m){const p=new Event("change",{bubbles:!0});m.call(l,n),l.dispatchEvent(p)}},[s,n]),d.createElement(Xm,{asChild:!0},d.createElement("select",Y({},r,{ref:i,defaultValue:n})))});yk.displayName="BubbleSelect";function wk(e){const t=Lt(e),n=d.useRef(""),r=d.useRef(0),o=d.useCallback(s=>{const l=n.current+s;t(l),function u(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}(l)},[t]),i=d.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function xk(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=eY(e,Math.max(i,0));o.length===1&&(s=s.filter(f=>f!==n));const u=s.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function eY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const tY=PG,bk=kG,nY=MG,rY=OG,oY=NG,Sk=DG,iY=jG,sY=VG,_k=HG,Ek=GG,aY=YG,lY=ZG,Ck=qG,$k=QG,Rk=JG,yo=tY,zo=sY,wo=nY,Vr=d.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(bk,{ref:r,className:xe("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent pl-2 pr-1 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),tabIndex:-1,...n,children:[t,v.jsx(rY,{asChild:!0,children:v.jsx(Jj,{className:"h-4 w-4 opacity-50"})})]}));Vr.displayName=bk.displayName;const Pk=d.forwardRef(({className:e,...t},n)=>v.jsx(Ck,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(sB,{})}));Pk.displayName=Ck.displayName;const Tk=d.forwardRef(({className:e,...t},n)=>v.jsx($k,{ref:n,className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(nB,{})}));Tk.displayName=$k.displayName;const Wr=d.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>v.jsx(oY,{children:v.jsxs(Sk,{ref:o,className:xe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,onCloseAutoFocus:i=>i.preventDefault(),...r,children:[v.jsx(Pk,{}),v.jsx(iY,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),v.jsx(Tk,{})]})}));Wr.displayName=Sk.displayName;const cY=d.forwardRef(({className:e,...t},n)=>v.jsx(_k,{ref:n,className:xe("px-2 py-1.5 text-sm font-semibold",e),...t}));cY.displayName=_k.displayName;const Hr=d.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(Ek,{ref:r,className:xe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[v.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(lY,{children:v.jsx(EP,{className:"h-4 w-4"})})}),v.jsx(aY,{children:t})]}));Hr.displayName=Ek.displayName;const uY=d.forwardRef(({className:e,...t},n)=>v.jsx(Rk,{ref:n,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));uY.displayName=Rk.displayName;function dY(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const kk="ScrollArea",[Ak,yte]=Tn(kk),[fY,to]=Ak(kk),hY=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[l,u]=d.useState(null),[f,m]=d.useState(null),[p,g]=d.useState(null),[y,x]=d.useState(null),[S,E]=d.useState(null),[_,b]=d.useState(0),[C,R]=d.useState(0),[k,O]=d.useState(!1),[A,I]=d.useState(!1),z=Ve(t,ie=>u(ie)),H=Ac(o);return d.createElement(fY,{scope:n,type:r,dir:H,scrollHideDelay:i,scrollArea:l,viewport:f,onViewportChange:m,content:p,onContentChange:g,scrollbarX:y,onScrollbarXChange:x,scrollbarXEnabled:k,onScrollbarXEnabledChange:O,scrollbarY:S,onScrollbarYChange:E,scrollbarYEnabled:A,onScrollbarYEnabledChange:I,onCornerWidthChange:b,onCornerHeightChange:R},d.createElement(Ae.div,Y({dir:H},s,{ref:z,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})))}),pY="ScrollAreaViewport",mY=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,i=to(pY,n),s=d.useRef(null),l=Ve(t,s,i.onViewportChange);return d.createElement(d.Fragment,null,d.createElement("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}"}}),d.createElement(Ae.div,Y({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style}}),d.createElement("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),Ii="ScrollAreaScrollbar",Mk=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=to(Ii,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,l=e.orientation==="horizontal";return d.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),o.type==="hover"?d.createElement(gY,Y({},r,{ref:t,forceMount:n})):o.type==="scroll"?d.createElement(vY,Y({},r,{ref:t,forceMount:n})):o.type==="auto"?d.createElement(Ok,Y({},r,{ref:t,forceMount:n})):o.type==="always"?d.createElement(Xx,Y({},r,{ref:t})):null}),gY=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=to(Ii,e.__scopeScrollArea),[i,s]=d.useState(!1);return d.useEffect(()=>{const l=o.scrollArea;let u=0;if(l){const f=()=>{window.clearTimeout(u),s(!0)},m=()=>{u=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",f),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(u),l.removeEventListener("pointerenter",f),l.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),d.createElement(xn,{present:n||i},d.createElement(Ok,Y({"data-state":i?"visible":"hidden"},r,{ref:t})))}),vY=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=to(Ii,e.__scopeScrollArea),i=e.orientation==="horizontal",s=dg(()=>u("SCROLL_END"),100),[l,u]=dY("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 d.useEffect(()=>{if(l==="idle"){const f=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(f)}},[l,o.scrollHideDelay,u]),d.useEffect(()=>{const f=o.viewport,m=i?"scrollLeft":"scrollTop";if(f){let p=f[m];const g=()=>{const y=f[m];p!==y&&(u("SCROLL"),s()),p=y};return f.addEventListener("scroll",g),()=>f.removeEventListener("scroll",g)}},[o.viewport,i,u,s]),d.createElement(xn,{present:n||l!=="hidden"},d.createElement(Xx,Y({"data-state":l==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:fe(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:fe(e.onPointerLeave,()=>u("POINTER_LEAVE"))})))}),Ok=d.forwardRef((e,t)=>{const n=to(Ii,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=d.useState(!1),l=e.orientation==="horizontal",u=dg(()=>{if(n.viewport){const f=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=to(Ii,e.__scopeScrollArea),i=d.useRef(null),s=d.useRef(0),[l,u]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=Lk(l.viewport,l.content),m={...r,sizes:l,onSizesChange:u,hasThumb:f>0&&f<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:g=>s.current=g};function p(g,y){return CY(g,s.current,l,y)}return n==="horizontal"?d.createElement(yY,Y({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const g=o.viewport.scrollLeft,y=_2(g,l,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"?d.createElement(wY,Y({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const g=o.viewport.scrollTop,y=_2(g,l);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}),yY=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=to(Ii,e.__scopeScrollArea),[s,l]=d.useState(),u=d.useRef(null),f=Ve(t,u,i.onScrollbarXChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(Dk,Y({"data-orientation":"horizontal"},o,{ref:f,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":ug(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(i.viewport){const g=i.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),jk(g,p)&&m.preventDefault()}},onResize:()=>{u.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Kp(s.paddingLeft),paddingEnd:Kp(s.paddingRight)}})}}))}),wY=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=to(Ii,e.__scopeScrollArea),[s,l]=d.useState(),u=d.useRef(null),f=Ve(t,u,i.onScrollbarYChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(Dk,Y({"data-orientation":"vertical"},o,{ref:f,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":ug(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(i.viewport){const g=i.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),jk(g,p)&&m.preventDefault()}},onResize:()=>{u.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Kp(s.paddingTop),paddingEnd:Kp(s.paddingBottom)}})}}))}),[xY,Nk]=Ak(Ii),Dk=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:f,onWheelScroll:m,onResize:p,...g}=e,y=to(Ii,n),[x,S]=d.useState(null),E=Ve(t,z=>S(z)),_=d.useRef(null),b=d.useRef(""),C=y.viewport,R=r.content-r.viewport,k=Lt(m),O=Lt(u),A=dg(p,10);function I(z){if(_.current){const H=z.clientX-_.current.left,ie=z.clientY-_.current.top;f({x:H,y:ie})}}return d.useEffect(()=>{const z=H=>{const ie=H.target;(x==null?void 0:x.contains(ie))&&k(H,R)};return document.addEventListener("wheel",z,{passive:!1}),()=>document.removeEventListener("wheel",z,{passive:!1})},[C,x,R,k]),d.useEffect(O,[r,O]),pc(x,A),pc(y.content,A),d.createElement(xY,{scope:n,scrollbar:x,hasThumb:o,onThumbChange:Lt(i),onThumbPointerUp:Lt(s),onThumbPositionChange:O,onThumbPointerDown:Lt(l)},d.createElement(Ae.div,Y({},g,{ref:E,style:{position:"absolute",...g.style},onPointerDown:fe(e.onPointerDown,z=>{z.button===0&&(z.target.setPointerCapture(z.pointerId),_.current=x.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",y.viewport&&(y.viewport.style.scrollBehavior="auto"),I(z))}),onPointerMove:fe(e.onPointerMove,I),onPointerUp:fe(e.onPointerUp,z=>{const H=z.target;H.hasPointerCapture(z.pointerId)&&H.releasePointerCapture(z.pointerId),document.body.style.webkitUserSelect=b.current,y.viewport&&(y.viewport.style.scrollBehavior=""),_.current=null})})))}),P1="ScrollAreaThumb",bY=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Nk(P1,e.__scopeScrollArea);return d.createElement(xn,{present:n||o.hasThumb},d.createElement(SY,Y({ref:t},r)))}),SY=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=to(P1,n),s=Nk(P1,n),{onThumbPositionChange:l}=s,u=Ve(t,p=>s.onThumbChange(p)),f=d.useRef(),m=dg(()=>{f.current&&(f.current(),f.current=void 0)},100);return d.useEffect(()=>{const p=i.viewport;if(p){const g=()=>{if(m(),!f.current){const y=$Y(p,l);f.current=y,l()}};return l(),p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[i.viewport,m,l]),d.createElement(Ae.div,Y({"data-state":s.hasThumb?"visible":"hidden"},o,{ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:fe(e.onPointerDownCapture,p=>{const y=p.target.getBoundingClientRect(),x=p.clientX-y.left,S=p.clientY-y.top;s.onThumbPointerDown({x,y:S})}),onPointerUp:fe(e.onPointerUp,s.onThumbPointerUp)}))}),Ik="ScrollAreaCorner",_Y=d.forwardRef((e,t)=>{const n=to(Ik,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.createElement(EY,Y({},e,{ref:t})):null}),EY=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=to(Ik,n),[i,s]=d.useState(0),[l,u]=d.useState(0),f=!!(i&&l);return pc(o.scrollbarX,()=>{var m;const p=((m=o.scrollbarX)===null||m===void 0?void 0:m.offsetHeight)||0;o.onCornerHeightChange(p),u(p)}),pc(o.scrollbarY,()=>{var m;const p=((m=o.scrollbarY)===null||m===void 0?void 0:m.offsetWidth)||0;o.onCornerWidthChange(p),s(p)}),f?d.createElement(Ae.div,Y({},r,{ref:t,style:{width:i,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function Kp(e){return e?parseInt(e,10):0}function Lk(e,t){const n=e/t;return isNaN(n)?0:n}function ug(e){const t=Lk(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function CY(e,t,n,r="ltr"){const o=ug(n),i=o/2,s=t||i,l=o-s,u=n.scrollbar.paddingStart+s,f=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,p=r==="ltr"?[0,m]:[m*-1,0];return Fk([u,f],p)(e)}function _2(e,t,n="ltr"){const r=ug(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,l=i-r,u=n==="ltr"?[0,s]:[s*-1,0],f=fd(e,u);return Fk([0,s],[0,l])(f)}function Fk(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 jk(e,t){return e>0&&e{})=>{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,l=n.top!==i.top;(s||l)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function dg(e,t){const n=Lt(e),r=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),d.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function pc(e,t){const n=Lt(t);Pn(()=>{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 Bk=hY,RY=mY,PY=_Y,fg=d.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(Bk,{ref:r,className:xe("relative overflow-hidden",e),scrollHideDelay:400,...n,children:[v.jsx(RY,{className:"h-full w-full rounded-[inherit]",children:t}),v.jsx(zk,{}),v.jsx(PY,{})]}));fg.displayName=Bk.displayName;const zk=d.forwardRef(({className:e,orientation:t="vertical",...n},r)=>v.jsx(Mk,{ref:r,orientation:t,className:xe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:v.jsx(bY,{className:"relative flex-1 rounded-full bg-border"})}));zk.displayName=Mk.displayName;const Uk="Name",Vk="Created time",Wk="Modified time",E2="input",TY="output",Hk="mask",C2={[Ps.NAME]:Uk,[Ps.CTIME]:Vk,[Ps.MTIME]:Wk};function kY(e){const{onPhotoClick:t,photoWidth:n}=e,[r,o]=Fx(!1),[i,s]=xt(H=>[H.fileManagerState,H.updateFileManagerState]),{toast:l}=Id(),[u,f]=d.useState(0),[m,p]=d.useState(0),g=d.useRef(null),y=GU(i.searchText,300),[x,S]=d.useState(E2),[E,_]=d.useState([]),[b,C]=d.useState([]),[R,k]=d.useState(0);Yn("f",()=>{o()}),Yn("left",()=>{let H=R;R>0&&(H=R-1),k(H),t(x,b[H].name)},[R,b]),Yn("right",()=>{let H=R;R{r||p(u)},[r,u]);const O=d.useCallback(H=>{H!==null&&r&&setTimeout(()=>{H.scrollTo({top:m,left:0})},100)},[r,m]);d.useEffect(()=>{(async()=>{try{const ie=await Gj(x);_(ie)}catch(ie){l({variant:"destructive",title:"Uh oh! Something went wrong.",description:ie.message?ie.message:ie.toString()})}})()},[x]),d.useEffect(()=>{if(!r)return;(async()=>{try{let ie=E;y&&(ie=new kc(ie,{keys:["name"]}).search(y).map(re=>ie[re.refIndex])),ie=xH.orderBy(ie,i.sortBy,i.sortOrder);const K=ie.map(te=>{const U=n,re=te.height*(U/te.width);return{src:`${Ni}/media_thumbnail_file?tab=${x}&filename=${encodeURIComponent(te.name)}&width=${Math.ceil(U)}&height=${Math.ceil(re)}`,height:re,width:U,name:te.name}});C(K)}catch(ie){l({variant:"destructive",title:"Uh oh! Something went wrong.",description:ie.message?ie.message:ie.toString()})}})()},[E,y,i,n,r]);const A=H=>{f(H.currentTarget.scrollTop)},I=({index:H})=>{o(),k(H),t(x,b[H].name)},z=()=>v.jsxs("div",{className:"flex justify-start items-center gap-[12px]",children:[v.jsx("div",{children:`Images (${b.length})`}),v.jsxs("div",{className:"flex",children:[v.jsx(Zn,{tooltip:"Rows layout",onClick:()=>{s({layout:"rows"})},children:v.jsx(vB,{className:i.layout!=="rows"?"opacity-50":""})}),v.jsx(Zn,{tooltip:"Grid layout",onClick:()=>{s({layout:"masonry"})},children:v.jsx(mB,{className:i.layout!=="masonry"?"opacity-50":""})})]})]});return v.jsxs(Mx,{open:r,onOpenChange:o,children:[v.jsx(vT,{asChild:!0,children:v.jsx(Zn,{tooltip:"File Manager",children:v.jsx(pH,{})})}),v.jsxs(rg,{className:"h-4/5 max-w-6xl",children:[v.jsx(og,{children:z()}),v.jsxs("div",{className:"flex justify-between gap-8 items-center",children:[v.jsxs("div",{className:"flex relative justify-start items-center",children:[v.jsx(dB,{className:"absolute left-[8px]"}),v.jsx(Wm,{ref:g,value:i.searchText,className:"w-[250px] pl-[30px]",tabIndex:-1,onInput:H=>{H.preventDefault(),H.stopPropagation();const ie=H.target;s({searchText:ie.value})},placeholder:"Search by file name"})]}),v.jsx(hk,{defaultValue:x,onValueChange:H=>S(H),children:v.jsxs(Hx,{"aria-label":"Manage your account",children:[v.jsx(ys,{value:E2,children:"Image Directory"}),v.jsx(ys,{value:TY,children:"Output Directory"}),v.jsx(ys,{value:Hk,children:"Mask Directory"})]})}),v.jsx("div",{className:"flex gap-2",children:v.jsxs("div",{className:"flex gap-1",children:[v.jsxs(yo,{value:C2[i.sortBy],onValueChange:H=>{switch(H){case Uk:s({sortBy:Ps.NAME});break;case Vk:s({sortBy:Ps.CTIME});break;case Wk:s({sortBy:Ps.MTIME});break}},children:[v.jsx(Vr,{className:"w-[140px]",children:v.jsx(wo,{})}),v.jsx(Wr,{children:Object.values(C2).map(H=>v.jsx(Hr,{value:H,children:H},H))})]}),i.sortOrder===Ou.DESCENDING?v.jsx(Zn,{tooltip:"Descending Order",onClick:()=>{s({sortOrder:Ou.ASCENDING})},children:v.jsx(iK,{})}):v.jsx(Zn,{tooltip:"Ascending Order",onClick:()=>{s({sortOrder:Ou.DESCENDING})},children:v.jsx(lK,{})})]})})]}),v.jsx(fg,{className:"w-full h-full rounded-md",onScroll:A,ref:O,children:v.jsx(nK,{layout:i.layout,photos:b,spacing:12,padding:0,onClick:I})})]})]})}var Hd=e=>e.type==="checkbox",Tl=e=>e instanceof Date,Fn=e=>e==null;const Kk=e=>typeof e=="object";var sn=e=>!Fn(e)&&!Array.isArray(e)&&Kk(e)&&!Tl(e),Gk=e=>sn(e)&&e.target?Hd(e.target)?e.target.checked:e.target.value:e,AY=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Yk=(e,t)=>e.has(AY(t)),MY=e=>{const t=e.constructor&&e.constructor.prototype;return sn(t)&&t.hasOwnProperty("isPrototypeOf")},Zx=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function uo(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Zx&&(e instanceof Blob||e instanceof FileList))&&(n||sn(e)))if(t=n?[]:{},!n&&!MY(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=uo(e[r]));else return e;return t}var Kd=e=>Array.isArray(e)?e.filter(Boolean):[],Wt=e=>e===void 0,ye=(e,t,n)=>{if(!t||!sn(e))return n;const r=Kd(t.split(/[,[\].]+?/)).reduce((o,i)=>Fn(o)?o:o[i],e);return Wt(r)||r===e?Wt(e[t])?n:e[t]:r},Uo=e=>typeof e=="boolean";const Gp={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},xo={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},hi={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Xk=Be.createContext(null),hg=()=>Be.useContext(Xk),OY=e=>{const{children:t,...n}=e;return Be.createElement(Xk.Provider,{value:n},t)};var Zk=(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]!==xo.all&&(t._proxyFormState[s]=!r||xo.all),n&&(n[s]=!0),e[s]}});return o},Fr=e=>sn(e)&&!Object.keys(e).length,qk=(e,t,n,r)=>{n(e);const{name:o,...i}=e;return Fr(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!r||xo.all))},rp=e=>Array.isArray(e)?e:[e],Qk=(e,t,n)=>!e||!t||e===t||rp(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function qx(e){const t=Be.useRef(e);t.current=e,Be.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function NY(e){const t=hg(),{control:n=t.control,disabled:r,name:o,exact:i}=e||{},[s,l]=Be.useState(n._formState),u=Be.useRef(!0),f=Be.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),m=Be.useRef(o);return m.current=o,qx({disabled:r,next:p=>u.current&&Qk(m.current,p.name,i)&&qk(p,f.current,n._updateFormState)&&l({...n._formState,...p}),subject:n._subjects.state}),Be.useEffect(()=>(u.current=!0,f.current.isValid&&n._updateValid(!0),()=>{u.current=!1}),[n]),Zk(s,n,f.current,!1)}var Ko=e=>typeof e=="string",Jk=(e,t,n,r,o)=>Ko(e)?(r&&t.watch.add(e),ye(n,e,o)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),ye(n,i))):(r&&(t.watchAll=!0),n);function DY(e){const t=hg(),{control:n=t.control,name:r,defaultValue:o,disabled:i,exact:s}=e||{},l=Be.useRef(r);l.current=r,qx({disabled:i,subject:n._subjects.values,next:m=>{Qk(l.current,m.name,s)&&f(uo(Jk(l.current,n._names,m.values||n._formValues,!1,o)))}});const[u,f]=Be.useState(n._getWatch(r,o));return Be.useEffect(()=>n._removeUnmounted()),u}var Qx=e=>/^\w*$/.test(e),e3=e=>Kd(e.replace(/["|']|\]/g,"").split(/\.|\[/));function wt(e,t,n){let r=-1;const o=Qx(t)?[t]:e3(t),i=o.length,s=i-1;for(;++r{const m=o._options.shouldUnregister||i,p=(g,y)=>{const x=ye(o._fields,g);x&&(x._f.mount=y)};if(p(n,!0),m){const g=uo(ye(o._options.defaultValues,n));wt(o._defaultValues,n,g),Wt(ye(o._formValues,n))&&wt(o._formValues,n,g)}return()=>{(s?m&&!o._state.action:m)?o.unregister(n):p(n,!1)}},[n,o,s,i]),Be.useEffect(()=>{ye(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:ye(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:l,...Uo(r)||Uo(u.disabled)?{disabled:u.disabled||r}:{},onChange:Be.useCallback(m=>f.current.onChange({target:{value:Gk(m),name:n},type:Gp.CHANGE}),[n]),onBlur:Be.useCallback(()=>f.current.onBlur({target:{value:ye(o._formValues,n),name:n},type:Gp.BLUR}),[n,o]),ref:m=>{const p=ye(o._fields,n);p&&m&&(p._f.ref={focus:()=>m.focus(),select:()=>m.select(),setCustomValidity:g=>m.setCustomValidity(g),reportValidity:()=>m.reportValidity()})}},formState:u,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ye(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!ye(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ye(u.touchedFields,n)},error:{enumerable:!0,get:()=>ye(u.errors,n)}})}}const LY=e=>e.render(IY(e));var t3=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},$2=e=>({isOnSubmit:!e||e===xo.onSubmit,isOnBlur:e===xo.onBlur,isOnChange:e===xo.onChange,isOnAll:e===xo.all,isOnTouch:e===xo.onTouched}),R2=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const op=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const i=ye(e,o);if(i){const{_f:s,...l}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!r)break;if(s.ref&&t(s.ref,s.name)&&!r)break}else sn(l)&&op(l,t)}}};var FY=(e,t,n)=>{const r=Kd(ye(e,n));return wt(r,"root",t[n]),wt(e,n,r),e},Jx=e=>e.type==="file",ws=e=>typeof e=="function",Yp=e=>{if(!Zx)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ip=e=>Ko(e),eb=e=>e.type==="radio",Xp=e=>e instanceof RegExp;const P2={value:!1,isValid:!1},T2={value:!0,isValid:!0};var n3=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&&!Wt(e[0].attributes.value)?Wt(e[0].value)||e[0].value===""?T2:{value:e[0].value,isValid:!0}:T2:P2}return P2};const k2={isValid:!1,value:null};var r3=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,k2):k2;function A2(e,t,n="validate"){if(ip(e)||Array.isArray(e)&&e.every(ip)||Uo(e)&&!e)return{type:n,message:ip(e)?e:"",ref:t}}var cl=e=>sn(e)&&!Xp(e)?e:{value:e,message:""},M2=async(e,t,n,r,o)=>{const{ref:i,refs:s,required:l,maxLength:u,minLength:f,min:m,max:p,pattern:g,validate:y,name:x,valueAsNumber:S,mount:E,disabled:_}=e._f,b=ye(t,x);if(!E||_)return{};const C=s?s[0]:i,R=K=>{r&&C.reportValidity&&(C.setCustomValidity(Uo(K)?"":K||""),C.reportValidity())},k={},O=eb(i),A=Hd(i),I=O||A,z=(S||Jx(i))&&Wt(i.value)&&Wt(b)||Yp(i)&&i.value===""||b===""||Array.isArray(b)&&!b.length,H=t3.bind(null,x,n,k),ie=(K,te,U,re=hi.maxLength,V=hi.minLength)=>{const J=K?te:U;k[x]={type:K?re:V,message:J,ref:i,...H(K?re:V,J)}};if(o?!Array.isArray(b)||!b.length:l&&(!I&&(z||Fn(b))||Uo(b)&&!b||A&&!n3(s).isValid||O&&!r3(s).isValid)){const{value:K,message:te}=ip(l)?{value:!!l,message:l}:cl(l);if(K&&(k[x]={type:hi.required,message:te,ref:C,...H(hi.required,te)},!n))return R(te),k}if(!z&&(!Fn(m)||!Fn(p))){let K,te;const U=cl(p),re=cl(m);if(!Fn(b)&&!isNaN(b)){const V=i.valueAsNumber||b&&+b;Fn(U.value)||(K=V>U.value),Fn(re.value)||(te=Vnew Date(new Date().toDateString()+" "+Q),G=i.type=="time",Z=i.type=="week";Ko(U.value)&&b&&(K=G?J(b)>J(U.value):Z?b>U.value:V>new Date(U.value)),Ko(re.value)&&b&&(te=G?J(b)+K.value,re=!Fn(te.value)&&b.length<+te.value;if((U||re)&&(ie(U,K.message,te.message),!n))return R(k[x].message),k}if(g&&!z&&Ko(b)){const{value:K,message:te}=cl(g);if(Xp(K)&&!b.match(K)&&(k[x]={type:hi.pattern,message:te,ref:i,...H(hi.pattern,te)},!n))return R(te),k}if(y){if(ws(y)){const K=await y(b,t),te=A2(K,C);if(te&&(k[x]={...te,...H(hi.validate,te.message)},!n))return R(te.message),k}else if(sn(y)){let K={};for(const te in y){if(!Fr(K)&&!n)break;const U=A2(await y[te](b,t),C,te);U&&(K={...U,...H(te,U.message)},R(U.message),n&&(k[x]=K))}if(!Fr(K)&&(k[x]={ref:C,...K},!n))return k}}return R(!0),k};function jY(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}}var Zp=e=>Fn(e)||!Kk(e);function va(e,t){if(Zp(e)||Zp(t))return e===t;if(Tl(e)&&Tl(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const i=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const s=t[o];if(Tl(i)&&Tl(s)||sn(i)&&sn(s)||Array.isArray(i)&&Array.isArray(s)?!va(i,s):i!==s)return!1}}return!0}var o3=e=>e.type==="select-multiple",zY=e=>eb(e)||Hd(e),B0=e=>Yp(e)&&e.isConnected,i3=e=>{for(const t in e)if(ws(e[t]))return!0;return!1};function qp(e,t={}){const n=Array.isArray(e);if(sn(e)||n)for(const r in e)Array.isArray(e[r])||sn(e[r])&&!i3(e[r])?(t[r]=Array.isArray(e[r])?[]:{},qp(e[r],t[r])):Fn(e[r])||(t[r]=!0);return t}function s3(e,t,n){const r=Array.isArray(e);if(sn(e)||r)for(const o in e)Array.isArray(e[o])||sn(e[o])&&!i3(e[o])?Wt(t)||Zp(n[o])?n[o]=Array.isArray(e[o])?qp(e[o],[]):{...qp(e[o])}:s3(e[o],Fn(t)?{}:t[o],n[o]):n[o]=!va(e[o],t[o]);return n}var z0=(e,t)=>s3(e,t,qp(t)),a3=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Wt(e)?e:t?e===""?NaN:e&&+e:n&&Ko(e)?new Date(e):r?r(e):e;function U0(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Jx(t)?t.files:eb(t)?r3(e.refs).value:o3(t)?[...t.selectedOptions].map(({value:n})=>n):Hd(t)?n3(e.refs).value:a3(Wt(t.value)?e.ref.value:t.value,e)}var UY=(e,t,n,r)=>{const o={};for(const i of e){const s=ye(t,i);s&&wt(o,i,s._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},uu=e=>Wt(e)?e:Xp(e)?e.source:sn(e)?Xp(e.value)?e.value.source:e.value:e,VY=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function O2(e,t,n){const r=ye(e,n);if(r||Qx(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const i=o.join("."),s=ye(t,i),l=ye(e,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};o.pop()}return{name:n}}var WY=(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,HY=(e,t)=>!Kd(ye(e,t)).length&&pn(e,t);const KY={mode:xo.onSubmit,reValidateMode:xo.onChange,shouldFocusError:!0};function GY(e={},t){let n={...KY,...e},r={submitCount:0,isDirty:!1,isLoading:ws(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},o={},i=sn(n.defaultValues)||sn(n.values)?uo(n.defaultValues||n.values)||{}:{},s=n.shouldUnregister?{}:uo(i),l={action:!1,mount:!1,watch:!1},u={mount:new Set,unMount:new Set,array:new Set,watch:new Set},f,m=0;const p={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={values:j0(),array:j0(),state:j0()},y=e.resetOptions&&e.resetOptions.keepDirtyValues,x=$2(n.mode),S=$2(n.reValidateMode),E=n.criteriaMode===xo.all,_=N=>X=>{clearTimeout(m),m=setTimeout(N,X)},b=async N=>{if(p.isValid||N){const X=n.resolver?Fr((await z()).errors):await ie(o,!0);X!==r.isValid&&g.state.next({isValid:X})}},C=N=>p.isValidating&&g.state.next({isValidating:N}),R=(N,X=[],ee,Se,pe=!0,he=!0)=>{if(Se&&ee){if(l.action=!0,he&&Array.isArray(ye(o,N))){const Te=ee(ye(o,N),Se.argA,Se.argB);pe&&wt(o,N,Te)}if(he&&Array.isArray(ye(r.errors,N))){const Te=ee(ye(r.errors,N),Se.argA,Se.argB);pe&&wt(r.errors,N,Te),HY(r.errors,N)}if(p.touchedFields&&he&&Array.isArray(ye(r.touchedFields,N))){const Te=ee(ye(r.touchedFields,N),Se.argA,Se.argB);pe&&wt(r.touchedFields,N,Te)}p.dirtyFields&&(r.dirtyFields=z0(i,s)),g.state.next({name:N,isDirty:te(N,X),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else wt(s,N,X)},k=(N,X)=>{wt(r.errors,N,X),g.state.next({errors:r.errors})},O=(N,X,ee,Se)=>{const pe=ye(o,N);if(pe){const he=ye(s,N,Wt(ee)?ye(i,N):ee);Wt(he)||Se&&Se.defaultChecked||X?wt(s,N,X?he:U0(pe._f)):V(N,he),l.mount&&b()}},A=(N,X,ee,Se,pe)=>{let he=!1,Te=!1;const ut={name:N};if(!ee||Se){p.isDirty&&(Te=r.isDirty,r.isDirty=ut.isDirty=te(),he=Te!==ut.isDirty);const gt=va(ye(i,N),X);Te=ye(r.dirtyFields,N),gt?pn(r.dirtyFields,N):wt(r.dirtyFields,N,!0),ut.dirtyFields=r.dirtyFields,he=he||p.dirtyFields&&Te!==!gt}if(ee){const gt=ye(r.touchedFields,N);gt||(wt(r.touchedFields,N,ee),ut.touchedFields=r.touchedFields,he=he||p.touchedFields&>!==ee)}return he&&pe&&g.state.next(ut),he?ut:{}},I=(N,X,ee,Se)=>{const pe=ye(r.errors,N),he=p.isValid&&Uo(X)&&r.isValid!==X;if(e.delayError&&ee?(f=_(()=>k(N,ee)),f(e.delayError)):(clearTimeout(m),f=null,ee?wt(r.errors,N,ee):pn(r.errors,N)),(ee?!va(pe,ee):pe)||!Fr(Se)||he){const Te={...Se,...he&&Uo(X)?{isValid:X}:{},errors:r.errors,name:N};r={...r,...Te},g.state.next(Te)}C(!1)},z=async N=>n.resolver(s,n.context,UY(N||u.mount,o,n.criteriaMode,n.shouldUseNativeValidation)),H=async N=>{const{errors:X}=await z(N);if(N)for(const ee of N){const Se=ye(X,ee);Se?wt(r.errors,ee,Se):pn(r.errors,ee)}else r.errors=X;return X},ie=async(N,X,ee={valid:!0})=>{for(const Se in N){const pe=N[Se];if(pe){const{_f:he,...Te}=pe;if(he){const ut=u.array.has(he.name),gt=await M2(pe,s,E,n.shouldUseNativeValidation&&!X,ut);if(gt[he.name]&&(ee.valid=!1,X))break;!X&&(ye(gt,he.name)?ut?FY(r.errors,gt,he.name):wt(r.errors,he.name,gt[he.name]):pn(r.errors,he.name))}Te&&await ie(Te,X,ee)}}return ee.valid},K=()=>{for(const N of u.unMount){const X=ye(o,N);X&&(X._f.refs?X._f.refs.every(ee=>!B0(ee)):!B0(X._f.ref))&&me(N)}u.unMount=new Set},te=(N,X)=>(N&&X&&wt(s,N,X),!va(L(),i)),U=(N,X,ee)=>Jk(N,u,{...l.mount?s:Wt(X)?i:Ko(N)?{[N]:X}:X},ee,X),re=N=>Kd(ye(l.mount?s:i,N,e.shouldUnregister?ye(i,N,[]):[])),V=(N,X,ee={})=>{const Se=ye(o,N);let pe=X;if(Se){const he=Se._f;he&&(!he.disabled&&wt(s,N,a3(X,he)),pe=Yp(he.ref)&&Fn(X)?"":X,o3(he.ref)?[...he.ref.options].forEach(Te=>Te.selected=pe.includes(Te.value)):he.refs?Hd(he.ref)?he.refs.length>1?he.refs.forEach(Te=>(!Te.defaultChecked||!Te.disabled)&&(Te.checked=Array.isArray(pe)?!!pe.find(ut=>ut===Te.value):pe===Te.value)):he.refs[0]&&(he.refs[0].checked=!!pe):he.refs.forEach(Te=>Te.checked=Te.value===pe):Jx(he.ref)?he.ref.value="":(he.ref.value=pe,he.ref.type||g.values.next({name:N,values:{...s}})))}(ee.shouldDirty||ee.shouldTouch)&&A(N,pe,ee.shouldTouch,ee.shouldDirty,!0),ee.shouldValidate&&le(N)},J=(N,X,ee)=>{for(const Se in X){const pe=X[Se],he=`${N}.${Se}`,Te=ye(o,he);(u.array.has(N)||!Zp(pe)||Te&&!Te._f)&&!Tl(pe)?J(he,pe,ee):V(he,pe,ee)}},G=(N,X,ee={})=>{const Se=ye(o,N),pe=u.array.has(N),he=uo(X);wt(s,N,he),pe?(g.array.next({name:N,values:{...s}}),(p.isDirty||p.dirtyFields)&&ee.shouldDirty&&g.state.next({name:N,dirtyFields:z0(i,s),isDirty:te(N,he)})):Se&&!Se._f&&!Fn(he)?J(N,he,ee):V(N,he,ee),R2(N,u)&&g.state.next({...r}),g.values.next({name:N,values:{...s}}),!l.mount&&t()},Z=async N=>{const X=N.target;let ee=X.name,Se=!0;const pe=ye(o,ee),he=()=>X.type?U0(pe._f):Gk(N),Te=ut=>{Se=Number.isNaN(ut)||ut===ye(s,ee,ut)};if(pe){let ut,gt;const An=he(),Mn=N.type===Gp.BLUR||N.type===Gp.FOCUS_OUT,Fi=!VY(pe._f)&&!n.resolver&&!ye(r.errors,ee)&&!pe._f.deps||WY(Mn,ye(r.touchedFields,ee),r.isSubmitted,S,x),Ro=R2(ee,u,Mn);wt(s,ee,An),Mn?(pe._f.onBlur&&pe._f.onBlur(N),f&&f(0)):pe._f.onChange&&pe._f.onChange(N);const Cr=A(ee,An,Mn,!1),Ks=!Fr(Cr)||Ro;if(!Mn&&g.values.next({name:ee,type:N.type,values:{...s}}),Fi)return p.isValid&&b(),Ks&&g.state.next({name:ee,...Ro?{}:Cr});if(!Mn&&Ro&&g.state.next({...r}),C(!0),n.resolver){const{errors:ri}=await z([ee]);if(Te(An),Se){const ji=O2(r.errors,o,ee),or=O2(ri,o,ji.name||ee);ut=or.error,ee=or.name,gt=Fr(ri)}}else ut=(await M2(pe,s,E,n.shouldUseNativeValidation))[ee],Te(An),Se&&(ut?gt=!1:p.isValid&&(gt=await ie(o,!0)));Se&&(pe._f.deps&&le(pe._f.deps),I(ee,gt,ut,Cr))}},Q=(N,X)=>{if(ye(r.errors,X)&&N.focus)return N.focus(),1},le=async(N,X={})=>{let ee,Se;const pe=rp(N);if(C(!0),n.resolver){const he=await H(Wt(N)?N:pe);ee=Fr(he),Se=N?!pe.some(Te=>ye(he,Te)):ee}else N?(Se=(await Promise.all(pe.map(async he=>{const Te=ye(o,he);return await ie(Te&&Te._f?{[he]:Te}:Te)}))).every(Boolean),!(!Se&&!r.isValid)&&b()):Se=ee=await ie(o);return g.state.next({...!Ko(N)||p.isValid&&ee!==r.isValid?{}:{name:N},...n.resolver||!N?{isValid:ee}:{},errors:r.errors,isValidating:!1}),X.shouldFocus&&!Se&&op(o,Q,N?pe:u.mount),Se},L=N=>{const X={...i,...l.mount?s:{}};return Wt(N)?X:Ko(N)?ye(X,N):N.map(ee=>ye(X,ee))},ue=(N,X)=>({invalid:!!ye((X||r).errors,N),isDirty:!!ye((X||r).dirtyFields,N),isTouched:!!ye((X||r).touchedFields,N),error:ye((X||r).errors,N)}),Ne=N=>{N&&rp(N).forEach(X=>pn(r.errors,X)),g.state.next({errors:N?r.errors:{}})},Ke=(N,X,ee)=>{const Se=(ye(o,N,{_f:{}})._f||{}).ref;wt(r.errors,N,{...X,ref:Se}),g.state.next({name:N,errors:r.errors,isValid:!1}),ee&&ee.shouldFocus&&Se&&Se.focus&&Se.focus()},Me=(N,X)=>ws(N)?g.values.subscribe({next:ee=>N(U(void 0,X),ee)}):U(N,X,!0),me=(N,X={})=>{for(const ee of N?rp(N):u.mount)u.mount.delete(ee),u.array.delete(ee),X.keepValue||(pn(o,ee),pn(s,ee)),!X.keepError&&pn(r.errors,ee),!X.keepDirty&&pn(r.dirtyFields,ee),!X.keepTouched&&pn(r.touchedFields,ee),!n.shouldUnregister&&!X.keepDefaultValue&&pn(i,ee);g.values.next({values:{...s}}),g.state.next({...r,...X.keepDirty?{isDirty:te()}:{}}),!X.keepIsValid&&b()},be=({disabled:N,name:X,field:ee,fields:Se,value:pe})=>{if(Uo(N)){const he=N?void 0:Wt(pe)?U0(ee?ee._f:ye(Se,X)._f):pe;wt(s,X,he),A(X,he,!1,!1,!0)}},Ee=(N,X={})=>{let ee=ye(o,N);const Se=Uo(X.disabled);return wt(o,N,{...ee||{},_f:{...ee&&ee._f?ee._f:{ref:{name:N}},name:N,mount:!0,...X}}),u.mount.add(N),ee?be({field:ee,disabled:X.disabled,name:N}):O(N,!0,X.value),{...Se?{disabled:X.disabled}:{},...n.progressive?{required:!!X.required,min:uu(X.min),max:uu(X.max),minLength:uu(X.minLength),maxLength:uu(X.maxLength),pattern:uu(X.pattern)}:{},name:N,onChange:Z,onBlur:Z,ref:pe=>{if(pe){Ee(N,X),ee=ye(o,N);const he=Wt(pe.value)&&pe.querySelectorAll&&pe.querySelectorAll("input,select,textarea")[0]||pe,Te=zY(he),ut=ee._f.refs||[];if(Te?ut.find(gt=>gt===he):he===ee._f.ref)return;wt(o,N,{_f:{...ee._f,...Te?{refs:[...ut.filter(B0),he,...Array.isArray(ye(i,N))?[{}]:[]],ref:{type:he.type,name:N}}:{ref:he}}}),O(N,!1,void 0,he)}else ee=ye(o,N,{}),ee._f&&(ee._f.mount=!1),(n.shouldUnregister||X.shouldUnregister)&&!(Yk(u.array,N)&&l.action)&&u.unMount.add(N)}}},Oe=()=>n.shouldFocusError&&op(o,Q,u.mount),Ie=N=>{Uo(N)&&(g.state.next({disabled:N}),op(o,X=>{X.disabled=N},0,!1))},ze=(N,X)=>async ee=>{ee&&(ee.preventDefault&&ee.preventDefault(),ee.persist&&ee.persist());let Se=uo(s);if(g.state.next({isSubmitting:!0}),n.resolver){const{errors:pe,values:he}=await z();r.errors=pe,Se=he}else await ie(o);pn(r.errors,"root"),Fr(r.errors)?(g.state.next({errors:{}}),await N(Se,ee)):(X&&await X({...r.errors},ee),Oe(),setTimeout(Oe)),g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Fr(r.errors),submitCount:r.submitCount+1,errors:r.errors})},ht=(N,X={})=>{ye(o,N)&&(Wt(X.defaultValue)?G(N,ye(i,N)):(G(N,X.defaultValue),wt(i,N,X.defaultValue)),X.keepTouched||pn(r.touchedFields,N),X.keepDirty||(pn(r.dirtyFields,N),r.isDirty=X.defaultValue?te(N,ye(i,N)):te()),X.keepError||(pn(r.errors,N),p.isValid&&b()),g.state.next({...r}))},st=(N,X={})=>{const ee=N?uo(N):i,Se=uo(ee),pe=N&&!Fr(N)?Se:i;if(X.keepDefaultValues||(i=ee),!X.keepValues){if(X.keepDirtyValues||y)for(const he of u.mount)ye(r.dirtyFields,he)?wt(pe,he,ye(s,he)):G(he,ye(pe,he));else{if(Zx&&Wt(N))for(const he of u.mount){const Te=ye(o,he);if(Te&&Te._f){const ut=Array.isArray(Te._f.refs)?Te._f.refs[0]:Te._f.ref;if(Yp(ut)){const gt=ut.closest("form");if(gt){gt.reset();break}}}}o={}}s=e.shouldUnregister?X.keepDefaultValues?uo(i):{}:uo(pe),g.array.next({values:{...pe}}),g.values.next({values:{...pe}})}u={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!l.mount&&t(),l.mount=!p.isValid||!!X.keepIsValid,l.watch=!!e.shouldUnregister,g.state.next({submitCount:X.keepSubmitCount?r.submitCount:0,isDirty:X.keepDirty?r.isDirty:!!(X.keepDefaultValues&&!va(N,i)),isSubmitted:X.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:X.keepDirtyValues?r.dirtyFields:X.keepDefaultValues&&N?z0(i,N):{},touchedFields:X.keepTouched?r.touchedFields:{},errors:X.keepErrors?r.errors:{},isSubmitSuccessful:X.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Yt=(N,X)=>st(ws(N)?N(s):N,X);return{control:{register:Ee,unregister:me,getFieldState:ue,handleSubmit:ze,setError:Ke,_executeSchema:z,_getWatch:U,_getDirty:te,_updateValid:b,_removeUnmounted:K,_updateFieldArray:R,_updateDisabledField:be,_getFieldArray:re,_reset:st,_resetDefaultValues:()=>ws(n.defaultValues)&&n.defaultValues().then(N=>{Yt(N,n.resetOptions),g.state.next({isLoading:!1})}),_updateFormState:N=>{r={...r,...N}},_disableForm:Ie,_subjects:g,_proxyFormState:p,get _fields(){return o},get _formValues(){return s},get _state(){return l},set _state(N){l=N},get _defaultValues(){return i},get _names(){return u},set _names(N){u=N},get _formState(){return r},set _formState(N){r=N},get _options(){return n},set _options(N){n={...n,...N}}},trigger:le,register:Ee,handleSubmit:ze,watch:Me,setValue:G,getValues:L,reset:Yt,resetField:ht,clearErrors:Ne,unregister:me,setError:Ke,setFocus:(N,X={})=>{const ee=ye(o,N),Se=ee&&ee._f;if(Se){const pe=Se.refs?Se.refs[0]:Se.ref;pe.focus&&(pe.focus(),X.shouldSelect&&pe.select())}},getFieldState:ue}}function YY(e={}){const t=Be.useRef(),n=Be.useRef(),[r,o]=Be.useState({isDirty:!1,isValidating:!1,isLoading:ws(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:ws(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...GY(e,()=>o(s=>({...s}))),formState:r});const i=t.current.control;return i._options=e,qx({subject:i._subjects.state,next:s=>{qk(s,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),Be.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),Be.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),Be.useEffect(()=>{e.values&&!va(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values):i._resetDefaultValues()},[e.values,i]),Be.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=Zk(r,i),t.current}var N2=function(e,t,n){if(e&&"reportValidity"in e){var r=ye(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},l3=function(e,t){var n=function(o){var i=t.fields[o];i&&i.ref&&"reportValidity"in i.ref?N2(i.ref,o,e):i.refs&&i.refs.forEach(function(s){return N2(s,o,e)})};for(var r in t.fields)n(r)},XY=function(e,t){t.shouldUseNativeValidation&&l3(e,t);var n={};for(var r in e){var o=ye(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(qY(t.names||Object.keys(e),r)){var s=Object.assign({},ZY(ye(n,r)));wt(s,"root",i),wt(n,r,s)}else wt(n,r,i)}return n},ZY=function(e){return Array.isArray(e)?e.filter(Boolean):[]},qY=function(e,t){return e.some(function(n){return n.startsWith(t+".")})},QY=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,i=r.message,s=r.path.join(".");if(!n[s])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[s]={message:l.message,type:l.code}}else n[s]={message:i,type:o};if("unionErrors"in r&&r.unionErrors.forEach(function(m){return m.errors.forEach(function(p){return e.push(p)})}),t){var u=n[s].types,f=u&&u[r.code];n[s]=t3(s,t,n,o,f?[].concat(f,r.message):r.message)}e.shift()}return n},JY=function(e,t,n){return n===void 0&&(n={}),function(r,o,i){try{return Promise.resolve(function(s,l){try{var u=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(f){return i.shouldUseNativeValidation&&l3({},i),{errors:{},values:n.raw?r:f}})}catch(f){return l(f)}return u&&u.then?u.then(void 0,l):u}(0,function(s){if(function(l){return l.errors!=null}(s))return{values:{},errors:XY(QY(s.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}}},mt;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const s of o)i[s]=s;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),s={};for(const l of i)s[l]=o[l];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(const s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(mt||(mt={}));var D2;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(D2||(D2={}));const _e=mt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),da=e=>{switch(typeof e){case"undefined":return _e.undefined;case"string":return _e.string;case"number":return isNaN(e)?_e.nan:_e.number;case"boolean":return _e.boolean;case"function":return _e.function;case"bigint":return _e.bigint;case"symbol":return _e.symbol;case"object":return Array.isArray(e)?_e.array:e===null?_e.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?_e.promise:typeof Map<"u"&&e instanceof Map?_e.map:typeof Set<"u"&&e instanceof Set?_e.set:typeof Date<"u"&&e instanceof Date?_e.date:_e.object;default:return _e.unknown}},ge=mt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Xo extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let l=r,u=0;for(;un.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Xo.create=e=>new Xo(e);const Qp=(e,t)=>{let n;switch(e.code){case ge.invalid_type:e.received===_e.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ge.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,mt.jsonStringifyReplacer)}`;break;case ge.unrecognized_keys:n=`Unrecognized key(s) in object: ${mt.joinValues(e.keys,", ")}`;break;case ge.invalid_union:n="Invalid input";break;case ge.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${mt.joinValues(e.options)}`;break;case ge.invalid_enum_value:n=`Invalid enum value. Expected ${mt.joinValues(e.options)}, received '${e.received}'`;break;case ge.invalid_arguments:n="Invalid function arguments";break;case ge.invalid_return_type:n="Invalid function return type";break;case ge.invalid_date:n="Invalid date";break;case ge.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:mt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ge.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ge.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ge.custom:n="Invalid input";break;case ge.invalid_intersection_types:n="Intersection results could not be merged";break;case ge.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ge.not_finite:n="Number must be finite";break;default:n=t.defaultError,mt.assertNever(e)}return{message:n}};let eX=Qp;function T1(){return eX}const k1=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],s={...o,path:i};let l="";const u=r.filter(f=>!!f).slice().reverse();for(const f of u)l=f(s,{data:t,defaultError:l}).message;return{...o,path:i,message:o.message||l}};function Re(e,t){const n=k1({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,T1(),Qp].filter(r=>!!r)});e.common.issues.push(n)}class Bn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Ze;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n)r.push({key:await o.key,value:await o.value});return Bn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return Ze;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const Ze=Object.freeze({status:"aborted"}),tX=e=>({status:"dirty",value:e}),nr=e=>({status:"valid",value:e}),I2=e=>e.status==="aborted",L2=e=>e.status==="dirty",Jp=e=>e.status==="valid",A1=e=>typeof Promise<"u"&&e instanceof Promise;var De;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(De||(De={}));class ei{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const F2=(e,t)=>{if(Jp(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Xo(e.common.issues);return this._error=n,this._error}}};function Xe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,l)=>s.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:r??l.defaultError}:{message:n??l.defaultError},description:o}}class rt{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return da(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:da(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Bn,ctx:{common:t.parent.common,data:t.data,parsedType:da(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(A1(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:da(t)},i=this._parseSync({data:t,path:o.path,parent:o});return F2(o,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:da(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(A1(o)?o:Promise.resolve(o));return F2(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const s=t(o),l=()=>i.addIssue({code:ge.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Mi({schema:this,typeName:Ue.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Ts.create(this,this._def)}nullable(){return yc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zo.create(this,this._def)}promise(){return pd.create(this,this._def)}or(t){return nm.create([this,t],this._def)}and(t){return rm.create(this,t,this._def)}transform(t){return new Mi({...Xe(this._def),schema:this,typeName:Ue.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new lm({...Xe(this._def),innerType:this,defaultValue:n,typeName:Ue.ZodDefault})}brand(){return new hX({typeName:Ue.ZodBranded,type:this,...Xe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new F1({...Xe(this._def),innerType:this,catchValue:n,typeName:Ue.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return pg.create(this,t)}readonly(){return B1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const nX=/^c[^\s-]{8,}$/i,rX=/^[a-z][a-z0-9]*$/,oX=/^[0-9A-HJKMNP-TV-Z]{26}$/,iX=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,sX=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let V0;const lX=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,cX=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,uX=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function dX(e,t){return!!((t==="v4"||!t)&&lX.test(e)||(t==="v6"||!t)&&cX.test(e))}class xi extends rt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==_e.string){const i=this._getOrReturnCtx(t);return Re(i,{code:ge.invalid_type,expected:_e.string,received:i.parsedType}),Ze}const r=new Bn;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(o=this._getOrReturnCtx(t,o),Re(o,{code:ge.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,l=t.data.lengtht.test(o),{validation:n,code:ge.invalid_string,...De.errToObj(r)})}_addCheck(t){return new xi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...De.errToObj(t)})}url(t){return this._addCheck({kind:"url",...De.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...De.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...De.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...De.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...De.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...De.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...De.errToObj(t)})}datetime(t){var n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...De.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...De.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...De.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...De.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...De.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...De.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...De.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...De.errToObj(n)})}nonempty(t){return this.min(1,De.errToObj(t))}trim(){return new xi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new xi({checks:[],typeName:Ue.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Xe(e)})};function fX(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=parseInt(e.toFixed(o).replace(".","")),s=parseInt(t.toFixed(o).replace(".",""));return i%s/Math.pow(10,o)}class mc extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==_e.number){const i=this._getOrReturnCtx(t);return Re(i,{code:ge.invalid_type,expected:_e.number,received:i.parsedType}),Ze}let r;const o=new Bn;for(const i of this._def.checks)i.kind==="int"?mt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Re(r,{code:ge.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Re(r,{code:ge.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?fX(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Re(r,{code:ge.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Re(r,{code:ge.not_finite,message:i.message}),o.dirty()):mt.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,De.toString(n))}gt(t,n){return this.setLimit("min",t,!1,De.toString(n))}lte(t,n){return this.setLimit("max",t,!0,De.toString(n))}lt(t,n){return this.setLimit("max",t,!1,De.toString(n))}setLimit(t,n,r,o){return new mc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(o)}]})}_addCheck(t){return new mc({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:De.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:De.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:De.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:De.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:De.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&mt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew mc({checks:[],typeName:Ue.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Xe(e)});class gc extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==_e.bigint){const i=this._getOrReturnCtx(t);return Re(i,{code:ge.invalid_type,expected:_e.bigint,received:i.parsedType}),Ze}let r;const o=new Bn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Re(r,{code:ge.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Re(r,{code:ge.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):mt.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,De.toString(n))}gt(t,n){return this.setLimit("min",t,!1,De.toString(n))}lte(t,n){return this.setLimit("max",t,!0,De.toString(n))}lt(t,n){return this.setLimit("max",t,!1,De.toString(n))}setLimit(t,n,r,o){return new gc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:De.toString(o)}]})}_addCheck(t){return new gc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:De.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:De.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:De.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:De.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:De.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new gc({checks:[],typeName:Ue.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Xe(e)})};class M1 extends rt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==_e.boolean){const r=this._getOrReturnCtx(t);return Re(r,{code:ge.invalid_type,expected:_e.boolean,received:r.parsedType}),Ze}return nr(t.data)}}M1.create=e=>new M1({typeName:Ue.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Xe(e)});class hd extends rt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==_e.date){const i=this._getOrReturnCtx(t);return Re(i,{code:ge.invalid_type,expected:_e.date,received:i.parsedType}),Ze}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return Re(i,{code:ge.invalid_date}),Ze}const r=new Bn;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(o=this._getOrReturnCtx(t,o),Re(o,{code:ge.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):mt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new hd({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:De.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:De.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew hd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ue.ZodDate,...Xe(e)});class O1 extends rt{_parse(t){if(this._getType(t)!==_e.symbol){const r=this._getOrReturnCtx(t);return Re(r,{code:ge.invalid_type,expected:_e.symbol,received:r.parsedType}),Ze}return nr(t.data)}}O1.create=e=>new O1({typeName:Ue.ZodSymbol,...Xe(e)});class em extends rt{_parse(t){if(this._getType(t)!==_e.undefined){const r=this._getOrReturnCtx(t);return Re(r,{code:ge.invalid_type,expected:_e.undefined,received:r.parsedType}),Ze}return nr(t.data)}}em.create=e=>new em({typeName:Ue.ZodUndefined,...Xe(e)});class tm extends rt{_parse(t){if(this._getType(t)!==_e.null){const r=this._getOrReturnCtx(t);return Re(r,{code:ge.invalid_type,expected:_e.null,received:r.parsedType}),Ze}return nr(t.data)}}tm.create=e=>new tm({typeName:Ue.ZodNull,...Xe(e)});class N1 extends rt{constructor(){super(...arguments),this._any=!0}_parse(t){return nr(t.data)}}N1.create=e=>new N1({typeName:Ue.ZodAny,...Xe(e)});class Ll extends rt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return nr(t.data)}}Ll.create=e=>new Ll({typeName:Ue.ZodUnknown,...Xe(e)});class Is extends rt{_parse(t){const n=this._getOrReturnCtx(t);return Re(n,{code:ge.invalid_type,expected:_e.never,received:n.parsedType}),Ze}}Is.create=e=>new Is({typeName:Ue.ZodNever,...Xe(e)});class D1 extends rt{_parse(t){if(this._getType(t)!==_e.undefined){const r=this._getOrReturnCtx(t);return Re(r,{code:ge.invalid_type,expected:_e.void,received:r.parsedType}),Ze}return nr(t.data)}}D1.create=e=>new D1({typeName:Ue.ZodVoid,...Xe(e)});class Zo extends rt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==_e.array)return Re(n,{code:ge.invalid_type,expected:_e.array,received:n.parsedType}),Ze;if(o.exactLength!==null){const s=n.data.length>o.exactLength.value,l=n.data.lengtho.maxLength.value&&(Re(n,{code:ge.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,l)=>o.type._parseAsync(new ei(n,s,n.path,l)))).then(s=>Bn.mergeArray(r,s));const i=[...n.data].map((s,l)=>o.type._parseSync(new ei(n,s,n.path,l)));return Bn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Zo({...this._def,minLength:{value:t,message:De.toString(n)}})}max(t,n){return new Zo({...this._def,maxLength:{value:t,message:De.toString(n)}})}length(t,n){return new Zo({...this._def,exactLength:{value:t,message:De.toString(n)}})}nonempty(t){return this.min(1,t)}}Zo.create=(e,t)=>new Zo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ue.ZodArray,...Xe(t)});function pl(e){if(e instanceof Ut){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ts.create(pl(r))}return new Ut({...e._def,shape:()=>t})}else return e instanceof Zo?new Zo({...e._def,type:pl(e.element)}):e instanceof Ts?Ts.create(pl(e.unwrap())):e instanceof yc?yc.create(pl(e.unwrap())):e instanceof Ai?Ai.create(e.items.map(t=>pl(t))):e}class Ut extends rt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=mt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==_e.object){const f=this._getOrReturnCtx(t);return Re(f,{code:ge.invalid_type,expected:_e.object,received:f.parsedType}),Ze}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof Is&&this._def.unknownKeys==="strip"))for(const f in o.data)s.includes(f)||l.push(f);const u=[];for(const f of s){const m=i[f],p=o.data[f];u.push({key:{status:"valid",value:f},value:m._parse(new ei(o,p,o.path,f)),alwaysSet:f in o.data})}if(this._def.catchall instanceof Is){const f=this._def.unknownKeys;if(f==="passthrough")for(const m of l)u.push({key:{status:"valid",value:m},value:{status:"valid",value:o.data[m]}});else if(f==="strict")l.length>0&&(Re(o,{code:ge.unrecognized_keys,keys:l}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const m of l){const p=o.data[m];u.push({key:{status:"valid",value:m},value:f._parse(new ei(o,p,o.path,m)),alwaysSet:m in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const f=[];for(const m of u){const p=await m.key;f.push({key:p,value:await m.value,alwaysSet:m.alwaysSet})}return f}).then(f=>Bn.mergeObjectSync(r,f)):Bn.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(t){return De.errToObj,new Ut({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i,s,l;const u=(s=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=De.errToObj(t).message)!==null&&l!==void 0?l:u}:{message:u}}}:{}})}strip(){return new Ut({...this._def,unknownKeys:"strip"})}passthrough(){return new Ut({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ut({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ut({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ue.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Ut({...this._def,catchall:t})}pick(t){const n={};return mt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Ut({...this._def,shape:()=>n})}omit(t){const n={};return mt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Ut({...this._def,shape:()=>n})}deepPartial(){return pl(this)}partial(t){const n={};return mt.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new Ut({...this._def,shape:()=>n})}required(t){const n={};return mt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ts;)i=i._def.innerType;n[r]=i}}),new Ut({...this._def,shape:()=>n})}keyof(){return c3(mt.objectKeys(this.shape))}}Ut.create=(e,t)=>new Ut({shape:()=>e,unknownKeys:"strip",catchall:Is.create(),typeName:Ue.ZodObject,...Xe(t)});Ut.strictCreate=(e,t)=>new Ut({shape:()=>e,unknownKeys:"strict",catchall:Is.create(),typeName:Ue.ZodObject,...Xe(t)});Ut.lazycreate=(e,t)=>new Ut({shape:e,unknownKeys:"strip",catchall:Is.create(),typeName:Ue.ZodObject,...Xe(t)});class nm extends rt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const s=i.map(l=>new Xo(l.ctx.common.issues));return Re(n,{code:ge.invalid_union,unionErrors:s}),Ze}if(n.common.async)return Promise.all(r.map(async i=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let i;const s=[];for(const u of r){const f={...n,common:{...n.common,issues:[]},parent:null},m=u._parseSync({data:n.data,path:n.path,parent:f});if(m.status==="valid")return m;m.status==="dirty"&&!i&&(i={result:m,ctx:f}),f.common.issues.length&&s.push(f.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=s.map(u=>new Xo(u));return Re(n,{code:ge.invalid_union,unionErrors:l}),Ze}}get options(){return this._def.options}}nm.create=(e,t)=>new nm({options:e,typeName:Ue.ZodUnion,...Xe(t)});const sp=e=>e instanceof im?sp(e.schema):e instanceof Mi?sp(e.innerType()):e instanceof sm?[e.value]:e instanceof La?e.options:e instanceof am?Object.keys(e.enum):e instanceof lm?sp(e._def.innerType):e instanceof em?[void 0]:e instanceof tm?[null]:null;class tb extends rt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.object)return Re(n,{code:ge.invalid_type,expected:_e.object,received:n.parsedType}),Ze;const r=this.discriminator,o=n.data[r],i=this.optionsMap.get(o);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Re(n,{code:ge.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ze)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const i of n){const s=sp(i.shape[t]);if(!s)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of s){if(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,i)}}return new tb({typeName:Ue.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...Xe(r)})}}function I1(e,t){const n=da(e),r=da(t);if(e===t)return{valid:!0,data:e};if(n===_e.object&&r===_e.object){const o=mt.objectKeys(t),i=mt.objectKeys(e).filter(l=>o.indexOf(l)!==-1),s={...e,...t};for(const l of i){const u=I1(e[l],t[l]);if(!u.valid)return{valid:!1};s[l]=u.data}return{valid:!0,data:s}}else if(n===_e.array&&r===_e.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i{if(I2(i)||I2(s))return Ze;const l=I1(i.value,s.value);return l.valid?((L2(i)||L2(s))&&n.dirty(),{status:n.value,value:l.data}):(Re(r,{code:ge.invalid_intersection_types}),Ze)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}rm.create=(e,t,n)=>new rm({left:e,right:t,typeName:Ue.ZodIntersection,...Xe(n)});class Ai extends rt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.array)return Re(r,{code:ge.invalid_type,expected:_e.array,received:r.parsedType}),Ze;if(r.data.lengththis._def.items.length&&(Re(r,{code:ge.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,l)=>{const u=this._def.items[l]||this._def.rest;return u?u._parse(new ei(r,s,r.path,l)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>Bn.mergeArray(n,s)):Bn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Ai({...this._def,rest:t})}}Ai.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ai({items:e,typeName:Ue.ZodTuple,rest:null,...Xe(t)})};class om extends rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.object)return Re(r,{code:ge.invalid_type,expected:_e.object,received:r.parsedType}),Ze;const o=[],i=this._def.keyType,s=this._def.valueType;for(const l in r.data)o.push({key:i._parse(new ei(r,l,r.path,l)),value:s._parse(new ei(r,r.data[l],r.path,l))});return r.common.async?Bn.mergeObjectAsync(n,o):Bn.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof rt?new om({keyType:t,valueType:n,typeName:Ue.ZodRecord,...Xe(r)}):new om({keyType:xi.create(),valueType:t,typeName:Ue.ZodRecord,...Xe(n)})}}class L1 extends rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.map)return Re(r,{code:ge.invalid_type,expected:_e.map,received:r.parsedType}),Ze;const o=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([l,u],f)=>({key:o._parse(new ei(r,l,r.path,[f,"key"])),value:i._parse(new ei(r,u,r.path,[f,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const u of s){const f=await u.key,m=await u.value;if(f.status==="aborted"||m.status==="aborted")return Ze;(f.status==="dirty"||m.status==="dirty")&&n.dirty(),l.set(f.value,m.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const u of s){const f=u.key,m=u.value;if(f.status==="aborted"||m.status==="aborted")return Ze;(f.status==="dirty"||m.status==="dirty")&&n.dirty(),l.set(f.value,m.value)}return{status:n.value,value:l}}}}L1.create=(e,t,n)=>new L1({valueType:t,keyType:e,typeName:Ue.ZodMap,...Xe(n)});class vc extends rt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_e.set)return Re(r,{code:ge.invalid_type,expected:_e.set,received:r.parsedType}),Ze;const o=this._def;o.minSize!==null&&r.data.sizeo.maxSize.value&&(Re(r,{code:ge.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function s(u){const f=new Set;for(const m of u){if(m.status==="aborted")return Ze;m.status==="dirty"&&n.dirty(),f.add(m.value)}return{status:n.value,value:f}}const l=[...r.data.values()].map((u,f)=>i._parse(new ei(r,u,r.path,f)));return r.common.async?Promise.all(l).then(u=>s(u)):s(l)}min(t,n){return new vc({...this._def,minSize:{value:t,message:De.toString(n)}})}max(t,n){return new vc({...this._def,maxSize:{value:t,message:De.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}vc.create=(e,t)=>new vc({valueType:e,minSize:null,maxSize:null,typeName:Ue.ZodSet,...Xe(t)});class Lu extends rt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.function)return Re(n,{code:ge.invalid_type,expected:_e.function,received:n.parsedType}),Ze;function r(l,u){return k1({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,T1(),Qp].filter(f=>!!f),issueData:{code:ge.invalid_arguments,argumentsError:u}})}function o(l,u){return k1({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,T1(),Qp].filter(f=>!!f),issueData:{code:ge.invalid_return_type,returnTypeError:u}})}const i={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof pd){const l=this;return nr(async function(...u){const f=new Xo([]),m=await l._def.args.parseAsync(u,i).catch(y=>{throw f.addIssue(r(u,y)),f}),p=await Reflect.apply(s,this,m);return await l._def.returns._def.type.parseAsync(p,i).catch(y=>{throw f.addIssue(o(p,y)),f})})}else{const l=this;return nr(function(...u){const f=l._def.args.safeParse(u,i);if(!f.success)throw new Xo([r(u,f.error)]);const m=Reflect.apply(s,this,f.data),p=l._def.returns.safeParse(m,i);if(!p.success)throw new Xo([o(m,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Lu({...this._def,args:Ai.create(t).rest(Ll.create())})}returns(t){return new Lu({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Lu({args:t||Ai.create([]).rest(Ll.create()),returns:n||Ll.create(),typeName:Ue.ZodFunction,...Xe(r)})}}class im extends rt{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}im.create=(e,t)=>new im({getter:e,typeName:Ue.ZodLazy,...Xe(t)});class sm extends rt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Re(n,{received:n.data,code:ge.invalid_literal,expected:this._def.value}),Ze}return{status:"valid",value:t.data}}get value(){return this._def.value}}sm.create=(e,t)=>new sm({value:e,typeName:Ue.ZodLiteral,...Xe(t)});function c3(e,t){return new La({values:e,typeName:Ue.ZodEnum,...Xe(t)})}class La extends rt{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Re(n,{expected:mt.joinValues(r),received:n.parsedType,code:ge.invalid_type}),Ze}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return Re(n,{received:n.data,code:ge.invalid_enum_value,options:r}),Ze}return nr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return La.create(t)}exclude(t){return La.create(this.options.filter(n=>!t.includes(n)))}}La.create=c3;class am extends rt{_parse(t){const n=mt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==_e.string&&r.parsedType!==_e.number){const o=mt.objectValues(n);return Re(r,{expected:mt.joinValues(o),received:r.parsedType,code:ge.invalid_type}),Ze}if(n.indexOf(t.data)===-1){const o=mt.objectValues(n);return Re(r,{received:r.data,code:ge.invalid_enum_value,options:o}),Ze}return nr(t.data)}get enum(){return this._def.values}}am.create=(e,t)=>new am({values:e,typeName:Ue.ZodNativeEnum,...Xe(t)});class pd extends rt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_e.promise&&n.common.async===!1)return Re(n,{code:ge.invalid_type,expected:_e.promise,received:n.parsedType}),Ze;const r=n.parsedType===_e.promise?n.data:Promise.resolve(n.data);return nr(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}pd.create=(e,t)=>new pd({type:e,typeName:Ue.ZodPromise,...Xe(t)});class Mi extends rt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{Re(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const s=o.transform(r.data,i);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(s).then(l=>this._def.schema._parseAsync({data:l,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}if(o.type==="refinement"){const s=l=>{const u=o.refinement(l,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?Ze:(l.status==="dirty"&&n.dirty(),s(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?Ze:(l.status==="dirty"&&n.dirty(),s(l.value).then(()=>({status:n.value,value:l.value}))))}if(o.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Jp(s))return s;const l=o.transform(s.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Jp(s)?Promise.resolve(o.transform(s.value,i)).then(l=>({status:n.value,value:l})):s);mt.assertNever(o)}}Mi.create=(e,t,n)=>new Mi({schema:e,typeName:Ue.ZodEffects,effect:t,...Xe(n)});Mi.createWithPreprocess=(e,t,n)=>new Mi({schema:t,effect:{type:"preprocess",transform:e},typeName:Ue.ZodEffects,...Xe(n)});class Ts extends rt{_parse(t){return this._getType(t)===_e.undefined?nr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ts.create=(e,t)=>new Ts({innerType:e,typeName:Ue.ZodOptional,...Xe(t)});class yc extends rt{_parse(t){return this._getType(t)===_e.null?nr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}yc.create=(e,t)=>new yc({innerType:e,typeName:Ue.ZodNullable,...Xe(t)});class lm extends rt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===_e.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}lm.create=(e,t)=>new lm({innerType:e,typeName:Ue.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Xe(t)});class F1 extends rt{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return A1(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Xo(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Xo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}F1.create=(e,t)=>new F1({innerType:e,typeName:Ue.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Xe(t)});class j1 extends rt{_parse(t){if(this._getType(t)!==_e.nan){const r=this._getOrReturnCtx(t);return Re(r,{code:ge.invalid_type,expected:_e.nan,received:r.parsedType}),Ze}return{status:"valid",value:t.data}}}j1.create=e=>new j1({typeName:Ue.ZodNaN,...Xe(e)});class hX extends rt{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class pg extends rt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ze:i.status==="dirty"?(n.dirty(),tX(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ze:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new pg({in:t,out:n,typeName:Ue.ZodPipeline})}}class B1 extends rt{_parse(t){const n=this._def.innerType._parse(t);return Jp(n)&&(n.value=Object.freeze(n.value)),n}}B1.create=(e,t)=>new B1({innerType:e,typeName:Ue.ZodReadonly,...Xe(t)});Ut.lazycreate;var Ue;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ue||(Ue={}));const du=xi.create;mc.create;j1.create;gc.create;const fu=M1.create;hd.create;O1.create;em.create;tm.create;N1.create;Ll.create;Is.create;D1.create;Zo.create;const pX=Ut.create;Ut.strictCreate;nm.create;tb.create;rm.create;Ai.create;om.create;L1.create;vc.create;Lu.create;im.create;sm.create;La.create;am.create;pd.create;Mi.create;Ts.create;yc.create;Mi.createWithPreprocess;pg.create;const z1="horizontal",mX=["horizontal","vertical"],u3=d.forwardRef((e,t)=>{const{decorative:n,orientation:r=z1,...o}=e,i=d3(r)?r:z1,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return d.createElement(Ae.div,Y({"data-orientation":i},l,o,{ref:t}))});u3.propTypes={orientation(e,t,n){const r=e[t],o=String(r);return r&&!d3(r)?new Error(gX(o,n)):null}};function gX(e,t){return`Invalid prop \`orientation\` of value \`${e}\` supplied to \`${t}\`, expected one of: - horizontal - vertical Defaulting to \`${z1}\`.`}function d3(e){return mX.includes(e)}const f3=u3,Xt=d.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>v.jsx(f3,{ref:o,decorative:n,orientation:t,className:xe("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Xt.displayName=f3.displayName;const vX=d.forwardRef((e,t)=>d.createElement(Ae.label,Y({},e,{ref:t,onMouseDown:n=>{var r;(r=e.onMouseDown)===null||r===void 0||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault()}}))),h3=vX,yX=Fm("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),nb=d.forwardRef(({className:e,disabled:t,...n},r)=>v.jsx(h3,{ref:r,className:xe(yX(),e,t?"opacity-50":"","select-none"),...n}));nb.displayName=h3.displayName;const wX=OY,p3=d.createContext({}),ul=({...e})=>v.jsx(p3.Provider,{value:{name:e.name},children:v.jsx(LY,{...e})}),mg=()=>{const e=d.useContext(p3),t=d.useContext(m3),{getFieldState:n,formState:r}=hg(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...o}},m3=d.createContext({}),sa=d.forwardRef(({className:e,...t},n)=>{const r=d.useId();return v.jsx(m3.Provider,{value:{id:r},children:v.jsx("div",{ref:n,className:xe("space-y-2",e),...t})})});sa.displayName="FormItem";const aa=d.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:o}=mg();return v.jsx(nb,{ref:n,className:xe(r&&"text-destructive","text-sm",e),htmlFor:o,...t})});aa.displayName="FormLabel";const la=d.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:o,formMessageId:i}=mg();return v.jsx(Qo,{ref:t,id:r,"aria-describedby":n?`${o} ${i}`:`${o}`,"aria-invalid":!!n,...e})});la.displayName="FormControl";const ca=d.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=mg();return v.jsx("p",{ref:n,id:r,className:xe("text-[0.8rem] text-muted-foreground",e),...t})});ca.displayName="FormDescription";const xX=d.forwardRef(({className:e,children:t,...n},r)=>{const{error:o,formMessageId:i}=mg(),s=o?String(o==null?void 0:o.message):t;return s?v.jsx("p",{ref:r,id:i,className:xe("text-[0.8rem] font-medium text-destructive",e),...n,children:s}):null});xX.displayName="FormMessage";const g3="Switch",[bX,wte]=Tn(g3),[SX,_X]=bX(g3),EX=d.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:l,value:u="on",onCheckedChange:f,...m}=e,[p,g]=d.useState(null),y=Ve(t,b=>g(b)),x=d.useRef(!1),S=p?!!p.closest("form"):!0,[E=!1,_]=eo({prop:o,defaultProp:i,onChange:f});return d.createElement(SX,{scope:n,checked:E,disabled:l},d.createElement(Ae.button,Y({type:"button",role:"switch","aria-checked":E,"aria-required":s,"data-state":v3(E),"data-disabled":l?"":void 0,disabled:l,value:u},m,{ref:y,onClick:fe(e.onClick,b=>{_(C=>!C),S&&(x.current=b.isPropagationStopped(),x.current||b.stopPropagation())})})),S&&d.createElement(RX,{control:p,bubbles:!x.current,name:r,value:u,checked:E,required:s,disabled:l,style:{transform:"translateX(-100%)"}}))}),CX="SwitchThumb",$X=d.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=_X(CX,n);return d.createElement(Ae.span,Y({"data-state":v3(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),RX=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=d.useRef(null),s=Kx(n),l=Sx(t);return d.useEffect(()=>{const u=i.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(s!==n&&p){const g=new Event("click",{bubbles:r});p.call(u,n),u.dispatchEvent(g)}},[s,n,r]),d.createElement("input",Y({type:"checkbox","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function v3(e){return e?"checked":"unchecked"}const y3=EX,PX=$X,jr=d.forwardRef(({className:e,...t},n)=>v.jsx(y3,{className:xe("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),tabIndex:-1,...t,ref:n,children:v.jsx(PX,{className:xe("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));jr.displayName=y3.displayName;const TX="AlertDialog",[kX,xte]=Tn(TX,[gT]),Vs=gT(),AX=e=>{const{__scopeAlertDialog:t,...n}=e,r=Vs(t);return d.createElement(Tx,Y({},r,n,{modal:!0}))},MX=e=>{const{__scopeAlertDialog:t,...n}=e,r=Vs(t);return d.createElement(kx,Y({},r,n))},OX=d.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Vs(n);return d.createElement(Bd,Y({},o,r,{ref:t}))}),w3="AlertDialogContent",[NX,DX]=kX(w3),IX=d.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=Vs(n),s=d.useRef(null),l=Ve(t,s),u=d.useRef(null);return d.createElement(JV,{contentName:w3,titleName:LX,docsSlug:"alert-dialog"},d.createElement(NX,{scope:n,cancelRef:u},d.createElement(zd,Y({role:"alertdialog"},i,o,{ref:l,onOpenAutoFocus:fe(o.onOpenAutoFocus,f=>{var m;f.preventDefault(),(m=u.current)===null||m===void 0||m.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault()}),d.createElement(fx,null,r),!1)))}),LX="AlertDialogTitle",FX=d.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Vs(n);return d.createElement(Ud,Y({},o,r,{ref:t}))}),jX=d.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Vs(n);return d.createElement(Vd,Y({},o,r,{ref:t}))}),BX=d.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Vs(n);return d.createElement(Ax,Y({},o,r,{ref:t}))}),zX="AlertDialogCancel",UX=d.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=DX(zX,n),i=Vs(n),s=Ve(t,o);return d.createElement(Ax,Y({},i,r,{ref:s}))}),VX=AX,WX=MX,x3=OX,b3=IX,S3=BX,_3=UX,E3=FX,C3=jX,HX=VX,KX=WX,$3=d.forwardRef(({className:e,...t},n)=>v.jsx(x3,{className:xe("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));$3.displayName=x3.displayName;const R3=d.forwardRef(({className:e,...t},n)=>v.jsxs(KX,{children:[v.jsx($3,{}),v.jsx(b3,{ref:n,className:xe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));R3.displayName=b3.displayName;const P3=({className:e,...t})=>v.jsx("div",{className:xe("flex flex-col space-y-2 text-center sm:text-left",e),...t});P3.displayName="AlertDialogHeader";const GX=d.forwardRef(({className:e,...t},n)=>v.jsx(E3,{ref:n,className:xe("text-lg font-semibold",e),...t}));GX.displayName=E3.displayName;const YX=d.forwardRef(({className:e,...t},n)=>v.jsx(C3,{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));YX.displayName=C3.displayName;const XX=d.forwardRef(({className:e,...t},n)=>v.jsx(S3,{ref:n,className:xe(Rx(),e),...t}));XX.displayName=S3.displayName;const ZX=d.forwardRef(({className:e,...t},n)=>v.jsx(_3,{ref:n,className:xe(Rx({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ZX.displayName=_3.displayName;const qX=pX({enableFileManager:fu(),inputDirectory:du(),outputDirectory:du(),enableDownloadMask:fu(),enableManualInpainting:fu(),enableUploadMask:fu(),enableAutoExtractPrompt:fu(),removeBGModel:du(),realesrganModel:du(),interactiveSegModel:du()}),T3="General",U1="Model",k3="Plugins",QX=[U1,T3,k3];function JX(){const[e,t]=rT(!1),[n,r]=d.useState(U1),[o,i,s,l,u,f]=xt(V=>[V.updateAppState,V.settings,V.updateSettings,V.fileManagerState,V.setModel,V.setServerConfig]),{toast:m}=Id(),[p,g]=d.useState(i.model),[y,x]=d.useState([]),S=y.length>0;d.useEffect(()=>{g(i.model)},[i.model]);const{data:E,status:_,refetch:b}=OL({queryKey:["serverConfig"],queryFn:SP}),C=YY({resolver:JY(qX),defaultValues:{enableDownloadMask:i.enableDownloadMask,enableManualInpainting:i.enableManualInpainting,enableUploadMask:i.enableUploadMask,enableAutoExtractPrompt:i.enableAutoExtractPrompt,inputDirectory:l.inputDirectory,outputDirectory:l.outputDirectory,removeBGModel:E==null?void 0:E.removeBGModel,realesrganModel:E==null?void 0:E.realesrganModel,interactiveSegModel:E==null?void 0:E.interactiveSegModel}});d.useEffect(()=>{E&&(f(E),C.setValue("removeBGModel",E.removeBGModel),C.setValue("realesrganModel",E.realesrganModel),C.setValue("interactiveSegModel",E.interactiveSegModel))},[C,E]);async function R(V){s({enableDownloadMask:V.enableDownloadMask,enableManualInpainting:V.enableManualInpainting,enableUploadMask:V.enableUploadMask,enableAutoExtractPrompt:V.enableAutoExtractPrompt});const J=p.name!==i.model.name,G=(E==null?void 0:E.removeBGModel)!==V.removeBGModel&&A,Z=(E==null?void 0:E.realesrganModel)!==V.realesrganModel&&I,Q=(E==null?void 0:E.interactiveSegModel)!==V.interactiveSegModel&&z;if(J||G||Z||Q){const L=[];if(J&&L.push(`Switching model from ${i.model.name} to ${p.name}`),G&&L.push(`Switching RemoveBG model from ${E==null?void 0:E.removeBGModel} to ${V.removeBGModel}`),Z&&L.push(`Switching RealESRGAN model from ${E==null?void 0:E.realesrganModel} to ${V.realesrganModel}`),Q&&L.push(`Switching ${Oo.InteractiveSeg} model from ${E==null?void 0:E.interactiveSegModel} to ${V.interactiveSegModel}`),x(L),o({disableShortCuts:!0}),J)try{const ue=await Vj(p.name);m({title:`Switch to ${ue.name} success`}),u(p)}catch(ue){m({variant:"destructive",title:`Switch to ${p.name} failed: ${ue}`}),g(i.model)}if(G)try{const ue=await S0(Oo.RemoveBG,V.removeBGModel);if(ue.status!==200)throw new Error(ue.statusText)}catch(ue){m({variant:"destructive",title:`Switch RemoveBG model to ${V.removeBGModel} failed: ${ue}`})}if(Z)try{const ue=await S0(Oo.RealESRGAN,V.realesrganModel);if(ue.status!==200)throw new Error(ue.statusText)}catch(ue){m({variant:"destructive",title:`Switch RealESRGAN model to ${V.realesrganModel} failed: ${ue}`})}if(Q)try{const ue=await S0(Oo.InteractiveSeg,V.interactiveSegModel);if(ue.status!==200)throw new Error(ue.statusText)}catch(ue){m({variant:"destructive",title:`Switch ${Oo.InteractiveSeg} model to ${V.interactiveSegModel} failed: ${ue}`})}x([]),o({disableShortCuts:!1}),b()}}if(Yn("s",()=>{t(),e&&R(C.getValues())},[e,C,p,E]),_!=="success")return v.jsx(v.Fragment,{});const k=E.modelInfos,O=E.plugins,A=O.some(V=>V.name===Oo.RemoveBG),I=O.some(V=>V.name===Oo.RealESRGAN),z=O.some(V=>V.name===Oo.InteractiveSeg);function H(V){t(),V||R(C.getValues())}function ie(V){g(V)}function K(V){return k?k.filter(J=>V.includes(J.model_type)).map(J=>v.jsxs("div",{onClick:()=>ie(J),className:"px-2",children:[v.jsx("div",{className:xe([J.name===p.name?"bg-muted":"hover:bg-muted","rounded-md px-2 py-2","cursor-default"]),children:v.jsx("div",{className:"text-base",children:J.name})}),v.jsx(Xt,{className:"my-1"})]},J.name)):v.jsx("div",{children:"Please download model first"})}function te(){let V=ms;for(let J of k)if(p.name===J.name){V=J.model_type,V===uC&&(V=hh),V===dC&&(V=ph);break}return v.jsxs("div",{className:"flex flex-col gap-4 w-[510px]",children:[v.jsxs("div",{className:"flex flex-col gap-4 rounded-md",children:[v.jsx("div",{className:"font-medium",children:"Current Model"}),v.jsx("div",{children:p.name})]}),v.jsx(Xt,{}),v.jsxs("div",{className:"space-y-4 rounded-md",children:[v.jsx("div",{className:"flex gap-1 items-center justify-start",children:v.jsx("div",{className:"font-medium",children:"Available models"})}),v.jsxs(hk,{defaultValue:V,children:[v.jsxs(Hx,{children:[v.jsx(ys,{value:ms,children:"Inpaint"}),v.jsx(ys,{value:hh,children:"Stable Diffusion"}),v.jsx(ys,{value:ph,children:"Stable Diffusion Inpaint"}),v.jsx(ys,{value:g0,children:"Other Diffusion"})]}),v.jsxs(fg,{className:"h-[240px] w-full mt-2 outline-none border rounded-lg",children:[v.jsx(Su,{value:ms,children:K([ms])}),v.jsx(Su,{value:hh,children:K([hh,uC])}),v.jsx(Su,{value:ph,children:K([ph,dC])}),v.jsx(Su,{value:g0,children:K([g0])})]})]})]})]})}function U(){return v.jsxs("div",{className:"space-y-4 w-[510px]",children:[v.jsx(ul,{control:C.control,name:"enableManualInpainting",render:({field:V})=>v.jsxs(sa,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(aa,{children:"Enable manual inpainting"}),v.jsx(ca,{children:"For erase model, click a button to trigger inpainting after draw mask."})]}),v.jsx(la,{children:v.jsx(jr,{checked:V.value,onCheckedChange:V.onChange})})]})}),v.jsx(Xt,{}),v.jsx(ul,{control:C.control,name:"enableDownloadMask",render:({field:V})=>v.jsxs(sa,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(aa,{children:"Enable download mask"}),v.jsx(ca,{children:"Also download the mask after save the inpainting result."})]}),v.jsx(la,{children:v.jsx(jr,{checked:V.value,onCheckedChange:V.onChange})})]})}),v.jsx(Xt,{}),v.jsx(ul,{control:C.control,name:"enableAutoExtractPrompt",render:({field:V})=>v.jsxs(sa,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(aa,{children:"Enable auto extract prompt"}),v.jsx(ca,{children:"Automatically extract prompt/negativate prompt from the image meta."})]}),v.jsx(la,{children:v.jsx(jr,{checked:V.value,onCheckedChange:V.onChange})})]})})]})}function re(){return v.jsxs("div",{className:"space-y-4 w-[510px]",children:[v.jsx(ul,{control:C.control,name:"removeBGModel",render:({field:V})=>v.jsxs(sa,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(aa,{children:"Remove Background"}),v.jsx(ca,{children:"Remove background model"})]}),v.jsxs(yo,{onValueChange:V.onChange,defaultValue:V.value,disabled:!A,children:[v.jsx(la,{children:v.jsx(Vr,{className:"w-auto",children:v.jsx(wo,{placeholder:"Select removebg model"})})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:E==null?void 0:E.removeBGModels.map(J=>v.jsx(Hr,{value:J,children:J},J))})})]})]})}),v.jsx(Xt,{}),v.jsx(ul,{control:C.control,name:"realesrganModel",render:({field:V})=>v.jsxs(sa,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(aa,{children:"RealESRGAN"}),v.jsx(ca,{children:"RealESRGAN Model"})]}),v.jsxs(yo,{onValueChange:V.onChange,defaultValue:V.value,disabled:!I,children:[v.jsx(la,{children:v.jsx(Vr,{className:"w-auto",children:v.jsx(wo,{placeholder:"Select RealESRGAN model"})})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:E==null?void 0:E.realesrganModels.map(J=>v.jsx(Hr,{value:J,children:J},J))})})]})]})}),v.jsx(Xt,{}),v.jsx(ul,{control:C.control,name:"interactiveSegModel",render:({field:V})=>v.jsxs(sa,{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"space-y-0.5",children:[v.jsx(aa,{children:"Interactive Segmentation"}),v.jsx(ca,{children:"Interactive Segmentation Model"})]}),v.jsxs(yo,{onValueChange:V.onChange,defaultValue:V.value,disabled:!z,children:[v.jsx(la,{children:v.jsx(Vr,{className:"w-auto",children:v.jsx(wo,{placeholder:"Select interactive segmentation model"})})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:E==null?void 0:E.interactiveSegModels.map(J=>v.jsx(Hr,{value:J,children:J},J))})})]})]})})]})}return v.jsxs(v.Fragment,{children:[v.jsx(HX,{open:S,children:v.jsx(R3,{children:v.jsx(P3,{children:v.jsxs("div",{className:"flex flex-col justify-center items-center gap-4",children:[v.jsxs("div",{role:"status",children:[v.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-primary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[v.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),v.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),v.jsx("span",{className:"sr-only",children:"Loading..."})]}),y?v.jsx("div",{className:"flex flex-col",children:y.map((V,J)=>v.jsx("div",{children:V},J))}):v.jsx(v.Fragment,{})]})})})}),v.jsxs(Mx,{open:e,onOpenChange:H,children:[v.jsx(_T,{asChild:!0,children:v.jsx(Zn,{tooltip:"Settings",children:v.jsx(vH,{})})}),v.jsxs(rg,{className:"max-w-3xl h-[600px]",onOpenAutoFocus:V=>V.preventDefault(),children:[v.jsx(og,{children:"Settings"}),v.jsx(Xt,{}),v.jsxs("div",{className:"flex flex-row space-x-8 h-full",children:[v.jsx("div",{className:"flex flex-col space-y-1",children:QX.map(V=>v.jsx(vn,{variant:"ghost",onClick:()=>r(V),className:xe(n===V?"bg-muted ":"hover:bg-muted","justify-start"),children:V},V))}),v.jsx(Xt,{orientation:"vertical"}),v.jsx(wX,{...C,children:v.jsx("div",{className:"flex w-full justify-center",children:v.jsxs("form",{onSubmit:C.handleSubmit(R),children:[n===U1?te():v.jsx(v.Fragment,{}),n===T3?U():v.jsx(v.Fragment,{}),n===k3?re():v.jsx(v.Fragment,{}),v.jsx("div",{className:"absolute right-10 bottom-6",children:v.jsx(vn,{onClick:()=>H(!1),children:"Ok"})})]})})})]})]})]})]})}const eZ=()=>{const[e,t,n,r,o,i,s,l,u,f,m,p,g,y,x]=xt(k=>[k.file,k.customMask,k.isInpainting,k.serverConfig,k.runMannually(),k.settings.enableUploadMask,k.settings.model,k.setFile,k.setCustomFile,k.runInpainting,k.showPrevMask,k.hidePrevMask,k.imageHeight,k.imageWidth,k.handleFileManagerMaskSelect]),{toast:S}=Id(),[E,_]=Nx(t),[b,C]=d.useState(!1),R=async(k,O)=>{try{if(k===Hk){const A=await Kj(k,O);x(A)}else{const A=await Hj(k,O);l(A)}}catch(A){S({variant:"destructive",description:A.message?A.message:A.toString()});return}};return v.jsxs("header",{className:"h-[60px] px-6 py-4 absolute top-[0] flex justify-between items-center w-full z-20 border-b backdrop-filter backdrop-blur-md bg-background/70",children:[v.jsxs("div",{className:"flex items-center gap-1",children:[r.enableFileManager?v.jsx(kY,{photoWidth:512,onPhotoClick:R}):v.jsx(v.Fragment,{}),v.jsxs("div",{className:xe(["flex items-center gap-1",e&&i?"visible":"hidden"]),children:[v.jsx(nT,{disabled:n,tooltip:"Upload custom mask",onFileUpload:async k=>{let O=null;try{O=await yF(k)}catch(A){S({variant:"destructive",description:A.message?A.message:A.toString()});return}if(O.naturalHeight!==g||O.naturalWidth!==y){S({variant:"destructive",description:`The size of the mask must same as image: ${y}x${g}`});return}u(k),o||f()},children:v.jsx(BT,{})}),t?v.jsxs(MW,{open:b,children:[v.jsx(OW,{className:"btn-primary side-panel-trigger",onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),style:{visibility:t?"visible":"hidden",outline:"none"},onClick:()=>{},children:v.jsx(Zn,{tooltip:"Run custom mask",children:v.jsx(hB,{})})}),v.jsx(LT,{children:_?v.jsx("img",{src:E.src,alt:"Custom mask"}):v.jsx(v.Fragment,{})})]}):v.jsx(v.Fragment,{})]})]}),s.need_prompt?v.jsx(oH,{}):v.jsx(v.Fragment,{}),v.jsxs("div",{className:"flex gap-1",children:[v.jsx(yW,{}),r.disableModelSwitch?v.jsx(v.Fragment,{}):v.jsx(JX,{})]})]})};var Yr=function(e,t){return Number(e.toFixed(t))},tZ=function(e,t){return typeof e=="number"?e:t},Ot=function(e,t,n){n&&typeof n=="function"&&n(e,t)},nZ=function(e){return-Math.cos(e*Math.PI)/2+.5},rZ=function(e){return e},oZ=function(e){return e*e},iZ=function(e){return e*(2-e)},sZ=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},aZ=function(e){return e*e*e},lZ=function(e){return--e*e*e+1},cZ=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},uZ=function(e){return e*e*e*e},dZ=function(e){return 1- --e*e*e*e},fZ=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},hZ=function(e){return e*e*e*e*e},pZ=function(e){return 1+--e*e*e*e*e},mZ=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},A3={easeOut:nZ,linear:rZ,easeInQuad:oZ,easeOutQuad:iZ,easeInOutQuad:sZ,easeInCubic:aZ,easeOutCubic:lZ,easeInOutCubic:cZ,easeInQuart:uZ,easeOutQuart:dZ,easeInOutQuart:fZ,easeInQuint:hZ,easeOutQuint:pZ,easeInOutQuint:mZ},M3=function(e){typeof e=="number"&&cancelAnimationFrame(e)},Vo=function(e){e.mounted&&(M3(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function O3(e,t,n,r){if(e.mounted){var o=new Date().getTime(),i=1;Vo(e),e.animation=function(){if(!e.mounted)return M3(e.animation);var s=new Date().getTime()-o,l=s/n,u=A3[t],f=u(l);s>=n?(r(i),e.animation=null):e.animation&&(r(f),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function gZ(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function Ws(e,t,n,r){var o=gZ(t);if(!(!e.mounted||!o)){var i=e.setTransformState,s=e.transformState,l=s.scale,u=s.positionX,f=s.positionY,m=t.scale-l,p=t.positionX-u,g=t.positionY-f;n===0?i(t.scale,t.positionX,t.positionY):O3(e,r,n,function(y){var x=l+m*y,S=u+p*y,E=f+g*y;i(x,S,E)})}}function vZ(e,t,n){var r=e.offsetWidth,o=e.offsetHeight,i=t.offsetWidth,s=t.offsetHeight,l=i*n,u=s*n,f=r-l,m=o-u;return{wrapperWidth:r,wrapperHeight:o,newContentWidth:l,newDiffWidth:f,newContentHeight:u,newDiffHeight:m}}var yZ=function(e,t,n,r,o,i,s){var l=e>t?n*(s?1:.5):0,u=r>o?i*(s?1:.5):0,f=e-t-l,m=l,p=r-o-u,g=u;return{minPositionX:f,maxPositionX:m,minPositionY:p,maxPositionY:g}},rb=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,o=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var i=vZ(n,r,t),s=i.wrapperWidth,l=i.wrapperHeight,u=i.newContentWidth,f=i.newDiffWidth,m=i.newContentHeight,p=i.newDiffHeight,g=yZ(s,u,f,l,m,p,!!o);return g},V1=function(e,t,n,r){return r?en?Yr(n,2):Yr(e,2):Yr(e,2)},wc=function(e,t){var n=rb(e,t);return e.bounds=n,n};function gg(e,t,n,r,o,i,s){var l=n.minPositionX,u=n.minPositionY,f=n.maxPositionX,m=n.maxPositionY,p=0,g=0;s&&(p=o,g=i);var y=V1(e,l-p,f+p,r),x=V1(t,u-g,m+g,r);return{x:y,y:x}}function vg(e,t,n,r,o,i){var s=e.transformState,l=s.scale,u=s.positionX,f=s.positionY,m=r-l;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:u,y:f};var p=u-t*m,g=f-n*m,y=gg(p,g,o,i,0,0,null);return y}function Gd(e,t,n,r,o){var i=o?r:0,s=t-i;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(t)&&e<=s?s:e}var j2=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,o=e.wrapperComponent,i=t.target,s=o==null?void 0:o.contains(i),l=r&&i&&s;if(!l)return!1;var u=yg(i,n);return!u},B2=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,o=r.panning.disabled,i=t&&n&&!o;return!!i},wZ=function(e,t){var n=e.transformState,r=n.positionX,o=n.positionY;e.isPanning=!0;var i=t.clientX,s=t.clientY;e.startCoords={x:i-r,y:s-o}},xZ=function(e,t){var n=t.touches,r=e.transformState,o=r.positionX,i=r.positionY;e.isPanning=!0;var s=n.length===1;if(s){var l=n[0].clientX,u=n[0].clientY;e.startCoords={x:l-o,y:u-i}}};function bZ(e){var t=e.transformState,n=t.positionX,r=t.positionY,o=t.scale,i=e.setup,s=i.disabled,l=i.limitToBounds,u=i.centerZoomedOut,f=e.wrapperComponent;if(!(s||!f||!e.bounds)){var m=e.bounds,p=m.maxPositionX,g=m.minPositionX,y=m.maxPositionY,x=m.minPositionY,S=n>p||ny||rp?f.offsetWidth:e.setup.minPositionX||0,b=r>y?f.offsetHeight:e.setup.minPositionY||0,C=vg(e,_,b,o,e.bounds,l||u),R=C.x,k=C.y;return{scale:o,positionX:S?R:n,positionY:E?k:r}}}function SZ(e,t,n,r,o){var i=e.setup.limitToBounds,s=e.wrapperComponent,l=e.bounds,u=e.transformState,f=u.scale,m=u.positionX,p=u.positionY;if(!(s===null||l===null||t===m&&n===p)){var g=gg(t,n,l,i,r,o,s),y=g.x,x=g.y;e.setTransformState(f,y,x)}}var _Z=function(e,t,n){var r=e.startCoords,o=e.transformState,i=e.setup.panning,s=i.lockAxisX,l=i.lockAxisY,u=o.positionX,f=o.positionY;if(!r)return{x:u,y:f};var m=t-r.x,p=n-r.y,g=s?u:m,y=l?f:p;return{x:g,y}},cm=function(e,t){var n=e.setup,r=e.transformState,o=r.scale,i=n.minScale,s=n.disablePadding;return t>0&&o>=i&&!s?t:0},EZ=function(e){var t=e.mounted,n=e.setup,r=n.disabled,o=n.velocityAnimation,i=e.transformState.scale,s=o.disabled,l=!s||i>1||!r||t;return!!l},CZ=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,o=e.setup,i=o.disabled,s=o.velocityAnimation,l=e.transformState.scale,u=s.disabled,f=!u||l>1||!i||t;return!(!f||!n||!r)};function $Z(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,o=n.animationTime,i=n.sensitivity;return r?o*t*i:o}function z2(e,t,n,r,o,i,s,l,u,f){if(o){if(t>s&&n>s){var m=s+(e-s)*f;return m>u?u:mi?i:m}}return r?t:V1(e,i,s,o)}function RZ(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function PZ(e,t){var n=EZ(e);if(n){var r=e.lastMousePosition,o=e.velocityTime,i=e.setup,s=e.wrapperComponent,l=i.velocityAnimation.equalToMove,u=Date.now();if(r&&o&&s){var f=RZ(s,l),m=t.x-r.x,p=t.y-r.y,g=m/f,y=p/f,x=u-o,S=m*m+p*p,E=Math.sqrt(S)/x;e.velocity={velocityX:g,velocityY:y,total:E}}e.lastMousePosition=t,e.velocityTime=u}}function TZ(e){var t=e.velocity,n=e.bounds,r=e.setup,o=e.wrapperComponent,i=CZ(e);if(!(!i||!t||!n||!o)){var s=t.velocityX,l=t.velocityY,u=t.total,f=n.maxPositionX,m=n.minPositionX,p=n.maxPositionY,g=n.minPositionY,y=r.limitToBounds,x=r.alignmentAnimation,S=r.zoomAnimation,E=r.panning,_=E.lockAxisY,b=E.lockAxisX,C=S.animationType,R=x.sizeX,k=x.sizeY,O=x.velocityAlignmentTime,A=O,I=$Z(e,u),z=Math.max(I,A),H=cm(e,R),ie=cm(e,k),K=H*o.offsetWidth/100,te=ie*o.offsetHeight/100,U=f+K,re=m-K,V=p+te,J=g-te,G=e.transformState,Z=new Date().getTime();O3(e,C,z,function(Q){var le=e.transformState,L=le.scale,ue=le.positionX,Ne=le.positionY,Ke=new Date().getTime()-Z,Me=Ke/A,me=A3[x.animationType],be=1-me(Math.min(1,Me)),Ee=1-Q,Oe=ue+s*Ee,Ie=Ne+l*Ee,ze=z2(Oe,G.positionX,ue,b,y,m,f,re,U,be),ht=z2(Ie,G.positionY,Ne,_,y,g,p,J,V,be);(ue!==Oe||Ne!==Ie)&&e.setTransformState(L,ze,ht)})}}function U2(e,t){var n=e.transformState.scale;Vo(e),wc(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?xZ(e,t):wZ(e,t)}function N3(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,o=n.alignmentAnimation,i=o.disabled,s=o.sizeX,l=o.sizeY,u=o.animationTime,f=o.animationType,m=i||t.1&&p;g?TZ(e):N3(e)}}function ob(e,t,n,r){var o=e.setup,i=o.minScale,s=o.maxScale,l=o.limitToBounds,u=Gd(Yr(t,2),i,s,0,!1),f=wc(e,u),m=vg(e,n,r,u,f,l),p=m.x,g=m.y;return{scale:u,positionX:p,positionY:g}}function D3(e,t,n){var r=e.transformState.scale,o=e.wrapperComponent,i=e.setup,s=i.minScale,l=i.limitToBounds,u=i.zoomAnimation,f=u.disabled,m=u.animationTime,p=u.animationType,g=f||r>=s;if((r>=1||l)&&N3(e),!(g||!o||!e.mounted)){var y=t||o.offsetWidth/2,x=n||o.offsetHeight/2,S=ob(e,s,y,x);S&&Ws(e,S,m,p)}}var ks=function(){return ks=Object.assign||function(t){for(var n,r=1,o=arguments.length;rs||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY):!1},GZ=function(e,t){var n=e.setup.pinch,r=n.disabled,o=n.excluded,i=e.isInitialized,s=t.target,l=i&&!r&&s;if(!l)return!1;var u=yg(s,o);return!u},YZ=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,o=n&&!t&&r;return!!o},XZ=function(e,t,n){var r=n.getBoundingClientRect(),o=e.touches,i=Yr(o[0].clientX-r.left,5),s=Yr(o[0].clientY-r.top,5),l=Yr(o[1].clientX-r.left,5),u=Yr(o[1].clientY-r.top,5);return{x:(i+l)/2/t,y:(s+u)/2/t}},U3=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},ZZ=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,o=e.setup,i=o.maxScale,s=o.minScale,l=o.zoomAnimation,u=o.disablePadding,f=l.size,m=l.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var p=t/r,g=p*n;return Gd(Yr(g,2),s,i,f,!m&&!u)},qZ=160,QZ=100,JZ=function(e,t){var n=e.props,r=n.onWheelStart,o=n.onZoomStart;e.wheelStopEventTimer||(Vo(e),Ot(Et(e),t,r),Ot(Et(e),t,o))},eq=function(e,t){var n=e.props,r=n.onWheel,o=n.onZoom,i=e.contentComponent,s=e.setup,l=e.transformState,u=l.scale,f=s.limitToBounds,m=s.centerZoomedOut,p=s.zoomAnimation,g=s.wheel,y=s.disablePadding,x=s.smooth,S=p.size,E=p.disabled,_=g.step,b=g.smoothStep;if(!i)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var C=WZ(t,null),R=x?b*Math.abs(t.deltaY):_,k=HZ(e,C,R,!t.ctrlKey);if(u!==k){var O=wc(e,k),A=z3(t,i,u),I=E||S===0||m||y,z=f&&I,H=vg(e,A.x,A.y,k,O,z),ie=H.x,K=H.y;e.previousWheelEvent=t,e.setTransformState(k,ie,K),Ot(Et(e),t,r),Ot(Et(e),t,o)}},tq=function(e,t){var n=e.props,r=n.onWheelStop,o=n.onZoomStop;H1(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(D3(e,t.x,t.y),e.wheelAnimationTimer=null)},QZ);var i=KZ(e,t);i&&(H1(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Ot(Et(e),t,r),Ot(Et(e),t,o))},qZ))},nq=function(e,t){var n=U3(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,Vo(e)},rq=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,o=e.transformState.scale,i=e.setup,s=i.limitToBounds,l=i.centerZoomedOut,u=i.zoomAnimation,f=u.disabled,m=u.size;if(!(r===null||!n)){var p=XZ(t,o,n);if(!(!Number.isFinite(p.x)||!Number.isFinite(p.y))){var g=U3(t),y=ZZ(e,g);if(y!==o){var x=wc(e,y),S=f||m===0||l,E=s&&S,_=vg(e,p.x,p.y,y,x,E),b=_.x,C=_.y;e.pinchMidpoint=p,e.lastDistance=g,e.setTransformState(y,b,C)}}}},oq=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,D3(e,t==null?void 0:t.x,t==null?void 0:t.y)},V3=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;H1(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Ot(Et(e),t,n)},r)},iq=function(e,t){var n=e.props,r=n.onZoomStart,o=n.onZoom,i=e.setup.doubleClick,s=i.animationTime,l=i.animationType;Ot(Et(e),t,r),j3(e,s,l,function(){return Ot(Et(e),t,o)}),V3(e,t)};function sq(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,o=e.transformState,i=e.contentComponent,s=o.scale,l=e.props,u=l.onZoomStart,f=l.onZoom,m=n.doubleClick,p=m.disabled,g=m.mode,y=m.step,x=m.animationTime,S=m.animationType;if(!p&&!r){if(g==="reset")return iq(e,t);if(!i)return console.error("No ContentComponent found");var E=g==="zoomOut"?-1:1,_=L3(e,E,y);if(s!==_){Ot(Et(e),t,u);var b=z3(t,i,s),C=ob(e,_,b.x,b.y);if(!C)return console.error("Error during zoom event. New transformation state was not calculated.");Ot(Et(e),t,f),Ws(e,C,x,S),V3(e,t)}}}var aq=function(e,t){var n=e.isInitialized,r=e.setup,o=e.wrapperComponent,i=r.doubleClick,s=i.disabled,l=i.excluded,u=t.target,f=o==null?void 0:o.contains(u),m=n&&u&&f&&!s;if(!m)return!1;var p=yg(u,l);return!p},lq=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){wc(n,n.transformState.scale),n.setup=H2(r)},this.initializeWindowEvents=function(){var r,o=H0(),i=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,s=i==null?void 0:i.defaultView;s==null||s.addEventListener("mousedown",n.onPanningStart,o),s==null||s.addEventListener("mousemove",n.onPanning,o),s==null||s.addEventListener("mouseup",n.onPanningStop,o),i==null||i.addEventListener("mouseleave",n.clearPanning,o),s==null||s.addEventListener("keyup",n.setKeyUnPressed,o),s==null||s.addEventListener("keydown",n.setKeyPressed,o)},this.cleanupWindowEvents=function(){var r,o,i=H0(),s=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,l=s==null?void 0:s.defaultView;l==null||l.removeEventListener("mousedown",n.onPanningStart,i),l==null||l.removeEventListener("mousemove",n.onPanning,i),l==null||l.removeEventListener("mouseup",n.onPanningStop,i),s==null||s.removeEventListener("mouseleave",n.clearPanning,i),l==null||l.removeEventListener("keyup",n.setKeyUnPressed,i),l==null||l.removeEventListener("keydown",n.setKeyPressed,i),document.removeEventListener("mouseleave",n.clearPanning,i),Vo(n),(o=n.observer)===null||o===void 0||o.disconnect()},this.handleInitializeWrapperEvents=function(r){var o=H0();r.addEventListener("wheel",n.onWheelZoom,o),r.addEventListener("dblclick",n.onDoubleClick,o),r.addEventListener("touchstart",n.onTouchPanningStart,o),r.addEventListener("touchmove",n.onTouchPanning,o),r.addEventListener("touchend",n.onTouchPanningStop,o)},this.handleInitialize=function(r){var o=n.setup.centerOnInit;n.applyTransformation(),n.onInitCallbacks.forEach(function(i){return i(Et(n))}),o&&(n.setCenter(),n.observer=new ResizeObserver(function(){var i;n.onInitCallbacks.forEach(function(s){return s(Et(n))}),n.setCenter(),(i=n.observer)===null||i===void 0||i.disconnect()}),n.observer.observe(r))},this.onWheelZoom=function(r){var o=n.setup.disabled;if(!o){var i=UZ(n,r);if(i){var s=n.isPressingKeys(n.setup.wheel.activationKeys);s&&(JZ(n,r),eq(n,r),tq(n,r))}}},this.onPanningStart=function(r){var o=n.setup.disabled,i=n.props.onPanningStart;if(!o){var s=j2(n,r);if(s){var l=n.isPressingKeys(n.setup.panning.activationKeys);l&&(r.button===0&&!n.setup.panning.allowLeftClickPan||r.button===1&&!n.setup.panning.allowMiddleClickPan||r.button===2&&!n.setup.panning.allowRightClickPan||(r.preventDefault(),r.stopPropagation(),Vo(n),U2(n,r),Ot(Et(n),r,i)))}}},this.onPanning=function(r){var o=n.setup.disabled,i=n.props.onPanning;if(!o){var s=B2(n);if(s){var l=n.isPressingKeys(n.setup.panning.activationKeys);l&&(r.preventDefault(),r.stopPropagation(),V2(n,r.clientX,r.clientY),Ot(Et(n),r,i))}}},this.onPanningStop=function(r){var o=n.props.onPanningStop;n.isPanning&&(kZ(n),Ot(Et(n),r,o))},this.onPinchStart=function(r){var o=n.setup.disabled,i=n.props,s=i.onPinchingStart,l=i.onZoomStart;if(!o){var u=GZ(n,r);u&&(nq(n,r),Vo(n),Ot(Et(n),r,s),Ot(Et(n),r,l))}},this.onPinch=function(r){var o=n.setup.disabled,i=n.props,s=i.onPinching,l=i.onZoom;if(!o){var u=YZ(n);u&&(r.preventDefault(),r.stopPropagation(),rq(n,r),Ot(Et(n),r,s),Ot(Et(n),r,l))}},this.onPinchStop=function(r){var o=n.props,i=o.onPinchingStop,s=o.onZoomStop;n.pinchStartScale&&(oq(n),Ot(Et(n),r,i),Ot(Et(n),r,s))},this.onTouchPanningStart=function(r){var o=n.setup.disabled,i=n.props.onPanningStart;if(!o){var s=j2(n,r);if(s){var l=n.lastTouch&&+new Date-n.lastTouch<200;if(l&&r.touches.length===1)n.onDoubleClick(r);else{n.lastTouch=+new Date,Vo(n);var u=r.touches,f=u.length===1,m=u.length===2;f&&(Vo(n),U2(n,r),Ot(Et(n),r,i)),m&&n.onPinchStart(r)}}}},this.onTouchPanning=function(r){var o=n.setup.disabled,i=n.props.onPanning;if(n.isPanning&&r.touches.length===1){if(o)return;var s=B2(n);if(!s)return;r.preventDefault(),r.stopPropagation();var l=r.touches[0];V2(n,l.clientX,l.clientY),Ot(Et(n),r,i)}else r.touches.length>1&&n.onPinch(r)},this.onTouchPanningStop=function(r){n.onPanningStop(r),n.onPinchStop(r)},this.onDoubleClick=function(r){var o=n.setup.disabled;if(!o){var i=aq(n,r);i&&sq(n,r)}},this.clearPanning=function(r){n.isPanning&&n.onPanningStop(r)},this.setKeyPressed=function(r){n.pressedKeys[r.key]=!0},this.setKeyUnPressed=function(r){n.pressedKeys[r.key]=!1},this.isPressingKeys=function(r){return r.length?!!r.find(function(o){return n.pressedKeys[o]}):!0},this.setTransformState=function(r,o,i){var s=n.props.onTransformed;if(!Number.isNaN(r)&&!Number.isNaN(o)&&!Number.isNaN(i)){r!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=r),n.transformState.positionX=o,n.transformState.positionY=i,n.applyTransformation();var l=Et(n);n.onChangeCallbacks.forEach(function(u){return u(l)}),Ot(l,{scale:r,positionX:o,positionY:i},s)}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var r=B3(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(r.scale,r.positionX,r.positionY)}},this.handleTransformStyles=function(r,o,i){return n.props.customTransform?n.props.customTransform(r,o,i):BZ(r,o,i)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,o=r.scale,i=r.positionX,s=r.positionY,l=n.handleTransformStyles(i,s,o);n.contentComponent.style.transform=l}},this.getContext=function(){return Et(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.onInit=function(r){return n.onInitCallbacks.has(r)||n.onInitCallbacks.add(r),function(){n.onInitCallbacks.delete(r)}},this.init=function(r,o){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=o,wc(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(o),n.initializeWindowEvents(),n.isInitialized=!0;var i=Et(n);Ot(i,void 0,n.props.onInit)},this.props=t,this.setup=H2(this.props),this.transformState=I3(this.props)}return e}(),ib=Be.createContext(null),cq=function(e,t){return typeof e=="function"?e(t):e},uq=Be.forwardRef(function(e,t){var n=d.useRef(new lq(e)).current,r=cq(e.children,W1(n));return d.useImperativeHandle(t,function(){return W1(n)},[n]),d.useEffect(function(){n.update(e)},[n,e]),Be.createElement(ib.Provider,{value:n},r)});Be.forwardRef(function(e,t){var n=d.useRef(null),r=d.useContext(ib);return d.useEffect(function(){return r.onChange(function(o){if(n.current){var i=0,s=0;n.current.style.transform=r.handleTransformStyles(i,s,1/o.instance.transformState.scale)}})},[r]),Be.createElement("div",ks({},e,{ref:zZ([n,t])}))});function dq(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var fq=`.transform-component-module_wrapper__SPB86 { position: relative; width: -moz-fit-content; width: fit-content; height: -moz-fit-content; height: fit-content; overflow: hidden; -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -khtml-user-select: none; /* Konqueror HTML */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ user-select: none; margin: 0; padding: 0; } .transform-component-module_content__FBWxo { display: flex; flex-wrap: wrap; width: -moz-fit-content; width: fit-content; height: -moz-fit-content; height: fit-content; margin: 0; padding: 0; transform-origin: 0% 0%; } .transform-component-module_content__FBWxo img { pointer-events: none; } `,K2={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};dq(fq);var hq=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,o=e.contentClass,i=o===void 0?"":o,s=e.wrapperStyle,l=e.contentStyle,u=e.wrapperProps,f=u===void 0?{}:u,m=e.contentProps,p=m===void 0?{}:m,g=d.useContext(ib),y=g.init,x=g.cleanupWindowEvents,S=d.useRef(null),E=d.useRef(null);return d.useEffect(function(){var _=S.current,b=E.current;return _!==null&&b!==null&&y&&(y==null||y(_,b)),function(){x==null||x()}},[]),Be.createElement("div",ks({},f,{ref:S,className:"react-transform-wrapper ".concat(K2.wrapper," ").concat(r),style:s}),Be.createElement("div",ks({},p,{ref:E,className:"react-transform-component ".concat(K2.content," ").concat(i),style:l}),t))};const W3=["PageUp","PageDown"],H3=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],K3={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Yd="Slider",[K1,pq,mq]=Wd(Yd),[G3,bte]=Tn(Yd,[mq]),[gq,wg]=G3(Yd),vq=d.forwardRef((e,t)=>{const{name:n,min:r=0,max:o=100,step:i=1,orientation:s="horizontal",disabled:l=!1,minStepsBetweenThumbs:u=0,defaultValue:f=[r],value:m,onValueChange:p=()=>{},onValueCommit:g=()=>{},inverted:y=!1,...x}=e,[S,E]=d.useState(null),_=Ve(t,U=>E(U)),b=d.useRef(new Set),C=d.useRef(0),R=s==="horizontal",k=S?!!S.closest("form"):!0,O=R?yq:wq,[A=[],I]=eo({prop:m,defaultProp:f,onChange:U=>{var re;(re=[...b.current][C.current])===null||re===void 0||re.focus(),p(U)}}),z=d.useRef(A);function H(U){const re=Pq(A,U);te(U,re)}function ie(U){te(U,C.current)}function K(){const U=z.current[C.current];A[C.current]!==U&&g(A)}function te(U,re,{commit:V}={commit:!1}){const J=Mq(i),G=Oq(Math.round((U-r)/i)*i+r,J),Z=fd(G,[r,o]);I((Q=[])=>{const le=$q(Q,Z,re);if(Aq(le,u*i)){C.current=le.indexOf(Z);const L=String(le)!==String(Q);return L&&V&&g(le),L?le:Q}else return Q})}return d.createElement(gq,{scope:e.__scopeSlider,disabled:l,min:r,max:o,valueIndexToChangeRef:C,thumbs:b.current,values:A,orientation:s},d.createElement(K1.Provider,{scope:e.__scopeSlider},d.createElement(K1.Slot,{scope:e.__scopeSlider},d.createElement(O,Y({"aria-disabled":l,"data-disabled":l?"":void 0},x,{ref:_,onPointerDown:fe(x.onPointerDown,()=>{l||(z.current=A)}),min:r,max:o,inverted:y,onSlideStart:l?void 0:H,onSlideMove:l?void 0:ie,onSlideEnd:l?void 0:K,onHomeKeyDown:()=>!l&&te(r,0,{commit:!0}),onEndKeyDown:()=>!l&&te(o,A.length-1,{commit:!0}),onStepKeyDown:({event:U,direction:re})=>{if(!l){const G=W3.includes(U.key)||U.shiftKey&&H3.includes(U.key)?10:1,Z=C.current,Q=A[Z],le=i*G*re;te(Q+le,Z,{commit:!0})}}})))),k&&A.map((U,re)=>d.createElement(Cq,{key:re,name:n?n+(A.length>1?"[]":""):void 0,value:U})))}),[Y3,X3]=G3(Yd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),yq=d.forwardRef((e,t)=>{const{min:n,max:r,dir:o,inverted:i,onSlideStart:s,onSlideMove:l,onSlideEnd:u,onStepKeyDown:f,...m}=e,[p,g]=d.useState(null),y=Ve(t,C=>g(C)),x=d.useRef(),S=Ac(o),E=S==="ltr",_=E&&!i||!E&&i;function b(C){const R=x.current||p.getBoundingClientRect(),k=[0,R.width],A=sb(k,_?[n,r]:[r,n]);return x.current=R,A(C-R.left)}return d.createElement(Y3,{scope:e.__scopeSlider,startEdge:_?"left":"right",endEdge:_?"right":"left",direction:_?1:-1,size:"width"},d.createElement(Z3,Y({dir:S,"data-orientation":"horizontal"},m,{ref:y,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const R=b(C.clientX);s==null||s(R)},onSlideMove:C=>{const R=b(C.clientX);l==null||l(R)},onSlideEnd:()=>{x.current=void 0,u==null||u()},onStepKeyDown:C=>{const k=K3[_?"from-left":"from-right"].includes(C.key);f==null||f({event:C,direction:k?-1:1})}})))}),wq=d.forwardRef((e,t)=>{const{min:n,max:r,inverted:o,onSlideStart:i,onSlideMove:s,onSlideEnd:l,onStepKeyDown:u,...f}=e,m=d.useRef(null),p=Ve(t,m),g=d.useRef(),y=!o;function x(S){const E=g.current||m.current.getBoundingClientRect(),_=[0,E.height],C=sb(_,y?[r,n]:[n,r]);return g.current=E,C(S-E.top)}return d.createElement(Y3,{scope:e.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1},d.createElement(Z3,Y({"data-orientation":"vertical"},f,{ref:p,style:{...f.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:S=>{const E=x(S.clientY);i==null||i(E)},onSlideMove:S=>{const E=x(S.clientY);s==null||s(E)},onSlideEnd:()=>{g.current=void 0,l==null||l()},onStepKeyDown:S=>{const _=K3[y?"from-bottom":"from-top"].includes(S.key);u==null||u({event:S,direction:_?-1:1})}})))}),Z3=d.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:s,onEndKeyDown:l,onStepKeyDown:u,...f}=e,m=wg(Yd,n);return d.createElement(Ae.span,Y({},f,{ref:t,onKeyDown:fe(e.onKeyDown,p=>{p.key==="Home"?(s(p),p.preventDefault()):p.key==="End"?(l(p),p.preventDefault()):W3.concat(H3).includes(p.key)&&(u(p),p.preventDefault())}),onPointerDown:fe(e.onPointerDown,p=>{const g=p.target;g.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(g)?g.focus():r(p)}),onPointerMove:fe(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&o(p)}),onPointerUp:fe(e.onPointerUp,p=>{const g=p.target;g.hasPointerCapture(p.pointerId)&&(g.releasePointerCapture(p.pointerId),i(p))})}))}),xq="SliderTrack",bq=d.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=wg(xq,n);return d.createElement(Ae.span,Y({"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation},r,{ref:t}))}),G2="SliderRange",Sq=d.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=wg(G2,n),i=X3(G2,n),s=d.useRef(null),l=Ve(t,s),u=o.values.length,f=o.values.map(g=>q3(g,o.min,o.max)),m=u>1?Math.min(...f):0,p=100-Math.max(...f);return d.createElement(Ae.span,Y({"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0},r,{ref:l,style:{...e.style,[i.startEdge]:m+"%",[i.endEdge]:p+"%"}}))}),Y2="SliderThumb",_q=d.forwardRef((e,t)=>{const n=pq(e.__scopeSlider),[r,o]=d.useState(null),i=Ve(t,l=>o(l)),s=d.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return d.createElement(Eq,Y({},e,{ref:i,index:s}))}),Eq=d.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,...o}=e,i=wg(Y2,n),s=X3(Y2,n),[l,u]=d.useState(null),f=Ve(t,E=>u(E)),m=Sx(l),p=i.values[r],g=p===void 0?0:q3(p,i.min,i.max),y=Rq(r,i.values.length),x=m==null?void 0:m[s.size],S=x?Tq(x,g,s.direction):0;return d.useEffect(()=>{if(l)return i.thumbs.add(l),()=>{i.thumbs.delete(l)}},[l,i.thumbs]),d.createElement("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${g}% + ${S}px)`}},d.createElement(K1.ItemSlot,{scope:e.__scopeSlider},d.createElement(Ae.span,Y({role:"slider","aria-label":e["aria-label"]||y,"aria-valuemin":i.min,"aria-valuenow":p,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0},o,{ref:f,style:p===void 0?{display:"none"}:e.style,onFocus:fe(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})}))))}),Cq=e=>{const{value:t,...n}=e,r=d.useRef(null),o=Kx(t);return d.useEffect(()=>{const i=r.current,s=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(s,"value").set;if(o!==t&&u){const f=new Event("input",{bubbles:!0});u.call(i,t),i.dispatchEvent(f)}},[o,t]),d.createElement("input",Y({style:{display:"none"}},n,{ref:r,defaultValue:t}))};function $q(e=[],t,n){const r=[...e];return r[n]=t,r.sort((o,i)=>o-i)}function q3(e,t,n){const i=100/(n-t)*(e-t);return fd(i,[0,100])}function Rq(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Pq(e,t){if(e.length===1)return 0;const n=e.map(o=>Math.abs(o-t)),r=Math.min(...n);return n.indexOf(r)}function Tq(e,t,n){const r=e/2,i=sb([0,50],[0,r]);return(r-i(t)*n)*n}function kq(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Aq(e,t){if(t>0){const n=kq(e);return Math.min(...n)>=t}return!0}function sb(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 Mq(e){return(String(e).split(".")[1]||"").length}function Oq(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}const Q3=vq,Nq=bq,Dq=Sq,Iq=_q,po=d.forwardRef(({className:e,...t},n)=>v.jsxs(Q3,{ref:n,className:xe("relative flex w-full touch-none select-none items-center",e),tabIndex:-1,...t,children:[v.jsx(Nq,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",children:v.jsx(Dq,{className:"absolute h-full bg-primary data-[disabled]:cursor-not-allowed "})}),v.jsx(Iq,{tabIndex:-1,className:"block h-4 w-4 rounded-full border border-primary/60 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring data-[disabled]:cursor-not-allowed"})]}));po.displayName=Q3.displayName;const dl={capture:!0,passive:!1},Lq=2,X2=(e,t,n,r,o,i)=>{if(e!==n&&t===r){if(e<0)return[0,r];if(e+t>i)return[i-r,r]}else{if(ti)return[e,i-e]}return[e,t]},Fq=e=>{const{minHeight:t,minWidth:n,maxHeight:r,maxWidth:o,scale:i,show:s}=e,[l,u,f,m,{x:p,y:g,width:y,height:x},S,E,_,b,C,R]=xt(Q=>[Q.imageWidth,Q.imageHeight,Q.isInpainting,Q.isSD(),Q.cropperState,Q.setCropperX,Q.setCropperY,Q.setCropperWidth,Q.setCropperHeight,Q.isCropperExtenderResizing,Q.setIsCropperExtenderResizing]),[k,O]=d.useState(!1);d.useEffect(()=>{S(Math.round((o-512)/2)),E(Math.round((r-512)/2))},[r,o,l,u]);const[A,I]=d.useState({initX:0,initY:0,initHeight:0,initWidth:0,startResizeX:0,startResizeY:0,ord:"top"}),z=()=>{},H=(Q,le)=>X2(Q,le,p,y,n,o),ie=(Q,le)=>X2(Q,le,g,x,t,r),K=Q=>{if(f)return;const le=Q.clientX,L=Q.clientY,ue=Math.round((L-A.startResizeY)/i),Ne=Math.round((le-A.startResizeX)/i),Ke=()=>{const Ee=A.initHeight-ue,Oe=A.initY+ue,[Ie,ze]=ie(Oe,Ee);b(ze),E(Ie)},Me=()=>{const Ee=A.initHeight+ue,[Oe,Ie]=ie(A.initY,Ee);b(Ie),E(Oe)},me=()=>{const Ee=A.initWidth-Ne,Oe=A.initX+Ne,[Ie,ze]=H(Oe,Ee);_(ze),S(Ie)},be=()=>{const Ee=A.initWidth+Ne,[Oe,Ie]=H(A.initX,Ee);_(Ie),S(Oe)};if(C)switch(A.ord){case"topleft":{Ke(),me();break}case"topright":{Ke(),be();break}case"bottomleft":{Me(),me();break}case"bottomright":{Me(),be();break}case"top":{Ke();break}case"right":{be();break}case"bottom":{Me();break}case"left":{me();break}}if(k){const Ee=A.initX+Ne,Oe=A.initY+ue,[Ie,ze]=H(Ee,A.initWidth),[ht,st]=ie(Oe,A.initHeight);_(ze),b(st),S(Ie),E(ht)}},te=()=>{C&&R(!1),k&&O(!1)};d.useEffect(()=>{if(C||k)return document.addEventListener("pointermove",K,dl),document.addEventListener("pointerup",te,dl),document.addEventListener("pointercancel",te,dl),()=>{document.removeEventListener("pointermove",K,dl),document.removeEventListener("pointerup",te,dl),document.removeEventListener("pointercancel",te,dl)}},[C,k,y,x,A]);const U=Q=>{const{ord:le}=Q.target.dataset;le&&(R(!0),I({initX:p,initY:g,initHeight:x,initWidth:y,startResizeX:Q.clientX,startResizeY:Q.clientY,ord:le}))},re=(Q,le,L)=>{const Ke="w-[12px] h-[12px] z-[4] absolute content-[''] block border-2 border-primary borde pointer-events-auto hover:bg-primary";let Me="0",me="0",be=L,Ee="-6px";return L===""&&(Ee="50%",le==="left"||le==="right"?(be="top",me="-50%"):(be="left",Me="-50%")),v.jsx("div",{className:xe(Ke,Q),style:{[le]:-6,[be]:Ee,transform:`translate(${Me}, ${me}) scale(${1/i})`},"data-ord":le+L,"aria-label":le+L,tabIndex:-1,role:"button"})},V=()=>v.jsxs("div",{onFocus:z,onPointerDown:U,className:"absolute top-0 h-full w-full",children:[v.jsx("div",{className:"absolute pointer-events-auto top-0 left-0 w-full cursor-ns-resize h-[12px] mt-[-6px]","data-ord":"top"}),v.jsx("div",{className:"absolute pointer-events-auto top-0 right-0 h-full cursor-ew-resize w-[12px] mr-[-6px]","data-ord":"right"}),v.jsx("div",{className:"absolute pointer-events-auto bottom-0 left-0 w-full cursor-ns-resize h-[12px] mb-[-6px]","data-ord":"bottom"}),v.jsx("div",{className:"absolute pointer-events-auto top-0 left-0 h-full cursor-ew-resize w-[12px] ml-[-6px]","data-ord":"left"}),re("cursor-nw-resize","top","left"),re("cursor-ne-resize","top","right"),re("cursor-sw-resize","bottom","left"),re("cursor-se-resize","bottom","right"),re("cursor-ns-resize","top",""),re("cursor-ns-resize","bottom",""),re("cursor-ew-resize","left",""),re("cursor-ew-resize","right","")]}),J=Q=>{O(!0),I({initX:p,initY:g,initHeight:x,initWidth:y,startResizeX:Q.clientX,startResizeY:Q.clientY,ord:""})},G=()=>v.jsxs("div",{className:ix("border absolute pointer-events-auto px-2 py-1 rounded-full hover:cursor-move bg-background","origin-top-left top-0 left-0"),style:{transform:`scale(${1/i*.8})`},onPointerDown:J,children:[y," x ",x]}),Z=()=>v.jsx("div",{className:"outline-dashed outline-primary",style:{height:x,width:y,outlineWidth:`${Lq/i*1.3}px`}});return s===!1||!m?null:v.jsx("div",{className:"absolute h-full w-full overflow-hidden pointer-events-none z-[2]",children:v.jsxs("div",{className:"relative pointer-events-none z-[2] [box-shadow:0_0_0_9999px_rgba(0,_0,_0,_0.5)]",style:{height:x,width:y,left:p,top:g},children:[Z(),G(),V()]})})},jq=()=>{const[e,t,n]=xt(r=>[r.interactiveSegState,r.resetInteractiveSegState,r.handleInteractiveSegAccept]);return e.isInteractiveSeg?v.jsxs("div",{className:"z-10 absolute top-[68px] rounded-xl border-solid border p-[8px] left-1/2 translate-x-[-50%] flex justify-center items-center gap-[8px] bg-background",children:[v.jsx(vn,{onClick:()=>{t()},size:"sm",variant:"secondary",children:"Cancel"}),v.jsx(vn,{size:"sm",onClick:()=>{n()},children:"Accept"})]}):null},Bq=e=>{const{x:t,y:n,positive:r}=e,o=r?"bg-[rgba(21,_215,_121,_0.936)] outline-[rgba(98,255,179,0.31)]":"bg-[rgba(237,_49,_55,_0.942)] outline-[rgba(255,89,95,0.31)]";return v.jsx("div",{className:`absolute h-[10px] w-[10px] rounded-[50%] ${o} outline-8 outline`,style:{left:t,top:n,transform:"translate(-50%, -50%)"}})},zq=()=>{const e=xt(t=>t.interactiveSegState.clicks);return v.jsx("div",{className:"absolute h-full w-full overflow-hidden pointer-events-none",children:e.map(t=>v.jsx(Bq,{x:t[0],y:t[1],positive:t[2]===1},t[3]))})},Uq=()=>v.jsx("div",{children:v.jsx(jq,{})}),fl={capture:!0,passive:!1},Vq=2,Z2=(e,t,n,r)=>t{const{minHeight:t,minWidth:n,scale:r,show:o}=e,[i,s,l,u,{x:f,y:m,width:p,height:g},y,x,S,E,_,b,C]=xt(J=>[J.isInpainting,J.imageHeight,J.imageWidth,J.isSD(),J.extenderState,J.setExtenderX,J.setExtenderY,J.setExtenderWidth,J.setExtenderHeight,J.settings.extenderDirection,J.isCropperExtenderResizing,J.setIsCropperExtenderResizing]),[R,k]=d.useState({initX:0,initY:0,initHeight:0,initWidth:0,startResizeX:0,startResizeY:0,ord:"top"}),O=()=>{},A=(J,G)=>Z2(J,G,f,n),I=(J,G)=>Z2(J,G,m,t),z=J=>{if(i)return;const G=J.clientX,Z=J.clientY,Q=Math.round((Z-R.startResizeY)/r),le=Math.round((G-R.startResizeX)/r),L=()=>{const Me=R.initHeight-Q,me=R.initY+Q;let be=me,Ee=Me;if(_===Ln.xy)be>0&&(be=0,Ee=R.initHeight-Math.abs(R.initY));else{const Oe=I(me,Me);be=Oe[0],Ee=Oe[1]}E(Ee),x(be)},ue=()=>{const Me=R.initHeight+Q;let[me,be]=I(R.initY,Me);_===Ln.xy&&be{const Me=R.initWidth-le,me=R.initX+le;let be=me,Ee=Me;if(_===Ln.xy)be>0&&(be=0,Ee=R.initWidth-Math.abs(R.initX));else{const Oe=A(me,Me);be=Oe[0],Ee=Oe[1]}S(Ee),y(be)},Ke=()=>{const Me=R.initWidth+le;let[me,be]=A(R.initX,Me);_===Ln.xy&&be{b&&C(!1)};d.useEffect(()=>{if(b)return document.addEventListener("pointermove",z,fl),document.addEventListener("pointerup",H,fl),document.addEventListener("pointercancel",H,fl),()=>{document.removeEventListener("pointermove",z,fl),document.removeEventListener("pointerup",H,fl),document.removeEventListener("pointercancel",H,fl)}},[b,p,g,R]);const ie=J=>{const{ord:G}=J.target.dataset;G&&(C(!0),k({initX:f,initY:m,initHeight:g,initWidth:p,startResizeX:J.clientX,startResizeY:J.clientY,ord:G}))},K=(J,G,Z)=>{const L="w-[12px] h-[12px] z-[4] absolute content-[''] block border-2 border-primary borde pointer-events-auto hover:bg-primary";let ue="0",Ne="0",Ke=Z,Me="-6px";return Z===""&&(Me="50%",G==="left"||G==="right"?(Ke="top",Ne="-50%"):(Ke="left",ue="-50%")),v.jsx("div",{className:xe(L,J),style:{[G]:-6,[Ke]:Me,transform:`translate(${ue}, ${Ne}) scale(${1/r})`},"data-ord":G+Z,"aria-label":G+Z,tabIndex:-1,role:"button"})},te=()=>v.jsxs("div",{onFocus:O,onPointerDown:ie,className:"absolute top-0 h-full w-full",children:[[Ln.y,Ln.xy].includes(_)?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"absolute pointer-events-auto top-0 left-0 w-full cursor-ns-resize h-[12px] mt-[-6px]","data-ord":"top"}),v.jsx("div",{className:"absolute pointer-events-auto bottom-0 left-0 w-full cursor-ns-resize h-[12px] mb-[-6px]","data-ord":"bottom"}),K("cursor-ns-resize","top",""),K("cursor-ns-resize","bottom","")]}):v.jsx(v.Fragment,{}),[Ln.x,Ln.xy].includes(_)?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"absolute pointer-events-auto top-0 right-0 h-full cursor-ew-resize w-[12px] mr-[-6px]","data-ord":"right"}),v.jsx("div",{className:"absolute pointer-events-auto top-0 left-0 h-full cursor-ew-resize w-[12px] ml-[-6px]","data-ord":"left"}),K("cursor-ew-resize","left",""),K("cursor-ew-resize","right","")]}):v.jsx(v.Fragment,{}),_===Ln.xy?v.jsxs(v.Fragment,{children:[K("cursor-nw-resize","top","left"),K("cursor-ne-resize","top","right"),K("cursor-sw-resize","bottom","left"),K("cursor-se-resize","bottom","right")]}):v.jsx(v.Fragment,{})]}),U=J=>{k({initX:f,initY:m,initHeight:g,initWidth:p,startResizeX:J.clientX,startResizeY:J.clientY,ord:""})},re=()=>v.jsxs("div",{className:ix("border absolute pointer-events-auto px-2 py-1 rounded-full bg-background","origin-top-left top-0 left-0"),style:{transform:`scale(${1/r*.8})`},onPointerDown:U,children:[p," x ",g]}),V=()=>v.jsx("div",{className:xe("outline-dashed outline-primary"),style:{height:g,width:p,outlineWidth:`${Vq/r*1.3}px`}});return o===!1||!u?null:v.jsx("div",{className:"absolute h-full w-full pointer-events-none z-[2]",children:v.jsxs("div",{className:"relative pointer-events-none z-[2] [box-shadow:0_0_0_9999px_rgba(0,_0,_0,_0.5)]",style:{height:g,width:p,left:f,top:m},children:[V(),re(),te()]})})},Hq=200,pu=300;function Kq(e){const{file:t}=e,{toast:n}=Id(),[r,o,i,s,l,u,f,m,p,g,y,x,S,E,_,b,C,R,k,O,A,I,z,H]=xt(W=>[W.disableShortCuts,W.windowSize,W.isInpainting,W.imageWidth,W.imageHeight,W.settings,W.serverConfig.enableAutoSaving,W.setImageSize,W.setBaseBrushSize,W.interactiveSegState,W.updateInteractiveSegState,W.handleCanvasMouseDown,W.handleCanvasMouseMove,W.undo,W.redo,W.undoDisabled(),W.redoDisabled(),W.getIsProcessing(),W.updateAppState,W.runMannually(),W.runInpainting,W.isCropperExtenderResizing,W.decreaseBaseBrushSize,W.increaseBaseBrushSize]),ie=xt(W=>W.editorState.baseBrushSize),K=xt(W=>W.getBrushSize()),te=xt(W=>W.editorState.renders),U=xt(W=>W.editorState.extraMasks),re=xt(W=>W.editorState.temporaryMasks),V=xt(W=>W.editorState.lineGroups),J=xt(W=>W.editorState.curLineGroup),[G,Z]=d.useState(!1),[Q,le]=Nx(t),[L,ue]=d.useState(),[Ne,Ke]=d.useState(),[{x:Me,y:me},be]=d.useState({x:-1,y:-1}),[Ee,Oe]=d.useState(!1),[Ie,ze]=d.useState(!1),[ht,st]=d.useState(!1),[Yt,rr]=d.useState(1),[Jt,Li]=d.useState(!1),[N,X]=d.useState(1),ee=o.width/2,Se=o.height/2,pe=d.useRef(null),[he,Te]=d.useState(!1),[ut,gt]=d.useState(!1),[An,Mn]=d.useState(0),[Fi,Ro]=d.useState(!1),Cr=d.useCallback(()=>J.length!==0,[J]);d.useEffect(()=>{if(!Ne||!le||s===0||l===0)return;const W=te.length===0?Q:te[te.length-1];Ne.canvas.width=s,Ne.canvas.height=l,Ne.clearRect(0,0,Ne.canvas.width,Ne.canvas.height),Ne.drawImage(W,0,0,s,l)},[te,Q,le,Ne,l,s]),d.useEffect(()=>{!L||!le||s===0||l===0||(L.canvas.width=s,L.canvas.height=l,L.clearRect(0,0,L.canvas.width,L.canvas.height),re.forEach(W=>{L.drawImage(W,0,0,s,l)}),U.forEach(W=>{L.drawImage(W,0,0,s,l)}),g.isInteractiveSeg&&g.tmpInteractiveSegMask&&L.drawImage(g.tmpInteractiveSegMask,0,0,s,l),eP(L,J))},[re,U,le,g,L,J,l,s]);const Ks=d.useCallback(async()=>{let W=t;if(te.length>0){const We=te[te.length-1];W=await Nu(We.currentSrc,t.name,t.type)}return W},[t,te]),ri=()=>te.length!==0,ji=d.useCallback(()=>{let W=512,We=512;return le?(te.length===0?(W=Q.naturalWidth,We=Q.naturalHeight):te.length!==0&&(W=te[te.length-1].width,We=te[te.length-1].height),[W,We]):[W,We]},[Q,le,te]);d.useEffect(()=>{var of;if(!le)return;const[W,We]=ji();(W!==s||We!==l)&&m(W,We);const dt=o.width/W,no=(o.height-Hq)/We;let an=1;(dt<1||no<1)&&(an=Math.min(dt,no)),X(an),rr(an),console.log(`[on file load] image size: ${W}x${We}, scale: ${an}, initialCentered: ${he}`),L!=null&&L.canvas&&(console.log("[on file load] set canvas size"),W!=L.canvas.width&&(L.canvas.width=W),We!=L.canvas.height&&(L.canvas.height=We)),he||((of=pe.current)==null||of.centerView(an,1),console.log("[on file load] centerView"),Te(!0))},[pe,l,s,Q,le,o,he,ji]),d.useEffect(()=>{var W;console.log("[useEffect] centerView"),(W=pe==null?void 0:pe.current)==null||W.centerView(N,1)},[l,s,pe,N]);const or=d.useCallback(()=>{if(!N||!o)return;const W=pe.current;if(!W)return;const We=(o.width-s*N)/2,dt=(o.height-l*N)/2;W.setTransform(We,dt,N,200,"easeOutQuad"),W.instance.transformState.scale&&(W.instance.transformState.scale=N),rr(N),Li(!1)},[pe,o,l,s,o.height,N]);d.useEffect(()=>(window.addEventListener("resize",()=>{or()}),()=>{window.removeEventListener("resize",()=>{or()})}),[o,or]),Yn("Escape",()=>{R||(ut?gt(!1):or())},[ut,i,or]);const $g=W=>{const We=W.nativeEvent;be({x:We.pageX,y:We.pageY})},qd=W=>{R||g.isInteractiveSeg||ht||ut&&J.length!==0&&S(v0(W))},Rg=async W=>{k({isPluginRunning:!0});const We=await Ks();try{const dt=await _P(!0,Oo.InteractiveSeg,We,void 0,W),{blob:no}=dt,an=new Image;an.onload=()=>{y({tmpInteractiveSegMask:an})},an.src=no}catch(dt){n({variant:"destructive",description:dt.message?dt.message:dt.toString()})}k({isPluginRunning:!1})},Qd=W=>{if(vC(W)){st(!1);return}!Cr()||g.isInteractiveSeg||ht||!Q.src||!(L!=null&&L.canvas)||i||ut&&(O?gt(!1):A())},Nc=W=>{if(g.isInteractiveSeg){const We=v0(W),dt=[...g.clicks];gC(W)?dt.push([We.x,We.y,0,dt.length]):dt.push([We.x,We.y,1,dt.length]),Rg(dt),y({clicks:dt})}},Jd=W=>{if(!(R||g.isInteractiveSeg||ht||!le||!(L!=null&&L.canvas))&&!gC(W)){if(vC(W)){st(!0);return}gt(!0),x(v0(W))}},ef=W=>{W.preventDefault(),E()};Yn("meta+z,ctrl+z",ef);const tf=W=>{W.preventDefault(),_()};Yn("shift+ctrl+z,shift+meta+z",tf),I0("Tab",W=>{W==null||W.preventDefault(),W==null||W.stopPropagation(),ri()&&Z(()=>(window.setTimeout(()=>{Mn(100)},10),!0))},W=>{W==null||W.preventDefault(),W==null||W.stopPropagation(),ri()&&(window.setTimeout(()=>{Mn(0)},10),window.setTimeout(()=>{Z(!1)},pu))});const nf=d.useCallback(async()=>{if(t===void 0)return;if(f&&te.length>0){try{await Yj(te[te.length-1],t.name,t.type),n({description:"Save image success"})}catch(dt){n({variant:"destructive",title:"Uh oh! Something went wrong.",description:dt.message?dt.message:dt.toString()})}return}const W=t.name.replace(/(\.[\w\d_-]+)$/i,"_cleanup$1"),We=te[te.length-1];if(_F(We.currentSrc,W),u.enableDownloadMask){let dt=t.name.replace(/(\.[\w\d_-]+)$/i,"_mask$1");dt=dt.replace(/\.[^/.]+$/,".jpg");const no=Gh(s,l,V),an=document.createElement("a");an.download=dt,an.href=no.toDataURL("image/jpeg"),an.click()}},[t,f,te,u,l,s,V]);Yn("meta+s,ctrl+s",nf);const Va=W=>{W!==Ee&&!ht&&!I&&Oe(W)},Pg=d.useCallback(()=>{if(R)return"default";if(ht)return"grab";if(Ee)return"none"},[Ee,ht,R]);Yn("[",()=>{z()},[z]),Yn("]",()=>{H()},[H]),Yn("shift+r",()=>{O&&Cr()&&A()},[O,A,Cr]),Yn("ctrl+c,meta+c",async()=>{await wF()&&te.length>0&&L!=null&&L.canvas&&(await SF(L==null?void 0:L.canvas),n({title:"Copy inpainting result to clipboard"}))},[te,L]),I0(" ",W=>{r||(W==null||W.preventDefault(),W==null||W.stopPropagation(),Oe(!1),st(!0))},W=>{r||(W==null||W.preventDefault(),W==null||W.stopPropagation(),Oe(!0),st(!1))}),I0("Alt",W=>{r||(W==null||W.preventDefault(),W==null||W.stopPropagation(),Ro(!0))},W=>{r||(W==null||W.preventDefault(),W==null||W.stopPropagation(),Ro(!1))});const Dc=()=>{var We,dt,no,an;let W=N;return((dt=(We=pe.current)==null?void 0:We.instance)==null?void 0:dt.transformState.scale)!==void 0&&(W=(an=(no=pe.current)==null?void 0:no.instance)==null?void 0:an.transformState.scale),W},rf=(W,We)=>{const dt=Dc();return{width:`${K*dt}px`,height:`${K*dt}px`,left:`${W}px`,top:`${We}px`,transform:"translate(-50%, -50%)"}},Wa=W=>v.jsx("div",{className:"absolute rounded-[50%] border-[1px] border-[solid] border-[#ffcc00] pointer-events-none bg-[#ffcc00bb]",style:W}),Tg=W=>{p(W),Ie||(ze(!0),window.setTimeout(()=>{ze(!1)},1e4))},Ic=()=>v.jsx("div",{className:"absolute h-[20px] w-[20px] pointer-events-none rounded-[50%] bg-[rgba(21,_215,_121,_0.936)] [box-shadow:0_0_0_0_rgba(21,_215,_121,_0.936)] animate-pulse",style:{left:`${Me}px`,top:`${me}px`,transform:"translate(-50%, -50%)"},children:v.jsx(dK,{})}),kg=()=>v.jsx(uq,{ref:W=>{W&&(pe.current=W)},panning:{disabled:!ht,velocityDisabled:!0},wheel:{step:.05,wheelDisabled:Fi},centerZoomedOut:!0,alignmentAnimation:{disabled:!0},centerOnInit:!0,limitToBounds:!1,doubleClick:{disabled:!0},initialScale:N,minScale:N*.3,onPanning:()=>{Jt||Li(!0)},onZoom:W=>{rr(W.state.scale)},children:v.jsxs(hq,{contentStyle:{visibility:he?"visible":"hidden"},children:[v.jsxs("div",{className:"grid [grid-template-areas:'editor-content'] gap-y-4",children:[v.jsx("canvas",{className:"[grid-area:editor-content]",style:{clipPath:`inset(0 ${An}% 0 0)`,transition:`clip-path ${pu}ms`},ref:W=>{if(W&&!Ne){const We=W.getContext("2d");We&&Ke(We)}}}),v.jsx("canvas",{className:xe("[grid-area:editor-content]",R?"pointer-events-none animate-pulse duration-600":""),style:{cursor:Pg(),clipPath:`inset(0 ${An}% 0 0)`,transition:`clip-path ${pu}ms`},onContextMenu:W=>{W.preventDefault()},onMouseOver:()=>{Va(!0),ze(!1)},onFocus:()=>Va(!0),onMouseLeave:()=>Va(!1),onMouseDown:Jd,onMouseUp:Nc,onMouseMove:qd,onTouchStart:Jd,onTouchEnd:Nc,onTouchMove:qd,ref:W=>{if(W&&!L){const We=W.getContext("2d");We&&ue(We)}}}),v.jsx("div",{className:"[grid-area:editor-content] pointer-events-none grid [grid-template-areas:'original-image-content']",style:{width:`${s}px`,height:`${l}px`},children:G&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"[grid-area:original-image-content] z-10 bg-primary h-full w-[6px] justify-self-end",style:{marginRight:`${An}%`,transition:`margin-right ${pu}ms`}}),v.jsx("img",{className:"[grid-area:original-image-content]",src:Q.src,alt:"original",style:{width:`${s}px`,height:`${l}px`}})]})})]}),v.jsx(Fq,{maxHeight:l,maxWidth:s,minHeight:Math.min(512,l),minWidth:Math.min(512,s),scale:Dc(),show:u.showCropper}),v.jsx(Wq,{minHeight:Math.min(512,l),minWidth:Math.min(512,s),scale:Dc(),show:u.showExtender}),g.isInteractiveSeg?v.jsx(zq,{}):v.jsx(v.Fragment,{})]})}),Ag=W=>{if(!Fi)return;const{deltaY:We}=W;We>0?H():We<0&&z()};return v.jsxs("div",{className:"flex w-screen h-screen justify-center items-center","aria-hidden":"true",onMouseMove:$g,onMouseUp:Qd,onWheel:Ag,children:[kg(),Ee&&!i&&!ht&&(g.isInteractiveSeg?Ic():Wa(rf(Me,me))),Ie&&Wa(rf(ee,Se)),v.jsxs("div",{className:"fixed flex bottom-5 border px-4 py-2 rounded-[3rem] gap-8 items-center justify-center backdrop-filter backdrop-blur-md bg-background/70",children:[v.jsx(po,{className:"w-48",defaultValue:[50],min:dF,max:QR,step:1,tabIndex:-1,value:[ie],onValueChange:W=>Tg(W[0]),onClick:()=>ze(!1)}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx(Zn,{tooltip:"Reset zoom & pan",disabled:Yt===N&&Jt===!1,onClick:or,children:v.jsx(fH,{})}),v.jsx(Zn,{tooltip:"Undo",onClick:ef,disabled:b,children:v.jsx(yH,{})}),v.jsx(Zn,{tooltip:"Redo",onClick:tf,disabled:C,children:v.jsx(gH,{})}),v.jsx(Zn,{tooltip:"Show original image",onPointerDown:W=>{W.preventDefault(),Z(()=>(window.setTimeout(()=>{Mn(100)},10),!0))},onPointerUp:()=>{window.setTimeout(()=>{Mn(0)},10),window.setTimeout(()=>{Z(!1)},pu)},disabled:te.length===0,children:v.jsx(hH,{})}),v.jsx(Zn,{tooltip:"Save Image",disabled:!te.length,onClick:nf,children:v.jsx(uH,{})}),u.enableManualInpainting&&u.model.model_type==="inpaint"?v.jsx(Zn,{tooltip:"Run Inpainting",disabled:R||!Cr()&&U.length===0,onClick:()=>{A()},children:v.jsx(dH,{})}):v.jsx(v.Fragment,{})]})]})]})}const Gq=()=>{const[e,t]=xt(n=>[n.imageWidth,n.imageHeight]);return!e||!t?null:v.jsxs("div",{className:"border rounded-lg px-2 py-[6px] z-10 bg-background",children:[e,"x",t]})},G1=["Enter"," "],Yq=["ArrowDown","PageUp","Home"],J3=["ArrowUp","PageDown","End"],Xq=[...Yq,...J3],Zq={ltr:[...G1,"ArrowRight"],rtl:[...G1,"ArrowLeft"]},qq={ltr:["ArrowLeft"],rtl:["ArrowRight"]},xg="Menu",[md,Qq,Jq]=Wd(xg),[Ua,eA]=Tn(xg,[Jq,zs,sg]),bg=zs(),tA=sg(),[nA,Hs]=Ua(xg),[eQ,Xd]=Ua(xg),tQ=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,l=bg(t),[u,f]=d.useState(null),m=d.useRef(!1),p=Lt(i),g=Ac(o);return d.useEffect(()=>{const y=()=>{m.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>m.current=!1;return document.addEventListener("keydown",y,{capture:!0}),()=>{document.removeEventListener("keydown",y,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),d.createElement(Fd,l,d.createElement(nA,{scope:t,open:n,onOpenChange:p,content:u,onContentChange:f},d.createElement(eQ,{scope:t,onClose:d.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:g,modal:s},r)))},rA=d.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=bg(n);return d.createElement(Gm,Y({},o,r,{ref:t}))}),oA="MenuPortal",[nQ,iA]=Ua(oA,{forceMount:void 0}),rQ=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=Hs(oA,t);return d.createElement(nQ,{scope:t,forceMount:n},d.createElement(xn,{present:n||i.open},d.createElement(jd,{asChild:!0,container:o},r)))},_o="MenuContent",[oQ,ab]=Ua(_o),iQ=d.forwardRef((e,t)=>{const n=iA(_o,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Hs(_o,e.__scopeMenu),s=Xd(_o,e.__scopeMenu);return d.createElement(md.Provider,{scope:e.__scopeMenu},d.createElement(xn,{present:r||i.open},d.createElement(md.Slot,{scope:e.__scopeMenu},s.modal?d.createElement(sQ,Y({},o,{ref:t})):d.createElement(aQ,Y({},o,{ref:t})))))}),sQ=d.forwardRef((e,t)=>{const n=Hs(_o,e.__scopeMenu),r=d.useRef(null),o=Ve(t,r);return d.useEffect(()=>{const i=r.current;if(i)return ng(i)},[]),d.createElement(lb,Y({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:fe(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),aQ=d.forwardRef((e,t)=>{const n=Hs(_o,e.__scopeMenu);return d.createElement(lb,Y({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),lb=d.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:g,onDismiss:y,disableOutsideScroll:x,...S}=e,E=Hs(_o,n),_=Xd(_o,n),b=bg(n),C=tA(n),R=Qq(n),[k,O]=d.useState(null),A=d.useRef(null),I=Ve(t,A,E.onContentChange),z=d.useRef(0),H=d.useRef(""),ie=d.useRef(0),K=d.useRef(null),te=d.useRef("right"),U=d.useRef(0),re=x?tg:d.Fragment,V=x?{as:Qo,allowPinchZoom:!0}:void 0,J=Z=>{var Q,le;const L=H.current+Z,ue=R().filter(Ee=>!Ee.disabled),Ne=document.activeElement,Ke=(Q=ue.find(Ee=>Ee.ref.current===Ne))===null||Q===void 0?void 0:Q.textValue,Me=ue.map(Ee=>Ee.textValue),me=EQ(Me,L,Ke),be=(le=ue.find(Ee=>Ee.textValue===me))===null||le===void 0?void 0:le.ref.current;(function Ee(Oe){H.current=Oe,window.clearTimeout(z.current),Oe!==""&&(z.current=window.setTimeout(()=>Ee(""),1e3))})(L),be&&setTimeout(()=>be.focus())};d.useEffect(()=>()=>window.clearTimeout(z.current),[]),Jm();const G=d.useCallback(Z=>{var Q,le;return te.current===((Q=K.current)===null||Q===void 0?void 0:Q.side)&&$Q(Z,(le=K.current)===null||le===void 0?void 0:le.area)},[]);return d.createElement(oQ,{scope:n,searchRef:H,onItemEnter:d.useCallback(Z=>{G(Z)&&Z.preventDefault()},[G]),onItemLeave:d.useCallback(Z=>{var Q;G(Z)||((Q=A.current)===null||Q===void 0||Q.focus(),O(null))},[G]),onTriggerLeave:d.useCallback(Z=>{G(Z)&&Z.preventDefault()},[G]),pointerGraceTimerRef:ie,onPointerGraceIntentChange:d.useCallback(Z=>{K.current=Z},[])},d.createElement(re,V,d.createElement(Qm,{asChild:!0,trapped:o,onMountAutoFocus:fe(i,Z=>{var Q;Z.preventDefault(),(Q=A.current)===null||Q===void 0||Q.focus()}),onUnmountAutoFocus:s},d.createElement($c,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:p,onInteractOutside:g,onDismiss:y},d.createElement(ok,Y({asChild:!0},C,{dir:_.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:O,onEntryFocus:fe(u,Z=>{_.isUsingKeyboardRef.current||Z.preventDefault()})}),d.createElement(Ym,Y({role:"menu","aria-orientation":"vertical","data-state":dA(E.open),"data-radix-menu-content":"",dir:_.dir},b,S,{ref:I,style:{outline:"none",...S.style},onKeyDown:fe(S.onKeyDown,Z=>{const le=Z.target.closest("[data-radix-menu-content]")===Z.currentTarget,L=Z.ctrlKey||Z.altKey||Z.metaKey,ue=Z.key.length===1;le&&(Z.key==="Tab"&&Z.preventDefault(),!L&&ue&&J(Z.key));const Ne=A.current;if(Z.target!==Ne||!Xq.includes(Z.key))return;Z.preventDefault();const Me=R().filter(me=>!me.disabled).map(me=>me.ref.current);J3.includes(Z.key)&&Me.reverse(),SQ(Me)}),onBlur:fe(e.onBlur,Z=>{Z.currentTarget.contains(Z.target)||(window.clearTimeout(z.current),H.current="")}),onPointerMove:fe(e.onPointerMove,gd(Z=>{const Q=Z.target,le=U.current!==Z.clientX;if(Z.currentTarget.contains(Q)&&le){const L=Z.clientX>U.current?"right":"left";te.current=L,U.current=Z.clientX}}))})))))))}),lQ=d.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.createElement(Ae.div,Y({},r,{ref:t}))}),Y1="MenuItem",q2="menu.itemSelect",cb=d.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=d.useRef(null),s=Xd(Y1,e.__scopeMenu),l=ab(Y1,e.__scopeMenu),u=Ve(t,i),f=d.useRef(!1),m=()=>{const p=i.current;if(!n&&p){const g=new CustomEvent(q2,{bubbles:!0,cancelable:!0});p.addEventListener(q2,y=>r==null?void 0:r(y),{once:!0}),mx(p,g),g.defaultPrevented?f.current=!1:s.onClose()}};return d.createElement(sA,Y({},o,{ref:u,disabled:n,onClick:fe(e.onClick,m),onPointerDown:p=>{var g;(g=e.onPointerDown)===null||g===void 0||g.call(e,p),f.current=!0},onPointerUp:fe(e.onPointerUp,p=>{var g;f.current||(g=p.currentTarget)===null||g===void 0||g.click()}),onKeyDown:fe(e.onKeyDown,p=>{const g=l.searchRef.current!=="";n||g&&p.key===" "||G1.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})}))}),sA=d.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=ab(Y1,n),l=tA(n),u=d.useRef(null),f=Ve(t,u),[m,p]=d.useState(!1),[g,y]=d.useState("");return d.useEffect(()=>{const x=u.current;if(x){var S;y(((S=x.textContent)!==null&&S!==void 0?S:"").trim())}},[i.children]),d.createElement(md.ItemSlot,{scope:n,disabled:r,textValue:o??g},d.createElement(ik,Y({asChild:!0},l,{focusable:!r}),d.createElement(Ae.div,Y({role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:f,onPointerMove:fe(e.onPointerMove,gd(x=>{r?s.onItemLeave(x):(s.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus())})),onPointerLeave:fe(e.onPointerLeave,gd(x=>s.onItemLeave(x))),onFocus:fe(e.onFocus,()=>p(!0)),onBlur:fe(e.onBlur,()=>p(!1))}))))}),cQ=d.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return d.createElement(lA,{scope:e.__scopeMenu,checked:n},d.createElement(cb,Y({role:"menuitemcheckbox","aria-checked":um(n)?"mixed":n},o,{ref:t,"data-state":ub(n),onSelect:fe(o.onSelect,()=>r==null?void 0:r(um(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),uQ="MenuRadioGroup",[Ste,dQ]=Ua(uQ,{value:void 0,onValueChange:()=>{}}),fQ="MenuRadioItem",hQ=d.forwardRef((e,t)=>{const{value:n,...r}=e,o=dQ(fQ,e.__scopeMenu),i=n===o.value;return d.createElement(lA,{scope:e.__scopeMenu,checked:i},d.createElement(cb,Y({role:"menuitemradio","aria-checked":i},r,{ref:t,"data-state":ub(i),onSelect:fe(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),aA="MenuItemIndicator",[lA,pQ]=Ua(aA,{checked:!1}),mQ=d.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=pQ(aA,n);return d.createElement(xn,{present:r||um(i.checked)||i.checked===!0},d.createElement(Ae.span,Y({},o,{ref:t,"data-state":ub(i.checked)})))}),gQ=d.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.createElement(Ae.div,Y({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),cA="MenuSub",[vQ,uA]=Ua(cA),yQ=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:o}=e,i=Hs(cA,t),s=bg(t),[l,u]=d.useState(null),[f,m]=d.useState(null),p=Lt(o);return d.useEffect(()=>(i.open===!1&&p(!1),()=>p(!1)),[i.open,p]),d.createElement(Fd,s,d.createElement(nA,{scope:t,open:r,onOpenChange:p,content:f,onContentChange:m},d.createElement(vQ,{scope:t,contentId:tr(),triggerId:tr(),trigger:l,onTriggerChange:u},n)))},$h="MenuSubTrigger",wQ=d.forwardRef((e,t)=>{const n=Hs($h,e.__scopeMenu),r=Xd($h,e.__scopeMenu),o=uA($h,e.__scopeMenu),i=ab($h,e.__scopeMenu),s=d.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:u}=i,f={__scopeMenu:e.__scopeMenu},m=d.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return d.useEffect(()=>m,[m]),d.useEffect(()=>{const p=l.current;return()=>{window.clearTimeout(p),u(null)}},[l,u]),d.createElement(rA,Y({asChild:!0},f),d.createElement(sA,Y({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":dA(n.open)},e,{ref:Lm(t,o.onTriggerChange),onClick:p=>{var g;(g=e.onClick)===null||g===void 0||g.call(e,p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:fe(e.onPointerMove,gd(p=>{i.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:fe(e.onPointerLeave,gd(p=>{var g;m();const y=(g=n.content)===null||g===void 0?void 0:g.getBoundingClientRect();if(y){var x;const S=(x=n.content)===null||x===void 0?void 0:x.dataset.side,E=S==="right",_=E?-5:5,b=y[E?"left":"right"],C=y[E?"right":"left"];i.onPointerGraceIntentChange({area:[{x:p.clientX+_,y:p.clientY},{x:b,y:y.top},{x:C,y:y.top},{x:C,y:y.bottom},{x:b,y:y.bottom}],side:S}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(p),p.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:fe(e.onKeyDown,p=>{const g=i.searchRef.current!=="";if(!(e.disabled||g&&p.key===" ")&&Zq[r.dir].includes(p.key)){var y;n.onOpenChange(!0),(y=n.content)===null||y===void 0||y.focus(),p.preventDefault()}})})))}),xQ="MenuSubContent",bQ=d.forwardRef((e,t)=>{const n=iA(_o,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Hs(_o,e.__scopeMenu),s=Xd(_o,e.__scopeMenu),l=uA(xQ,e.__scopeMenu),u=d.useRef(null),f=Ve(t,u);return d.createElement(md.Provider,{scope:e.__scopeMenu},d.createElement(xn,{present:r||i.open},d.createElement(md.Slot,{scope:e.__scopeMenu},d.createElement(lb,Y({id:l.contentId,"aria-labelledby":l.triggerId},o,{ref:f,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{var p;s.isUsingKeyboardRef.current&&((p=u.current)===null||p===void 0||p.focus()),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:fe(e.onFocusOutside,m=>{m.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:fe(e.onEscapeKeyDown,m=>{s.onClose(),m.preventDefault()}),onKeyDown:fe(e.onKeyDown,m=>{const p=m.currentTarget.contains(m.target),g=qq[s.dir].includes(m.key);if(p&&g){var y;i.onOpenChange(!1),(y=l.trigger)===null||y===void 0||y.focus(),m.preventDefault()}})})))))});function dA(e){return e?"open":"closed"}function um(e){return e==="indeterminate"}function ub(e){return um(e)?"indeterminate":e?"checked":"unchecked"}function SQ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function _Q(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function EQ(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=_Q(e,Math.max(i,0));o.length===1&&(s=s.filter(f=>f!==n));const u=s.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function CQ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=m>r&&n<(f-l)*(r-u)/(m-u)+l&&(o=!o)}return o}function $Q(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return CQ(n,t)}function gd(e){return t=>t.pointerType==="mouse"?e(t):void 0}const RQ=tQ,PQ=rA,TQ=rQ,kQ=iQ,AQ=lQ,MQ=cb,OQ=cQ,NQ=hQ,DQ=mQ,IQ=gQ,LQ=yQ,FQ=wQ,jQ=bQ,fA="DropdownMenu",[BQ,_te]=Tn(fA,[eA]),Er=eA(),[zQ,hA]=BQ(fA),UQ=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=e,u=Er(t),f=d.useRef(null),[m=!1,p]=eo({prop:o,defaultProp:i,onChange:s});return d.createElement(zQ,{scope:t,triggerId:tr(),triggerRef:f,contentId:tr(),open:m,onOpenChange:p,onOpenToggle:d.useCallback(()=>p(g=>!g),[p]),modal:l},d.createElement(RQ,Y({},u,{open:m,onOpenChange:p,dir:r,modal:l}),n))},VQ="DropdownMenuTrigger",WQ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=hA(VQ,n),s=Er(n);return d.createElement(PQ,Y({asChild:!0},s),d.createElement(Ae.button,Y({type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},o,{ref:Lm(t,i.triggerRef),onPointerDown:fe(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:fe(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})))}),HQ=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Er(t);return d.createElement(TQ,Y({},r,n))},KQ="DropdownMenuContent",GQ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=hA(KQ,n),i=Er(n),s=d.useRef(!1);return d.createElement(kQ,Y({id:o.contentId,"aria-labelledby":o.triggerId},i,r,{ref:t,onCloseAutoFocus:fe(e.onCloseAutoFocus,l=>{var u;s.current||(u=o.triggerRef.current)===null||u===void 0||u.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:fe(e.onInteractOutside,l=>{const u=l.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,m=u.button===2||f;(!o.modal||m)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),YQ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Er(n);return d.createElement(AQ,Y({},o,r,{ref:t}))}),XQ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Er(n);return d.createElement(MQ,Y({},o,r,{ref:t}))}),ZQ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Er(n);return d.createElement(OQ,Y({},o,r,{ref:t}))}),qQ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Er(n);return d.createElement(NQ,Y({},o,r,{ref:t}))}),QQ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Er(n);return d.createElement(DQ,Y({},o,r,{ref:t}))}),JQ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Er(n);return d.createElement(IQ,Y({},o,r,{ref:t}))}),eJ=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:o,defaultOpen:i}=e,s=Er(t),[l=!1,u]=eo({prop:r,defaultProp:i,onChange:o});return d.createElement(LQ,Y({},s,{open:l,onOpenChange:u}),n)},tJ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Er(n);return d.createElement(FQ,Y({},o,r,{ref:t}))}),nJ=d.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Er(n);return d.createElement(jQ,Y({},o,r,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),rJ=UQ,oJ=WQ,iJ=HQ,pA=GQ,mA=YQ,gA=XQ,vA=ZQ,yA=qQ,wA=QQ,xA=JQ,sJ=eJ,bA=tJ,SA=nJ,aJ=rJ,lJ=oJ,Q2=sJ,X1=d.forwardRef(({className:e,inset:t,children:n,...r},o)=>v.jsxs(bA,{ref:o,className:xe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r,children:[n,v.jsx(oB,{className:"ml-auto h-4 w-4"})]}));X1.displayName=bA.displayName;const Z1=d.forwardRef(({className:e,...t},n)=>v.jsx(SA,{ref:n,className:xe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Z1.displayName=SA.displayName;const _A=d.forwardRef(({className:e,sideOffset:t=4,...n},r)=>v.jsx(iJ,{children:v.jsx(pA,{ref:r,sideOffset:t,className:xe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),onCloseAutoFocus:o=>o.preventDefault(),...n})}));_A.displayName=pA.displayName;const ml=d.forwardRef(({className:e,inset:t,...n},r)=>v.jsx(gA,{ref:r,className:xe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));ml.displayName=gA.displayName;const cJ=d.forwardRef(({className:e,children:t,checked:n,...r},o)=>v.jsxs(vA,{ref:o,className:xe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[v.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(wA,{children:v.jsx(EP,{className:"h-4 w-4"})})}),t]}));cJ.displayName=vA.displayName;const uJ=d.forwardRef(({className:e,children:t,...n},r)=>v.jsxs(yA,{ref:r,className:xe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[v.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(wA,{children:v.jsx(cB,{className:"h-4 w-4 fill-current"})})}),t]}));uJ.displayName=yA.displayName;const dJ=d.forwardRef(({className:e,inset:t,...n},r)=>v.jsx(mA,{ref:r,className:xe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));dJ.displayName=mA.displayName;const fJ=d.forwardRef(({className:e,...t},n)=>v.jsx(xA,{ref:n,className:xe("-mx-1 my-1 h-px bg-muted",e),...t}));fJ.displayName=xA.displayName;const J2={RemoveBG:{IconClass:u2,showName:"RemoveBG"},AnimeSeg:{IconClass:u2,showName:"Anime Segmentation"},RealESRGAN:{IconClass:jT,showName:"RealESRGAN"},GFPGAN:{IconClass:d2,showName:"GFPGAN"},RestoreFormer:{IconClass:d2,showName:"RestoreFormer"},InteractiveSeg:{IconClass:mH,showName:"Interactive Segmentation"}},hJ=()=>{const[e,t,n,r,o]=xt(m=>[m.file,m.serverConfig.plugins,m.isPluginRunning,m.updateInteractiveSegState,m.runRenderablePlugin]),i=!e;if(t.length===0)return null;const s=(m,p)=>{p==="InteractiveSeg"?r({isInteractiveSeg:!0}):o(m,p)},l=()=>v.jsxs(Q2,{children:[v.jsx(X1,{disabled:i,children:v.jsxs("div",{className:"flex gap-2 items-center",children:[v.jsx(jT,{}),"RealESRGAN"]})}),v.jsxs(Z1,{children:[v.jsx(ml,{onClick:()=>o(!1,"RealESRGAN",{upscale:2}),children:"upscale 2x"}),v.jsx(ml,{onClick:()=>o(!1,"RealESRGAN",{upscale:4}),children:"upscale 4x"})]})]},"RealESRGAN"),u=m=>{const{IconClass:p,showName:g}=J2[m.name];return v.jsxs(Q2,{children:[v.jsx(X1,{disabled:i,children:v.jsxs("div",{className:"flex gap-2 items-center",children:[v.jsx(p,{className:"p-1"}),g]})}),v.jsxs(Z1,{children:[v.jsx(ml,{onClick:()=>s(!1,m.name),children:"Remove Background"}),v.jsx(ml,{onClick:()=>s(!0,m.name),children:"Generate Mask"})]})]},m.name)},f=()=>t.map(m=>{const{IconClass:p,showName:g}=J2[m.name];return m.name==="RealESRGAN"?l():m.name==="RemoveBG"||m.name==="AnimeSeg"?u(m):v.jsx(ml,{onClick:()=>s(!1,m.name),disabled:i,children:v.jsxs("div",{className:"flex gap-2 items-center",children:[v.jsx(p,{className:"p-1"}),g]})},m.name)});return v.jsxs(aJ,{modal:!1,children:[v.jsx(lJ,{className:"border rounded-lg z-10 bg-background outline-none",tabIndex:-1,children:v.jsx(vn,{variant:"ghost",size:"icon",asChild:!0,className:"p-1.5",children:n?v.jsx("div",{role:"status",children:v.jsxs("svg",{"aria-hidden":"true",className:"w-5 h-5 animate-spin fill-primary",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[v.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),v.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]})}):v.jsx(aH,{strokeWidth:1})})}),v.jsx(_A,{side:"bottom",align:"start",children:f()})]})},pJ=Tx,mJ=ST,gJ=kx,EA=d.forwardRef(({className:e,...t},n)=>v.jsx(Bd,{className:xe("fixed inset-0 bg-background/80 backdrop-blur-sm data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));EA.displayName=Bd.displayName;const vJ=Fm("fixed gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-200 data-[state=open]:duration-300",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),CA=d.forwardRef(({side:e="right",className:t,children:n,...r},o)=>v.jsxs(gJ,{children:[v.jsx(EA,{}),v.jsx(zd,{ref:o,className:xe(vJ({side:e}),t),...r,children:n})]}));CA.displayName=zd.displayName;const $A=({className:e,...t})=>v.jsx("div",{className:xe("flex flex-col space-y-2 text-center sm:text-left",e),...t});$A.displayName="SheetHeader";const yJ=d.forwardRef(({className:e,...t},n)=>v.jsx(Ud,{ref:n,className:xe("text-lg font-semibold text-foreground",e),...t}));yJ.displayName=Ud.displayName;const wJ=d.forwardRef(({className:e,...t},n)=>v.jsx(Vd,{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));wJ.displayName=Vd.displayName;const _t=({children:e})=>v.jsx("div",{className:"flex justify-between items-center pr-4",children:e}),zt=({text:e,toolTip:t="",url:n,htmlFor:r,disabled:o=!1,className:i=""})=>v.jsxs(eT,{children:[v.jsx(tT,{asChild:!0,children:v.jsx(nb,{htmlFor:r||e.toLowerCase().replace(" ","-"),className:xe("font-medium min-w-[65px]",i),disabled:o,children:e})}),t||n?v.jsxs($x,{className:"flex flex-col max-w-xs text-sm",side:"left",children:[v.jsx("p",{children:t}),n?v.jsx(vn,{variant:"link",className:"justify-end",children:v.jsx("a",{href:n,target:"_blank",children:"More info"})}):v.jsx(v.Fragment,{})]}):v.jsx(v.Fragment,{})]}),xJ=()=>{const[e,t]=xt(n=>[n.settings,n.updateSettings]);return v.jsxs("div",{className:"flex flex-col gap-4 mt-4",children:[v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(zt,{htmlFor:"steps",text:"Steps",toolTip:"The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference."}),v.jsxs(_t,{children:[v.jsx(po,{className:"w-[180px]",defaultValue:[30],min:1,max:100,step:1,value:[Math.floor(e.ldmSteps)],onValueChange:n=>t({ldmSteps:n[0]})}),v.jsx(No,{id:"steps",className:"w-[50px] rounded-full",numberValue:e.ldmSteps,allowFloat:!1,onNumberValueChange:n=>{t({ldmSteps:n})}})]})]}),v.jsxs(_t,{children:[v.jsx(zt,{text:"Sampler"}),v.jsxs(yo,{value:e.ldmSampler,onValueChange:n=>{t({ldmSampler:n})},children:[v.jsx(Vr,{className:"w-[100px]",children:v.jsx(wo,{placeholder:"Select sampler"})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:Object.values(nx).map(n=>v.jsx(Hr,{value:n,children:n},n))})})]})]})]})},Rh=({text:e,onClick:t})=>{const[n]=xt(r=>[r.settings.showExtender]);return v.jsx(vn,{variant:"outline",className:"p-1 h-8",disabled:!n,onClick:t,children:v.jsx("div",{className:"flex items-center gap-1",children:e})})},bJ=()=>{const[e,t,n,r,o,i,s,l,u,f,m,p,g,y,x]=xt(L=>[L.serverConfig.samplers,L.settings,L.paintByExampleFile,L.getIsProcessing(),L.updateSettings,L.runInpainting,L.updateAppState,L.updateExtenderByBuiltIn,L.updateExtenderDirection,L.adjustMask,L.clearMask,L.updateEnablePowerPaintV2,L.updateEnableBrushNet,L.updateEnableControlnet,L.updateLCMLora]),[S,E]=Nx(n),_=d.useRef(null);FT(_,()=>{_!=null&&_.current&&_.current.blur()});const b=L=>{L.key==="Enter"&&L.ctrlKey&&t.prompt.length!==0&&i()},C=()=>v.jsxs(_t,{children:[v.jsx(zt,{text:"Cropper",toolTip:"Inpainting on part of image, improve inference speed and reduce memory usage."}),v.jsx(jr,{id:"cropper",checked:t.showCropper,onCheckedChange:L=>{o({showCropper:L}),L&&o({showExtender:!1})}})]}),R=()=>{if(!t.model.support_brushnet)return null;let L="BrushNet is a plug-and-play image inpainting model works on any SD1.5 base models.";return v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"BrushNet",url:"https://github.com/TencentARC/BrushNet",toolTip:L}),v.jsx(jr,{id:"brushnet",checked:t.enableBrushNet,onCheckedChange:ue=>{g(ue)}})]}),v.jsx(_t,{children:v.jsxs(yo,{defaultValue:t.brushnetMethod,value:t.brushnetMethod,onValueChange:ue=>{o({brushnetMethod:ue})},disabled:!t.enableBrushNet,children:[v.jsx(Vr,{children:v.jsx(wo,{placeholder:"Select brushnet model"})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:Object.values(t.model.brushnets).map(ue=>v.jsx(Hr,{value:ue,children:ue.split("/")[1]},ue))})})]})})]}),v.jsx(Xt,{})]})},k=()=>{if(!t.model.support_controlnet)return null;let L="Using an additional conditioning image to control how an image is generated";return v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"ControlNet",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inpaint#controlnet",toolTip:L}),v.jsx(jr,{id:"controlnet",checked:t.enableControlnet,onCheckedChange:ue=>{y(ue)}})]}),v.jsx("div",{className:"flex flex-col gap-1",children:v.jsxs(_t,{children:[v.jsx(po,{className:"w-[180px]",defaultValue:[100],min:1,max:100,step:1,disabled:!t.enableControlnet,value:[Math.floor(t.controlnetConditioningScale*100)],onValueChange:ue=>o({controlnetConditioningScale:ue[0]/100})}),v.jsx(No,{id:"controlnet-weight",className:"w-[50px] rounded-full",disabled:!t.enableControlnet,numberValue:t.controlnetConditioningScale,allowFloat:!1,onNumberValueChange:ue=>{o({controlnetConditioningScale:ue})}})]})}),v.jsx(_t,{children:v.jsxs(yo,{defaultValue:t.controlnetMethod,value:t.controlnetMethod,onValueChange:ue=>{o({controlnetMethod:ue})},disabled:!t.enableControlnet,children:[v.jsx(Vr,{children:v.jsx(wo,{placeholder:"Select control method"})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:Object.values(t.model.controlnets).map(ue=>v.jsx(Hr,{value:ue,children:ue.split("/")[1]},ue))})})]})})]}),v.jsx(Xt,{})]})},O=()=>{if(!t.model.support_lcm_lora)return null;let L="Enable quality image generation in typically 2-8 steps. Suggest disabling guidance_scale by setting it to 0. You can also try values between 1.0 and 2.0. When LCM Lora is enabled, LCMSampler will be used automatically.";return v.jsxs(v.Fragment,{children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"LCM LoRA",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inference_with_lcm_lora",toolTip:L}),v.jsx(jr,{id:"lcm-lora",checked:t.enableLCMLora,onCheckedChange:ue=>{x(ue)}})]}),v.jsx(Xt,{})]})},A=()=>t.model.need_prompt?v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx(zt,{text:"Negative prompt",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inpaint#negative-prompt",toolTip:"Negative prompt guides the model away from generating certain things in an image"}),v.jsx("div",{className:"pl-2 pr-4",children:v.jsx(jx,{ref:_,rows:4,onKeyUp:b,className:"max-h-[8rem] overflow-y-auto mb-2",placeholder:"",id:"negative-prompt",value:t.negativePrompt,onInput:L=>{L.preventDefault(),L.stopPropagation();const ue=L.target;o({negativePrompt:ue.value})}})})]}):null,I=()=>t.model.name!==JR?null:v.jsxs("div",{children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"Example Image",toolTip:"An example image to guide image generation."}),v.jsx(nT,{tooltip:"Upload example image",onFileUpload:L=>{s({paintByExampleFile:L})},children:v.jsx(BT,{})})]}),E?v.jsx("div",{className:"flex justify-center items-center",children:v.jsx("img",{src:S.src,alt:"example",className:"max-w-[200px] max-h-[200px] m-3"})}):v.jsx(v.Fragment,{}),v.jsx(vn,{variant:"default",className:"w-full",disabled:r||!E,onClick:()=>{i()},children:"Paint"})]}),z=()=>t.model.name!==fF?null:v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx(zt,{text:"Image guidance scale",toolTip:"Push the generated image towards the inital image. Higher image guidance scale encourages generated images that are closely linked to the source image, usually at the expense of lower image quality.",url:"https://huggingface.co/docs/diffusers/main/en/api/pipelines/pix2pix"}),v.jsxs(_t,{children:[v.jsx(po,{className:"w-[180px]",defaultValue:[150],min:100,max:1e3,step:1,value:[Math.floor(t.p2pImageGuidanceScale*100)],onValueChange:L=>o({p2pImageGuidanceScale:L[0]/100})}),v.jsx(No,{id:"image-guidance-scale",className:"w-[50px] rounded-full",numberValue:t.p2pImageGuidanceScale,allowFloat:!0,onNumberValueChange:L=>{o({p2pImageGuidanceScale:L})}})]})]}),H=()=>{if(!t.model.support_strength)return null;let L="Strength is a measure of how much noise is added to the base image, which influences how similar the output is to the base image. Higher value means more noise and more different from the base image";return v.jsxs(_t,{children:[v.jsx(zt,{text:"Strength",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inpaint#strength",toolTip:L}),v.jsx(po,{className:"w-[110px]",defaultValue:[100],min:10,max:100,step:1,value:[Math.floor(t.sdStrength*100)],onValueChange:ue=>o({sdStrength:ue[0]/100})}),v.jsx(No,{id:"strength",className:"w-[50px] rounded-full",numberValue:t.sdStrength,allowFloat:!0,onNumberValueChange:ue=>{o({sdStrength:ue})}})]})},ie=()=>t.model.support_outpainting?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"Extender",toolTip:"Perform outpainting on images to expand it's content."}),v.jsx(jr,{id:"extender",checked:t.showExtender,onCheckedChange:L=>{o({showExtender:L}),L&&o({showCropper:!1})}})]}),v.jsxs(_t,{children:[v.jsxs(yo,{defaultValue:t.extenderDirection,value:t.extenderDirection,onValueChange:L=>{u(L)},children:[v.jsx(Vr,{className:"w-[65px] h-7",disabled:!t.showExtender,children:v.jsx(wo,{placeholder:"Select axis"})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:Object.values(Ln).map(L=>v.jsx(Hr,{value:L,children:L},L))})})]}),v.jsxs("div",{className:"flex gap-1 justify-center mt-0",children:[v.jsx(Rh,{text:"1.25x",onClick:()=>l(t.extenderDirection,1.25)}),v.jsx(Rh,{text:"1.5x",onClick:()=>l(t.extenderDirection,1.5)}),v.jsx(Rh,{text:"1.75x",onClick:()=>l(t.extenderDirection,1.75)}),v.jsx(Rh,{text:"2.0x",onClick:()=>l(t.extenderDirection,2)})]})]})]}),v.jsx(Xt,{})]}):null,K=()=>v.jsxs(_t,{children:[v.jsx(zt,{text:"Task",toolTip:"PowerPaint task. When using extender, image-outpainting task will be auto used. For object-removal and image-outpainting, it is recommended to set the guidance_scale at 10 or above."}),v.jsxs(yo,{defaultValue:t.powerpaintTask,value:t.powerpaintTask,onValueChange:L=>{o({powerpaintTask:L})},disabled:t.showExtender,children:[v.jsx(Vr,{className:"w-[130px]",children:v.jsx(wo,{placeholder:"Select task"})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:[ma.text_guided,ma.object_remove,ma.context_aware,ma.shape_guided].map(L=>v.jsx(Hr,{value:L,children:L},L))})})]})]}),te=()=>t.model.name!==hF?null:v.jsxs(v.Fragment,{children:[K(),v.jsx(Xt,{})]}),U=()=>t.model.support_powerpaint_v2===!1?null:v.jsxs(v.Fragment,{children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"PowerPaint V2",toolTip:"PowerPaint is a plug-and-play image inpainting model works on any SD1.5 base models."}),v.jsx(jr,{id:"powerpaint-v2",checked:t.enablePowerPaintV2,onCheckedChange:L=>{p(L)}})]}),K(),v.jsx(Xt,{})]}),re=()=>v.jsxs(_t,{children:[v.jsx(zt,{htmlFor:"steps",text:"Steps",toolTip:"The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference."}),v.jsx(po,{className:"w-[110px]",defaultValue:[30],min:1,max:100,step:1,value:[Math.floor(t.sdSteps)],onValueChange:L=>o({sdSteps:L[0]})}),v.jsx(No,{id:"steps",className:"w-[50px] rounded-full",numberValue:t.sdSteps,allowFloat:!1,onNumberValueChange:L=>{o({sdSteps:L})}})]}),V=()=>v.jsxs(_t,{children:[v.jsx(zt,{text:"Guidance",url:"https://huggingface.co/docs/diffusers/main/en/using-diffusers/inpaint#guidance-scale",toolTip:"Guidance scale affects how aligned the text prompt and generated image are. Higher value means the prompt and generated image are closely aligned, so the output is a stricter interpretation of the prompt"}),v.jsx(po,{className:"w-[110px]",defaultValue:[750],min:0,max:1500,step:1,value:[Math.floor(t.sdGuidanceScale*100)],onValueChange:L=>o({sdGuidanceScale:L[0]/100})}),v.jsx(No,{id:"guid",className:"w-[50px] rounded-full",numberValue:t.sdGuidanceScale,allowFloat:!0,onNumberValueChange:L=>{o({sdGuidanceScale:L})}})]}),J=()=>t.model.name===pF?null:v.jsxs(_t,{children:[v.jsx(zt,{text:"Sampler"}),v.jsxs(yo,{defaultValue:t.sdSampler,value:t.sdSampler,onValueChange:L=>{o({sdSampler:L})},children:[v.jsx(Vr,{className:"w-[175px] text-xs",children:v.jsx(wo,{placeholder:"Select sampler"})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:e.map(L=>v.jsx(Hr,{value:L,className:"text-xs",children:L},L))})})]})]}),G=()=>v.jsxs(_t,{children:[v.jsx(zt,{text:"Seed",toolTip:"Using same parameters and a fixed seed can generate same result image."}),v.jsxs("div",{className:"flex gap-2 justify-center items-center",children:[v.jsx(jr,{id:"seed",checked:t.seedFixed,onCheckedChange:L=>{o({seedFixed:L})}}),v.jsx(No,{id:"seed",className:"w-[110px]",disabled:!t.seedFixed,numberValue:t.seed,allowFloat:!1,onNumberValueChange:L=>{o({seed:L})}})]})]}),Z=()=>v.jsxs(v.Fragment,{children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"Mask blur",toolTip:"How much to blur the mask before processing, in pixels. Make the generated inpainting boundaries appear more natural."}),v.jsx(po,{className:"w-[110px]",defaultValue:[t.sdMaskBlur],min:0,max:96,step:1,value:[Math.floor(t.sdMaskBlur)],onValueChange:L=>o({sdMaskBlur:L[0]})}),v.jsx(No,{id:"mask-blur",className:"w-[50px] rounded-full",numberValue:t.sdMaskBlur,allowFloat:!1,onNumberValueChange:L=>{o({sdMaskBlur:L})}})]}),v.jsx(Xt,{})]}),Q=()=>v.jsxs(v.Fragment,{children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"Match histograms",toolTip:"Match the inpainting result histogram to the source image histogram",url:"https://github.com/Sanster/lama-cleaner/pull/143#issuecomment-1325859307"}),v.jsx(jr,{id:"match-histograms",checked:t.sdMatchHistograms,onCheckedChange:L=>{o({sdMatchHistograms:L})}})]}),v.jsx(Xt,{})]}),le=()=>v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs(_t,{children:[v.jsx(zt,{htmlFor:"adjustMaskKernelSize",text:"Mask OP",toolTip:"Expand or shrink mask. Using the slider to adjust the kernel size for dilation or erosion."}),v.jsx(po,{className:"w-[110px]",defaultValue:[12],min:1,max:100,step:1,value:[Math.floor(t.adjustMaskKernelSize)],onValueChange:L=>o({adjustMaskKernelSize:L[0]})}),v.jsx(No,{id:"adjustMaskKernelSize",className:"w-[50px] rounded-full",numberValue:t.adjustMaskKernelSize,allowFloat:!1,onNumberValueChange:L=>{o({adjustMaskKernelSize:L})}})]}),v.jsxs(_t,{children:[v.jsx(vn,{variant:"outline",className:"p-1 h-8",onClick:()=>f("expand"),disabled:r,children:v.jsx("div",{className:"flex items-center gap-1 select-none",children:"Expand"})}),v.jsx(vn,{variant:"outline",className:"p-1 h-8",onClick:()=>f("shrink"),disabled:r,children:v.jsx("div",{className:"flex items-center gap-1 select-none",children:"Shrink"})}),v.jsx(vn,{variant:"outline",className:"p-1 h-8",onClick:()=>f("reverse"),disabled:r,children:v.jsx("div",{className:"flex items-center gap-1 select-none",children:"Reverse"})}),v.jsx(vn,{variant:"outline",className:"p-1 h-8 justify-self-end",onClick:m,disabled:r,children:v.jsx("div",{className:"flex items-center gap-1 select-none",children:"Clear"})})]})]}),v.jsx(Xt,{})]});return v.jsxs("div",{className:"flex flex-col gap-[14px] mt-4",children:[C(),ie(),Z(),le(),Q(),te(),re(),V(),z(),H(),J(),G(),A(),v.jsx(Xt,{}),R(),U(),k(),O(),I()]})},SJ=()=>{const[e,t]=xt(n=>[n.settings,n.updateSettings]);return v.jsxs("div",{className:"flex flex-col gap-4 mt-4",children:[v.jsxs(_t,{children:[v.jsx(zt,{text:"CV2 Flag",url:"https://docs.opencv.org/4.8.0/d7/d8b/group__photo__inpaint.html#gga8002a65f5a3328fbf15df81b842d3c3ca892824c38e258feb5e72f308a358d52e"}),v.jsxs(yo,{value:e.cv2Flag,onValueChange:n=>{t({cv2Flag:n})},children:[v.jsx(Vr,{className:"w-[160px]",children:v.jsx(wo,{placeholder:"Select flag"})}),v.jsx(Wr,{align:"end",children:v.jsx(zo,{children:Object.values(rx).map(n=>v.jsx(Hr,{value:n,children:n},n))})})]})]}),v.jsx(zt,{text:"CV2 Radius",url:"https://docs.opencv.org/4.8.0/d7/d8b/group__photo__inpaint.html#gga8002a65f5a3328fbf15df81b842d3c3ca892824c38e258feb5e72f308a358d52e"}),v.jsxs(_t,{children:[v.jsx(po,{className:"w-[180px]",defaultValue:[5],min:1,max:100,step:1,value:[Math.floor(e.cv2Radius)],onValueChange:n=>t({cv2Radius:n[0]})}),v.jsx(No,{id:"cv2-radius",className:"w-[50px] rounded-full",numberValue:e.cv2Radius,allowFloat:!1,onNumberValueChange:n=>{t({cv2Radius:n})}})]})]})},_J=()=>{const[e,t]=xt(i=>[i.settings,i.windowSize]),[n,r]=Fx(!0);if(Yn("c",()=>{r()}),e.model.name!==fC&&e.model.name!==hC&&e.model.model_type===ms)return null;const o=()=>e.model.name===fC?v.jsx(xJ,{}):e.model.name===hC?v.jsx(SJ,{}):v.jsx(bJ,{});return v.jsxs(pJ,{open:n,modal:!1,children:[v.jsx(mJ,{tabIndex:-1,className:"z-10 outline-none absolute top-[68px] right-6 rounded-lg border bg-background",hidden:n,children:v.jsx(vn,{variant:"ghost",size:"icon",asChild:!0,className:"p-1.5",onClick:r,children:v.jsx(lH,{strokeWidth:1})})}),v.jsxs(CA,{side:"right",className:"w-[286px] mt-[60px] outline-none pl-3 pr-1",onOpenAutoFocus:i=>i.preventDefault(),onPointerDownOutside:i=>i.preventDefault(),children:[v.jsxs($A,{children:[v.jsxs(_t,{children:[v.jsx("div",{className:"overflow-hidden mr-8",children:e.model.name.split("/")[e.model.name.split("/").length-1]}),v.jsx(vn,{variant:"ghost",size:"icon",className:"border h-6 w-6",onClick:r,children:v.jsx(cH,{strokeWidth:1})})]}),v.jsx(Xt,{})]}),v.jsx(fg,{style:{height:t.height-160},children:o()})]})]})},ti=Object.create(null);ti.open="0";ti.close="1";ti.ping="2";ti.pong="3";ti.message="4";ti.upgrade="5";ti.noop="6";const ap=Object.create(null);Object.keys(ti).forEach(e=>{ap[ti[e]]=e});const q1={type:"error",data:"parser error"},RA=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",PA=typeof ArrayBuffer=="function",TA=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,db=({type:e,data:t},n,r)=>RA&&t instanceof Blob?n?r(t):e$(t,r):PA&&(t instanceof ArrayBuffer||TA(t))?n?r(t):e$(new Blob([t]),r):r(ti[e]+(t||"")),e$=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function t$(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let K0;function EJ(e,t){if(RA&&e.data instanceof Blob)return e.data.arrayBuffer().then(t$).then(t);if(PA&&(e.data instanceof ArrayBuffer||TA(e.data)))return t(t$(e.data));db(e,!1,n=>{K0||(K0=new TextEncoder),t(K0.encode(n))})}const n$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_u=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,o=0,i,s,l,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const f=new ArrayBuffer(t),m=new Uint8Array(f);for(r=0;r>4,m[o++]=(s&15)<<4|l>>2,m[o++]=(l&3)<<6|u&63;return f},$J=typeof ArrayBuffer=="function",fb=(e,t)=>{if(typeof e!="string")return{type:"message",data:kA(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:RJ(e.substring(1),t)}:ap[n]?e.length>1?{type:ap[n],data:e.substring(1)}:{type:ap[n]}:q1},RJ=(e,t)=>{if($J){const n=CJ(e);return kA(n,t)}else return{base64:!0,data:e}},kA=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},AA="",PJ=(e,t)=>{const n=e.length,r=new Array(n);let o=0;e.forEach((i,s)=>{db(i,!1,l=>{r[s]=l,++o===n&&t(r.join(AA))})})},TJ=(e,t)=>{const n=e.split(AA),r=[];for(let o=0;o{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const i=new DataView(o.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{o=new Uint8Array(9);const i=new DataView(o.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}let G0;function Ph(e){return e.reduce((t,n)=>t+n.length,0)}function Th(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;oMath.pow(2,21)-1){l.enqueue(q1);break}o=m*Math.pow(2,32)+f.getUint32(4),r=3}else{if(Ph(n)e){l.enqueue(q1);break}}}})}const MA=4;function qt(e){if(e)return MJ(e)}function MJ(e){for(var t in qt.prototype)e[t]=qt.prototype[t];return e}qt.prototype.on=qt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};qt.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};qt.prototype.off=qt.prototype.removeListener=qt.prototype.removeAllListeners=qt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,o=0;o(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const OJ=Ur.setTimeout,NJ=Ur.clearTimeout;function Sg(e,t){t.useNativeTimers?(e.setTimeoutFn=OJ.bind(Ur),e.clearTimeoutFn=NJ.bind(Ur)):(e.setTimeoutFn=Ur.setTimeout.bind(Ur),e.clearTimeoutFn=Ur.clearTimeout.bind(Ur))}const DJ=1.33;function IJ(e){return typeof e=="string"?LJ(e):Math.ceil((e.byteLength||e.size)*DJ)}function LJ(e){let t=0,n=0;for(let r=0,o=e.length;r=57344?n+=3:(r++,n+=4);return n}function FJ(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function jJ(e){let t={},n=e.split("&");for(let r=0,o=n.length;r0);return t}function DA(){const e=i$(+new Date);return e!==o$?(r$=0,o$=e):e+"."+i$(r$++)}for(;kh{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};TJ(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,PJ(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=DA()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new qo(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(o,i)=>{this.onError("xhr post error",o,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class qo extends qt{constructor(t,n){super(),Sg(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=OA(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new LA(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.opts.extraHeaders[o])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this.opts.cookieJar)===null||o===void 0||o.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(o){this.setTimeoutFn(()=>{this.onError(o)},0);return}typeof document<"u"&&(this.index=qo.requestsCount++,qo.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=VJ,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete qo.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}qo.requestsCount=0;qo.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",s$);else if(typeof addEventListener=="function"){const e="onpagehide"in Ur?"pagehide":"unload";addEventListener(e,s$,!1)}}function s$(){for(let e in qo.requests)qo.requests.hasOwnProperty(e)&&qo.requests[e].abort()}const pb=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ah=Ur.WebSocket||Ur.MozWebSocket,a$=!0,KJ="arraybuffer",l$=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class GJ extends hb{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=l$?{}:OA(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=a$&&!l$?n?new Ah(t,n):new Ah(t):new Ah(t,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const s={};try{a$&&this.ws.send(i)}catch{}o&&pb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=DA()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!Ah}}class YJ extends hb{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=AJ(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),o=kJ();o.readable.pipeTo(t.writable),this.writer=o.writable.getWriter();const i=()=>{r.read().then(({done:l,value:u})=>{l||(this.onPacket(u),i())}).catch(l=>{})};i();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this.writer.write(s).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{o&&pb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const XJ={websocket:GJ,webtransport:YJ,polling:HJ},ZJ=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,qJ=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function J1(e){if(e.length>2e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=ZJ.exec(e||""),i={},s=14;for(;s--;)i[qJ[s]]=o[s]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=QJ(i,i.path),i.queryKey=JJ(i,i.query),i}function QJ(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function JJ(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,i){o&&(n[o]=i)}),n}let FA=class gl extends qt{constructor(t,n={}){super(),this.binaryType=KJ,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=J1(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=J1(n.host).host),Sg(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=jJ(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=MA,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new XJ[t](r)}open(){let t;if(this.opts.rememberUpgrade&&gl.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;gl.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;gl.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(m(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function i(){r||(r=!0,m(),n.close(),n=null)}const s=p=>{const g=new Error("probe error: "+p);g.transport=n.name,i(),this.emitReserved("upgradeError",g)};function l(){s("transport closed")}function u(){s("socket closed")}function f(p){n&&p.name!==n.name&&i()}const m=()=>{n.removeListener("open",o),n.removeListener("error",s),n.removeListener("close",l),this.off("close",u),this.off("upgrading",f)};n.once("open",o),n.once("error",s),n.once("close",l),this.once("close",u),this.once("upgrading",f),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",gl.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),o&&this.once("flush",o),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){gl.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const o=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,jA=Object.prototype.toString,ree=typeof Blob=="function"||typeof Blob<"u"&&jA.call(Blob)==="[object BlobConstructor]",oee=typeof File=="function"||typeof File<"u"&&jA.call(File)==="[object FileConstructor]";function mb(e){return tee&&(e instanceof ArrayBuffer||nee(e))||ree&&e instanceof Blob||oee&&e instanceof File}function lp(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let s=0;s{this.io.clearTimeoutFn(i),n.apply(this,[null,...s])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((o,i)=>{n.push((s,l)=>r?s?i(s):o(l):o(s)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...i)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:lt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case lt.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case lt.EVENT:case lt.BINARY_EVENT:this.onevent(t);break;case lt.ACK:case lt.BINARY_ACK:this.onack(t);break;case lt.DISCONNECT:this.ondisconnect();break;case lt.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:lt.ACK,id:t,data:o}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:lt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Oc.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Oc.prototype.reset=function(){this.attempts=0};Oc.prototype.setMin=function(e){this.ms=e};Oc.prototype.setMax=function(e){this.max=e};Oc.prototype.setJitter=function(e){this.jitter=e};class nw extends qt{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Sg(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Oc({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const o=n.parser||dee;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new FA(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=mo(n,"open",function(){r.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},s=mo(n,"error",i);if(this._timeout!==!1){const l=this._timeout,u=this.setTimeoutFn(()=>{o(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(o),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(mo(t,"ping",this.onping.bind(this)),mo(t,"data",this.ondata.bind(this)),mo(t,"error",this.onerror.bind(this)),mo(t,"close",this.onclose.bind(this)),mo(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){pb(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new BA(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const mu={};function cp(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=eee(e,t.path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=mu[o]&&i in mu[o].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let u;return l?u=new nw(r,t):(mu[o]||(mu[o]=new nw(r,t)),u=mu[o]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(cp,{Manager:nw,Socket:BA,io:cp,connect:cp});const zA="Progress",_g=100,[hee,Ete]=Tn(zA),[pee,mee]=hee(zA),UA=d.forwardRef((e,t)=>{const{__scopeProgress:n,value:r,max:o,getValueLabel:i=yee,...s}=e,l=rw(o)?o:_g,u=WA(r,l)?r:null,f=dm(u)?i(u,l):void 0;return d.createElement(pee,{scope:n,value:u,max:l},d.createElement(Ae.div,Y({"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":dm(u)?u:void 0,"aria-valuetext":f,role:"progressbar","data-state":VA(u,l),"data-value":u??void 0,"data-max":l},s,{ref:t})))});UA.propTypes={max(e,t,n){const r=e[t],o=String(r);return r&&!rw(r)?new Error(wee(o,n)):null},value(e,t,n){const r=e[t],o=String(r),i=rw(e.max)?e.max:_g;return r!=null&&!WA(r,i)?new Error(xee(o,n)):null}};const gee="ProgressIndicator",vee=d.forwardRef((e,t)=>{var n;const{__scopeProgress:r,...o}=e,i=mee(gee,r);return d.createElement(Ae.div,Y({"data-state":VA(i.value,i.max),"data-value":(n=i.value)!==null&&n!==void 0?n:void 0,"data-max":i.max},o,{ref:t}))});function yee(e,t){return`${Math.round(e/t*100)}%`}function VA(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function dm(e){return typeof e=="number"}function rw(e){return dm(e)&&!isNaN(e)&&e>0}function WA(e,t){return dm(e)&&!isNaN(e)&&e<=t&&e>=0}function wee(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${_g}\`.`}function xee(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${_g} if no \`max\` prop is set) - \`null\` if the progress is indeterminate. Defaulting to \`null\`.`}const HA=UA,bee=vee,KA=d.forwardRef(({className:e,value:t,...n},r)=>v.jsx(HA,{ref:r,className:xe("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:v.jsx(bee,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));KA.displayName=HA.displayName;const See="",Ji=cp(See),_ee=()=>{const[e,t,n]=xt(u=>[u.settings,u.isInpainting,u.isSD()]),[r,o]=d.useState(!1),[i,s]=d.useState(0),l=Math.min(Math.round(i/e.sdSteps*100),100);return d.useEffect(()=>(Ji.on("connect",()=>{o(!0)}),Ji.on("disconnect",()=>{o(!1)}),Ji.on("diffusion_progress",u=>{u&&s(u.step+1)}),Ji.on("diffusion_finish",()=>{s(0)}),()=>{Ji.off("connect"),Ji.off("disconnect"),Ji.off("diffusion_progress"),Ji.off("diffusion_finish")}),[]),v.jsxs("div",{className:"z-10 fixed bg-background w-[220px] left-1/2 -translate-x-1/2 top-[68px] h-[32px] flex justify-center items-center gap-[18px] border-[1px] border-[solid] rounded-[14px] pl-[8px] pr-[8px]",style:{visibility:r&&t&&n?"visible":"hidden"},children:[v.jsx(KA,{value:l}),v.jsxs("div",{className:"w-[45px] flex justify-center font-nums",children:[l,"%"]})]})},Eee=()=>{const[e,t]=xt(n=>[n.file,n.updateSettings]);return d.useEffect(()=>{(async()=>{const r=await Wj();t({model:r})})()},[]),v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex gap-3 absolute top-[68px] left-[24px] items-center",children:[v.jsx(hJ,{}),v.jsx(Gq,{})]}),v.jsx(Uq,{}),v.jsx(_ee,{}),v.jsx(_J,{}),e?v.jsx(Kq,{file:e}):v.jsx(v.Fragment,{})]})},Cee=()=>{const[e,t]=d.useState(window.innerWidth),n=d.useCallback(()=>{t(window.innerWidth)},[]);if(d.useEffect(()=>(window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)})),e<768)return"mobile";if(e>=768&&e<1224)return"tablet";if(e>=1224)return"desktop"};function $ee(e){const[t]=d.useState(`file-upload-${Math.random().toString()}`),n=Cee();return v.jsx("div",{className:"absolute flex w-screen h-screen justify-center items-center pointer-events-none",children:v.jsx("label",{htmlFor:t,className:"grid bg-background border-[2px] border-[dashed] rounded-lg min-w-[600px] pointer-events-auto",children:v.jsx("div",{className:"grid p-16 w-full h-full",children:v.jsx("p",{className:"text-center",children:"Sollte das Bild nicht geladen werden, drücken sie die F5-Taste, oder klicken sie rechts oben auf den Button"})})})})}const GA="ToastProvider",[vb,Ree,Pee]=Wd("Toast"),[YA,Cte]=Tn("Toast",[Pee]),[Tee,Eg]=YA(GA),XA=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:i=50,children:s}=e,[l,u]=d.useState(null),[f,m]=d.useState(0),p=d.useRef(!1),g=d.useRef(!1);return d.createElement(vb.Provider,{scope:t},d.createElement(Tee,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:i,toastCount:f,viewport:l,onViewportChange:u,onToastAdd:d.useCallback(()=>m(y=>y+1),[]),onToastRemove:d.useCallback(()=>m(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:g},s))};XA.propTypes={label(e){if(e.label&&typeof e.label=="string"&&!e.label.trim()){const t=`Invalid prop \`label\` supplied to \`${GA}\`. Expected non-empty \`string\`.`;return new Error(t)}return null}};const kee="ToastViewport",Aee=["F8"],ow="toast.viewportPause",iw="toast.viewportResume",Mee=d.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Aee,label:o="Notifications ({hotkey})",...i}=e,s=Eg(kee,n),l=Ree(n),u=d.useRef(null),f=d.useRef(null),m=d.useRef(null),p=d.useRef(null),g=Ve(t,p,s.onViewportChange),y=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=s.toastCount>0;d.useEffect(()=>{const E=_=>{var b;r.every(R=>_[R]||_.code===R)&&((b=p.current)===null||b===void 0||b.focus())};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[r]),d.useEffect(()=>{const E=u.current,_=p.current;if(x&&E&&_){const b=()=>{if(!s.isClosePausedRef.current){const O=new CustomEvent(ow);_.dispatchEvent(O),s.isClosePausedRef.current=!0}},C=()=>{if(s.isClosePausedRef.current){const O=new CustomEvent(iw);_.dispatchEvent(O),s.isClosePausedRef.current=!1}},R=O=>{!E.contains(O.relatedTarget)&&C()},k=()=>{E.contains(document.activeElement)||C()};return E.addEventListener("focusin",b),E.addEventListener("focusout",R),E.addEventListener("pointermove",b),E.addEventListener("pointerleave",k),window.addEventListener("blur",b),window.addEventListener("focus",C),()=>{E.removeEventListener("focusin",b),E.removeEventListener("focusout",R),E.removeEventListener("pointermove",b),E.removeEventListener("pointerleave",k),window.removeEventListener("blur",b),window.removeEventListener("focus",C)}}},[x,s.isClosePausedRef]);const S=d.useCallback(({tabbingDirection:E})=>{const b=l().map(C=>{const R=C.ref.current,k=[R,...Yee(R)];return E==="forwards"?k:k.reverse()});return(E==="forwards"?b.reverse():b).flat()},[l]);return d.useEffect(()=>{const E=p.current;if(E){const _=b=>{const C=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!C){const I=document.activeElement,z=b.shiftKey;if(b.target===E&&z){var k;(k=f.current)===null||k===void 0||k.focus();return}const K=S({tabbingDirection:z?"backwards":"forwards"}),te=K.findIndex(U=>U===I);if(Y0(K.slice(te+1)))b.preventDefault();else{var O,A;z?(O=f.current)===null||O===void 0||O.focus():(A=m.current)===null||A===void 0||A.focus()}}};return E.addEventListener("keydown",_),()=>E.removeEventListener("keydown",_)}},[l,S]),d.createElement(Rz,{ref:u,role:"region","aria-label":o.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"}},x&&d.createElement(u$,{ref:f,onFocusFromOutsideViewport:()=>{const E=S({tabbingDirection:"forwards"});Y0(E)}}),d.createElement(vb.Slot,{scope:n},d.createElement(Ae.ol,Y({tabIndex:-1},i,{ref:g}))),x&&d.createElement(u$,{ref:m,onFocusFromOutsideViewport:()=>{const E=S({tabbingDirection:"backwards"});Y0(E)}}))}),Oee="ToastFocusProxy",u$=d.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,i=Eg(Oee,n);return d.createElement(Xm,Y({"aria-hidden":!0,tabIndex:0},o,{ref:t,style:{position:"fixed"},onFocus:s=>{var l;const u=s.relatedTarget;!((l=i.viewport)!==null&&l!==void 0&&l.contains(u))&&r()}}))}),Cg="Toast",Nee="toast.swipeStart",Dee="toast.swipeMove",Iee="toast.swipeCancel",Lee="toast.swipeEnd",Fee=d.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:i,...s}=e,[l=!0,u]=eo({prop:r,defaultProp:o,onChange:i});return d.createElement(xn,{present:n||l},d.createElement(ZA,Y({open:l},s,{ref:t,onClose:()=>u(!1),onPause:Lt(e.onPause),onResume:Lt(e.onResume),onSwipeStart:fe(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:fe(e.onSwipeMove,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:fe(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:fe(e.onSwipeEnd,f=>{const{x:m,y:p}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${m}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),u(!1)})})))}),[jee,Bee]=YA(Cg,{onClose(){}}),ZA=d.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:i,onClose:s,onEscapeKeyDown:l,onPause:u,onResume:f,onSwipeStart:m,onSwipeMove:p,onSwipeCancel:g,onSwipeEnd:y,...x}=e,S=Eg(Cg,n),[E,_]=d.useState(null),b=Ve(t,U=>_(U)),C=d.useRef(null),R=d.useRef(null),k=o||S.duration,O=d.useRef(0),A=d.useRef(k),I=d.useRef(0),{onToastAdd:z,onToastRemove:H}=S,ie=Lt(()=>{var U;(E==null?void 0:E.contains(document.activeElement))&&((U=S.viewport)===null||U===void 0||U.focus()),s()}),K=d.useCallback(U=>{!U||U===1/0||(window.clearTimeout(I.current),O.current=new Date().getTime(),I.current=window.setTimeout(ie,U))},[ie]);d.useEffect(()=>{const U=S.viewport;if(U){const re=()=>{K(A.current),f==null||f()},V=()=>{const J=new Date().getTime()-O.current;A.current=A.current-J,window.clearTimeout(I.current),u==null||u()};return U.addEventListener(ow,V),U.addEventListener(iw,re),()=>{U.removeEventListener(ow,V),U.removeEventListener(iw,re)}}},[S.viewport,k,u,f,K]),d.useEffect(()=>{i&&!S.isClosePausedRef.current&&K(k)},[i,k,S.isClosePausedRef,K]),d.useEffect(()=>(z(),()=>H()),[z,H]);const te=d.useMemo(()=>E?eM(E):null,[E]);return S.viewport?d.createElement(d.Fragment,null,te&&d.createElement(zee,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0},te),d.createElement(jee,{scope:n,onClose:ie},Bs.createPortal(d.createElement(vb.ItemSlot,{scope:n},d.createElement($z,{asChild:!0,onEscapeKeyDown:fe(l,()=>{S.isFocusedToastEscapeKeyDownRef.current||ie(),S.isFocusedToastEscapeKeyDownRef.current=!1})},d.createElement(Ae.li,Y({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":S.swipeDirection},x,{ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:fe(e.onKeyDown,U=>{U.key==="Escape"&&(l==null||l(U.nativeEvent),U.nativeEvent.defaultPrevented||(S.isFocusedToastEscapeKeyDownRef.current=!0,ie()))}),onPointerDown:fe(e.onPointerDown,U=>{U.button===0&&(C.current={x:U.clientX,y:U.clientY})}),onPointerMove:fe(e.onPointerMove,U=>{if(!C.current)return;const re=U.clientX-C.current.x,V=U.clientY-C.current.y,J=!!R.current,G=["left","right"].includes(S.swipeDirection),Z=["left","up"].includes(S.swipeDirection)?Math.min:Math.max,Q=G?Z(0,re):0,le=G?0:Z(0,V),L=U.pointerType==="touch"?10:2,ue={x:Q,y:le},Ne={originalEvent:U,delta:ue};J?(R.current=ue,Mh(Dee,p,Ne,{discrete:!1})):d$(ue,S.swipeDirection,L)?(R.current=ue,Mh(Nee,m,Ne,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(re)>L||Math.abs(V)>L)&&(C.current=null)}),onPointerUp:fe(e.onPointerUp,U=>{const re=R.current,V=U.target;if(V.hasPointerCapture(U.pointerId)&&V.releasePointerCapture(U.pointerId),R.current=null,C.current=null,re){const J=U.currentTarget,G={originalEvent:U,delta:re};d$(re,S.swipeDirection,S.swipeThreshold)?Mh(Lee,y,G,{discrete:!0}):Mh(Iee,g,G,{discrete:!0}),J.addEventListener("click",Z=>Z.preventDefault(),{once:!0})}})})))),S.viewport))):null});ZA.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){const t=`Invalid prop \`type\` supplied to \`${Cg}\`. Expected \`foreground | background\`.`;return new Error(t)}return null}};const zee=e=>{const{__scopeToast:t,children:n,...r}=e,o=Eg(Cg,t),[i,s]=d.useState(!1),[l,u]=d.useState(!1);return Kee(()=>s(!0)),d.useEffect(()=>{const f=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(f)},[]),l?null:d.createElement(jd,{asChild:!0},d.createElement(Xm,r,i&&d.createElement(d.Fragment,null,o.label," ",n)))},Uee=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return d.createElement(Ae.div,Y({},r,{ref:t}))}),Vee=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return d.createElement(Ae.div,Y({},r,{ref:t}))}),Wee="ToastAction",qA=d.forwardRef((e,t)=>{const{altText:n,...r}=e;return n?d.createElement(JA,{altText:n,asChild:!0},d.createElement(QA,Y({},r,{ref:t}))):null});qA.propTypes={altText(e){return e.altText?null:new Error(`Missing prop \`altText\` expected on \`${Wee}\``)}};const Hee="ToastClose",QA=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=Bee(Hee,n);return d.createElement(JA,{asChild:!0},d.createElement(Ae.button,Y({type:"button"},r,{ref:t,onClick:fe(e.onClick,o.onClose)})))}),JA=d.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return d.createElement(Ae.div,Y({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0},o,{ref:t}))});function eM(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),Gee(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!o)if(i){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...eM(r))}}),t}function Mh(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?mx(o,i):o.dispatchEvent(i)}const d$=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),i=r>o;return t==="left"||t==="right"?i&&r>n:!i&&o>n};function Kee(e=()=>{}){const t=Lt(e);Pn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function Gee(e){return e.nodeType===e.ELEMENT_NODE}function Yee(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Y0(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}const Xee=XA,tM=Mee,nM=Fee,rM=Uee,oM=Vee,iM=qA,sM=QA,Zee=Xee,aM=d.forwardRef(({className:e,...t},n)=>v.jsx(tM,{ref:n,className:xe("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),tabIndex:-1,...t}));aM.displayName=tM.displayName;const qee=Fm("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),lM=d.forwardRef(({className:e,variant:t,...n},r)=>v.jsx(nM,{ref:r,className:xe(qee({variant:t}),e),tabIndex:-1,...n}));lM.displayName=nM.displayName;const Qee=d.forwardRef(({className:e,...t},n)=>v.jsx(iM,{ref:n,className:xe("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),tabIndex:-1,...t}));Qee.displayName=iM.displayName;const cM=d.forwardRef(({className:e,...t},n)=>v.jsx(sM,{ref:n,className:xe("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",tabIndex:-1,...t,children:v.jsx(CP,{className:"h-4 w-4"})}));cM.displayName=sM.displayName;const uM=d.forwardRef(({className:e,...t},n)=>v.jsx(rM,{ref:n,className:xe("text-sm font-semibold [&+div]:text-xs",e),tabIndex:-1,...t}));uM.displayName=rM.displayName;const dM=d.forwardRef(({className:e,...t},n)=>v.jsx(oM,{ref:n,className:xe("text-sm opacity-90",e),...t,tabIndex:-1}));dM.displayName=oM.displayName;function Jee(){const{toasts:e}=Id();return v.jsxs(Zee,{children:[e.map(function({id:t,title:n,description:r,action:o,...i}){return v.jsxs(lM,{...i,children:[v.jsxs("div",{className:"grid gap-1",children:[n&&v.jsx(uM,{children:n}),r&&v.jsx(dM,{children:r})]}),o,v.jsx(cM,{})]},t)}),v.jsx(aM,{})]})}const ete=["image/jpeg","image/png","image/webp","image/bmp","image/tiff"];function tte(){const[e,t,n,r]=xt(g=>[g.file,g.updateAppState,g.setServerConfig,g.setFile]),o=qj(),i=rH();d.useEffect(()=>{o&&r(o)},[o,r]),d.useEffect(()=>{t({windowSize:i})},[i]),d.useEffect(()=>{(async()=>{const y=await SP();n(y),y.isDesktop&&gF()})()},[]);const s=d.useRef(0),l=d.useCallback(g=>{g.preventDefault(),g.stopPropagation()},[]),u=d.useCallback(g=>{g.preventDefault(),g.stopPropagation(),s.current+=1},[]),f=d.useCallback(g=>{g.preventDefault(),g.stopPropagation(),s.current-=1,s.current>0},[]),m=d.useCallback(g=>{if(g.preventDefault(),g.stopPropagation(),g.dataTransfer.files&&g.dataTransfer.files.length>0){if(!(g.dataTransfer.files.length>1)){const y=g.dataTransfer.files[0],x=y.type;ete.includes(x)&&r(y)}g.dataTransfer.clearData()}},[]),p=d.useCallback(g=>{if(!g.clipboardData)return;const y=g.clipboardData.items,x=[].slice.call(y).filter(_=>_.type.indexOf("image")!==-1);if(x.length===0)return;g.preventDefault(),g.stopPropagation();const E=x[0].getAsFile();E&&r(E)},[]);return d.useEffect(()=>(window.addEventListener("dragenter",u),window.addEventListener("dragleave",f),window.addEventListener("dragover",l),window.addEventListener("drop",m),window.addEventListener("paste",p),function(){window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",f),window.removeEventListener("dragover",l),window.removeEventListener("drop",m),window.removeEventListener("paste",p)})),v.jsxs("main",{className:"flex min-h-screen flex-col items-center justify-between w-full bg-[radial-gradient(circle_at_1px_1px,_#8e8e8e8e_1px,_transparent_0)] [background-size:20px_20px] bg-repeat",children:[v.jsx(Jee,{}),v.jsx(eZ,{}),v.jsx(Eee,{}),e?v.jsx(v.Fragment,{}):v.jsx($ee,{onSelection:async g=>{r(g)}})]})}const fm=["light","dark"],yb="(prefers-color-scheme: dark)",nte=typeof window>"u",fM=d.createContext(void 0),rte=e=>d.useContext(fM)?Be.createElement(d.Fragment,null,e.children):Be.createElement(ite,e),ote=["light","dark"],ite=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:o="theme",themes:i=ote,defaultTheme:s=n?"system":"light",attribute:l="data-theme",value:u,children:f,nonce:m})=>{const[p,g]=d.useState(()=>f$(o,s)),[y,x]=d.useState(()=>f$(o)),S=u?Object.values(u):i,E=d.useCallback(R=>{let k=R;if(!k)return;R==="system"&&n&&(k=h$());const O=u?u[k]:k,A=t?ate():null,I=document.documentElement;if(l==="class"?(I.classList.remove(...S),O&&I.classList.add(O)):O?I.setAttribute(l,O):I.removeAttribute(l),r){const z=fm.includes(s)?s:null,H=fm.includes(k)?k:z;I.style.colorScheme=H}A==null||A()},[]),_=d.useCallback(R=>{g(R);try{localStorage.setItem(o,R)}catch{}},[e]),b=d.useCallback(R=>{const k=h$(R);x(k),p==="system"&&n&&!e&&E("system")},[p,e]);d.useEffect(()=>{const R=window.matchMedia(yb);return R.addListener(b),b(R),()=>R.removeListener(b)},[b]),d.useEffect(()=>{const R=k=>{k.key===o&&_(k.newValue||s)};return window.addEventListener("storage",R),()=>window.removeEventListener("storage",R)},[_]),d.useEffect(()=>{E(e??p)},[e,p]);const C=d.useMemo(()=>({theme:p,setTheme:_,forcedTheme:e,resolvedTheme:p==="system"?y:p,themes:n?[...i,"system"]:i,systemTheme:n?y:void 0}),[p,_,e,y,n,i]);return Be.createElement(fM.Provider,{value:C},Be.createElement(ste,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:n,enableColorScheme:r,storageKey:o,themes:i,defaultTheme:s,attribute:l,value:u,children:f,attrs:S,nonce:m}),f)},ste=d.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:o,defaultTheme:i,value:s,attrs:l,nonce:u})=>{const f=i==="system",m=n==="class"?`var d=document.documentElement,c=d.classList;c.remove(${l.map(x=>`'${x}'`).join(",")});`:`var d=document.documentElement,n='${n}',s='setAttribute';`,p=o?fm.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",g=(x,S=!1,E=!0)=>{const _=s?s[x]:x,b=S?x+"|| ''":`'${_}'`;let C="";return o&&E&&!S&&fm.includes(x)&&(C+=`d.style.colorScheme = '${x}';`),n==="class"?C+=S||_?`c.add(${b})`:"null":_&&(C+=`d[s](n,${b})`),C},y=e?`!function(){${m}${g(e)}}()`:r?`!function(){try{${m}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${f})){var t='${yb}',m=window.matchMedia(t);if(m.media!==t||m.matches){${g("dark")}}else{${g("light")}}}else if(e){${s?`var x=${JSON.stringify(s)};`:""}${g(s?"x[e]":"e",!0)}}${f?"":"else{"+g(i,!1,!1)+"}"}${p}}catch(e){}}()`:`!function(){try{${m}var e=localStorage.getItem('${t}');if(e){${s?`var x=${JSON.stringify(s)};`:""}${g(s?"x[e]":"e",!0)}}else{${g(i,!1,!1)};}${p}}catch(t){}}();`;return Be.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:y}})},()=>!0),f$=(e,t)=>{if(nte)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},ate=()=>{const e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},h$=e=>(e||(e=window.matchMedia(yb)),e.matches?"dark":"light"),lte=new mL;X0.createRoot(document.getElementById("root")).render(v.jsx(Be.StrictMode,{children:v.jsx(xL,{client:lte,children:v.jsx(rte,{defaultTheme:"dark",disableTransitionOnChange:!0,children:v.jsx(KU,{children:v.jsx(tte,{})})})})}));