function $7(e,t){for(var n=0;nr[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dQ(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){if(this instanceof r){var i=[null];i.push.apply(i,arguments);var o=Function.bind.apply(t,i);return new o}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var F7={exports:{}},D_={},B7={exports:{}},xt={};/** * @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 dm=Symbol.for("react.element"),fQ=Symbol.for("react.portal"),hQ=Symbol.for("react.fragment"),pQ=Symbol.for("react.strict_mode"),gQ=Symbol.for("react.profiler"),mQ=Symbol.for("react.provider"),yQ=Symbol.for("react.context"),vQ=Symbol.for("react.forward_ref"),_Q=Symbol.for("react.suspense"),bQ=Symbol.for("react.memo"),SQ=Symbol.for("react.lazy"),VP=Symbol.iterator;function wQ(e){return e===null||typeof e!="object"?null:(e=VP&&e[VP]||e["@@iterator"],typeof e=="function"?e:null)}var U7={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z7=Object.assign,V7={};function Kf(e,t,n){this.props=e,this.context=t,this.refs=V7,this.updater=n||U7}Kf.prototype.isReactComponent={};Kf.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")};Kf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function j7(){}j7.prototype=Kf.prototype;function h4(e,t,n){this.props=e,this.context=t,this.refs=V7,this.updater=n||U7}var p4=h4.prototype=new j7;p4.constructor=h4;z7(p4,Kf.prototype);p4.isPureReactComponent=!0;var jP=Array.isArray,G7=Object.prototype.hasOwnProperty,g4={current:null},H7={key:!0,ref:!0,__self:!0,__source:!0};function W7(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)G7.call(t,r)&&!H7.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,Z=$[q];if(0>>1;qi(se,G))lei(W,se)?($[q]=W,$[le]=G,q=le):($[q]=se,$[ie]=G,q=ie);else if(lei(W,G))$[q]=W,$[le]=G,q=le;else break e}}return j}function i($,j){var G=$.sortIndex-j.sortIndex;return G!==0?G:$.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],d=1,f=null,h=3,g=!1,m=!1,v=!1,x=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 y($){for(var j=n(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=$)r(u),j.sortIndex=j.expirationTime,t(l,j);else break;j=n(u)}}function S($){if(v=!1,y($),!m)if(n(l)!==null)m=!0,D(C);else{var j=n(u);j!==null&&U(S,j.startTime-$)}}function C($,j){m=!1,v&&(v=!1,_(P),P=-1),g=!0;var G=h;try{for(y(j),f=n(l);f!==null&&(!(f.expirationTime>j)||$&&!M());){var q=f.callback;if(typeof q=="function"){f.callback=null,h=f.priorityLevel;var Z=q(f.expirationTime<=j);j=e.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),y(j)}else r(l);f=n(l)}if(f!==null)var ee=!0;else{var ie=n(u);ie!==null&&U(S,ie.startTime-j),ee=!1}return ee}finally{f=null,h=G,g=!1}}var T=!1,E=null,P=-1,k=5,O=-1;function M(){return!(e.unstable_now()-O$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function($){switch(h){case 1:case 2:case 3:var j=3;break;default:j=h}var G=h;h=j;try{return $()}finally{h=G}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,j){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var G=h;h=$;try{return j()}finally{h=G}},e.unstable_scheduleCallback=function($,j,G){var q=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0q?($.sortIndex=G,t(u,$),n(l)===null&&$===n(u)&&(v?(_(P),P=-1):v=!0,U(S,G-q))):($.sortIndex=Z,t(l,$),m||g||(m=!0,D(C))),$},e.unstable_shouldYield=M,e.unstable_wrapCallback=function($){var j=h;return function(){var G=h;h=j;try{return $.apply(this,arguments)}finally{h=G}}}})(Y7);X7.exports=Y7;var MQ=X7.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 Q7=L,no=MQ;function ge(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"),RC=Object.prototype.hasOwnProperty,NQ=/^[: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]*$/,WP={},qP={};function LQ(e){return RC.call(qP,e)?!0:RC.call(WP,e)?!1:NQ.test(e)?qP[e]=!0:(WP[e]=!0,!1)}function DQ(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 $Q(e,t,n,r){if(t===null||typeof t>"u"||DQ(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 Si(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var Vr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Vr[e]=new Si(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Vr[t]=new Si(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Vr[e]=new Si(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Vr[e]=new Si(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){Vr[e]=new Si(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Vr[e]=new Si(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Vr[e]=new Si(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Vr[e]=new Si(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Vr[e]=new Si(e,5,!1,e.toLowerCase(),null,!1,!1)});var y4=/[\-:]([a-z])/g;function v4(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(y4,v4);Vr[t]=new Si(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(y4,v4);Vr[t]=new Si(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(y4,v4);Vr[t]=new Si(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Vr[e]=new Si(e,1,!1,e.toLowerCase(),null,!1,!1)});Vr.xlinkHref=new Si("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Vr[e]=new Si(e,1,!1,e.toLowerCase(),null,!0,!0)});function _4(e,t,n,r){var i=Vr.hasOwnProperty(t)?Vr[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` `+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{zw=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Sp(e):""}function FQ(e){switch(e.tag){case 5:return Sp(e.type);case 16:return Sp("Lazy");case 13:return Sp("Suspense");case 19:return Sp("SuspenseList");case 0:case 2:case 15:return e=Vw(e.type,!1),e;case 11:return e=Vw(e.type.render,!1),e;case 1:return e=Vw(e.type,!0),e;default:return""}}function MC(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 Dd:return"Fragment";case Ld:return"Portal";case OC:return"Profiler";case b4:return"StrictMode";case kC:return"Suspense";case IC:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case eM:return(e.displayName||"Context")+".Consumer";case J7:return(e._context.displayName||"Context")+".Provider";case S4:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case w4:return t=e.displayName||null,t!==null?t:MC(e.type)||"Memo";case Sl:t=e._payload,e=e._init;try{return MC(e(t))}catch{}}return null}function BQ(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 MC(t);case 8:return t===b4?"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 Xl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function nM(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function UQ(e){var t=nM(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 i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.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 u0(e){e._valueTracker||(e._valueTracker=UQ(e))}function rM(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=nM(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Wv(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 NC(e,t){var n=t.checked;return On({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function XP(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Xl(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 iM(e,t){t=t.checked,t!=null&&_4(e,"checked",t,!1)}function LC(e,t){iM(e,t);var n=Xl(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")?DC(e,t.type,n):t.hasOwnProperty("defaultValue")&&DC(e,t.type,Xl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function YP(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 DC(e,t,n){(t!=="number"||Wv(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var wp=Array.isArray;function Jd(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=c0.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Jp(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var kp={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},zQ=["Webkit","ms","Moz","O"];Object.keys(kp).forEach(function(e){zQ.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),kp[t]=kp[e]})});function lM(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||kp.hasOwnProperty(e)&&kp[e]?(""+t).trim():t+"px"}function uM(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=lM(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var VQ=On({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 BC(e,t){if(t){if(VQ[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ge(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ge(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ge(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ge(62))}}function UC(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 zC=null;function x4(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var VC=null,ef=null,tf=null;function JP(e){if(e=pm(e)){if(typeof VC!="function")throw Error(ge(280));var t=e.stateNode;t&&(t=z_(t),VC(e.stateNode,e.type,t))}}function cM(e){ef?tf?tf.push(e):tf=[e]:ef=e}function dM(){if(ef){var e=ef,t=tf;if(tf=ef=null,JP(e),t)for(e=0;e>>=0,e===0?32:31-(JQ(e)/eZ|0)|0}var d0=64,f0=4194304;function xp(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 Yv(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=xp(a):(o&=s,o!==0&&(r=xp(o)))}else s=n&~i,s!==0?r=xp(s):o!==0&&(r=xp(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&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 fm(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ss(t),e[t]=n}function iZ(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=Mp),l8=String.fromCharCode(32),u8=!1;function kM(e,t){switch(e){case"keyup":return IZ.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function IM(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $d=!1;function NZ(e,t){switch(e){case"compositionend":return IM(t);case"keypress":return t.which!==32?null:(u8=!0,l8);case"textInput":return e=t.data,e===l8&&u8?null:e;default:return null}}function LZ(e,t){if($d)return e==="compositionend"||!k4&&kM(e,t)?(e=RM(),fv=P4=kl=null,$d=!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=h8(n)}}function DM(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?DM(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $M(){for(var e=window,t=Wv();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wv(e.document)}return t}function I4(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 GZ(e){var t=$M(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&DM(n.ownerDocument.documentElement,n)){if(r!==null&&I4(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 i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=p8(n,o);var s=p8(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>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,Fd=null,KC=null,Lp=null,XC=!1;function g8(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;XC||Fd==null||Fd!==Wv(r)||(r=Fd,"selectionStart"in r&&I4(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}),Lp&&og(Lp,r)||(Lp=r,r=Jv(KC,"onSelect"),0zd||(e.current=t3[zd],t3[zd]=null,zd--)}function ln(e,t){zd++,t3[zd]=e.current,e.current=t}var Yl={},ni=cu(Yl),Li=cu(!1),uc=Yl;function Cf(e,t){var n=e.type.contextTypes;if(!n)return Yl;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Di(e){return e=e.childContextTypes,e!=null}function t1(){pn(Li),pn(ni)}function w8(e,t,n){if(ni.current!==Yl)throw Error(ge(168));ln(ni,t),ln(Li,n)}function WM(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(ge(108,BQ(e)||"Unknown",i));return On({},n,r)}function n1(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yl,uc=ni.current,ln(ni,e),ln(Li,Li.current),!0}function x8(e,t,n){var r=e.stateNode;if(!r)throw Error(ge(169));n?(e=WM(e,t,uc),r.__reactInternalMemoizedMergedChildContext=e,pn(Li),pn(ni),ln(ni,e)):pn(Li),ln(Li,n)}var Ta=null,V_=!1,nx=!1;function qM(e){Ta===null?Ta=[e]:Ta.push(e)}function nJ(e){V_=!0,qM(e)}function du(){if(!nx&&Ta!==null){nx=!0;var e=0,t=Gt;try{var n=Ta;for(Gt=1;e>=s,i-=s,Pa=1<<32-ss(t)+i|n<P?(k=E,E=null):k=E.sibling;var O=h(_,E,y[P],S);if(O===null){E===null&&(E=k);break}e&&E&&O.alternate===null&&t(_,E),b=o(O,b,P),T===null?C=O:T.sibling=O,T=O,E=k}if(P===y.length)return n(_,E),_n&&Bu(_,P),C;if(E===null){for(;PP?(k=E,E=null):k=E.sibling;var M=h(_,E,O.value,S);if(M===null){E===null&&(E=k);break}e&&E&&M.alternate===null&&t(_,E),b=o(M,b,P),T===null?C=M:T.sibling=M,T=M,E=k}if(O.done)return n(_,E),_n&&Bu(_,P),C;if(E===null){for(;!O.done;P++,O=y.next())O=f(_,O.value,S),O!==null&&(b=o(O,b,P),T===null?C=O:T.sibling=O,T=O);return _n&&Bu(_,P),C}for(E=r(_,E);!O.done;P++,O=y.next())O=g(E,_,P,O.value,S),O!==null&&(e&&O.alternate!==null&&E.delete(O.key===null?P:O.key),b=o(O,b,P),T===null?C=O:T.sibling=O,T=O);return e&&E.forEach(function(V){return t(_,V)}),_n&&Bu(_,P),C}function x(_,b,y,S){if(typeof y=="object"&&y!==null&&y.type===Dd&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case l0:e:{for(var C=y.key,T=b;T!==null;){if(T.key===C){if(C=y.type,C===Dd){if(T.tag===7){n(_,T.sibling),b=i(T,y.props.children),b.return=_,_=b;break e}}else if(T.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Sl&&O8(C)===T.type){n(_,T.sibling),b=i(T,y.props),b.ref=Zh(_,T,y),b.return=_,_=b;break e}n(_,T);break}else t(_,T);T=T.sibling}y.type===Dd?(b=nc(y.props.children,_.mode,S,y.key),b.return=_,_=b):(S=bv(y.type,y.key,y.props,null,_.mode,S),S.ref=Zh(_,b,y),S.return=_,_=S)}return s(_);case Ld:e:{for(T=y.key;b!==null;){if(b.key===T)if(b.tag===4&&b.stateNode.containerInfo===y.containerInfo&&b.stateNode.implementation===y.implementation){n(_,b.sibling),b=i(b,y.children||[]),b.return=_,_=b;break e}else{n(_,b);break}else t(_,b);b=b.sibling}b=cx(y,_.mode,S),b.return=_,_=b}return s(_);case Sl:return T=y._init,x(_,b,T(y._payload),S)}if(wp(y))return m(_,b,y,S);if(qh(y))return v(_,b,y,S);_0(_,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,b!==null&&b.tag===6?(n(_,b.sibling),b=i(b,y),b.return=_,_=b):(n(_,b),b=ux(y,_.mode,S),b.return=_,_=b),s(_)):n(_,b)}return x}var Ef=tN(!0),nN=tN(!1),gm={},Vs=cu(gm),ug=cu(gm),cg=cu(gm);function Xu(e){if(e===gm)throw Error(ge(174));return e}function z4(e,t){switch(ln(cg,t),ln(ug,e),ln(Vs,gm),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:FC(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=FC(t,e)}pn(Vs),ln(Vs,t)}function Af(){pn(Vs),pn(ug),pn(cg)}function rN(e){Xu(cg.current);var t=Xu(Vs.current),n=FC(t,e.type);t!==n&&(ln(ug,e),ln(Vs,n))}function V4(e){ug.current===e&&(pn(Vs),pn(ug))}var En=cu(0);function l1(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 rx=[];function j4(){for(var e=0;en?n:4,e(!0);var r=ix.transition;ix.transition={};try{e(!1),t()}finally{Gt=n,ix.transition=r}}function _N(){return Mo().memoizedState}function sJ(e,t,n){var r=Vl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},bN(e))SN(t,n);else if(n=QM(e,t,n,r),n!==null){var i=gi();as(n,e,r,i),wN(n,t,r)}}function aJ(e,t,n){var r=Vl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(bN(e))SN(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,fs(a,s)){var l=t.interleaved;l===null?(i.next=i,B4(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=QM(e,t,i,r),n!==null&&(i=gi(),as(n,e,r,i),wN(n,t,r))}}function bN(e){var t=e.alternate;return e===Rn||t!==null&&t===Rn}function SN(e,t){Dp=u1=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function wN(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,T4(e,n)}}var c1={readContext:Io,useCallback:Kr,useContext:Kr,useEffect:Kr,useImperativeHandle:Kr,useInsertionEffect:Kr,useLayoutEffect:Kr,useMemo:Kr,useReducer:Kr,useRef:Kr,useState:Kr,useDebugValue:Kr,useDeferredValue:Kr,useTransition:Kr,useMutableSource:Kr,useSyncExternalStore:Kr,useId:Kr,unstable_isNewReconciler:!1},lJ={readContext:Io,useCallback:function(e,t){return As().memoizedState=[e,t===void 0?null:t],e},useContext:Io,useEffect:I8,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,mv(4194308,4,pN.bind(null,t,e),n)},useLayoutEffect:function(e,t){return mv(4194308,4,e,t)},useInsertionEffect:function(e,t){return mv(4,2,e,t)},useMemo:function(e,t){var n=As();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=As();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=sJ.bind(null,Rn,e),[r.memoizedState,e]},useRef:function(e){var t=As();return e={current:e},t.memoizedState=e},useState:k8,useDebugValue:K4,useDeferredValue:function(e){return As().memoizedState=e},useTransition:function(){var e=k8(!1),t=e[0];return e=oJ.bind(null,e[1]),As().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Rn,i=As();if(_n){if(n===void 0)throw Error(ge(407));n=n()}else{if(n=t(),Tr===null)throw Error(ge(349));dc&30||sN(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,I8(lN.bind(null,r,o,e),[e]),r.flags|=2048,hg(9,aN.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=As(),t=Tr.identifierPrefix;if(_n){var n=Ra,r=Pa;n=(r&~(1<<32-ss(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=dg++,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[Is]=t,e[lg]=r,kN(e,t,!1,!1),t.stateNode=e;e:{switch(s=UC(n,r),n){case"dialog":cn("cancel",e),cn("close",e),i=r;break;case"iframe":case"object":case"embed":cn("load",e),i=r;break;case"video":case"audio":for(i=0;iRf&&(t.flags|=128,r=!0,Jh(o,!1),t.lanes=4194304)}else{if(!r)if(e=l1(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Jh(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!_n)return Xr(t),null}else 2*jn()-o.renderingStartTime>Rf&&n!==1073741824&&(t.flags|=128,r=!0,Jh(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=jn(),t.sibling=null,n=En.current,ln(En,r?n&1|2:n&1),t):(Xr(t),null);case 22:case 23:return eT(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Qi&1073741824&&(Xr(t),t.subtreeFlags&6&&(t.flags|=8192)):Xr(t),null;case 24:return null;case 25:return null}throw Error(ge(156,t.tag))}function mJ(e,t){switch(N4(t),t.tag){case 1:return Di(t.type)&&t1(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Af(),pn(Li),pn(ni),j4(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return V4(t),null;case 13:if(pn(En),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ge(340));Tf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pn(En),null;case 4:return Af(),null;case 10:return F4(t.type._context),null;case 22:case 23:return eT(),null;case 24:return null;default:return null}}var S0=!1,ei=!1,yJ=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function Hd(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ln(e,t,r)}else n.current=null}function h3(e,t,n){try{n()}catch(r){Ln(e,t,r)}}var z8=!1;function vJ(e,t){if(YC=Qv,e=$M(),I4(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 i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var g;f!==n||i!==0&&f.nodeType!==3||(a=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(g=f.firstChild)!==null;)h=f,f=g;for(;;){if(f===e)break t;if(h===n&&++u===i&&(a=s),h===o&&++d===r&&(l=s),(g=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(QC={focusedElem:e,selectionRange:n},Qv=!1,Pe=t;Pe!==null;)if(t=Pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Pe=e;else for(;Pe!==null;){t=Pe;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var v=m.memoizedProps,x=m.memoizedState,_=t.stateNode,b=_.getSnapshotBeforeUpdate(t.elementType===t.type?v:Zo(t.type,v),x);_.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ge(163))}}catch(S){Ln(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Pe=e;break}Pe=t.return}return m=z8,z8=!1,m}function $p(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&h3(t,n,o)}i=i.next}while(i!==r)}}function H_(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 p3(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 NN(e){var t=e.alternate;t!==null&&(e.alternate=null,NN(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Is],delete t[lg],delete t[e3],delete t[eJ],delete t[tJ])),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 LN(e){return e.tag===5||e.tag===3||e.tag===4}function V8(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||LN(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 g3(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=e1));else if(r!==4&&(e=e.child,e!==null))for(g3(e,t,n),e=e.sibling;e!==null;)g3(e,t,n),e=e.sibling}function m3(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(m3(e,t,n),e=e.sibling;e!==null;)m3(e,t,n),e=e.sibling}var Fr=null,es=!1;function pl(e,t,n){for(n=n.child;n!==null;)DN(e,t,n),n=n.sibling}function DN(e,t,n){if(zs&&typeof zs.onCommitFiberUnmount=="function")try{zs.onCommitFiberUnmount($_,n)}catch{}switch(n.tag){case 5:ei||Hd(n,t);case 6:var r=Fr,i=es;Fr=null,pl(e,t,n),Fr=r,es=i,Fr!==null&&(es?(e=Fr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Fr.removeChild(n.stateNode));break;case 18:Fr!==null&&(es?(e=Fr,n=n.stateNode,e.nodeType===8?tx(e.parentNode,n):e.nodeType===1&&tx(e,n),rg(e)):tx(Fr,n.stateNode));break;case 4:r=Fr,i=es,Fr=n.stateNode.containerInfo,es=!0,pl(e,t,n),Fr=r,es=i;break;case 0:case 11:case 14:case 15:if(!ei&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&h3(n,t,s),i=i.next}while(i!==r)}pl(e,t,n);break;case 1:if(!ei&&(Hd(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ln(n,t,a)}pl(e,t,n);break;case 21:pl(e,t,n);break;case 22:n.mode&1?(ei=(r=ei)||n.memoizedState!==null,pl(e,t,n),ei=r):pl(e,t,n);break;default:pl(e,t,n)}}function j8(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yJ),t.forEach(function(r){var i=AJ.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Yo(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=jn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*bJ(r/1960))-r,10e?16:e,Il===null)var r=!1;else{if(e=Il,Il=null,h1=0,Pt&6)throw Error(ge(331));var i=Pt;for(Pt|=4,Pe=e.current;Pe!==null;){var o=Pe,s=o.child;if(Pe.flags&16){var a=o.deletions;if(a!==null){for(var l=0;ljn()-Z4?tc(e,0):Q4|=n),$i(e,t)}function GN(e,t){t===0&&(e.mode&1?(t=f0,f0<<=1,!(f0&130023424)&&(f0=4194304)):t=1);var n=gi();e=za(e,t),e!==null&&(fm(e,t,n),$i(e,n))}function EJ(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),GN(e,n)}function AJ(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ge(314))}r!==null&&r.delete(t),GN(e,n)}var HN;HN=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Li.current)ki=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ki=!1,pJ(e,t,n);ki=!!(e.flags&131072)}else ki=!1,_n&&t.flags&1048576&&KM(t,i1,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;yv(e,t),e=t.pendingProps;var i=Cf(t,ni.current);rf(t,n),i=H4(null,t,r,e,i,n);var o=W4();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Di(r)?(o=!0,n1(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,U4(t),i.updater=j_,t.stateNode=i,i._reactInternals=t,s3(t,r,e,n),t=u3(null,t,r,!0,o,n)):(t.tag=0,_n&&o&&M4(t),pi(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(yv(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=RJ(r),e=Zo(r,e),i){case 0:t=l3(null,t,r,e,n);break e;case 1:t=F8(null,t,r,e,n);break e;case 11:t=D8(null,t,r,e,n);break e;case 14:t=$8(null,t,r,Zo(r.type,e),n);break e}throw Error(ge(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Zo(r,i),l3(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Zo(r,i),F8(e,t,r,i,n);case 3:e:{if(PN(t),e===null)throw Error(ge(387));r=t.pendingProps,o=t.memoizedState,i=o.element,ZM(e,t),a1(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Pf(Error(ge(423)),t),t=B8(e,t,r,n,i);break e}else if(r!==i){i=Pf(Error(ge(424)),t),t=B8(e,t,r,n,i);break e}else for(Ji=Bl(t.stateNode.containerInfo.firstChild),eo=t,_n=!0,ns=null,n=nN(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Tf(),r===i){t=Va(e,t,n);break e}pi(e,t,r,n)}t=t.child}return t;case 5:return rN(t),e===null&&r3(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,ZC(r,i)?s=null:o!==null&&ZC(r,o)&&(t.flags|=32),AN(e,t),pi(e,t,s,n),t.child;case 6:return e===null&&r3(t),null;case 13:return RN(e,t,n);case 4:return z4(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ef(t,null,r,n):pi(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Zo(r,i),D8(e,t,r,i,n);case 7:return pi(e,t,t.pendingProps,n),t.child;case 8:return pi(e,t,t.pendingProps.children,n),t.child;case 12:return pi(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,ln(o1,r._currentValue),r._currentValue=s,o!==null)if(fs(o.value,s)){if(o.children===i.children&&!Li.current){t=Va(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Ia(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),i3(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(ge(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),i3(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}pi(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,rf(t,n),i=Io(i),r=r(i),t.flags|=1,pi(e,t,r,n),t.child;case 14:return r=t.type,i=Zo(r,t.pendingProps),i=Zo(r.type,i),$8(e,t,r,i,n);case 15:return TN(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Zo(r,i),yv(e,t),t.tag=1,Di(r)?(e=!0,n1(t)):e=!1,rf(t,n),eN(t,r,i),s3(t,r,i,n),u3(null,t,r,!0,e,n);case 19:return ON(e,t,n);case 22:return EN(e,t,n)}throw Error(ge(156,t.tag))};function WN(e,t){return vM(e,t)}function PJ(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 Po(e,t,n,r){return new PJ(e,t,n,r)}function nT(e){return e=e.prototype,!(!e||!e.isReactComponent)}function RJ(e){if(typeof e=="function")return nT(e)?1:0;if(e!=null){if(e=e.$$typeof,e===S4)return 11;if(e===w4)return 14}return 2}function jl(e,t){var n=e.alternate;return n===null?(n=Po(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 bv(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")nT(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Dd:return nc(n.children,i,o,t);case b4:s=8,i|=8;break;case OC:return e=Po(12,n,t,i|2),e.elementType=OC,e.lanes=o,e;case kC:return e=Po(13,n,t,i),e.elementType=kC,e.lanes=o,e;case IC:return e=Po(19,n,t,i),e.elementType=IC,e.lanes=o,e;case tM:return q_(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case J7:s=10;break e;case eM:s=9;break e;case S4:s=11;break e;case w4:s=14;break e;case Sl:s=16,r=null;break e}throw Error(ge(130,e==null?e:typeof e,""))}return t=Po(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function nc(e,t,n,r){return e=Po(7,e,r,t),e.lanes=n,e}function q_(e,t,n,r){return e=Po(22,e,r,t),e.elementType=tM,e.lanes=n,e.stateNode={isHidden:!1},e}function ux(e,t,n){return e=Po(6,e,null,t),e.lanes=n,e}function cx(e,t,n){return t=Po(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function OJ(e,t,n,r,i){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=Gw(0),this.expirationTimes=Gw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gw(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function rT(e,t,n,r,i,o,s,a,l){return e=new OJ(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Po(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},U4(o),e}function kJ(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(YN)}catch(e){console.error(e)}}YN(),K7.exports=so;var Ms=K7.exports;const bRe=Tc(Ms);var Q8=Ms;PC.createRoot=Q8.createRoot,PC.hydrateRoot=Q8.hydrateRoot;const DJ="modulepreload",$J=function(e,t){return new URL(e,t).href},Z8={},QN=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=$J(o,r),o in Z8)return;Z8[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!r)for(let d=i.length-1;d>=0;d--){const f=i[d];if(f.href===o&&(!s||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":DJ,s||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),s)return new Promise((d,f)=>{u.addEventListener("load",d),u.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})};function Cr(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:Z_(e)?2:J_(e)?3:0}function Gl(e,t){return Ql(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Sv(e,t){return Ql(e)===2?e.get(t):e[t]}function ZN(e,t,n){var r=Ql(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function JN(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Z_(e){return jJ&&e instanceof Map}function J_(e){return GJ&&e instanceof Set}function br(e){return e.o||e.t}function lT(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=tL(e);delete t[nt];for(var n=af(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=FJ),Object.freeze(e),t&&ja(e,function(n,r){return mm(r,!0)},!0)),e}function FJ(){Cr(2)}function uT(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function js(e){var t=w3[e];return t||Cr(18,e),t}function cT(e,t){w3[e]||(w3[e]=t)}function gg(){return yg}function dx(e,t){t&&(js("Patches"),e.u=[],e.s=[],e.v=t)}function m1(e){S3(e),e.p.forEach(BJ),e.p=null}function S3(e){e===yg&&(yg=e.l)}function J8(e){return yg={p:[],l:yg,h:e,m:!0,_:0}}function BJ(e){var t=e[nt];t.i===0||t.i===1?t.j():t.g=!0}function fx(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||js("ES5").S(t,e,r),r?(n[nt].P&&(m1(t),Cr(4)),Fi(e)&&(e=y1(t,e),t.l||v1(t,e)),t.u&&js("Patches").M(n[nt].t,e,t.u,t.s)):e=y1(t,n,[]),m1(t),t.u&&t.v(t.u,t.s),e!==tb?e:void 0}function y1(e,t,n){if(uT(t))return t;var r=t[nt];if(!r)return ja(t,function(a,l){return e9(e,r,t,a,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return v1(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=lT(r.k):r.o,o=i,s=!1;r.i===3&&(o=new Set(i),i.clear(),s=!0),ja(o,function(a,l){return e9(e,r,i,a,l,n,s)}),v1(e,i,!1),n&&e.u&&js("Patches").N(r,n,e.u,e.s)}return r.o}function e9(e,t,n,r,i,o,s){if(yi(i)){var a=y1(e,i,o&&t&&t.i!==3&&!Gl(t.R,r)?o.concat(r):void 0);if(ZN(n,r,a),!yi(a))return;e.m=!1}else s&&n.add(i);if(Fi(i)&&!uT(i)){if(!e.h.D&&e._<1)return;y1(e,i),t&&t.A.l||v1(e,i)}}function v1(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&mm(t,n)}function hx(e,t){var n=e[nt];return(n?br(n):e)[t]}function t9(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function Oi(e){e.P||(e.P=!0,e.l&&Oi(e.l))}function px(e){e.o||(e.o=lT(e.t))}function mg(e,t,n){var r=Z_(t)?js("MapSet").F(t,n):J_(t)?js("MapSet").T(t,n):e.O?function(i,o){var s=Array.isArray(i),a={i:s?1:0,A:o?o.A:gg(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=a,u=vg;s&&(l=[a],u=Tp);var d=Proxy.revocable(l,u),f=d.revoke,h=d.proxy;return a.k=h,a.j=f,h}(t,n):js("ES5").J(t,n);return(n?n.A:gg()).p.push(r),r}function eb(e){return yi(e)||Cr(22,e),function t(n){if(!Fi(n))return n;var r,i=n[nt],o=Ql(n);if(i){if(!i.P&&(i.i<4||!js("ES5").K(i)))return i.t;i.I=!0,r=n9(n,o),i.I=!1}else r=n9(n,o);return ja(r,function(s,a){i&&Sv(i.t,s)===a||ZN(r,s,t(a))}),o===3?new Set(r):r}(e)}function n9(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return lT(e)}function dT(){function e(o,s){var a=i[o];return a?a.enumerable=s:i[o]=a={configurable:!0,enumerable:s,get:function(){var l=this[nt];return vg.get(l,o)},set:function(l){var u=this[nt];vg.set(u,o,l)}},a}function t(o){for(var s=o.length-1;s>=0;s--){var a=o[s][nt];if(!a.P)switch(a.i){case 5:r(a)&&Oi(a);break;case 4:n(a)&&Oi(a)}}}function n(o){for(var s=o.t,a=o.k,l=af(a),u=l.length-1;u>=0;u--){var d=l[u];if(d!==nt){var f=s[d];if(f===void 0&&!Gl(s,d))return!0;var h=a[d],g=h&&h[nt];if(g?g.t!==f:!JN(h,f))return!0}}var m=!!s[nt];return l.length!==af(s).length+(m?0:1)}function r(o){var s=o.k;if(s.length!==o.t.length)return!0;var a=Object.getOwnPropertyDescriptor(s,s.length-1);if(a&&!a.get)return!0;for(var l=0;l1?_-1:0),y=1;y<_;y++)b[y-1]=arguments[y];return l.produce(v,function(S){var C;return(C=o).call.apply(C,[x,S].concat(b))})}}var u;if(typeof o!="function"&&Cr(6),s!==void 0&&typeof s!="function"&&Cr(7),Fi(i)){var d=J8(r),f=mg(r,i,void 0),h=!0;try{u=o(f),h=!1}finally{h?m1(d):S3(d)}return typeof Promise<"u"&&u instanceof Promise?u.then(function(v){return dx(d,s),fx(v,d)},function(v){throw m1(d),v}):(dx(d,s),fx(u,d))}if(!i||typeof i!="object"){if((u=o(i))===void 0&&(u=i),u===tb&&(u=void 0),r.D&&mm(u,!0),s){var g=[],m=[];js("Patches").M(i,u,g,m),s(g,m)}return u}Cr(21,i)},this.produceWithPatches=function(i,o){if(typeof i=="function")return function(u){for(var d=arguments.length,f=Array(d>1?d-1:0),h=1;h=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var s=js("Patches").$;return yi(n)?s(n,r):this.produce(n,function(a){return s(a,r)})},e}(),ro=new nL,rL=ro.produce,pT=ro.produceWithPatches.bind(ro),WJ=ro.setAutoFreeze.bind(ro),qJ=ro.setUseProxies.bind(ro),x3=ro.applyPatches.bind(ro),KJ=ro.createDraft.bind(ro),XJ=ro.finishDraft.bind(ro);const fu=rL,SRe=Object.freeze(Object.defineProperty({__proto__:null,Immer:nL,applyPatches:x3,castDraft:zJ,castImmutable:VJ,createDraft:KJ,current:eb,default:fu,enableAllPlugins:UJ,enableES5:dT,enableMapSet:eL,enablePatches:fT,finishDraft:XJ,freeze:mm,immerable:sf,isDraft:yi,isDraftable:Fi,nothing:tb,original:aT,produce:rL,produceWithPatches:pT,setAutoFreeze:WJ,setUseProxies:qJ},Symbol.toStringTag,{value:"Module"}));function _g(e){"@babel/helpers - typeof";return _g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_g(e)}function YJ(e,t){if(_g(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(_g(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function QJ(e){var t=YJ(e,"string");return _g(t)==="symbol"?t:String(t)}function ZJ(e,t,n){return t=QJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function s9(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Br(1));return n(ym)(e,t)}if(typeof e!="function")throw new Error(Br(2));var i=e,o=t,s=[],a=s,l=!1;function u(){a===s&&(a=s.slice())}function d(){if(l)throw new Error(Br(3));return o}function f(v){if(typeof v!="function")throw new Error(Br(4));if(l)throw new Error(Br(5));var x=!0;return u(),a.push(v),function(){if(x){if(l)throw new Error(Br(6));x=!1,u();var b=a.indexOf(v);a.splice(b,1),s=null}}}function h(v){if(!JJ(v))throw new Error(Br(7));if(typeof v.type>"u")throw new Error(Br(8));if(l)throw new Error(Br(9));try{l=!0,o=i(o,v)}finally{l=!1}for(var x=s=a,_=0;_"u")throw new Error(Br(12));if(typeof n(void 0,{type:Of.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Br(13))})}function Qf(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Br(14));f[g]=x,d=d||x!==v}return d=d||o.length!==Object.keys(l).length,d?f:l}}function l9(e,t){return function(){return t(e.apply(this,arguments))}}function oL(e,t){if(typeof e=="function")return l9(e,t);if(typeof e!="object"||e===null)throw new Error(Br(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=l9(i,t))}return n}function kf(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return _1}function i(a,l){r(a)===_1&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function o(){return n}function s(){n=[]}return{get:r,put:i,getEntries:o,clear:s}}var sL=function(t,n){return t===n};function iee(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var a=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(x,_){var b=t?t+"."+x:x;if(l){var y=i.some(function(S){return S instanceof RegExp?S.test(b):b===S});if(y)return"continue"}if(!n(_))return{value:{keyPath:b,value:_}};if(typeof _=="object"&&(s=pL(_,b,n,r,i,o),s))return{value:s}},d=0,f=a;d-1}function bee(e){return""+e}function _L(e){var t={},n=[],r,i={addCase:function(o,s){var a=typeof o=="string"?o:o.type;if(a in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[a]=s,i},addMatcher:function(o,s){return n.push({matcher:o,reducer:s}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function See(e){return typeof e=="function"}function bL(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?_L(t):[t,n,r],o=i[0],s=i[1],a=i[2],l;if(See(e))l=function(){return C3(e())};else{var u=C3(e);l=function(){return u}}function d(f,h){f===void 0&&(f=l());var g=Zl([o[h.type]],s.filter(function(m){var v=m.matcher;return v(h)}).map(function(m){var v=m.reducer;return v}));return g.filter(function(m){return!!m}).length===0&&(g=[a]),g.reduce(function(m,v){if(v)if(yi(m)){var x=m,_=v(x,h);return _===void 0?m:_}else{if(Fi(m))return fu(m,function(b){return v(b,h)});var _=v(m,h);if(_===void 0){if(m===null)return m;throw Error("A case reducer on a non-draftable value must not return undefined")}return _}return m},f)}return d.getInitialState=l,d}function wee(e,t){return e+"/"+t}function An(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:C3(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},s={},a={};i.forEach(function(d){var f=r[d],h=wee(t,d),g,m;"reducer"in f?(g=f.reducer,m=f.prepare):g=f,o[d]=g,s[h]=g,a[d]=m?Me(h,m):Me(h)});function l(){var d=typeof e.extraReducers=="function"?_L(e.extraReducers):[e.extraReducers],f=d[0],h=f===void 0?{}:f,g=d[1],m=g===void 0?[]:g,v=d[2],x=v===void 0?void 0:v,_=Ii(Ii({},h),s);return bL(n,function(b){for(var y in _)b.addCase(y,_[y]);for(var S=0,C=m;S0;if(b){var y=m.filter(function(S){return u(x,S,v)}).length>0;y&&(v.ids=Object.keys(v.entities))}}function h(m,v){return g([m],v)}function g(m,v){var x=SL(m,e,v),_=x[0],b=x[1];f(b,v),n(_,v)}return{removeAll:Eee(l),addOne:zn(t),addMany:zn(n),setOne:zn(r),setMany:zn(i),setAll:zn(o),updateOne:zn(d),updateMany:zn(f),upsertOne:zn(h),upsertMany:zn(g),removeOne:zn(s),removeMany:zn(a)}}function Aee(e,t){var n=wL(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function s(b,y){return a([b],y)}function a(b,y){b=rc(b);var S=b.filter(function(C){return!(Up(C,e)in y.entities)});S.length!==0&&x(S,y)}function l(b,y){return u([b],y)}function u(b,y){b=rc(b),b.length!==0&&x(b,y)}function d(b,y){b=rc(b),y.entities={},y.ids=[],a(b,y)}function f(b,y){return h([b],y)}function h(b,y){for(var S=!1,C=0,T=b;C-1;return n&&r}function bm(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function ib(){for(var e=[],t=0;t0)for(var y=g.getState(),S=Array.from(n.values()),C=0,T=S;CMath.floor(e/t)*t,Ns=(e,t)=>Math.round(e/t)*t;var Hee=typeof global=="object"&&global&&global.Object===Object&&global;const UL=Hee;var Wee=typeof self=="object"&&self&&self.Object===Object&&self,qee=UL||Wee||Function("return this")();const Js=qee;var Kee=Js.Symbol;const No=Kee;var zL=Object.prototype,Xee=zL.hasOwnProperty,Yee=zL.toString,tp=No?No.toStringTag:void 0;function Qee(e){var t=Xee.call(e,tp),n=e[tp];try{e[tp]=void 0;var r=!0}catch{}var i=Yee.call(e);return r&&(t?e[tp]=n:delete e[tp]),i}var Zee=Object.prototype,Jee=Zee.toString;function ete(e){return Jee.call(e)}var tte="[object Null]",nte="[object Undefined]",m9=No?No.toStringTag:void 0;function gu(e){return e==null?e===void 0?nte:tte:m9&&m9 in Object(e)?Qee(e):ete(e)}function ps(e){return e!=null&&typeof e=="object"}var rte="[object Symbol]";function ob(e){return typeof e=="symbol"||ps(e)&&gu(e)==rte}function VL(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=Lte)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Bte(e){return function(){return e}}var Ute=function(){try{var e=Rc(Object,"defineProperty");return e({},"",{}),e}catch{}}();const x1=Ute;var zte=x1?function(e,t){return x1(e,"toString",{configurable:!0,enumerable:!1,value:Bte(t),writable:!0})}:sb;const Vte=zte;var jte=Fte(Vte);const WL=jte;function qL(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var Xte=9007199254740991,Yte=/^(?:0|[1-9]\d*)$/;function bT(e,t){var n=typeof e;return t=t??Xte,!!t&&(n=="number"||n!="symbol"&&Yte.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=Jte}function Jf(e){return e!=null&&wT(e.length)&&!_T(e)}function QL(e,t,n){if(!vi(n))return!1;var r=typeof t;return(r=="number"?Jf(n)&&bT(t,n.length):r=="string"&&t in n)?Cm(n[t],e):!1}function ZL(e){return YL(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&QL(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function pre(e,t){var n=this.__data__,r=ab(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Ka(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(a)?t>1?oD(a,t-1,n,r,i):RT(i,a):r||(i[i.length]=a)}return i}function Ire(e){var t=e==null?0:e.length;return t?oD(e,1):[]}function Mre(e){return WL(XL(e,void 0,Ire),e+"")}var Nre=rD(Object.getPrototypeOf,Object);const OT=Nre;var Lre="[object Object]",Dre=Function.prototype,$re=Object.prototype,sD=Dre.toString,Fre=$re.hasOwnProperty,Bre=sD.call(Object);function aD(e){if(!ps(e)||gu(e)!=Lre)return!1;var t=OT(e);if(t===null)return!0;var n=Fre.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&sD.call(n)==Bre}function lD(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:lD(e,t,n)}var zre="\\ud800-\\udfff",Vre="\\u0300-\\u036f",jre="\\ufe20-\\ufe2f",Gre="\\u20d0-\\u20ff",Hre=Vre+jre+Gre,Wre="\\ufe0e\\ufe0f",qre="\\u200d",Kre=RegExp("["+qre+zre+Hre+Wre+"]");function kT(e){return Kre.test(e)}function Xre(e){return e.split("")}var uD="\\ud800-\\udfff",Yre="\\u0300-\\u036f",Qre="\\ufe20-\\ufe2f",Zre="\\u20d0-\\u20ff",Jre=Yre+Qre+Zre,eie="\\ufe0e\\ufe0f",tie="["+uD+"]",P3="["+Jre+"]",R3="\\ud83c[\\udffb-\\udfff]",nie="(?:"+P3+"|"+R3+")",cD="[^"+uD+"]",dD="(?:\\ud83c[\\udde6-\\uddff]){2}",fD="[\\ud800-\\udbff][\\udc00-\\udfff]",rie="\\u200d",hD=nie+"?",pD="["+eie+"]?",iie="(?:"+rie+"(?:"+[cD,dD,fD].join("|")+")"+pD+hD+")*",oie=pD+hD+iie,sie="(?:"+[cD+P3+"?",P3,dD,fD,tie].join("|")+")",aie=RegExp(R3+"(?="+R3+")|"+sie+oie,"g");function lie(e){return e.match(aie)||[]}function uie(e){return kT(e)?lie(e):Xre(e)}function cie(e){return function(t){t=ub(t);var n=kT(t)?uie(t):void 0,r=n?n[0]:t.charAt(0),i=n?Ure(n,1).join(""):t.slice(1);return r[e]()+i}}var die=cie("toUpperCase");const fie=die;function gD(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function Ml(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=vx(n),n=n===n?n:0),t!==void 0&&(t=vx(t),t=t===t?t:0),noe(vx(e),t,n)}function roe(){this.__data__=new Ka,this.size=0}function ioe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ooe(e){return this.__data__.get(e)}function soe(e){return this.__data__.has(e)}var aoe=200;function loe(e,t){var n=this.__data__;if(n instanceof Ka){var r=n.__data__;if(!xg||r.lengtha))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var f=-1,h=!0,g=n&Vse?new Cg:void 0;for(o.set(e,t),o.set(t,e);++f1),o}),Zf(e,LD(e),n),r&&(n=Vp(n,Wae|qae|Kae,Hae));for(var i=t.length;i--;)YD(n,t[i]);return n});const mb=Xae;var Yae=WD("length");const Qae=Yae;var QD="\\ud800-\\udfff",Zae="\\u0300-\\u036f",Jae="\\ufe20-\\ufe2f",ele="\\u20d0-\\u20ff",tle=Zae+Jae+ele,nle="\\ufe0e\\ufe0f",rle="["+QD+"]",L3="["+tle+"]",D3="\\ud83c[\\udffb-\\udfff]",ile="(?:"+L3+"|"+D3+")",ZD="[^"+QD+"]",JD="(?:\\ud83c[\\udde6-\\uddff]){2}",e$="[\\ud800-\\udbff][\\udc00-\\udfff]",ole="\\u200d",t$=ile+"?",n$="["+nle+"]?",sle="(?:"+ole+"(?:"+[ZD,JD,e$].join("|")+")"+n$+t$+")*",ale=n$+t$+sle,lle="(?:"+[ZD+L3+"?",L3,JD,e$,rle].join("|")+")",X9=RegExp(D3+"(?="+D3+")|"+lle+ale,"g");function ule(e){for(var t=X9.lastIndex=0;X9.test(e);)++t;return t}function cle(e){return kT(e)?ule(e):Qae(e)}function dle(e,t,n,r,i){return i(e,function(o,s,a){n=r?(r=!1,o):t(n,o,s,a)}),n}function LT(e,t,n){var r=Er(e)?gD:dle,i=arguments.length<3;return r(e,fb(t),n,i,hb)}var fle="[object Map]",hle="[object Set]";function DT(e){if(e==null)return 0;if(Jf(e))return zae(e)?cle(e):e.length;var t=Nf(e);return t==fle||t==hle?e.size:iD(e).length}function ple(e,t){var n;return hb(e,function(r,i,o){return n=t(r,i,o),!n}),!!n}function Hu(e,t,n){var r=Er(e)?zD:ple;return n&&QL(e,t,n)&&(t=void 0),r(e,fb(t))}var gle=toe(function(e,t,n){return e+(n?" ":"")+fie(t)});const mle=gle;var yle=1/0,vle=df&&1/NT(new df([,-0]))[1]==yle?function(e){return new df(e)}:Nte;const _le=vle;var ble=200;function Sle(e,t,n){var r=-1,i=Kte,o=e.length,s=!0,a=[],l=a;if(n)s=!1,i=Dae;else if(o>=ble){var u=t?null:_le(e);if(u)return NT(u);s=!1,i=VD,l=new Cg}else l=t?[]:a;e:for(;++r{Gae(e,t.payload)}}}),{configChanged:Cle}=i$.actions,Tle=i$.reducer,CRe={"sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},TRe={"sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},Ele={"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},ERe={lycoris:"LyCORIS",diffusers:"Diffusers"},ARe=0,Ale=4294967295;var kt;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(const a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(const s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(kt||(kt={}));var $3;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})($3||($3={}));const Ce=kt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rl=e=>{switch(typeof e){case"undefined":return Ce.undefined;case"string":return Ce.string;case"number":return isNaN(e)?Ce.nan:Ce.number;case"boolean":return Ce.boolean;case"function":return Ce.function;case"bigint":return Ce.bigint;case"symbol":return Ce.symbol;case"object":return Array.isArray(e)?Ce.array:e===null?Ce.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ce.promise:typeof Map<"u"&&e instanceof Map?Ce.map:typeof Set<"u"&&e instanceof Set?Ce.set:typeof Date<"u"&&e instanceof Date?Ce.date:Ce.object;default:return Ce.unknown}},me=kt.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"]),Ple=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class us 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(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}us.create=e=>new us(e);const Tg=(e,t)=>{let n;switch(e.code){case me.invalid_type:e.received===Ce.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case me.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,kt.jsonStringifyReplacer)}`;break;case me.unrecognized_keys:n=`Unrecognized key(s) in object: ${kt.joinValues(e.keys,", ")}`;break;case me.invalid_union:n="Invalid input";break;case me.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${kt.joinValues(e.options)}`;break;case me.invalid_enum_value:n=`Invalid enum value. Expected ${kt.joinValues(e.options)}, received '${e.received}'`;break;case me.invalid_arguments:n="Invalid function arguments";break;case me.invalid_return_type:n="Invalid function return type";break;case me.invalid_date:n="Invalid date";break;case me.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}"`:kt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case me.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 me.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 me.custom:n="Invalid input";break;case me.invalid_intersection_types:n="Intersection results could not be merged";break;case me.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case me.not_finite:n="Number must be finite";break;default:n=t.defaultError,kt.assertNever(e)}return{message:n}};let o$=Tg;function Rle(e){o$=e}function T1(){return o$}const E1=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],s={...i,path:o};let a="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:i.message||a}},Ole=[];function Ee(e,t){const n=E1({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,T1(),Tg].filter(r=>!!r)});e.common.issues.push(n)}class ri{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 i of n){if(i.status==="aborted")return Ye;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return ri.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Ye;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:t.value,value:r}}}const Ye=Object.freeze({status:"aborted"}),s$=e=>({status:"dirty",value:e}),_i=e=>({status:"valid",value:e}),F3=e=>e.status==="aborted",B3=e=>e.status==="dirty",A1=e=>e.status==="valid",P1=e=>typeof Promise<"u"&&e instanceof Promise;var ze;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ze||(ze={}));class Ks{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}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 Y9=(e,t)=>{if(A1(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 us(e.common.issues);return this._error=n,this._error}}};function ot(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=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:i}:{errorMap:(s,a)=>s.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:r??a.defaultError}:{message:n??a.defaultError},description:i}}class ct{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.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Rl(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Rl(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ri,ctx:{common:t.parent.common,data:t.data,parsedType:Rl(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(P1(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 i={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:Rl(t)},o=this._parseSync({data:t,path:i.path,parent:i});return Y9(i,o)}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:Rl(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(P1(i)?i:Promise.resolve(i));return Y9(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=t(i),a=()=>o.addIssue({code:me.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new gs({schema:this,typeName:qe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Ma.create(this,this._def)}nullable(){return vc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cs.create(this,this._def)}promise(){return Df.create(this,this._def)}or(t){return Rg.create([this,t],this._def)}and(t){return Og.create(this,t,this._def)}transform(t){return new gs({...ot(this._def),schema:this,typeName:qe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Lg({...ot(this._def),innerType:this,defaultValue:n,typeName:qe.ZodDefault})}brand(){return new l$({typeName:qe.ZodBranded,type:this,...ot(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new I1({...ot(this._def),innerType:this,catchValue:n,typeName:qe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Pm.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const kle=/^c[^\s-]{8,}$/i,Ile=/^[a-z][a-z0-9]*$/,Mle=/[0-9A-HJKMNP-TV-Z]{26}/,Nle=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Lle=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((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}))\])|(\[IPv6:(([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})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,Dle=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,$le=/^(((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}))$/,Fle=/^(([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})))$/,Ble=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 Ule(e,t){return!!((t==="v4"||!t)&&$le.test(e)||(t==="v6"||!t)&&Fle.test(e))}class os extends ct{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:me.invalid_string,...ze.errToObj(r)}),this.nonempty=t=>this.min(1,ze.errToObj(t)),this.trim=()=>new os({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new os({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new os({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ce.string){const o=this._getOrReturnCtx(t);return Ee(o,{code:me.invalid_type,expected:Ce.string,received:o.parsedType}),Ye}const r=new ri;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),Ee(i,{code:me.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=t.data.length>o.value,a=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...ze.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ze.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ze.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ze.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ze.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ze.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ze.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ze.errToObj(n)})}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 os({checks:[],typeName:qe.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ot(e)})};function zle(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),s=parseInt(t.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class eu extends ct{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)!==Ce.number){const o=this._getOrReturnCtx(t);return Ee(o,{code:me.invalid_type,expected:Ce.number,received:o.parsedType}),Ye}let r;const i=new ri;for(const o of this._def.checks)o.kind==="int"?kt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Ee(r,{code:me.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:me.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?zle(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:me.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Ee(r,{code:me.not_finite,message:o.message}),i.dirty()):kt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ze.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ze.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ze.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ze.toString(n))}setLimit(t,n,r,i){return new eu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ze.toString(i)}]})}_addCheck(t){return new eu({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ze.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ze.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ze.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ze.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ze.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ze.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ze.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ze.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ze.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"&&kt.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 eu({checks:[],typeName:qe.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ot(e)});class tu extends ct{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)!==Ce.bigint){const o=this._getOrReturnCtx(t);return Ee(o,{code:me.invalid_type,expected:Ce.bigint,received:o.parsedType}),Ye}let r;const i=new ri;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:me.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Ee(r,{code:me.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):kt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ze.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ze.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ze.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ze.toString(n))}setLimit(t,n,r,i){return new tu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ze.toString(i)}]})}_addCheck(t){return new tu({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ze.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ze.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ze.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ze.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ze.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 tu({checks:[],typeName:qe.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ot(e)})};class Eg extends ct{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ce.boolean){const r=this._getOrReturnCtx(t);return Ee(r,{code:me.invalid_type,expected:Ce.boolean,received:r.parsedType}),Ye}return _i(t.data)}}Eg.create=e=>new Eg({typeName:qe.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ot(e)});class mc extends ct{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ce.date){const o=this._getOrReturnCtx(t);return Ee(o,{code:me.invalid_type,expected:Ce.date,received:o.parsedType}),Ye}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return Ee(o,{code:me.invalid_date}),Ye}const r=new ri;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),Ee(i,{code:me.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):kt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new mc({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ze.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ze.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 mc({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:qe.ZodDate,...ot(e)});class R1 extends ct{_parse(t){if(this._getType(t)!==Ce.symbol){const r=this._getOrReturnCtx(t);return Ee(r,{code:me.invalid_type,expected:Ce.symbol,received:r.parsedType}),Ye}return _i(t.data)}}R1.create=e=>new R1({typeName:qe.ZodSymbol,...ot(e)});class Ag extends ct{_parse(t){if(this._getType(t)!==Ce.undefined){const r=this._getOrReturnCtx(t);return Ee(r,{code:me.invalid_type,expected:Ce.undefined,received:r.parsedType}),Ye}return _i(t.data)}}Ag.create=e=>new Ag({typeName:qe.ZodUndefined,...ot(e)});class Pg extends ct{_parse(t){if(this._getType(t)!==Ce.null){const r=this._getOrReturnCtx(t);return Ee(r,{code:me.invalid_type,expected:Ce.null,received:r.parsedType}),Ye}return _i(t.data)}}Pg.create=e=>new Pg({typeName:qe.ZodNull,...ot(e)});class Lf extends ct{constructor(){super(...arguments),this._any=!0}_parse(t){return _i(t.data)}}Lf.create=e=>new Lf({typeName:qe.ZodAny,...ot(e)});class ic extends ct{constructor(){super(...arguments),this._unknown=!0}_parse(t){return _i(t.data)}}ic.create=e=>new ic({typeName:qe.ZodUnknown,...ot(e)});class Ga extends ct{_parse(t){const n=this._getOrReturnCtx(t);return Ee(n,{code:me.invalid_type,expected:Ce.never,received:n.parsedType}),Ye}}Ga.create=e=>new Ga({typeName:qe.ZodNever,...ot(e)});class O1 extends ct{_parse(t){if(this._getType(t)!==Ce.undefined){const r=this._getOrReturnCtx(t);return Ee(r,{code:me.invalid_type,expected:Ce.void,received:r.parsedType}),Ye}return _i(t.data)}}O1.create=e=>new O1({typeName:qe.ZodVoid,...ot(e)});class cs extends ct{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ce.array)return Ee(n,{code:me.invalid_type,expected:Ce.array,received:n.parsedType}),Ye;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,a=n.data.lengthi.maxLength.value&&(Ee(n,{code:me.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new Ks(n,s,n.path,a)))).then(s=>ri.mergeArray(r,s));const o=[...n.data].map((s,a)=>i.type._parseSync(new Ks(n,s,n.path,a)));return ri.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new cs({...this._def,minLength:{value:t,message:ze.toString(n)}})}max(t,n){return new cs({...this._def,maxLength:{value:t,message:ze.toString(n)}})}length(t,n){return new cs({...this._def,exactLength:{value:t,message:ze.toString(n)}})}nonempty(t){return this.min(1,t)}}cs.create=(e,t)=>new cs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:qe.ZodArray,...ot(t)});function Rd(e){if(e instanceof Tn){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ma.create(Rd(r))}return new Tn({...e._def,shape:()=>t})}else return e instanceof cs?new cs({...e._def,type:Rd(e.element)}):e instanceof Ma?Ma.create(Rd(e.unwrap())):e instanceof vc?vc.create(Rd(e.unwrap())):e instanceof Xs?Xs.create(e.items.map(t=>Rd(t))):e}class Tn extends ct{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=kt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Ce.object){const u=this._getOrReturnCtx(t);return Ee(u,{code:me.invalid_type,expected:Ce.object,received:u.parsedType}),Ye}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ga&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||a.push(u);const l=[];for(const u of s){const d=o[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Ks(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Ga){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")a.length>0&&(Ee(i,{code:me.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Ks(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key;u.push({key:f,value:await d.value,alwaysSet:d.alwaysSet})}return u}).then(u=>ri.mergeObjectSync(r,u)):ri.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ze.errToObj,new Tn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,s,a;const l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ze.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Tn({...this._def,unknownKeys:"strip"})}passthrough(){return new Tn({...this._def,unknownKeys:"passthrough"})}extend(t){return new Tn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Tn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:qe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Tn({...this._def,catchall:t})}pick(t){const n={};return kt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Tn({...this._def,shape:()=>n})}omit(t){const n={};return kt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Tn({...this._def,shape:()=>n})}deepPartial(){return Rd(this)}partial(t){const n={};return kt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new Tn({...this._def,shape:()=>n})}required(t){const n={};return kt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ma;)o=o._def.innerType;n[r]=o}}),new Tn({...this._def,shape:()=>n})}keyof(){return a$(kt.objectKeys(this.shape))}}Tn.create=(e,t)=>new Tn({shape:()=>e,unknownKeys:"strip",catchall:Ga.create(),typeName:qe.ZodObject,...ot(t)});Tn.strictCreate=(e,t)=>new Tn({shape:()=>e,unknownKeys:"strict",catchall:Ga.create(),typeName:qe.ZodObject,...ot(t)});Tn.lazycreate=(e,t)=>new Tn({shape:e,unknownKeys:"strip",catchall:Ga.create(),typeName:qe.ZodObject,...ot(t)});class Rg extends ct{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(a=>new us(a.ctx.common.issues));return Ee(n,{code:me.invalid_union,unionErrors:s}),Ye}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(l=>new us(l));return Ee(n,{code:me.invalid_union,unionErrors:a}),Ye}}get options(){return this._def.options}}Rg.create=(e,t)=>new Rg({options:e,typeName:qe.ZodUnion,...ot(t)});const xv=e=>e instanceof Ig?xv(e.schema):e instanceof gs?xv(e.innerType()):e instanceof Mg?[e.value]:e instanceof nu?e.options:e instanceof Ng?Object.keys(e.enum):e instanceof Lg?xv(e._def.innerType):e instanceof Ag?[void 0]:e instanceof Pg?[null]:null;class yb extends ct{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ce.object)return Ee(n,{code:me.invalid_type,expected:Ce.object,received:n.parsedType}),Ye;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(Ee(n,{code:me.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ye)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const s=xv(o.shape[t]);if(!s)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new yb({typeName:qe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...ot(r)})}}function U3(e,t){const n=Rl(e),r=Rl(t);if(e===t)return{valid:!0,data:e};if(n===Ce.object&&r===Ce.object){const i=kt.objectKeys(t),o=kt.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(const a of o){const l=U3(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===Ce.array&&r===Ce.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(F3(o)||F3(s))return Ye;const a=U3(o.value,s.value);return a.valid?((B3(o)||B3(s))&&n.dirty(),{status:n.value,value:a.data}):(Ee(r,{code:me.invalid_intersection_types}),Ye)};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(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Og.create=(e,t,n)=>new Og({left:e,right:t,typeName:qe.ZodIntersection,...ot(n)});class Xs extends ct{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ce.array)return Ee(r,{code:me.invalid_type,expected:Ce.array,received:r.parsedType}),Ye;if(r.data.lengththis._def.items.length&&(Ee(r,{code:me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ks(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>ri.mergeArray(n,s)):ri.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Xs({...this._def,rest:t})}}Xs.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xs({items:e,typeName:qe.ZodTuple,rest:null,...ot(t)})};class kg extends ct{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!==Ce.object)return Ee(r,{code:me.invalid_type,expected:Ce.object,received:r.parsedType}),Ye;const i=[],o=this._def.keyType,s=this._def.valueType;for(const a in r.data)i.push({key:o._parse(new Ks(r,a,r.path,a)),value:s._parse(new Ks(r,r.data[a],r.path,a))});return r.common.async?ri.mergeObjectAsync(n,i):ri.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ct?new kg({keyType:t,valueType:n,typeName:qe.ZodRecord,...ot(r)}):new kg({keyType:os.create(),valueType:t,typeName:qe.ZodRecord,...ot(n)})}}class k1 extends ct{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ce.map)return Ee(r,{code:me.invalid_type,expected:Ce.map,received:r.parsedType}),Ye;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,l],u)=>({key:i._parse(new Ks(r,a,r.path,[u,"key"])),value:o._parse(new Ks(r,l,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return Ye;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return Ye;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}k1.create=(e,t,n)=>new k1({valueType:t,keyType:e,typeName:qe.ZodMap,...ot(n)});class yc extends ct{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ce.set)return Ee(r,{code:me.invalid_type,expected:Ce.set,received:r.parsedType}),Ye;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Ee(r,{code:me.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(l){const u=new Set;for(const d of l){if(d.status==="aborted")return Ye;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((l,u)=>o._parse(new Ks(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new yc({...this._def,minSize:{value:t,message:ze.toString(n)}})}max(t,n){return new yc({...this._def,maxSize:{value:t,message:ze.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}yc.create=(e,t)=>new yc({valueType:e,minSize:null,maxSize:null,typeName:qe.ZodSet,...ot(t)});class ff extends ct{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ce.function)return Ee(n,{code:me.invalid_type,expected:Ce.function,received:n.parsedType}),Ye;function r(a,l){return E1({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,T1(),Tg].filter(u=>!!u),issueData:{code:me.invalid_arguments,argumentsError:l}})}function i(a,l){return E1({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,T1(),Tg].filter(u=>!!u),issueData:{code:me.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;return this._def.returns instanceof Df?_i(async(...a)=>{const l=new us([]),u=await this._def.args.parseAsync(a,o).catch(h=>{throw l.addIssue(r(a,h)),l}),d=await s(...u);return await this._def.returns._def.type.parseAsync(d,o).catch(h=>{throw l.addIssue(i(d,h)),l})}):_i((...a)=>{const l=this._def.args.safeParse(a,o);if(!l.success)throw new us([r(a,l.error)]);const u=s(...l.data),d=this._def.returns.safeParse(u,o);if(!d.success)throw new us([i(u,d.error)]);return d.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new ff({...this._def,args:Xs.create(t).rest(ic.create())})}returns(t){return new ff({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new ff({args:t||Xs.create([]).rest(ic.create()),returns:n||ic.create(),typeName:qe.ZodFunction,...ot(r)})}}class Ig extends ct{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})}}Ig.create=(e,t)=>new Ig({getter:e,typeName:qe.ZodLazy,...ot(t)});class Mg extends ct{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Ee(n,{received:n.data,code:me.invalid_literal,expected:this._def.value}),Ye}return{status:"valid",value:t.data}}get value(){return this._def.value}}Mg.create=(e,t)=>new Mg({value:e,typeName:qe.ZodLiteral,...ot(t)});function a$(e,t){return new nu({values:e,typeName:qe.ZodEnum,...ot(t)})}class nu extends ct{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Ee(n,{expected:kt.joinValues(r),received:n.parsedType,code:me.invalid_type}),Ye}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return Ee(n,{received:n.data,code:me.invalid_enum_value,options:r}),Ye}return _i(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 nu.create(t)}exclude(t){return nu.create(this.options.filter(n=>!t.includes(n)))}}nu.create=a$;class Ng extends ct{_parse(t){const n=kt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ce.string&&r.parsedType!==Ce.number){const i=kt.objectValues(n);return Ee(r,{expected:kt.joinValues(i),received:r.parsedType,code:me.invalid_type}),Ye}if(n.indexOf(t.data)===-1){const i=kt.objectValues(n);return Ee(r,{received:r.data,code:me.invalid_enum_value,options:i}),Ye}return _i(t.data)}get enum(){return this._def.values}}Ng.create=(e,t)=>new Ng({values:e,typeName:qe.ZodNativeEnum,...ot(t)});class Df extends ct{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ce.promise&&n.common.async===!1)return Ee(n,{code:me.invalid_type,expected:Ce.promise,received:n.parsedType}),Ye;const r=n.parsedType===Ce.promise?n.data:Promise.resolve(n.data);return _i(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Df.create=(e,t)=>new Df({type:e,typeName:qe.ZodPromise,...ot(t)});class gs extends ct{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null;if(i.type==="preprocess"){const s=i.transform(r.data);return r.common.async?Promise.resolve(s).then(a=>this._def.schema._parseAsync({data:a,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}const o={addIssue:s=>{Ee(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="refinement"){const s=a=>{const l=i.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ye:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ye:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!A1(s))return s;const a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>A1(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:n.value,value:a})):s);kt.assertNever(i)}}gs.create=(e,t,n)=>new gs({schema:e,typeName:qe.ZodEffects,effect:t,...ot(n)});gs.createWithPreprocess=(e,t,n)=>new gs({schema:t,effect:{type:"preprocess",transform:e},typeName:qe.ZodEffects,...ot(n)});class Ma extends ct{_parse(t){return this._getType(t)===Ce.undefined?_i(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ma.create=(e,t)=>new Ma({innerType:e,typeName:qe.ZodOptional,...ot(t)});class vc extends ct{_parse(t){return this._getType(t)===Ce.null?_i(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}vc.create=(e,t)=>new vc({innerType:e,typeName:qe.ZodNullable,...ot(t)});class Lg extends ct{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ce.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Lg.create=(e,t)=>new Lg({innerType:e,typeName:qe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ot(t)});class I1 extends ct{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return P1(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new us(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new us(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}I1.create=(e,t)=>new I1({innerType:e,typeName:qe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ot(t)});class M1 extends ct{_parse(t){if(this._getType(t)!==Ce.nan){const r=this._getOrReturnCtx(t);return Ee(r,{code:me.invalid_type,expected:Ce.nan,received:r.parsedType}),Ye}return{status:"valid",value:t.data}}}M1.create=e=>new M1({typeName:qe.ZodNaN,...ot(e)});const Vle=Symbol("zod_brand");class l$ extends ct{_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 Pm extends ct{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ye:o.status==="dirty"?(n.dirty(),s$(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ye:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new Pm({in:t,out:n,typeName:qe.ZodPipeline})}}const u$=(e,t={},n)=>e?Lf.create().superRefine((r,i)=>{var o,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(o=a.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...u,fatal:l})}}):Lf.create(),jle={object:Tn.lazycreate};var qe;(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"})(qe||(qe={}));const Gle=(e,t={message:`Input not instance of ${e.name}`})=>u$(n=>n instanceof e,t),c$=os.create,d$=eu.create,Hle=M1.create,Wle=tu.create,f$=Eg.create,qle=mc.create,Kle=R1.create,Xle=Ag.create,Yle=Pg.create,Qle=Lf.create,Zle=ic.create,Jle=Ga.create,eue=O1.create,tue=cs.create,nue=Tn.create,rue=Tn.strictCreate,iue=Rg.create,oue=yb.create,sue=Og.create,aue=Xs.create,lue=kg.create,uue=k1.create,cue=yc.create,due=ff.create,fue=Ig.create,hue=Mg.create,pue=nu.create,gue=Ng.create,mue=Df.create,Q9=gs.create,yue=Ma.create,vue=vc.create,_ue=gs.createWithPreprocess,bue=Pm.create,Sue=()=>c$().optional(),wue=()=>d$().optional(),xue=()=>f$().optional(),Cue={string:e=>os.create({...e,coerce:!0}),number:e=>eu.create({...e,coerce:!0}),boolean:e=>Eg.create({...e,coerce:!0}),bigint:e=>tu.create({...e,coerce:!0}),date:e=>mc.create({...e,coerce:!0})},Tue=Ye;var Et=Object.freeze({__proto__:null,defaultErrorMap:Tg,setErrorMap:Rle,getErrorMap:T1,makeIssue:E1,EMPTY_PATH:Ole,addIssueToContext:Ee,ParseStatus:ri,INVALID:Ye,DIRTY:s$,OK:_i,isAborted:F3,isDirty:B3,isValid:A1,isAsync:P1,get util(){return kt},get objectUtil(){return $3},ZodParsedType:Ce,getParsedType:Rl,ZodType:ct,ZodString:os,ZodNumber:eu,ZodBigInt:tu,ZodBoolean:Eg,ZodDate:mc,ZodSymbol:R1,ZodUndefined:Ag,ZodNull:Pg,ZodAny:Lf,ZodUnknown:ic,ZodNever:Ga,ZodVoid:O1,ZodArray:cs,ZodObject:Tn,ZodUnion:Rg,ZodDiscriminatedUnion:yb,ZodIntersection:Og,ZodTuple:Xs,ZodRecord:kg,ZodMap:k1,ZodSet:yc,ZodFunction:ff,ZodLazy:Ig,ZodLiteral:Mg,ZodEnum:nu,ZodNativeEnum:Ng,ZodPromise:Df,ZodEffects:gs,ZodTransformer:gs,ZodOptional:Ma,ZodNullable:vc,ZodDefault:Lg,ZodCatch:I1,ZodNaN:M1,BRAND:Vle,ZodBranded:l$,ZodPipeline:Pm,custom:u$,Schema:ct,ZodSchema:ct,late:jle,get ZodFirstPartyTypeKind(){return qe},coerce:Cue,any:Qle,array:tue,bigint:Wle,boolean:f$,date:qle,discriminatedUnion:oue,effect:Q9,enum:pue,function:due,instanceof:Gle,intersection:sue,lazy:fue,literal:hue,map:uue,nan:Hle,nativeEnum:gue,never:Jle,null:Yle,nullable:vue,number:d$,object:nue,oboolean:xue,onumber:wue,optional:yue,ostring:Sue,pipeline:bue,preprocess:_ue,promise:mue,record:lue,set:cue,strictObject:rue,string:c$,symbol:Kle,transformer:Q9,tuple:aue,undefined:Xle,union:iue,unknown:Zle,void:eue,NEVER:Tue,ZodIssueCode:me,quotelessJson:Ple,ZodError:us});const Eue=Et.string(),PRe=e=>Eue.safeParse(e).success,Aue=Et.string(),RRe=e=>Aue.safeParse(e).success,Pue=Et.string(),ORe=e=>Pue.safeParse(e).success,Rue=Et.string(),kRe=e=>Rue.safeParse(e).success,Oue=Et.number().int().min(1),IRe=e=>Oue.safeParse(e).success,kue=Et.number().min(1),MRe=e=>kue.safeParse(e).success,Iue=Et.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a"]),NRe=e=>Iue.safeParse(e).success,LRe={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral"},Mue=Et.number().int().min(0).max(Ale),DRe=e=>Mue.safeParse(e).success,Nue=Et.number().multipleOf(8).min(64),$Re=e=>Nue.safeParse(e).success,Lue=Et.number().multipleOf(8).min(64),FRe=e=>Lue.safeParse(e).success,Rm=Et.enum(["sd-1","sd-2","sdxl","sdxl-refiner"]),$T=Et.object({model_name:Et.string().min(1),base_model:Rm,model_type:Et.literal("main")}),BRe=e=>$T.safeParse(e).success,h$=Et.object({model_name:Et.string().min(1),base_model:Et.literal("sdxl-refiner"),model_type:Et.literal("main")}),URe=e=>h$.safeParse(e).success,Due=Et.object({model_name:Et.string().min(1),base_model:Rm,model_type:Et.literal("onnx")}),p$=Et.union([$T,Due]),$ue=Et.object({model_name:Et.string().min(1),base_model:Rm}),zRe=Et.object({model_name:Et.string().min(1),base_model:Rm}),VRe=Et.object({model_name:Et.string().min(1),base_model:Rm}),Fue=Et.number().min(0).max(1),jRe=e=>Fue.safeParse(e).success;Et.enum(["fp16","fp32"]);const Bue=Et.number().min(1).max(10),GRe=e=>Bue.safeParse(e).success,Uue=Et.number().min(1).max(10),HRe=e=>Uue.safeParse(e).success,zue=Et.number().min(0).max(1),WRe=e=>zue.safeParse(e).success;Et.enum(["box","gaussian"]);const ys={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,shouldUseNoiseSettings:!1,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null},Vue=ys,g$=An({name:"generation",initialState:Vue,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=Ml(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=Ml(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},resetParametersState:e=>({...e,...ys}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setMaskBlur:(e,t)=>{e.maskBlur=t.payload},setMaskBlurMethod:(e,t)=>{e.maskBlurMethod=t.payload},setTileSize:(e,t)=>{e.tileSize=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},setShouldUseNoiseSettings:(e,t)=>{e.shouldUseNoiseSettings=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=Ele[e.model.base_model];e.clipSkip=Ml(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setShouldShowAdvancedOptions:(e,t)=>{e.shouldShowAdvancedOptions=t.payload,t.payload||(e.clipSkip=0)},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=Ns(e.width/n,8))}},extraReducers:e=>{e.addCase(Cle,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,s,a]=r.split("/"),l=$T.safeParse({model_name:a,base_model:o,model_type:s});l.success&&(t.model=l.data)}}),e.addCase(Gue,(t,n)=>{n.payload||(t.clipSkip=0)})}}),{clampSymmetrySteps:qRe,clearInitialImage:FT,resetParametersState:KRe,resetSeed:XRe,setCfgScale:YRe,setWidth:QRe,setHeight:ZRe,toggleSize:JRe,setImg2imgStrength:eOe,setInfillMethod:jue,setIterations:tOe,setPerlin:nOe,setPositivePrompt:rOe,setNegativePrompt:iOe,setScheduler:oOe,setMaskBlur:sOe,setMaskBlurMethod:aOe,setSeed:lOe,setSeedWeights:uOe,setShouldFitToWidthHeight:cOe,setShouldGenerateVariations:dOe,setShouldRandomizeSeed:fOe,setSteps:hOe,setThreshold:pOe,setTileSize:gOe,setVariationAmount:mOe,setShouldUseSymmetry:yOe,setHorizontalSymmetrySteps:vOe,setVerticalSymmetrySteps:_Oe,initialImageChanged:vb,modelChanged:Nl,vaeSelected:m$,setShouldUseNoiseSettings:bOe,setSeamlessXAxis:SOe,setSeamlessYAxis:wOe,setClipSkip:xOe,shouldUseCpuNoiseChanged:COe,setShouldShowAdvancedOptions:Gue,setAspectRatio:Hue,vaePrecisionChanged:TOe}=g$.actions,Wue=g$.reducer,y$=["txt2img","img2img","unifiedCanvas","nodes","modelManager","batch"],Z9=(e,t)=>{typeof t=="number"?e.activeTab=t:e.activeTab=y$.indexOf(t)},v$={activeTab:0,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldPinGallery:!0,shouldShowGallery:!0,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,favoriteSchedulers:[]},_$=An({name:"ui",initialState:v$,reducers:{setActiveTab:(e,t)=>{Z9(e,t.payload)},setShouldPinParametersPanel:(e,t)=>{e.shouldPinParametersPanel=t.payload,e.shouldShowParametersPanel=!0},setShouldShowParametersPanel:(e,t)=>{e.shouldShowParametersPanel=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowGallery:(e,t)=>{e.shouldShowGallery=t.payload},togglePinGalleryPanel:e=>{e.shouldPinGallery=!e.shouldPinGallery,e.shouldPinGallery||(e.shouldShowGallery=!0)},togglePinParametersPanel:e=>{e.shouldPinParametersPanel=!e.shouldPinParametersPanel,e.shouldPinParametersPanel||(e.shouldShowParametersPanel=!0)},toggleParametersPanel:e=>{e.shouldShowParametersPanel=!e.shouldShowParametersPanel},toggleGalleryPanel:e=>{e.shouldShowGallery=!e.shouldShowGallery},togglePanels:e=>{e.shouldShowGallery||e.shouldShowParametersPanel?(e.shouldShowGallery=!1,e.shouldShowParametersPanel=!1):(e.shouldShowGallery=!0,e.shouldShowParametersPanel=!0)},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker}},extraReducers(e){e.addCase(vb,t=>{Z9(t,"img2img")})}}),{setActiveTab:b$,setShouldPinParametersPanel:EOe,setShouldShowParametersPanel:AOe,setShouldShowImageDetails:POe,setShouldUseCanvasBetaLayout:que,setShouldShowExistingModelsInSearch:ROe,setShouldUseSliders:OOe,setShouldHidePreview:kOe,setShouldShowGallery:IOe,togglePanels:MOe,togglePinGalleryPanel:NOe,togglePinParametersPanel:LOe,toggleParametersPanel:DOe,toggleGalleryPanel:$Oe,setShouldShowProgressInViewer:FOe,favoriteSchedulersChanged:BOe,toggleEmbeddingPicker:UOe}=_$.actions,Kue=_$.reducer;let fi=[],Om=(e,t)=>{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let s=n.indexOf(i);~s&&(n.splice(s,2),r.lc--,r.lc||r.off())}},notify(i){let o=!fi.length;for(let s=0;s(e.events=e.events||{},e.events[n+P0]||(e.events[n+P0]=r(i=>{e.events[n].reduceRight((o,s)=>(s(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+P0](),delete e.events[n+P0])}),Que=1e3,Zue=(e,t)=>Yue(e,r=>{let i=t(r);i&&e.events[A0].push(i)},Xue,r=>{let i=e.listen;e.listen=(...s)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...s));let o=e.off;return e.events[A0]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let s of e.events[A0])s();e.events[A0]=[]}},Que)},()=>{e.listen=i,e.off=o}}),Jue=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(s=>s.get());(n===void 0||o.some((s,a)=>s!==n[a]))&&(n=o,i.set(t(...o)))},i=Om(void 0,Math.max(...e.map(o=>o.l))+1);return Zue(i,()=>{let o=e.map(s=>s.listen(r,i.l));return r(),()=>{for(let s of o)s()}}),i};const ece={"Content-Type":"application/json"},tce=/\/*$/;function nce(e){const t=new URLSearchParams;if(e&&typeof e=="object")for(const[n,r]of Object.entries(e))r!=null&&t.set(n,r);return t.toString()}function rce(e){return JSON.stringify(e)}function ice(e,t){let n=`${t.baseUrl?t.baseUrl.replace(tce,""):""}${e}`;if(t.params.path)for(const[r,i]of Object.entries(t.params.path))n=n.replace(`{${r}}`,encodeURIComponent(String(i)));if(t.params.query){const r=t.querySerializer(t.params.query);r&&(n+=`?${r}`)}return n}function oce(e={}){const{fetch:t=globalThis.fetch,querySerializer:n,bodySerializer:r,...i}=e,o=new Headers({...ece,...i.headers??{}});async function s(a,l){const{headers:u,body:d,params:f={},parseAs:h="json",querySerializer:g=n??nce,bodySerializer:m=r??rce,...v}=l||{},x=ice(a,{baseUrl:i.baseUrl,params:f,querySerializer:g}),_=new Headers(o),b=new Headers(u);for(const[T,E]of b.entries())E==null?_.delete(T):_.set(T,E);const y={redirect:"follow",...i,...v,headers:_};d&&(y.body=m(d)),y.body instanceof FormData&&_.delete("Content-Type");const S=await t(x,y);if(S.status===204||S.headers.get("Content-Length")==="0")return S.ok?{data:{},response:S}:{error:{},response:S};if(S.ok){let T=S.body;if(h!=="stream"){const E=S.clone();T=typeof E[h]=="function"?await E[h]():await E.text()}return{data:T,response:S}}let C={};try{C=await S.clone().json()}catch{C=await S.clone().text()}return{error:C,response:S}}return{async get(a,l){return s(a,{...l,method:"GET"})},async put(a,l){return s(a,{...l,method:"PUT"})},async post(a,l){return s(a,{...l,method:"POST"})},async del(a,l){return s(a,{...l,method:"DELETE"})},async options(a,l){return s(a,{...l,method:"OPTIONS"})},async head(a,l){return s(a,{...l,method:"HEAD"})},async patch(a,l){return s(a,{...l,method:"PATCH"})},async trace(a,l){return s(a,{...l,method:"TRACE"})}}}const Dg=Om(),$g=Om(),N1=Om(),_b=Jue([Dg,$g,N1],(e,t,n)=>oce({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`})),jr=Jl("api/sessionCreated",async(e,{rejectWithValue:t})=>{const{graph:n}=e,{post:r}=_b.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/",{body:n});return o?t({arg:e,status:s.status,error:o}):i}),sce=e=>vi(e)&&"status"in e,ace=e=>vi(e)&&"detail"in e,km=Jl("api/sessionInvoked",async(e,{rejectWithValue:t})=>{const{session_id:n}=e,{put:r}=_b.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/{session_id}/invoke",{params:{query:{all:!0},path:{session_id:n}}});if(o){if(sce(o)&&o.status===403)return t({arg:e,status:s.status,error:o.body.detail});if(ace(o)&&s.status===403)return t({arg:e,status:s.status,error:o.detail});if(o)return t({arg:e,status:s.status,error:o})}}),Oc=Jl("api/sessionCanceled",async(e,{rejectWithValue:t})=>{const{session_id:n}=e,{del:r}=_b.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/{session_id}/invoke",{params:{path:{session_id:n}}});return o?t({arg:e,error:o}):i});Jl("api/listSessions",async(e,{rejectWithValue:t})=>{const{params:n}=e,{get:r}=_b.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/",{params:n});return o?t({arg:e,error:o}):i});const S$=Lo(jr.rejected,km.rejected),pd=(e,t,n,r,i,o,s)=>{const a=Math.floor(e/2-(n+i/2)*s),l=Math.floor(t/2-(r+o/2)*s);return{x:a,y:l}},gd=(e,t,n,r,i=.95)=>{const o=e*i/n,s=t*i/r;return Math.min(1,Math.min(o,s))},zOe=.999,VOe=.1,jOe=20,np=.95,GOe=30,HOe=10,J9=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),Nu=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let s=t*n,a=448;for(;s1?(r.width=a,r.height=Ns(a/o,64)):o<1&&(r.height=a,r.width=Ns(a*o,64)),s=r.width*r.height;return r},lce=e=>({width:Ns(e.width,64),height:Ns(e.height,64)}),WOe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],qOe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],w$=e=>e.kind==="line"&&e.layer==="mask",KOe=e=>e.kind==="line"&&e.layer==="base",eR=e=>e.kind==="image"&&e.layer==="base",XOe=e=>e.kind==="fillRect"&&e.layer==="base",YOe=e=>e.kind==="eraseRect"&&e.layer==="base",uce=e=>e.kind==="line",Od={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},x$={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"none",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Od,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush"},C$=An({name:"canvas",initialState:x$,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(Qr(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!w$(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,s={width:T0(Ml(r,64,512),64),height:T0(Ml(i,64,512),64)},a={x:Ns(r/2-s.width/2,64),y:Ns(i/2-s.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const d=Nu(s);e.scaledBoundingBoxDimensions=d}e.boundingBoxDimensions=s,e.boundingBoxCoordinates=a,e.pastLayerStates.push(Qr(e.layerState)),e.layerState={...Od,objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.isCanvasInitialized=!1;const l=gd(o.width,o.height,r,i,np),u=pd(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u,e.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(e,t)=>{const n=lce(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=Nu(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=J9(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setDoesCanvasNeedScaling:(e,t)=>{e.doesCanvasNeedScaling=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},canvasSessionIdChanged:(e,t)=>{e.layerState.stagingArea.sessionId=t.payload},stagingAreaInitialized:(e,t)=>{const{sessionId:n,boundingBox:r}=t.payload;e.layerState.stagingArea={boundingBox:r,sessionId:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(Qr(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(Qr(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea={...Od.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingOutline=!0},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Qr(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(Qr(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:s}=e;if(n==="move"||n==="colorPicker")return;const a=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(Qr(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:a,points:t.payload,...l};s&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(uce);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Qr(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Qr(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(Qr(e.layerState)),e.layerState=Od,e.futureLayerStates=[]},setCanvasContainerDimensions:(e,t)=>{e.canvasContainerDimensions=t.payload},resizeAndScaleCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r=e.layerState.objects.find(eR),i={width:Math.floor(t),height:Math.floor(n)};if(!r){const d=gd(i.width,i.height,512,512,np),f=pd(i.width,i.height,0,0,512,512,d),h={width:512,height:512};if(e.stageScale=d,e.stageCoordinates=f,e.stageDimensions=i,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=h,e.boundingBoxScaleMethod==="auto"){const g=Nu(h);e.scaledBoundingBoxDimensions=g}return}const{width:o,height:s}=r,l=gd(t,n,o,s,.95),u=pd(i.width,i.height,0,0,o,s,l);e.minimumStageScale=l,e.stageScale=l,e.stageCoordinates=J9(u),e.stageDimensions=i,e.isCanvasInitialized=!0},resizeCanvas:e=>{const{width:t,height:n}=e.canvasContainerDimensions,r={width:Math.floor(t),height:Math.floor(n)};if(e.stageDimensions=r,!e.layerState.objects.find(eR)){const i=gd(r.width,r.height,512,512,np),o=pd(r.width,r.height,0,0,512,512,i),s={width:512,height:512};if(e.stageScale=i,e.stageCoordinates=o,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const a=Nu(s);e.scaledBoundingBoxDimensions=a}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:s,y:a,width:l,height:u}=n;if(l!==0&&u!==0){const d=r?1:gd(i,o,l,u,np),f=pd(i,o,s,a,l,u,d);e.stageScale=d,e.stageCoordinates=f}else{const d=gd(i,o,512,512,np),f=pd(i,o,0,0,512,512,d),h={width:512,height:512};if(e.stageScale=d,e.stageCoordinates=f,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=h,e.boundingBoxScaleMethod==="auto"){const g=Nu(h);e.scaledBoundingBoxDimensions=g}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex,n=e.layerState.stagingArea.images.length;e.layerState.stagingArea.selectedImageIndex=Math.min(t+1,n-1)},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex;e.layerState.stagingArea.selectedImageIndex=Math.max(t-1,0)},commitStagingAreaImage:(e,t)=>{if(!e.layerState.stagingArea.images.length)return;const{images:n,selectedImageIndex:r}=e.layerState.stagingArea;e.pastLayerStates.push(Qr(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const i=n[r];i&&e.layerState.objects.push({...i}),e.layerState.stagingArea={...Od.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,s=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>s){const a={width:T0(Ml(o,64,512),64),height:T0(Ml(s,64,512),64)},l={x:Ns(o/2-a.width/2,64),y:Ns(s/2-a.height/2,64)};if(e.boundingBoxDimensions=a,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=Nu(a);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=Nu(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldAntialias:(e,t)=>{e.shouldAntialias=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(Qr(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}},extraReducers:e=>{e.addCase(Oc.pending,t=>{t.layerState.stagingArea.images.length||(t.layerState.stagingArea=Od.stagingArea)}),e.addCase(que,t=>{t.doesCanvasNeedScaling=!0}),e.addCase(b$,t=>{t.doesCanvasNeedScaling=!0}),e.addCase(Hue,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=Ns(t.boundingBoxDimensions.width/r,64))})}}),{addEraseRect:QOe,addFillRect:ZOe,addImageToStagingArea:cce,addLine:JOe,addPointToCurrentLine:eke,clearCanvasHistory:tke,clearMask:nke,commitColorPickerColor:rke,commitStagingAreaImage:dce,discardStagedImages:ike,fitBoundingBoxToStage:oke,mouseLeftCanvas:ske,nextStagingAreaImage:ake,prevStagingAreaImage:lke,redo:uke,resetCanvas:BT,resetCanvasInteractionState:cke,resetCanvasView:dke,resizeAndScaleCanvas:fke,resizeCanvas:hke,setBoundingBoxCoordinates:pke,setBoundingBoxDimensions:gke,setBoundingBoxPreviewFill:mke,setBoundingBoxScaleMethod:yke,flipBoundingBoxAxes:vke,setBrushColor:_ke,setBrushSize:bke,setCanvasContainerDimensions:Ske,setColorPickerColor:wke,setCursorPosition:xke,setDoesCanvasNeedScaling:Cke,setInitialCanvasImage:T$,setIsDrawing:Tke,setIsMaskEnabled:Eke,setIsMouseOverBoundingBox:Ake,setIsMoveBoundingBoxKeyHeld:Pke,setIsMoveStageKeyHeld:Rke,setIsMovingBoundingBox:Oke,setIsMovingStage:kke,setIsTransformingBoundingBox:Ike,setLayer:Mke,setMaskColor:Nke,setMergedCanvas:fce,setShouldAutoSave:Lke,setShouldCropToBoundingBoxOnSave:Dke,setShouldDarkenOutsideBoundingBox:$ke,setShouldLockBoundingBox:Fke,setShouldPreserveMaskedArea:Bke,setShouldShowBoundingBox:Uke,setShouldShowBrush:zke,setShouldShowBrushPreview:Vke,setShouldShowCanvasDebugInfo:jke,setShouldShowCheckboardTransparency:Gke,setShouldShowGrid:Hke,setShouldShowIntermediates:Wke,setShouldShowStagingImage:qke,setShouldShowStagingOutline:Kke,setShouldSnapToGrid:Xke,setStageCoordinates:Yke,setStageScale:Qke,setTool:Zke,toggleShouldLockBoundingBox:Jke,toggleTool:eIe,undo:tIe,setScaledBoundingBoxDimensions:nIe,setShouldRestrictStrokesToBox:rIe,stagingAreaInitialized:hce,canvasSessionIdChanged:pce,setShouldAntialias:iIe}=C$.actions,gce=C$.reducer,Jr=["general"],Ll=["control","mask","user","other"],mce=100,tR=20;var L1={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 */L1.exports;(function(e,t){(function(){var n,r="4.17.21",i=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",a="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",u=500,d="__lodash_placeholder__",f=1,h=2,g=4,m=1,v=2,x=1,_=2,b=4,y=8,S=16,C=32,T=64,E=128,P=256,k=512,O=30,M="...",V=800,B=16,A=1,N=2,D=3,U=1/0,$=9007199254740991,j=17976931348623157e292,G=0/0,q=4294967295,Z=q-1,ee=q>>>1,ie=[["ary",E],["bind",x],["bindKey",_],["curry",y],["curryRight",S],["flip",k],["partial",C],["partialRight",T],["rearg",P]],se="[object Arguments]",le="[object Array]",W="[object AsyncFunction]",ne="[object Boolean]",fe="[object Date]",pe="[object DOMException]",ve="[object Error]",ye="[object Function]",Je="[object GeneratorFunction]",Fe="[object Map]",Ae="[object Number]",vt="[object Null]",_e="[object Object]",Qt="[object Promise]",rr="[object Proxy]",qt="[object RegExp]",ht="[object Set]",At="[object String]",un="[object Symbol]",Gr="[object Undefined]",Pr="[object WeakMap]",Ci="[object WeakSet]",In="[object ArrayBuffer]",gn="[object DataView]",ir="[object Float32Array]",mn="[object Float64Array]",Zt="[object Int8Array]",Rr="[object Int16Array]",Hr="[object Int32Array]",si="[object Uint8Array]",Vi="[object Uint8ClampedArray]",$n="[object Uint16Array]",ai="[object Uint32Array]",ra=/\b__p \+= '';/g,uo=/\b(__p \+=) '' \+/g,ia=/(__e\(.*?\)|\b__t\)) \+\n'';/g,nn=/&(?:amp|lt|gt|quot|#39);/g,Ft=/[&<>"']/g,or=RegExp(nn.source),qn=RegExp(Ft.source),yr=/<%-([\s\S]+?)%>/g,Or=/<%([\s\S]+?)%>/g,kr=/<%=([\s\S]+?)%>/g,co=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ir=/^\w*$/,sr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ji=/[\\^$.*+?()[\]{}|]/g,bs=RegExp(ji.source),fo=/^\s+/,tl=/\s/,Vo=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Mr=/\{\n\/\* \[wrapped with (.+)\] \*/,oa=/,? & /,hh=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ph=/[()=,{}\[\]\/\s]/,gh=/\\(\\)?/g,mh=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,jo=/\w*$/,yh=/^[-+]0x[0-9a-f]+$/i,vh=/^0b[01]+$/i,Gc=/^\[object .+?Constructor\]$/,_h=/^0o[0-7]+$/i,bh=/^(?:0|[1-9]\d*)$/,Sh=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ss=/($^)/,wh=/['\n\r\u2028\u2029\\]/g,Go="\\ud800-\\udfff",nl="\\u0300-\\u036f",xh="\\ufe20-\\ufe2f",rl="\\u20d0-\\u20ff",Cu=nl+xh+rl,Hc="\\u2700-\\u27bf",il="a-z\\xdf-\\xf6\\xf8-\\xff",A2="\\xac\\xb1\\xd7\\xf7",ry="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",P2="\\u2000-\\u206f",R2=" \\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",iy="A-Z\\xc0-\\xd6\\xd8-\\xde",oy="\\ufe0e\\ufe0f",sy=A2+ry+P2+R2,Ch="['’]",O2="["+Go+"]",ay="["+sy+"]",Wc="["+Cu+"]",ly="\\d+",qc="["+Hc+"]",Kc="["+il+"]",uy="[^"+Go+sy+ly+Hc+il+iy+"]",Th="\\ud83c[\\udffb-\\udfff]",cy="(?:"+Wc+"|"+Th+")",dy="[^"+Go+"]",Eh="(?:\\ud83c[\\udde6-\\uddff]){2}",Ah="[\\ud800-\\udbff][\\udc00-\\udfff]",sa="["+iy+"]",fy="\\u200d",hy="(?:"+Kc+"|"+uy+")",k2="(?:"+sa+"|"+uy+")",Xc="(?:"+Ch+"(?:d|ll|m|re|s|t|ve))?",py="(?:"+Ch+"(?:D|LL|M|RE|S|T|VE))?",gy=cy+"?",my="["+oy+"]?",Yc="(?:"+fy+"(?:"+[dy,Eh,Ah].join("|")+")"+my+gy+")*",Ph="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Rh="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Qc=my+gy+Yc,I2="(?:"+[qc,Eh,Ah].join("|")+")"+Qc,yy="(?:"+[dy+Wc+"?",Wc,Eh,Ah,O2].join("|")+")",Oh=RegExp(Ch,"g"),vy=RegExp(Wc,"g"),Ho=RegExp(Th+"(?="+Th+")|"+yy+Qc,"g"),Tu=RegExp([sa+"?"+Kc+"+"+Xc+"(?="+[ay,sa,"$"].join("|")+")",k2+"+"+py+"(?="+[ay,sa+hy,"$"].join("|")+")",sa+"?"+hy+"+"+Xc,sa+"+"+py,Rh,Ph,ly,I2].join("|"),"g"),M2=RegExp("["+fy+Go+Cu+oy+"]"),_y=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,N2=["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"],by=-1,Jt={};Jt[ir]=Jt[mn]=Jt[Zt]=Jt[Rr]=Jt[Hr]=Jt[si]=Jt[Vi]=Jt[$n]=Jt[ai]=!0,Jt[se]=Jt[le]=Jt[In]=Jt[ne]=Jt[gn]=Jt[fe]=Jt[ve]=Jt[ye]=Jt[Fe]=Jt[Ae]=Jt[_e]=Jt[qt]=Jt[ht]=Jt[At]=Jt[Pr]=!1;var Kt={};Kt[se]=Kt[le]=Kt[In]=Kt[gn]=Kt[ne]=Kt[fe]=Kt[ir]=Kt[mn]=Kt[Zt]=Kt[Rr]=Kt[Hr]=Kt[Fe]=Kt[Ae]=Kt[_e]=Kt[qt]=Kt[ht]=Kt[At]=Kt[un]=Kt[si]=Kt[Vi]=Kt[$n]=Kt[ai]=!0,Kt[ve]=Kt[ye]=Kt[Pr]=!1;var Sy={À:"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"},L2={"&":"&","<":"<",">":">",'"':""","'":"'"},H={"&":"&","<":"<",">":">",""":'"',"'":"'"},Y={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},re=parseFloat,xe=parseInt,pt=typeof Ze=="object"&&Ze&&Ze.Object===Object&&Ze,Ut=typeof self=="object"&&self&&self.Object===Object&&self,et=pt||Ut||Function("return this")(),at=t&&!t.nodeType&&t,Rt=at&&!0&&e&&!e.nodeType&&e,li=Rt&&Rt.exports===at,Nr=li&&pt.process,vr=function(){try{var J=Rt&&Rt.require&&Rt.require("util").types;return J||Nr&&Nr.binding&&Nr.binding("util")}catch{}}(),Zc=vr&&vr.isArrayBuffer,Jc=vr&&vr.isDate,kh=vr&&vr.isMap,UA=vr&&vr.isRegExp,zA=vr&&vr.isSet,VA=vr&&vr.isTypedArray;function Gi(J,ae,oe){switch(oe.length){case 0:return J.call(ae);case 1:return J.call(ae,oe[0]);case 2:return J.call(ae,oe[0],oe[1]);case 3:return J.call(ae,oe[0],oe[1],oe[2])}return J.apply(ae,oe)}function NG(J,ae,oe,Te){for(var Xe=-1,Nt=J==null?0:J.length;++Xe-1}function D2(J,ae,oe){for(var Te=-1,Xe=J==null?0:J.length;++Te-1;);return oe}function YA(J,ae){for(var oe=J.length;oe--&&ed(ae,J[oe],0)>-1;);return oe}function jG(J,ae){for(var oe=J.length,Te=0;oe--;)J[oe]===ae&&++Te;return Te}var GG=U2(Sy),HG=U2(L2);function WG(J){return"\\"+Y[J]}function qG(J,ae){return J==null?n:J[ae]}function td(J){return M2.test(J)}function KG(J){return _y.test(J)}function XG(J){for(var ae,oe=[];!(ae=J.next()).done;)oe.push(ae.value);return oe}function G2(J){var ae=-1,oe=Array(J.size);return J.forEach(function(Te,Xe){oe[++ae]=[Xe,Te]}),oe}function QA(J,ae){return function(oe){return J(ae(oe))}}function al(J,ae){for(var oe=-1,Te=J.length,Xe=0,Nt=[];++oe-1}function DH(c,p){var w=this.__data__,R=By(w,c);return R<0?(++this.size,w.push([c,p])):w[R][1]=p,this}aa.prototype.clear=IH,aa.prototype.delete=MH,aa.prototype.get=NH,aa.prototype.has=LH,aa.prototype.set=DH;function la(c){var p=-1,w=c==null?0:c.length;for(this.clear();++p=p?c:p)),c}function mo(c,p,w,R,I,z){var K,X=p&f,te=p&h,ce=p&g;if(w&&(K=I?w(c,R,I,z):w(c)),K!==n)return K;if(!xn(c))return c;var de=Qe(c);if(de){if(K=UW(c),!X)return Ti(c,K)}else{var he=qr(c),be=he==ye||he==Je;if(hl(c))return M6(c,X);if(he==_e||he==se||be&&!I){if(K=te||be?{}:Z6(c),!X)return te?RW(c,ZH(K,c)):PW(c,u6(K,c))}else{if(!Kt[he])return I?c:{};K=zW(c,he,X)}}z||(z=new qo);var Ne=z.get(c);if(Ne)return Ne;z.set(c,K),AP(c)?c.forEach(function(Ge){K.add(mo(Ge,p,w,Ge,c,z))}):TP(c)&&c.forEach(function(Ge,gt){K.set(gt,mo(Ge,p,w,gt,c,z))});var je=ce?te?mw:gw:te?Ai:_r,st=de?n:je(c);return ho(st||c,function(Ge,gt){st&&(gt=Ge,Ge=c[gt]),Fh(K,gt,mo(Ge,p,w,gt,c,z))}),K}function JH(c){var p=_r(c);return function(w){return c6(w,c,p)}}function c6(c,p,w){var R=w.length;if(c==null)return!R;for(c=en(c);R--;){var I=w[R],z=p[I],K=c[I];if(K===n&&!(I in c)||!z(K))return!1}return!0}function d6(c,p,w){if(typeof c!="function")throw new po(s);return Hh(function(){c.apply(n,w)},p)}function Bh(c,p,w,R){var I=-1,z=wy,K=!0,X=c.length,te=[],ce=p.length;if(!X)return te;w&&(p=yn(p,Hi(w))),R?(z=D2,K=!1):p.length>=i&&(z=Ih,K=!1,p=new Pu(p));e:for(;++II?0:I+w),R=R===n||R>I?I:rt(R),R<0&&(R+=I),R=w>R?0:RP(R);w0&&w(X)?p>1?Lr(X,p-1,w,R,I):sl(I,X):R||(I[I.length]=X)}return I}var Q2=B6(),p6=B6(!0);function ws(c,p){return c&&Q2(c,p,_r)}function Z2(c,p){return c&&p6(c,p,_r)}function zy(c,p){return ol(p,function(w){return ha(c[w])})}function Ou(c,p){p=dl(p,c);for(var w=0,R=p.length;c!=null&&wp}function nW(c,p){return c!=null&&zt.call(c,p)}function rW(c,p){return c!=null&&p in en(c)}function iW(c,p,w){return c>=Wr(p,w)&&c=120&&de.length>=120)?new Pu(K&&de):n}de=c[0];var he=-1,be=X[0];e:for(;++he-1;)X!==c&&Iy.call(X,te,1),Iy.call(c,te,1);return c}function T6(c,p){for(var w=c?p.length:0,R=w-1;w--;){var I=p[w];if(w==R||I!==z){var z=I;fa(I)?Iy.call(c,I,1):lw(c,I)}}return c}function ow(c,p){return c+Ly(o6()*(p-c+1))}function yW(c,p,w,R){for(var I=-1,z=lr(Ny((p-c)/(w||1)),0),K=oe(z);z--;)K[R?z:++I]=c,c+=w;return K}function sw(c,p){var w="";if(!c||p<1||p>$)return w;do p%2&&(w+=c),p=Ly(p/2),p&&(c+=c);while(p);return w}function lt(c,p){return xw(tP(c,p,Pi),c+"")}function vW(c){return l6(fd(c))}function _W(c,p){var w=fd(c);return Zy(w,Ru(p,0,w.length))}function Vh(c,p,w,R){if(!xn(c))return c;p=dl(p,c);for(var I=-1,z=p.length,K=z-1,X=c;X!=null&&++II?0:I+p),w=w>I?I:w,w<0&&(w+=I),I=p>w?0:w-p>>>0,p>>>=0;for(var z=oe(I);++R>>1,K=c[z];K!==null&&!qi(K)&&(w?K<=p:K=i){var ce=p?null:MW(c);if(ce)return Cy(ce);K=!1,I=Ih,te=new Pu}else te=p?[]:X;e:for(;++R=R?c:yo(c,p,w)}var I6=cH||function(c){return et.clearTimeout(c)};function M6(c,p){if(p)return c.slice();var w=c.length,R=e6?e6(w):new c.constructor(w);return c.copy(R),R}function fw(c){var p=new c.constructor(c.byteLength);return new Oy(p).set(new Oy(c)),p}function CW(c,p){var w=p?fw(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.byteLength)}function TW(c){var p=new c.constructor(c.source,jo.exec(c));return p.lastIndex=c.lastIndex,p}function EW(c){return $h?en($h.call(c)):{}}function N6(c,p){var w=p?fw(c.buffer):c.buffer;return new c.constructor(w,c.byteOffset,c.length)}function L6(c,p){if(c!==p){var w=c!==n,R=c===null,I=c===c,z=qi(c),K=p!==n,X=p===null,te=p===p,ce=qi(p);if(!X&&!ce&&!z&&c>p||z&&K&&te&&!X&&!ce||R&&K&&te||!w&&te||!I)return 1;if(!R&&!z&&!ce&&c=X)return te;var ce=w[R];return te*(ce=="desc"?-1:1)}}return c.index-p.index}function D6(c,p,w,R){for(var I=-1,z=c.length,K=w.length,X=-1,te=p.length,ce=lr(z-K,0),de=oe(te+ce),he=!R;++X1?w[I-1]:n,K=I>2?w[2]:n;for(z=c.length>3&&typeof z=="function"?(I--,z):n,K&&ci(w[0],w[1],K)&&(z=I<3?n:z,I=1),p=en(p);++R-1?I[z?p[K]:K]:n}}function V6(c){return da(function(p){var w=p.length,R=w,I=go.prototype.thru;for(c&&p.reverse();R--;){var z=p[R];if(typeof z!="function")throw new po(s);if(I&&!K&&Yy(z)=="wrapper")var K=new go([],!0)}for(R=K?R:w;++R1&&Ct.reverse(),de&&teX))return!1;var ce=z.get(c),de=z.get(p);if(ce&&de)return ce==p&&de==c;var he=-1,be=!0,Ne=w&v?new Pu:n;for(z.set(c,p),z.set(p,c);++he1?"& ":"")+p[R],p=p.join(w>2?", ":" "),c.replace(Vo,`{ /* [wrapped with `+p+`] */ `)}function jW(c){return Qe(c)||Mu(c)||!!(r6&&c&&c[r6])}function fa(c,p){var w=typeof c;return p=p??$,!!p&&(w=="number"||w!="symbol"&&bh.test(c))&&c>-1&&c%1==0&&c0){if(++p>=V)return arguments[0]}else p=0;return c.apply(n,arguments)}}function Zy(c,p){var w=-1,R=c.length,I=R-1;for(p=p===n?R:p;++w1?c[p-1]:n;return w=typeof w=="function"?(c.pop(),w):n,hP(c,w)});function pP(c){var p=F(c);return p.__chain__=!0,p}function eK(c,p){return p(c),c}function Jy(c,p){return p(c)}var tK=da(function(c){var p=c.length,w=p?c[0]:0,R=this.__wrapped__,I=function(z){return Y2(z,c)};return p>1||this.__actions__.length||!(R instanceof _t)||!fa(w)?this.thru(I):(R=R.slice(w,+w+(p?1:0)),R.__actions__.push({func:Jy,args:[I],thisArg:n}),new go(R,this.__chain__).thru(function(z){return p&&!z.length&&z.push(n),z}))});function nK(){return pP(this)}function rK(){return new go(this.value(),this.__chain__)}function iK(){this.__values__===n&&(this.__values__=PP(this.value()));var c=this.__index__>=this.__values__.length,p=c?n:this.__values__[this.__index__++];return{done:c,value:p}}function oK(){return this}function sK(c){for(var p,w=this;w instanceof Fy;){var R=aP(w);R.__index__=0,R.__values__=n,p?I.__wrapped__=R:p=R;var I=R;w=w.__wrapped__}return I.__wrapped__=c,p}function aK(){var c=this.__wrapped__;if(c instanceof _t){var p=c;return this.__actions__.length&&(p=new _t(this)),p=p.reverse(),p.__actions__.push({func:Jy,args:[Cw],thisArg:n}),new go(p,this.__chain__)}return this.thru(Cw)}function lK(){return O6(this.__wrapped__,this.__actions__)}var uK=Hy(function(c,p,w){zt.call(c,w)?++c[w]:ua(c,w,1)});function cK(c,p,w){var R=Qe(c)?jA:eW;return w&&ci(c,p,w)&&(p=n),R(c,Ve(p,3))}function dK(c,p){var w=Qe(c)?ol:h6;return w(c,Ve(p,3))}var fK=z6(lP),hK=z6(uP);function pK(c,p){return Lr(e0(c,p),1)}function gK(c,p){return Lr(e0(c,p),U)}function mK(c,p,w){return w=w===n?1:rt(w),Lr(e0(c,p),w)}function gP(c,p){var w=Qe(c)?ho:ul;return w(c,Ve(p,3))}function mP(c,p){var w=Qe(c)?LG:f6;return w(c,Ve(p,3))}var yK=Hy(function(c,p,w){zt.call(c,w)?c[w].push(p):ua(c,w,[p])});function vK(c,p,w,R){c=Ei(c)?c:fd(c),w=w&&!R?rt(w):0;var I=c.length;return w<0&&(w=lr(I+w,0)),o0(c)?w<=I&&c.indexOf(p,w)>-1:!!I&&ed(c,p,w)>-1}var _K=lt(function(c,p,w){var R=-1,I=typeof p=="function",z=Ei(c)?oe(c.length):[];return ul(c,function(K){z[++R]=I?Gi(p,K,w):Uh(K,p,w)}),z}),bK=Hy(function(c,p,w){ua(c,w,p)});function e0(c,p){var w=Qe(c)?yn:_6;return w(c,Ve(p,3))}function SK(c,p,w,R){return c==null?[]:(Qe(p)||(p=p==null?[]:[p]),w=R?n:w,Qe(w)||(w=w==null?[]:[w]),x6(c,p,w))}var wK=Hy(function(c,p,w){c[w?0:1].push(p)},function(){return[[],[]]});function xK(c,p,w){var R=Qe(c)?$2:qA,I=arguments.length<3;return R(c,Ve(p,4),w,I,ul)}function CK(c,p,w){var R=Qe(c)?DG:qA,I=arguments.length<3;return R(c,Ve(p,4),w,I,f6)}function TK(c,p){var w=Qe(c)?ol:h6;return w(c,r0(Ve(p,3)))}function EK(c){var p=Qe(c)?l6:vW;return p(c)}function AK(c,p,w){(w?ci(c,p,w):p===n)?p=1:p=rt(p);var R=Qe(c)?XH:_W;return R(c,p)}function PK(c){var p=Qe(c)?YH:SW;return p(c)}function RK(c){if(c==null)return 0;if(Ei(c))return o0(c)?nd(c):c.length;var p=qr(c);return p==Fe||p==ht?c.size:nw(c).length}function OK(c,p,w){var R=Qe(c)?F2:wW;return w&&ci(c,p,w)&&(p=n),R(c,Ve(p,3))}var kK=lt(function(c,p){if(c==null)return[];var w=p.length;return w>1&&ci(c,p[0],p[1])?p=[]:w>2&&ci(p[0],p[1],p[2])&&(p=[p[0]]),x6(c,Lr(p,1),[])}),t0=dH||function(){return et.Date.now()};function IK(c,p){if(typeof p!="function")throw new po(s);return c=rt(c),function(){if(--c<1)return p.apply(this,arguments)}}function yP(c,p,w){return p=w?n:p,p=c&&p==null?c.length:p,ca(c,E,n,n,n,n,p)}function vP(c,p){var w;if(typeof p!="function")throw new po(s);return c=rt(c),function(){return--c>0&&(w=p.apply(this,arguments)),c<=1&&(p=n),w}}var Ew=lt(function(c,p,w){var R=x;if(w.length){var I=al(w,cd(Ew));R|=C}return ca(c,R,p,w,I)}),_P=lt(function(c,p,w){var R=x|_;if(w.length){var I=al(w,cd(_P));R|=C}return ca(p,R,c,w,I)});function bP(c,p,w){p=w?n:p;var R=ca(c,y,n,n,n,n,n,p);return R.placeholder=bP.placeholder,R}function SP(c,p,w){p=w?n:p;var R=ca(c,S,n,n,n,n,n,p);return R.placeholder=SP.placeholder,R}function wP(c,p,w){var R,I,z,K,X,te,ce=0,de=!1,he=!1,be=!0;if(typeof c!="function")throw new po(s);p=_o(p)||0,xn(w)&&(de=!!w.leading,he="maxWait"in w,z=he?lr(_o(w.maxWait)||0,p):z,be="trailing"in w?!!w.trailing:be);function Ne(Bn){var Xo=R,ga=I;return R=I=n,ce=Bn,K=c.apply(ga,Xo),K}function je(Bn){return ce=Bn,X=Hh(gt,p),de?Ne(Bn):K}function st(Bn){var Xo=Bn-te,ga=Bn-ce,zP=p-Xo;return he?Wr(zP,z-ga):zP}function Ge(Bn){var Xo=Bn-te,ga=Bn-ce;return te===n||Xo>=p||Xo<0||he&&ga>=z}function gt(){var Bn=t0();if(Ge(Bn))return Ct(Bn);X=Hh(gt,st(Bn))}function Ct(Bn){return X=n,be&&R?Ne(Bn):(R=I=n,K)}function Ki(){X!==n&&I6(X),ce=0,R=te=I=X=n}function di(){return X===n?K:Ct(t0())}function Xi(){var Bn=t0(),Xo=Ge(Bn);if(R=arguments,I=this,te=Bn,Xo){if(X===n)return je(te);if(he)return I6(X),X=Hh(gt,p),Ne(te)}return X===n&&(X=Hh(gt,p)),K}return Xi.cancel=Ki,Xi.flush=di,Xi}var MK=lt(function(c,p){return d6(c,1,p)}),NK=lt(function(c,p,w){return d6(c,_o(p)||0,w)});function LK(c){return ca(c,k)}function n0(c,p){if(typeof c!="function"||p!=null&&typeof p!="function")throw new po(s);var w=function(){var R=arguments,I=p?p.apply(this,R):R[0],z=w.cache;if(z.has(I))return z.get(I);var K=c.apply(this,R);return w.cache=z.set(I,K)||z,K};return w.cache=new(n0.Cache||la),w}n0.Cache=la;function r0(c){if(typeof c!="function")throw new po(s);return function(){var p=arguments;switch(p.length){case 0:return!c.call(this);case 1:return!c.call(this,p[0]);case 2:return!c.call(this,p[0],p[1]);case 3:return!c.call(this,p[0],p[1],p[2])}return!c.apply(this,p)}}function DK(c){return vP(2,c)}var $K=xW(function(c,p){p=p.length==1&&Qe(p[0])?yn(p[0],Hi(Ve())):yn(Lr(p,1),Hi(Ve()));var w=p.length;return lt(function(R){for(var I=-1,z=Wr(R.length,w);++I=p}),Mu=m6(function(){return arguments}())?m6:function(c){return Mn(c)&&zt.call(c,"callee")&&!n6.call(c,"callee")},Qe=oe.isArray,ZK=Zc?Hi(Zc):sW;function Ei(c){return c!=null&&i0(c.length)&&!ha(c)}function Fn(c){return Mn(c)&&Ei(c)}function JK(c){return c===!0||c===!1||Mn(c)&&ui(c)==ne}var hl=hH||Fw,eX=Jc?Hi(Jc):aW;function tX(c){return Mn(c)&&c.nodeType===1&&!Wh(c)}function nX(c){if(c==null)return!0;if(Ei(c)&&(Qe(c)||typeof c=="string"||typeof c.splice=="function"||hl(c)||dd(c)||Mu(c)))return!c.length;var p=qr(c);if(p==Fe||p==ht)return!c.size;if(Gh(c))return!nw(c).length;for(var w in c)if(zt.call(c,w))return!1;return!0}function rX(c,p){return zh(c,p)}function iX(c,p,w){w=typeof w=="function"?w:n;var R=w?w(c,p):n;return R===n?zh(c,p,n,w):!!R}function Pw(c){if(!Mn(c))return!1;var p=ui(c);return p==ve||p==pe||typeof c.message=="string"&&typeof c.name=="string"&&!Wh(c)}function oX(c){return typeof c=="number"&&i6(c)}function ha(c){if(!xn(c))return!1;var p=ui(c);return p==ye||p==Je||p==W||p==rr}function CP(c){return typeof c=="number"&&c==rt(c)}function i0(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=$}function xn(c){var p=typeof c;return c!=null&&(p=="object"||p=="function")}function Mn(c){return c!=null&&typeof c=="object"}var TP=kh?Hi(kh):uW;function sX(c,p){return c===p||tw(c,p,vw(p))}function aX(c,p,w){return w=typeof w=="function"?w:n,tw(c,p,vw(p),w)}function lX(c){return EP(c)&&c!=+c}function uX(c){if(WW(c))throw new Xe(o);return y6(c)}function cX(c){return c===null}function dX(c){return c==null}function EP(c){return typeof c=="number"||Mn(c)&&ui(c)==Ae}function Wh(c){if(!Mn(c)||ui(c)!=_e)return!1;var p=ky(c);if(p===null)return!0;var w=zt.call(p,"constructor")&&p.constructor;return typeof w=="function"&&w instanceof w&&Ay.call(w)==aH}var Rw=UA?Hi(UA):cW;function fX(c){return CP(c)&&c>=-$&&c<=$}var AP=zA?Hi(zA):dW;function o0(c){return typeof c=="string"||!Qe(c)&&Mn(c)&&ui(c)==At}function qi(c){return typeof c=="symbol"||Mn(c)&&ui(c)==un}var dd=VA?Hi(VA):fW;function hX(c){return c===n}function pX(c){return Mn(c)&&qr(c)==Pr}function gX(c){return Mn(c)&&ui(c)==Ci}var mX=Xy(rw),yX=Xy(function(c,p){return c<=p});function PP(c){if(!c)return[];if(Ei(c))return o0(c)?Wo(c):Ti(c);if(Mh&&c[Mh])return XG(c[Mh]());var p=qr(c),w=p==Fe?G2:p==ht?Cy:fd;return w(c)}function pa(c){if(!c)return c===0?c:0;if(c=_o(c),c===U||c===-U){var p=c<0?-1:1;return p*j}return c===c?c:0}function rt(c){var p=pa(c),w=p%1;return p===p?w?p-w:p:0}function RP(c){return c?Ru(rt(c),0,q):0}function _o(c){if(typeof c=="number")return c;if(qi(c))return G;if(xn(c)){var p=typeof c.valueOf=="function"?c.valueOf():c;c=xn(p)?p+"":p}if(typeof c!="string")return c===0?c:+c;c=KA(c);var w=vh.test(c);return w||_h.test(c)?xe(c.slice(2),w?2:8):yh.test(c)?G:+c}function OP(c){return xs(c,Ai(c))}function vX(c){return c?Ru(rt(c),-$,$):c===0?c:0}function Bt(c){return c==null?"":Wi(c)}var _X=ld(function(c,p){if(Gh(p)||Ei(p)){xs(p,_r(p),c);return}for(var w in p)zt.call(p,w)&&Fh(c,w,p[w])}),kP=ld(function(c,p){xs(p,Ai(p),c)}),s0=ld(function(c,p,w,R){xs(p,Ai(p),c,R)}),bX=ld(function(c,p,w,R){xs(p,_r(p),c,R)}),SX=da(Y2);function wX(c,p){var w=ad(c);return p==null?w:u6(w,p)}var xX=lt(function(c,p){c=en(c);var w=-1,R=p.length,I=R>2?p[2]:n;for(I&&ci(p[0],p[1],I)&&(R=1);++w1),z}),xs(c,mw(c),w),R&&(w=mo(w,f|h|g,NW));for(var I=p.length;I--;)lw(w,p[I]);return w});function zX(c,p){return MP(c,r0(Ve(p)))}var VX=da(function(c,p){return c==null?{}:gW(c,p)});function MP(c,p){if(c==null)return{};var w=yn(mw(c),function(R){return[R]});return p=Ve(p),C6(c,w,function(R,I){return p(R,I[0])})}function jX(c,p,w){p=dl(p,c);var R=-1,I=p.length;for(I||(I=1,c=n);++Rp){var R=c;c=p,p=R}if(w||c%1||p%1){var I=o6();return Wr(c+I*(p-c+re("1e-"+((I+"").length-1))),p)}return ow(c,p)}var eY=ud(function(c,p,w){return p=p.toLowerCase(),c+(w?DP(p):p)});function DP(c){return Iw(Bt(c).toLowerCase())}function $P(c){return c=Bt(c),c&&c.replace(Sh,GG).replace(vy,"")}function tY(c,p,w){c=Bt(c),p=Wi(p);var R=c.length;w=w===n?R:Ru(rt(w),0,R);var I=w;return w-=p.length,w>=0&&c.slice(w,I)==p}function nY(c){return c=Bt(c),c&&qn.test(c)?c.replace(Ft,HG):c}function rY(c){return c=Bt(c),c&&bs.test(c)?c.replace(ji,"\\$&"):c}var iY=ud(function(c,p,w){return c+(w?"-":"")+p.toLowerCase()}),oY=ud(function(c,p,w){return c+(w?" ":"")+p.toLowerCase()}),sY=U6("toLowerCase");function aY(c,p,w){c=Bt(c),p=rt(p);var R=p?nd(c):0;if(!p||R>=p)return c;var I=(p-R)/2;return Ky(Ly(I),w)+c+Ky(Ny(I),w)}function lY(c,p,w){c=Bt(c),p=rt(p);var R=p?nd(c):0;return p&&R>>0,w?(c=Bt(c),c&&(typeof p=="string"||p!=null&&!Rw(p))&&(p=Wi(p),!p&&td(c))?fl(Wo(c),0,w):c.split(p,w)):[]}var gY=ud(function(c,p,w){return c+(w?" ":"")+Iw(p)});function mY(c,p,w){return c=Bt(c),w=w==null?0:Ru(rt(w),0,c.length),p=Wi(p),c.slice(w,w+p.length)==p}function yY(c,p,w){var R=F.templateSettings;w&&ci(c,p,w)&&(p=n),c=Bt(c),p=s0({},p,R,q6);var I=s0({},p.imports,R.imports,q6),z=_r(I),K=j2(I,z),X,te,ce=0,de=p.interpolate||Ss,he="__p += '",be=H2((p.escape||Ss).source+"|"+de.source+"|"+(de===kr?mh:Ss).source+"|"+(p.evaluate||Ss).source+"|$","g"),Ne="//# sourceURL="+(zt.call(p,"sourceURL")?(p.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++by+"]")+` `;c.replace(be,function(Ge,gt,Ct,Ki,di,Xi){return Ct||(Ct=Ki),he+=c.slice(ce,Xi).replace(wh,WG),gt&&(X=!0,he+=`' + __e(`+gt+`) + '`),di&&(te=!0,he+=`'; `+di+`; __p += '`),Ct&&(he+=`' + ((__t = (`+Ct+`)) == null ? '' : __t) + '`),ce=Xi+Ge.length,Ge}),he+=`'; `;var je=zt.call(p,"variable")&&p.variable;if(!je)he=`with (obj) { `+he+` } `;else if(ph.test(je))throw new Xe(a);he=(te?he.replace(ra,""):he).replace(uo,"$1").replace(ia,"$1;"),he="function("+(je||"obj")+`) { `+(je?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(X?", __e = _.escape":"")+(te?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+he+`return __p }`;var st=BP(function(){return Nt(z,Ne+"return "+he).apply(n,K)});if(st.source=he,Pw(st))throw st;return st}function vY(c){return Bt(c).toLowerCase()}function _Y(c){return Bt(c).toUpperCase()}function bY(c,p,w){if(c=Bt(c),c&&(w||p===n))return KA(c);if(!c||!(p=Wi(p)))return c;var R=Wo(c),I=Wo(p),z=XA(R,I),K=YA(R,I)+1;return fl(R,z,K).join("")}function SY(c,p,w){if(c=Bt(c),c&&(w||p===n))return c.slice(0,ZA(c)+1);if(!c||!(p=Wi(p)))return c;var R=Wo(c),I=YA(R,Wo(p))+1;return fl(R,0,I).join("")}function wY(c,p,w){if(c=Bt(c),c&&(w||p===n))return c.replace(fo,"");if(!c||!(p=Wi(p)))return c;var R=Wo(c),I=XA(R,Wo(p));return fl(R,I).join("")}function xY(c,p){var w=O,R=M;if(xn(p)){var I="separator"in p?p.separator:I;w="length"in p?rt(p.length):w,R="omission"in p?Wi(p.omission):R}c=Bt(c);var z=c.length;if(td(c)){var K=Wo(c);z=K.length}if(w>=z)return c;var X=w-nd(R);if(X<1)return R;var te=K?fl(K,0,X).join(""):c.slice(0,X);if(I===n)return te+R;if(K&&(X+=te.length-X),Rw(I)){if(c.slice(X).search(I)){var ce,de=te;for(I.global||(I=H2(I.source,Bt(jo.exec(I))+"g")),I.lastIndex=0;ce=I.exec(de);)var he=ce.index;te=te.slice(0,he===n?X:he)}}else if(c.indexOf(Wi(I),X)!=X){var be=te.lastIndexOf(I);be>-1&&(te=te.slice(0,be))}return te+R}function CY(c){return c=Bt(c),c&&or.test(c)?c.replace(nn,JG):c}var TY=ud(function(c,p,w){return c+(w?" ":"")+p.toUpperCase()}),Iw=U6("toUpperCase");function FP(c,p,w){return c=Bt(c),p=w?n:p,p===n?KG(c)?nH(c):BG(c):c.match(p)||[]}var BP=lt(function(c,p){try{return Gi(c,n,p)}catch(w){return Pw(w)?w:new Xe(w)}}),EY=da(function(c,p){return ho(p,function(w){w=Cs(w),ua(c,w,Ew(c[w],c))}),c});function AY(c){var p=c==null?0:c.length,w=Ve();return c=p?yn(c,function(R){if(typeof R[1]!="function")throw new po(s);return[w(R[0]),R[1]]}):[],lt(function(R){for(var I=-1;++I$)return[];var w=q,R=Wr(c,q);p=Ve(p),c-=q;for(var I=V2(R,p);++w0||p<0)?new _t(w):(c<0?w=w.takeRight(-c):c&&(w=w.drop(c)),p!==n&&(p=rt(p),w=p<0?w.dropRight(-p):w.take(p-c)),w)},_t.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},_t.prototype.toArray=function(){return this.take(q)},ws(_t.prototype,function(c,p){var w=/^(?:filter|find|map|reject)|While$/.test(p),R=/^(?:head|last)$/.test(p),I=F[R?"take"+(p=="last"?"Right":""):p],z=R||/^find/.test(p);I&&(F.prototype[p]=function(){var K=this.__wrapped__,X=R?[1]:arguments,te=K instanceof _t,ce=X[0],de=te||Qe(K),he=function(gt){var Ct=I.apply(F,sl([gt],X));return R&&be?Ct[0]:Ct};de&&w&&typeof ce=="function"&&ce.length!=1&&(te=de=!1);var be=this.__chain__,Ne=!!this.__actions__.length,je=z&&!be,st=te&&!Ne;if(!z&&de){K=st?K:new _t(this);var Ge=c.apply(K,X);return Ge.__actions__.push({func:Jy,args:[he],thisArg:n}),new go(Ge,be)}return je&&st?c.apply(this,X):(Ge=this.thru(he),je?R?Ge.value()[0]:Ge.value():Ge)})}),ho(["pop","push","shift","sort","splice","unshift"],function(c){var p=Ty[c],w=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",R=/^(?:pop|shift)$/.test(c);F.prototype[c]=function(){var I=arguments;if(R&&!this.__chain__){var z=this.value();return p.apply(Qe(z)?z:[],I)}return this[w](function(K){return p.apply(Qe(K)?K:[],I)})}}),ws(_t.prototype,function(c,p){var w=F[p];if(w){var R=w.name+"";zt.call(sd,R)||(sd[R]=[]),sd[R].push({name:p,func:w})}}),sd[Wy(n,_).name]=[{name:"wrapper",func:n}],_t.prototype.clone=CH,_t.prototype.reverse=TH,_t.prototype.value=EH,F.prototype.at=tK,F.prototype.chain=nK,F.prototype.commit=rK,F.prototype.next=iK,F.prototype.plant=sK,F.prototype.reverse=aK,F.prototype.toJSON=F.prototype.valueOf=F.prototype.value=lK,F.prototype.first=F.prototype.head,Mh&&(F.prototype[Mh]=oK),F},rd=rH();Rt?((Rt.exports=rd)._=rd,at._=rd):et._=rd}).call(Ze)})(L1,L1.exports);var yce=L1.exports,D1=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function Ace(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var oR=hs;function P$(e,t){if(e===t||!(oR(e)&&oR(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},s=0,a=n;s=200&&e.status<=299},Rce=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function aR(e){if(!hs(e))return e;for(var t=Vn({},e),n=0,r=Object.entries(t);n"u"&&a===sR&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(y,S){return B1(t,null,function(){var C,T,E,P,k,O,M,V,B,A,N,D,U,$,j,G,q,Z,ee,ie,se,le,W,ne,fe,pe,ve,ye,Je,Fe,Ae,vt,_e,Qt,rr,qt;return D1(this,function(ht){switch(ht.label){case 0:return C=S.signal,T=S.getState,E=S.extra,P=S.endpoint,k=S.forced,O=S.type,V=typeof y=="string"?{url:y}:y,B=V.url,A=V.headers,N=A===void 0?new Headers(_.headers):A,D=V.params,U=D===void 0?void 0:D,$=V.responseHandler,j=$===void 0?v??"json":$,G=V.validateStatus,q=G===void 0?x??Pce:G,Z=V.timeout,ee=Z===void 0?m:Z,ie=rR(V,["url","headers","params","responseHandler","validateStatus","timeout"]),se=Vn(Fs(Vn({},_),{signal:C}),ie),N=new Headers(aR(N)),le=se,[4,o(N,{getState:T,extra:E,endpoint:P,forced:k,type:O})];case 1:le.headers=ht.sent()||N,W=function(At){return typeof At=="object"&&(hs(At)||Array.isArray(At)||typeof At.toJSON=="function")},!se.headers.has("content-type")&&W(se.body)&&se.headers.set("content-type",h),W(se.body)&&d(se.headers)&&(se.body=JSON.stringify(se.body,g)),U&&(ne=~B.indexOf("?")?"&":"?",fe=l?l(U):new URLSearchParams(aR(U)),B+=ne+fe),B=Tce(r,B),pe=new Request(B,se),ve=pe.clone(),M={request:ve},Je=!1,Fe=ee&&setTimeout(function(){Je=!0,S.abort()},ee),ht.label=2;case 2:return ht.trys.push([2,4,5,6]),[4,a(pe)];case 3:return ye=ht.sent(),[3,6];case 4:return Ae=ht.sent(),[2,{error:{status:Je?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(Ae)},meta:M}];case 5:return Fe&&clearTimeout(Fe),[7];case 6:vt=ye.clone(),M.response=vt,Qt="",ht.label=7;case 7:return ht.trys.push([7,9,,10]),[4,Promise.all([b(ye,j).then(function(At){return _e=At},function(At){return rr=At}),vt.text().then(function(At){return Qt=At},function(){})])];case 8:if(ht.sent(),rr)throw rr;return[3,10];case 9:return qt=ht.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:ye.status,data:Qt,error:String(qt)},meta:M}];case 10:return[2,q(ye,_e)?{data:_e,meta:M}:{error:{status:ye.status,data:_e},meta:M}]}})})};function b(y,S){return B1(this,null,function(){var C;return D1(this,function(T){switch(T.label){case 0:return typeof S=="function"?[2,S(y)]:(S==="content-type"&&(S=d(y.headers)?"json":"text"),S!=="json"?[3,2]:[4,y.text()]);case 1:return C=T.sent(),[2,C.length?JSON.parse(C):null];case 2:return[2,y.text()]}})})}}var lR=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),UT=Me("__rtkq/focused"),R$=Me("__rtkq/unfocused"),zT=Me("__rtkq/online"),O$=Me("__rtkq/offline"),Ys;(function(e){e.query="query",e.mutation="mutation"})(Ys||(Ys={}));function k$(e){return e.type===Ys.query}function kce(e){return e.type===Ys.mutation}function I$(e,t,n,r,i,o){return Ice(e)?e(t,n,r,i).map(z3).map(o):Array.isArray(e)?e.map(z3).map(o):[]}function Ice(e){return typeof e=="function"}function z3(e){return typeof e=="string"?{type:e}:e}function wx(e){return e!=null}var Fg=Symbol("forceQueryFn"),V3=function(e){return typeof e[Fg]=="function"};function Mce(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,s=new Map,a=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,d=l.removeMutationResult,f=l.updateSubscriptionOptions;return{buildInitiateQuery:b,buildInitiateMutation:y,getRunningQueryThunk:m,getRunningMutationThunk:v,getRunningQueriesThunk:x,getRunningMutationsThunk:_,getRunningOperationPromises:g,removalWarning:h};function h(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function g(){typeof process<"u";var S=function(C){return Array.from(C.values()).flatMap(function(T){return T?Object.values(T):[]})};return $1($1([],S(s)),S(a)).filter(wx)}function m(S,C){return function(T){var E,P=o.endpointDefinitions[S],k=t({queryArgs:C,endpointDefinition:P,endpointName:S});return(E=s.get(T))==null?void 0:E[k]}}function v(S,C){return function(T){var E;return(E=a.get(T))==null?void 0:E[C]}}function x(){return function(S){return Object.values(s.get(S)||{}).filter(wx)}}function _(){return function(S){return Object.values(a.get(S)||{}).filter(wx)}}function b(S,C){var T=function(E,P){var k=P===void 0?{}:P,O=k.subscribe,M=O===void 0?!0:O,V=k.forceRefetch,B=k.subscriptionOptions,A=Fg,N=k[A];return function(D,U){var $,j,G=t({queryArgs:E,endpointDefinition:C,endpointName:S}),q=n(($={type:"query",subscribe:M,forceRefetch:V,subscriptionOptions:B,endpointName:S,originalArgs:E,queryCacheKey:G},$[Fg]=N,$)),Z=i.endpoints[S].select(E),ee=D(q),ie=Z(U()),se=ee.requestId,le=ee.abort,W=ie.requestId!==se,ne=(j=s.get(D))==null?void 0:j[G],fe=function(){return Z(U())},pe=Object.assign(N?ee.then(fe):W&&!ne?Promise.resolve(ie):Promise.all([ne,ee]).then(fe),{arg:E,requestId:se,subscriptionOptions:B,queryCacheKey:G,abort:le,unwrap:function(){return B1(this,null,function(){var ye;return D1(this,function(Je){switch(Je.label){case 0:return[4,pe];case 1:if(ye=Je.sent(),ye.isError)throw ye.error;return[2,ye.data]}})})},refetch:function(){return D(T(E,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){M&&D(u({queryCacheKey:G,requestId:se}))},updateSubscriptionOptions:function(ye){pe.subscriptionOptions=ye,D(f({endpointName:S,requestId:se,queryCacheKey:G,options:ye}))}});if(!ne&&!W&&!N){var ve=s.get(D)||{};ve[G]=pe,s.set(D,ve),pe.then(function(){delete ve[G],Object.keys(ve).length||s.delete(D)})}return pe}};return T}function y(S){return function(C,T){var E=T===void 0?{}:T,P=E.track,k=P===void 0?!0:P,O=E.fixedCacheKey;return function(M,V){var B=r({type:"mutation",endpointName:S,originalArgs:C,track:k,fixedCacheKey:O}),A=M(B),N=A.requestId,D=A.abort,U=A.unwrap,$=A.unwrap().then(function(Z){return{data:Z}}).catch(function(Z){return{error:Z}}),j=function(){M(d({requestId:N,fixedCacheKey:O}))},G=Object.assign($,{arg:A.arg,requestId:N,abort:D,unwrap:U,unsubscribe:j,reset:j}),q=a.get(M)||{};return a.set(M,q),q[N]=G,G.then(function(){delete q[N],Object.keys(q).length||a.delete(M)}),O&&(q[O]=G,G.then(function(){q[O]===G&&(delete q[O],Object.keys(q).length||a.delete(M))})),G}}}}function uR(e){return e}function Nce(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,s=e.api,a=function(y,S,C){return function(T){var E=i[y];T(s.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:S,endpointDefinition:E,endpointName:y}),patches:C}))}},l=function(y,S,C){return function(T,E){var P,k,O=s.endpoints[y].select(S)(E()),M={patches:[],inversePatches:[],undo:function(){return T(s.util.patchQueryData(y,S,M.inversePatches))}};if(O.status===vn.uninitialized)return M;if("data"in O)if(Fi(O.data)){var V=pT(O.data,C),B=V[1],A=V[2];(P=M.patches).push.apply(P,B),(k=M.inversePatches).push.apply(k,A)}else{var N=C(O.data);M.patches.push({op:"replace",path:[],value:N}),M.inversePatches.push({op:"replace",path:[],value:O.data})}return T(s.util.patchQueryData(y,S,M.patches)),M}},u=function(y,S,C){return function(T){var E;return T(s.endpoints[y].initiate(S,(E={subscribe:!1,forceRefetch:!0},E[Fg]=function(){return{data:C}},E)))}},d=function(y,S){return B1(t,[y,S],function(C,T){var E,P,k,O,M,V,B,A,N,D,U,$,j,G,q,Z,ee,ie,se=T.signal,le=T.abort,W=T.rejectWithValue,ne=T.fulfillWithValue,fe=T.dispatch,pe=T.getState,ve=T.extra;return D1(this,function(ye){switch(ye.label){case 0:E=i[C.endpointName],ye.label=1;case 1:return ye.trys.push([1,8,,13]),P=uR,k=void 0,O={signal:se,abort:le,dispatch:fe,getState:pe,extra:ve,endpoint:C.endpointName,type:C.type,forced:C.type==="query"?f(C,pe()):void 0},M=C.type==="query"?C[Fg]:void 0,M?(k=M(),[3,6]):[3,2];case 2:return E.query?[4,r(E.query(C.originalArgs),O,E.extraOptions)]:[3,4];case 3:return k=ye.sent(),E.transformResponse&&(P=E.transformResponse),[3,6];case 4:return[4,E.queryFn(C.originalArgs,O,E.extraOptions,function(Je){return r(Je,O,E.extraOptions)})];case 5:k=ye.sent(),ye.label=6;case 6:if(typeof process<"u",k.error)throw new lR(k.error,k.meta);return U=ne,[4,P(k.data,k.meta,C.originalArgs)];case 7:return[2,U.apply(void 0,[ye.sent(),(ee={fulfilledTimeStamp:Date.now(),baseQueryMeta:k.meta},ee[Yu]=!0,ee)])];case 8:if($=ye.sent(),j=$,!(j instanceof lR))return[3,12];G=uR,E.query&&E.transformErrorResponse&&(G=E.transformErrorResponse),ye.label=9;case 9:return ye.trys.push([9,11,,12]),q=W,[4,G(j.value,j.meta,C.originalArgs)];case 10:return[2,q.apply(void 0,[ye.sent(),(ie={baseQueryMeta:j.meta},ie[Yu]=!0,ie)])];case 11:return Z=ye.sent(),j=Z,[3,12];case 12:throw typeof process<"u",console.error(j),j;case 13:return[2]}})})};function f(y,S){var C,T,E,P,k=(T=(C=S[n])==null?void 0:C.queries)==null?void 0:T[y.queryCacheKey],O=(E=S[n])==null?void 0:E.config.refetchOnMountOrArgChange,M=k==null?void 0:k.fulfilledTimeStamp,V=(P=y.forceRefetch)!=null?P:y.subscribe&&O;return V?V===!0||(Number(new Date)-Number(M))/1e3>=V:!1}var h=Jl(n+"/executeQuery",d,{getPendingMeta:function(){var y;return y={startedTimeStamp:Date.now()},y[Yu]=!0,y},condition:function(y,S){var C=S.getState,T,E,P,k=C(),O=(E=(T=k[n])==null?void 0:T.queries)==null?void 0:E[y.queryCacheKey],M=O==null?void 0:O.fulfilledTimeStamp,V=y.originalArgs,B=O==null?void 0:O.originalArgs,A=i[y.endpointName];return V3(y)?!0:(O==null?void 0:O.status)==="pending"?!1:f(y,k)||k$(A)&&((P=A==null?void 0:A.forceRefetch)!=null&&P.call(A,{currentArg:V,previousArg:B,endpointState:O,state:k}))?!0:!M},dispatchConditionRejection:!0}),g=Jl(n+"/executeMutation",d,{getPendingMeta:function(){var y;return y={startedTimeStamp:Date.now()},y[Yu]=!0,y}}),m=function(y){return"force"in y},v=function(y){return"ifOlderThan"in y},x=function(y,S,C){return function(T,E){var P=m(C)&&C.force,k=v(C)&&C.ifOlderThan,O=function(A){return A===void 0&&(A=!0),s.endpoints[y].initiate(S,{forceRefetch:A})},M=s.endpoints[y].select(S)(E());if(P)T(O());else if(k){var V=M==null?void 0:M.fulfilledTimeStamp;if(!V){T(O());return}var B=(Number(new Date)-Number(new Date(V)))/1e3>=k;B&&T(O())}else T(O(!1))}};function _(y){return function(S){var C,T;return((T=(C=S==null?void 0:S.meta)==null?void 0:C.arg)==null?void 0:T.endpointName)===y}}function b(y,S){return{matchPending:lf(ib(y),_(S)),matchFulfilled:lf(pu(y),_(S)),matchRejected:lf(If(y),_(S))}}return{queryThunk:h,mutationThunk:g,prefetch:x,updateQueryData:l,upsertQueryData:u,patchQueryData:a,buildMatchThunkActions:b}}function M$(e,t,n,r){return I$(n[e.meta.arg.endpointName][t],pu(e)?e.payload:void 0,Sm(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function R0(e,t,n){var r=e[t];r&&n(r)}function Bg(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function cR(e,t,n){var r=e[Bg(t)];r&&n(r)}var rp={};function Lce(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,s=i.apiUid,a=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,d=e.config,f=Me(t+"/resetApiState"),h=An({name:t+"/queries",initialState:rp,reducers:{removeQueryResult:{reducer:function(C,T){var E=T.payload.queryCacheKey;delete C[E]},prepare:wv()},queryResultPatched:function(C,T){var E=T.payload,P=E.queryCacheKey,k=E.patches;R0(C,P,function(O){O.data=x3(O.data,k.concat())})}},extraReducers:function(C){C.addCase(n.pending,function(T,E){var P=E.meta,k=E.meta.arg,O,M,V=V3(k);(k.subscribe||V)&&((M=T[O=k.queryCacheKey])!=null||(T[O]={status:vn.uninitialized,endpointName:k.endpointName})),R0(T,k.queryCacheKey,function(B){B.status=vn.pending,B.requestId=V&&B.requestId?B.requestId:P.requestId,k.originalArgs!==void 0&&(B.originalArgs=k.originalArgs),B.startedTimeStamp=P.startedTimeStamp})}).addCase(n.fulfilled,function(T,E){var P=E.meta,k=E.payload;R0(T,P.arg.queryCacheKey,function(O){var M;if(!(O.requestId!==P.requestId&&!V3(P.arg))){var V=o[P.arg.endpointName].merge;if(O.status=vn.fulfilled,V)if(O.data!==void 0){var B=P.fulfilledTimeStamp,A=P.arg,N=P.baseQueryMeta,D=P.requestId,U=fu(O.data,function($){return V($,k,{arg:A.originalArgs,baseQueryMeta:N,fulfilledTimeStamp:B,requestId:D})});O.data=U}else O.data=k;else O.data=(M=o[P.arg.endpointName].structuralSharing)==null||M?P$(yi(O.data)?aT(O.data):O.data,k):k;delete O.error,O.fulfilledTimeStamp=P.fulfilledTimeStamp}})}).addCase(n.rejected,function(T,E){var P=E.meta,k=P.condition,O=P.arg,M=P.requestId,V=E.error,B=E.payload;R0(T,O.queryCacheKey,function(A){if(!k){if(A.requestId!==M)return;A.status=vn.rejected,A.error=B??V}})}).addMatcher(l,function(T,E){for(var P=a(E).queries,k=0,O=Object.entries(P);k"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ide:rde;D$.useSyncExternalStore=$f.useSyncExternalStore!==void 0?$f.useSyncExternalStore:ode;L$.exports=D$;var sde=L$.exports,$$={exports:{}},F$={};/** * @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 bb=L,ade=sde;function lde(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ude=typeof Object.is=="function"?Object.is:lde,cde=ade.useSyncExternalStore,dde=bb.useRef,fde=bb.useEffect,hde=bb.useMemo,pde=bb.useDebugValue;F$.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=dde(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=hde(function(){function l(g){if(!u){if(u=!0,d=g,g=r(g),i!==void 0&&s.hasValue){var m=s.value;if(i(m,g))return f=m}return f=g}if(m=f,ude(d,g))return m;var v=r(g);return i!==void 0&&i(m,v)?m:(d=g,f=v)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return l(t())},h===null?void 0:function(){return l(h())}]},[t,n,r,i]);var a=cde(e,o[0],o[1]);return fde(function(){s.hasValue=!0,s.value=a},[a]),pde(a),a};$$.exports=F$;var B$=$$.exports;const gde=Tc(B$);function mde(e){e()}let U$=mde;const yde=e=>U$=e,vde=()=>U$,yR=Symbol.for(`react-redux-context-${L.version}`),vR=globalThis;function _de(){let e=vR[yR];return e||(e=L.createContext(null),vR[yR]=e),e}const ru=new Proxy({},new Proxy({},{get(e,t){const n=_de();return(r,...i)=>Reflect[t](n,...i)}}));function VT(e=ru){return function(){return L.useContext(e)}}const z$=VT(),bde=()=>{throw new Error("uSES not initialized!")};let V$=bde;const Sde=e=>{V$=e},wde=(e,t)=>e===t;function xde(e=ru){const t=e===ru?z$:VT(e);return function(r,i={}){const{equalityFn:o=wde,stabilityCheck:s=void 0,noopCheck:a=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:d,stabilityCheck:f,noopCheck:h}=t();L.useRef(!0);const g=L.useCallback({[r.name](v){return r(v)}}[r.name],[r,f,s]),m=V$(u.addNestedSub,l.getState,d||l.getState,g,o);return L.useDebugValue(m),m}}const j$=xde();function U1(){return U1=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const _R={notify(){},get:()=>[]};function Lde(e,t){let n,r=_R;function i(f){return l(),r.subscribe(f)}function o(){r.notify()}function s(){d.onStateChange&&d.onStateChange()}function a(){return!!n}function l(){n||(n=t?t.addNestedSub(s):e.subscribe(s),r=Nde())}function u(){n&&(n(),n=void 0,r.clear(),r=_R)}const d={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:s,isSubscribed:a,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return d}const Dde=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$de=Dde?L.useLayoutEffect:L.useEffect;function bR(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function z1(e,t){if(bR(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=Lde(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),a=L.useMemo(()=>e.getState(),[e]);$de(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,a]);const l=t||ru;return jt.createElement(l.Provider,{value:s},n)}function X$(e=ru){const t=e===ru?z$:VT(e);return function(){const{store:r}=t();return r}}const Y$=X$();function Bde(e=ru){const t=e===ru?Y$:X$(e);return function(){return t().dispatch}}const Q$=Bde();Sde(B$.useSyncExternalStoreWithSelector);yde(Ms.unstable_batchedUpdates);var Ude=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n{const r=$g.get(),i=Dg.get(),o=N1.get();return Oce({baseUrl:`${r??""}/api/v1`,prepareHeaders:a=>(i&&a.set("Authorization",`Bearer ${i}`),o&&a.set("project-id",o),a)})(e,t,n)},iu=tfe({baseQuery:rfe,reducerPath:"api",tagTypes:nfe,endpoints:()=>({})}),ife=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,cfe=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),G3=Symbol("encodeFragmentIdentifier");function dfe(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Kn(t,e),"[",i,"]"].join("")]:[...n,[Kn(t,e),"[",Kn(i,e),"]=",Kn(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Kn(t,e),"[]"].join("")]:[...n,[Kn(t,e),"[]=",Kn(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Kn(t,e),":list="].join("")]:[...n,[Kn(t,e),":list=",Kn(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[Kn(n,e),t,Kn(i,e)].join("")]:[[r,Kn(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Kn(t,e)]:[...n,[Kn(t,e),"=",Kn(r,e)].join("")]}}function ffe(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),s=typeof r=="string"&&!o&&Ea(r,e).includes(e.arrayFormatSeparator);r=s?Ea(r,e):r;const a=o||s?r.split(e.arrayFormatSeparator).map(l=>Ea(l,e)):r===null?r:Ea(r,e);i[n]=a};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Ea(r,e);return}const s=r===null?[]:r.split(e.arrayFormatSeparator).map(a=>Ea(a,e));if(i[n]===void 0){i[n]=s;return}i[n]=[...i[n],...s]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function eF(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Kn(e,t){return t.encode?t.strict?cfe(e):encodeURIComponent(e):e}function Ea(e,t){return t.decode?afe(e):e}function tF(e){return Array.isArray(e)?e.sort():typeof e=="object"?tF(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function nF(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function hfe(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function ER(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function KT(e){e=nF(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function XT(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},eF(t.arrayFormatSeparator);const n=ffe(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[s,a]=J$(o,"=");s===void 0&&(s=o),a=a===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:Ea(a,t),n(Ea(s,t),a,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[s,a]of Object.entries(o))o[s]=ER(a,t);else r[i]=ER(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const s=r[o];return s&&typeof s=="object"&&!Array.isArray(s)?i[o]=tF(s):i[o]=s,i},Object.create(null))}function rF(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},eF(t.arrayFormatSeparator);const n=s=>t.skipNull&&ufe(e[s])||t.skipEmptyString&&e[s]==="",r=dfe(t),i={};for(const[s,a]of Object.entries(e))n(s)||(i[s]=a);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(s=>{const a=e[s];return a===void 0?"":a===null?Kn(s,t):Array.isArray(a)?a.length===0&&t.arrayFormat==="bracket-separator"?Kn(s,t)+"[]":a.reduce(r(s),[]).join("&"):Kn(s,t)+"="+Kn(a,t)}).filter(s=>s.length>0).join("&")}function iF(e,t){var i;t={decode:!0,...t};let[n,r]=J$(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:XT(KT(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Ea(r,t)}:{}}}function oF(e,t){t={encode:!0,strict:!0,[G3]:!0,...t};const n=nF(e.url).split("?")[0]||"",r=KT(e.url),i={...XT(r,{sort:!1}),...e.query};let o=rF(i,t);o&&(o=`?${o}`);let s=hfe(e.url);if(e.fragmentIdentifier){const a=new URL(n);a.hash=e.fragmentIdentifier,s=t[G3]?a.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${s}`}function sF(e,t,n){n={parseFragmentIdentifier:!0,[G3]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=iF(e,n);return oF({url:r,query:lfe(i,t),fragmentIdentifier:o},n)}function pfe(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return sF(e,r,n)}const Tv=Object.freeze(Object.defineProperty({__proto__:null,exclude:pfe,extract:KT,parse:XT,parseUrl:iF,pick:sF,stringify:rF,stringifyUrl:oF},Symbol.toStringTag,{value:"Module"})),ip=(e,t)=>{if(!e)return!1;const n=j1.selectAll(e);if(n.length>1){const r=new Date(t.created_at),i=n[n.length-1];if(!i)return!1;const o=new Date(i.created_at);return r>=o}else if([0,1].includes(n.length))return!0;return!1},ml=e=>Jr.includes(e.image_category)?Jr:Ll,Cn=hu({selectId:e=>e.image_name,sortComparer:(e,t)=>ife(t.updated_at,e.updated_at)}),j1=Cn.getSelectors(),Jo=e=>`images/?${Tv.stringify(e,{arrayFormat:"none"})}`,Yi=iu.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:(t,n,r)=>{const i=[{type:"Board",id:tt}];return t&&i.push(...t.items.map(({board_id:o})=>({type:"Board",id:o}))),i}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:(t,n,r)=>{const i=[{type:"Board",id:tt}];return t&&i.push(...t.map(({board_id:o})=>({type:"Board",id:o}))),i}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Jo({board_id:t??"none",categories:Jr,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>t.total}),getBoardAssetsTotal:e.query({query:t=>({url:Jo({board_id:t??"none",categories:Ll,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>t.total}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:tt}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:oIe,useListAllBoardsQuery:sIe,useGetBoardImagesTotalQuery:aIe,useGetBoardAssetsTotalQuery:lIe,useCreateBoardMutation:uIe,useUpdateBoardMutation:cIe,useListAllImageNamesForBoardQuery:dIe}=Yi,we=iu.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Jo(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Jo({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Jo({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return Cn.addMany(Cn.getInitialState(),n)},merge:(t,n)=>{Cn.addMany(t,j1.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;j1.selectAll(i).forEach(o=>{n(we.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:Jo({is_intermediate:!0})}),providesTags:["IntermediatesCount"],transformResponse:t=>t.total}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],keepUnusedDataFor:86400}),clearIntermediates:e.mutation({query:()=>({url:"images/clear-intermediates",method:"POST"}),invalidatesTags:["IntermediatesCount"]}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),invalidatesTags:(t,n,{board_id:r})=>[{type:"BoardImagesTotal",id:r??"none"},{type:"BoardAssetsTotal",id:r??"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,s={board_id:o??"none",categories:ml(t)},a=n(we.util.updateQueryData("listImages",s,l=>{Cn.removeOne(l,i)}));try{await r}catch{a.undo()}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{var o;const i=(o=r[0])==null?void 0:o.board_id;return[{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"}]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=yce.keyBy(t,"image_name");i.deleted_images.forEach(s=>{const a=o[s];if(a){const l={board_id:a.board_id??"none",categories:ml(a)};n(we.util.updateQueryData("listImages",l,u=>{Cn.removeOne(u,s)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[];s.push(r(we.util.updateQueryData("getImageDTO",t.image_name,l=>{Object.assign(l,{is_intermediate:n})})));const a=ml(t);if(n)s.push(r(we.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:a},l=>{Cn.removeOne(l,t.image_name)})));else{const l={board_id:t.board_id??"none",categories:a},u=we.endpoints.listImages.select(l)(o()),{data:d}=Jr.includes(t.image_category)?Yi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):Yi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),f=u.data&&u.data.ids.length>=(d??0),h=ip(u.data,t);(f||h)&&s.push(r(we.util.updateQueryData("listImages",l,g=>{Cn.upsertOne(g,t)})))}try{await i}catch{s.forEach(l=>l.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[];s.push(r(we.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{s.forEach(a=>a.undo())}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:s})=>{const a=new FormData;return a.append("file",t),{url:"images/upload",method:"POST",body:a,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:s}}},async onQueryStarted({file:t,image_category:n,is_intermediate:r,postUploadAction:i,session_id:o,board_id:s},{dispatch:a,queryFulfilled:l}){try{const{data:u}=await l;if(u.is_intermediate)return;a(we.util.upsertQueryData("getImageDTO",u.image_name,u));const d=ml(u);a(we.util.updateQueryData("listImages",{board_id:u.board_id??"none",categories:d},f=>{Cn.addOne(f,u)})),a(we.util.invalidateTags([{type:"BoardImagesTotal",id:u.board_id??"none"},{type:"BoardAssetsTotal",id:u.board_id??"none"}]))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:(t,n,r)=>[{type:"Board",id:tt},{type:"ImageList",id:Jo({board_id:"none",categories:Jr})},{type:"ImageList",id:Jo({board_id:"none",categories:Ll})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{deleted_board_images:s}=o;s.forEach(u=>{n(we.util.updateQueryData("getImageDTO",u,d=>{d.board_id=void 0}))});const a=[{categories:Jr},{categories:Ll}],l=s.map(u=>({id:u,changes:{board_id:void 0}}));a.forEach(u=>{n(we.util.updateQueryData("listImages",u,d=>{Cn.updateMany(d,l)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:(t,n,r)=>[{type:"Board",id:tt},{type:"ImageList",id:Jo({board_id:"none",categories:Jr})},{type:"ImageList",id:Jo({board_id:"none",categories:Ll})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{deleted_images:s}=o;[{categories:Jr},{categories:Ll}].forEach(l=>{n(we.util.updateQueryData("listImages",l,u=>{Cn.removeMany(u,s)}))})}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r,imageDTO:i})=>[{type:"Board",id:r},{type:"BoardImagesTotal",id:r},{type:"BoardAssetsTotal",id:r},{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[],a=ml(n);if(s.push(r(we.util.updateQueryData("getImageDTO",n.image_name,l=>{l.board_id=t}))),!n.is_intermediate){s.push(r(we.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:a},g=>{Cn.removeOne(g,n.image_name)})));const l={board_id:t??"none",categories:a},u=we.endpoints.listImages.select(l)(o()),{data:d}=Jr.includes(n.image_category)?Yi.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):Yi.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),f=u.data&&u.data.ids.length>=(d??0),h=ip(u.data,n);(f||h)&&s.push(r(we.util.updateQueryData("listImages",l,g=>{Cn.addOne(g,n)})))}try{await i}catch{s.forEach(l=>l.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=ml(t),s=[];s.push(n(we.util.updateQueryData("getImageDTO",t.image_name,h=>{h.board_id=void 0}))),s.push(n(we.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},h=>{Cn.removeOne(h,t.image_name)})));const a={board_id:"none",categories:o},l=we.endpoints.listImages.select(a)(i()),{data:u}=Jr.includes(t.image_category)?Yi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):Yi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),d=l.data&&l.data.ids.length>=(u??0),f=ip(l.data,t);(d||f)&&s.push(n(we.util.updateQueryData("listImages",a,h=>{Cn.upsertOne(h,t)})));try{await r}catch{s.forEach(h=>h.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{imageDTOs:r,board_id:i})=>{var s;const o=(s=r[0])==null?void 0:s.board_id;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:o??"none"},{type:"BoardAssetsTotal",id:o??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:s}=await i,{added_image_names:a}=s;a.forEach(l=>{r(we.util.updateQueryData("getImageDTO",l,_=>{_.board_id=t}));const u=n.find(_=>_.image_name===l);if(!u)return;const d=ml(u),f=u.board_id;r(we.util.updateQueryData("listImages",{board_id:f??"none",categories:d},_=>{Cn.removeOne(_,u.image_name)}));const h={board_id:t,categories:d},g=we.endpoints.listImages.select(h)(o()),{data:m}=Jr.includes(u.image_category)?Yi.endpoints.getBoardImagesTotal.select(t??"none")(o()):Yi.endpoints.getBoardAssetsTotal.select(t??"none")(o()),v=g.data&&g.data.ids.length>=(m??0),x=(m||0)>=tR?ip(g.data,u):!0;(v||x)&&r(we.util.updateQueryData("listImages",h,_=>{Cn.upsertOne(_,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}];return t==null||t.removed_image_names.forEach(s=>{var l;const a=(l=r.find(u=>u.image_name===s))==null?void 0:l.board_id;!a||i.includes(a)||(o.push({type:"Board",id:a}),o.push({type:"BoardImagesTotal",id:a}),o.push({type:"BoardAssetsTotal",id:a}))}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:s}=o;s.forEach(a=>{n(we.util.updateQueryData("getImageDTO",a,v=>{v.board_id=void 0}));const l=t.find(v=>v.image_name===a);if(!l)return;const u=ml(l);n(we.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},v=>{Cn.removeOne(v,l.image_name)}));const d={board_id:"none",categories:u},f=we.endpoints.listImages.select(d)(i()),{data:h}=Jr.includes(l.image_category)?Yi.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):Yi.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),g=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=tR?ip(f.data,l):!0;(g||m)&&n(we.util.updateQueryData("listImages",d,v=>{Cn.upsertOne(v,{...l,board_id:"none"})}))})}catch{}}})})}),{useGetIntermediatesCountQuery:fIe,useListImagesQuery:hIe,useLazyListImagesQuery:pIe,useGetImageDTOQuery:gIe,useGetImageMetadataQuery:mIe,useDeleteImageMutation:yIe,useDeleteImagesMutation:vIe,useUploadImageMutation:_Ie,useClearIntermediatesMutation:bIe,useAddImagesToBoardMutation:SIe,useRemoveImagesFromBoardMutation:wIe,useAddImageToBoardMutation:xIe,useRemoveImageFromBoardMutation:CIe,useChangeImageIsIntermediateMutation:TIe,useChangeImageSessionIdMutation:EIe,useDeleteBoardAndImagesMutation:AIe,useDeleteBoardMutation:PIe}=we,aF=Me("socket/socketConnected"),lF=Me("socket/appSocketConnected"),uF=Me("socket/socketDisconnected"),cF=Me("socket/appSocketDisconnected"),YT=Me("socket/socketSubscribed"),dF=Me("socket/appSocketSubscribed"),fF=Me("socket/socketUnsubscribed"),hF=Me("socket/appSocketUnsubscribed"),pF=Me("socket/socketInvocationStarted"),gF=Me("socket/appSocketInvocationStarted"),QT=Me("socket/socketInvocationComplete"),mF=Me("socket/appSocketInvocationComplete"),yF=Me("socket/socketInvocationError"),ZT=Me("socket/appSocketInvocationError"),vF=Me("socket/socketGraphExecutionStateComplete"),_F=Me("socket/appSocketGraphExecutionStateComplete"),bF=Me("socket/socketGeneratorProgress"),SF=Me("socket/appSocketGeneratorProgress"),wF=Me("socket/socketModelLoadStarted"),gfe=Me("socket/appSocketModelLoadStarted"),xF=Me("socket/socketModelLoadCompleted"),mfe=Me("socket/appSocketModelLoadCompleted"),CF=Me("socket/socketSessionRetrievalError"),TF=Me("socket/appSocketSessionRetrievalError"),EF=Me("socket/socketInvocationRetrievalError"),AF=Me("socket/appSocketInvocationRetrievalError"),JT=Me("controlNet/imageProcessed"),kd={none:{type:"none",label:"none",description:"",default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",label:"Canny",description:"",default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",label:"Content Shuffle",description:"",default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",label:"HED",description:"",default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",label:"Lineart Anime",description:"",default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",label:"Lineart",description:"",default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",label:"Mediapipe Face",description:"",default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",label:"Depth (Midas)",description:"",default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",label:"M-LSD",description:"",default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",label:"Normal BAE",description:"",default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",label:"Openpose",description:"",default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",label:"PIDI",description:"",default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",label:"Depth (Zoe)",description:"",default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},M0={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor"},AR={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",resizeMode:"just_resize",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:kd.canny_image_processor.default,shouldAutoConfig:!0},H3={controlNets:{},isEnabled:!1,pendingControlImages:[]},PF=An({name:"controlNet",initialState:H3,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??AR,controlNetId:n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=Qr(i);o.controlNetId=r,e.controlNets[r]=o},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...AR,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetToggled:(e,t)=>{const{controlNetId:n}=t.payload,r=e.controlNets[n];r&&(r.isEnabled=!r.isEnabled)},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload,i=e.controlNets[n];i&&(i.controlImage=r,i.processedControlImage=null,r!==null&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload,i=e.controlNets[n];if(i&&(i.model=r,i.processedControlImage=null,i.shouldAutoConfig)){let o;for(const s in M0)if(r.model_name.includes(s)){o=M0[s];break}o?(i.processorType=o,i.processorNode=kd[o].default):(i.processorType="none",i.processorNode=kd.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload,i=e.controlNets[n];i&&(i.weight=r)},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.beginStepPct=r)},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.endStepPct=r)},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload,i=e.controlNets[n];i&&(i.controlMode=r)},controlNetResizeModeChanged:(e,t)=>{const{controlNetId:n,resizeMode:r}=t.payload,i=e.controlNets[n];i&&(i.resizeMode=r)},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=i.processorNode;i.processorNode={...o,...r},i.shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=null,i.processorType=r,i.processorNode=kd[r].default,i.shouldAutoConfig=!1)},controlNetAutoConfigToggled:(e,t)=>{var o;const{controlNetId:n}=t.payload,r=e.controlNets[n];if(!r)return;const i=!r.shouldAutoConfig;if(i){let s;for(const a in M0)if((o=r.model)!=null&&o.model_name.includes(a)){s=M0[a];break}s?(r.processorType=s,r.processorNode=kd[s].default):(r.processorType="none",r.processorNode=kd.none.default)}r.shouldAutoConfig=i},controlNetReset:()=>({...H3})},extraReducers:e=>{e.addCase(JT,(t,n)=>{const r=t.controlNets[n.payload.controlNetId];r&&r.controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(ZT,t=>{t.pendingControlImages=[]}),e.addMatcher(S$,t=>{t.pendingControlImages=[]}),e.addMatcher(we.endpoints.deleteImage.matchFulfilled,(t,n)=>{const{image_name:r}=n.meta.arg.originalArgs;gc(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})})}}),{isControlNetEnabledToggled:RIe,controlNetAdded:OIe,controlNetDuplicated:kIe,controlNetAddedFromImage:IIe,controlNetRemoved:RF,controlNetImageChanged:eE,controlNetProcessedImageChanged:yfe,controlNetToggled:MIe,controlNetModelChanged:PR,controlNetWeightChanged:NIe,controlNetBeginStepPctChanged:LIe,controlNetEndStepPctChanged:DIe,controlNetControlModeChanged:$Ie,controlNetResizeModeChanged:FIe,controlNetProcessorParamsChanged:vfe,controlNetProcessorTypeChanged:_fe,controlNetReset:tE,controlNetAutoConfigToggled:RR}=PF.actions,bfe=PF.reducer,OF={isEnabled:!1,maxPrompts:100,combinatorial:!0},Sfe=OF,kF=An({name:"dynamicPrompts",initialState:Sfe,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=OF.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},isEnabledToggled:e=>{e.isEnabled=!e.isEnabled}}}),{isEnabledToggled:BIe,maxPromptsChanged:UIe,maxPromptsReset:zIe,combinatorialToggled:VIe}=kF.actions,wfe=kF.reducer,IF={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",shouldShowDeleteButton:!1,boardSearchText:""},MF=An({name:"gallery",initialState:IF,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=t.payload},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},shouldShowDeleteButtonChanged:(e,t)=>{e.shouldShowDeleteButton=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(Cfe,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(Yi.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:Gs,shouldAutoSwitchChanged:jIe,autoAssignBoardOnClickChanged:GIe,setGalleryImageMinimumWidth:HIe,boardIdSelected:W3,autoAddBoardIdChanged:WIe,galleryViewChanged:G1,selectionChanged:qIe,shouldShowDeleteButtonChanged:KIe,boardSearchTextChanged:XIe}=MF.actions,xfe=MF.reducer,Cfe=Lo(we.endpoints.deleteBoard.matchFulfilled,we.endpoints.deleteBoardAndImages.matchFulfilled),Tfe={imagesToDelete:[],isModalOpen:!1},NF=An({name:"deleteImageModal",initialState:Tfe,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:nE,imagesToDeleteSelected:Efe,imageDeletionCanceled:YIe}=NF.actions,Afe=NF.reducer,Pfe={isModalOpen:!1,imagesToChange:[]},LF=An({name:"changeBoardModal",initialState:Pfe,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:QIe,imagesToChangeSelected:ZIe,changeBoardReset:JIe}=LF.actions,Rfe=LF.reducer,OR={weight:.75},Ofe={loras:{}},DF=An({name:"lora",initialState:Ofe,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...OR}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=OR.weight)}}}),{loraAdded:e7e,loraRemoved:$F,loraWeightChanged:t7e,loraWeightReset:n7e,lorasCleared:r7e}=DF.actions,kfe=DF.reducer;function $o(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=u??typeof d!="object"?d:Object.assign({},t,d),n.forEach(h=>h(t,f))}},i=()=>t,a={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,a),a},Ife=e=>e?kR(e):kR,{useSyncExternalStoreWithSelector:Mfe}=gde;function Nfe(e,t=e.getState,n){const r=Mfe(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return L.useDebugValue(r),r}function Bi(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,i]of e)if(!Object.is(i,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{}};function zb(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ev.prototype=zb.prototype={constructor:Ev,on:function(e,t){var n=this._,r=Dfe(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),MR.hasOwnProperty(t)?{space:MR[t],local:e}:e}function Ffe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===q3&&t.documentElement.namespaceURI===q3?t.createElement(e):t.createElementNS(n,e)}}function Bfe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function FF(e){var t=Vb(e);return(t.local?Bfe:Ffe)(t)}function Ufe(){}function rE(e){return e==null?Ufe:function(){return this.querySelector(e)}}function zfe(e){typeof e!="function"&&(e=rE(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=y&&(y=b+1);!(C=x[y])&&++y=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function fhe(e){e||(e=hhe);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function phe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ghe(){return Array.from(this)}function mhe(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Ahe:typeof t=="function"?Rhe:Phe)(e,t,n??"")):Ff(this.node(),e)}function Ff(e,t){return e.style.getPropertyValue(t)||jF(e).getComputedStyle(e,null).getPropertyValue(t)}function khe(e){return function(){delete this[e]}}function Ihe(e,t){return function(){this[e]=t}}function Mhe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Nhe(e,t){return arguments.length>1?this.each((t==null?khe:typeof t=="function"?Mhe:Ihe)(e,t)):this.node()[e]}function GF(e){return e.trim().split(/^|\s+/)}function iE(e){return e.classList||new HF(e)}function HF(e){this._node=e,this._names=GF(e.getAttribute("class")||"")}HF.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function WF(e,t){for(var n=iE(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function lpe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function K3(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,dx:l,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}K3.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function vpe(e){return!e.ctrlKey&&!e.button}function _pe(){return this.parentNode}function bpe(e,t){return t??{x:e.x,y:e.y}}function Spe(){return navigator.maxTouchPoints||"ontouchstart"in this}function wpe(){var e=vpe,t=_pe,n=bpe,r=Spe,i={},o=zb("start","drag","end"),s=0,a,l,u,d,f=0;function h(S){S.on("mousedown.drag",g).filter(r).on("touchstart.drag",x).on("touchmove.drag",_,ype).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(S,C){if(!(d||!e.call(this,S,C))){var T=y(this,t.call(this,S,C),S,C,"mouse");T&&(rs(S.view).on("mousemove.drag",m,Ug).on("mouseup.drag",v,Ug),YF(S.view),Ax(S),u=!1,a=S.clientX,l=S.clientY,T("start",S))}}function m(S){if(hf(S),!u){var C=S.clientX-a,T=S.clientY-l;u=C*C+T*T>f}i.mouse("drag",S)}function v(S){rs(S.view).on("mousemove.drag mouseup.drag",null),QF(S.view,u),hf(S),i.mouse("end",S)}function x(S,C){if(e.call(this,S,C)){var T=S.changedTouches,E=t.call(this,S,C),P=T.length,k,O;for(k=0;k>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?L0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?L0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Cpe.exec(e))?new Mi(t[1],t[2],t[3],1):(t=Tpe.exec(e))?new Mi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Epe.exec(e))?L0(t[1],t[2],t[3],t[4]):(t=Ape.exec(e))?L0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ppe.exec(e))?UR(t[1],t[2]/100,t[3]/100,1):(t=Rpe.exec(e))?UR(t[1],t[2]/100,t[3]/100,t[4]):NR.hasOwnProperty(e)?$R(NR[e]):e==="transparent"?new Mi(NaN,NaN,NaN,0):null}function $R(e){return new Mi(e>>16&255,e>>8&255,e&255,1)}function L0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Mi(e,t,n,r)}function Ipe(e){return e instanceof Mm||(e=jg(e)),e?(e=e.rgb(),new Mi(e.r,e.g,e.b,e.opacity)):new Mi}function X3(e,t,n,r){return arguments.length===1?Ipe(e):new Mi(e,t,n,r??1)}function Mi(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}oE(Mi,X3,ZF(Mm,{brighter(e){return e=e==null?W1:Math.pow(W1,e),new Mi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zg:Math.pow(zg,e),new Mi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Mi(oc(this.r),oc(this.g),oc(this.b),q1(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:FR,formatHex:FR,formatHex8:Mpe,formatRgb:BR,toString:BR}));function FR(){return`#${Zu(this.r)}${Zu(this.g)}${Zu(this.b)}`}function Mpe(){return`#${Zu(this.r)}${Zu(this.g)}${Zu(this.b)}${Zu((isNaN(this.opacity)?1:this.opacity)*255)}`}function BR(){const e=q1(this.opacity);return`${e===1?"rgb(":"rgba("}${oc(this.r)}, ${oc(this.g)}, ${oc(this.b)}${e===1?")":`, ${e})`}`}function q1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function oc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Zu(e){return e=oc(e),(e<16?"0":"")+e.toString(16)}function UR(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new is(e,t,n,r)}function JF(e){if(e instanceof is)return new is(e.h,e.s,e.l,e.opacity);if(e instanceof Mm||(e=jg(e)),!e)return new is;if(e instanceof is)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new is(s,a,l,e.opacity)}function Npe(e,t,n,r){return arguments.length===1?JF(e):new is(e,t,n,r??1)}function is(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}oE(is,Npe,ZF(Mm,{brighter(e){return e=e==null?W1:Math.pow(W1,e),new is(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zg:Math.pow(zg,e),new is(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Mi(Px(e>=240?e-240:e+120,i,r),Px(e,i,r),Px(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new is(zR(this.h),D0(this.s),D0(this.l),q1(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=q1(this.opacity);return`${e===1?"hsl(":"hsla("}${zR(this.h)}, ${D0(this.s)*100}%, ${D0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zR(e){return e=(e||0)%360,e<0?e+360:e}function D0(e){return Math.max(0,Math.min(1,e||0))}function Px(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const eB=e=>()=>e;function Lpe(e,t){return function(n){return e+n*t}}function Dpe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function $pe(e){return(e=+e)==1?tB:function(t,n){return n-t?Dpe(t,n,e):eB(isNaN(t)?n:t)}}function tB(e,t){var n=t-e;return n?Lpe(e,n):eB(isNaN(e)?t:e)}const VR=function e(t){var n=$pe(t);function r(i,o){var s=n((i=X3(i)).r,(o=X3(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),u=tB(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=a(d),i.b=l(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function xl(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Y3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rx=new RegExp(Y3.source,"g");function Fpe(e){return function(){return e}}function Bpe(e){return function(t){return e(t)+""}}function Upe(e,t){var n=Y3.lastIndex=Rx.lastIndex=0,r,i,o,s=-1,a=[],l=[];for(e=e+"",t=t+"";(r=Y3.exec(e))&&(i=Rx.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:xl(r,i)})),n=Rx.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:xl(u,d)})):d&&f.push(i(f)+"rotate("+d+r)}function a(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:xl(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function l(u,d,f,h,g,m){if(u!==f||d!==h){var v=g.push(i(g)+"scale(",null,",",null,")");m.push({i:v-4,x:xl(u,f)},{i:v-2,x:xl(d,h)})}else(f!==1||h!==1)&&g.push(i(g)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),o(u.translateX,u.translateY,d.translateX,d.translateY,f,h),s(u.rotate,d.rotate,f,h),a(u.skewX,d.skewX,f,h),l(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(g){for(var m=-1,v=h.length,x;++m=0&&e._call.call(void 0,t),e=e._next;--Bf}function HR(){_c=(X1=Gg.now())+jb,Bf=Ep=0;try{Ype()}finally{Bf=0,Zpe(),_c=0}}function Qpe(){var e=Gg.now(),t=e-X1;t>iB&&(jb-=t,X1=e)}function Zpe(){for(var e,t=K1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:K1=n);Ap=e,Z3(r)}function Z3(e){if(!Bf){Ep&&(Ep=clearTimeout(Ep));var t=e-_c;t>24?(e<1/0&&(Ep=setTimeout(HR,e-Gg.now()-jb)),op&&(op=clearInterval(op))):(op||(X1=Gg.now(),op=setInterval(Qpe,iB)),Bf=1,oB(HR))}}function WR(e,t,n){var r=new Y1;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Jpe=zb("start","end","cancel","interrupt"),ege=[],aB=0,qR=1,J3=2,Av=3,KR=4,e5=5,Pv=6;function Gb(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;tge(e,n,{name:t,index:r,group:i,on:Jpe,tween:ege,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:aB})}function aE(e,t){var n=vs(e,t);if(n.state>aB)throw new Error("too late; already scheduled");return n}function ea(e,t){var n=vs(e,t);if(n.state>Av)throw new Error("too late; already running");return n}function vs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tge(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=sB(o,0,n.time);function o(u){n.state=qR,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var d,f,h,g;if(n.state!==qR)return l();for(d in r)if(g=r[d],g.name===n.name){if(g.state===Av)return WR(s);g.state===KR?(g.state=Pv,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[d]):+dJ3&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function kge(e,t,n){var r,i,o=Oge(t)?aE:ea;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Ige(e,t){var n=this._id;return arguments.length<2?vs(this.node(),n).on.on(e):this.each(kge(n,e,t))}function Mge(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Nge(){return this.on("end.remove",Mge(this._id))}function Lge(e){var t=this._name,n=this._id;typeof e!="function"&&(e=rE(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s()=>e;function sme(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Oa(e,t,n){this.k=e,this.x=t,this.y=n}Oa.prototype={constructor:Oa,scale:function(e){return e===1?this:new Oa(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Oa(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Hl=new Oa(1,0,0);Oa.prototype;function Ox(e){e.stopImmediatePropagation()}function sp(e){e.preventDefault(),e.stopImmediatePropagation()}function ame(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function lme(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function XR(){return this.__zoom||Hl}function ume(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cme(){return navigator.maxTouchPoints||"ontouchstart"in this}function dme(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function fme(){var e=ame,t=lme,n=dme,r=ume,i=cme,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Kpe,u=zb("start","zoom","end"),d,f,h,g=500,m=150,v=0,x=10;function _(A){A.property("__zoom",XR).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",O).filter(i).on("touchstart.zoom",M).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(A,N,D,U){var $=A.selection?A.selection():A;$.property("__zoom",XR),A!==$?C(A,N,D,U):$.interrupt().each(function(){T(this,arguments).event(U).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},_.scaleBy=function(A,N,D,U){_.scaleTo(A,function(){var $=this.__zoom.k,j=typeof N=="function"?N.apply(this,arguments):N;return $*j},D,U)},_.scaleTo=function(A,N,D,U){_.transform(A,function(){var $=t.apply(this,arguments),j=this.__zoom,G=D==null?S($):typeof D=="function"?D.apply(this,arguments):D,q=j.invert(G),Z=typeof N=="function"?N.apply(this,arguments):N;return n(y(b(j,Z),G,q),$,s)},D,U)},_.translateBy=function(A,N,D,U){_.transform(A,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),s)},null,U)},_.translateTo=function(A,N,D,U,$){_.transform(A,function(){var j=t.apply(this,arguments),G=this.__zoom,q=U==null?S(j):typeof U=="function"?U.apply(this,arguments):U;return n(Hl.translate(q[0],q[1]).scale(G.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof D=="function"?-D.apply(this,arguments):-D),j,s)},U,$)};function b(A,N){return N=Math.max(o[0],Math.min(o[1],N)),N===A.k?A:new Oa(N,A.x,A.y)}function y(A,N,D){var U=N[0]-D[0]*A.k,$=N[1]-D[1]*A.k;return U===A.x&&$===A.y?A:new Oa(A.k,U,$)}function S(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function C(A,N,D,U){A.on("start.zoom",function(){T(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(U).end()}).tween("zoom",function(){var $=this,j=arguments,G=T($,j).event(U),q=t.apply($,j),Z=D==null?S(q):typeof D=="function"?D.apply($,j):D,ee=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),ie=$.__zoom,se=typeof N=="function"?N.apply($,j):N,le=l(ie.invert(Z).concat(ee/ie.k),se.invert(Z).concat(ee/se.k));return function(W){if(W===1)W=se;else{var ne=le(W),fe=ee/ne[2];W=new Oa(fe,Z[0]-ne[0]*fe,Z[1]-ne[1]*fe)}G.zoom(null,W)}})}function T(A,N,D){return!D&&A.__zooming||new E(A,N)}function E(A,N){this.that=A,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,N),this.taps=0}E.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,N){return this.mouse&&A!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var N=rs(this.that).datum();u.call(A,this.that,new sme(A,{sourceEvent:this.sourceEvent,target:_,type:A,transform:this.that.__zoom,dispatch:u}),N)}};function P(A,...N){if(!e.apply(this,arguments))return;var D=T(this,N).event(A),U=this.__zoom,$=Math.max(o[0],Math.min(o[1],U.k*Math.pow(2,r.apply(this,arguments)))),j=Rs(A);if(D.wheel)(D.mouse[0][0]!==j[0]||D.mouse[0][1]!==j[1])&&(D.mouse[1]=U.invert(D.mouse[0]=j)),clearTimeout(D.wheel);else{if(U.k===$)return;D.mouse=[j,U.invert(j)],Rv(this),D.start()}sp(A),D.wheel=setTimeout(G,m),D.zoom("mouse",n(y(b(U,$),D.mouse[0],D.mouse[1]),D.extent,s));function G(){D.wheel=null,D.end()}}function k(A,...N){if(h||!e.apply(this,arguments))return;var D=A.currentTarget,U=T(this,N,!0).event(A),$=rs(A.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",ee,!0),j=Rs(A,D),G=A.clientX,q=A.clientY;YF(A.view),Ox(A),U.mouse=[j,this.__zoom.invert(j)],Rv(this),U.start();function Z(ie){if(sp(ie),!U.moved){var se=ie.clientX-G,le=ie.clientY-q;U.moved=se*se+le*le>v}U.event(ie).zoom("mouse",n(y(U.that.__zoom,U.mouse[0]=Rs(ie,D),U.mouse[1]),U.extent,s))}function ee(ie){$.on("mousemove.zoom mouseup.zoom",null),QF(ie.view,U.moved),sp(ie),U.event(ie).end()}}function O(A,...N){if(e.apply(this,arguments)){var D=this.__zoom,U=Rs(A.changedTouches?A.changedTouches[0]:A,this),$=D.invert(U),j=D.k*(A.shiftKey?.5:2),G=n(y(b(D,j),U,$),t.apply(this,N),s);sp(A),a>0?rs(this).transition().duration(a).call(C,G,U,A):rs(this).call(_.transform,G,U,A)}}function M(A,...N){if(e.apply(this,arguments)){var D=A.touches,U=D.length,$=T(this,N,A.changedTouches.length===U).event(A),j,G,q,Z;for(Ox(A),G=0;G"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`},dB=ou.error001();function Gn(e,t){const n=L.useContext(Hb);if(n===null)throw new Error(dB);return Nfe(n,e,t)}const ii=()=>{const e=L.useContext(Hb);if(e===null)throw new Error(dB);return L.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},pme=e=>e.userSelectionActive?"none":"all";function gme({position:e,children:t,className:n,style:r,...i}){const o=Gn(pme),s=`${e}`.split("-");return ue.jsx("div",{className:$o(["react-flow__panel",n,...s]),style:{...r,pointerEvents:o},...i,children:t})}function mme({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ue.jsx(gme,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:ue.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const yme=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:u,...d})=>{const f=L.useRef(null),[h,g]=L.useState({x:0,y:0,width:0,height:0}),m=$o(["react-flow__edge-textwrapper",u]);return L.useEffect(()=>{if(f.current){const v=f.current.getBBox();g({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),typeof n>"u"||!n?null:ue.jsxs("g",{transform:`translate(${e-h.width/2} ${t-h.height/2})`,className:m,visibility:h.width?"visible":"hidden",...d,children:[i&&ue.jsx("rect",{width:h.width+2*s[0],x:-s[0],y:-s[1],height:h.height+2*s[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),ue.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:f,style:r,children:n}),l]})};var vme=L.memo(yme);const uE=e=>({width:e.offsetWidth,height:e.offsetHeight}),Uf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),cE=(e={x:0,y:0},t)=>({x:Uf(e.x,t[0][0],t[1][0]),y:Uf(e.y,t[0][1],t[1][1])}),YR=(e,t,n)=>en?-Uf(Math.abs(e-n),1,50)/50:0,fB=(e,t)=>{const n=YR(e.x,35,t.width-35)*20,r=YR(e.y,35,t.height-35)*20;return[n,r]},hB=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},pB=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Q1=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),gB=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),QR=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),i7e=(e,t)=>gB(pB(Q1(e),Q1(t))),t5=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},_me=e=>Ro(e.width)&&Ro(e.height)&&Ro(e.x)&&Ro(e.y),Ro=e=>!isNaN(e)&&isFinite(e),pr=Symbol.for("internals"),mB=["Enter"," ","Escape"],bme=(e,t)=>{},Sme=e=>"nativeEvent"in e;function n5(e){var i,o;const t=Sme(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const yB=e=>"clientX"in e,Wl=(e,t)=>{var o,s;const n=yB(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Nm=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:h,interactionWidth:g=20})=>ue.jsxs(ue.Fragment,{children:[ue.jsx("path",{id:e,style:d,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:h}),g&&ue.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"react-flow__edge-interaction"}),i&&Ro(n)&&Ro(r)?ue.jsx(vme,{x:n,y:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]});Nm.displayName="BaseEdge";function ap(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function vB({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[x,_,b]=bB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return ue.jsx(Nm,{path:x,labelX:_,labelY:b,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:m,interactionWidth:v})});dE.displayName="SimpleBezierEdge";const JR={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},wme=({source:e,sourcePosition:t=Ue.Bottom,target:n})=>t===Ue.Left||t===Ue.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function xme({source:e,sourcePosition:t=Ue.Bottom,target:n,targetPosition:r=Ue.Top,center:i,offset:o}){const s=JR[t],a=JR[r],l={x:e.x+s.x*o,y:e.y+s.y*o},u={x:n.x+a.x*o,y:n.y+a.y*o},d=wme({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let g=[],m,v;const[x,_,b,y]=vB({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*a[f]===-1){m=i.x||x,v=i.y||_;const C=[{x:m,y:l.y},{x:m,y:u.y}],T=[{x:l.x,y:v},{x:u.x,y:v}];s[f]===h?g=f==="x"?C:T:g=f==="x"?T:C}else{const C=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(f==="x"?g=s.x===h?T:C:g=s.y===h?C:T,t!==r){const E=f==="x"?"y":"x",P=s[f]===a[E],k=l[E]>u[E],O=l[E]{let y="";return b>0&&b{const[_,b,y]=r5({sourceX:e,sourceY:t,sourcePosition:f,targetX:n,targetY:r,targetPosition:h,borderRadius:v==null?void 0:v.borderRadius,offset:v==null?void 0:v.offset});return ue.jsx(Nm,{path:_,labelX:b,labelY:y,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:d,markerEnd:g,markerStart:m,interactionWidth:x})});Wb.displayName="SmoothStepEdge";const fE=L.memo(e=>{var t;return ue.jsx(Wb,{...e,pathOptions:L.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});fE.displayName="StepEdge";function Tme({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,s,a]=vB({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,s,a]}const hE=L.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:h,interactionWidth:g})=>{const[m,v,x]=Tme({sourceX:e,sourceY:t,targetX:n,targetY:r});return ue.jsx(Nm,{path:m,labelX:v,labelY:x,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:d,markerEnd:f,markerStart:h,interactionWidth:g})});hE.displayName="StraightEdge";function B0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function tO({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Ue.Left:return[t-B0(t-r,o),n];case Ue.Right:return[t+B0(r-t,o),n];case Ue.Top:return[t,n-B0(n-i,o)];case Ue.Bottom:return[t,n+B0(i-n,o)]}}function SB({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:i,targetPosition:o=Ue.Top,curvature:s=.25}){const[a,l]=tO({pos:n,x1:e,y1:t,x2:r,y2:i,c:s}),[u,d]=tO({pos:o,x1:r,y1:i,x2:e,y2:t,c:s}),[f,h,g,m]=_B({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${l} ${u},${d} ${r},${i}`,f,h,g,m]}const J1=L.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=Ue.Bottom,targetPosition:o=Ue.Top,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:m,pathOptions:v,interactionWidth:x})=>{const[_,b,y]=SB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:v==null?void 0:v.curvature});return ue.jsx(Nm,{path:_,labelX:b,labelY:y,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:m,interactionWidth:x})});J1.displayName="BezierEdge";const pE=L.createContext(null),Eme=pE.Provider;pE.Consumer;const Ame=()=>L.useContext(pE),Pme=e=>"id"in e&&"source"in e&&"target"in e,Rme=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,i5=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,Ome=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),wB=(e,t)=>{if(!e.source||!e.target)return t;let n;return Pme(e)?n={...e}:n={...e,id:Rme(e)},Ome(n,t)?t:t.concat(n)},xB=({x:e,y:t},[n,r,i],o,[s,a])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:s*Math.round(l.x/s),y:a*Math.round(l.y/a)}:l},kme=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),mf=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},CB=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:s}=mf(i,t).positionAbsolute;return pB(r,Q1({x:o,y:s,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gB(n)},TB=(e,t,[n,r,i]=[0,0,1],o=!1,s=!1,a=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(d=>{const{width:f,height:h,selectable:g=!0,hidden:m=!1}=d;if(s&&!g||m)return!1;const{positionAbsolute:v}=mf(d,a),x={x:v.x,y:v.y,width:f||0,height:h||0},_=t5(l,x),b=typeof f>"u"||typeof h>"u"||f===null||h===null,y=o&&_>0,S=(f||0)*(h||0);(b||y||_>=S||d.dragging)&&u.push(d)}),u},EB=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},AB=(e,t,n,r,i,o=.1)=>{const s=t/(e.width*(1+o)),a=n/(e.height*(1+o)),l=Math.min(s,a),u=Uf(l,r,i),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,g=n/2-f*u;return[h,g,u]},Vu=(e,t=0)=>e.transition().duration(t);function nO(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var s,a;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+o.x+o.width/2,y:(((a=e.positionAbsolute)==null?void 0:a.y)??0)+o.y+o.height/2}),i},[])}function Ime(e,t,n,r,i,o){const{x:s,y:a}=Wl(e),u=t.elementsFromPoint(s,a).find(m=>m.classList.contains("react-flow__handle"));if(u){const m=u.getAttribute("data-nodeid");if(m){const v=gE(void 0,u),x=u.getAttribute("data-handleid"),_=o({nodeId:m,id:x,type:v});if(_)return{handle:{id:x,type:v,nodeId:m,x:n.x,y:n.y},validHandleResult:_}}}let d=[],f=1/0;if(i.forEach(m=>{const v=Math.sqrt((m.x-n.x)**2+(m.y-n.y)**2);if(v<=r){const x=o(m);v<=f&&(vm.isValid),g=d.some(({handle:m})=>m.type==="target");return d.find(({handle:m,validHandleResult:v})=>g?m.type==="target":h?v.isValid:!0)||d[0]}const Mme={source:null,target:null,sourceHandle:null,targetHandle:null},PB=()=>({handleDomNode:null,isValid:!1,connection:Mme,endHandle:null});function RB(e,t,n,r,i,o,s){const a=i==="target",l=s.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...PB(),handleDomNode:l};if(l){const d=gE(void 0,l),f=l.getAttribute("data-nodeid"),h=l.getAttribute("data-handleid"),g=l.classList.contains("connectable"),m=l.classList.contains("connectableend"),v={source:a?f:n,sourceHandle:a?h:r,target:a?n:f,targetHandle:a?r:h};u.connection=v,g&&m&&(t===bc.Strict?a&&d==="source"||!a&&d==="target":f!==n||h!==r)&&(u.endHandle={nodeId:f,handleId:h,type:d},u.isValid=o(v))}return u}function Nme({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[pr]){const{handleBounds:s}=o[pr];let a=[],l=[];s&&(a=nO(o,s,"source",`${t}-${n}-${r}`),l=nO(o,s,"target",`${t}-${n}-${r}`)),i.push(...a,...l)}return i},[])}function gE(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function kx(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Lme(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function OB({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:s,isValidConnection:a,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const d=hB(e.target),{connectionMode:f,domNode:h,autoPanOnConnect:g,connectionRadius:m,onConnectStart:v,panBy:x,getNodes:_,cancelConnection:b}=o();let y=0,S;const{x:C,y:T}=Wl(e),E=d==null?void 0:d.elementFromPoint(C,T),P=gE(l,E),k=h==null?void 0:h.getBoundingClientRect();if(!k||!P)return;let O,M=Wl(e,k),V=!1,B=null,A=!1,N=null;const D=Nme({nodes:_(),nodeId:n,handleId:t,handleType:P}),U=()=>{if(!g)return;const[G,q]=fB(M,k);x({x:G,y:q}),y=requestAnimationFrame(U)};s({connectionPosition:M,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:P,connectionStartHandle:{nodeId:n,handleId:t,type:P},connectionEndHandle:null}),v==null||v(e,{nodeId:n,handleId:t,handleType:P});function $(G){const{transform:q}=o();M=Wl(G,k);const{handle:Z,validHandleResult:ee}=Ime(G,d,xB(M,q,!1,[1,1]),m,D,ie=>RB(ie,f,n,t,i?"target":"source",a,d));if(S=Z,V||(U(),V=!0),N=ee.handleDomNode,B=ee.connection,A=ee.isValid,s({connectionPosition:S&&A?kme({x:S.x,y:S.y},q):M,connectionStatus:Lme(!!S,A),connectionEndHandle:ee.endHandle}),!S&&!A&&!N)return kx(O);B.source!==B.target&&N&&(kx(O),O=N,N.classList.add("connecting","react-flow__handle-connecting"),N.classList.toggle("valid",A),N.classList.toggle("react-flow__handle-valid",A))}function j(G){var q,Z;(S||N)&&B&&A&&(r==null||r(B)),(Z=(q=o()).onConnectEnd)==null||Z.call(q,G),l&&(u==null||u(G)),kx(O),b(),cancelAnimationFrame(y),V=!1,A=!1,B=null,N=null,d.removeEventListener("mousemove",$),d.removeEventListener("mouseup",j),d.removeEventListener("touchmove",$),d.removeEventListener("touchend",j)}d.addEventListener("mousemove",$),d.addEventListener("mouseup",j),d.addEventListener("touchmove",$),d.addEventListener("touchend",j)}const rO=()=>!0,Dme=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),$me=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:s}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},kB=L.forwardRef(({type:e="source",position:t=Ue.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:s,onConnect:a,children:l,className:u,onMouseDown:d,onTouchStart:f,...h},g)=>{var k,O;const m=s||null,v=e==="target",x=ii(),_=Ame(),{connectOnClick:b,noPanClassName:y}=Gn(Dme,Bi),{connecting:S,clickConnecting:C}=Gn($me(_,m,e),Bi);_||(O=(k=x.getState()).onError)==null||O.call(k,"010",ou.error010());const T=M=>{const{defaultEdgeOptions:V,onConnect:B,hasDefaultEdges:A}=x.getState(),N={...V,...M};if(A){const{edges:D,setEdges:U}=x.getState();U(wB(N,D))}B==null||B(N),a==null||a(N)},E=M=>{if(!_)return;const V=yB(M);i&&(V&&M.button===0||!V)&&OB({event:M,handleId:m,nodeId:_,onConnect:T,isTarget:v,getState:x.getState,setState:x.setState,isValidConnection:n||x.getState().isValidConnection||rO}),V?d==null||d(M):f==null||f(M)},P=M=>{const{onClickConnectStart:V,onClickConnectEnd:B,connectionClickStartHandle:A,connectionMode:N,isValidConnection:D}=x.getState();if(!_||!A&&!i)return;if(!A){V==null||V(M,{nodeId:_,handleId:m,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:m}});return}const U=hB(M.target),$=n||D||rO,{connection:j,isValid:G}=RB({nodeId:_,id:m,type:e},N,A.nodeId,A.handleId||null,A.type,$,U);G&&T(j),B==null||B(M),x.setState({connectionClickStartHandle:null})};return ue.jsx("div",{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${m}-${e}`,className:$o(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,u,{source:!v,target:v,connectable:r,connectablestart:i,connectableend:o,connecting:C,connectionindicator:r&&(i&&!S||o&&S)}]),onMouseDown:E,onTouchStart:E,onClick:b?P:void 0,ref:g,...h,children:l})});kB.displayName="Handle";var e_=L.memo(kB);const IB=({data:e,isConnectable:t,targetPosition:n=Ue.Top,sourcePosition:r=Ue.Bottom})=>ue.jsxs(ue.Fragment,{children:[ue.jsx(e_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ue.jsx(e_,{type:"source",position:r,isConnectable:t})]});IB.displayName="DefaultNode";var o5=L.memo(IB);const MB=({data:e,isConnectable:t,sourcePosition:n=Ue.Bottom})=>ue.jsxs(ue.Fragment,{children:[e==null?void 0:e.label,ue.jsx(e_,{type:"source",position:n,isConnectable:t})]});MB.displayName="InputNode";var NB=L.memo(MB);const LB=({data:e,isConnectable:t,targetPosition:n=Ue.Top})=>ue.jsxs(ue.Fragment,{children:[ue.jsx(e_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});LB.displayName="OutputNode";var DB=L.memo(LB);const mE=()=>null;mE.displayName="GroupNode";const Fme=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),U0=e=>e.id;function Bme(e,t){return Bi(e.selectedNodes.map(U0),t.selectedNodes.map(U0))&&Bi(e.selectedEdges.map(U0),t.selectedEdges.map(U0))}const $B=L.memo(({onSelectionChange:e})=>{const t=ii(),{selectedNodes:n,selectedEdges:r}=Gn(Fme,Bme);return L.useEffect(()=>{var o,s;const i={nodes:n,edges:r};e==null||e(i),(s=(o=t.getState()).onSelectionChange)==null||s.call(o,i)},[n,r,e]),null});$B.displayName="SelectionListener";const Ume=e=>!!e.onSelectionChange;function zme({onSelectionChange:e}){const t=Gn(Ume);return e||t?ue.jsx($B,{onSelectionChange:e}):null}const Vme=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function md(e,t){L.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function mt(e,t,n){L.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const jme=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:s,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:d,nodesFocusable:f,edgesFocusable:h,edgesUpdatable:g,elevateNodesOnSelect:m,minZoom:v,maxZoom:x,nodeExtent:_,onNodesChange:b,onEdgesChange:y,elementsSelectable:S,connectionMode:C,snapGrid:T,snapToGrid:E,translateExtent:P,connectOnClick:k,defaultEdgeOptions:O,fitView:M,fitViewOptions:V,onNodesDelete:B,onEdgesDelete:A,onNodeDrag:N,onNodeDragStart:D,onNodeDragStop:U,onSelectionDrag:$,onSelectionDragStart:j,onSelectionDragStop:G,noPanClassName:q,nodeOrigin:Z,rfId:ee,autoPanOnConnect:ie,autoPanOnNodeDrag:se,onError:le,connectionRadius:W,isValidConnection:ne})=>{const{setNodes:fe,setEdges:pe,setDefaultNodesAndEdges:ve,setMinZoom:ye,setMaxZoom:Je,setTranslateExtent:Fe,setNodeExtent:Ae,reset:vt}=Gn(Vme,Bi),_e=ii();return L.useEffect(()=>{const Qt=r==null?void 0:r.map(rr=>({...rr,...O}));return ve(n,Qt),()=>{vt()}},[]),mt("defaultEdgeOptions",O,_e.setState),mt("connectionMode",C,_e.setState),mt("onConnect",i,_e.setState),mt("onConnectStart",o,_e.setState),mt("onConnectEnd",s,_e.setState),mt("onClickConnectStart",a,_e.setState),mt("onClickConnectEnd",l,_e.setState),mt("nodesDraggable",u,_e.setState),mt("nodesConnectable",d,_e.setState),mt("nodesFocusable",f,_e.setState),mt("edgesFocusable",h,_e.setState),mt("edgesUpdatable",g,_e.setState),mt("elementsSelectable",S,_e.setState),mt("elevateNodesOnSelect",m,_e.setState),mt("snapToGrid",E,_e.setState),mt("snapGrid",T,_e.setState),mt("onNodesChange",b,_e.setState),mt("onEdgesChange",y,_e.setState),mt("connectOnClick",k,_e.setState),mt("fitViewOnInit",M,_e.setState),mt("fitViewOnInitOptions",V,_e.setState),mt("onNodesDelete",B,_e.setState),mt("onEdgesDelete",A,_e.setState),mt("onNodeDrag",N,_e.setState),mt("onNodeDragStart",D,_e.setState),mt("onNodeDragStop",U,_e.setState),mt("onSelectionDrag",$,_e.setState),mt("onSelectionDragStart",j,_e.setState),mt("onSelectionDragStop",G,_e.setState),mt("noPanClassName",q,_e.setState),mt("nodeOrigin",Z,_e.setState),mt("rfId",ee,_e.setState),mt("autoPanOnConnect",ie,_e.setState),mt("autoPanOnNodeDrag",se,_e.setState),mt("onError",le,_e.setState),mt("connectionRadius",W,_e.setState),mt("isValidConnection",ne,_e.setState),md(e,fe),md(t,pe),md(v,ye),md(x,Je),md(P,Fe),md(_,Ae),null},iO={display:"none"},Gme={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},FB="react-flow__node-desc",BB="react-flow__edge-desc",Hme="react-flow__aria-live",Wme=e=>e.ariaLiveMessage;function qme({rfId:e}){const t=Gn(Wme);return ue.jsx("div",{id:`${Hme}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Gme,children:t})}function Kme({rfId:e,disableKeyboardA11y:t}){return ue.jsxs(ue.Fragment,{children:[ue.jsxs("div",{id:`${FB}-${e}`,style:iO,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),ue.jsx("div",{id:`${BB}-${e}`,style:iO,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&ue.jsx(qme,{rfId:e})]})}const Xme=(e,t,n)=>n===Ue.Left?e-t:n===Ue.Right?e+t:e,Yme=(e,t,n)=>n===Ue.Top?e-t:n===Ue.Bottom?e+t:e,oO="react-flow__edgeupdater",sO=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:s,type:a})=>ue.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:s,className:$o([oO,`${oO}-${a}`]),cx:Xme(t,r,e),cy:Yme(n,r,e),r,stroke:"transparent",fill:"transparent"}),Qme=()=>!0;var yd=e=>{const t=({id:n,className:r,type:i,data:o,onClick:s,onEdgeDoubleClick:a,selected:l,animated:u,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:v,style:x,source:_,target:b,sourceX:y,sourceY:S,targetX:C,targetY:T,sourcePosition:E,targetPosition:P,elementsSelectable:k,hidden:O,sourceHandleId:M,targetHandleId:V,onContextMenu:B,onMouseEnter:A,onMouseMove:N,onMouseLeave:D,edgeUpdaterRadius:U,onEdgeUpdate:$,onEdgeUpdateStart:j,onEdgeUpdateEnd:G,markerEnd:q,markerStart:Z,rfId:ee,ariaLabel:ie,isFocusable:se,isUpdatable:le,pathOptions:W,interactionWidth:ne})=>{const fe=L.useRef(null),[pe,ve]=L.useState(!1),[ye,Je]=L.useState(!1),Fe=ii(),Ae=L.useMemo(()=>`url(#${i5(Z,ee)})`,[Z,ee]),vt=L.useMemo(()=>`url(#${i5(q,ee)})`,[q,ee]);if(O)return null;const _e=mn=>{const{edges:Zt,addSelectedEdges:Rr}=Fe.getState();if(k&&(Fe.setState({nodesSelectionActive:!1}),Rr([n])),s){const Hr=Zt.find(si=>si.id===n);s(mn,Hr)}},Qt=ap(n,Fe.getState,a),rr=ap(n,Fe.getState,B),qt=ap(n,Fe.getState,A),ht=ap(n,Fe.getState,N),At=ap(n,Fe.getState,D),un=(mn,Zt)=>{if(mn.button!==0)return;const{edges:Rr,isValidConnection:Hr}=Fe.getState(),si=Zt?b:_,Vi=(Zt?V:M)||null,$n=Zt?"target":"source",ai=Hr||Qme,ra=Zt,uo=Rr.find(Ft=>Ft.id===n);Je(!0),j==null||j(mn,uo,$n);const ia=Ft=>{Je(!1),G==null||G(Ft,uo,$n)};OB({event:mn,handleId:Vi,nodeId:si,onConnect:Ft=>$==null?void 0:$(uo,Ft),isTarget:ra,getState:Fe.getState,setState:Fe.setState,isValidConnection:ai,edgeUpdaterType:$n,onEdgeUpdateEnd:ia})},Gr=mn=>un(mn,!0),Pr=mn=>un(mn,!1),Ci=()=>ve(!0),In=()=>ve(!1),gn=!k&&!s,ir=mn=>{var Zt;if(mB.includes(mn.key)&&k){const{unselectNodesAndEdges:Rr,addSelectedEdges:Hr,edges:si}=Fe.getState();mn.key==="Escape"?((Zt=fe.current)==null||Zt.blur(),Rr({edges:[si.find($n=>$n.id===n)]})):Hr([n])}};return ue.jsxs("g",{className:$o(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:gn,updating:pe}]),onClick:_e,onDoubleClick:Qt,onContextMenu:rr,onMouseEnter:qt,onMouseMove:ht,onMouseLeave:At,onKeyDown:se?ir:void 0,tabIndex:se?0:void 0,role:se?"button":void 0,"data-testid":`rf__edge-${n}`,"aria-label":ie===null?void 0:ie||`Edge from ${_} to ${b}`,"aria-describedby":se?`${BB}-${ee}`:void 0,ref:fe,children:[!ye&&ue.jsx(e,{id:n,source:_,target:b,selected:l,animated:u,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:m,labelBgBorderRadius:v,data:o,style:x,sourceX:y,sourceY:S,targetX:C,targetY:T,sourcePosition:E,targetPosition:P,sourceHandleId:M,targetHandleId:V,markerStart:Ae,markerEnd:vt,pathOptions:W,interactionWidth:ne}),le&&ue.jsxs(ue.Fragment,{children:[(le==="source"||le===!0)&&ue.jsx(sO,{position:E,centerX:y,centerY:S,radius:U,onMouseDown:Gr,onMouseEnter:Ci,onMouseOut:In,type:"source"}),(le==="target"||le===!0)&&ue.jsx(sO,{position:P,centerX:C,centerY:T,radius:U,onMouseDown:Pr,onMouseEnter:Ci,onMouseOut:In,type:"target"})]})]})};return t.displayName="EdgeWrapper",L.memo(t)};function Zme(e){const t={default:yd(e.default||J1),straight:yd(e.bezier||hE),step:yd(e.step||fE),smoothstep:yd(e.step||Wb),simplebezier:yd(e.simplebezier||dE)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=yd(e[o]||J1),i),n);return{...t,...r}}function aO(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case Ue.Top:return{x:r+o/2,y:i};case Ue.Right:return{x:r+o,y:i+s/2};case Ue.Bottom:return{x:r+o/2,y:i+s};case Ue.Left:return{x:r,y:i+s/2}}}function lO(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const Jme=(e,t,n,r,i,o)=>{const s=aO(n,e,t),a=aO(o,r,i);return{sourceX:s.x,sourceY:s.y,targetX:a.x,targetY:a.y}};function eye({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:s,height:a,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const d=Q1({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:s/l[2],height:a/l[2]}),f=Math.max(0,Math.min(d.x2,u.x2)-Math.max(d.x,u.x)),h=Math.max(0,Math.min(d.y2,u.y2)-Math.max(d.y,u.y));return Math.ceil(f*h)>0}function uO(e){var r,i,o,s,a;const t=((r=e==null?void 0:e[pr])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}function UB(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:UB(n,t):!1}function cO(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function tye(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!UB(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,s;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((s=i.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function nye(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function zB(e,t,n,r,i=[0,0],o){const s=nye(e,e.extent||r);let a=s;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const d=n.get(e.parentNode),{x:f,y:h}=mf(d,i).positionAbsolute;a=d&&Ro(f)&&Ro(h)&&Ro(d.width)&&Ro(d.height)?[[f+e.width*i[0],h+e.height*i[1]],[f+d.width-e.width+e.width*i[0],h+d.height-e.height+e.height*i[1]]]:a}else o==null||o("005",ou.error005()),a=s;else if(e.extent&&e.parentNode){const d=n.get(e.parentNode),{x:f,y:h}=mf(d,i).positionAbsolute;a=[[e.extent[0][0]+f,e.extent[0][1]+h],[e.extent[1][0]+f,e.extent[1][1]+h]]}let l={x:0,y:0};if(e.parentNode){const d=n.get(e.parentNode);l=mf(d,i).positionAbsolute}const u=a?cE(t,a):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function Ix({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const dO=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),s=t.getBoundingClientRect(),a={x:s.width*r[0],y:s.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-s.left-a.x)/n,y:(u.top-s.top-a.y)/n,...uE(l)}})};function lp(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);n(r,{...i})}}function s5({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:s,nodeInternals:a}=t.getState(),l=a.get(e);t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(o({nodes:[l]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):i([e])}function rye(){const e=ii();return L.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,a=n.touches?n.touches[0].clientY:n.clientY,l={x:(s-r[0])/r[2],y:(a-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function Mx(e){return(t,n,r)=>e==null?void 0:e(t,r)}function VB({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:s}){const a=ii(),[l,u]=L.useState(!1),d=L.useRef([]),f=L.useRef({x:null,y:null}),h=L.useRef(0),g=L.useRef(null),m=L.useRef({x:0,y:0}),v=L.useRef(null),x=L.useRef(!1),_=rye();return L.useEffect(()=>{if(e!=null&&e.current){const b=rs(e.current),y=({x:C,y:T})=>{const{nodeInternals:E,onNodeDrag:P,onSelectionDrag:k,updateNodePositions:O,nodeExtent:M,snapGrid:V,snapToGrid:B,nodeOrigin:A,onError:N}=a.getState();f.current={x:C,y:T};let D=!1;if(d.current=d.current.map($=>{const j={x:C-$.distance.x,y:T-$.distance.y};B&&(j.x=V[0]*Math.round(j.x/V[0]),j.y=V[1]*Math.round(j.y/V[1]));const G=zB($,j,E,M,A,N);return D=D||$.position.x!==G.position.x||$.position.y!==G.position.y,$.position=G.position,$.positionAbsolute=G.positionAbsolute,$}),!D)return;O(d.current,!0,!0),u(!0);const U=i?P:Mx(k);if(U&&v.current){const[$,j]=Ix({nodeId:i,dragItems:d.current,nodeInternals:E});U(v.current,$,j)}},S=()=>{if(!g.current)return;const[C,T]=fB(m.current,g.current);if(C!==0||T!==0){const{transform:E,panBy:P}=a.getState();f.current.x=(f.current.x??0)-C/E[2],f.current.y=(f.current.y??0)-T/E[2],P({x:C,y:T})&&y(f.current)}h.current=requestAnimationFrame(S)};if(t)b.on(".drag",null);else{const C=wpe().on("start",T=>{var D;const{nodeInternals:E,multiSelectionActive:P,domNode:k,nodesDraggable:O,unselectNodesAndEdges:M,onNodeDragStart:V,onSelectionDragStart:B}=a.getState(),A=i?V:Mx(B);!s&&!P&&i&&((D=E.get(i))!=null&&D.selected||M()),i&&o&&s&&s5({id:i,store:a,nodeRef:e});const N=_(T);if(f.current=N,d.current=tye(E,O,N,i),A&&d.current){const[U,$]=Ix({nodeId:i,dragItems:d.current,nodeInternals:E});A(T.sourceEvent,U,$)}g.current=(k==null?void 0:k.getBoundingClientRect())||null,m.current=Wl(T.sourceEvent,g.current)}).on("drag",T=>{const E=_(T),{autoPanOnNodeDrag:P}=a.getState();!x.current&&P&&(x.current=!0,S()),(f.current.x!==E.xSnapped||f.current.y!==E.ySnapped)&&d.current&&(v.current=T.sourceEvent,m.current=Wl(T.sourceEvent,g.current),y(E))}).on("end",T=>{if(u(!1),x.current=!1,cancelAnimationFrame(h.current),d.current){const{updateNodePositions:E,nodeInternals:P,onNodeDragStop:k,onSelectionDragStop:O}=a.getState(),M=i?k:Mx(O);if(E(d.current,!1,!1),M){const[V,B]=Ix({nodeId:i,dragItems:d.current,nodeInternals:P});M(T.sourceEvent,V,B)}}}).filter(T=>{const E=T.target;return!T.button&&(!n||!cO(E,`.${n}`,e))&&(!r||cO(E,r,e))});return b.call(C),()=>{b.on(".drag",null)}}}},[e,t,n,r,o,a,i,s,_]),l}function jB(){const e=ii();return L.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:s,snapToGrid:a,snapGrid:l,onError:u,nodesDraggable:d}=e.getState(),f=s().filter(b=>b.selected&&(b.draggable||d&&typeof b.draggable>"u")),h=a?l[0]:5,g=a?l[1]:5,m=n.isShiftPressed?4:1,v=n.x*h*m,x=n.y*g*m,_=f.map(b=>{if(b.positionAbsolute){const y={x:b.positionAbsolute.x+v,y:b.positionAbsolute.y+x};a&&(y.x=l[0]*Math.round(y.x/l[0]),y.y=l[1]*Math.round(y.y/l[1]));const{positionAbsolute:S,position:C}=zB(b,y,r,i,void 0,u);b.position=C,b.positionAbsolute=S}return b});o(_,!0,!1)},[])}const yf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var up=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:s,xPosOrigin:a,yPosOrigin:l,selected:u,onClick:d,onMouseEnter:f,onMouseMove:h,onMouseLeave:g,onContextMenu:m,onDoubleClick:v,style:x,className:_,isDraggable:b,isSelectable:y,isConnectable:S,isFocusable:C,selectNodesOnDrag:T,sourcePosition:E,targetPosition:P,hidden:k,resizeObserver:O,dragHandle:M,zIndex:V,isParent:B,noDragClassName:A,noPanClassName:N,initialized:D,disableKeyboardA11y:U,ariaLabel:$,rfId:j})=>{const G=ii(),q=L.useRef(null),Z=L.useRef(E),ee=L.useRef(P),ie=L.useRef(r),se=y||b||d||f||h||g,le=jB(),W=lp(n,G.getState,f),ne=lp(n,G.getState,h),fe=lp(n,G.getState,g),pe=lp(n,G.getState,m),ve=lp(n,G.getState,v),ye=Ae=>{if(y&&(!T||!b)&&s5({id:n,store:G,nodeRef:q}),d){const vt=G.getState().nodeInternals.get(n);d(Ae,{...vt})}},Je=Ae=>{if(!n5(Ae))if(mB.includes(Ae.key)&&y){const vt=Ae.key==="Escape";s5({id:n,store:G,unselect:vt,nodeRef:q})}else!U&&b&&u&&Object.prototype.hasOwnProperty.call(yf,Ae.key)&&(G.setState({ariaLiveMessage:`Moved selected node ${Ae.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~s}`}),le({x:yf[Ae.key].x,y:yf[Ae.key].y,isShiftPressed:Ae.shiftKey}))};L.useEffect(()=>{if(q.current&&!k){const Ae=q.current;return O==null||O.observe(Ae),()=>O==null?void 0:O.unobserve(Ae)}},[k]),L.useEffect(()=>{const Ae=ie.current!==r,vt=Z.current!==E,_e=ee.current!==P;q.current&&(Ae||vt||_e)&&(Ae&&(ie.current=r),vt&&(Z.current=E),_e&&(ee.current=P),G.getState().updateNodeDimensions([{id:n,nodeElement:q.current,forceUpdate:!0}]))},[n,r,E,P]);const Fe=VB({nodeRef:q,disabled:k||!b,noDragClassName:A,handleSelector:M,nodeId:n,isSelectable:y,selectNodesOnDrag:T});return k?null:ue.jsx("div",{className:$o(["react-flow__node",`react-flow__node-${r}`,{[N]:b},_,{selected:u,selectable:y,parent:B,dragging:Fe}]),ref:q,style:{zIndex:V,transform:`translate(${a}px,${l}px)`,pointerEvents:se?"all":"none",visibility:D?"visible":"hidden",...x},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:W,onMouseMove:ne,onMouseLeave:fe,onContextMenu:pe,onClick:ye,onDoubleClick:ve,onKeyDown:C?Je:void 0,tabIndex:C?0:void 0,role:C?"button":void 0,"aria-describedby":U?void 0:`${FB}-${j}`,"aria-label":$,children:ue.jsx(Eme,{value:n,children:ue.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:s,selected:u,isConnectable:S,sourcePosition:E,targetPosition:P,dragging:Fe,dragHandle:M,zIndex:V})})})};return t.displayName="NodeWrapper",L.memo(t)};function iye(e){const t={input:up(e.input||NB),default:up(e.default||o5),output:up(e.output||DB),group:up(e.group||mE)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=up(e[o]||o5),i),n);return{...t,...r}}const oye=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},sye=typeof document<"u"?document:null;var Wg=(e=null,t={target:sye})=>{const[n,r]=L.useState(!1),i=L.useRef(!1),o=L.useRef(new Set([])),[s,a]=L.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return L.useEffect(()=>{var l,u;if(e!==null){const d=g=>{if(i.current=g.ctrlKey||g.metaKey||g.shiftKey,!i.current&&n5(g))return!1;const m=hO(g.code,a);o.current.add(g[m]),fO(s,o.current,!1)&&(g.preventDefault(),r(!0))},f=g=>{if(!i.current&&n5(g))return!1;const m=hO(g.code,a);fO(s,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(g[m]),i.current=!1},h=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",d),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",f),window.addEventListener("blur",h),()=>{var g,m;(g=t==null?void 0:t.target)==null||g.removeEventListener("keydown",d),(m=t==null?void 0:t.target)==null||m.removeEventListener("keyup",f),window.removeEventListener("blur",h)}}},[e,r]),n};function fO(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function hO(e,t){return t.includes(e)?"code":"key"}function GB(e,t,n,r){var s,a;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=mf(i,r);return GB(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((s=i[pr])==null?void 0:s.z)??0)>(n.z??0)?((a=i[pr])==null?void 0:a.z)??0:n.z??0},r)}function HB(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:s,z:a}=GB(r,e,{...r.position,z:((i=r[pr])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:s},r[pr].z=a,n!=null&&n[r.id]&&(r[pr].isParent=!0)}})}function Nx(e,t,n,r){const i=new Map,o={},s=r?1e3:0;return e.forEach(a=>{var f;const l=(Ro(a.zIndex)?a.zIndex:0)+(a.selected?s:0),u=t.get(a.id),d={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...a,positionAbsolute:{x:a.position.x,y:a.position.y}};a.parentNode&&(d.parentNode=a.parentNode,o[a.parentNode]=!0),Object.defineProperty(d,pr,{enumerable:!1,value:{handleBounds:(f=u==null?void 0:u[pr])==null?void 0:f.handleBounds,z:l}}),i.set(a.id,d)}),HB(i,n,o),i}function WB(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:s,d3Zoom:a,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:d,nodeOrigin:f}=e(),h=t.initial&&!u&&d;if(a&&l&&(h||!t.initial)){const m=n().filter(x=>{var b;const _=t.includeHiddenNodes?x.width&&x.height:!x.hidden;return(b=t.nodes)!=null&&b.length?_&&t.nodes.some(y=>y.id===x.id):_}),v=m.every(x=>x.width&&x.height);if(m.length>0&&v){const x=CB(m,f),[_,b,y]=AB(x,r,i,t.minZoom??o,t.maxZoom??s,t.padding??.1),S=Hl.translate(_,b).scale(y);return typeof t.duration=="number"&&t.duration>0?a.transform(Vu(l,t.duration),S):a.transform(l,S),!0}}return!1}function aye(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[pr]:r[pr],selected:n.selected})}),new Map(t)}function lye(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function z0({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:s,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:aye(e,i)}),s==null||s(e)),t!=null&&t.length&&(u&&r({edges:lye(t,o)}),a==null||a(t))}const vd=()=>{},uye={zoomIn:vd,zoomOut:vd,zoomTo:vd,getZoom:()=>1,setViewport:vd,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:vd,fitBounds:vd,project:e=>e,viewportInitialized:!1},cye=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),dye=()=>{const e=ii(),{d3Zoom:t,d3Selection:n}=Gn(cye,Bi);return L.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(Vu(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(Vu(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(Vu(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[s,a,l]=e.getState().transform,u=Hl.translate(i.x??s,i.y??a).scale(i.zoom??l);t.transform(Vu(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,s]=e.getState().transform;return{x:i,y:o,zoom:s}},fitView:i=>WB(e.getState,i),setCenter:(i,o,s)=>{const{width:a,height:l,maxZoom:u}=e.getState(),d=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:u,f=a/2-i*d,h=l/2-o*d,g=Hl.translate(f,h).scale(d);t.transform(Vu(n,s==null?void 0:s.duration),g)},fitBounds:(i,o)=>{const{width:s,height:a,minZoom:l,maxZoom:u}=e.getState(),[d,f,h]=AB(i,s,a,l,u,(o==null?void 0:o.padding)??.1),g=Hl.translate(d,f).scale(h);t.transform(Vu(n,o==null?void 0:o.duration),g)},project:i=>{const{transform:o,snapToGrid:s,snapGrid:a}=e.getState();return xB(i,o,s,a)},viewportInitialized:!0}:uye,[t,n])};function qB(){const e=dye(),t=ii(),n=L.useCallback(()=>t.getState().getNodes().map(v=>({...v})),[]),r=L.useCallback(v=>t.getState().nodeInternals.get(v),[]),i=L.useCallback(()=>{const{edges:v=[]}=t.getState();return v.map(x=>({...x}))},[]),o=L.useCallback(v=>{const{edges:x=[]}=t.getState();return x.find(_=>_.id===v)},[]),s=L.useCallback(v=>{const{getNodes:x,setNodes:_,hasDefaultNodes:b,onNodesChange:y}=t.getState(),S=x(),C=typeof v=="function"?v(S):v;if(b)_(C);else if(y){const T=C.length===0?S.map(E=>({type:"remove",id:E.id})):C.map(E=>({item:E,type:"reset"}));y(T)}},[]),a=L.useCallback(v=>{const{edges:x=[],setEdges:_,hasDefaultEdges:b,onEdgesChange:y}=t.getState(),S=typeof v=="function"?v(x):v;if(b)_(S);else if(y){const C=S.length===0?x.map(T=>({type:"remove",id:T.id})):S.map(T=>({item:T,type:"reset"}));y(C)}},[]),l=L.useCallback(v=>{const x=Array.isArray(v)?v:[v],{getNodes:_,setNodes:b,hasDefaultNodes:y,onNodesChange:S}=t.getState();if(y){const T=[..._(),...x];b(T)}else if(S){const C=x.map(T=>({item:T,type:"add"}));S(C)}},[]),u=L.useCallback(v=>{const x=Array.isArray(v)?v:[v],{edges:_=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:S}=t.getState();if(y)b([..._,...x]);else if(S){const C=x.map(T=>({item:T,type:"add"}));S(C)}},[]),d=L.useCallback(()=>{const{getNodes:v,edges:x=[],transform:_}=t.getState(),[b,y,S]=_;return{nodes:v().map(C=>({...C})),edges:x.map(C=>({...C})),viewport:{x:b,y,zoom:S}}},[]),f=L.useCallback(({nodes:v,edges:x})=>{const{nodeInternals:_,getNodes:b,edges:y,hasDefaultNodes:S,hasDefaultEdges:C,onNodesDelete:T,onEdgesDelete:E,onNodesChange:P,onEdgesChange:k}=t.getState(),O=(v||[]).map(N=>N.id),M=(x||[]).map(N=>N.id),V=b().reduce((N,D)=>{const U=!O.includes(D.id)&&D.parentNode&&N.find(j=>j.id===D.parentNode);return(typeof D.deletable=="boolean"?D.deletable:!0)&&(O.includes(D.id)||U)&&N.push(D),N},[]),B=y.filter(N=>typeof N.deletable=="boolean"?N.deletable:!0),A=B.filter(N=>M.includes(N.id));if(V||A){const N=EB(V,B),D=[...A,...N],U=D.reduce(($,j)=>($.includes(j.id)||$.push(j.id),$),[]);if((C||S)&&(C&&t.setState({edges:y.filter($=>!U.includes($.id))}),S&&(V.forEach($=>{_.delete($.id)}),t.setState({nodeInternals:new Map(_)}))),U.length>0&&(E==null||E(D),k&&k(U.map($=>({id:$,type:"remove"})))),V.length>0&&(T==null||T(V),P)){const $=V.map(j=>({id:j.id,type:"remove"}));P($)}}},[]),h=L.useCallback(v=>{const x=_me(v),_=x?null:t.getState().nodeInternals.get(v.id);return[x?v:QR(_),_,x]},[]),g=L.useCallback((v,x=!0,_)=>{const[b,y,S]=h(v);return b?(_||t.getState().getNodes()).filter(C=>{if(!S&&(C.id===y.id||!C.positionAbsolute))return!1;const T=QR(C),E=t5(T,b);return x&&E>0||E>=v.width*v.height}):[]},[]),m=L.useCallback((v,x,_=!0)=>{const[b]=h(v);if(!b)return!1;const y=t5(b,x);return _&&y>0||y>=v.width*v.height},[]);return L.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:s,setEdges:a,addNodes:l,addEdges:u,toObject:d,deleteElements:f,getIntersectingNodes:g,isNodeIntersecting:m}),[e,n,r,i,o,s,a,l,u,d,f,g,m])}var fye=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=ii(),{deleteElements:r}=qB(),i=Wg(e),o=Wg(t);L.useEffect(()=>{if(i){const{edges:s,getNodes:a}=n.getState(),l=a().filter(d=>d.selected),u=s.filter(d=>d.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),L.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function hye(e){const t=ii();L.useEffect(()=>{let n;const r=()=>{var o,s;if(!e.current)return;const i=uE(e.current);(i.height===0||i.width===0)&&((s=(o=t.getState()).onError)==null||s.call(o,"004",ou.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const yE={position:"absolute",width:"100%",height:"100%",top:0,left:0},pye=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Lx=e=>({x:e.x,y:e.y,zoom:e.k}),_d=(e,t)=>e.target.closest(`.${t}`),pO=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),gye=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),mye=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=gf.Free,zoomOnDoubleClick:u=!0,elementsSelectable:d,panOnDrag:f=!0,defaultViewport:h,translateExtent:g,minZoom:m,maxZoom:v,zoomActivationKeyCode:x,preventScrolling:_=!0,children:b,noWheelClassName:y,noPanClassName:S})=>{const C=L.useRef(),T=ii(),E=L.useRef(!1),P=L.useRef(!1),k=L.useRef(null),O=L.useRef({x:0,y:0,zoom:0}),{d3Zoom:M,d3Selection:V,d3ZoomHandler:B,userSelectionActive:A}=Gn(gye,Bi),N=Wg(x),D=L.useRef(0);return hye(k),L.useEffect(()=>{if(k.current){const U=k.current.getBoundingClientRect(),$=fme().scaleExtent([m,v]).translateExtent(g),j=rs(k.current).call($),G=Hl.translate(h.x,h.y).scale(Uf(h.zoom,m,v)),q=[[0,0],[U.width,U.height]],Z=$.constrain()(G,q,g);$.transform(j,Z),T.setState({d3Zoom:$,d3Selection:j,d3ZoomHandler:j.on("wheel.zoom"),transform:[Z.x,Z.y,Z.k],domNode:k.current.closest(".react-flow")})}},[]),L.useEffect(()=>{V&&M&&(s&&!N&&!A?V.on("wheel.zoom",U=>{if(_d(U,y))return!1;U.preventDefault(),U.stopImmediatePropagation();const $=V.property("__zoom").k||1;if(U.ctrlKey&&o){const Z=Rs(U),ee=-U.deltaY*(U.deltaMode===1?.05:U.deltaMode?1:.002)*10,ie=$*Math.pow(2,ee);M.scaleTo(V,ie,Z);return}const j=U.deltaMode===1?20:1,G=l===gf.Vertical?0:U.deltaX*j,q=l===gf.Horizontal?0:U.deltaY*j;M.translateBy(V,-(G/$)*a,-(q/$)*a)},{passive:!1}):typeof B<"u"&&V.on("wheel.zoom",function(U,$){if(!_||_d(U,y))return null;U.preventDefault(),B.call(this,U,$)},{passive:!1}))},[A,s,l,V,M,B,N,o,_,y]),L.useEffect(()=>{M&&M.on("start",U=>{var j;if(!U.sourceEvent)return null;D.current=U.sourceEvent.button;const{onViewportChangeStart:$}=T.getState();if(E.current=!0,((j=U.sourceEvent)==null?void 0:j.type)==="mousedown"&&T.setState({paneDragging:!0}),t||$){const G=Lx(U.transform);O.current=G,$==null||$(G),t==null||t(U.sourceEvent,G)}})},[M,t]),L.useEffect(()=>{M&&(A&&!E.current?M.on("zoom",null):A||M.on("zoom",U=>{const{onViewportChange:$}=T.getState();if(T.setState({transform:[U.transform.x,U.transform.y,U.transform.k]}),P.current=!!(r&&pO(f,D.current??0)),e||$){const j=Lx(U.transform);$==null||$(j),e==null||e(U.sourceEvent,j)}}))},[A,M,e,f,r]),L.useEffect(()=>{M&&M.on("end",U=>{if(!U.sourceEvent)return null;const{onViewportChangeEnd:$}=T.getState();if(E.current=!1,T.setState({paneDragging:!1}),r&&pO(f,D.current??0)&&!P.current&&r(U.sourceEvent),P.current=!1,(n||$)&&pye(O.current,U.transform)){const j=Lx(U.transform);O.current=j,clearTimeout(C.current),C.current=setTimeout(()=>{$==null||$(j),n==null||n(U.sourceEvent,j)},s?150:0)}})},[M,s,f,n,r]),L.useEffect(()=>{M&&M.filter(U=>{const $=N||i,j=o&&U.ctrlKey;if(U.button===1&&U.type==="mousedown"&&(_d(U,"react-flow__node")||_d(U,"react-flow__edge")))return!0;if(!f&&!$&&!s&&!u&&!o||A||!u&&U.type==="dblclick"||_d(U,y)&&U.type==="wheel"||_d(U,S)&&U.type!=="wheel"||!o&&U.ctrlKey&&U.type==="wheel"||!$&&!s&&!j&&U.type==="wheel"||!f&&(U.type==="mousedown"||U.type==="touchstart")||Array.isArray(f)&&!f.includes(U.button)&&(U.type==="mousedown"||U.type==="touchstart"))return!1;const G=Array.isArray(f)&&f.includes(U.button)||!U.button||U.button<=1;return(!U.ctrlKey||U.type==="wheel")&&G})},[A,M,i,o,s,u,f,d,N]),ue.jsx("div",{className:"react-flow__renderer",ref:k,style:yE,children:b})},yye=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function vye(){const{userSelectionActive:e,userSelectionRect:t}=Gn(yye,Bi);return e&&t?ue.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function gO(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function KB(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(a=>a.id===i.id);if(o.length===0)return r.push(i),r;const s={...i};for(const a of o)if(a)switch(a.type){case"select":{s.selected=a.selected;break}case"position":{typeof a.position<"u"&&(s.position=a.position),typeof a.positionAbsolute<"u"&&(s.positionAbsolute=a.positionAbsolute),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&gO(r,s);break}case"dimensions":{typeof a.dimensions<"u"&&(s.width=a.dimensions.width,s.height=a.dimensions.height),typeof a.updateStyle<"u"&&(s.style={...s.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(s.resizing=a.resizing),s.expandParent&&gO(r,s);break}case"remove":return r}return r.push(s),r},n)}function XB(e,t){return KB(e,t)}function _ye(e,t){return KB(e,t)}const Cl=(e,t)=>({id:e,type:"select",selected:t});function qd(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(Cl(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(Cl(r.id,!1))),n},[])}const Dx=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},bye=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),YB=L.memo(({isSelecting:e,selectionMode:t=Hg.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:s,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:d,children:f})=>{const h=L.useRef(null),g=ii(),m=L.useRef(0),v=L.useRef(0),x=L.useRef(),{userSelectionActive:_,elementsSelectable:b,dragging:y}=Gn(bye,Bi),S=()=>{g.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,v.current=0},C=B=>{o==null||o(B),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},T=B=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){B.preventDefault();return}s==null||s(B)},E=a?B=>a(B):void 0,P=B=>{const{resetSelectedElements:A,domNode:N}=g.getState();if(x.current=N==null?void 0:N.getBoundingClientRect(),!b||!e||B.button!==0||B.target!==h.current||!x.current)return;const{x:D,y:U}=Wl(B,x.current);A(),g.setState({userSelectionRect:{width:0,height:0,startX:D,startY:U,x:D,y:U}}),r==null||r(B)},k=B=>{const{userSelectionRect:A,nodeInternals:N,edges:D,transform:U,onNodesChange:$,onEdgesChange:j,nodeOrigin:G,getNodes:q}=g.getState();if(!e||!x.current||!A)return;g.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Z=Wl(B,x.current),ee=A.startX??0,ie=A.startY??0,se={...A,x:Z.xpe.id),fe=W.map(pe=>pe.id);if(m.current!==fe.length){m.current=fe.length;const pe=qd(le,fe);pe.length&&($==null||$(pe))}if(v.current!==ne.length){v.current=ne.length;const pe=qd(D,ne);pe.length&&(j==null||j(pe))}g.setState({userSelectionRect:se})},O=B=>{if(B.button!==0)return;const{userSelectionRect:A}=g.getState();!_&&A&&B.target===h.current&&(C==null||C(B)),g.setState({nodesSelectionActive:m.current>0}),S(),i==null||i(B)},M=B=>{_&&(g.setState({nodesSelectionActive:m.current>0}),i==null||i(B)),S()},V=b&&(e||_);return ue.jsxs("div",{className:$o(["react-flow__pane",{dragging:y,selection:e}]),onClick:V?void 0:Dx(C,h),onContextMenu:Dx(T,h),onWheel:Dx(E,h),onMouseEnter:V?void 0:l,onMouseDown:V?P:void 0,onMouseMove:V?k:u,onMouseUp:V?O:void 0,onMouseLeave:V?M:d,ref:h,style:yE,children:[f,ue.jsx(vye,{})]})});YB.displayName="Pane";const Sye=e=>{const t=e.getNodes().filter(n=>n.selected);return{...CB(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function wye({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=ii(),{width:i,height:o,x:s,y:a,transformString:l,userSelectionActive:u}=Gn(Sye,Bi),d=jB(),f=L.useRef(null);if(L.useEffect(()=>{var m;n||(m=f.current)==null||m.focus({preventScroll:!0})},[n]),VB({nodeRef:f}),u||!i||!o)return null;const h=e?m=>{const v=r.getState().getNodes().filter(x=>x.selected);e(m,v)}:void 0,g=m=>{Object.prototype.hasOwnProperty.call(yf,m.key)&&d({x:yf[m.key].x,y:yf[m.key].y,isShiftPressed:m.shiftKey})};return ue.jsx("div",{className:$o(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:ue.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:i,height:o,top:a,left:s}})})}var xye=L.memo(wye);const Cye=e=>e.nodesSelectionActive,QB=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,deleteKeyCode:a,onMove:l,onMoveStart:u,onMoveEnd:d,selectionKeyCode:f,selectionOnDrag:h,selectionMode:g,onSelectionStart:m,onSelectionEnd:v,multiSelectionKeyCode:x,panActivationKeyCode:_,zoomActivationKeyCode:b,elementsSelectable:y,zoomOnScroll:S,zoomOnPinch:C,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:P,zoomOnDoubleClick:k,panOnDrag:O,defaultViewport:M,translateExtent:V,minZoom:B,maxZoom:A,preventScrolling:N,onSelectionContextMenu:D,noWheelClassName:U,noPanClassName:$,disableKeyboardA11y:j})=>{const G=Gn(Cye),q=Wg(f),ee=Wg(_)||O,ie=q||h&&ee!==!0;return fye({deleteKeyCode:a,multiSelectionKeyCode:x}),ue.jsx(mye,{onMove:l,onMoveStart:u,onMoveEnd:d,onPaneContextMenu:o,elementsSelectable:y,zoomOnScroll:S,zoomOnPinch:C,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:P,zoomOnDoubleClick:k,panOnDrag:!q&&ee,defaultViewport:M,translateExtent:V,minZoom:B,maxZoom:A,zoomActivationKeyCode:b,preventScrolling:N,noWheelClassName:U,noPanClassName:$,children:ue.jsxs(YB,{onSelectionStart:m,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,panOnDrag:ee,isSelecting:!!ie,selectionMode:g,children:[e,G&&ue.jsx(xye,{onSelectionContextMenu:D,noPanClassName:$,disableKeyboardA11y:j})]})})};QB.displayName="FlowRenderer";var Tye=L.memo(QB);function Eye(e){return Gn(L.useCallback(n=>e?TB(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}const Aye=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),ZB=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:s}=Gn(Aye,Bi),a=Eye(e.onlyRenderVisibleElements),l=L.useRef(),u=L.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const d=new ResizeObserver(f=>{const h=f.map(g=>({id:g.target.getAttribute("data-id"),nodeElement:g.target,forceUpdate:!0}));o(h)});return l.current=d,d},[]);return L.useEffect(()=>()=>{var d;(d=l==null?void 0:l.current)==null||d.disconnect()},[]),ue.jsx("div",{className:"react-flow__nodes",style:yE,children:a.map(d=>{var C,T;let f=d.type||"default";e.nodeTypes[f]||(s==null||s("003",ou.error003(f)),f="default");const h=e.nodeTypes[f]||e.nodeTypes.default,g=!!(d.draggable||t&&typeof d.draggable>"u"),m=!!(d.selectable||i&&typeof d.selectable>"u"),v=!!(d.connectable||n&&typeof d.connectable>"u"),x=!!(d.focusable||r&&typeof d.focusable>"u"),_=e.nodeExtent?cE(d.positionAbsolute,e.nodeExtent):d.positionAbsolute,b=(_==null?void 0:_.x)??0,y=(_==null?void 0:_.y)??0,S=oye({x:b,y,width:d.width??0,height:d.height??0,origin:e.nodeOrigin});return ue.jsx(h,{id:d.id,className:d.className,style:d.style,type:f,data:d.data,sourcePosition:d.sourcePosition||Ue.Bottom,targetPosition:d.targetPosition||Ue.Top,hidden:d.hidden,xPos:b,yPos:y,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!d.selected,isDraggable:g,isSelectable:m,isConnectable:v,isFocusable:x,resizeObserver:u,dragHandle:d.dragHandle,zIndex:((C=d[pr])==null?void 0:C.z)??0,isParent:!!((T=d[pr])!=null&&T.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!d.width&&!!d.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:d.ariaLabel},d.id)})})};ZB.displayName="NodeRenderer";var Pye=L.memo(ZB);const Rye=[{level:0,isMaxLevel:!0,edges:[]}];function Oye(e,t,n=!1){let r=-1;const i=e.reduce((s,a)=>{var d,f;const l=Ro(a.zIndex);let u=l?a.zIndex:0;if(n){const h=t.get(a.target),g=t.get(a.source),m=a.selected||(h==null?void 0:h.selected)||(g==null?void 0:g.selected),v=Math.max(((d=g==null?void 0:g[pr])==null?void 0:d.z)||0,((f=h==null?void 0:h[pr])==null?void 0:f.z)||0,1e3);u=(l?a.zIndex:0)+(m?v:0)}return s[u]?s[u].push(a):s[u]=[a],r=u>r?u:r,s},{}),o=Object.entries(i).map(([s,a])=>{const l=+s;return{edges:a,level:l,isMaxLevel:l===r}});return o.length===0?Rye:o}function kye(e,t,n){const r=Gn(L.useCallback(i=>e?i.edges.filter(o=>{const s=t.get(o.source),a=t.get(o.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&eye({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return Oye(r,t,n)}const Iye=({color:e="none",strokeWidth:t=1})=>ue.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),Mye=({color:e="none",strokeWidth:t=1})=>ue.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),mO={[Z1.Arrow]:Iye,[Z1.ArrowClosed]:Mye};function Nye(e){const t=ii();return L.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(mO,e)?mO[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",ou.error009(e)),null)},[e])}const Lye=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=Nye(t);return l?ue.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0",children:ue.jsx(l,{color:n,strokeWidth:s})}):null},Dye=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const a=i5(s,t);r.includes(a)||(i.push({id:a,color:s.color||e,...s}),r.push(a))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},JB=({defaultColor:e,rfId:t})=>{const n=Gn(L.useCallback(Dye({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,s)=>o.id!==i[s].id)));return ue.jsx("defs",{children:n.map(r=>ue.jsx(Lye,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};JB.displayName="MarkerDefinitions";var $ye=L.memo(JB);const Fye=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),eU=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:f,edgeUpdaterRadius:h,onEdgeDoubleClick:g,onEdgeUpdateStart:m,onEdgeUpdateEnd:v,children:x})=>{const{edgesFocusable:_,edgesUpdatable:b,elementsSelectable:y,width:S,height:C,connectionMode:T,nodeInternals:E,onError:P}=Gn(Fye,Bi),k=kye(t,E,n);return S?ue.jsxs(ue.Fragment,{children:[k.map(({level:O,edges:M,isMaxLevel:V})=>ue.jsxs("svg",{style:{zIndex:O},width:S,height:C,className:"react-flow__edges react-flow__container",children:[V&&ue.jsx($ye,{defaultColor:e,rfId:r}),ue.jsx("g",{children:M.map(B=>{const[A,N,D]=uO(E.get(B.source)),[U,$,j]=uO(E.get(B.target));if(!D||!j)return null;let G=B.type||"default";i[G]||(P==null||P("011",ou.error011(G)),G="default");const q=i[G]||i.default,Z=T===bc.Strict?$.target:($.target??[]).concat($.source??[]),ee=lO(N.source,B.sourceHandle),ie=lO(Z,B.targetHandle),se=(ee==null?void 0:ee.position)||Ue.Bottom,le=(ie==null?void 0:ie.position)||Ue.Top,W=!!(B.focusable||_&&typeof B.focusable>"u"),ne=typeof s<"u"&&(B.updatable||b&&typeof B.updatable>"u");if(!ee||!ie)return P==null||P("008",ou.error008(ee,B)),null;const{sourceX:fe,sourceY:pe,targetX:ve,targetY:ye}=Jme(A,ee,se,U,ie,le);return ue.jsx(q,{id:B.id,className:$o([B.className,o]),type:G,data:B.data,selected:!!B.selected,animated:!!B.animated,hidden:!!B.hidden,label:B.label,labelStyle:B.labelStyle,labelShowBg:B.labelShowBg,labelBgStyle:B.labelBgStyle,labelBgPadding:B.labelBgPadding,labelBgBorderRadius:B.labelBgBorderRadius,style:B.style,source:B.source,target:B.target,sourceHandleId:B.sourceHandle,targetHandleId:B.targetHandle,markerEnd:B.markerEnd,markerStart:B.markerStart,sourceX:fe,sourceY:pe,targetX:ve,targetY:ye,sourcePosition:se,targetPosition:le,elementsSelectable:y,onEdgeUpdate:s,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,onClick:f,edgeUpdaterRadius:h,onEdgeDoubleClick:g,onEdgeUpdateStart:m,onEdgeUpdateEnd:v,rfId:r,ariaLabel:B.ariaLabel,isFocusable:W,isUpdatable:ne,pathOptions:"pathOptions"in B?B.pathOptions:void 0,interactionWidth:B.interactionWidth},B.id)})})]},O)),x]}):null};eU.displayName="EdgeRenderer";var Bye=L.memo(eU);const Uye=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zye({children:e}){const t=Gn(Uye);return ue.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function Vye(e){const t=qB(),n=L.useRef(!1);L.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const jye={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top},tU=({nodeId:e,handleType:t,style:n,type:r=Ol.Bezier,CustomComponent:i,connectionStatus:o})=>{var T,E,P;const{fromNode:s,handleId:a,toX:l,toY:u,connectionMode:d}=Gn(L.useCallback(k=>({fromNode:k.nodeInternals.get(e),handleId:k.connectionHandleId,toX:(k.connectionPosition.x-k.transform[0])/k.transform[2],toY:(k.connectionPosition.y-k.transform[1])/k.transform[2],connectionMode:k.connectionMode}),[e]),Bi),f=(T=s==null?void 0:s[pr])==null?void 0:T.handleBounds;let h=f==null?void 0:f[t];if(d===bc.Loose&&(h=h||(f==null?void 0:f[t==="source"?"target":"source"])),!s||!h)return null;const g=a?h.find(k=>k.id===a):h[0],m=g?g.x+g.width/2:(s.width??0)/2,v=g?g.y+g.height/2:s.height??0,x=(((E=s.positionAbsolute)==null?void 0:E.x)??0)+m,_=(((P=s.positionAbsolute)==null?void 0:P.y)??0)+v,b=g==null?void 0:g.position,y=b?jye[b]:null;if(!b||!y)return null;if(i)return ue.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:s,fromHandle:g,fromX:x,fromY:_,toX:l,toY:u,fromPosition:b,toPosition:y,connectionStatus:o});let S="";const C={sourceX:x,sourceY:_,sourcePosition:b,targetX:l,targetY:u,targetPosition:y};return r===Ol.Bezier?[S]=SB(C):r===Ol.Step?[S]=r5({...C,borderRadius:0}):r===Ol.SmoothStep?[S]=r5(C):r===Ol.SimpleBezier?[S]=bB(C):S=`M${x},${_} ${l},${u}`,ue.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:n})};tU.displayName="ConnectionLine";const Gye=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Hye({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:s,width:a,height:l,connectionStatus:u}=Gn(Gye,Bi);return!(i&&o&&a&&s)?null:ue.jsx("svg",{style:e,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:ue.jsx("g",{className:$o(["react-flow__connection",u]),children:ue.jsx(tU,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}const nU=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:d,onNodeMouseMove:f,onNodeMouseLeave:h,onNodeContextMenu:g,onSelectionContextMenu:m,onSelectionStart:v,onSelectionEnd:x,connectionLineType:_,connectionLineStyle:b,connectionLineComponent:y,connectionLineContainerStyle:S,selectionKeyCode:C,selectionOnDrag:T,selectionMode:E,multiSelectionKeyCode:P,panActivationKeyCode:k,zoomActivationKeyCode:O,deleteKeyCode:M,onlyRenderVisibleElements:V,elementsSelectable:B,selectNodesOnDrag:A,defaultViewport:N,translateExtent:D,minZoom:U,maxZoom:$,preventScrolling:j,defaultMarkerColor:G,zoomOnScroll:q,zoomOnPinch:Z,panOnScroll:ee,panOnScrollSpeed:ie,panOnScrollMode:se,zoomOnDoubleClick:le,panOnDrag:W,onPaneClick:ne,onPaneMouseEnter:fe,onPaneMouseMove:pe,onPaneMouseLeave:ve,onPaneScroll:ye,onPaneContextMenu:Je,onEdgeUpdate:Fe,onEdgeContextMenu:Ae,onEdgeMouseEnter:vt,onEdgeMouseMove:_e,onEdgeMouseLeave:Qt,edgeUpdaterRadius:rr,onEdgeUpdateStart:qt,onEdgeUpdateEnd:ht,noDragClassName:At,noWheelClassName:un,noPanClassName:Gr,elevateEdgesOnSelect:Pr,disableKeyboardA11y:Ci,nodeOrigin:In,nodeExtent:gn,rfId:ir})=>(Vye(o),ue.jsx(Tye,{onPaneClick:ne,onPaneMouseEnter:fe,onPaneMouseMove:pe,onPaneMouseLeave:ve,onPaneContextMenu:Je,onPaneScroll:ye,deleteKeyCode:M,selectionKeyCode:C,selectionOnDrag:T,selectionMode:E,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:P,panActivationKeyCode:k,zoomActivationKeyCode:O,elementsSelectable:B,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:q,zoomOnPinch:Z,zoomOnDoubleClick:le,panOnScroll:ee,panOnScrollSpeed:ie,panOnScrollMode:se,panOnDrag:W,defaultViewport:N,translateExtent:D,minZoom:U,maxZoom:$,onSelectionContextMenu:m,preventScrolling:j,noDragClassName:At,noWheelClassName:un,noPanClassName:Gr,disableKeyboardA11y:Ci,children:ue.jsxs(zye,{children:[ue.jsx(Bye,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onEdgeUpdate:Fe,onlyRenderVisibleElements:V,onEdgeContextMenu:Ae,onEdgeMouseEnter:vt,onEdgeMouseMove:_e,onEdgeMouseLeave:Qt,onEdgeUpdateStart:qt,onEdgeUpdateEnd:ht,edgeUpdaterRadius:rr,defaultMarkerColor:G,noPanClassName:Gr,elevateEdgesOnSelect:!!Pr,disableKeyboardA11y:Ci,rfId:ir,children:ue.jsx(Hye,{style:b,type:_,component:y,containerStyle:S})}),ue.jsx("div",{className:"react-flow__edgelabel-renderer"}),ue.jsx(Pye,{nodeTypes:e,onNodeClick:s,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:f,onNodeMouseLeave:h,onNodeContextMenu:g,selectNodesOnDrag:A,onlyRenderVisibleElements:V,noPanClassName:Gr,noDragClassName:At,disableKeyboardA11y:Ci,nodeOrigin:In,nodeExtent:gn,rfId:ir})]})}));nU.displayName="GraphView";var Wye=L.memo(nU);const a5=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],yl={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:a5,nodeExtent:a5,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:bc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:bme,isValidConnection:void 0},qye=()=>Ife((e,t)=>({...yl,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:Nx(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",s=i?Nx(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:s,fitViewOnInitOptions:a,domNode:l,nodeOrigin:u}=t(),d=l==null?void 0:l.querySelector(".react-flow__viewport");if(!d)return;const f=window.getComputedStyle(d),{m22:h}=new window.DOMMatrixReadOnly(f.transform),g=n.reduce((v,x)=>{const _=i.get(x.id);if(_){const b=uE(x.nodeElement);!!(b.width&&b.height&&(_.width!==b.width||_.height!==b.height||x.forceUpdate))&&(i.set(_.id,{..._,[pr]:{..._[pr],handleBounds:{source:dO(".source",x.nodeElement,h,u),target:dO(".target",x.nodeElement,h,u)}},...b}),v.push({id:_.id,type:"dimensions",dimensions:b}))}return v},[]);HB(i,u);const m=s||o&&!s&&WB(t,{initial:!0,...a});e({nodeInternals:new Map(i),fitViewOnInitDone:m}),(g==null?void 0:g.length)>0&&(r==null||r(g))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),s=n.map(a=>{const l={id:a.id,type:"position",dragging:i};return r&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});o(s)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:s,getNodes:a,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=XB(n,a()),d=Nx(u,i,s,l);e({nodeInternals:d})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>Cl(l,!0)):(s=qd(o(),n),a=qd(i,[])),z0({changedNodes:s,changedEdges:a,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>Cl(l,!0)):(s=qd(i,n),a=qd(o(),[])),z0({changedNodes:a,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),s=n||o(),a=r||i,l=s.map(d=>(d.selected=!1,Cl(d.id,!1))),u=a.map(d=>Cl(d.id,!1));z0({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(a=>a.selected).map(a=>Cl(a.id,!1)),s=n.filter(a=>a.selected).map(a=>Cl(a.id,!1));z0({changedNodes:o,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=cE(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:s,d3Selection:a,translateExtent:l}=t();if(!s||!a||!n.x&&!n.y)return!1;const u=Hl.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),d=[[0,0],[i,o]],f=s==null?void 0:s.constrain()(u,d,l);return s.transform(a,f),r[0]!==f.x||r[1]!==f.y||r[2]!==f.k},cancelConnection:()=>e({connectionNodeId:yl.connectionNodeId,connectionHandleId:yl.connectionHandleId,connectionHandleType:yl.connectionHandleType,connectionStatus:yl.connectionStatus,connectionStartHandle:yl.connectionStartHandle,connectionEndHandle:yl.connectionEndHandle}),reset:()=>e({...yl})})),rU=({children:e})=>{const t=L.useRef(null);return t.current||(t.current=qye()),ue.jsx(hme,{value:t.current,children:e})};rU.displayName="ReactFlowProvider";const iU=({children:e})=>L.useContext(Hb)?ue.jsx(ue.Fragment,{children:e}):ue.jsx(rU,{children:e});iU.displayName="ReactFlowWrapper";function yO(e,t){return L.useRef(null),L.useMemo(()=>t(e),[e])}const Kye={input:NB,default:o5,output:DB,group:mE},Xye={default:J1,straight:hE,step:fE,smoothstep:Wb,simplebezier:dE},Yye=[0,0],Qye=[15,15],Zye={x:0,y:0,zoom:1},Jye={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},e0e=L.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=Kye,edgeTypes:s=Xye,onNodeClick:a,onEdgeClick:l,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:g,onConnectStart:m,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:_,onNodeMouseEnter:b,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:T,onNodeDragStart:E,onNodeDrag:P,onNodeDragStop:k,onNodesDelete:O,onEdgesDelete:M,onSelectionChange:V,onSelectionDragStart:B,onSelectionDrag:A,onSelectionDragStop:N,onSelectionContextMenu:D,onSelectionStart:U,onSelectionEnd:$,connectionMode:j=bc.Strict,connectionLineType:G=Ol.Bezier,connectionLineStyle:q,connectionLineComponent:Z,connectionLineContainerStyle:ee,deleteKeyCode:ie="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:le=!1,selectionMode:W=Hg.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:fe="Meta",zoomActivationKeyCode:pe="Meta",snapToGrid:ve=!1,snapGrid:ye=Qye,onlyRenderVisibleElements:Je=!1,selectNodesOnDrag:Fe=!0,nodesDraggable:Ae,nodesConnectable:vt,nodesFocusable:_e,nodeOrigin:Qt=Yye,edgesFocusable:rr,edgesUpdatable:qt,elementsSelectable:ht,defaultViewport:At=Zye,minZoom:un=.5,maxZoom:Gr=2,translateExtent:Pr=a5,preventScrolling:Ci=!0,nodeExtent:In,defaultMarkerColor:gn="#b1b1b7",zoomOnScroll:ir=!0,zoomOnPinch:mn=!0,panOnScroll:Zt=!1,panOnScrollSpeed:Rr=.5,panOnScrollMode:Hr=gf.Free,zoomOnDoubleClick:si=!0,panOnDrag:Vi=!0,onPaneClick:$n,onPaneMouseEnter:ai,onPaneMouseMove:ra,onPaneMouseLeave:uo,onPaneScroll:ia,onPaneContextMenu:nn,children:Ft,onEdgeUpdate:or,onEdgeContextMenu:qn,onEdgeDoubleClick:yr,onEdgeMouseEnter:Or,onEdgeMouseMove:kr,onEdgeMouseLeave:co,onEdgeUpdateStart:Ir,onEdgeUpdateEnd:sr,edgeUpdaterRadius:ji=10,onNodesChange:bs,onEdgesChange:fo,noDragClassName:tl="nodrag",noWheelClassName:Vo="nowheel",noPanClassName:Mr="nopan",fitView:oa=!1,fitViewOptions:hh,connectOnClick:ph=!0,attributionPosition:gh,proOptions:mh,defaultEdgeOptions:jo,elevateNodesOnSelect:yh=!0,elevateEdgesOnSelect:vh=!1,disableKeyboardA11y:Gc=!1,autoPanOnConnect:_h=!0,autoPanOnNodeDrag:bh=!0,connectionRadius:Sh=20,isValidConnection:Ss,onError:wh,style:Go,id:nl,...xh},rl)=>{const Cu=yO(o,iye),Hc=yO(s,Zme),il=nl||"1";return ue.jsx("div",{...xh,style:{...Go,...Jye},ref:rl,className:$o(["react-flow",i]),"data-testid":"rf__wrapper",id:nl,children:ue.jsxs(iU,{children:[ue.jsx(Wye,{onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:b,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:T,nodeTypes:Cu,edgeTypes:Hc,connectionLineType:G,connectionLineStyle:q,connectionLineComponent:Z,connectionLineContainerStyle:ee,selectionKeyCode:se,selectionOnDrag:le,selectionMode:W,deleteKeyCode:ie,multiSelectionKeyCode:fe,panActivationKeyCode:ne,zoomActivationKeyCode:pe,onlyRenderVisibleElements:Je,selectNodesOnDrag:Fe,defaultViewport:At,translateExtent:Pr,minZoom:un,maxZoom:Gr,preventScrolling:Ci,zoomOnScroll:ir,zoomOnPinch:mn,zoomOnDoubleClick:si,panOnScroll:Zt,panOnScrollSpeed:Rr,panOnScrollMode:Hr,panOnDrag:Vi,onPaneClick:$n,onPaneMouseEnter:ai,onPaneMouseMove:ra,onPaneMouseLeave:uo,onPaneScroll:ia,onPaneContextMenu:nn,onSelectionContextMenu:D,onSelectionStart:U,onSelectionEnd:$,onEdgeUpdate:or,onEdgeContextMenu:qn,onEdgeDoubleClick:yr,onEdgeMouseEnter:Or,onEdgeMouseMove:kr,onEdgeMouseLeave:co,onEdgeUpdateStart:Ir,onEdgeUpdateEnd:sr,edgeUpdaterRadius:ji,defaultMarkerColor:gn,noDragClassName:tl,noWheelClassName:Vo,noPanClassName:Mr,elevateEdgesOnSelect:vh,rfId:il,disableKeyboardA11y:Gc,nodeOrigin:Qt,nodeExtent:In}),ue.jsx(jme,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:m,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:_,nodesDraggable:Ae,nodesConnectable:vt,nodesFocusable:_e,edgesFocusable:rr,edgesUpdatable:qt,elementsSelectable:ht,elevateNodesOnSelect:yh,minZoom:un,maxZoom:Gr,nodeExtent:In,onNodesChange:bs,onEdgesChange:fo,snapToGrid:ve,snapGrid:ye,connectionMode:j,translateExtent:Pr,connectOnClick:ph,defaultEdgeOptions:jo,fitView:oa,fitViewOptions:hh,onNodesDelete:O,onEdgesDelete:M,onNodeDragStart:E,onNodeDrag:P,onNodeDragStop:k,onSelectionDrag:A,onSelectionDragStart:B,onSelectionDragStop:N,noPanClassName:Mr,nodeOrigin:Qt,rfId:il,autoPanOnConnect:_h,autoPanOnNodeDrag:bh,onError:wh,connectionRadius:Sh,isValidConnection:Ss}),ue.jsx(zme,{onSelectionChange:V}),Ft,ue.jsx(mme,{proOptions:mh,position:gh}),ue.jsx(Kme,{rfId:il,disableKeyboardA11y:Gc})]})})});e0e.displayName="ReactFlow";var oU={},qb={},Kb={};Object.defineProperty(Kb,"__esModule",{value:!0});Kb.createLogMethods=void 0;var t0e=function(){return{debug:console.debug.bind(console),error:console.error.bind(console),fatal:console.error.bind(console),info:console.info.bind(console),trace:console.debug.bind(console),warn:console.warn.bind(console)}};Kb.createLogMethods=t0e;var vE={},Xb={};Object.defineProperty(Xb,"__esModule",{value:!0});Xb.boolean=void 0;const n0e=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};Xb.boolean=n0e;var Yb={};Object.defineProperty(Yb,"__esModule",{value:!0});Yb.isBooleanable=void 0;const r0e=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};Yb.isBooleanable=r0e;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=Xb;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const n=Yb;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return n.isBooleanable}})})(vE);var vO=Object.prototype.toString,sU=function(t){var n=vO.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vO.call(t.callee)==="[object Function]"),r},$x,_O;function i0e(){if(_O)return $x;_O=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=sU,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(h){var g=h.constructor;return g&&g.prototype===h},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if(typeof window>"u")return!1;for(var h in window)try{if(!u["$"+h]&&t.call(window,h)&&window[h]!==null&&typeof window[h]=="object")try{l(window[h])}catch{return!0}}catch{return!0}return!1}(),f=function(h){if(typeof window>"u"||!d)return l(h);try{return l(h)}catch{return!1}};e=function(g){var m=g!==null&&typeof g=="object",v=n.call(g)==="[object Function]",x=r(g),_=m&&n.call(g)==="[object String]",b=[];if(!m&&!v&&!x)throw new TypeError("Object.keys called on a non-object");var y=s&&v;if(_&&g.length>0&&!t.call(g,0))for(var S=0;S0)for(var C=0;C"u"||!Sr?St:Sr(Uint8Array),ac={"%AggregateError%":typeof AggregateError>"u"?St:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?St:ArrayBuffer,"%ArrayIteratorPrototype%":bd&&Sr?Sr([][Symbol.iterator]()):St,"%AsyncFromSyncIteratorPrototype%":St,"%AsyncFunction%":Id,"%AsyncGenerator%":Id,"%AsyncGeneratorFunction%":Id,"%AsyncIteratorPrototype%":Id,"%Atomics%":typeof Atomics>"u"?St:Atomics,"%BigInt%":typeof BigInt>"u"?St:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?St:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?St:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?St:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?St:Float32Array,"%Float64Array%":typeof Float64Array>"u"?St:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?St:FinalizationRegistry,"%Function%":lU,"%GeneratorFunction%":Id,"%Int8Array%":typeof Int8Array>"u"?St:Int8Array,"%Int16Array%":typeof Int16Array>"u"?St:Int16Array,"%Int32Array%":typeof Int32Array>"u"?St:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":bd&&Sr?Sr(Sr([][Symbol.iterator]())):St,"%JSON%":typeof JSON=="object"?JSON:St,"%Map%":typeof Map>"u"?St:Map,"%MapIteratorPrototype%":typeof Map>"u"||!bd||!Sr?St:Sr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?St:Promise,"%Proxy%":typeof Proxy>"u"?St:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?St:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?St:Set,"%SetIteratorPrototype%":typeof Set>"u"||!bd||!Sr?St:Sr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?St:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":bd&&Sr?Sr(""[Symbol.iterator]()):St,"%Symbol%":bd?Symbol:St,"%SyntaxError%":zf,"%ThrowTypeError%":b0e,"%TypedArray%":w0e,"%TypeError%":vf,"%Uint8Array%":typeof Uint8Array>"u"?St:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?St:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?St:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?St:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?St:WeakMap,"%WeakRef%":typeof WeakRef>"u"?St:WeakRef,"%WeakSet%":typeof WeakSet>"u"?St:WeakSet};if(Sr)try{null.error}catch(e){var x0e=Sr(Sr(e));ac["%Error.prototype%"]=x0e}var C0e=function e(t){var n;if(t==="%AsyncFunction%")n=Bx("async function () {}");else if(t==="%GeneratorFunction%")n=Bx("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=Bx("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Sr&&(n=Sr(i.prototype))}return ac[t]=n,n},CO={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Lm=aU,t_=_0e,T0e=Lm.call(Function.call,Array.prototype.concat),E0e=Lm.call(Function.apply,Array.prototype.splice),TO=Lm.call(Function.call,String.prototype.replace),n_=Lm.call(Function.call,String.prototype.slice),A0e=Lm.call(Function.call,RegExp.prototype.exec),P0e=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,R0e=/\\(\\)?/g,O0e=function(t){var n=n_(t,0,1),r=n_(t,-1);if(n==="%"&&r!=="%")throw new zf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new zf("invalid intrinsic syntax, expected opening `%`");var i=[];return TO(t,P0e,function(o,s,a,l){i[i.length]=a?TO(l,R0e,"$1"):s||o}),i},k0e=function(t,n){var r=t,i;if(t_(CO,r)&&(i=CO[r],r="%"+i[0]+"%"),t_(ac,r)){var o=ac[r];if(o===Id&&(o=C0e(r)),typeof o>"u"&&!n)throw new vf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new zf("intrinsic "+t+" does not exist!")},I0e=function(t,n){if(typeof t!="string"||t.length===0)throw new vf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new vf('"allowMissing" argument must be a boolean');if(A0e(/^%?[^%]*%?$/,t)===null)throw new zf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=O0e(t),i=r.length>0?r[0]:"",o=k0e("%"+i+"%",n),s=o.name,a=o.value,l=!1,u=o.alias;u&&(i=u[0],E0e(r,T0e([0,1],u)));for(var d=1,f=!0;d=r.length){var v=sc(a,h);f=!!v,f&&"get"in v&&!("originalValue"in v.get)?a=v.get:a=a[h]}else f=t_(a,h),a=a[h];f&&!l&&(ac[s]=a)}}return a},M0e=I0e,l5=M0e("%Object.defineProperty%",!0),u5=function(){if(l5)try{return l5({},"a",{value:1}),!0}catch{return!1}return!1};u5.hasArrayLengthDefineBug=function(){if(!u5())return null;try{return l5([],"length",{value:1}).length!==1}catch{return!0}};var N0e=u5,L0e=a0e,D0e=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",$0e=Object.prototype.toString,F0e=Array.prototype.concat,uU=Object.defineProperty,B0e=function(e){return typeof e=="function"&&$0e.call(e)==="[object Function]"},U0e=N0e(),cU=uU&&U0e,z0e=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!B0e(r)||!r())return}cU?uU(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},dU=function(e,t){var n=arguments.length>2?arguments[2]:{},r=L0e(t);D0e&&(r=F0e.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};eS.testComparisonRange=lve;var tS={};Object.defineProperty(tS,"__esModule",{value:!0});tS.testRange=void 0;var uve=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};tS.testRange=uve;(function(e){var t=Ze&&Ze.__assign||function(){return t=Object.assign||function(d){for(var f,h=1,g=arguments.length;h0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,fve.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};nS.highlight=pve;var rS={},vU={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(Ze,function(){function t(u,d,f){return this.id=++t.highestId,this.name=u,this.symbols=d,this.postprocess=f,this}t.highestId=0,t.prototype.toString=function(u){var d=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+d};function n(u,d,f,h){this.rule=u,this.dot=d,this.reference=f,this.data=[],this.wantedBy=h,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var d=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return d.left=this,d.right=u,d.isComplete&&(d.data=d.build(),d.right=void 0),d},n.prototype.build=function(){var u=[],d=this;do u.push(d.right.data),d=d.left;while(d.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))};function r(u,d){this.grammar=u,this.index=d,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var d=this.states,f=this.wants,h=this.completed,g=0;g0&&d.push(" ^ "+h+" more lines identical to this"),h=0,d.push(" "+v)),f=v}},s.prototype.getSymbolDisplay=function(u){return a(u)},s.prototype.buildFirstStateStack=function(u,d){if(d.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var f=u.wantedBy[0],h=[u].concat(d),g=this.buildFirstStateStack(f,h);return g===null?null:[u].concat(g)},s.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},s.prototype.restore=function(u){var d=u.index;this.current=d,this.table[d]=u,this.table.splice(d+1),this.lexerState=u.lexerState,this.results=this.finish()},s.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},s.prototype.finish=function(){var u=[],d=this.grammar.start,f=this.table[this.table.length-1];return f.states.forEach(function(h){h.rule.name===d&&h.dot===h.rule.symbols.length&&h.reference===0&&h.data!==s.fail&&u.push(h)}),u.map(function(h){return h.data})};function a(u){var d=typeof u;if(d==="string")return u;if(d==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var d=typeof u;if(d==="string")return u;if(d==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:s,Grammar:i,Rule:t}})})(vU);var gve=vU.exports,Sc={},_U={},mu={};mu.__esModule=void 0;mu.__esModule=!0;var mve=typeof Object.setPrototypeOf=="function",yve=typeof Object.getPrototypeOf=="function",vve=typeof Object.defineProperty=="function",_ve=typeof Object.create=="function",bve=typeof Object.prototype.hasOwnProperty=="function",Sve=function(t,n){mve?Object.setPrototypeOf(t,n):t.__proto__=n};mu.setPrototypeOf=Sve;var wve=function(t){return yve?Object.getPrototypeOf(t):t.__proto__||t.prototype};mu.getPrototypeOf=wve;var EO=!1,xve=function e(t,n,r){if(vve&&!EO)try{Object.defineProperty(t,n,r)}catch{EO=!0,e(t,n,r)}else t[n]=r.value};mu.defineProperty=xve;var bU=function(t,n){return bve?t.hasOwnProperty(t,n):t[n]===void 0};mu.hasOwnProperty=bU;var Cve=function(t,n){if(_ve)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)bU(n,o)&&(i[o]=n[o].value);return i};mu.objectCreate=Cve;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=mu,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,s=new Error().toString()==="[object Error]",a="";function l(u){var d=this.constructor,f=d.name||function(){var x=d.toString().match(/^function\s*([^\s(]+)/);return x===null?a||"Error":x[1]}(),h=f==="Error",g=h?a:f,m=Error.apply(this,arguments);if(n(m,r(this)),!(m instanceof d)||!(m instanceof l)){var m=this;Error.apply(this,arguments),i(m,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(m,"name",{configurable:!0,enumerable:!1,value:g,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(m,h?l:d),m.stack===void 0){var v=new Error(u);v.name=m.name,m.stack=v.stack}return s&&i(m,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),m}a=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(_U);var SU=Ze&&Ze.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Sc,"__esModule",{value:!0});Sc.SyntaxError=Sc.LiqeError=void 0;var Tve=_U,wU=function(e){SU(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Tve.ExtendableError);Sc.LiqeError=wU;var Eve=function(e){SU(t,e);function t(n,r,i,o){var s=e.call(this,n)||this;return s.message=n,s.offset=r,s.line=i,s.column=o,s}return t}(wU);Sc.SyntaxError=Eve;var SE={},r_=Ze&&Ze.__assign||function(){return r_=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:ya},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};SE.default=Ave;var xU={},iS={},Fm={};Object.defineProperty(Fm,"__esModule",{value:!0});Fm.isSafePath=void 0;var Pve=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,Rve=function(e){return Pve.test(e)};Fm.isSafePath=Rve;Object.defineProperty(iS,"__esModule",{value:!0});iS.createGetValueFunctionBody=void 0;var Ove=Fm,kve=function(e){if(!(0,Ove.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};iS.createGetValueFunctionBody=kve;(function(e){var t=Ze&&Ze.__assign||function(){return t=Object.assign||function(o){for(var s,a=1,l=arguments.length;a\d+) col (?\d+)/,$ve=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new TU.default.Parser(Lve),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(Dve);throw r?new Ive.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,Nve.hydrateAst)(n[0]);return i};rS.parse=$ve;var oS={};Object.defineProperty(oS,"__esModule",{value:!0});oS.test=void 0;var Fve=Dm,Bve=function(e,t){return(0,Fve.filter)(e,[t]).length===1};oS.test=Bve;var EU={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,s){return s==="double"?'"'.concat(o,'"'):s==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var s=o.range,a=s.min,l=s.max,u=s.minInclusive,d=s.maxInclusive;return"".concat(u?"[":"{").concat(a," TO ").concat(l).concat(d?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var s=o.field,a=o.expression,l=o.operator;if(s.type==="ImplicitField")return n(a);var u=s.quoted?t(s.name,s.quotes):s.name,d=" ".repeat(a.location.start-l.location.end);return u+l.operator+d+n(a)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var s=" ".repeat(o.expression.location.start-(o.location.start+1)),a=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(s).concat((0,e.serialize)(o.expression)).concat(a,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(EU);var sS={};Object.defineProperty(sS,"__esModule",{value:!0});sS.isSafeUnquotedExpression=void 0;var Uve=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};sS.isSafeUnquotedExpression=Uve;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=Dm;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=nS;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=rS;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=oS;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=Sc;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var s=EU;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return s.serialize}});var a=sS;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return a.isSafeUnquotedExpression}})})(yU);var Bm={},AU={},wc={};Object.defineProperty(wc,"__esModule",{value:!0});wc.ROARR_LOG_FORMAT_VERSION=wc.ROARR_VERSION=void 0;wc.ROARR_VERSION="5.0.0";wc.ROARR_LOG_FORMAT_VERSION="2.0.0";var Um={};Object.defineProperty(Um,"__esModule",{value:!0});Um.logLevels=void 0;Um.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var PU={},aS={};Object.defineProperty(aS,"__esModule",{value:!0});aS.hasOwnProperty=void 0;const zve=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);aS.hasOwnProperty=zve;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=aS;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(PU);var RU={},lS={},uS={};Object.defineProperty(uS,"__esModule",{value:!0});uS.tokenize=void 0;const Vve=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,jve=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=Vve.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const s=t[0];i=t.index+s.length,s==="\\%"||s==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:s,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};uS.tokenize=jve;Object.defineProperty(lS,"__esModule",{value:!0});lS.createPrintf=void 0;const AO=vE,Gve=uS,Hve=(e,t)=>t.placeholder,Wve=e=>{var t;const n=(o,s,a)=>a==="-"?o.padEnd(s," "):a==="-+"?((Number(o)>=0?"+":"")+o).padEnd(s," "):a==="+"?((Number(o)>=0?"+":"")+o).padStart(s," "):a==="0"?o.padStart(s,"0"):o.padStart(s," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:Hve,i={};return(o,...s)=>{let a=i[o];a||(a=i[o]=Gve.tokenize(o));let l="";for(const u of a)if(u.type==="literal")l+=u.literal;else{let d=s[u.position];if(d===void 0)l+=r(o,u,s);else if(u.conversion==="b")l+=AO.boolean(d)?"true":"false";else if(u.conversion==="B")l+=AO.boolean(d)?"TRUE":"FALSE";else if(u.conversion==="c")l+=d;else if(u.conversion==="C")l+=String(d).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")d=String(Math.trunc(d)),u.width!==null&&(d=n(d,u.width,u.flag)),l+=d;else if(u.conversion==="e")l+=Number(d).toExponential();else if(u.conversion==="E")l+=Number(d).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(d=Number(d).toFixed(u.precision)),u.width!==null&&(d=n(String(d),u.width,u.flag)),l+=d;else if(u.conversion==="o")l+=(Number.parseInt(String(d),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(d=n(String(d),u.width,u.flag)),l+=d;else if(u.conversion==="S")u.width!==null&&(d=n(String(d),u.width,u.flag)),l+=String(d).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(d),10)>>>0;else if(u.conversion==="x")d=(Number.parseInt(String(d),10)>>>0).toString(16),u.width!==null&&(d=n(String(d),u.width,u.flag)),l+=d;else throw new Error("Unknown format specifier.")}return l}};lS.createPrintf=Wve;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=lS;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(RU);var c5={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=x();r.configure=x,r.stringify=r,r.default=r,t.stringify=r,t.configure=x,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(_){return _.length<5e3&&!i.test(_)?`"${_}"`:JSON.stringify(_)}function s(_){if(_.length>200)return _.sort();for(let b=1;b<_.length;b++){const y=_[b];let S=b;for(;S!==0&&_[S-1]>y;)_[S]=_[S-1],S--;_[S]=y}return _}const a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(_){return a.call(_)!==void 0&&_.length!==0}function u(_,b,y){_.length= 1`)}return y===void 0?1/0:y}function g(_){return _===1?"1 item":`${_} items`}function m(_){const b=new Set;for(const y of _)(typeof y=="string"||typeof y=="number")&&b.add(String(y));return b}function v(_){if(n.call(_,"strict")){const b=_.strict;if(typeof b!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(b)return y=>{let S=`Object can not safely be stringified. Received type ${typeof y}`;throw typeof y!="function"&&(S+=` (${y.toString()})`),new Error(S)}}}function x(_){_={..._};const b=v(_);b&&(_.bigint===void 0&&(_.bigint=!1),"circularValue"in _||(_.circularValue=Error));const y=d(_),S=f(_,"bigint"),C=f(_,"deterministic"),T=h(_,"maximumDepth"),E=h(_,"maximumBreadth");function P(B,A,N,D,U,$){let j=A[B];switch(typeof j=="object"&&j!==null&&typeof j.toJSON=="function"&&(j=j.toJSON(B)),j=D.call(A,B,j),typeof j){case"string":return o(j);case"object":{if(j===null)return"null";if(N.indexOf(j)!==-1)return y;let G="",q=",";const Z=$;if(Array.isArray(j)){if(j.length===0)return"[]";if(TE){const ve=j.length-E-1;G+=`${q}"... ${g(ve)} not stringified"`}return U!==""&&(G+=` ${Z}`),N.pop(),`[${G}]`}let ee=Object.keys(j);const ie=ee.length;if(ie===0)return"{}";if(TE){const ne=ie-E;G+=`${le}"...":${se}"${g(ne)} not stringified"`,le=q}return U!==""&&le.length>1&&(G=` ${$}${G} ${Z}`),N.pop(),`{${G}}`}case"number":return isFinite(j)?String(j):b?b(j):"null";case"boolean":return j===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(j);default:return b?b(j):void 0}}function k(B,A,N,D,U,$){switch(typeof A=="object"&&A!==null&&typeof A.toJSON=="function"&&(A=A.toJSON(B)),typeof A){case"string":return o(A);case"object":{if(A===null)return"null";if(N.indexOf(A)!==-1)return y;const j=$;let G="",q=",";if(Array.isArray(A)){if(A.length===0)return"[]";if(TE){const W=A.length-E-1;G+=`${q}"... ${g(W)} not stringified"`}return U!==""&&(G+=` ${j}`),N.pop(),`[${G}]`}N.push(A);let Z="";U!==""&&($+=U,q=`, ${$}`,Z=" ");let ee="";for(const ie of D){const se=k(ie,A[ie],N,D,U,$);se!==void 0&&(G+=`${ee}${o(ie)}:${Z}${se}`,ee=q)}return U!==""&&ee.length>1&&(G=` ${$}${G} ${j}`),N.pop(),`{${G}}`}case"number":return isFinite(A)?String(A):b?b(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return b?b(A):void 0}}function O(B,A,N,D,U){switch(typeof A){case"string":return o(A);case"object":{if(A===null)return"null";if(typeof A.toJSON=="function"){if(A=A.toJSON(B),typeof A!="object")return O(B,A,N,D,U);if(A===null)return"null"}if(N.indexOf(A)!==-1)return y;const $=U;if(Array.isArray(A)){if(A.length===0)return"[]";if(TE){const pe=A.length-E-1;se+=`${le}"... ${g(pe)} not stringified"`}return se+=` ${$}`,N.pop(),`[${se}]`}let j=Object.keys(A);const G=j.length;if(G===0)return"{}";if(TE){const se=G-E;Z+=`${ee}"...": "${g(se)} not stringified"`,ee=q}return ee!==""&&(Z=` ${U}${Z} ${$}`),N.pop(),`{${Z}}`}case"number":return isFinite(A)?String(A):b?b(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return b?b(A):void 0}}function M(B,A,N){switch(typeof A){case"string":return o(A);case"object":{if(A===null)return"null";if(typeof A.toJSON=="function"){if(A=A.toJSON(B),typeof A!="object")return M(B,A,N);if(A===null)return"null"}if(N.indexOf(A)!==-1)return y;let D="";if(Array.isArray(A)){if(A.length===0)return"[]";if(TE){const ie=A.length-E-1;D+=`,"... ${g(ie)} not stringified"`}return N.pop(),`[${D}]`}let U=Object.keys(A);const $=U.length;if($===0)return"{}";if(TE){const q=$-E;D+=`${j}"...":"${g(q)} not stringified"`}return N.pop(),`{${D}}`}case"number":return isFinite(A)?String(A):b?b(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(S)return String(A);default:return b?b(A):void 0}}function V(B,A,N){if(arguments.length>1){let D="";if(typeof N=="number"?D=" ".repeat(Math.min(N,10)):typeof N=="string"&&(D=N.slice(0,10)),A!=null){if(typeof A=="function")return P("",{"":B},[],A,D,"");if(Array.isArray(A))return k("",B,[],m(A),D,"")}if(D.length!==0)return O("",B,[],D,"")}return M("",B,[])}return V}})(c5,c5.exports);var qve=c5.exports;(function(e){var t=Ze&&Ze.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=wc,r=Um,i=PU,o=RU,s=t(_E),a=t(qve);let l=!1;const u=(0,s.default)(),d=()=>u.ROARR,f=()=>({messageContext:{},transforms:[]}),h=()=>{const y=d().asyncLocalStorage;if(!y)throw new Error("AsyncLocalContext is unavailable.");const S=y.getStore();return S||f()},g=()=>!!d().asyncLocalStorage,m=()=>{if(g()){const y=h();return(0,i.hasOwnProperty)(y,"sequenceRoot")&&(0,i.hasOwnProperty)(y,"sequence")&&typeof y.sequence=="number"?String(y.sequenceRoot)+"."+String(y.sequence++):String(d().sequence++)}return String(d().sequence++)},v=(y,S)=>(C,T,E,P,k,O,M,V,B,A)=>{y.child({logLevel:S})(C,T,E,P,k,O,M,V,B,A)},x=1e3,_=(y,S)=>(C,T,E,P,k,O,M,V,B,A)=>{const N=(0,a.default)({a:C,b:T,c:E,d:P,e:k,f:O,g:M,h:V,i:B,j:A,logLevel:S});if(!N)throw new Error("Expected key to be a string");const D=d().onceLog;D.has(N)||(D.add(N),D.size>x&&D.clear(),y.child({logLevel:S})(C,T,E,P,k,O,M,V,B,A))},b=(y,S={},C=[])=>{const T=(E,P,k,O,M,V,B,A,N,D)=>{const U=Date.now(),$=m();let j;g()?j=h():j=f();let G,q;if(typeof E=="string"?G={...j.messageContext,...S}:G={...j.messageContext,...S,...E},typeof E=="string"&&P===void 0)q=E;else if(typeof E=="string"){if(!E.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");q=(0,o.printf)(E,P,k,O,M,V,B,A,N,D)}else{let ee=P;if(typeof P!="string")if(P===void 0)ee="";else throw new TypeError("Message must be a string. Received "+typeof P+".");q=(0,o.printf)(ee,k,O,M,V,B,A,N,D)}let Z={context:G,message:q,sequence:$,time:U,version:n.ROARR_LOG_FORMAT_VERSION};for(const ee of[...j.transforms,...C])if(Z=ee(Z),typeof Z!="object"||Z===null)throw new Error("Message transform function must return a message object.");y(Z)};return T.child=E=>{let P;return g()?P=h():P=f(),typeof E=="function"?(0,e.createLogger)(y,{...P.messageContext,...S,...E},[E,...C]):(0,e.createLogger)(y,{...P.messageContext,...S,...E},C)},T.getContext=()=>{let E;return g()?E=h():E=f(),{...E.messageContext,...S}},T.adopt=async(E,P)=>{if(!g())return l===!1&&(l=!0,y({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:m(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),E();const k=h();let O;(0,i.hasOwnProperty)(k,"sequenceRoot")&&(0,i.hasOwnProperty)(k,"sequence")&&typeof k.sequence=="number"?O=k.sequenceRoot+"."+String(k.sequence++):O=String(d().sequence++);let M={...k.messageContext};const V=[...k.transforms];typeof P=="function"?V.push(P):M={...M,...P};const B=d().asyncLocalStorage;if(!B)throw new Error("Async local context unavailable.");return B.run({messageContext:M,sequence:0,sequenceRoot:O,transforms:V},()=>E())},T.debug=v(T,r.logLevels.debug),T.debugOnce=_(T,r.logLevels.debug),T.error=v(T,r.logLevels.error),T.errorOnce=_(T,r.logLevels.error),T.fatal=v(T,r.logLevels.fatal),T.fatalOnce=_(T,r.logLevels.fatal),T.info=v(T,r.logLevels.info),T.infoOnce=_(T,r.logLevels.info),T.trace=v(T,r.logLevels.trace),T.traceOnce=_(T,r.logLevels.trace),T.warn=v(T,r.logLevels.warn),T.warnOnce=_(T,r.logLevels.warn),T};e.createLogger=b})(AU);var cS={},Kve=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var s=Number(r[o]),a=Number(i[o]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!isNaN(a))return-1}return 0},Xve=Ze&&Ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cS,"__esModule",{value:!0});cS.createRoarrInitialGlobalStateBrowser=void 0;const PO=wc,RO=Xve(Kve),Yve=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(RO.default),t.includes(PO.ROARR_VERSION)||t.push(PO.ROARR_VERSION),t.sort(RO.default),{sequence:0,...e,versions:t}};cS.createRoarrInitialGlobalStateBrowser=Yve;var dS={};Object.defineProperty(dS,"__esModule",{value:!0});dS.getLogLevelName=void 0;const Qve=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";dS.getLogLevelName=Qve;(function(e){var t=Ze&&Ze.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=AU,r=cS,o=(0,t(_E).default)(),s=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=s,o.ROARR=s;const a=f=>JSON.stringify(f),l=(0,n.createLogger)(f=>{var h;s.write&&s.write(((h=s.serializeMessage)!==null&&h!==void 0?h:a)(f))});e.Roarr=l;var u=Um;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var d=dS;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return d.getLogLevelName}})})(Bm);var Zve=Ze&&Ze.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?g("%c ".concat(h," %c").concat(d?" [".concat(String(d),"]:"):"","%c ").concat(a.message," %O"),v,x,_,f):g("%c ".concat(h," %c").concat(d?" [".concat(String(d),"]:"):"","%c ").concat(a.message),v,x,_)}}};qb.createLogWriter=a1e;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=qb;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(oU);Bm.ROARR.write=oU.createLogWriter();const kU={};Bm.Roarr.child(kU);const fS=Om(Bm.Roarr.child(kU)),ke=e=>fS.get().child({namespace:e}),o7e=["trace","debug","info","warn","error","fatal"],s7e={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function l1e(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const qg=Jl("nodes/receivedOpenAPISchema",async(e,{dispatch:t,rejectWithValue:n})=>{const r=ke("system");try{const o=await(await fetch("openapi.json")).json();return r.info({openAPISchema:o},"Received OpenAPI schema"),JSON.parse(JSON.stringify(o,l1e()))}catch(i){return n({error:i})}}),IU={nodes:[],edges:[],schema:null,invocationTemplates:{},connectionStartParams:null,shouldShowGraphOverlay:!1,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,editorInstance:void 0,progressNodeSize:{width:512,height:512}},MU=An({name:"nodes",initialState:IU,reducers:{nodesChanged:(e,t)=>{e.nodes=XB(t.payload,e.nodes)},nodeAdded:(e,t)=>{e.nodes.push(t.payload)},edgesChanged:(e,t)=>{e.edges=_ye(t.payload,e.edges)},connectionStarted:(e,t)=>{e.connectionStartParams=t.payload},connectionMade:(e,t)=>{e.edges=wB(t.payload,e.edges)},connectionEnded:e=>{e.connectionStartParams=null},fieldValueChanged:(e,t)=>{var a,l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n),s=(u=(l=(a=e.nodes)==null?void 0:a[o])==null?void 0:l.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},imageCollectionFieldValueChanged:(e,t)=>{var l,u,d;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(f=>f.id===n);if(o===-1)return;const s=(d=(u=(l=e.nodes)==null?void 0:l[o])==null?void 0:u.data)==null?void 0:d.inputs[r];if(!s)return;const a=Qr(s.value);if(!a){s.value=i;return}s.value=wle(a.concat(i),"image_name")},shouldShowGraphOverlayChanged:(e,t)=>{e.shouldShowGraphOverlay=t.payload},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.invocationTemplates=t.payload},nodeEditorReset:e=>{e.nodes=[],e.edges=[]},setEditorInstance:(e,t)=>{e.editorInstance=t.payload},loadFileNodes:(e,t)=>{e.nodes=t.payload},loadFileEdges:(e,t)=>{e.edges=t.payload},setProgressNodeSize:(e,t)=>{e.progressNodeSize=t.payload}},extraReducers:e=>{e.addCase(qg.fulfilled,(t,n)=>{t.schema=n.payload})}}),{nodesChanged:a7e,edgesChanged:l7e,nodeAdded:u7e,fieldValueChanged:NU,connectionMade:c7e,connectionStarted:d7e,connectionEnded:f7e,shouldShowGraphOverlayChanged:h7e,shouldShowFieldTypeLegendChanged:p7e,shouldShowMinimapPanelChanged:g7e,nodeTemplatesBuilt:wE,nodeEditorReset:xE,imageCollectionFieldValueChanged:m7e,setEditorInstance:y7e,loadFileNodes:v7e,loadFileEdges:_7e,setProgressNodeSize:b7e}=MU.actions,u1e=MU.reducer,LU={esrganModelName:"RealESRGAN_x4plus.pth"},DU=An({name:"postprocessing",initialState:LU,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:S7e}=DU.actions,c1e=DU.reducer,d1e={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.7},$U=An({name:"sdxl",initialState:d1e,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldConcatSDXLStylePrompt:(e,t)=>{e.shouldConcatSDXLStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerPositiveAestheticScore:(e,t)=>{e.refinerPositiveAestheticScore=t.payload},setRefinerNegativeAestheticScore:(e,t)=>{e.refinerNegativeAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:w7e,setNegativeStylePromptSDXL:x7e,setShouldConcatSDXLStylePrompt:C7e,setShouldUseSDXLRefiner:f1e,setSDXLImg2ImgDenoisingStrength:T7e,refinerModelChanged:kO,setRefinerSteps:E7e,setRefinerCFGScale:A7e,setRefinerScheduler:P7e,setRefinerPositiveAestheticScore:R7e,setRefinerNegativeAestheticScore:O7e,setRefinerStart:k7e}=$U.actions,h1e=$U.reducer,zm=Me("app/userInvoked"),p1e={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class i_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||p1e,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{s(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(s=>{s.apply(s,[t,...r])})}}function cp(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function IO(e){return e==null?"":""+e}function g1e(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function CE(e,t,n){function r(s){return s&&s.indexOf("###")>-1?s.replace(/###/g,"."):s}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const s=r(o.shift());!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function MO(e,t,n){const{obj:r,k:i}=CE(e,t,Object);r[i]=n}function m1e(e,t,n,r){const{obj:i,k:o}=CE(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function o_(e,t){const{obj:n,k:r}=CE(e,t);if(n)return n[r]}function y1e(e,t,n){const r=o_(e,n);return r!==void 0?r:o_(t,n)}function FU(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):FU(e[r],t[r],n):e[r]=t[r]);return e}function Sd(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var v1e={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function _1e(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>v1e[t]):e}const b1e=[" ",",","?","!",";"];function S1e(e,t,n){t=t||"",n=n||"";const r=b1e.filter(s=>t.indexOf(s)<0&&n.indexOf(s)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let o=!i.test(e);if(!o){const s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}function s_(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+s;)s++,a=r.slice(o,o+s).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(t.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const u=r.slice(o+s).join(n);return u?s_(l,u,n):void 0}i=i[r[o]]}return i}function a_(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class NO extends hS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[t,n];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."));const l=o_(this.data,a);return l||!s||typeof r!="string"?l:s_(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(s?r.split(s):r)),t.indexOf(".")>-1&&(a=t.split("."),i=n,n=a[1]),this.addNamespaces(n),MO(this.data,a,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=o_(this.data,a)||{};i?FU(l,r,o):l={...l,...r},MO(this.data,a,l),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var BU={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const LO={};class l_ extends hS{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),g1e(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Bs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const s=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!S1e(t,r,i);if(s&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const S=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${S}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:`${l}${S}${s}`}return i?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:s}const f=this.resolve(t,n);let h=f&&f.res;const g=f&&f.usedKey||s,m=f&&f.exactUsedKey||s,v=Object.prototype.toString.apply(h),x=["[object Number]","[object Function]","[object RegExp]"],_=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject;if(b&&h&&(typeof h!="string"&&typeof h!="boolean"&&typeof h!="number")&&x.indexOf(v)<0&&!(typeof _=="string"&&v==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,h,{...n,ns:a}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(f.res=S,f):S}if(o){const S=v==="[object Array]",C=S?[]:{},T=S?m:g;for(const E in h)if(Object.prototype.hasOwnProperty.call(h,E)){const P=`${T}${o}${E}`;C[E]=this.translate(P,{...n,joinArrays:!1,ns:a}),C[E]===P&&(C[E]=h[E])}h=C}}else if(b&&typeof _=="string"&&v==="[object Array]")h=h.join(_),h&&(h=this.extendTranslation(h,t,n,r));else{let S=!1,C=!1;const T=n.count!==void 0&&typeof n.count!="string",E=l_.hasDefaultValue(n),P=T?this.pluralResolver.getSuffix(u,n.count,n):"",k=n.ordinal&&T?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",O=n[`defaultValue${P}`]||n[`defaultValue${k}`]||n.defaultValue;!this.isValidLookup(h)&&E&&(S=!0,h=O),this.isValidLookup(h)||(C=!0,h=s);const V=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:h,B=E&&O!==h&&this.options.updateMissing;if(C||S||B){if(this.logger.log(B?"updateKey":"missingKey",u,l,s,B?O:h),o){const U=this.resolve(s,{...n,keySeparator:!1});U&&U.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let A=[];const N=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&N&&N[0])for(let U=0;U{const G=E&&j!==h?j:V;this.options.missingKeyHandler?this.options.missingKeyHandler(U,l,$,G,B,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(U,l,$,G,B,n),this.emit("missingKey",U,l,$,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&T?A.forEach(U=>{this.pluralResolver.getSuffixes(U,n).forEach($=>{D([U],s+$,n[`defaultValue${$}`]||O)})}):D(A,s,O))}h=this.extendTranslation(h,t,n,f,r),C&&h===s&&this.options.appendNamespaceToMissingKey&&(h=`${l}:${s}`),(C||S)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${s}`:s,S?h:void 0):h=this.options.parseMissingKeyHandler(h))}return i?(f.res=h,f):h}extendTranslation(t,n,r,i,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const h=t.match(this.interpolator.nestingRegexp);d=h&&h.length}let f=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language,r),u){const h=t.match(this.interpolator.nestingRegexp),g=h&&h.length;d1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,s,a;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),d=u.key;i=d;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const h=n.count!==void 0&&typeof n.count!="string",g=h&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),m=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(x=>{this.isValidLookup(r)||(a=x,!LO[`${v[0]}-${x}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(LO[`${v[0]}-${x}`]=!0,this.logger.warn(`key "${i}" for languages "${v.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),v.forEach(_=>{if(this.isValidLookup(r))return;s=_;const b=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(b,d,_,x,n);else{let S;h&&(S=this.pluralResolver.getSuffix(_,n.count,n));const C=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(b.push(d+S),n.ordinal&&S.indexOf(T)===0&&b.push(d+S.replace(T,this.options.pluralSeparator)),g&&b.push(d+C)),m){const E=`${d}${this.options.contextSeparator}${n.context}`;b.push(E),h&&(b.push(E+S),n.ordinal&&S.indexOf(T)===0&&b.push(E+S.replace(T,this.options.pluralSeparator)),g&&b.push(E+C))}}let y;for(;y=b.pop();)this.isValidLookup(r)||(o=y,r=this.getResource(_,x,y,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function Vx(e){return e.charAt(0).toUpperCase()+e.slice(1)}class DO{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Bs.create("languageUtils")}getScriptPartFromCode(t){if(t=a_(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=a_(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Vx(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=Vx(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Vx(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(s=>{i.indexOf(s)<0&&o(this.formatLanguageCode(s))}),i}}let w1e=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],x1e={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const C1e=["v1","v2","v3"],T1e=["v4"],$O={zero:0,one:1,two:2,few:3,many:4,other:5};function E1e(){const e={};return w1e.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:x1e[t.fc]}})}),e}class A1e{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Bs.create("pluralResolver"),(!this.options.compatibilityJSON||T1e.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=E1e()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(a_(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>$O[i]-$O[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!C1e.includes(this.options.compatibilityJSON)}}function FO(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=y1e(e,t,n);return!o&&i&&typeof n=="string"&&(o=s_(e,n,r),o===void 0&&(o=s_(t,n,r))),o}class P1e{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bs.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:_1e,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?Sd(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?Sd(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?Sd(n.nestingPrefix):n.nestingPrefixEscaped||Sd("$t("),this.nestingSuffix=n.nestingSuffix?Sd(n.nestingSuffix):n.nestingSuffixEscaped||Sd(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,s,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(m){return m.replace(/\$/g,"$$$$")}const d=m=>{if(m.indexOf(this.formatSeparator)<0){const b=FO(n,l,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,r,{...i,...n,interpolationkey:m}):b}const v=m.split(this.formatSeparator),x=v.shift().trim(),_=v.join(this.formatSeparator).trim();return this.format(FO(n,l,x,this.options.keySeparator,this.options.ignoreJSONStructure),_,r,{...i,...n,interpolationkey:x})};this.resetRegExp();const f=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,h=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>u(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?u(this.escape(m)):u(m)}].forEach(m=>{for(a=0;o=m.regex.exec(t);){const v=o[1].trim();if(s=d(v),s===void 0)if(typeof f=="function"){const _=f(t,o,i);s=typeof _=="string"?_:""}else if(i&&Object.prototype.hasOwnProperty.call(i,v))s="";else if(h){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${v} for interpolating ${t}`),s="";else typeof s!="string"&&!this.useRawValueToEscape&&(s=IO(s));const x=m.safeValue(s);if(t=t.replace(o[0],x),h?(m.regex.lastIndex+=s.length,m.regex.lastIndex-=o[0].length):m.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,s;function a(l,u){const d=this.nestingOptionsSeparator;if(l.indexOf(d)<0)return l;const f=l.split(new RegExp(`${d}[ ]*{`));let h=`{${f[1]}`;l=f[0],h=this.interpolate(h,s);const g=h.match(/'/g),m=h.match(/"/g);(g&&g.length%2===0&&!m||m.length%2!==0)&&(h=h.replace(/'/g,'"'));try{s=JSON.parse(h),u&&(s={...u,...s})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,v),`${l}${d}${h}`}return delete s.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];s={...r},s=s.replace&&typeof s.replace!="string"?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const d=i[1].split(this.formatSeparator).map(f=>f.trim());i[1]=d.shift(),l=d,u=!0}if(o=n(a.call(this,i[1].trim(),s),s),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=IO(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((d,f)=>this.format(d,f,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function R1e(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(s=>{if(!s)return;const[a,...l]=s.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[a.trim()]||(n[a.trim()]=u),u==="false"&&(n[a.trim()]=!1),u==="true"&&(n[a.trim()]=!0),isNaN(u)||(n[a.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function wd(e){const t={};return function(r,i,o){const s=i+JSON.stringify(o);let a=t[s];return a||(a=e(a_(i),o),t[s]=a),a(r)}}class O1e{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Bs.create("formatter"),this.options=t,this.formats={number:wd((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:wd((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:wd((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:wd((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:wd((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=wd(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,l)=>{const{formatName:u,formatOptions:d}=R1e(l);if(this.formats[u]){let f=a;try{const h=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},g=h.locale||h.lng||i.locale||i.lng||r;f=this.formats[u](a,g,{...d,...i,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}function k1e(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class I1e extends hS{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=Bs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},s={},a={},l={};return t.forEach(u=>{let d=!0;n.forEach(f=>{const h=`${u}|${f}`;!r.reload&&this.store.hasResourceBundle(u,f)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?s[h]===void 0&&(s[h]=!0):(this.state[h]=1,d=!1,s[h]===void 0&&(s[h]=!0),o[h]===void 0&&(o[h]=!0),l[f]===void 0&&(l[f]=!0)))}),d||(a[u]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],s=i[1];n&&this.emit("failedLoading",o,s,n),r&&this.store.addResourceBundle(o,s,r),this.state[t]=n?-1:2;const a={};this.queue.forEach(l=>{m1e(l.loaded,[o],s),k1e(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const d=l.loaded[u];d.length&&d.forEach(f=>{a[u][f]===void 0&&(a[u][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:s});return}this.readingCalls++;const a=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&d&&i{this.read.call(this,t,n,r,i+1,o*2,s)},o);return}s(u,d)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(d=>a(null,d)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,s),!s&&a&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,a),this.loaded(t,s,a)})}saveMissing(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...s,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(t,n,r,i,l):d=u(t,n,r,i),d&&typeof d.then=="function"?d.then(f=>a(null,f)).catch(a):a(null,d)}catch(d){a(d)}else u(t,n,r,i,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function BO(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function UO(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function V0(){}function M1e(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Kg extends hS{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=UO(t),this.services={},this.logger=Bs,this.modules={external:[]},M1e(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=BO();this.options={...i,...this.options,...UO(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(d){return d?typeof d=="function"?new d:d:null}if(!this.options.isClone){this.modules.logger?Bs.init(o(this.modules.logger),this.options):Bs.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=O1e);const f=new DO(this.options);this.store=new NO(this.options.resources,this.options);const h=this.services;h.logger=Bs,h.resourceStore=this.store,h.languageUtils=f,h.pluralResolver=new A1e(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(h.formatter=o(d),h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new P1e(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new I1e(o(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",function(g){for(var m=arguments.length,v=new Array(m>1?m-1:0),x=1;x1?m-1:0),x=1;x{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,r||(r=V0),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=function(){return t.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return t.store[d](...arguments),t}});const l=cp(),u=()=>{const d=(f,h)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(h),r(f,h)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V0;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],s=a=>{if(!a)return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload&&this.options.preload.forEach(a=>s(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const i=cp();return t||(t=this.languages),n||(n=this.options.ns),r||(r=V0),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&BU.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=cp();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},s=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{s(d,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),i}getFixedT(t,n,r){var i=this;const o=function(s,a){let l;if(typeof a!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),f=2;f`${l.keyPrefix}${h}${m}`):g=l.keyPrefix?`${l.keyPrefix}${h}${s}`:s,i.t(g,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!i||s(o,t)))}loadNamespaces(t,n){const r=cp();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=cp();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(s=>i.indexOf(s)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new DO(BO());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Kg(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V0;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Kg(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new NO(this.store.data,i),o.services.resourceStore=o.store),o.translator=new l_(o.services,i),o.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;dtypeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},UU={isConnected:!1,isProcessing:!1,isGFPGANAvailable:!0,isESRGANAvailable:!0,shouldConfirmOnDelete:!0,currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatusHasSteps:!1,isCancelable:!0,enableImageDebugging:!1,toastQueue:[],progressImage:null,shouldAntialiasProgressImage:!1,sessionId:null,cancelType:"immediate",isCancelScheduled:!1,subscribedNodeIds:[],wereModelsReceived:!1,wasSchemaParsed:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,statusTranslationKey:"common.statusDisconnected",canceledSession:"",isPersisted:!1,language:"en",isUploading:!1,isNodesEnabled:!1,shouldUseNSFWChecker:!1,shouldUseWatermarker:!1},zU=An({name:"system",initialState:UU,reducers:{setIsProcessing:(e,t)=>{e.isProcessing=t.payload},setCurrentStatus:(e,t)=>{e.statusTranslationKey=t.payload},setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setIsCancelable:(e,t)=>{e.isCancelable=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},cancelScheduled:e=>{e.isCancelScheduled=!0},scheduledCancelAborted:e=>{e.isCancelScheduled=!1},cancelTypeChanged:(e,t)=>{e.cancelType=t.payload},subscribedNodeIdsSet:(e,t)=>{e.subscribedNodeIds=t.payload},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},isPersistedChanged:(e,t)=>{e.isPersisted=t.payload},languageChanged:(e,t)=>{e.language=t.payload},progressImageSet(e,t){e.progressImage=t.payload},setIsNodesEnabled(e,t){e.isNodesEnabled=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload}},extraReducers(e){e.addCase(dF,(t,n)=>{t.sessionId=n.payload.sessionId,t.canceledSession=""}),e.addCase(hF,t=>{t.sessionId=null}),e.addCase(lF,t=>{t.isConnected=!0,t.isCancelable=!0,t.isProcessing=!1,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.statusTranslationKey="common.statusConnected"}),e.addCase(cF,t=>{t.isConnected=!1,t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusDisconnected"}),e.addCase(gF,t=>{t.isCancelable=!0,t.isProcessing=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusGenerating"}),e.addCase(SF,(t,n)=>{const{step:r,total_steps:i,progress_image:o}=n.payload.data;t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!0,t.currentStep=r+1,t.totalSteps=i,t.progressImage=o??null,t.statusTranslationKey="common.statusGenerating"}),e.addCase(mF,(t,n)=>{const{data:r}=n.payload;t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusProcessingComplete",t.canceledSession===r.graph_execution_state_id&&(t.isProcessing=!1,t.isCancelable=!0)}),e.addCase(_F,t=>{t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null}),e.addCase(zm,t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.statusTranslationKey="common.statusPreparing"}),e.addCase(Oc.fulfilled,(t,n)=>{t.canceledSession=n.meta.arg.session_id,t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null,t.toastQueue.push(lc({title:jp("toast.canceled"),status:"warning"}))}),e.addCase(wE,t=>{t.wasSchemaParsed=!0}),e.addMatcher(S$,(t,n)=>{var i,o,s;t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null;let r;((i=n.payload)==null?void 0:i.status)===422?r="Validation Error":(o=n.payload)!=null&&o.error&&(r=(s=n.payload)==null?void 0:s.error),t.toastQueue.push(lc({title:jp("toast.serverError"),status:"error",description:r}))}),e.addMatcher(F1e,(t,n)=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusError",t.progressImage=null,t.toastQueue.push(lc({title:jp("toast.serverError"),status:"error",description:mle(n.payload.data.error_type)}))})}}),{setIsProcessing:I7e,setShouldConfirmOnDelete:M7e,setCurrentStatus:N7e,setIsCancelable:L7e,setEnableImageDebugging:D7e,addToast:Yn,clearToastQueue:$7e,cancelScheduled:F7e,scheduledCancelAborted:B7e,cancelTypeChanged:U7e,subscribedNodeIdsSet:z7e,consoleLogLevelChanged:V7e,shouldLogToConsoleChanged:j7e,isPersistedChanged:G7e,shouldAntialiasProgressImageChanged:H7e,languageChanged:W7e,progressImageSet:N1e,setIsNodesEnabled:q7e,shouldUseNSFWCheckerChanged:L1e,shouldUseWatermarkerChanged:D1e}=zU.actions,$1e=zU.reducer,F1e=Lo(ZT,TF,AF),B1e={searchFolder:null,advancedAddScanModel:null},VU=An({name:"modelmanager",initialState:B1e,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:K7e,setAdvancedAddScanModel:X7e}=VU.actions,U1e=VU.reducer,jU={shift:!1},GU=An({name:"hotkeys",initialState:jU,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload}}}),{shiftKeyPressed:Y7e}=GU.actions,z1e=GU.reducer,V1e=dQ(tee);HU=d5=void 0;var j1e=V1e,G1e=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(d){return function(f){return j1e.compose.apply(void 0,n)(d)(f)}}},o=function(){for(var u,d,f=arguments.length,h=Array(f),g=0;g=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function qU(e,t){if(e){if(typeof e=="string")return VO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VO(e,t)}}function VO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,s=r.persistWholeStore,a=r.serialize;try{var l=s?i_e:o_e;yield l(t,n,{prefix:i,driver:o,serialize:a})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function WO(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(u){n(u);return}a.done?t(l):Promise.resolve(l).then(r,i)}function qO(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(l){WO(o,r,i,s,a,"next",l)}function a(l){WO(o,r,i,s,a,"throw",l)}s(void 0)})}}var a_e=function(){var e=qO(function*(t,n,r){var i=r.prefix,o=r.driver,s=r.serialize,a=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,d=r.persistWholeStore;yield J1e(t,n,{prefix:i,driver:o,unserialize:a,persistWholeStore:d});var f={},h=function(){var g=qO(function*(){var m=WU(t.getState(),n);yield s_e(m,f,{prefix:i,driver:o,serialize:s,persistWholeStore:d}),EE(m,f)||t.dispatch({type:K1e,payload:m}),f=m});return function(){return g.apply(this,arguments)}}();u&&u>0?t.subscribe(Y1e(h,u)):t.subscribe(X1e(h,l))});return function(n,r,i){return e.apply(this,arguments)}}();const l_e=a_e;function Xg(e){"@babel/helpers - typeof";return Xg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xg(e)}function KO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hx(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=Hx({},r));var o=typeof t=="function"?t:Qf(t);switch(i.type){case f5:return n.state=o(Hx(Hx({},n.state),i.payload||{}),{type:f5}),n.state;default:return o(r,i)}}},h_e=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,s=r.serialize,a=s===void 0?function(x,_){return JSON.stringify(x)}:s,l=r.unserialize,u=l===void 0?function(x,_){return JSON.parse(x)}:l,d=r.persistThrottle,f=d===void 0?100:d,h=r.persistDebounce,g=r.persistWholeStore,m=g===void 0?!1:g;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var v=function(_){return function(b,y,S){var C=_(b,y,S);return l_e(C,n,{driver:t,prefix:o,serialize:a,unserialize:u,persistThrottle:f,persistDebounce:h,persistWholeStore:m}),C}};return v};const Q7e=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],p_e="@@invokeai-",g_e=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"],m_e=["pendingControlImages"],y_e=["selection","selectedBoardId","galleryView"],v_e=["schema","invocationTemplates"],__e=[],b_e=[],S_e=["currentIteration","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","totalIterations","totalSteps","isCancelScheduled","progressImage","wereModelsReceived","wasSchemaParsed","isPersisted","isUploading"],w_e=["shouldShowImageDetails"],x_e={canvas:g_e,gallery:y_e,generation:__e,nodes:v_e,postprocessing:b_e,system:S_e,ui:w_e,controlNet:m_e},C_e=(e,t)=>{const n=mb(e,x_e[t]??[]);return JSON.stringify(n)},T_e={canvas:x$,gallery:IF,generation:ys,nodes:IU,postprocessing:LU,system:UU,config:r$,ui:v$,hotkeys:jU,controlNet:H3},E_e=(e,t)=>Lae(JSON.parse(e),T_e[t]),XU=Me("nodes/textToImageGraphBuilt"),YU=Me("nodes/imageToImageGraphBuilt"),QU=Me("nodes/canvasGraphBuilt"),ZU=Me("nodes/nodesGraphBuilt"),A_e=Lo(XU,YU,QU,ZU),P_e=e=>{if(A_e(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return qg.fulfilled.match(e)?{...e,payload:""}:wE.match(e)?{...e,payload:""}:e},R_e=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","hotkeys/shiftKeyPressed","@@REMEMBER_PERSISTED"],O_e=e=>e,k_e=()=>{Oe({actionCreator:dce,effect:async(e,{dispatch:t,getState:n})=>{const r=ke("canvas"),i=n(),{sessionId:o,isProcessing:s}=i.system,a=e.payload;if(s){if(!a){r.debug("No canvas session, skipping cancel");return}if(a!==o){r.debug({canvasSessionId:a,session_id:o},"Canvas session does not match global session, skipping cancel");return}t(Oc({session_id:o}))}}})};Me("app/appStarted");const I_e=()=>{Oe({matcher:we.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Jo({board_id:"none",categories:Jr}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Cn.getSelectors().selectAll(i)[0];t(Gs(o??null))}}})},AE=iu.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5})})}),{useGetAppVersionQuery:Z7e,useGetAppConfigQuery:J7e}=AE,M_e=()=>{Oe({matcher:AE.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,s=t().generation.infillMethod;r.includes(s)||n(jue(r[0])),i.includes("nsfw_checker")||n(L1e(!1)),o.includes("invisible_watermark")||n(D1e(!1))}})},N_e=Me("app/appStarted"),L_e=()=>{Oe({actionCreator:N_e,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},PE={memoizeOptions:{resultEqualityCheck:gb}},JU=(e,t)=>{var f;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,s=((f=n.initialImage)==null?void 0:f.imageName)===t,a=r.layerState.objects.some(h=>h.kind==="image"&&h.imageName===t),l=i.nodes.some(h=>Hu(h.data.inputs,g=>{var m;return g.type==="image"&&((m=g.value)==null?void 0:m.image_name)===t})),u=Hu(o.controlNets,h=>h.controlImage===t||h.processedControlImage===t);return{isInitialImage:s,isCanvasImage:a,isNodesImage:l,isControlNetImage:u}},D_e=mi([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>JU(e,r.image_name)):[]},PE),$_e=()=>{Oe({matcher:we.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,s=!1,a=!1;const l=n();r.forEach(u=>{const d=JU(l,u);d.isInitialImage&&!i&&(t(FT()),i=!0),d.isCanvasImage&&!o&&(t(BT()),o=!0),d.isNodesImage&&!s&&(t(xE()),s=!0),d.isControlNetImage&&!a&&(t(tE()),a=!0)})}})},F_e=()=>{Oe({matcher:Lo(W3,G1),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),s=W3.match(e)?e.payload:o.gallery.selectedBoardId,l=(G1.match(e)?e.payload:o.gallery.galleryView)==="images"?Jr:Ll,u={board_id:s??"none",categories:l};if(await r(()=>we.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:f}=we.endpoints.listImages.select(u)(t());if(f){const h=j1.selectAll(f)[0];n(Gs(h??null))}else n(Gs(null))}else n(Gs(null))}})},B_e=Me("canvas/canvasSavedToGallery"),U_e=Me("canvas/canvasCopiedToClipboard"),z_e=Me("canvas/canvasDownloadedAsImage"),V_e=Me("canvas/canvasMerged"),j_e=Me("canvas/stagingAreaImageSaved");let ez=null,tz=null;const eMe=e=>{ez=e},gS=()=>ez,tMe=e=>{tz=e},G_e=()=>tz,H_e=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),c_=async(e,t)=>await H_e(e.toCanvas(t)),RE=async e=>{const t=gS();if(!t)return;const{shouldCropToBoundingBoxOnSave:n,boundingBoxCoordinates:r,boundingBoxDimensions:i}=e.canvas,o=t.clone();o.scale({x:1,y:1});const s=o.getAbsolutePosition(),a=n?{x:r.x+s.x,y:r.y+s.y,width:i.width,height:i.height}:o.getClientRect();return c_(o,a)},W_e=e=>{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])},q_e=()=>{Oe({actionCreator:U_e,effect:async(e,{dispatch:t,getState:n})=>{const r=fS.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n(),o=await RE(i);if(!o){r.error("Problem getting base layer blob"),t(Yn({title:"Problem Copying Canvas",description:"Unable to export base layer",status:"error"}));return}W_e(o),t(Yn({title:"Canvas Copied to Clipboard",status:"success"}))}})},K_e=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},X_e=()=>{Oe({actionCreator:z_e,effect:async(e,{dispatch:t,getState:n})=>{const r=fS.get().child({namespace:"canvasSavedToGalleryListener"}),i=n(),o=await RE(i);if(!o){r.error("Problem getting base layer blob"),t(Yn({title:"Problem Downloading Canvas",description:"Unable to export base layer",status:"error"}));return}K_e(o,"canvas.png"),t(Yn({title:"Canvas Downloaded",status:"success"}))}})},Y_e=async()=>{const e=gS();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),c_(t,t.getClientRect())},Q_e=()=>{Oe({actionCreator:V_e,effect:async(e,{dispatch:t})=>{const n=fS.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await Y_e();if(!r){n.error("Problem getting base layer blob"),t(Yn({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const i=gS();if(!i){n.error("Problem getting canvas base layer"),t(Yn({title:"Problem Merging Canvas",description:"Unable to export base layer",status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),s=await t(we.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:"Canvas Merged"}}})).unwrap(),{image_name:a}=s;t(fce({kind:"image",layer:"base",imageName:a,...o}))}})},Z_e=()=>{Oe({actionCreator:B_e,effect:async(e,{dispatch:t,getState:n})=>{const r=ke("canvas"),i=n(),o=await RE(i);if(!o){r.error("Problem getting base layer blob"),t(Yn({title:"Problem Saving Canvas",description:"Unable to export base layer",status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(we.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:"Canvas Saved to Gallery"}}}))}})},J_e=(e,t,n)=>{var f;if(!(vfe.match(e)||PR.match(e)||eE.match(e)||_fe.match(e)||RR.match(e))||RR.match(e)&&((f=n.controlNet.controlNets[e.payload.controlNetId])==null?void 0:f.shouldAutoConfig)===!0)return!1;const i=t.controlNet.controlNets[e.payload.controlNetId];if(!i)return!1;const{controlImage:o,processorType:s,shouldAutoConfig:a}=i;if(PR.match(e)&&!a)return!1;const l=s!=="none",u=t.system.isProcessing;return l&&!u&&!!o},ebe=()=>{Oe({predicate:J_e,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=ke("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(JT({controlNetId:o}))}})},kc=Me("system/sessionReadyToInvoke"),nz=e=>(e==null?void 0:e.type)==="image_output",tbe=()=>{Oe({actionCreator:JT,effect:async(e,{dispatch:t,getState:n,take:r})=>{const i=ke("session"),{controlNetId:o}=e.payload,s=n().controlNet.controlNets[o];if(!(s!=null&&s.controlImage)){i.error("Unable to process ControlNet image");return}const a={nodes:{[s.processorNode.id]:{...s.processorNode,is_intermediate:!0,image:{image_name:s.controlImage}}}},l=t(jr({graph:a})),[u]=await r(h=>jr.fulfilled.match(h)&&h.meta.requestId===l.requestId),d=u.payload.id;t(kc());const[f]=await r(h=>QT.match(h)&&h.payload.data.graph_execution_state_id===d);if(nz(f.payload.data.result)){const{image_name:h}=f.payload.data.result.image,[{payload:g}]=await r(v=>we.endpoints.getImageDTO.matchFulfilled(v)&&v.payload.image_name===h),m=g;i.debug({controlNetId:e.payload,processedControlImage:m},"ControlNet image processed"),t(yfe({controlNetId:o,processedControlImage:m.image_name}))}}})},nbe=()=>{Oe({matcher:we.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=ke("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},rbe=()=>{Oe({matcher:we.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=ke("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},OE=Me("deleteImageModal/imageDeletionConfirmed"),nMe=e=>e.gallery,rMe=mi(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],PE),rz=mi([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?Jr:Ll,offset:0,limit:mce,is_intermediate:!1}},PE),ibe=()=>{Oe({actionCreator:OE,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var h;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const s=i[0],a=o[0];if(!s||!a)return;t(nE(!1));const l=n(),u=(h=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:h.image_name;if(s&&(s==null?void 0:s.image_name)===u){const{image_name:g}=s,m=rz(l),{data:v}=we.endpoints.listImages.select(m)(l),x=v?Cn.getSelectors().selectAll(v):[],_=x.findIndex(C=>C.image_name===g),b=x.filter(C=>C.image_name!==g),y=Ml(_,0,b.length-1),S=b[y];t(Gs(S||null))}a.isCanvasImage&&t(BT()),a.isControlNetImage&&t(tE()),a.isInitialImage&&t(FT()),a.isNodesImage&&t(xE());const{requestId:d}=t(we.endpoints.deleteImage.initiate(s));await r(g=>we.endpoints.deleteImage.matchFulfilled(g)&&g.meta.requestId===d,3e4)&&t(iu.util.invalidateTags([{type:"Board",id:s.board_id}]))}})},obe=()=>{Oe({actionCreator:OE,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<1||i.length<1))try{await t(we.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),s=rz(o),{data:a}=we.endpoints.listImages.select(s)(o),l=a?Cn.getSelectors().selectAll(a)[0]:void 0;t(Gs(l||null)),t(nE(!1)),i.some(u=>u.isCanvasImage)&&t(BT()),i.some(u=>u.isControlNetImage)&&t(tE()),i.some(u=>u.isInitialImage)&&t(FT()),i.some(u=>u.isNodesImage)&&t(xE())}catch{}}})},sbe=()=>{Oe({matcher:we.endpoints.deleteImage.matchPending,effect:()=>{}})},abe=()=>{Oe({matcher:we.endpoints.deleteImage.matchFulfilled,effect:e=>{ke("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},lbe=()=>{Oe({matcher:we.endpoints.deleteImage.matchRejected,effect:e=>{ke("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},iz=Me("dnd/dndDropped"),ube=()=>{Oe({actionCreator:iz,effect:async(e,{dispatch:t})=>{const n=ke("images"),{activeData:r,overData:i}=e.payload;if(r.payloadType==="IMAGE_DTO"?n.debug({activeData:r,overData:i},"Image dropped"):r.payloadType==="IMAGE_DTOS"?n.debug({activeData:r,overData:i},`Images (${r.payload.imageDTOs.length}) dropped`):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Gs(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(vb(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(eE({controlImage:r.payload.imageDTO.image_name,controlNetId:o}));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(T$(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:s}=i.context;t(NU({nodeId:s,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:s}=i.context;t(we.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:s}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(we.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:s}=i.context;t(we.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:s}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(we.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},cbe=()=>{Oe({matcher:we.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=ke("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},dbe=()=>{Oe({matcher:we.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=ke("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},fbe=()=>{Oe({actionCreator:Efe,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,s=D_e(n()),a=s.some(l=>l.isCanvasImage)||s.some(l=>l.isInitialImage)||s.some(l=>l.isControlNetImage)||s.some(l=>l.isNodesImage);if(o||a){t(nE(!0));return}t(OE({imageDTOs:r,imagesUsage:s}))}})},xd={title:"Image Uploaded",status:"success"},hbe=()=>{Oe({matcher:we.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=ke("images"),i=e.payload,o=n(),{autoAddBoardId:s}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:a}=e.meta.arg.originalArgs;if(!(e.payload.is_intermediate&&!a)){if((a==null?void 0:a.type)==="TOAST"){const{toastOptions:l}=a;if(!s||s==="none")t(Yn({...xd,...l}));else{t(we.endpoints.addImageToBoard.initiate({board_id:s,imageDTO:i}));const{data:u}=Yi.endpoints.listAllBoards.select()(o),d=u==null?void 0:u.find(h=>h.board_id===s),f=d?`Added to board ${d.board_name}`:`Added to board ${s}`;t(Yn({...xd,description:f}))}return}if((a==null?void 0:a.type)==="SET_CANVAS_INITIAL_IMAGE"){t(T$(i)),t(Yn({...xd,description:"Set as canvas initial image"}));return}if((a==null?void 0:a.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:l}=a;t(eE({controlNetId:l,controlImage:i.image_name})),t(Yn({...xd,description:"Set as control image"}));return}if((a==null?void 0:a.type)==="SET_INITIAL_IMAGE"){t(vb(i)),t(Yn({...xd,description:"Set as initial image"}));return}if((a==null?void 0:a.type)==="SET_NODES_IMAGE"){const{nodeId:l,fieldName:u}=a;t(NU({nodeId:l,fieldName:u,value:i})),t(Yn({...xd,description:`Set as node field ${u}`}));return}}}})},pbe=()=>{Oe({matcher:we.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=ke("images"),r={arg:{...mb(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Yn({title:"Image Upload Failed",description:e.error.message,status:"error"}))}})},gbe=Me("generation/initialImageSelected"),mbe=Me("generation/modelSelected"),ybe=()=>{Oe({actionCreator:gbe,effect:(e,{dispatch:t})=>{if(!e.payload){t(Yn(lc({title:jp("toast.imageNotLoadedDesc"),status:"error"})));return}t(vb(e.payload)),t(Yn(lc(jp("toast.sentToImageToImage"))))}})},vbe=()=>{Oe({actionCreator:mbe,effect:(e,{getState:t,dispatch:n})=>{var l;const r=ke("models"),i=t(),o=p$.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const s=o.data,{base_model:a}=s;if(((l=i.generation.model)==null?void 0:l.base_model)!==a){let u=0;gc(i.lora.loras,(h,g)=>{h.base_model!==a&&(n($F(g)),u+=1)});const{vae:d}=i.generation;d&&d.base_model!==a&&(n(m$(null)),u+=1);const{controlNets:f}=i.controlNet;gc(f,(h,g)=>{var m;((m=h.model)==null?void 0:m.base_model)!==a&&(n(RF({controlNetId:g})),u+=1)}),u>0&&n(Yn(lc({title:`Base model changed, cleared ${u} incompatible submodel${u===1?"":"s"}`,status:"warning"})))}n(Nl(s))}})},p5=hu({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),XO=hu({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),YO=hu({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),QO=hu({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),ZO=hu({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),g5=hu({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),_be=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Cd=e=>{const t=[];return e.forEach(n=>{const r={...Qr(n),id:_be(n)};t.push(r)}),t},Aa=iu.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${Tv.stringify(n,{arrayFormat:"none"})}`},providesTags:(t,n,r)=>{const i=[{type:"OnnxModel",id:tt}];return t&&i.push(...t.ids.map(o=>({type:"OnnxModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Cd(t.models);return XO.setAll(XO.getInitialState(),i)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${Tv.stringify(n,{arrayFormat:"none"})}`},providesTags:(t,n,r)=>{const i=[{type:"MainModel",id:tt}];return t&&i.push(...t.ids.map(o=>({type:"MainModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Cd(t.models);return p5.setAll(p5.getInitialState(),i)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:tt},{type:"SDXLRefinerModel",id:tt},{type:"OnnxModel",id:tt}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:tt},{type:"SDXLRefinerModel",id:tt},{type:"OnnxModel",id:tt}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:tt},{type:"SDXLRefinerModel",id:tt},{type:"OnnxModel",id:tt}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:tt},{type:"SDXLRefinerModel",id:tt},{type:"OnnxModel",id:tt}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:[{type:"MainModel",id:tt},{type:"SDXLRefinerModel",id:tt},{type:"OnnxModel",id:tt}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:tt},{type:"SDXLRefinerModel",id:tt},{type:"OnnxModel",id:tt}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:tt},{type:"SDXLRefinerModel",id:tt},{type:"OnnxModel",id:tt}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:(t,n,r)=>{const i=[{type:"LoRAModel",id:tt}];return t&&i.push(...t.ids.map(o=>({type:"LoRAModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Cd(t.models);return YO.setAll(YO.getInitialState(),i)}}),updateLoRAModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/lora/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"LoRAModel",id:tt}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:tt}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:(t,n,r)=>{const i=[{type:"ControlNetModel",id:tt}];return t&&i.push(...t.ids.map(o=>({type:"ControlNetModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Cd(t.models);return QO.setAll(QO.getInitialState(),i)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:(t,n,r)=>{const i=[{type:"VaeModel",id:tt}];return t&&i.push(...t.ids.map(o=>({type:"VaeModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Cd(t.models);return g5.setAll(g5.getInitialState(),i)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:(t,n,r)=>{const i=[{type:"TextualInversionModel",id:tt}];return t&&i.push(...t.ids.map(o=>({type:"TextualInversionModel",id:o}))),i},transformResponse:(t,n,r)=>{const i=Cd(t.models);return ZO.setAll(ZO.getInitialState(),i)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${Tv.stringify(t,{})}`}),providesTags:(t,n,r)=>{const i=[{type:"ScannedModels",id:tt}];return t&&i.push(...t.map(o=>({type:"ScannedModels",id:o}))),i}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:iMe,useGetOnnxModelsQuery:oMe,useGetControlNetModelsQuery:sMe,useGetLoRAModelsQuery:aMe,useGetTextualInversionModelsQuery:lMe,useGetVaeModelsQuery:uMe,useUpdateMainModelsMutation:cMe,useDeleteMainModelsMutation:dMe,useImportMainModelsMutation:fMe,useAddMainModelsMutation:hMe,useConvertMainModelsMutation:pMe,useMergeMainModelsMutation:gMe,useDeleteLoRAModelsMutation:mMe,useUpdateLoRAModelsMutation:yMe,useSyncModelsMutation:vMe,useGetModelsInFolderQuery:_Me,useGetCheckpointConfigsQuery:bMe}=Aa,bbe=()=>{Oe({predicate:(e,t)=>Aa.endpoints.getMainModels.matchFulfilled(t)&&!t.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=ke("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model;if(Hu(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)&&(u==null?void 0:u.model_type)===(i==null?void 0:i.model_type)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(Nl(null));return}const l=p$.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse main model");return}n(Nl(l.data))}}),Oe({predicate:(e,t)=>Aa.endpoints.getMainModels.matchFulfilled(t)&&t.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=ke("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel;if(Hu(e.payload.entities,u=>(u==null?void 0:u.model_name)===(i==null?void 0:i.model_name)&&(u==null?void 0:u.base_model)===(i==null?void 0:i.base_model)&&(u==null?void 0:u.model_type)===(i==null?void 0:i.model_type)))return;const s=e.payload.ids[0],a=e.payload.entities[s];if(!a){n(kO(null)),n(f1e(!1));return}const l=h$.safeParse(a);if(!l.success){r.error({error:l.error.format()},"Failed to parse SDXL Refiner Model");return}n(kO(l.data))}}),Oe({matcher:Aa.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=ke("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Hu(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const s=g5.getSelectors().selectAll(e.payload)[0];if(!s){n(Nl(null));return}const a=$ue.safeParse(s);if(!a.success){r.error({error:a.error.format()},"Failed to parse VAE model");return}n(m$(a.data))}}),Oe({matcher:Aa.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{ke("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;gc(i,(o,s)=>{Hu(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n($F(s))})}}),Oe({matcher:Aa.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{ke("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;gc(i,(o,s)=>{Hu(e.payload.entities,l=>{var u,d;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((d=o==null?void 0:o.model)==null?void 0:d.base_model)})||n(RF({controlNetId:s}))})}}),Oe({matcher:Aa.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{ke("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},Ya=e=>JSON.parse(JSON.stringify(e)),m5=e=>!("$ref"in e),Sbe=e=>!("$ref"in e),SMe=500,wbe={integer:"integer",float:"float",number:"float",string:"string",boolean:"boolean",enum:"enum",ImageField:"image",image_collection:"image_collection",LatentsField:"latents",ConditioningField:"conditioning",UNetField:"unet",ClipField:"clip",VaeField:"vae",model:"model",refiner_model:"refiner_model",vae_model:"vae_model",lora_model:"lora_model",controlnet_model:"controlnet_model",ControlNetModelField:"controlnet_model",array:"array",item:"item",ColorField:"color",ControlField:"control",control:"control",cfg_scale:"float",control_weight:"float"},xbe=500,Un=e=>`var(--invokeai-colors-${e}-${xbe})`,wMe={integer:{color:"red",colorCssVar:Un("red"),title:"Integer",description:"Integers are whole numbers, without a decimal point."},float:{color:"orange",colorCssVar:Un("orange"),title:"Float",description:"Floats are numbers with a decimal point."},string:{color:"yellow",colorCssVar:Un("yellow"),title:"String",description:"Strings are text."},boolean:{color:"green",colorCssVar:Un("green"),title:"Boolean",description:"Booleans are true or false."},enum:{color:"blue",colorCssVar:Un("blue"),title:"Enum",description:"Enums are values that may be one of a number of options."},image:{color:"purple",colorCssVar:Un("purple"),title:"Image",description:"Images may be passed between nodes."},image_collection:{color:"purple",colorCssVar:Un("purple"),title:"Image Collection",description:"A collection of images."},latents:{color:"pink",colorCssVar:Un("pink"),title:"Latents",description:"Latents may be passed between nodes."},conditioning:{color:"cyan",colorCssVar:Un("cyan"),title:"Conditioning",description:"Conditioning may be passed between nodes."},unet:{color:"red",colorCssVar:Un("red"),title:"UNet",description:"UNet submodel."},clip:{color:"green",colorCssVar:Un("green"),title:"Clip",description:"Tokenizer and text_encoder submodels."},vae:{color:"blue",colorCssVar:Un("blue"),title:"Vae",description:"Vae submodel."},control:{color:"cyan",colorCssVar:Un("cyan"),title:"Control",description:"Control info passed between nodes."},model:{color:"teal",colorCssVar:Un("teal"),title:"Model",description:"Models are models."},refiner_model:{color:"teal",colorCssVar:Un("teal"),title:"Refiner Model",description:"Models are models."},vae_model:{color:"teal",colorCssVar:Un("teal"),title:"VAE",description:"Models are models."},lora_model:{color:"teal",colorCssVar:Un("teal"),title:"LoRA",description:"Models are models."},controlnet_model:{color:"teal",colorCssVar:Un("teal"),title:"ControlNet",description:"Models are models."},array:{color:"gray",colorCssVar:Un("gray"),title:"Array",description:"TODO: Array type description."},item:{color:"gray",colorCssVar:Un("gray"),title:"Collection Item",description:"TODO: Collection Item type description."},color:{color:"gray",colorCssVar:Un("gray"),title:"Color",description:"A RGBA color."}},xMe=250,Wx=e=>{const t=e.$ref.split("/").slice(-1)[0];return t||"UNKNOWN FIELD TYPE"},Cbe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},Tbe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",inputRequirement:"always",inputKind:"any",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&(n.exclusiveMinimum=e.exclusiveMinimum),n},Ebe=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",inputRequirement:"always",inputKind:"any",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},Abe=({schemaObject:e,baseField:t})=>({...t,type:"boolean",inputRequirement:"always",inputKind:"any",default:e.default??!1}),Pbe=({schemaObject:e,baseField:t})=>({...t,type:"model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),Rbe=({schemaObject:e,baseField:t})=>({...t,type:"refiner_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),Obe=({schemaObject:e,baseField:t})=>({...t,type:"vae_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),kbe=({schemaObject:e,baseField:t})=>({...t,type:"lora_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),Ibe=({schemaObject:e,baseField:t})=>({...t,type:"controlnet_model",inputRequirement:"always",inputKind:"direct",default:e.default??void 0}),Mbe=({schemaObject:e,baseField:t})=>({...t,type:"image",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),Nbe=({schemaObject:e,baseField:t})=>({...t,type:"image_collection",inputRequirement:"always",inputKind:"any",default:e.default??void 0}),Lbe=({schemaObject:e,baseField:t})=>({...t,type:"latents",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Dbe=({schemaObject:e,baseField:t})=>({...t,type:"conditioning",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),$be=({schemaObject:e,baseField:t})=>({...t,type:"unet",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Fbe=({schemaObject:e,baseField:t})=>({...t,type:"clip",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Bbe=({schemaObject:e,baseField:t})=>({...t,type:"vae",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),Ube=({schemaObject:e,baseField:t})=>({...t,type:"control",inputRequirement:"always",inputKind:"connection",default:e.default??void 0}),zbe=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",enumType:e.type??"string",options:n,inputRequirement:"always",inputKind:"direct",default:e.default??n[0]}},JO=({baseField:e})=>({...e,type:"array",inputRequirement:"always",inputKind:"direct",default:[]}),ek=({baseField:e})=>({...e,type:"item",inputRequirement:"always",inputKind:"direct",default:void 0}),Vbe=({schemaObject:e,baseField:t})=>({...t,type:"color",inputRequirement:"always",inputKind:"direct",default:e.default??{r:127,g:127,b:127,a:255}}),oz=(e,t,n)=>{let r="";n&&t in n?r=n[t]??"UNKNOWN FIELD TYPE":e.type?e.enum?r="enum":e.type&&(r=e.type):e.allOf?r=Wx(e.allOf[0]):e.anyOf?r=Wx(e.anyOf[0]):e.oneOf&&(r=Wx(e.oneOf[0]));const i=wbe[r];if(!i)throw`Field type "${r}" is unknown!`;return i},jbe=(e,t,n)=>{const r=oz(e,t,n),i={name:t,title:e.title??"",description:e.description??""};if(["image"].includes(r))return Mbe({schemaObject:e,baseField:i});if(["image_collection"].includes(r))return Nbe({schemaObject:e,baseField:i});if(["latents"].includes(r))return Lbe({schemaObject:e,baseField:i});if(["conditioning"].includes(r))return Dbe({schemaObject:e,baseField:i});if(["unet"].includes(r))return $be({schemaObject:e,baseField:i});if(["clip"].includes(r))return Fbe({schemaObject:e,baseField:i});if(["vae"].includes(r))return Bbe({schemaObject:e,baseField:i});if(["control"].includes(r))return Ube({schemaObject:e,baseField:i});if(["model"].includes(r))return Pbe({schemaObject:e,baseField:i});if(["refiner_model"].includes(r))return Rbe({schemaObject:e,baseField:i});if(["vae_model"].includes(r))return Obe({schemaObject:e,baseField:i});if(["lora_model"].includes(r))return kbe({schemaObject:e,baseField:i});if(["controlnet_model"].includes(r))return Ibe({schemaObject:e,baseField:i});if(["enum"].includes(r))return zbe({schemaObject:e,baseField:i});if(["integer"].includes(r))return Cbe({schemaObject:e,baseField:i});if(["number","float"].includes(r))return Tbe({schemaObject:e,baseField:i});if(["string"].includes(r))return Ebe({schemaObject:e,baseField:i});if(["boolean"].includes(r))return Abe({schemaObject:e,baseField:i});if(["array"].includes(r))return JO({schemaObject:e,baseField:i});if(["item"].includes(r))return ek({schemaObject:e,baseField:i});if(["color"].includes(r))return Vbe({schemaObject:e,baseField:i});if(["array"].includes(r))return JO({schemaObject:e,baseField:i});if(["item"].includes(r))return ek({schemaObject:e,baseField:i})},Gbe=(e,t,n)=>{const r=e.$ref.split("/").slice(-1)[0];if(!r)throw ke("nodes").error({refObject:Ya(e)},"No output schema name found in ref object"),"No output schema name found in ref object";const i=t.components.schemas[r];if(!i)throw ke("nodes").error({outputSchemaName:r},"Output schema not found"),"Output schema not found";return m5(i)?LT(i.properties,(s,a,l)=>{if(!["type","id"].includes(l)&&!["object"].includes(a.type)&&m5(a)){const u=oz(a,l,n);s[l]={name:l,title:a.title??"",description:a.description??"",type:u}}return s},{}):{}},Hbe=e=>e==="l2i"?["id","type","metadata"]:["id","type","is_intermediate","metadata"],Wbe=["Graph","InvocationMeta","MetadataAccumulatorInvocation"],qbe=e=>{var r;return XD((r=e.components)==null?void 0:r.schemas,(i,o)=>o.includes("Invocation")&&!o.includes("InvocationOutput")&&!Wbe.some(s=>o.includes(s))).reduce((i,o)=>{var s,a,l,u,d;if(Sbe(o)){const f=o.properties.type.default,h=Hbe(f),g=((s=o.ui)==null?void 0:s.title)??o.title.replace("Invocation",""),m=(a=o.ui)==null?void 0:a.type_hints,v={};if(f==="collect"){const y=o.properties.item;v.item={type:"item",name:"item",description:y.description??"",title:"Collection Item",inputKind:"connection",inputRequirement:"always",default:void 0}}else if(f==="iterate"){const y=o.properties.collection;v.collection={type:"array",name:"collection",title:y.title??"",default:[],description:y.description??"",inputRequirement:"always",inputKind:"connection"}}else LT(o.properties,(y,S,C)=>{if(!h.includes(C)&&m5(S)){const T=jbe(S,C,m);T&&(y[C]=T)}return y},v);const x=o.output;let _;if(f==="iterate"){const y=(u=(l=e.components)==null?void 0:l.schemas)==null?void 0:u.IterateInvocationOutput;_={item:{name:"item",title:(y==null?void 0:y.title)??"",description:(y==null?void 0:y.description)??"",type:"array"}}}else _=Gbe(x,e,m);const b={title:g,type:f,tags:((d=o.ui)==null?void 0:d.tags)??[],description:o.description??"",inputs:v,outputs:_};Object.assign(i,{[f]:b})}return i},{})},Kbe=()=>{Oe({actionCreator:qg.fulfilled,effect:(e,{dispatch:t})=>{const n=ke("system"),r=e.payload;n.debug({schemaJSON:r},"Dereferenced OpenAPI schema");const i=qbe(r);n.debug({nodeTemplates:Ya(i)},`Built ${DT(i)} node templates`),t(wE(i))}}),Oe({actionCreator:qg.rejected,effect:()=>{ke("system").error("Problem dereferencing OpenAPI Schema")}})},Xbe=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),Ybe=new Map(Xbe),Qbe=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],y5=Symbol(".toJSON was called"),Zbe=e=>{e[y5]=!0;const t=e.toJSON();return delete e[y5],t},Jbe=e=>Ybe.get(e)??Error,sz=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a})=>{if(!n)if(Array.isArray(e))n=[];else if(!a&&tk(e)){const u=Jbe(e.name);n=new u}else n={};if(t.push(e),o>=i)return n;if(s&&typeof e.toJSON=="function"&&e[y5]!==!0)return Zbe(e);const l=u=>sz({from:u,seen:[...t],forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a});for(const[u,d]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(d)){n[u]="[object Buffer]";continue}if(d!==null&&typeof d=="object"&&typeof d.pipe=="function"){n[u]="[object Stream]";continue}if(typeof d!="function"){if(!d||typeof d!="object"){n[u]=d;continue}if(!t.includes(e[u])){o++,n[u]=l(e[u]);continue}n[u]="[Circular]"}}for(const{property:u,enumerable:d}of Qbe)typeof e[u]<"u"&&e[u]!==null&&Object.defineProperty(n,u,{value:tk(e[u])?l(e[u]):e[u],enumerable:r?!0:d,configurable:!0,writable:!0});return n};function kE(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?sz({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function tk(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const eSe=()=>{Oe({actionCreator:Oc.pending,effect:()=>{}})},tSe=()=>{Oe({actionCreator:Oc.fulfilled,effect:e=>{const t=ke("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session canceled (${n})`)}})},nSe=()=>{Oe({actionCreator:Oc.rejected,effect:e=>{const t=ke("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:kE(r)},"Problem canceling session")}}})},rSe=()=>{Oe({actionCreator:jr.pending,effect:()=>{}})},iSe=()=>{Oe({actionCreator:jr.fulfilled,effect:e=>{const t=ke("session"),n=e.payload;t.debug({session:Ya(n)},`Session created (${n.id})`)}})},oSe=()=>{Oe({actionCreator:jr.rejected,effect:e=>{const t=ke("session");if(e.payload){const{error:n,status:r}=e.payload,i=Ya(e.meta.arg);t.error({graph:i,status:r,error:kE(n)},"Problem creating session")}}})},sSe=()=>{Oe({actionCreator:km.pending,effect:()=>{}})},aSe=()=>{Oe({actionCreator:km.fulfilled,effect:e=>{const t=ke("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session invoked (${n})`)}})},lSe=()=>{Oe({actionCreator:km.rejected,effect:e=>{const t=ke("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:kE(r)},"Problem invoking session")}}})},uSe=()=>{Oe({actionCreator:kc,effect:(e,{getState:t,dispatch:n})=>{const r=ke("session"),{sessionId:i}=t().system;i&&(r.debug({session_id:i},`Session ready to invoke (${i})})`),n(km({session_id:i})))}})},cSe=()=>{Oe({actionCreator:aF,effect:(e,{dispatch:t,getState:n})=>{ke("socketio").debug("Connected");const{nodes:i,config:o}=n(),{disabledTabs:s}=o;!i.schema&&!s.includes("nodes")&&t(qg()),t(lF(e.payload)),t(Aa.util.invalidateTags([{type:"MainModel",id:tt},{type:"SDXLRefinerModel",id:tt},{type:"LoRAModel",id:tt},{type:"ControlNetModel",id:tt},{type:"VaeModel",id:tt},{type:"TextualInversionModel",id:tt},{type:"ScannedModels",id:tt}])),t(AE.util.invalidateTags(["AppConfig","AppVersion"]))}})},dSe=()=>{Oe({actionCreator:uF,effect:(e,{dispatch:t})=>{ke("socketio").debug("Disconnected"),t(cF(e.payload))}})},fSe=()=>{Oe({actionCreator:bF,effect:(e,{dispatch:t,getState:n})=>{const r=ke("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored generator progress for canceled session");return}r.trace(e.payload,`Generator progress (${e.payload.data.node.type})`),t(SF(e.payload))}})},hSe=()=>{Oe({actionCreator:vF,effect:(e,{dispatch:t})=>{ke("socketio").debug(e.payload,"Session complete"),t(_F(e.payload))}})},$e="positive_conditioning",Be="negative_conditioning",Le="denoise_latents",it="latents_to_image",Kd="nsfw_checker",dp="invisible_watermark",Se="noise",dr="rand_int",bn="range_of_size",sn="iterate",an="main_model_loader",mS="onnx_model_loader",Lu="vae_loader",az="lora_loader",It="clip_skip",Vt="image_to_latents",Jn="resize_image",Ie="canvas_output",hn="inpaint_image",ko="inpaint_image_resize_up",ti="inpaint_image_resize_down",Nn="inpaint_infill",Ls="inpaint_infill_resize_down",_f="tomask",ut="mask_blur",Ds="mask_combine",Ni="mask_resize_up",er="mask_resize_down",wt="color_correct",j0="control_net_collect",qx="dynamic_prompt",yt="metadata_accumulator",nk="esrgan",We="sdxl_model_loader",Re="sdxl_denoise_latents",fp="sdxl_refiner_model_loader",G0="sdxl_refiner_positive_conditioning",H0="sdxl_refiner_negative_conditioning",va="sdxl_refiner_denoise_latents",lz="text_to_image_graph",v5="image_to_image_graph",uz="canvas_text_to_image_graph",_5="canvas_image_to_image_graph",cz="canvas_inpaint_graph",dz="canvas_outpaint_graph",fz="sdxl_text_to_image_graph",b5="sxdl_image_to_image_graph",IE="sdxl_canvas_text_to_image_graph",d_="sdxl_canvas_image_to_image_graph",ME="sdxl_canvas_inpaint_graph",NE="sdxl_canvas_outpaint_graph",pSe=["dataURL_image"],gSe=()=>{Oe({actionCreator:QT,effect:async(e,{dispatch:t,getState:n})=>{const r=ke("socketio"),{data:i}=e.payload;r.debug({data:Ya(i)},`Invocation complete (${e.payload.data.node.type})`);const o=e.payload.data.graph_execution_state_id,{cancelType:s,isCancelScheduled:a}=n().system;s==="scheduled"&&a&&t(Oc({session_id:o}));const{result:l,node:u,graph_execution_state_id:d}=i;if(nz(l)&&!pSe.includes(u.type)){const{image_name:f}=l.image,{canvas:h,gallery:g}=n(),m=await t(we.endpoints.getImageDTO.initiate(f)).unwrap();if(d===h.layerState.stagingArea.sessionId&&[Ie].includes(i.source_node_id)&&t(cce(m)),!m.is_intermediate){const{autoAddBoardId:v}=g;t(v&&v!=="none"?we.endpoints.addImageToBoard.initiate({board_id:v,imageDTO:m}):we.util.updateQueryData("listImages",{board_id:"none",categories:Jr},b=>{Cn.addOne(b,m)})),t(we.util.invalidateTags([{type:"BoardImagesTotal",id:v},{type:"BoardAssetsTotal",id:v}]));const{selectedBoardId:x,shouldAutoSwitch:_}=g;_&&(v&&v!==x?(t(W3(v)),t(G1("images"))):v||t(G1("images")),t(Gs(m)))}t(N1e(null))}t(mF(e.payload))}})},mSe=()=>{Oe({actionCreator:yF,effect:(e,{dispatch:t})=>{ke("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(ZT(e.payload))}})},ySe=()=>{Oe({actionCreator:EF,effect:(e,{dispatch:t})=>{ke("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(AF(e.payload))}})},vSe=()=>{Oe({actionCreator:pF,effect:(e,{dispatch:t,getState:n})=>{const r=ke("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored invocation started for canceled session");return}r.debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(gF(e.payload))}})},_Se=()=>{Oe({actionCreator:wF,effect:(e,{dispatch:t})=>{const n=ke("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load started: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(gfe(e.payload))}}),Oe({actionCreator:xF,effect:(e,{dispatch:t})=>{const n=ke("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load complete: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(mfe(e.payload))}})},bSe=()=>{Oe({actionCreator:CF,effect:(e,{dispatch:t})=>{ke("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(TF(e.payload))}})},SSe=()=>{Oe({actionCreator:YT,effect:(e,{dispatch:t})=>{ke("socketio").debug(e.payload,"Subscribed"),t(dF(e.payload))}})},wSe=()=>{Oe({actionCreator:fF,effect:(e,{dispatch:t})=>{ke("socketio").debug(e.payload,"Unsubscribed"),t(hF(e.payload))}})},xSe=()=>{Oe({actionCreator:j_e,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(we.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(we.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Yn({title:"Image Saved",status:"success"}))}catch(i){t(Yn({title:"Image Saving Failed",description:i==null?void 0:i.message,status:"error"}))}}})},CMe=["sd-1","sd-2","sdxl","sdxl-refiner"],CSe=["sd-1","sd-2","sdxl"],TMe=["sdxl-refiner"],TSe=()=>{Oe({actionCreator:b$,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const s=n(Aa.endpoints.getMainModels.initiate(CSe)),a=await s.unwrap();if(s.unsubscribe(),!a.ids.length){n(Nl(null));return}const u=p5.getSelectors().selectAll(a).filter(g=>["sd-1","sd-2","sxdl"].includes(g.base_model))[0];if(!u){n(Nl(null));return}const{base_model:d,model_name:f,model_type:h}=u;n(Nl({base_model:d,model_name:f,model_type:h}))}catch{n(Nl(null))}}}})},ESe=({image_name:e,esrganModelName:t})=>{const n={id:nk,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!1};return{id:"adhoc-esrgan-graph",nodes:{[nk]:n},edges:[]}},ASe=Me("upscale/upscaleRequested"),PSe=()=>{Oe({actionCreator:ASe,effect:async(e,{dispatch:t,getState:n,take:r})=>{const{image_name:i}=e.payload,{esrganModelName:o}=n().postprocessing,s=ESe({image_name:i,esrganModelName:o});t(jr({graph:s})),await r(jr.fulfilled.match),t(kc())}})},RSe=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},rk=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)});var LE={exports:{}},yS={},hz={},ft={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof Ze<"u"?Ze:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(ft);var kn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=ft;class n{constructor(S=[1,0,0,1,0,0]){this.dirty=!1,this.m=S&&S.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(S){S.m[0]=this.m[0],S.m[1]=this.m[1],S.m[2]=this.m[2],S.m[3]=this.m[3],S.m[4]=this.m[4],S.m[5]=this.m[5]}point(S){var C=this.m;return{x:C[0]*S.x+C[2]*S.y+C[4],y:C[1]*S.x+C[3]*S.y+C[5]}}translate(S,C){return this.m[4]+=this.m[0]*S+this.m[2]*C,this.m[5]+=this.m[1]*S+this.m[3]*C,this}scale(S,C){return this.m[0]*=S,this.m[1]*=S,this.m[2]*=C,this.m[3]*=C,this}rotate(S){var C=Math.cos(S),T=Math.sin(S),E=this.m[0]*C+this.m[2]*T,P=this.m[1]*C+this.m[3]*T,k=this.m[0]*-T+this.m[2]*C,O=this.m[1]*-T+this.m[3]*C;return this.m[0]=E,this.m[1]=P,this.m[2]=k,this.m[3]=O,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(S,C){var T=this.m[0]+this.m[2]*C,E=this.m[1]+this.m[3]*C,P=this.m[2]+this.m[0]*S,k=this.m[3]+this.m[1]*S;return this.m[0]=T,this.m[1]=E,this.m[2]=P,this.m[3]=k,this}multiply(S){var C=this.m[0]*S.m[0]+this.m[2]*S.m[1],T=this.m[1]*S.m[0]+this.m[3]*S.m[1],E=this.m[0]*S.m[2]+this.m[2]*S.m[3],P=this.m[1]*S.m[2]+this.m[3]*S.m[3],k=this.m[0]*S.m[4]+this.m[2]*S.m[5]+this.m[4],O=this.m[1]*S.m[4]+this.m[3]*S.m[5]+this.m[5];return this.m[0]=C,this.m[1]=T,this.m[2]=E,this.m[3]=P,this.m[4]=k,this.m[5]=O,this}invert(){var S=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),C=this.m[3]*S,T=-this.m[1]*S,E=-this.m[2]*S,P=this.m[0]*S,k=S*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),O=S*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=C,this.m[1]=T,this.m[2]=E,this.m[3]=P,this.m[4]=k,this.m[5]=O,this}getMatrix(){return this.m}decompose(){var S=this.m[0],C=this.m[1],T=this.m[2],E=this.m[3],P=this.m[4],k=this.m[5],O=S*E-C*T;let M={x:P,y:k,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(S!=0||C!=0){var V=Math.sqrt(S*S+C*C);M.rotation=C>0?Math.acos(S/V):-Math.acos(S/V),M.scaleX=V,M.scaleY=O/V,M.skewX=(S*T+C*E)/O,M.skewY=0}else if(T!=0||E!=0){var B=Math.sqrt(T*T+E*E);M.rotation=Math.PI/2-(E>0?Math.acos(-T/B):-Math.acos(T/B)),M.scaleX=O/B,M.scaleY=B,M.skewX=0,M.skewY=(S*T+C*E)/O}return M.rotation=e.Util._getRotation(M.rotation),M}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",s="[object Boolean]",a=Math.PI/180,l=180/Math.PI,u="#",d="",f="0",h="Konva warning: ",g="Konva error: ",m="rgb(",v={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},x=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,_=[];const b=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(y){setTimeout(y,60)};e.Util={_isElement(y){return!!(y&&y.nodeType==1)},_isFunction(y){return!!(y&&y.constructor&&y.call&&y.apply)},_isPlainObject(y){return!!y&&y.constructor===Object},_isArray(y){return Object.prototype.toString.call(y)===r},_isNumber(y){return Object.prototype.toString.call(y)===i&&!isNaN(y)&&isFinite(y)},_isString(y){return Object.prototype.toString.call(y)===o},_isBoolean(y){return Object.prototype.toString.call(y)===s},isObject(y){return y instanceof Object},isValidSelector(y){if(typeof y!="string")return!1;var S=y[0];return S==="#"||S==="."||S===S.toUpperCase()},_sign(y){return y===0||y>0?1:-1},requestAnimFrame(y){_.push(y),_.length===1&&b(function(){const S=_;_=[],S.forEach(function(C){C()})})},createCanvasElement(){var y=document.createElement("canvas");try{y.style=y.style||{}}catch{}return y},createImageElement(){return document.createElement("img")},_isInDocument(y){for(;y=y.parentNode;)if(y==document)return!0;return!1},_urlToImage(y,S){var C=e.Util.createImageElement();C.onload=function(){S(C)},C.src=y},_rgbToHex(y,S,C){return((1<<24)+(y<<16)+(S<<8)+C).toString(16).slice(1)},_hexToRgb(y){y=y.replace(u,d);var S=parseInt(y,16);return{r:S>>16&255,g:S>>8&255,b:S&255}},getRandomColor(){for(var y=(Math.random()*16777215<<0).toString(16);y.length<6;)y=f+y;return u+y},getRGB(y){var S;return y in v?(S=v[y],{r:S[0],g:S[1],b:S[2]}):y[0]===u?this._hexToRgb(y.substring(1)):y.substr(0,4)===m?(S=x.exec(y.replace(/ /g,"")),{r:parseInt(S[1],10),g:parseInt(S[2],10),b:parseInt(S[3],10)}):{r:0,g:0,b:0}},colorToRGBA(y){return y=y||"black",e.Util._namedColorToRBA(y)||e.Util._hex3ColorToRGBA(y)||e.Util._hex4ColorToRGBA(y)||e.Util._hex6ColorToRGBA(y)||e.Util._hex8ColorToRGBA(y)||e.Util._rgbColorToRGBA(y)||e.Util._rgbaColorToRGBA(y)||e.Util._hslColorToRGBA(y)},_namedColorToRBA(y){var S=v[y.toLowerCase()];return S?{r:S[0],g:S[1],b:S[2],a:1}:null},_rgbColorToRGBA(y){if(y.indexOf("rgb(")===0){y=y.match(/rgb\(([^)]+)\)/)[1];var S=y.split(/ *, */).map(Number);return{r:S[0],g:S[1],b:S[2],a:1}}},_rgbaColorToRGBA(y){if(y.indexOf("rgba(")===0){y=y.match(/rgba\(([^)]+)\)/)[1];var S=y.split(/ *, */).map((C,T)=>C.slice(-1)==="%"?T===3?parseInt(C)/100:parseInt(C)/100*255:Number(C));return{r:S[0],g:S[1],b:S[2],a:S[3]}}},_hex8ColorToRGBA(y){if(y[0]==="#"&&y.length===9)return{r:parseInt(y.slice(1,3),16),g:parseInt(y.slice(3,5),16),b:parseInt(y.slice(5,7),16),a:parseInt(y.slice(7,9),16)/255}},_hex6ColorToRGBA(y){if(y[0]==="#"&&y.length===7)return{r:parseInt(y.slice(1,3),16),g:parseInt(y.slice(3,5),16),b:parseInt(y.slice(5,7),16),a:1}},_hex4ColorToRGBA(y){if(y[0]==="#"&&y.length===5)return{r:parseInt(y[1]+y[1],16),g:parseInt(y[2]+y[2],16),b:parseInt(y[3]+y[3],16),a:parseInt(y[4]+y[4],16)/255}},_hex3ColorToRGBA(y){if(y[0]==="#"&&y.length===4)return{r:parseInt(y[1]+y[1],16),g:parseInt(y[2]+y[2],16),b:parseInt(y[3]+y[3],16),a:1}},_hslColorToRGBA(y){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(y)){const[S,...C]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(y),T=Number(C[0])/360,E=Number(C[1])/100,P=Number(C[2])/100;let k,O,M;if(E===0)return M=P*255,{r:Math.round(M),g:Math.round(M),b:Math.round(M),a:1};P<.5?k=P*(1+E):k=P+E-P*E;const V=2*P-k,B=[0,0,0];for(let A=0;A<3;A++)O=T+1/3*-(A-1),O<0&&O++,O>1&&O--,6*O<1?M=V+(k-V)*6*O:2*O<1?M=k:3*O<2?M=V+(k-V)*(2/3-O)*6:M=V,B[A]=M*255;return{r:Math.round(B[0]),g:Math.round(B[1]),b:Math.round(B[2]),a:1}}},haveIntersection(y,S){return!(S.x>y.x+y.width||S.x+S.widthy.y+y.height||S.y+S.height1?(k=C,O=T,M=(C-E)*(C-E)+(T-P)*(T-P)):(k=y+B*(C-y),O=S+B*(T-S),M=(k-E)*(k-E)+(O-P)*(O-P))}return[k,O,M]},_getProjectionToLine(y,S,C){var T=e.Util.cloneObject(y),E=Number.MAX_VALUE;return S.forEach(function(P,k){if(!(!C&&k===S.length-1)){var O=S[(k+1)%S.length],M=e.Util._getProjectionToSegment(P.x,P.y,O.x,O.y,y.x,y.y),V=M[0],B=M[1],A=M[2];AS.length){var k=S;S=y,y=k}for(T=0;T{S.width=0,S.height=0})},drawRoundedRectPath(y,S,C,T){let E=0,P=0,k=0,O=0;typeof T=="number"?E=P=k=O=Math.min(T,S/2,C/2):(E=Math.min(T[0]||0,S/2,C/2),P=Math.min(T[1]||0,S/2,C/2),O=Math.min(T[2]||0,S/2,C/2),k=Math.min(T[3]||0,S/2,C/2)),y.moveTo(E,0),y.lineTo(S-P,0),y.arc(S-P,P,P,Math.PI*3/2,0,!1),y.lineTo(S,C-O),y.arc(S-O,C-O,O,0,Math.PI/2,!1),y.lineTo(k,C),y.arc(k,C-k,k,Math.PI/2,Math.PI,!1),y.lineTo(0,E),y.arc(E,E,E,Math.PI,Math.PI*3/2,!1)}}})(kn);var wn={},dt={},De={};Object.defineProperty(De,"__esModule",{value:!0});De.getComponentValidator=De.getBooleanValidator=De.getNumberArrayValidator=De.getFunctionValidator=De.getStringOrGradientValidator=De.getStringValidator=De.getNumberOrAutoValidator=De.getNumberOrArrayOfNumbersValidator=De.getNumberValidator=De.alphaComponent=De.RGBComponent=void 0;const Qa=ft,Dn=kn;function Za(e){return Dn.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Dn.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function OSe(e){return e>255?255:e<0?0:Math.round(e)}De.RGBComponent=OSe;function kSe(e){return e>1?1:e<1e-4?1e-4:e}De.alphaComponent=kSe;function ISe(){if(Qa.Konva.isUnminified)return function(e,t){return Dn.Util._isNumber(e)||Dn.Util.warn(Za(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}De.getNumberValidator=ISe;function MSe(e){if(Qa.Konva.isUnminified)return function(t,n){let r=Dn.Util._isNumber(t),i=Dn.Util._isArray(t)&&t.length==e;return!r&&!i&&Dn.Util.warn(Za(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}De.getNumberOrArrayOfNumbersValidator=MSe;function NSe(){if(Qa.Konva.isUnminified)return function(e,t){var n=Dn.Util._isNumber(e),r=e==="auto";return n||r||Dn.Util.warn(Za(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}De.getNumberOrAutoValidator=NSe;function LSe(){if(Qa.Konva.isUnminified)return function(e,t){return Dn.Util._isString(e)||Dn.Util.warn(Za(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}De.getStringValidator=LSe;function DSe(){if(Qa.Konva.isUnminified)return function(e,t){const n=Dn.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Dn.Util.warn(Za(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}De.getStringOrGradientValidator=DSe;function $Se(){if(Qa.Konva.isUnminified)return function(e,t){return Dn.Util._isFunction(e)||Dn.Util.warn(Za(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}De.getFunctionValidator=$Se;function FSe(){if(Qa.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Dn.Util._isArray(e)?e.forEach(function(r){Dn.Util._isNumber(r)||Dn.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Dn.Util.warn(Za(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}De.getNumberArrayValidator=FSe;function BSe(){if(Qa.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||Dn.Util.warn(Za(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}De.getBooleanValidator=BSe;function USe(e){if(Qa.Konva.isUnminified)return function(t,n){return t==null||Dn.Util.isObject(t)||Dn.Util.warn(Za(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}De.getComponentValidator=USe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=kn,n=De;var r="get",i="set";e.Factory={addGetterSetter(o,s,a,l,u){e.Factory.addGetter(o,s,a),e.Factory.addSetter(o,s,l,u),e.Factory.addOverloadedGetterSetter(o,s)},addGetter(o,s,a){var l=r+t.Util._capitalize(s);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[s];return u===void 0?a:u}},addSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]||e.Factory.overWriteSetter(o,s,a,l)},overWriteSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]=function(d){return a&&d!==void 0&&d!==null&&(d=a.call(this,d,s)),this._setAttr(s,d),l&&l.call(this),this}},addComponentsGetterSetter(o,s,a,l,u){var d=a.length,f=t.Util._capitalize,h=r+f(s),g=i+f(s),m,v;o.prototype[h]=function(){var _={};for(m=0;m{this._setAttr(s+f(S),void 0)}),this._fireChangeEvent(s,b,_),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,s)},addOverloadedGetterSetter(o,s){var a=t.Util._capitalize(s),l=i+a,u=r+a;o.prototype[s]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,s,a,l){t.Util.error("Adding deprecated "+s);var u=r+t.Util._capitalize(s),d=s+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(d);var f=this.attrs[s];return f===void 0?a:f},e.Factory.addSetter(o,s,l,function(){t.Util.error(d)}),e.Factory.addOverloadedGetterSetter(o,s)},backCompat(o,s){t.Util.each(s,function(a,l){var u=o.prototype[l],d=r+t.Util._capitalize(a),f=i+t.Util._capitalize(a);function h(){u.apply(this,arguments),t.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[a]=h,o.prototype[d]=h,o.prototype[f]=h})},afterSetFilter(){this._filterUpToDate=!1}}})(dt);var ds={},Na={};Object.defineProperty(Na,"__esModule",{value:!0});Na.HitContext=Na.SceneContext=Na.Context=void 0;const pz=kn,zSe=ft;function VSe(e){var t=[],n=e.length,r=pz.Util,i,o;for(i=0;itypeof d=="number"?Math.floor(d):d)),o+=jSe+u.join(ik)+GSe)):(o+=a.property,t||(o+=XSe+a.val)),o+=qSe;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=QSe&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,s){this._context.arc(t,n,r,i,o,s)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,s){this._context.bezierCurveTo(t,n,r,i,o,s)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,s){return this._context.createRadialGradient(t,n,r,i,o,s)}drawImage(t,n,r,i,o,s,a,l,u){var d=arguments,f=this._context;d.length===3?f.drawImage(t,n,r):d.length===5?f.drawImage(t,n,r,i,o):d.length===9&&f.drawImage(t,n,r,i,o,s,a,l,u)}ellipse(t,n,r,i,o,s,a,l){this._context.ellipse(t,n,r,i,o,s,a,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,s){this._context.setTransform(t,n,r,i,o,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,s){this._context.transform(t,n,r,i,o,s)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=ok.length,r=this.setAttr,i,o,s=function(a){var l=t[a],u;t[a]=function(){return o=VSe(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:a,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,s)=>{const{node:a}=o,l=a.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(h=>h.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var d=a.dragDistance(),f=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(f{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:s}=o,a=s.getStage();if(r&&a.setPointersPositions(r),!a._changedPointerPositions.find(d=>d.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(bS);Object.defineProperty(wn,"__esModule",{value:!0});wn.Node=void 0;const bt=kn,Vm=dt,q0=ds,Du=ft,bo=bS,Hn=De;var Iv="absoluteOpacity",K0="allEventListeners",xa="absoluteTransform",sk="absoluteScale",$u="canvas",o2e="Change",s2e="children",a2e="konva",S5="listening",ak="mouseenter",lk="mouseleave",uk="set",ck="Shape",Mv=" ",dk="stage",_l="transform",l2e="Stage",w5="visible",u2e=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Mv);let c2e=1;class Ke{constructor(t){this._id=c2e++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===_l||t===xa)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===_l||t===xa,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(Mv);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get($u)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===xa&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has($u)){const{scene:t,filter:n,hit:r}=this._cache.get($u);bt.Util.releaseCanvas(t,n,r),this._cache.delete($u)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,d=n.drawBorder||!1,f=n.hitCanvasPixelRatio||1;if(!i||!o){bt.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,a-=u,l-=u;var h=new q0.SceneCanvas({pixelRatio:s,width:i,height:o}),g=new q0.SceneCanvas({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),m=new q0.HitCanvas({pixelRatio:f,width:i,height:o}),v=h.getContext(),x=m.getContext();return m.isCache=!0,h.isCache=!0,this._cache.delete($u),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(h.getContext()._context.imageSmoothingEnabled=!1,g.getContext()._context.imageSmoothingEnabled=!1),v.save(),x.save(),v.translate(-a,-l),x.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Iv),this._clearSelfAndDescendantCache(sk),this.drawScene(h,this),this.drawHit(m,this),this._isUnderCache=!1,v.restore(),x.restore(),d&&(v.save(),v.beginPath(),v.rect(0,0,i,o),v.closePath(),v.setAttr("strokeStyle","red"),v.setAttr("lineWidth",5),v.stroke(),v.restore()),this._cache.set($u,{scene:h,filter:g,hit:m,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has($u)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,s,a,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var d=l.point(u);i===void 0&&(i=s=d.x,o=a=d.y),i=Math.min(i,d.x),o=Math.min(o,d.y),s=Math.max(s,d.x),a=Math.max(a,d.y)}),{x:i,y:o,width:s-i,height:a-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),s,a,l,u;if(t){if(!this._filterUpToDate){var d=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/d,r.getHeight()/d),a=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==s2e&&(r=uk+bt.Util._capitalize(n),bt.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(S5,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(w5,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;bo.DD._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var o=!n&&!Du.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,s,a;function l(u){for(i=[],o=u.length,s=0;s0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==l2e&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(_l),this._clearSelfAndDescendantCache(xa)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new bt.Transform,s=this.offset();return o.m=i.slice(),o.translate(s.x,s.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(_l);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(_l),this._clearSelfAndDescendantCache(xa),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,s=0;s0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return bt.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return bt.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&bt.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Iv,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,s,a;t.attrs={};for(r in n)i=n[r],a=bt.Util.isObject(i)&&!bt.Util._isPlainObject(i)&&!bt.Util._isArray(i),!a&&(o=typeof this[r]=="function"&&this[r],delete n[r],s=o?o.call(this):null,n[r]=i,s!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),bt.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,bt.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Du.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,s,a;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;bo.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=bo.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&bo.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return bt.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return bt.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=Ke.prototype.getClassName.call(t),i=t.children,o,s,a;n&&(t.attrs.container=n),Du.Konva[r]||(bt.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Du.Konva[r];if(o=new l(t.attrs),i)for(s=i.length,a=0;a0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=Kx.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=Kx.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(a){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.hit;if(a){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=s&&a||l;const d=r===this;if(u){o.save();var f=this.getAbsoluteTransform(r),h=f.getMatrix();o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),o.beginPath();let x;if(l)x=l.call(this,o,this);else{var g=this.clipX(),m=this.clipY();o.rect(g,m,s,a)}o.clip.apply(o,x),h=f.copy().invert().getMatrix(),o.transform(h[0],h[1],h[2],h[3],h[4],h[5])}var v=!d&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";v&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(x){x[t](n,r)}),v&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,s,a,l,u={x:1/0,y:1/0,width:0,height:0},d=this;(n=this.children)===null||n===void 0||n.forEach(function(v){if(v.visible()){var x=v.getClientRect({relativeTo:d,skipShadow:t.skipShadow,skipStroke:t.skipStroke});x.width===0&&x.height===0||(o===void 0?(o=x.x,s=x.y,a=x.x+x.width,l=x.y+x.height):(o=Math.min(o,x.x),s=Math.min(s,x.y),a=Math.max(a,x.x+x.width),l=Math.max(l,x.y+x.height)))}});for(var f=this.find("Shape"),h=!1,g=0;gle.indexOf("pointer")>=0?"pointer":le.indexOf("touch")>=0?"touch":"mouse",Z=le=>{const W=q(le);if(W==="pointer")return i.Konva.pointerEventsEnabled&&G.pointer;if(W==="touch")return G.touch;if(W==="mouse")return G.mouse};function ee(le={}){return(le.clipFunc||le.clipWidth||le.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),le}const ie="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class se extends r.Container{constructor(W){super(ee(W)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{ee(this.attrs)}),this._checkVisibility()}_validateAdd(W){const ne=W.getType()==="Layer",fe=W.getType()==="FastLayer";ne||fe||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const W=this.visible()?"":"none";this.content.style.display=W}setContainer(W){if(typeof W===d){if(W.charAt(0)==="."){var ne=W.slice(1);W=document.getElementsByClassName(ne)[0]}else{var fe;W.charAt(0)!=="#"?fe=W:fe=W.slice(1),W=document.getElementById(fe)}if(!W)throw"Can not find container in document with id "+fe}return this._setAttr("container",W),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),W.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var W=this.children,ne=W.length,fe;for(fe=0;fe-1&&e.stages.splice(ne,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const W=this._pointerPositions[0]||this._changedPointerPositions[0];return W?{x:W.x,y:W.y}:(t.Util.warn(ie),null)}_getPointerById(W){return this._pointerPositions.find(ne=>ne.id===W)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(W){W=W||{},W.x=W.x||0,W.y=W.y||0,W.width=W.width||this.width(),W.height=W.height||this.height();var ne=new o.SceneCanvas({width:W.width,height:W.height,pixelRatio:W.pixelRatio||1}),fe=ne.getContext()._context,pe=this.children;return(W.x||W.y)&&fe.translate(-1*W.x,-1*W.y),pe.forEach(function(ve){if(ve.isVisible()){var ye=ve._toKonvaCanvas(W);fe.drawImage(ye._canvas,W.x,W.y,ye.getWidth()/ye.getPixelRatio(),ye.getHeight()/ye.getPixelRatio())}}),ne}getIntersection(W){if(!W)return null;var ne=this.children,fe=ne.length,pe=fe-1,ve;for(ve=pe;ve>=0;ve--){const ye=ne[ve].getIntersection(W);if(ye)return ye}return null}_resizeDOM(){var W=this.width(),ne=this.height();this.content&&(this.content.style.width=W+f,this.content.style.height=ne+f),this.bufferCanvas.setSize(W,ne),this.bufferHitCanvas.setSize(W,ne),this.children.forEach(fe=>{fe.setSize({width:W,height:ne}),fe.draw()})}add(W,...ne){if(arguments.length>1){for(var fe=0;fe$&&t.Util.warn("The stage has "+pe+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),W.setSize({width:this.width(),height:this.height()}),W.draw(),i.Konva.isBrowser&&this.content.appendChild(W.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(W){return l.hasPointerCapture(W,this)}setPointerCapture(W){l.setPointerCapture(W,this)}releaseCapture(W){l.releaseCapture(W,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&j.forEach(([W,ne])=>{this.content.addEventListener(W,fe=>{this[ne](fe)},{passive:!1})})}_pointerenter(W){this.setPointersPositions(W);const ne=Z(W.type);this._fire(ne.pointerenter,{evt:W,target:this,currentTarget:this})}_pointerover(W){this.setPointersPositions(W);const ne=Z(W.type);this._fire(ne.pointerover,{evt:W,target:this,currentTarget:this})}_getTargetShape(W){let ne=this[W+"targetShape"];return ne&&!ne.getStage()&&(ne=null),ne}_pointerleave(W){const ne=Z(W.type),fe=q(W.type);if(ne){this.setPointersPositions(W);var pe=this._getTargetShape(fe),ve=!s.DD.isDragging||i.Konva.hitOnDragEnabled;pe&&ve?(pe._fireAndBubble(ne.pointerout,{evt:W}),pe._fireAndBubble(ne.pointerleave,{evt:W}),this._fire(ne.pointerleave,{evt:W,target:this,currentTarget:this}),this[fe+"targetShape"]=null):ve&&(this._fire(ne.pointerleave,{evt:W,target:this,currentTarget:this}),this._fire(ne.pointerout,{evt:W,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(W){const ne=Z(W.type),fe=q(W.type);if(ne){this.setPointersPositions(W);var pe=!1;this._changedPointerPositions.forEach(ve=>{var ye=this.getIntersection(ve);if(s.DD.justDragged=!1,i.Konva["_"+fe+"ListenClick"]=!0,!(ye&&ye.isListening()))return;i.Konva.capturePointerEventsEnabled&&ye.setPointerCapture(ve.id),this[fe+"ClickStartShape"]=ye,ye._fireAndBubble(ne.pointerdown,{evt:W,pointerId:ve.id}),pe=!0;const Fe=W.type.indexOf("touch")>=0;ye.preventDefault()&&W.cancelable&&Fe&&W.preventDefault()}),pe||this._fire(ne.pointerdown,{evt:W,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(W){const ne=Z(W.type),fe=q(W.type);if(!ne)return;s.DD.isDragging&&s.DD.node.preventDefault()&&W.cancelable&&W.preventDefault(),this.setPointersPositions(W);var pe=!s.DD.isDragging||i.Konva.hitOnDragEnabled;if(!pe)return;var ve={};let ye=!1;var Je=this._getTargetShape(fe);this._changedPointerPositions.forEach(Fe=>{const Ae=l.getCapturedShape(Fe.id)||this.getIntersection(Fe),vt=Fe.id,_e={evt:W,pointerId:vt};var Qt=Je!==Ae;if(Qt&&Je&&(Je._fireAndBubble(ne.pointerout,Object.assign({},_e),Ae),Je._fireAndBubble(ne.pointerleave,Object.assign({},_e),Ae)),Ae){if(ve[Ae._id])return;ve[Ae._id]=!0}Ae&&Ae.isListening()?(ye=!0,Qt&&(Ae._fireAndBubble(ne.pointerover,Object.assign({},_e),Je),Ae._fireAndBubble(ne.pointerenter,Object.assign({},_e),Je),this[fe+"targetShape"]=Ae),Ae._fireAndBubble(ne.pointermove,Object.assign({},_e))):Je&&(this._fire(ne.pointerover,{evt:W,target:this,currentTarget:this,pointerId:vt}),this[fe+"targetShape"]=null)}),ye||this._fire(ne.pointermove,{evt:W,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(W){const ne=Z(W.type),fe=q(W.type);if(!ne)return;this.setPointersPositions(W);const pe=this[fe+"ClickStartShape"],ve=this[fe+"ClickEndShape"];var ye={};let Je=!1;this._changedPointerPositions.forEach(Fe=>{const Ae=l.getCapturedShape(Fe.id)||this.getIntersection(Fe);if(Ae){if(Ae.releaseCapture(Fe.id),ye[Ae._id])return;ye[Ae._id]=!0}const vt=Fe.id,_e={evt:W,pointerId:vt};let Qt=!1;i.Konva["_"+fe+"InDblClickWindow"]?(Qt=!0,clearTimeout(this[fe+"DblTimeout"])):s.DD.justDragged||(i.Konva["_"+fe+"InDblClickWindow"]=!0,clearTimeout(this[fe+"DblTimeout"])),this[fe+"DblTimeout"]=setTimeout(function(){i.Konva["_"+fe+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),Ae&&Ae.isListening()?(Je=!0,this[fe+"ClickEndShape"]=Ae,Ae._fireAndBubble(ne.pointerup,Object.assign({},_e)),i.Konva["_"+fe+"ListenClick"]&&pe&&pe===Ae&&(Ae._fireAndBubble(ne.pointerclick,Object.assign({},_e)),Qt&&ve&&ve===Ae&&Ae._fireAndBubble(ne.pointerdblclick,Object.assign({},_e)))):(this[fe+"ClickEndShape"]=null,i.Konva["_"+fe+"ListenClick"]&&this._fire(ne.pointerclick,{evt:W,target:this,currentTarget:this,pointerId:vt}),Qt&&this._fire(ne.pointerdblclick,{evt:W,target:this,currentTarget:this,pointerId:vt}))}),Je||this._fire(ne.pointerup,{evt:W,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+fe+"ListenClick"]=!1,W.cancelable&&fe!=="touch"&&W.preventDefault()}_contextmenu(W){this.setPointersPositions(W);var ne=this.getIntersection(this.getPointerPosition());ne&&ne.isListening()?ne._fireAndBubble(V,{evt:W}):this._fire(V,{evt:W,target:this,currentTarget:this})}_wheel(W){this.setPointersPositions(W);var ne=this.getIntersection(this.getPointerPosition());ne&&ne.isListening()?ne._fireAndBubble(U,{evt:W}):this._fire(U,{evt:W,target:this,currentTarget:this})}_pointercancel(W){this.setPointersPositions(W);const ne=l.getCapturedShape(W.pointerId)||this.getIntersection(this.getPointerPosition());ne&&ne._fireAndBubble(C,l.createEvent(W)),l.releaseCapture(W.pointerId)}_lostpointercapture(W){l.releaseCapture(W.pointerId)}setPointersPositions(W){var ne=this._getContentPosition(),fe=null,pe=null;W=W||window.event,W.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(W.touches,ve=>{this._pointerPositions.push({id:ve.identifier,x:(ve.clientX-ne.left)/ne.scaleX,y:(ve.clientY-ne.top)/ne.scaleY})}),Array.prototype.forEach.call(W.changedTouches||W.touches,ve=>{this._changedPointerPositions.push({id:ve.identifier,x:(ve.clientX-ne.left)/ne.scaleX,y:(ve.clientY-ne.top)/ne.scaleY})})):(fe=(W.clientX-ne.left)/ne.scaleX,pe=(W.clientY-ne.top)/ne.scaleY,this.pointerPos={x:fe,y:pe},this._pointerPositions=[{x:fe,y:pe,id:t.Util._getFirstPointerId(W)}],this._changedPointerPositions=[{x:fe,y:pe,id:t.Util._getFirstPointerId(W)}])}_setPointerPosition(W){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(W)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var W=this.content.getBoundingClientRect();return{top:W.top,left:W.left,scaleX:W.width/this.content.clientWidth||1,scaleY:W.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var W=this.container();if(!W)throw"Stage has no container. A container is required.";W.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),W.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(W){W.batchDraw()}),this}}e.Stage=se,se.prototype.nodeType=u,(0,a._registerNode)(se),n.Factory.addGetterSetter(se,"container")})(yz);var jm={},gr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=ft,n=kn,r=dt,i=wn,o=De,s=ft,a=Zi;var l="hasShadow",u="shadowRGBA",d="patternImage",f="linearGradient",h="radialGradient";let g;function m(){return g||(g=n.Util.createCanvasElement().getContext("2d"),g)}e.shapes={};function v(k){const O=this.attrs.fillRule;O?k.fill(O):k.fill()}function x(k){k.stroke()}function _(k){k.fill()}function b(k){k.stroke()}function y(){this._clearCache(l)}function S(){this._clearCache(u)}function C(){this._clearCache(d)}function T(){this._clearCache(f)}function E(){this._clearCache(h)}class P extends i.Node{constructor(O){super(O);let M;for(;M=n.Util.getRandomColor(),!(M&&!(M in e.shapes)););this.colorKey=M,e.shapes[M]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(d,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var O=m();const M=O.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(M&&M.setTransform){const V=new n.Transform;V.translate(this.fillPatternX(),this.fillPatternY()),V.rotate(t.Konva.getAngle(this.fillPatternRotation())),V.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),V.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const B=V.getMatrix(),A=typeof DOMMatrix>"u"?{a:B[0],b:B[1],c:B[2],d:B[3],e:B[4],f:B[5]}:new DOMMatrix(B);M.setTransform(A)}return M}}_getLinearGradient(){return this._getCache(f,this.__getLinearGradient)}__getLinearGradient(){var O=this.fillLinearGradientColorStops();if(O){for(var M=m(),V=this.fillLinearGradientStartPoint(),B=this.fillLinearGradientEndPoint(),A=M.createLinearGradient(V.x,V.y,B.x,B.y),N=0;Nthis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const O=this.hitStrokeWidth();return O==="auto"?this.hasStroke():this.strokeEnabled()&&!!O}intersects(O){var M=this.getStage(),V=M.bufferHitCanvas,B;return V.getContext().clear(),this.drawHit(V,null,!0),B=V.context.getImageData(Math.round(O.x),Math.round(O.y),1,1).data,B[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(O){var M;if(!this.getStage()||!((M=this.attrs.perfectDrawEnabled)!==null&&M!==void 0?M:!0))return!1;const B=O||this.hasFill(),A=this.hasStroke(),N=this.getAbsoluteOpacity()!==1;if(B&&A&&N)return!0;const D=this.hasShadow(),U=this.shadowForStrokeEnabled();return!!(B&&A&&D&&U)}setStrokeHitEnabled(O){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),O?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var O=this.size();return{x:this._centroid?-O.width/2:0,y:this._centroid?-O.height/2:0,width:O.width,height:O.height}}getClientRect(O={}){const M=O.skipTransform,V=O.relativeTo,B=this.getSelfRect(),N=!O.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,D=B.width+N,U=B.height+N,$=!O.skipShadow&&this.hasShadow(),j=$?this.shadowOffsetX():0,G=$?this.shadowOffsetY():0,q=D+Math.abs(j),Z=U+Math.abs(G),ee=$&&this.shadowBlur()||0,ie=q+ee*2,se=Z+ee*2,le={width:ie,height:se,x:-(N/2+ee)+Math.min(j,0)+B.x,y:-(N/2+ee)+Math.min(G,0)+B.y};return M?le:this._transformedRect(le,V)}drawScene(O,M){var V=this.getLayer(),B=O||V.getCanvas(),A=B.getContext(),N=this._getCanvasCache(),D=this.getSceneFunc(),U=this.hasShadow(),$,j,G,q=B.isCache,Z=M===this;if(!this.isVisible()&&!Z)return this;if(N){A.save();var ee=this.getAbsoluteTransform(M).getMatrix();return A.transform(ee[0],ee[1],ee[2],ee[3],ee[4],ee[5]),this._drawCachedSceneCanvas(A),A.restore(),this}if(!D)return this;if(A.save(),this._useBufferCanvas()&&!q){$=this.getStage(),j=$.bufferCanvas,G=j.getContext(),G.clear(),G.save(),G._applyLineJoin(this);var ie=this.getAbsoluteTransform(M).getMatrix();G.transform(ie[0],ie[1],ie[2],ie[3],ie[4],ie[5]),D.call(this,G,this),G.restore();var se=j.pixelRatio;U&&A._applyShadow(this),A._applyOpacity(this),A._applyGlobalCompositeOperation(this),A.drawImage(j._canvas,0,0,j.width/se,j.height/se)}else{if(A._applyLineJoin(this),!Z){var ie=this.getAbsoluteTransform(M).getMatrix();A.transform(ie[0],ie[1],ie[2],ie[3],ie[4],ie[5]),A._applyOpacity(this),A._applyGlobalCompositeOperation(this)}U&&A._applyShadow(this),D.call(this,A,this)}return A.restore(),this}drawHit(O,M,V=!1){if(!this.shouldDrawHit(M,V))return this;var B=this.getLayer(),A=O||B.hitCanvas,N=A&&A.getContext(),D=this.hitFunc()||this.sceneFunc(),U=this._getCanvasCache(),$=U&&U.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),$){N.save();var j=this.getAbsoluteTransform(M).getMatrix();return N.transform(j[0],j[1],j[2],j[3],j[4],j[5]),this._drawCachedHitCanvas(N),N.restore(),this}if(!D)return this;if(N.save(),N._applyLineJoin(this),!(this===M)){var q=this.getAbsoluteTransform(M).getMatrix();N.transform(q[0],q[1],q[2],q[3],q[4],q[5])}return D.call(this,N,this),N.restore(),this}drawHitFromCache(O=0){var M=this._getCanvasCache(),V=this._getCachedSceneCanvas(),B=M.hit,A=B.getContext(),N=B.getWidth(),D=B.getHeight(),U,$,j,G,q,Z;A.clear(),A.drawImage(V._canvas,0,0,N,D);try{for(U=A.getImageData(0,0,N,D),$=U.data,j=$.length,G=n.Util._hexToRgb(this.colorKey),q=0;qO?($[q]=G.r,$[q+1]=G.g,$[q+2]=G.b,$[q+3]=255):$[q+3]=0;A.putImageData(U,0,0)}catch(ee){n.Util.error("Unable to draw hit graph from cached scene canvas. "+ee.message)}return this}hasPointerCapture(O){return a.hasPointerCapture(O,this)}setPointerCapture(O){a.setPointerCapture(O,this)}releaseCapture(O){a.releaseCapture(O,this)}}e.Shape=P,P.prototype._fillFunc=v,P.prototype._strokeFunc=x,P.prototype._fillFuncHit=_,P.prototype._strokeFuncHit=b,P.prototype._centroid=!1,P.prototype.nodeType="Shape",(0,s._registerNode)(P),P.prototype.eventListeners={},P.prototype.on.call(P.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",y),P.prototype.on.call(P.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",S),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",C),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",T),P.prototype.on.call(P.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",E),r.Factory.addGetterSetter(P,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(P,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(P,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(P,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(P,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(P,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(P,"lineJoin"),r.Factory.addGetterSetter(P,"lineCap"),r.Factory.addGetterSetter(P,"sceneFunc"),r.Factory.addGetterSetter(P,"hitFunc"),r.Factory.addGetterSetter(P,"dash"),r.Factory.addGetterSetter(P,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(P,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(P,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(P,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"fillPatternImage"),r.Factory.addGetterSetter(P,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(P,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(P,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(P,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(P,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(P,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(P,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(P,"fillEnabled",!0),r.Factory.addGetterSetter(P,"strokeEnabled",!0),r.Factory.addGetterSetter(P,"shadowEnabled",!0),r.Factory.addGetterSetter(P,"dashEnabled",!0),r.Factory.addGetterSetter(P,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(P,"fillPriority","color"),r.Factory.addComponentsGetterSetter(P,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(P,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(P,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(P,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(P,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(P,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(P,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(P,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(P,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(P,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(P,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(P,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(P,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(P,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(P,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(P,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(P,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(P,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(P,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(P,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(P,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(P,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(P,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(P,"fillPatternRotation",0),r.Factory.addGetterSetter(P,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(P,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(gr);Object.defineProperty(jm,"__esModule",{value:!0});jm.Layer=void 0;const _a=kn,Xx=Ic,Td=wn,$E=dt,fk=ds,g2e=De,m2e=gr,y2e=ft;var v2e="#",_2e="beforeDraw",b2e="draw",bz=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],S2e=bz.length;class th extends Xx.Container{constructor(t){super(t),this.canvas=new fk.SceneCanvas,this.hitCanvas=new fk.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(_2e,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Xx.Container.prototype.drawScene.call(this,i,n),this._fire(b2e,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Xx.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){_a.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return _a.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return _a.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}jm.Layer=th;th.prototype.nodeType="Layer";(0,y2e._registerNode)(th);$E.Factory.addGetterSetter(th,"imageSmoothingEnabled",!0);$E.Factory.addGetterSetter(th,"clearBeforeDraw",!0);$E.Factory.addGetterSetter(th,"hitGraphEnabled",!0,(0,g2e.getBooleanValidator)());var wS={};Object.defineProperty(wS,"__esModule",{value:!0});wS.FastLayer=void 0;const w2e=kn,x2e=jm,C2e=ft;class FE extends x2e.Layer{constructor(t){super(t),this.listening(!1),w2e.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}wS.FastLayer=FE;FE.prototype.nodeType="FastLayer";(0,C2e._registerNode)(FE);var nh={};Object.defineProperty(nh,"__esModule",{value:!0});nh.Group=void 0;const T2e=kn,E2e=Ic,A2e=ft;class BE extends E2e.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&T2e.Util.throw("You may only add groups and shapes to groups.")}}nh.Group=BE;BE.prototype.nodeType="Group";(0,A2e._registerNode)(BE);var rh={};Object.defineProperty(rh,"__esModule",{value:!0});rh.Animation=void 0;const Yx=ft,hk=kn;var Qx=function(){return Yx.glob.performance&&Yx.glob.performance.now?function(){return Yx.glob.performance.now()}:function(){return new Date().getTime()}}();class $s{constructor(t,n){this.id=$s.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Qx(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():m<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=m,this.update())}getTime(){return this._time}setPosition(m){this.prevPos=this._pos,this.propFunc(m),this._pos=m}getPosition(m){return m===void 0&&(m=this._time),this.func(m,this.begin,this._change,this.duration)}play(){this.state=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(m){this.pause(),this._time=m,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var m=this.getTimer()-this._startTime;this.state===a?this.setTime(m):this.state===l&&this.setTime(this.duration-m)}pause(){this.state=s,this.fire("onPause")}getTimer(){return new Date().getTime()}}class h{constructor(m){var v=this,x=m.node,_=x._id,b,y=m.easing||e.Easings.Linear,S=!!m.yoyo,C;typeof m.duration>"u"?b=.3:m.duration===0?b=.001:b=m.duration,this.node=x,this._id=u++;var T=x.getLayer()||(x instanceof i.Konva.Stage?x.getLayers():null);T||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){v.tween.onEnterFrame()},T),this.tween=new f(C,function(E){v._tweenFunc(E)},y,0,1,b*1e3,S),this._addListeners(),h.attrs[_]||(h.attrs[_]={}),h.attrs[_][this._id]||(h.attrs[_][this._id]={}),h.tweens[_]||(h.tweens[_]={});for(C in m)o[C]===void 0&&this._addAttr(C,m[C]);this.reset(),this.onFinish=m.onFinish,this.onReset=m.onReset,this.onUpdate=m.onUpdate}_addAttr(m,v){var x=this.node,_=x._id,b,y,S,C,T,E,P,k;if(S=h.tweens[_][m],S&&delete h.attrs[_][S][m],b=x.getAttr(m),t.Util._isArray(v))if(y=[],T=Math.max(v.length,b.length),m==="points"&&v.length!==b.length&&(v.length>b.length?(P=b,b=t.Util._prepareArrayForTween(b,v,x.closed())):(E=v,v=t.Util._prepareArrayForTween(v,b,x.closed()))),m.indexOf("fill")===0)for(C=0;C{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var m=this.node,v=h.attrs[m._id][this._id];v.points&&v.points.trueEnd&&m.setAttr("points",v.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var m=this.node,v=h.attrs[m._id][this._id];v.points&&v.points.trueStart&&m.points(v.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(m){return this.tween.seek(m*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var m=this.node._id,v=this._id,x=h.tweens[m],_;this.pause();for(_ in x)delete h.tweens[m][_];delete h.attrs[m][v]}}e.Tween=h,h.attrs={},h.tweens={},r.Node.prototype.to=function(g){var m=g.onFinish;g.node=this,g.onFinish=function(){this.destroy(),m&&m()};var v=new h(g);v.play()},e.Easings={BackEaseIn(g,m,v,x){var _=1.70158;return v*(g/=x)*g*((_+1)*g-_)+m},BackEaseOut(g,m,v,x){var _=1.70158;return v*((g=g/x-1)*g*((_+1)*g+_)+1)+m},BackEaseInOut(g,m,v,x){var _=1.70158;return(g/=x/2)<1?v/2*(g*g*(((_*=1.525)+1)*g-_))+m:v/2*((g-=2)*g*(((_*=1.525)+1)*g+_)+2)+m},ElasticEaseIn(g,m,v,x,_,b){var y=0;return g===0?m:(g/=x)===1?m+v:(b||(b=x*.3),!_||_0?t:n),d=s*n,f=a*(a>0?t:n),h=l*(l>0?n:t);return{x:u,y:r?-1*h:f,width:d-u,height:h-f}}}xS.Arc=Ja;Ja.prototype._centroid=!0;Ja.prototype.className="Arc";Ja.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,R2e._registerNode)(Ja);CS.Factory.addGetterSetter(Ja,"innerRadius",0,(0,TS.getNumberValidator)());CS.Factory.addGetterSetter(Ja,"outerRadius",0,(0,TS.getNumberValidator)());CS.Factory.addGetterSetter(Ja,"angle",0,(0,TS.getNumberValidator)());CS.Factory.addGetterSetter(Ja,"clockwise",!1,(0,TS.getBooleanValidator)());var ES={},Gm={};Object.defineProperty(Gm,"__esModule",{value:!0});Gm.Line=void 0;const AS=dt,O2e=gr,wz=De,k2e=ft;function x5(e,t,n,r,i,o,s){var a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=s*a/(a+l),d=s*l/(a+l),f=n-u*(i-e),h=r-u*(o-t),g=n+d*(i-e),m=r+d*(o-t);return[f,h,g,m]}function gk(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(a=this.getTensionPoints(),l=a.length,u=o?0:4,o||t.quadraticCurveTo(a[0],a[1],a[2],a[3]);u{let u,d,f;u=l/2,d=0;for(let g=0;g<20;g++)f=u*e.tValues[20][g]+u,d+=e.cValues[20][g]*r(s,a,f);return u*d};e.getCubicArcLength=t;const n=(s,a,l)=>{l===void 0&&(l=1);const u=s[0]-2*s[1]+s[2],d=a[0]-2*a[1]+a[2],f=2*s[1]-2*s[0],h=2*a[1]-2*a[0],g=4*(u*u+d*d),m=4*(u*f+d*h),v=f*f+h*h;if(g===0)return l*Math.sqrt(Math.pow(s[2]-s[0],2)+Math.pow(a[2]-a[0],2));const x=m/(2*g),_=v/g,b=l+x,y=_-x*x,S=b*b+y>0?Math.sqrt(b*b+y):0,C=x*x+y>0?Math.sqrt(x*x+y):0,T=x+Math.sqrt(x*x+y)!==0?y*Math.log(Math.abs((b+S)/(x+C))):0;return Math.sqrt(g)/2*(b*S-x*C+T)};e.getQuadraticArcLength=n;function r(s,a,l){const u=i(1,l,s),d=i(1,l,a),f=u*u+d*d;return Math.sqrt(f)}const i=(s,a,l)=>{const u=l.length-1;let d,f;if(u===0)return 0;if(s===0){f=0;for(let h=0;h<=u;h++)f+=e.binomialCoefficients[u][h]*Math.pow(1-a,u-h)*Math.pow(a,h)*l[h];return f}else{d=new Array(u);for(let h=0;h{let u=1,d=s/a,f=(s-l(d))/a,h=0;for(;u>.001;){const g=l(d+f),m=Math.abs(s-g)/a;if(m500)break}return d};e.t2length=o})(xz);Object.defineProperty(ih,"__esModule",{value:!0});ih.Path=void 0;const I2e=dt,M2e=gr,N2e=ft,Ed=xz;class ur extends M2e.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ur.parsePathData(this.data()),this.pathLength=ur.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;id?u:d,x=u>d?1:u/d,_=u>d?d/u:1;t.translate(a,l),t.rotate(g),t.scale(x,_),t.arc(0,0,v,f,f+h,1-m),t.scale(1/x,1/_),t.rotate(-g),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var d=u.points[4],f=u.points[5],h=u.points[4]+f,g=Math.PI/180;if(Math.abs(d-h)h;m-=g){const v=ur.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],m,0);t.push(v.x,v.y)}else for(let m=d+g;mn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var s=n[i],a=s.points;switch(s.command){case"L":return ur.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return ur.getPointOnCubicBezier((0,Ed.t2length)(t,ur.getPathLength(n),v=>(0,Ed.getCubicArcLength)([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return ur.getPointOnQuadraticBezier((0,Ed.t2length)(t,ur.getPathLength(n),v=>(0,Ed.getQuadraticArcLength)([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":var l=a[0],u=a[1],d=a[2],f=a[3],h=a[4],g=a[5],m=a[6];return h+=g*t/s.pathLength,ur.getPointOnEllipticalArc(l,u,d,f,h,m)}return null}static getPointOnLine(t,n,r,i,o,s,a){s===void 0&&(s=n),a===void 0&&(a=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(m[0]);){var b=null,y=[],S=l,C=u,T,E,P,k,O,M,V,B,A,N;switch(g){case"l":l+=m.shift(),u+=m.shift(),b="L",y.push(l,u);break;case"L":l=m.shift(),u=m.shift(),y.push(l,u);break;case"m":var D=m.shift(),U=m.shift();if(l+=D,u+=U,b="M",s.length>2&&s[s.length-1].command==="z"){for(var $=s.length-2;$>=0;$--)if(s[$].command==="M"){l=s[$].points[0]+D,u=s[$].points[1]+U;break}}y.push(l,u),g="l";break;case"M":l=m.shift(),u=m.shift(),b="M",y.push(l,u),g="L";break;case"h":l+=m.shift(),b="L",y.push(l,u);break;case"H":l=m.shift(),b="L",y.push(l,u);break;case"v":u+=m.shift(),b="L",y.push(l,u);break;case"V":u=m.shift(),b="L",y.push(l,u);break;case"C":y.push(m.shift(),m.shift(),m.shift(),m.shift()),l=m.shift(),u=m.shift(),y.push(l,u);break;case"c":y.push(l+m.shift(),u+m.shift(),l+m.shift(),u+m.shift()),l+=m.shift(),u+=m.shift(),b="C",y.push(l,u);break;case"S":E=l,P=u,T=s[s.length-1],T.command==="C"&&(E=l+(l-T.points[2]),P=u+(u-T.points[3])),y.push(E,P,m.shift(),m.shift()),l=m.shift(),u=m.shift(),b="C",y.push(l,u);break;case"s":E=l,P=u,T=s[s.length-1],T.command==="C"&&(E=l+(l-T.points[2]),P=u+(u-T.points[3])),y.push(E,P,l+m.shift(),u+m.shift()),l+=m.shift(),u+=m.shift(),b="C",y.push(l,u);break;case"Q":y.push(m.shift(),m.shift()),l=m.shift(),u=m.shift(),y.push(l,u);break;case"q":y.push(l+m.shift(),u+m.shift()),l+=m.shift(),u+=m.shift(),b="Q",y.push(l,u);break;case"T":E=l,P=u,T=s[s.length-1],T.command==="Q"&&(E=l+(l-T.points[0]),P=u+(u-T.points[1])),l=m.shift(),u=m.shift(),b="Q",y.push(E,P,l,u);break;case"t":E=l,P=u,T=s[s.length-1],T.command==="Q"&&(E=l+(l-T.points[0]),P=u+(u-T.points[1])),l+=m.shift(),u+=m.shift(),b="Q",y.push(E,P,l,u);break;case"A":k=m.shift(),O=m.shift(),M=m.shift(),V=m.shift(),B=m.shift(),A=l,N=u,l=m.shift(),u=m.shift(),b="A",y=this.convertEndpointToCenterParameterization(A,N,l,u,V,B,k,O,M);break;case"a":k=m.shift(),O=m.shift(),M=m.shift(),V=m.shift(),B=m.shift(),A=l,N=u,l+=m.shift(),u+=m.shift(),b="A",y=this.convertEndpointToCenterParameterization(A,N,l,u,V,B,k,O,M);break}s.push({command:b||g,points:y,start:{x:S,y:C},pathLength:this.calcLength(S,C,b||g,y)})}(g==="z"||g==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(t,n,r,i){var o,s,a,l,u=ur;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,Ed.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,Ed.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var d=i[4],f=i[5],h=i[4]+f,g=Math.PI/180;if(Math.abs(d-h)h;l-=g)a=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=d+g;l1&&(a*=Math.sqrt(g),l*=Math.sqrt(g));var m=Math.sqrt((a*a*(l*l)-a*a*(h*h)-l*l*(f*f))/(a*a*(h*h)+l*l*(f*f)));o===s&&(m*=-1),isNaN(m)&&(m=0);var v=m*a*h/l,x=m*-l*f/a,_=(t+r)/2+Math.cos(d)*v-Math.sin(d)*x,b=(n+i)/2+Math.sin(d)*v+Math.cos(d)*x,y=function(O){return Math.sqrt(O[0]*O[0]+O[1]*O[1])},S=function(O,M){return(O[0]*M[0]+O[1]*M[1])/(y(O)*y(M))},C=function(O,M){return(O[0]*M[1]=1&&(k=0),s===0&&k>0&&(k=k-2*Math.PI),s===1&&k<0&&(k=k+2*Math.PI),[_,b,a,l,T,k,d,s]}}ih.Path=ur;ur.prototype.className="Path";ur.prototype._attrsAffectingSize=["data"];(0,N2e._registerNode)(ur);I2e.Factory.addGetterSetter(ur,"data");Object.defineProperty(ES,"__esModule",{value:!0});ES.Arrow=void 0;const PS=dt,L2e=Gm,Cz=De,D2e=ft,mk=ih;class Nc extends L2e.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var s=this.pointerLength(),a=r.length,l,u;if(o){const h=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[a-2],r[a-1]],g=mk.Path.calcLength(i[i.length-4],i[i.length-3],"C",h),m=mk.Path.getPointOnQuadraticBezier(Math.min(1,1-s/g),h[0],h[1],h[2],h[3],h[4],h[5]);l=r[a-2]-m.x,u=r[a-1]-m.y}else l=r[a-2]-r[a-4],u=r[a-1]-r[a-3];var d=(Math.atan2(u,l)+n)%n,f=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[a-2],r[a-1]),t.rotate(d),t.moveTo(0,0),t.lineTo(-s,f/2),t.lineTo(-s,-f/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-s,f/2),t.lineTo(-s,-f/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}ES.Arrow=Nc;Nc.prototype.className="Arrow";(0,D2e._registerNode)(Nc);PS.Factory.addGetterSetter(Nc,"pointerLength",10,(0,Cz.getNumberValidator)());PS.Factory.addGetterSetter(Nc,"pointerWidth",10,(0,Cz.getNumberValidator)());PS.Factory.addGetterSetter(Nc,"pointerAtBeginning",!1);PS.Factory.addGetterSetter(Nc,"pointerAtEnding",!0);var RS={};Object.defineProperty(RS,"__esModule",{value:!0});RS.Circle=void 0;const $2e=dt,F2e=gr,B2e=De,U2e=ft;let oh=class extends F2e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};RS.Circle=oh;oh.prototype._centroid=!0;oh.prototype.className="Circle";oh.prototype._attrsAffectingSize=["radius"];(0,U2e._registerNode)(oh);$2e.Factory.addGetterSetter(oh,"radius",0,(0,B2e.getNumberValidator)());var OS={};Object.defineProperty(OS,"__esModule",{value:!0});OS.Ellipse=void 0;const UE=dt,z2e=gr,Tz=De,V2e=ft;class vu extends z2e.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}OS.Ellipse=vu;vu.prototype.className="Ellipse";vu.prototype._centroid=!0;vu.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,V2e._registerNode)(vu);UE.Factory.addComponentsGetterSetter(vu,"radius",["x","y"]);UE.Factory.addGetterSetter(vu,"radiusX",0,(0,Tz.getNumberValidator)());UE.Factory.addGetterSetter(vu,"radiusY",0,(0,Tz.getNumberValidator)());var kS={};Object.defineProperty(kS,"__esModule",{value:!0});kS.Image=void 0;const Zx=kn,Lc=dt,j2e=gr,G2e=ft,Hm=De;let ta=class Ez extends j2e.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let s;if(o){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[o,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?Zx.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?Zx.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=Zx.Util.createImageElement();i.onload=function(){var o=new Ez({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};kS.Image=ta;ta.prototype.className="Image";(0,G2e._registerNode)(ta);Lc.Factory.addGetterSetter(ta,"cornerRadius",0,(0,Hm.getNumberOrArrayOfNumbersValidator)(4));Lc.Factory.addGetterSetter(ta,"image");Lc.Factory.addComponentsGetterSetter(ta,"crop",["x","y","width","height"]);Lc.Factory.addGetterSetter(ta,"cropX",0,(0,Hm.getNumberValidator)());Lc.Factory.addGetterSetter(ta,"cropY",0,(0,Hm.getNumberValidator)());Lc.Factory.addGetterSetter(ta,"cropWidth",0,(0,Hm.getNumberValidator)());Lc.Factory.addGetterSetter(ta,"cropHeight",0,(0,Hm.getNumberValidator)());var Vf={};Object.defineProperty(Vf,"__esModule",{value:!0});Vf.Tag=Vf.Label=void 0;const IS=dt,H2e=gr,W2e=nh,zE=De,Az=ft;var Pz=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],q2e="Change.konva",K2e="none",C5="up",T5="right",E5="down",A5="left",X2e=Pz.length;class VE extends W2e.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}NS.RegularPolygon=$c;$c.prototype.className="RegularPolygon";$c.prototype._centroid=!0;$c.prototype._attrsAffectingSize=["radius"];(0,nwe._registerNode)($c);Rz.Factory.addGetterSetter($c,"radius",0,(0,Oz.getNumberValidator)());Rz.Factory.addGetterSetter($c,"sides",0,(0,Oz.getNumberValidator)());var LS={};Object.defineProperty(LS,"__esModule",{value:!0});LS.Ring=void 0;const kz=dt,rwe=gr,Iz=De,iwe=ft;var yk=Math.PI*2;class Fc extends rwe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,yk,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),yk,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}LS.Ring=Fc;Fc.prototype.className="Ring";Fc.prototype._centroid=!0;Fc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,iwe._registerNode)(Fc);kz.Factory.addGetterSetter(Fc,"innerRadius",0,(0,Iz.getNumberValidator)());kz.Factory.addGetterSetter(Fc,"outerRadius",0,(0,Iz.getNumberValidator)());var DS={};Object.defineProperty(DS,"__esModule",{value:!0});DS.Sprite=void 0;const Bc=dt,owe=gr,swe=rh,Mz=De,awe=ft;class na extends owe.Shape{constructor(t){super(t),this._updated=!0,this.anim=new swe.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+0],l=o[i+1],u=o[i+2],d=o[i+3],f=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,d),t.closePath(),t.fillStrokeShape(this)),f)if(s){var h=s[n],g=r*2;t.drawImage(f,a,l,u,d,h[g+0],h[g+1],u,d)}else t.drawImage(f,a,l,u,d,0,0,u,d)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+2],l=o[i+3];if(t.beginPath(),s){var u=s[n],d=r*2;t.rect(u[d+0],u[d+1],a,l)}else t.rect(0,0,a,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Y0;function eC(){return Y0||(Y0=P5.Util.createCanvasElement().getContext(pwe),Y0)}function Twe(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Ewe(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Awe(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}class Wn extends cwe.Shape{constructor(t){super(Awe(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(_+=s)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=P5.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(gwe,n),this}getWidth(){var t=this.attrs.width===Ad||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Ad||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return P5.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=eC(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+X0+this.fontVariant()+X0+(this.fontSize()+_we)+Cwe(this.fontFamily())}_addTextLine(t){this.align()===hp&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return eC().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` `),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,s=this.attrs.height,a=o!==Ad&&o!==void 0,l=s!==Ad&&s!==void 0,u=this.padding(),d=o-u*2,f=s-u*2,h=0,g=this.wrap(),m=g!==bk,v=g!==wwe&&m,x=this.ellipsis();this.textArr=[],eC().font=this._getContextFont();for(var _=x?this._getTextWidth(Jx):0,b=0,y=t.length;bd)for(;S.length>0;){for(var T=0,E=S.length,P="",k=0;T>>1,M=S.slice(0,O+1),V=this._getTextWidth(M)+_;V<=d?(T=O+1,P=M,k=V):E=O}if(P){if(v){var B,A=S[P.length],N=A===X0||A===vk;N&&k<=d?B=P.length:B=Math.max(P.lastIndexOf(X0),P.lastIndexOf(vk))+1,B>0&&(T=B,P=P.slice(0,T),k=this._getTextWidth(P))}P=P.trimRight(),this._addTextLine(P),r=Math.max(r,k),h+=i;var D=this._shouldHandleEllipsis(h);if(D){this._tryToAddEllipsisToLastLine();break}if(S=S.slice(T),S=S.trimLeft(),S.length>0&&(C=this._getTextWidth(S),C<=d)){this._addTextLine(S),h+=i,r=Math.max(r,C);break}}else break}else this._addTextLine(S),h+=i,r=Math.max(r,C),this._shouldHandleEllipsis(h)&&bf)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Ad&&i!==void 0,s=this.padding(),a=i-s*2,l=this.wrap(),u=l!==bk;return!u||o&&t+r>a}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Ad&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!o)){if(n){var a=this._getTextWidth(s.text+Jx)n?null:pp.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=pp.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var s=0;s=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${Vz}`).join(" "),xk="nodesRect",Lwe=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Dwe={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const $we="ontouchstart"in Qo.Konva._global;function Fwe(e,t){if(e==="rotater")return"crosshair";t+=Xt.Util.degToRad(Dwe[e]||0);var n=(Xt.Util.radToDeg(t)%360+360)%360;return Xt.Util._inRange(n,315+22.5,360)||Xt.Util._inRange(n,0,22.5)?"ns-resize":Xt.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Xt.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Xt.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Xt.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Xt.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Xt.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Xt.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Xt.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var h_=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],Ck=1e8;function Bwe(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function jz(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function Uwe(e,t){const n=Bwe(e);return jz(e,t,n)}function zwe(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(Xt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},s=i._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");i.on(s,o),i.on(Lwe.map(a=>a+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,s=i.y-n.y;this.nodes().forEach(a=>{if(a===t||a.isDragging())return;const l=a.getAbsolutePosition();a.setAbsolutePosition({x:l.x+o,y:l.y+s}),a.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(xk),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(xk,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),s=t.getAbsolutePosition(r),a=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(Qo.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),d={x:s.x+a*Math.cos(u)+l*Math.sin(-u),y:s.y+l*Math.cos(u)+a*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return jz(d,-Qo.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-Ck,y:-Ck,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const d=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var f=[{x:d.x,y:d.y},{x:d.x+d.width,y:d.y},{x:d.x+d.width,y:d.y+d.height},{x:d.x,y:d.y+d.height}],h=u.getAbsoluteTransform();f.forEach(function(g){var m=h.point(g);n.push(m)})});const r=new Xt.Transform;r.rotate(-Qo.Konva.getAngle(this.rotation()));var i,o,s,a;n.forEach(function(u){var d=r.point(u);i===void 0&&(i=s=d.x,o=a=d.y),i=Math.min(i,d.x),o=Math.min(o,d.y),s=Math.max(s,d.x),a=Math.max(a,d.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:s-i,height:a-o,rotation:Qo.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),h_.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new Iwe.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:$we?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=Qo.Konva.getAngle(this.rotation()),o=Fwe(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new kwe.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*Xt.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var s=t.target.getAbsolutePosition(),a=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-s.x,y:a.y-s.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),s=o.getStage();s.setPointersPositions(t);const a=s.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const d=o.getAbsolutePosition();if(!(u.x===d.x&&u.y===d.y)){if(this._movingAnchorName==="rotater"){var f=this._getNodeRect();n=o.x()-f.width/2,r=-o.y()+f.height/2;let B=Math.atan2(-r,n)+Math.PI/2;f.height<0&&(B-=Math.PI);var h=Qo.Konva.getAngle(this.rotation());const A=h+B,N=Qo.Konva.getAngle(this.rotationSnapTolerance()),U=zwe(this.rotationSnaps(),A,N)-f.rotation,$=Uwe(f,U);this._fitNodesInto($,t);return}var g=this.shiftBehavior(),m;g==="inverted"?m=this.keepRatio()&&!t.shiftKey:g==="none"?m=this.keepRatio():m=this.keepRatio()||t.shiftKey;var y=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(m){var v=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(v.x-o.x(),2)+Math.pow(v.y-o.y(),2));var x=this.findOne(".top-left").x()>v.x?-1:1,_=this.findOne(".top-left").y()>v.y?-1:1;n=i*this.cos*x,r=i*this.sin*_,this.findOne(".top-left").x(v.x-n),this.findOne(".top-left").y(v.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(m){var v=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-v.x,2)+Math.pow(v.y-o.y(),2));var x=this.findOne(".top-right").x()v.y?-1:1;n=i*this.cos*x,r=i*this.sin*_,this.findOne(".top-right").x(v.x+n),this.findOne(".top-right").y(v.y-r)}var b=o.position();this.findOne(".top-left").y(b.y),this.findOne(".bottom-right").x(b.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(m){var v=y?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(v.x-o.x(),2)+Math.pow(o.y()-v.y,2));var x=v.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(Xt.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(Xt.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var s=new Xt.Transform;if(s.rotate(Qo.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const f=s.point({x:-this.padding()*2,y:0});if(t.x+=f.x,t.y+=f.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const f=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const f=s.point({x:0,y:-this.padding()*2});if(t.x+=f.x,t.y+=f.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const f=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const f=this.boundBoxFunc()(r,t);f?t=f:Xt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,l=new Xt.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/a,r.height/a);const u=new Xt.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/a,t.height/a);const d=u.multiply(l.invert());this._nodes.forEach(f=>{var h;const g=f.getParent().getAbsoluteTransform(),m=f.getTransform().copy();m.translate(f.offsetX(),f.offsetY());const v=new Xt.Transform;v.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(m);const x=v.decompose();f.setAttrs(x),this._fire("transform",{evt:n,target:f}),f._fire("transform",{evt:n,target:f}),(h=f.getLayer())===null||h===void 0||h.batchDraw()}),this.rotation(Xt.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(Xt.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),s=this.resizeEnabled(),a=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(f=>{f.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+a,offsetY:l/2+a,visible:s&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+a,visible:s&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:s&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+a,visible:s&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-a,visible:s&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-a,visible:s&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Xt.Util._sign(i)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const d=this.anchorStyleFunc();d&&u.forEach(f=>{d(f)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),wk.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Sk.Node.prototype.toObject.call(this)}clone(t){var n=Sk.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}BS.Transformer=Mt;function Vwe(e){return e instanceof Array||Xt.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){h_.indexOf(t)===-1&&Xt.Util.warn("Unknown anchor name: "+t+". Available names are: "+h_.join(", "))}),e||[]}Mt.prototype.className="Transformer";(0,Mwe._registerNode)(Mt);Wt.Factory.addGetterSetter(Mt,"enabledAnchors",h_,Vwe);Wt.Factory.addGetterSetter(Mt,"flipEnabled",!0,(0,Su.getBooleanValidator)());Wt.Factory.addGetterSetter(Mt,"resizeEnabled",!0);Wt.Factory.addGetterSetter(Mt,"anchorSize",10,(0,Su.getNumberValidator)());Wt.Factory.addGetterSetter(Mt,"rotateEnabled",!0);Wt.Factory.addGetterSetter(Mt,"rotationSnaps",[]);Wt.Factory.addGetterSetter(Mt,"rotateAnchorOffset",50,(0,Su.getNumberValidator)());Wt.Factory.addGetterSetter(Mt,"rotationSnapTolerance",5,(0,Su.getNumberValidator)());Wt.Factory.addGetterSetter(Mt,"borderEnabled",!0);Wt.Factory.addGetterSetter(Mt,"anchorStroke","rgb(0, 161, 255)");Wt.Factory.addGetterSetter(Mt,"anchorStrokeWidth",1,(0,Su.getNumberValidator)());Wt.Factory.addGetterSetter(Mt,"anchorFill","white");Wt.Factory.addGetterSetter(Mt,"anchorCornerRadius",0,(0,Su.getNumberValidator)());Wt.Factory.addGetterSetter(Mt,"borderStroke","rgb(0, 161, 255)");Wt.Factory.addGetterSetter(Mt,"borderStrokeWidth",1,(0,Su.getNumberValidator)());Wt.Factory.addGetterSetter(Mt,"borderDash");Wt.Factory.addGetterSetter(Mt,"keepRatio",!0);Wt.Factory.addGetterSetter(Mt,"shiftBehavior","default");Wt.Factory.addGetterSetter(Mt,"centeredScaling",!1);Wt.Factory.addGetterSetter(Mt,"ignoreStroke",!1);Wt.Factory.addGetterSetter(Mt,"padding",0,(0,Su.getNumberValidator)());Wt.Factory.addGetterSetter(Mt,"node");Wt.Factory.addGetterSetter(Mt,"nodes");Wt.Factory.addGetterSetter(Mt,"boundBoxFunc");Wt.Factory.addGetterSetter(Mt,"anchorDragBoundFunc");Wt.Factory.addGetterSetter(Mt,"anchorStyleFunc");Wt.Factory.addGetterSetter(Mt,"shouldOverdrawWholeArea",!1);Wt.Factory.addGetterSetter(Mt,"useSingleNodeRotation",!0);Wt.Factory.backCompat(Mt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var US={};Object.defineProperty(US,"__esModule",{value:!0});US.Wedge=void 0;const zS=dt,jwe=gr,Gwe=ft,Gz=De,Hwe=ft;class el extends jwe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,Gwe.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}US.Wedge=el;el.prototype.className="Wedge";el.prototype._centroid=!0;el.prototype._attrsAffectingSize=["radius"];(0,Hwe._registerNode)(el);zS.Factory.addGetterSetter(el,"radius",0,(0,Gz.getNumberValidator)());zS.Factory.addGetterSetter(el,"angle",0,(0,Gz.getNumberValidator)());zS.Factory.addGetterSetter(el,"clockwise",!1);zS.Factory.backCompat(el,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var VS={};Object.defineProperty(VS,"__esModule",{value:!0});VS.Blur=void 0;const Tk=dt,Wwe=wn,qwe=De;function Ek(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var Kwe=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Xwe=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Ywe(e,t){var n=e.data,r=e.width,i=e.height,o,s,a,l,u,d,f,h,g,m,v,x,_,b,y,S,C,T,E,P,k,O,M,V,B=t+t+1,A=r-1,N=i-1,D=t+1,U=D*(D+1)/2,$=new Ek,j=null,G=$,q=null,Z=null,ee=Kwe[t],ie=Xwe[t];for(a=1;a>ie,M!==0?(M=255/M,n[d]=(h*ee>>ie)*M,n[d+1]=(g*ee>>ie)*M,n[d+2]=(m*ee>>ie)*M):n[d]=n[d+1]=n[d+2]=0,h-=x,g-=_,m-=b,v-=y,x-=q.r,_-=q.g,b-=q.b,y-=q.a,l=f+((l=o+t+1)>ie,M>0?(M=255/M,n[l]=(h*ee>>ie)*M,n[l+1]=(g*ee>>ie)*M,n[l+2]=(m*ee>>ie)*M):n[l]=n[l+1]=n[l+2]=0,h-=x,g-=_,m-=b,v-=y,x-=q.r,_-=q.g,b-=q.b,y-=q.a,l=o+((l=s+D)0&&Ywe(t,n)};VS.Blur=Qwe;Tk.Factory.addGetterSetter(Wwe.Node,"blurRadius",0,(0,qwe.getNumberValidator)(),Tk.Factory.afterSetFilter);var jS={};Object.defineProperty(jS,"__esModule",{value:!0});jS.Brighten=void 0;const Ak=dt,Zwe=wn,Jwe=De,exe=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,s=s<0?0:s>255?255:s,n[a]=i,n[a+1]=o,n[a+2]=s};GS.Contrast=rxe;Pk.Factory.addGetterSetter(txe.Node,"contrast",0,(0,nxe.getNumberValidator)(),Pk.Factory.afterSetFilter);var HS={};Object.defineProperty(HS,"__esModule",{value:!0});HS.Emboss=void 0;const su=dt,WS=wn,ixe=kn,Hz=De,oxe=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,s=0,a=e.data,l=e.width,u=e.height,d=l*4,f=u;switch(r){case"top-left":o=-1,s=-1;break;case"top":o=-1,s=0;break;case"top-right":o=-1,s=1;break;case"right":o=0,s=1;break;case"bottom-right":o=1,s=1;break;case"bottom":o=1,s=0;break;case"bottom-left":o=1,s=-1;break;case"left":o=0,s=-1;break;default:ixe.Util.error("Unknown emboss direction: "+r)}do{var h=(f-1)*d,g=o;f+g<1&&(g=0),f+g>u&&(g=0);var m=(f-1+g)*l*4,v=l;do{var x=h+(v-1)*4,_=s;v+_<1&&(_=0),v+_>l&&(_=0);var b=m+(v-1+_)*4,y=a[x]-a[b],S=a[x+1]-a[b+1],C=a[x+2]-a[b+2],T=y,E=T>0?T:-T,P=S>0?S:-S,k=C>0?C:-C;if(P>E&&(T=S),k>E&&(T=C),T*=t,i){var O=a[x]+T,M=a[x+1]+T,V=a[x+2]+T;a[x]=O>255?255:O<0?0:O,a[x+1]=M>255?255:M<0?0:M,a[x+2]=V>255?255:V<0?0:V}else{var B=n-T;B<0?B=0:B>255&&(B=255),a[x]=a[x+1]=a[x+2]=B}}while(--v)}while(--f)};HS.Emboss=oxe;su.Factory.addGetterSetter(WS.Node,"embossStrength",.5,(0,Hz.getNumberValidator)(),su.Factory.afterSetFilter);su.Factory.addGetterSetter(WS.Node,"embossWhiteLevel",.5,(0,Hz.getNumberValidator)(),su.Factory.afterSetFilter);su.Factory.addGetterSetter(WS.Node,"embossDirection","top-left",null,su.Factory.afterSetFilter);su.Factory.addGetterSetter(WS.Node,"embossBlend",!1,null,su.Factory.afterSetFilter);var qS={};Object.defineProperty(qS,"__esModule",{value:!0});qS.Enhance=void 0;const Rk=dt,sxe=wn,axe=De;function rC(e,t,n,r,i){var o=n-t,s=i-r,a;return o===0?r+s/2:s===0?r:(a=(e-t)/o,a=s*a+r,a)}const lxe=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,s=t[1],a=s,l,u=t[2],d=u,f,h,g=this.enhance();if(g!==0){for(h=0;hi&&(i=o),l=t[h+1],la&&(a=l),f=t[h+2],fd&&(d=f);i===r&&(i=255,r=0),a===s&&(a=255,s=0),d===u&&(d=255,u=0);var m,v,x,_,b,y,S,C,T;for(g>0?(v=i+g*(255-i),x=r-g*(r-0),b=a+g*(255-a),y=s-g*(s-0),C=d+g*(255-d),T=u-g*(u-0)):(m=(i+r)*.5,v=i+g*(i-m),x=r+g*(r-m),_=(a+s)*.5,b=a+g*(a-_),y=s+g*(s-_),S=(d+u)*.5,C=d+g*(d-S),T=u+g*(u-S)),h=0;h_?x:_;var b=s,y=o,S,C,T=360/y*Math.PI/180,E,P;for(C=0;Cy?b:y;var S=s,C=o,T,E,P=n.polarRotation||0,k,O;for(d=0;dt&&(S=y,C=0,T=-1),i=0;i=0&&g=0&&m=0&&g=0&&m=255*4?255:0}return s}function xxe(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),s=[],a=0;a=0&&g=0&&m=n))for(o=v;o=r||(s=(n*o+i)*4,a+=S[s+0],l+=S[s+1],u+=S[s+2],d+=S[s+3],y+=1);for(a=a/y,l=l/y,u=u/y,d=d/y,i=g;i=n))for(o=v;o=r||(s=(n*o+i)*4,S[s+0]=a,S[s+1]=l,S[s+2]=u,S[s+3]=d)}};t2.Pixelate=kxe;Mk.Factory.addGetterSetter(Rxe.Node,"pixelSize",8,(0,Oxe.getNumberValidator)(),Mk.Factory.afterSetFilter);var n2={};Object.defineProperty(n2,"__esModule",{value:!0});n2.Posterize=void 0;const Nk=dt,Ixe=wn,Mxe=De,Nxe=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});g_.Factory.addGetterSetter(XE.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});g_.Factory.addGetterSetter(XE.Node,"blue",0,Lxe.RGBComponent,g_.Factory.afterSetFilter);var i2={};Object.defineProperty(i2,"__esModule",{value:!0});i2.RGBA=void 0;const Qg=dt,o2=wn,$xe=De,Fxe=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),s=this.alpha(),a,l;for(a=0;a255?255:e<0?0:Math.round(e)});Qg.Factory.addGetterSetter(o2.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});Qg.Factory.addGetterSetter(o2.Node,"blue",0,$xe.RGBComponent,Qg.Factory.afterSetFilter);Qg.Factory.addGetterSetter(o2.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var s2={};Object.defineProperty(s2,"__esModule",{value:!0});s2.Sepia=void 0;const Bxe=function(e){var t=e.data,n=t.length,r,i,o,s;for(r=0;r127&&(u=255-u),d>127&&(d=255-d),f>127&&(f=255-f),t[l]=u,t[l+1]=d,t[l+2]=f}while(--a)}while(--o)};a2.Solarize=Uxe;var l2={};Object.defineProperty(l2,"__esModule",{value:!0});l2.Threshold=void 0;const Lk=dt,zxe=wn,Vxe=De,jxe=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),s=new mp.Stage({container:o,width:r,height:i}),a=new mp.Layer,l=new mp.Layer;return a.add(new mp.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new mp.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),s.add(a),s.add(l),o.remove(),s},RCe=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const s=o.getContext("2d"),a=new Image;if(!s){o.remove(),i("Unable to get context");return}a.onload=function(){s.drawImage(a,0,0),o.remove(),r(s.getImageData(0,0,t,n))},a.src=e}),Fk=async(e,t)=>{const n=e.toDataURL(t);return await RCe(n,t.width,t.height)},OCe=async(e,t,n,r,i)=>{const o=ke("canvas"),s=gS(),a=G_e();if(!s||!a){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=s.clone();u.scale({x:1,y:1});const d=u.getAbsolutePosition(),f={x:l.x+d.x,y:l.y+d.y,width:l.width,height:l.height},h=await c_(u,f),g=await Fk(u,f),m=await PCe(r?e.objects.filter(w$):[],l,i),v=await c_(m,l),x=await Fk(m,l);return{baseBlob:h,baseImageData:g,maskBlob:v,maskImageData:x}},kCe=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=kCe(e.data),i=ICe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},NCe=e=>XD(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),Fo=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=NCe(i),s=t.nodes[yt];if(r&&o.length&&o.length){const a={id:j0,type:"collect",is_intermediate:!0};t.nodes[j0]=a,t.edges.push({source:{node_id:j0,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:d,processedControlImage:f,beginStepPct:h,endStepPct:g,controlMode:m,resizeMode:v,model:x,processorType:_,weight:b}=l,y={id:`control_net_${u}`,type:"controlnet",is_intermediate:!0,begin_step_percent:h,end_step_percent:g,control_mode:m,resize_mode:v,control_model:x,control_weight:b};if(f&&_!=="none")y.image={image_name:f};else if(d)y.image={image_name:d};else return;if(t.nodes[y.id]=y,s){const S=mb(y,["id","type"]);s.controlnets.push(S)}t.edges.push({source:{node_id:y.id,field:"control"},destination:{node_id:j0,field:"item"}})})}},wu=(e,t)=>{const{positivePrompt:n,iterations:r,seed:i,shouldRandomizeSeed:o}=e.generation,{combinatorial:s,isEnabled:a,maxPrompts:l}=e.dynamicPrompts,u=t.nodes[yt];if(a){xle(t.nodes[$e],"prompt");const d={id:qx,type:"dynamic_prompt",is_intermediate:!0,max_prompts:s?l:r,combinatorial:s,prompt:n},f={id:sn,type:"iterate",is_intermediate:!0};if(t.nodes[qx]=d,t.nodes[sn]=f,t.edges.push({source:{node_id:qx,field:"prompt_collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:$e,field:"prompt"}}),u&&t.edges.push({source:{node_id:sn,field:"item"},destination:{node_id:yt,field:"positive_prompt"}}),o){const h={id:dr,type:"rand_int",is_intermediate:!0};t.nodes[dr]=h,t.edges.push({source:{node_id:dr,field:"a"},destination:{node_id:Se,field:"seed"}}),u&&t.edges.push({source:{node_id:dr,field:"a"},destination:{node_id:yt,field:"seed"}})}else t.nodes[Se].seed=i,u&&(u.seed=i)}else{u&&(u.positive_prompt=n);const d={id:bn,type:"range_of_size",is_intermediate:!0,size:r,step:1},f={id:sn,type:"iterate",is_intermediate:!0};if(t.nodes[sn]=f,t.nodes[bn]=d,t.edges.push({source:{node_id:bn,field:"collection"},destination:{node_id:sn,field:"collection"}}),t.edges.push({source:{node_id:sn,field:"item"},destination:{node_id:Se,field:"seed"}}),u&&t.edges.push({source:{node_id:sn,field:"item"},destination:{node_id:yt,field:"seed"}}),o){const h={id:dr,type:"rand_int",is_intermediate:!0};t.nodes[dr]=h,t.edges.push({source:{node_id:dr,field:"a"},destination:{node_id:bn,field:"start"}})}else d.start=i}},sh=(e,t,n,r=an)=>{const{loras:i}=e.lora,o=DT(i),s=t.nodes[yt];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===It&&["clip"].includes(u.source.field))));let a="",l=0;gc(i,u=>{const{model_name:d,base_model:f,weight:h}=u,g=`${az}_${d.replace(".","_")}`,m={type:"lora_loader",id:g,is_intermediate:!0,lora:{model_name:d,base_model:f},weight:h};s&&s.loras.push({lora:{model_name:d,base_model:f},weight:h}),t.nodes[g]=m,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:g,field:"unet"}}),t.edges.push({source:{node_id:It,field:"clip"},destination:{node_id:g,field:"clip"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:g,field:"unet"}}),t.edges.push({source:{node_id:a,field:"clip"},destination:{node_id:g,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:g,field:"unet"},destination:{node_id:n,field:"unet"}}),t.edges.push({source:{node_id:g,field:"clip"},destination:{node_id:$e,field:"clip"}}),t.edges.push({source:{node_id:g,field:"clip"},destination:{node_id:Be,field:"clip"}})),a=g,l+=1})},Kz=mi(e=>e.ui,e=>y$[e.activeTab],{memoizeOptions:{equalityCheck:gb}}),PMe=mi(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:gb}}),RMe=mi(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:gb}}),Bo=(e,t,n=it)=>{const i=Kz(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],s=t.nodes[yt];if(!o)return;o.is_intermediate=!0;const a={id:Kd,type:"img_nsfw",is_intermediate:i};t.nodes[Kd]=a,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Kd,field:"image"}}),s&&t.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:Kd,field:"metadata"}})},Uo=(e,t,n=an)=>{const{vae:r}=e.generation,i=!r,o=t.nodes[yt];i||(t.nodes[Lu]={type:"vae_loader",id:Lu,is_intermediate:!0,vae_model:r});const s=n==mS;(t.id===lz||t.id===v5||t.id===fz||t.id===b5)&&t.edges.push({source:{node_id:i?n:Lu,field:i&&s?"vae_decoder":"vae"},destination:{node_id:it,field:"vae"}}),(t.id===uz||t.id===_5||t.id===IE||t.id==d_)&&t.edges.push({source:{node_id:i?n:Lu,field:i&&s?"vae_decoder":"vae"},destination:{node_id:Ie,field:"vae"}}),(t.id===v5||t.id===b5||t.id===_5||t.id===d_)&&t.edges.push({source:{node_id:i?n:Lu,field:i&&s?"vae_decoder":"vae"},destination:{node_id:Vt,field:"vae"}}),(t.id===cz||t.id===dz||t.id===ME||t.id===NE)&&t.edges.push({source:{node_id:i?n:Lu,field:i&&s?"vae_decoder":"vae"},destination:{node_id:hn,field:"vae"}},{source:{node_id:i?n:Lu,field:i&&s?"vae_decoder":"vae"},destination:{node_id:it,field:"vae"}}),r&&o&&(o.vae=r)},zo=(e,t,n=it)=>{const i=Kz(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],s=t.nodes[Kd],a=t.nodes[yt];if(!o)return;const l={id:dp,type:"img_watermark",is_intermediate:i};t.nodes[dp]=l,o.is_intermediate=!0,s?(s.is_intermediate=!0,t.edges.push({source:{node_id:Kd,field:"image"},destination:{node_id:dp,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:dp,field:"image"}}),a&&t.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:dp,field:"metadata"}})},LCe=(e,t)=>{const n=ke("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:s,scheduler:a,steps:l,img2imgStrength:u,clipSkip:d,shouldUseCpuNoise:f,shouldUseNoiseSettings:h}=e.generation,{width:g,height:m}=e.canvas.boundingBoxDimensions,{shouldAutoSave:v}=e.canvas;if(!o)throw n.error("No model found in state"),new Error("No model found in state");const x=h?f:ys.shouldUseCpuNoise,_={id:_5,nodes:{[an]:{type:"main_model_loader",id:an,is_intermediate:!0,model:o},[It]:{type:"clip_skip",id:It,is_intermediate:!0,skipped_layers:d},[$e]:{type:"compel",id:$e,is_intermediate:!0,prompt:r},[Be]:{type:"compel",id:Be,is_intermediate:!0,prompt:i},[Se]:{type:"noise",id:Se,is_intermediate:!0,use_cpu:x},[Vt]:{type:"i2l",id:Vt,is_intermediate:!0},[Le]:{type:"denoise_latents",id:Le,is_intermediate:!0,cfg_scale:s,scheduler:a,steps:l,denoising_start:1-u,denoising_end:1},[Ie]:{type:"l2i",id:Ie,is_intermediate:!v}},edges:[{source:{node_id:an,field:"unet"},destination:{node_id:Le,field:"unet"}},{source:{node_id:an,field:"clip"},destination:{node_id:It,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Le,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Le,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Le,field:"noise"}},{source:{node_id:Vt,field:"latents"},destination:{node_id:Le,field:"latents"}},{source:{node_id:Le,field:"latents"},destination:{node_id:Ie,field:"latents"}}]};if(t.width!==g||t.height!==m){const b={id:Jn,type:"img_resize",image:{image_name:t.image_name},is_intermediate:!0,width:g,height:m};_.nodes[Jn]=b,_.edges.push({source:{node_id:Jn,field:"image"},destination:{node_id:Vt,field:"image"}}),_.edges.push({source:{node_id:Jn,field:"width"},destination:{node_id:Se,field:"width"}}),_.edges.push({source:{node_id:Jn,field:"height"},destination:{node_id:Se,field:"height"}})}else _.nodes[Vt].image={image_name:t.image_name},_.edges.push({source:{node_id:Vt,field:"width"},destination:{node_id:Se,field:"width"}}),_.edges.push({source:{node_id:Vt,field:"height"},destination:{node_id:Se,field:"height"}});return _.nodes[yt]={id:yt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:s,height:m,width:g,positive_prompt:"",negative_prompt:i,model:o,seed:0,steps:l,rand_device:x?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],clip_skip:d,strength:u,init_image:t.image_name},_.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:Ie,field:"metadata"}}),sh(e,_,Le),Uo(e,_,an),wu(e,_),Fo(e,_,Le),e.system.shouldUseNSFWChecker&&Bo(e,_,Ie),e.system.shouldUseWatermarker&&zo(e,_,Ie),_},DCe=(e,t,n)=>{const r=ke("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,img2imgStrength:d,iterations:f,seed:h,shouldRandomizeSeed:g,vaePrecision:m,shouldUseNoiseSettings:v,shouldUseCpuNoise:x,maskBlur:_,maskBlurMethod:b,clipSkip:y}=e.generation;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:S,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:E,shouldAutoSave:P}=e.canvas,k=x,O={id:cz,nodes:{[an]:{type:"main_model_loader",id:an,is_intermediate:!0,model:s},[It]:{type:"clip_skip",id:It,is_intermediate:!0,skipped_layers:y},[$e]:{type:"compel",id:$e,is_intermediate:!0,prompt:i},[Be]:{type:"compel",id:Be,is_intermediate:!0,prompt:o},[ut]:{type:"img_blur",id:ut,is_intermediate:!0,radius:_,blur_type:b},[hn]:{type:"i2l",id:hn,is_intermediate:!0,fp32:m==="fp32"},[Se]:{type:"noise",id:Se,use_cpu:k,is_intermediate:!0},[Le]:{type:"denoise_latents",id:Le,is_intermediate:!0,steps:u,cfg_scale:a,scheduler:l,denoising_start:1-d,denoising_end:1},[it]:{type:"l2i",id:it,is_intermediate:!0,fp32:m==="fp32"},[wt]:{type:"color_correct",id:wt,is_intermediate:!0,reference:t},[Ie]:{type:"img_paste",id:Ie,is_intermediate:!P,base_image:t},[bn]:{type:"range_of_size",id:bn,is_intermediate:!0,size:f,step:1},[sn]:{type:"iterate",id:sn,is_intermediate:!0}},edges:[{source:{node_id:an,field:"unet"},destination:{node_id:Le,field:"unet"}},{source:{node_id:an,field:"clip"},destination:{node_id:It,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Le,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Le,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Le,field:"noise"}},{source:{node_id:hn,field:"latents"},destination:{node_id:Le,field:"latents"}},{source:{node_id:ut,field:"image"},destination:{node_id:Le,field:"mask"}},{source:{node_id:bn,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Se,field:"seed"}},{source:{node_id:Le,field:"latents"},destination:{node_id:it,field:"latents"}}]};if(["auto","manual"].includes(E)){const M=T.width,V=T.height;O.nodes[ko]={type:"img_resize",id:ko,is_intermediate:!0,width:M,height:V,image:t},O.nodes[Ni]={type:"img_resize",id:Ni,is_intermediate:!0,width:M,height:V,image:n},O.nodes[ti]={type:"img_resize",id:ti,is_intermediate:!0,width:S,height:C},O.nodes[er]={type:"img_resize",id:er,is_intermediate:!0,width:S,height:C},O.nodes[Se]={...O.nodes[Se],width:M,height:V},O.edges.push({source:{node_id:ko,field:"image"},destination:{node_id:hn,field:"image"}},{source:{node_id:Ni,field:"image"},destination:{node_id:ut,field:"image"}},{source:{node_id:it,field:"image"},destination:{node_id:ti,field:"image"}},{source:{node_id:ti,field:"image"},destination:{node_id:wt,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:er,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:wt,field:"mask"}},{source:{node_id:wt,field:"image"},destination:{node_id:Ie,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:Ie,field:"mask"}})}else O.nodes[Se]={...O.nodes[Se],width:S,height:C},O.nodes[hn]={...O.nodes[hn],image:t},O.nodes[ut]={...O.nodes[ut],image:n},O.edges.push({source:{node_id:it,field:"image"},destination:{node_id:wt,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:wt,field:"mask"}},{source:{node_id:wt,field:"image"},destination:{node_id:Ie,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:Ie,field:"mask"}});if(g){const M={id:dr,type:"rand_int"};O.nodes[dr]=M,O.edges.push({source:{node_id:dr,field:"a"},destination:{node_id:bn,field:"start"}})}else O.nodes[bn].start=h;return Uo(e,O,an),sh(e,O,Le,an),Fo(e,O,Le),e.system.shouldUseNSFWChecker&&Bo(e,O,Ie),e.system.shouldUseWatermarker&&zo(e,O,Ie),O},$Ce=(e,t,n)=>{const r=ke("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,img2imgStrength:d,iterations:f,seed:h,shouldRandomizeSeed:g,vaePrecision:m,shouldUseNoiseSettings:v,shouldUseCpuNoise:x,maskBlur:_,maskBlurMethod:b,tileSize:y,infillMethod:S,clipSkip:C}=e.generation;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:T,height:E}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:P,boundingBoxScaleMethod:k,shouldAutoSave:O}=e.canvas,M=x,V={id:dz,nodes:{[an]:{type:"main_model_loader",id:an,is_intermediate:!0,model:s},[It]:{type:"clip_skip",id:It,is_intermediate:!0,skipped_layers:C},[$e]:{type:"compel",id:$e,is_intermediate:!0,prompt:i},[Be]:{type:"compel",id:Be,is_intermediate:!0,prompt:o},[_f]:{type:"tomask",id:_f,is_intermediate:!0,image:t},[Ds]:{type:"mask_combine",id:Ds,is_intermediate:!0,mask2:n},[ut]:{type:"img_blur",id:ut,is_intermediate:!0,radius:_,blur_type:b},[Nn]:{type:"infill_tile",id:Nn,is_intermediate:!0,tile_size:y},[hn]:{type:"i2l",id:hn,is_intermediate:!0,fp32:m==="fp32"},[Se]:{type:"noise",id:Se,use_cpu:M,is_intermediate:!0},[Le]:{type:"denoise_latents",id:Le,is_intermediate:!0,steps:u,cfg_scale:a,scheduler:l,denoising_start:1-d,denoising_end:1},[it]:{type:"l2i",id:it,is_intermediate:!0,fp32:m==="fp32"},[wt]:{type:"color_correct",id:wt,is_intermediate:!0},[Ie]:{type:"img_paste",id:Ie,is_intermediate:!O},[bn]:{type:"range_of_size",id:bn,is_intermediate:!0,size:f,step:1},[sn]:{type:"iterate",id:sn,is_intermediate:!0}},edges:[{source:{node_id:an,field:"unet"},destination:{node_id:Le,field:"unet"}},{source:{node_id:an,field:"clip"},destination:{node_id:It,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Nn,field:"image"},destination:{node_id:hn,field:"image"}},{source:{node_id:_f,field:"mask"},destination:{node_id:Ds,field:"mask1"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Le,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Le,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Le,field:"noise"}},{source:{node_id:hn,field:"latents"},destination:{node_id:Le,field:"latents"}},{source:{node_id:ut,field:"image"},destination:{node_id:Le,field:"mask"}},{source:{node_id:bn,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Se,field:"seed"}},{source:{node_id:Le,field:"latents"},destination:{node_id:it,field:"latents"}}]};if(S==="patchmatch"&&(V.nodes[Nn]={type:"infill_patchmatch",id:Nn,is_intermediate:!0}),["auto","manual"].includes(k)){const B=P.width,A=P.height;V.nodes[ko]={type:"img_resize",id:ko,is_intermediate:!0,width:B,height:A,image:t},V.nodes[Ni]={type:"img_resize",id:Ni,is_intermediate:!0,width:B,height:A},V.nodes[ti]={type:"img_resize",id:ti,is_intermediate:!0,width:T,height:E},V.nodes[Ls]={type:"img_resize",id:Ls,is_intermediate:!0,width:T,height:E},V.nodes[er]={type:"img_resize",id:er,is_intermediate:!0,width:T,height:E},V.nodes[Se]={...V.nodes[Se],width:B,height:A},V.edges.push({source:{node_id:ko,field:"image"},destination:{node_id:Nn,field:"image"}},{source:{node_id:Ds,field:"image"},destination:{node_id:Ni,field:"image"}},{source:{node_id:Ni,field:"image"},destination:{node_id:ut,field:"image"}},{source:{node_id:it,field:"image"},destination:{node_id:ti,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:er,field:"image"}},{source:{node_id:Nn,field:"image"},destination:{node_id:Ls,field:"image"}},{source:{node_id:Ls,field:"image"},destination:{node_id:wt,field:"reference"}},{source:{node_id:ti,field:"image"},destination:{node_id:wt,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:wt,field:"mask"}},{source:{node_id:Ls,field:"image"},destination:{node_id:Ie,field:"base_image"}},{source:{node_id:wt,field:"image"},destination:{node_id:Ie,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:Ie,field:"mask"}})}else V.nodes[Nn]={...V.nodes[Nn],image:t},V.nodes[Se]={...V.nodes[Se],width:T,height:E},V.nodes[hn]={...V.nodes[hn],image:t},V.nodes[ut]={...V.nodes[ut],image:n},V.edges.push({source:{node_id:Ds,field:"image"},destination:{node_id:ut,field:"image"}},{source:{node_id:Nn,field:"image"},destination:{node_id:wt,field:"reference"}},{source:{node_id:it,field:"image"},destination:{node_id:wt,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:wt,field:"mask"}},{source:{node_id:Nn,field:"image"},destination:{node_id:Ie,field:"base_image"}},{source:{node_id:wt,field:"image"},destination:{node_id:Ie,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:Ie,field:"mask"}});if(g){const B={id:dr,type:"rand_int"};V.nodes[dr]=B,V.edges.push({source:{node_id:dr,field:"a"},destination:{node_id:bn,field:"start"}})}else V.nodes[bn].start=h;return Uo(e,V,an),sh(e,V,Le,an),Fo(e,V,Le),e.system.shouldUseNSFWChecker&&Bo(e,V,Ie),e.system.shouldUseWatermarker&&zo(e,V,Ie),V},ah=(e,t,n,r=We)=>{const{loras:i}=e.lora,o=DT(i),s=t.nodes[yt];o>0&&(t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))&&!(u.source.node_id===r&&["clip"].includes(u.source.field))&&!(u.source.node_id===r&&["clip2"].includes(u.source.field))));let a="",l=0;gc(i,u=>{const{model_name:d,base_model:f,weight:h}=u,g=`${az}_${d.replace(".","_")}`,m={type:"sdxl_lora_loader",id:g,is_intermediate:!0,lora:{model_name:d,base_model:f},weight:h};s&&s.loras.push({lora:{model_name:d,base_model:f},weight:h}),t.nodes[g]=m,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:g,field:"unet"}}),t.edges.push({source:{node_id:r,field:"clip"},destination:{node_id:g,field:"clip"}}),t.edges.push({source:{node_id:r,field:"clip2"},destination:{node_id:g,field:"clip2"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:g,field:"unet"}}),t.edges.push({source:{node_id:a,field:"clip"},destination:{node_id:g,field:"clip"}}),t.edges.push({source:{node_id:a,field:"clip2"},destination:{node_id:g,field:"clip2"}})),l===o-1&&(t.edges.push({source:{node_id:g,field:"unet"},destination:{node_id:n,field:"unet"}}),t.edges.push({source:{node_id:g,field:"clip"},destination:{node_id:$e,field:"clip"}}),t.edges.push({source:{node_id:g,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:g,field:"clip2"},destination:{node_id:$e,field:"clip2"}}),t.edges.push({source:{node_id:g,field:"clip2"},destination:{node_id:Be,field:"clip2"}})),a=g,l+=1})},Uc=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o}=e.sdxl;let s=i,a=o;return t&&(i.length>0?s=`${n} ${i}`:s=n,o.length>0?a=`${r} ${o}`:a=r),{craftedPositiveStylePrompt:s,craftedNegativeStylePrompt:a}},lh=(e,t,n)=>{const{refinerModel:r,refinerPositiveAestheticScore:i,refinerNegativeAestheticScore:o,refinerSteps:s,refinerScheduler:a,refinerCFGScale:l,refinerStart:u}=e.sdxl;if(!r)return;const d=t.nodes[yt];d&&(d.refiner_model=r,d.refiner_positive_aesthetic_score=i,d.refiner_negative_aesthetic_score=o,d.refiner_cfg_scale=l,d.refiner_scheduler=a,d.refiner_start=u,d.refiner_steps=s);const{craftedPositiveStylePrompt:f,craftedNegativeStylePrompt:h}=Uc(e,!0);t.edges=t.edges.filter(g=>!(g.source.node_id===n&&["latents"].includes(g.source.field))),t.edges=t.edges.filter(g=>!(g.source.node_id===We&&["vae"].includes(g.source.field))),t.nodes[fp]={type:"sdxl_refiner_model_loader",id:fp,model:r},t.nodes[G0]={type:"sdxl_refiner_compel_prompt",id:G0,style:f,aesthetic_score:i},t.nodes[H0]={type:"sdxl_refiner_compel_prompt",id:H0,style:h,aesthetic_score:o},t.nodes[va]={type:"denoise_latents",id:va,cfg_scale:l,steps:s,scheduler:a,denoising_start:u,denoising_end:1},t.edges.push({source:{node_id:fp,field:"unet"},destination:{node_id:va,field:"unet"}},{source:{node_id:fp,field:"clip2"},destination:{node_id:G0,field:"clip2"}},{source:{node_id:fp,field:"clip2"},destination:{node_id:H0,field:"clip2"}},{source:{node_id:G0,field:"conditioning"},destination:{node_id:va,field:"positive_conditioning"}},{source:{node_id:H0,field:"conditioning"},destination:{node_id:va,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:va,field:"latents"}}),t.id===IE||t.id===d_?t.edges.push({source:{node_id:va,field:"latents"},destination:{node_id:Ie,field:"latents"}}):t.edges.push({source:{node_id:va,field:"latents"},destination:{node_id:it,field:"latents"}}),(t.id===ME||t.id===NE)&&t.edges.push({source:{node_id:ut,field:"image"},destination:{node_id:va,field:"mask"}})},FCe=(e,t)=>{const n=ke("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:s,scheduler:a,steps:l,vaePrecision:u,clipSkip:d,shouldUseCpuNoise:f,shouldUseNoiseSettings:h}=e.generation,{shouldUseSDXLRefiner:g,refinerStart:m,sdxlImg2ImgDenoisingStrength:v,shouldConcatSDXLStylePrompt:x}=e.sdxl,{width:_,height:b}=e.canvas.boundingBoxDimensions,{shouldAutoSave:y}=e.canvas;if(!o)throw n.error("No model found in state"),new Error("No model found in state");const S=h?f:ys.shouldUseCpuNoise,{craftedPositiveStylePrompt:C,craftedNegativeStylePrompt:T}=Uc(e,x),E={id:d_,nodes:{[We]:{type:"sdxl_model_loader",id:We,model:o},[$e]:{type:"sdxl_compel_prompt",id:$e,prompt:r,style:C},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:i,style:T},[Se]:{type:"noise",id:Se,is_intermediate:!0,use_cpu:S},[Vt]:{type:"i2l",id:Vt,is_intermediate:!0,fp32:u==="fp32"},[Re]:{type:"denoise_latents",id:Re,is_intermediate:!0,cfg_scale:s,scheduler:a,steps:l,denoising_start:g?Math.min(m,1-v):1-v,denoising_end:g?m:1},[Ie]:{type:"l2i",id:Ie,is_intermediate:!y,fp32:u==="fp32"}},edges:[{source:{node_id:We,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:We,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:$e,field:"clip2"}},{source:{node_id:We,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:Vt,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:Re,field:"latents"},destination:{node_id:Ie,field:"latents"}}]};if(t.width!==_||t.height!==b){const P={id:Jn,type:"img_resize",image:{image_name:t.image_name},is_intermediate:!0,width:_,height:b};E.nodes[Jn]=P,E.edges.push({source:{node_id:Jn,field:"image"},destination:{node_id:Vt,field:"image"}}),E.edges.push({source:{node_id:Jn,field:"width"},destination:{node_id:Se,field:"width"}}),E.edges.push({source:{node_id:Jn,field:"height"},destination:{node_id:Se,field:"height"}})}else E.nodes[Vt].image={image_name:t.image_name},E.edges.push({source:{node_id:Vt,field:"width"},destination:{node_id:Se,field:"width"}}),E.edges.push({source:{node_id:Vt,field:"height"},destination:{node_id:Se,field:"height"}});return E.nodes[yt]={id:yt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:s,height:b,width:_,positive_prompt:"",negative_prompt:i,model:o,seed:0,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],clip_skip:d,strength:v,init_image:t.image_name},E.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:Ie,field:"metadata"}}),ah(e,E,Re,We),g&&lh(e,E,Re),Uo(e,E,We),wu(e,E),Fo(e,E,Re),e.system.shouldUseNSFWChecker&&Bo(e,E,Ie),e.system.shouldUseWatermarker&&zo(e,E,Ie),E},BCe=(e,t,n)=>{const r=ke("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,iterations:d,seed:f,shouldRandomizeSeed:h,vaePrecision:g,shouldUseNoiseSettings:m,shouldUseCpuNoise:v,maskBlur:x,maskBlurMethod:_}=e.generation,{sdxlImg2ImgDenoisingStrength:b,shouldUseSDXLRefiner:y,refinerStart:S,shouldConcatSDXLStylePrompt:C}=e.sdxl;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:T,height:E}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:P,boundingBoxScaleMethod:k,shouldAutoSave:O}=e.canvas,M=v,{craftedPositiveStylePrompt:V,craftedNegativeStylePrompt:B}=Uc(e,C),A={id:ME,nodes:{[We]:{type:"sdxl_model_loader",id:We,model:s},[$e]:{type:"sdxl_compel_prompt",id:$e,prompt:i,style:V},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:o,style:B},[ut]:{type:"img_blur",id:ut,is_intermediate:!0,radius:x,blur_type:_},[hn]:{type:"i2l",id:hn,is_intermediate:!0,fp32:g==="fp32"},[Se]:{type:"noise",id:Se,use_cpu:M,is_intermediate:!0},[Re]:{type:"denoise_latents",id:Re,is_intermediate:!0,steps:u,cfg_scale:a,scheduler:l,denoising_start:y?Math.min(S,1-b):1-b,denoising_end:y?S:1},[it]:{type:"l2i",id:it,is_intermediate:!0,fp32:g==="fp32"},[wt]:{type:"color_correct",id:wt,is_intermediate:!0,reference:t},[Ie]:{type:"img_paste",id:Ie,is_intermediate:!O,base_image:t},[bn]:{type:"range_of_size",id:bn,is_intermediate:!0,size:d,step:1},[sn]:{type:"iterate",id:sn,is_intermediate:!0}},edges:[{source:{node_id:We,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:We,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:$e,field:"clip2"}},{source:{node_id:We,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:hn,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:ut,field:"image"},destination:{node_id:Re,field:"mask"}},{source:{node_id:bn,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Se,field:"seed"}},{source:{node_id:Re,field:"latents"},destination:{node_id:it,field:"latents"}}]};if(["auto","manual"].includes(k)){const N=P.width,D=P.height;A.nodes[ko]={type:"img_resize",id:ko,is_intermediate:!0,width:N,height:D,image:t},A.nodes[Ni]={type:"img_resize",id:Ni,is_intermediate:!0,width:N,height:D,image:n},A.nodes[ti]={type:"img_resize",id:ti,is_intermediate:!0,width:T,height:E},A.nodes[er]={type:"img_resize",id:er,is_intermediate:!0,width:T,height:E},A.nodes[Se]={...A.nodes[Se],width:N,height:D},A.edges.push({source:{node_id:ko,field:"image"},destination:{node_id:hn,field:"image"}},{source:{node_id:Ni,field:"image"},destination:{node_id:ut,field:"image"}},{source:{node_id:it,field:"image"},destination:{node_id:ti,field:"image"}},{source:{node_id:ti,field:"image"},destination:{node_id:wt,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:er,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:wt,field:"mask"}},{source:{node_id:wt,field:"image"},destination:{node_id:Ie,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:Ie,field:"mask"}})}else A.nodes[Se]={...A.nodes[Se],width:T,height:E},A.nodes[hn]={...A.nodes[hn],image:t},A.nodes[ut]={...A.nodes[ut],image:n},A.edges.push({source:{node_id:it,field:"image"},destination:{node_id:wt,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:wt,field:"mask"}},{source:{node_id:wt,field:"image"},destination:{node_id:Ie,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:Ie,field:"mask"}});if(h){const N={id:dr,type:"rand_int"};A.nodes[dr]=N,A.edges.push({source:{node_id:dr,field:"a"},destination:{node_id:bn,field:"start"}})}else A.nodes[bn].start=f;return y&&lh(e,A,Re),Uo(e,A,We),ah(e,A,Re,We),Fo(e,A,Re),e.system.shouldUseNSFWChecker&&Bo(e,A,Ie),e.system.shouldUseWatermarker&&zo(e,A,Ie),A},UCe=(e,t,n)=>{const r=ke("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,iterations:d,seed:f,shouldRandomizeSeed:h,vaePrecision:g,shouldUseNoiseSettings:m,shouldUseCpuNoise:v,maskBlur:x,maskBlurMethod:_,tileSize:b,infillMethod:y}=e.generation,{sdxlImg2ImgDenoisingStrength:S,shouldUseSDXLRefiner:C,refinerStart:T,shouldConcatSDXLStylePrompt:E}=e.sdxl;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:P,height:k}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:O,boundingBoxScaleMethod:M,shouldAutoSave:V}=e.canvas,B=v,{craftedPositiveStylePrompt:A,craftedNegativeStylePrompt:N}=Uc(e,E),D={id:NE,nodes:{[We]:{type:"sdxl_model_loader",id:We,model:s},[$e]:{type:"sdxl_compel_prompt",id:$e,prompt:i,style:A},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:o,style:N},[_f]:{type:"tomask",id:_f,is_intermediate:!0,image:t},[Ds]:{type:"mask_combine",id:Ds,is_intermediate:!0,mask2:n},[ut]:{type:"img_blur",id:ut,is_intermediate:!0,radius:x,blur_type:_},[Nn]:{type:"infill_tile",id:Nn,is_intermediate:!0,tile_size:b},[hn]:{type:"i2l",id:hn,is_intermediate:!0,fp32:g==="fp32"},[Se]:{type:"noise",id:Se,use_cpu:B,is_intermediate:!0},[Re]:{type:"denoise_latents",id:Re,is_intermediate:!0,steps:u,cfg_scale:a,scheduler:l,denoising_start:C?Math.min(T,1-S):1-S,denoising_end:C?T:1},[it]:{type:"l2i",id:it,is_intermediate:!0,fp32:g==="fp32"},[wt]:{type:"color_correct",id:wt,is_intermediate:!0},[Ie]:{type:"img_paste",id:Ie,is_intermediate:!V},[bn]:{type:"range_of_size",id:bn,is_intermediate:!0,size:d,step:1},[sn]:{type:"iterate",id:sn,is_intermediate:!0}},edges:[{source:{node_id:We,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:We,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:$e,field:"clip2"}},{source:{node_id:We,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:Nn,field:"image"},destination:{node_id:hn,field:"image"}},{source:{node_id:_f,field:"mask"},destination:{node_id:Ds,field:"mask1"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:hn,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:ut,field:"image"},destination:{node_id:Re,field:"mask"}},{source:{node_id:bn,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Se,field:"seed"}},{source:{node_id:Re,field:"latents"},destination:{node_id:it,field:"latents"}}]};if(y==="patchmatch"&&(D.nodes[Nn]={type:"infill_patchmatch",id:Nn,is_intermediate:!0}),["auto","manual"].includes(M)){const U=O.width,$=O.height;D.nodes[ko]={type:"img_resize",id:ko,is_intermediate:!0,width:U,height:$,image:t},D.nodes[Ni]={type:"img_resize",id:Ni,is_intermediate:!0,width:U,height:$},D.nodes[ti]={type:"img_resize",id:ti,is_intermediate:!0,width:P,height:k},D.nodes[Ls]={type:"img_resize",id:Ls,is_intermediate:!0,width:P,height:k},D.nodes[er]={type:"img_resize",id:er,is_intermediate:!0,width:P,height:k},D.nodes[Se]={...D.nodes[Se],width:U,height:$},D.edges.push({source:{node_id:ko,field:"image"},destination:{node_id:Nn,field:"image"}},{source:{node_id:Ds,field:"image"},destination:{node_id:Ni,field:"image"}},{source:{node_id:Ni,field:"image"},destination:{node_id:ut,field:"image"}},{source:{node_id:it,field:"image"},destination:{node_id:ti,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:er,field:"image"}},{source:{node_id:Nn,field:"image"},destination:{node_id:Ls,field:"image"}},{source:{node_id:Ls,field:"image"},destination:{node_id:wt,field:"reference"}},{source:{node_id:ti,field:"image"},destination:{node_id:wt,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:wt,field:"mask"}},{source:{node_id:Ls,field:"image"},destination:{node_id:Ie,field:"base_image"}},{source:{node_id:wt,field:"image"},destination:{node_id:Ie,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:Ie,field:"mask"}})}else D.nodes[Nn]={...D.nodes[Nn],image:t},D.nodes[Se]={...D.nodes[Se],width:P,height:k},D.nodes[hn]={...D.nodes[hn],image:t},D.nodes[ut]={...D.nodes[ut],image:n},D.edges.push({source:{node_id:Ds,field:"image"},destination:{node_id:ut,field:"image"}},{source:{node_id:Nn,field:"image"},destination:{node_id:wt,field:"reference"}},{source:{node_id:it,field:"image"},destination:{node_id:wt,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:wt,field:"mask"}},{source:{node_id:Nn,field:"image"},destination:{node_id:Ie,field:"base_image"}},{source:{node_id:wt,field:"image"},destination:{node_id:Ie,field:"image"}},{source:{node_id:ut,field:"image"},destination:{node_id:Ie,field:"mask"}});if(h){const U={id:dr,type:"rand_int"};D.nodes[dr]=U,D.edges.push({source:{node_id:dr,field:"a"},destination:{node_id:bn,field:"start"}})}else D.nodes[bn].start=f;return C&&lh(e,D,Re),Uo(e,D,We),ah(e,D,Re,We),Fo(e,D,Re),e.system.shouldUseNSFWChecker&&Bo(e,D,Ie),e.system.shouldUseWatermarker&&zo(e,D,Ie),D},zCe=e=>{const t=ke("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,vaePrecision:l,clipSkip:u,shouldUseCpuNoise:d,shouldUseNoiseSettings:f}=e.generation,{width:h,height:g}=e.canvas.boundingBoxDimensions,{shouldAutoSave:m}=e.canvas,{shouldUseSDXLRefiner:v,refinerStart:x,shouldConcatSDXLStylePrompt:_}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const b=f?d:ys.shouldUseCpuNoise,y=i.model_type==="onnx",S=y?mS:We,C=y?"onnx_model_loader":"sdxl_model_loader",T=y?{type:"t2l_onnx",id:Re,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a}:{type:"denoise_latents",id:Re,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a,denoising_start:0,denoising_end:v?x:1},{craftedPositiveStylePrompt:E,craftedNegativeStylePrompt:P}=Uc(e,_),k={id:IE,nodes:{[S]:{type:C,id:S,is_intermediate:!0,model:i},[$e]:{type:y?"prompt_onnx":"sdxl_compel_prompt",id:$e,is_intermediate:!0,prompt:n,style:E},[Be]:{type:y?"prompt_onnx":"sdxl_compel_prompt",id:Be,is_intermediate:!0,prompt:r,style:P},[Se]:{type:"noise",id:Se,is_intermediate:!0,width:h,height:g,use_cpu:b},[T.id]:T,[Ie]:{type:y?"l2i_onnx":"l2i",id:Ie,is_intermediate:!m,fp32:l==="fp32"}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:S,field:"clip2"},destination:{node_id:$e,field:"clip2"}},{source:{node_id:S,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:S,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:Re,field:"latents"},destination:{node_id:Ie,field:"latents"}}]};return k.nodes[yt]={id:yt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:g,width:h,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:b?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:u},k.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:Ie,field:"metadata"}}),v&&lh(e,k,Re),ah(e,k,Re,S),Uo(e,k,S),wu(e,k),Fo(e,k,Re),e.system.shouldUseNSFWChecker&&Bo(e,k,Ie),e.system.shouldUseWatermarker&&zo(e,k,Ie),k},VCe=e=>{const t=ke("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,clipSkip:l,shouldUseCpuNoise:u,shouldUseNoiseSettings:d}=e.generation,{width:f,height:h}=e.canvas.boundingBoxDimensions,{shouldAutoSave:g}=e.canvas;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const m=d?u:ys.shouldUseCpuNoise,v=i.model_type==="onnx",x=v?mS:an,_=v?"onnx_model_loader":"main_model_loader",b=v?{type:"t2l_onnx",id:Le,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a}:{type:"denoise_latents",id:Le,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a,denoising_start:0,denoising_end:1},y={id:uz,nodes:{[x]:{type:_,id:x,is_intermediate:!0,model:i},[It]:{type:"clip_skip",id:It,is_intermediate:!0,skipped_layers:l},[$e]:{type:v?"prompt_onnx":"compel",id:$e,is_intermediate:!0,prompt:n},[Be]:{type:v?"prompt_onnx":"compel",id:Be,is_intermediate:!0,prompt:r},[Se]:{type:"noise",id:Se,is_intermediate:!0,width:f,height:h,use_cpu:m},[b.id]:b,[Ie]:{type:v?"l2i_onnx":"l2i",id:Ie,is_intermediate:!g}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Le,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:It,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Le,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Le,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Le,field:"noise"}},{source:{node_id:Le,field:"latents"},destination:{node_id:Ie,field:"latents"}}]};return y.nodes[yt]={id:yt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:h,width:f,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:m?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:l},y.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:Ie,field:"metadata"}}),Uo(e,y,x),sh(e,y,Le,x),wu(e,y),Fo(e,y,Le),e.system.shouldUseNSFWChecker&&Bo(e,y,Ie),e.system.shouldUseWatermarker&&zo(e,y,Ie),y},jCe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=zCe(e):i=VCe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=FCe(e,n):i=LCe(e,n)}else if(t==="inpaint"){if(!n||!r)throw new Error("Missing canvas init and mask images");e.generation.model&&e.generation.model.base_model==="sdxl"?i=BCe(e,n,r):i=DCe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=UCe(e,n,r):i=$Ce(e,n,r)}return i},GCe=()=>{Oe({predicate:e=>zm.match(e)&&e.payload==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=ke("session"),o=t(),{layerState:s,boundingBoxCoordinates:a,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:d}=o.canvas,f=await OCe(s,a,l,u,d);if(!f){i.error("Unable to create canvas data");return}const{baseBlob:h,baseImageData:g,maskBlob:m,maskImageData:v}=f,x=MCe(g,v);if(o.system.enableImageDebugging){const E=await rk(h),P=await rk(m);RSe([{base64:P,caption:"mask b64"},{base64:E,caption:"image b64"}])}i.debug(`Generation mode: ${x}`);let _,b;["img2img","inpaint","outpaint"].includes(x)&&(_=await n(we.endpoints.uploadImage.initiate({file:new File([h],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(x)&&(b=await n(we.endpoints.uploadImage.initiate({file:new File([m],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const y=jCe(o,x,_,b);i.debug({graph:Ya(y)},"Canvas graph built"),n(QU(y));const{requestId:S}=n(jr({graph:y})),[C]=await r(E=>jr.fulfilled.match(E)&&E.meta.requestId===S),T=C.payload.id;["img2img","inpaint"].includes(x)&&_&&n(we.endpoints.changeImageSessionId.initiate({imageDTO:_,session_id:T})),["inpaint"].includes(x)&&b&&n(we.endpoints.changeImageSessionId.initiate({imageDTO:b,session_id:T})),o.canvas.layerState.stagingArea.boundingBox||n(hce({sessionId:T,boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(pce(T)),n(kc())}})},HCe=e=>{const t=ke("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,initialImage:l,img2imgStrength:u,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:g,shouldUseCpuNoise:m,shouldUseNoiseSettings:v,vaePrecision:x}=e.generation;if(!l)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const _=v?m:ys.shouldUseCpuNoise,b={id:v5,nodes:{[an]:{type:"main_model_loader",id:an,model:i},[It]:{type:"clip_skip",id:It,skipped_layers:g},[$e]:{type:"compel",id:$e,prompt:n},[Be]:{type:"compel",id:Be,prompt:r},[Se]:{type:"noise",id:Se,use_cpu:_},[it]:{type:"l2i",id:it,fp32:x==="fp32"},[Le]:{type:"denoise_latents",id:Le,cfg_scale:o,scheduler:s,steps:a,denoising_start:1-u,denoising_end:1},[Vt]:{type:"i2l",id:Vt,fp32:x==="fp32"}},edges:[{source:{node_id:an,field:"unet"},destination:{node_id:Le,field:"unet"}},{source:{node_id:an,field:"clip"},destination:{node_id:It,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Le,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Le,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Le,field:"noise"}},{source:{node_id:Vt,field:"latents"},destination:{node_id:Le,field:"latents"}},{source:{node_id:Le,field:"latents"},destination:{node_id:it,field:"latents"}}]};if(d&&(l.width!==f||l.height!==h)){const y={id:Jn,type:"img_resize",image:{image_name:l.imageName},is_intermediate:!0,width:f,height:h};b.nodes[Jn]=y,b.edges.push({source:{node_id:Jn,field:"image"},destination:{node_id:Vt,field:"image"}}),b.edges.push({source:{node_id:Jn,field:"width"},destination:{node_id:Se,field:"width"}}),b.edges.push({source:{node_id:Jn,field:"height"},destination:{node_id:Se,field:"height"}})}else b.nodes[Vt].image={image_name:l.imageName},b.edges.push({source:{node_id:Vt,field:"width"},destination:{node_id:Se,field:"width"}}),b.edges.push({source:{node_id:Vt,field:"height"},destination:{node_id:Se,field:"height"}});return b.nodes[yt]={id:yt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:_?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:g,strength:u,init_image:l.imageName},b.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:it,field:"metadata"}}),Uo(e,b,an),sh(e,b,Le),wu(e,b),Fo(e,b,Le),e.system.shouldUseNSFWChecker&&Bo(e,b),e.system.shouldUseWatermarker&&zo(e,b),b},WCe=e=>{const t=ke("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,initialImage:l,shouldFitToWidthHeight:u,width:d,height:f,clipSkip:h,shouldUseCpuNoise:g,shouldUseNoiseSettings:m,vaePrecision:v}=e.generation,{positiveStylePrompt:x,negativeStylePrompt:_,shouldConcatSDXLStylePrompt:b,shouldUseSDXLRefiner:y,refinerStart:S,sdxlImg2ImgDenoisingStrength:C}=e.sdxl;if(!l)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const T=m?g:ys.shouldUseCpuNoise,{craftedPositiveStylePrompt:E,craftedNegativeStylePrompt:P}=Uc(e,b),k={id:b5,nodes:{[We]:{type:"sdxl_model_loader",id:We,model:i},[$e]:{type:"sdxl_compel_prompt",id:$e,prompt:n,style:E},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:r,style:P},[Se]:{type:"noise",id:Se,use_cpu:T},[it]:{type:"l2i",id:it,fp32:v==="fp32"},[Re]:{type:"denoise_latents",id:Re,cfg_scale:o,scheduler:s,steps:a,denoising_start:y?Math.min(S,1-C):1-C,denoising_end:y?S:1},[Vt]:{type:"i2l",id:Vt,fp32:v==="fp32"}},edges:[{source:{node_id:We,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:We,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:$e,field:"clip2"}},{source:{node_id:We,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:Vt,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:Re,field:"latents"},destination:{node_id:it,field:"latents"}}]};if(u&&(l.width!==d||l.height!==f)){const O={id:Jn,type:"img_resize",image:{image_name:l.imageName},is_intermediate:!0,width:d,height:f};k.nodes[Jn]=O,k.edges.push({source:{node_id:Jn,field:"image"},destination:{node_id:Vt,field:"image"}}),k.edges.push({source:{node_id:Jn,field:"width"},destination:{node_id:Se,field:"width"}}),k.edges.push({source:{node_id:Jn,field:"height"},destination:{node_id:Se,field:"height"}})}else k.nodes[Vt].image={image_name:l.imageName},k.edges.push({source:{node_id:Vt,field:"width"},destination:{node_id:Se,field:"width"}}),k.edges.push({source:{node_id:Vt,field:"height"},destination:{node_id:Se,field:"height"}});return k.nodes[yt]={id:yt,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:T?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:h,strength:C,init_image:l.imageName,positive_style_prompt:x,negative_style_prompt:_},k.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:it,field:"metadata"}}),ah(e,k,Re,We),y&&lh(e,k,Re),Uo(e,k,We),Fo(e,k,Re),wu(e,k),e.system.shouldUseNSFWChecker&&Bo(e,k),e.system.shouldUseWatermarker&&zo(e,k),k},qCe=()=>{Oe({predicate:e=>zm.match(e)&&e.payload==="img2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=ke("session"),o=t(),s=o.generation.model;let a;s&&s.base_model==="sdxl"?a=WCe(o):a=HCe(o),n(YU(a)),i.debug({graph:Ya(a)},"Image to Image graph built"),n(jr({graph:a})),await r(jr.fulfilled.match),n(kc())}})};let Z0;const KCe=new Uint8Array(16);function XCe(){if(!Z0&&(Z0=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Z0))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Z0(KCe)}const $r=[];for(let e=0;e<256;++e)$r.push((e+256).toString(16).slice(1));function YCe(e,t=0){return($r[e[t+0]]+$r[e[t+1]]+$r[e[t+2]]+$r[e[t+3]]+"-"+$r[e[t+4]]+$r[e[t+5]]+"-"+$r[e[t+6]]+$r[e[t+7]]+"-"+$r[e[t+8]]+$r[e[t+9]]+"-"+$r[e[t+10]]+$r[e[t+11]]+$r[e[t+12]]+$r[e[t+13]]+$r[e[t+14]]+$r[e[t+15]]).toLowerCase()}const QCe=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Bk={randomUUID:QCe};function ZCe(e,t,n){if(Bk.randomUUID&&!t&&!e)return Bk.randomUUID();e=e||{};const r=e.random||(e.rng||XCe)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return YCe(r)}const JCe=e=>{if(e.type==="color"&&e.value){const t=Qr(e.value),{r:n,g:r,b:i,a:o}=e.value,s=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a:s}),t}return e.value},e3e=e=>{const{nodes:t,edges:n}=e.nodes,i=t.filter(a=>a.type!=="progress_image").reduce((a,l)=>{const{id:u,data:d}=l,{type:f,inputs:h}=d,g=LT(h,(v,x,_)=>{const b=JCe(x);return v[_]=b,v},{}),m={type:f,id:u,...g};return Object.assign(a,{[u]:m}),a},{}),o=n.reduce((a,l)=>{const{source:u,target:d,sourceHandle:f,targetHandle:h}=l;return a.push({source:{node_id:u,field:f},destination:{node_id:d,field:h}}),a},[]);return o.forEach(a=>{const l=i[a.destination.node_id],u=a.destination.field;i[a.destination.node_id]=mb(l,u)}),{id:ZCe(),nodes:i,edges:o}},t3e=()=>{Oe({predicate:e=>zm.match(e)&&e.payload==="nodes",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=ke("session"),o=t(),s=e3e(o);n(ZU(s)),i.debug({graph:Ya(s)},"Nodes graph built"),n(jr({graph:s})),await r(jr.fulfilled.match),n(kc())}})},n3e=e=>{const t=ke("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,width:l,height:u,clipSkip:d,shouldUseCpuNoise:f,shouldUseNoiseSettings:h,vaePrecision:g}=e.generation,{positiveStylePrompt:m,negativeStylePrompt:v,shouldUseSDXLRefiner:x,shouldConcatSDXLStylePrompt:_,refinerStart:b}=e.sdxl,y=h?f:ys.shouldUseCpuNoise;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const{craftedPositiveStylePrompt:S,craftedNegativeStylePrompt:C}=Uc(e,_),T={id:fz,nodes:{[We]:{type:"sdxl_model_loader",id:We,model:i},[$e]:{type:"sdxl_compel_prompt",id:$e,prompt:n,style:S},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:r,style:C},[Se]:{type:"noise",id:Se,width:l,height:u,use_cpu:y},[Re]:{type:"denoise_latents",id:Re,cfg_scale:o,scheduler:s,steps:a,denoising_start:0,denoising_end:x?b:1},[it]:{type:"l2i",id:it,fp32:g==="fp32"}},edges:[{source:{node_id:We,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:We,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:$e,field:"clip2"}},{source:{node_id:We,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:We,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:Re,field:"latents"},destination:{node_id:it,field:"latents"}}]};return T.nodes[yt]={id:yt,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:u,width:l,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:y?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:d,positive_style_prompt:m,negative_style_prompt:v},T.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:it,field:"metadata"}}),x&&lh(e,T,Re),Uo(e,T,We),ah(e,T,Re,We),Fo(e,T,Re),wu(e,T),e.system.shouldUseNSFWChecker&&Bo(e,T),e.system.shouldUseWatermarker&&zo(e,T),T},r3e=e=>{const t=ke("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,width:l,height:u,clipSkip:d,shouldUseCpuNoise:f,shouldUseNoiseSettings:h,vaePrecision:g}=e.generation,m=h?f:ys.shouldUseCpuNoise;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const v=i.model_type==="onnx",x=v?mS:an,_=v?"onnx_model_loader":"main_model_loader",b=v?{type:"t2l_onnx",id:Le,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a}:{type:"denoise_latents",id:Le,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a,denoising_start:0,denoising_end:1},y={id:lz,nodes:{[x]:{type:_,id:x,is_intermediate:!0,model:i},[It]:{type:"clip_skip",id:It,skipped_layers:d,is_intermediate:!0},[$e]:{type:v?"prompt_onnx":"compel",id:$e,prompt:n,is_intermediate:!0},[Be]:{type:v?"prompt_onnx":"compel",id:Be,prompt:r,is_intermediate:!0},[Se]:{type:"noise",id:Se,width:l,height:u,use_cpu:m,is_intermediate:!0},[b.id]:b,[it]:{type:v?"l2i_onnx":"l2i",id:it,fp32:g==="fp32"}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Le,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:It,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:$e,field:"clip"}},{source:{node_id:It,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:$e,field:"conditioning"},destination:{node_id:Le,field:"positive_conditioning"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:Le,field:"negative_conditioning"}},{source:{node_id:Se,field:"noise"},destination:{node_id:Le,field:"noise"}},{source:{node_id:Le,field:"latents"},destination:{node_id:it,field:"latents"}}]};return y.nodes[yt]={id:yt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:m?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:d},y.edges.push({source:{node_id:yt,field:"metadata"},destination:{node_id:it,field:"metadata"}}),Uo(e,y,x),sh(e,y,Le,x),wu(e,y),Fo(e,y,Le),e.system.shouldUseNSFWChecker&&Bo(e,y),e.system.shouldUseWatermarker&&zo(e,y),y},i3e=()=>{Oe({predicate:e=>zm.match(e)&&e.payload==="txt2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=ke("session"),o=t(),s=o.generation.model;let a;s&&s.base_model==="sdxl"?a=n3e(o):a=r3e(o),n(XU(a)),i.debug({graph:Ya(a)},"Text to Image graph built"),n(jr({graph:a})),await r(jr.fulfilled.match),n(kc())}})},Xz=$L(),Oe=Xz.startListening;hbe();pbe();ybe();ibe();obe();sbe();abe();lbe();$_e();fbe();GCe();t3e();i3e();qCe();uSe();Z_e();X_e();q_e();Q_e();xSe();k_e();fSe();hSe();gSe();mSe();vSe();cSe();dSe();SSe();wSe();_Se();bSe();ySe();rSe();iSe();oSe();sSe();aSe();lSe();eSe();tSe();nSe();tbe();ebe();nbe();rbe();cbe();dbe();F_e();Kbe();ube();vbe();L_e();bbe();M_e();I_e();PSe();TSe();const o3e={canvas:gce,gallery:xfe,generation:Wue,nodes:u1e,postprocessing:c1e,system:$1e,config:Tle,ui:Kue,hotkeys:z1e,controlNet:bfe,dynamicPrompts:wfe,deleteImageModal:Afe,changeBoardModal:Rfe,lora:kfe,modelmanager:U1e,sdxl:h1e,[iu.reducerPath]:iu.reducer},s3e=Qf(o3e),a3e=f_e(s3e),l3e=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],u3e=yL({reducer:a3e,enhancers:e=>e.concat(h_e(window.localStorage,l3e,{persistDebounce:300,serialize:C_e,unserialize:E_e,prefix:p_e})).concat(BL()),middleware:e=>e({immutableCheck:!1,serializableCheck:!1}).concat(iu.middleware).concat(H1e).prepend(Xz.middleware),devTools:{actionSanitizer:P_e,stateSanitizer:O_e,trace:!0,predicate:(e,t)=>!R_e.includes(t.type)}}),OMe=e=>e,c3e=e=>{const{socket:t,storeApi:n}=e,{dispatch:r,getState:i}=n;t.on("connect",()=>{ke("socketio").debug("Connected"),r(aF());const{sessionId:s}=i().system;s&&(t.emit("subscribe",{session:s}),r(YT({sessionId:s})))}),t.on("connect_error",o=>{o&&o.message&&o.data==="ERR_UNAUTHENTICATED"&&r(Yn(lc({title:o.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(uF())}),t.on("invocation_started",o=>{r(pF({data:o}))}),t.on("generator_progress",o=>{r(bF({data:o}))}),t.on("invocation_error",o=>{r(yF({data:o}))}),t.on("invocation_complete",o=>{r(QT({data:o}))}),t.on("graph_execution_state_complete",o=>{r(vF({data:o}))}),t.on("model_load_started",o=>{r(wF({data:o}))}),t.on("model_load_completed",o=>{r(xF({data:o}))}),t.on("session_retrieval_error",o=>{r(CF({data:o}))}),t.on("invocation_retrieval_error",o=>{r(EF({data:o}))})},Qs=Object.create(null);Qs.open="0";Qs.close="1";Qs.ping="2";Qs.pong="3";Qs.message="4";Qs.upgrade="5";Qs.noop="6";const Nv=Object.create(null);Object.keys(Qs).forEach(e=>{Nv[Qs[e]]=e});const d3e={type:"error",data:"parser error"},Yz=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Qz=typeof ArrayBuffer=="function",Zz=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,YE=({type:e,data:t},n,r)=>Yz&&t instanceof Blob?n?r(t):Uk(t,r):Qz&&(t instanceof ArrayBuffer||Zz(t))?n?r(t):Uk(new Blob([t]),r):r(Qs[e]+(t||"")),Uk=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function zk(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let iC;function f3e(e,t){if(Yz&&e.data instanceof Blob)return e.data.arrayBuffer().then(zk).then(t);if(Qz&&(e.data instanceof ArrayBuffer||Zz(e.data)))return t(zk(e.data));YE(e,!1,n=>{iC||(iC=new TextEncoder),t(iC.encode(n))})}const Vk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pp=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,s,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),d=new Uint8Array(u);for(r=0;r>4,d[i++]=(s&15)<<4|a>>2,d[i++]=(a&3)<<6|l&63;return u},p3e=typeof ArrayBuffer=="function",QE=(e,t)=>{if(typeof e!="string")return{type:"message",data:Jz(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:g3e(e.substring(1),t)}:Nv[n]?e.length>1?{type:Nv[n],data:e.substring(1)}:{type:Nv[n]}:d3e},g3e=(e,t)=>{if(p3e){const n=h3e(e);return Jz(n,t)}else return{base64:!0,data:e}},Jz=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},eV=String.fromCharCode(30),m3e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{YE(o,!1,a=>{r[s]=a,++i===n&&t(r.join(eV))})})},y3e=(e,t)=>{const n=e.split(eV),r=[];for(let i=0;i54;return QE(r?e:oC.decode(e),n)}const tV=4;function nr(e){if(e)return _3e(e)}function _3e(e){for(var t in nr.prototype)e[t]=nr.prototype[t];return e}nr.prototype.on=nr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};nr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};nr.prototype.off=nr.prototype.removeListener=nr.prototype.removeAllListeners=nr.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,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function nV(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const b3e=Ao.setTimeout,S3e=Ao.clearTimeout;function u2(e,t){t.useNativeTimers?(e.setTimeoutFn=b3e.bind(Ao),e.clearTimeoutFn=S3e.bind(Ao)):(e.setTimeoutFn=Ao.setTimeout.bind(Ao),e.clearTimeoutFn=Ao.clearTimeout.bind(Ao))}const w3e=1.33;function x3e(e){return typeof e=="string"?C3e(e):Math.ceil((e.byteLength||e.size)*w3e)}function C3e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function T3e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function E3e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function iV(){const e=Hk(+new Date);return e!==Gk?(jk=0,Gk=e):e+"."+Hk(jk++)}for(;J0{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)};y3e(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,m3e(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]=iV()),!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 bf(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}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}}let bf=class Lv extends nr{constructor(t,n){super(),u2(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=nV(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new sV(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}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 i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.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(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Lv.requestsCount++,Lv.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=O3e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Lv.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()}};bf.requestsCount=0;bf.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Wk);else if(typeof addEventListener=="function"){const e="onpagehide"in Ao?"pagehide":"unload";addEventListener(e,Wk,!1)}}function Wk(){for(let e in bf.requests)bf.requests.hasOwnProperty(e)&&bf.requests[e].abort()}const JE=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),ev=Ao.WebSocket||Ao.MozWebSocket,qk=!0,M3e="arraybuffer",Kk=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class N3e extends ZE{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=Kk?{}:nV(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=qk&&!Kk?n?new ev(t,n):new ev(t):new ev(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||M3e,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{qk&&this.ws.send(o)}catch{}i&&JE(()=>{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]=iV()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!ev}}function L3e(e,t){return e.type==="message"&&typeof e.data!="string"&&t[0]>=48&&t[0]<=54}class D3e extends ZE{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=t.readable.getReader();this.writer=t.writable.getWriter();let r;const i=()=>{n.read().then(({done:s,value:a})=>{s||(!r&&a.byteLength===1&&a[0]===54?r=!0:(this.onPacket(v3e(a,r,"arraybuffer")),r=!1),i())}).catch(s=>{})};i();const o=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write(new TextEncoder().encode(o)).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{L3e(r,o)&&this.writer.write(Uint8Array.of(54)),this.writer.write(o).then(()=>{i&&JE(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const $3e={websocket:N3e,webtransport:D3e,polling:I3e},F3e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,B3e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function O5(e){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 i=F3e.exec(e||""),o={},s=14;for(;s--;)o[B3e[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=U3e(o,o.path),o.queryKey=z3e(o,o.query),o}function U3e(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 z3e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let aV=class Md extends nr{constructor(t,n={}){super(),this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=O5(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=O5(n.host).host),u2(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=E3e(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=tV,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 $3e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Md.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;Md.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Md.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,d(),n.close(),n=null)}const s=f=>{const h=new Error("probe error: "+f);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function a(){s("transport closed")}function l(){s("socket closed")}function u(f){n&&f.name!==n.name&&o()}const d=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",a),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Md.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,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),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){Md.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 i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,lV=Object.prototype.toString,H3e=typeof Blob=="function"||typeof Blob<"u"&&lV.call(Blob)==="[object BlobConstructor]",W3e=typeof File=="function"||typeof File<"u"&&lV.call(File)==="[object FileConstructor]";function eA(e){return j3e&&(e instanceof ArrayBuffer||G3e(e))||H3e&&e instanceof Blob||W3e&&e instanceof File}function Dv(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(o),n.apply(this,[null,...s])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((s,a)=>r?s?o(s):i(a):i(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((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),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:Tt.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 Tt.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 Tt.EVENT:case Tt.BINARY_EVENT:this.onevent(t);break;case Tt.ACK:case Tt.BINARY_ACK:this.onack(t);break;case Tt.DISCONNECT:this.ondisconnect();break;case Tt.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(...i){r||(r=!0,n.packet({type:Tt.ACK,id:t,data:i}))}}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:Tt.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}uh.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};uh.prototype.reset=function(){this.attempts=0};uh.prototype.setMin=function(e){this.ms=e};uh.prototype.setMax=function(e){this.max=e};uh.prototype.setJitter=function(e){this.jitter=e};class M5 extends nr{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,u2(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 uh({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||J3e;this.encoder=new i.Encoder,this.decoder=new i.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 aV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=ts(n,"open",function(){r.onopen(),t&&t()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},s=ts(n,"error",o);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),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(ts(t,"ping",this.onping.bind(this)),ts(t,"data",this.ondata.bind(this)),ts(t,"error",this.onerror.bind(this)),ts(t,"close",this.onclose.bind(this)),ts(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){JE(()=>{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 uV(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(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):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 yp={};function $v(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=V3e(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=yp[i]&&o in yp[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let l;return a?l=new M5(r,t):(yp[i]||(yp[i]=new M5(r,t)),l=yp[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign($v,{Manager:M5,Socket:uV,io:$v,connect:$v});const Yk=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const s=$g.get();s&&(n=s.replace(/^https?\:\/\//i,""));const a=Dg.get();a&&(r.auth={token:a}),r.transports=["websocket","polling"]}const i=$v(n,r);return s=>a=>l=>{const{dispatch:u,getState:d}=s;if(e||(c3e({storeApi:s,socket:i}),e=!0,i.connect()),jr.fulfilled.match(l)){const f=l.payload.id,h=d().system.sessionId;h&&(i.emit("unsubscribe",{session:h}),u(fF({sessionId:h}))),i.emit("subscribe",{session:f}),u(YT({sessionId:f}))}a(l)}};function t5e(e){if(e.sheet)return e.sheet;for(var t=0;t0?Ur(ch,--Ui):0,Hf--,Qn===10&&(Hf=1,d2--),Qn}function to(){return Qn=Ui2||Jg(Qn)>3?"":" "}function p5e(e,t){for(;--t&&to()&&!(Qn<48||Qn>102||Qn>57&&Qn<65||Qn>70&&Qn<97););return qm(e,Fv()+(t<6&&Ws()==32&&to()==32))}function L5(e){for(;to();)switch(Qn){case e:return Ui;case 34:case 39:e!==34&&e!==39&&L5(Qn);break;case 40:e===41&&L5(e);break;case 92:to();break}return Ui}function g5e(e,t){for(;to()&&e+Qn!==47+10;)if(e+Qn===42+42&&Ws()===47)break;return"/*"+qm(t,Ui-1)+"*"+c2(e===47?e:to())}function m5e(e){for(;!Jg(Ws());)to();return qm(e,Ui)}function y5e(e){return gV(Uv("",null,null,null,[""],e=pV(e),0,[0],e))}function Uv(e,t,n,r,i,o,s,a,l){for(var u=0,d=0,f=s,h=0,g=0,m=0,v=1,x=1,_=1,b=0,y="",S=i,C=o,T=r,E=y;x;)switch(m=b,b=to()){case 40:if(m!=108&&Ur(E,f-1)==58){N5(E+=$t(Bv(b),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:E+=Bv(b);break;case 9:case 10:case 13:case 32:E+=h5e(m);break;case 92:E+=p5e(Fv()-1,7);continue;case 47:switch(Ws()){case 42:case 47:tv(v5e(g5e(to(),Fv()),t,n),l);break;default:E+="/"}break;case 123*v:a[u++]=Os(E)*_;case 125*v:case 59:case 0:switch(b){case 0:case 125:x=0;case 59+d:_==-1&&(E=$t(E,/\f/g,"")),g>0&&Os(E)-f&&tv(g>32?Zk(E+";",r,n,f-1):Zk($t(E," ","")+";",r,n,f-2),l);break;case 59:E+=";";default:if(tv(T=Qk(E,t,n,u,d,i,a,y,S=[],C=[],f),o),b===123)if(d===0)Uv(E,t,T,T,S,o,f,a,C);else switch(h===99&&Ur(E,3)===110?100:h){case 100:case 108:case 109:case 115:Uv(e,T,T,r&&tv(Qk(e,T,T,0,0,i,a,y,i,S=[],f),C),i,C,f,a,r?S:C);break;default:Uv(E,T,T,T,[""],C,0,a,C)}}u=d=g=0,v=_=1,y=E="",f=s;break;case 58:f=1+Os(E),g=m;default:if(v<1){if(b==123)--v;else if(b==125&&v++==0&&f5e()==125)continue}switch(E+=c2(b),b*v){case 38:_=d>0?1:(E+="\f",-1);break;case 44:a[u++]=(Os(E)-1)*_,_=1;break;case 64:Ws()===45&&(E+=Bv(to())),h=Ws(),d=f=Os(y=E+=m5e(Fv())),b++;break;case 45:m===45&&Os(E)==2&&(v=0)}}return o}function Qk(e,t,n,r,i,o,s,a,l,u,d){for(var f=i-1,h=i===0?o:[""],g=iA(h),m=0,v=0,x=0;m0?h[_]+" "+b:$t(b,/&\f/g,h[_])))&&(l[x++]=y);return f2(e,t,n,i===0?nA:a,l,u,d)}function v5e(e,t,n){return f2(e,t,n,cV,c2(d5e()),Zg(e,2,-2),0)}function Zk(e,t,n,r){return f2(e,t,n,rA,Zg(e,0,r),Zg(e,r+1,-1),r)}function Sf(e,t){for(var n="",r=iA(e),i=0;i6)switch(Ur(e,t+1)){case 109:if(Ur(e,t+4)!==45)break;case 102:return $t(e,/(.+:)(.+)-([^]+)/,"$1"+Dt+"$2-$3$1"+m_+(Ur(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~N5(e,"stretch")?yV($t(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ur(e,t+1)!==115)break;case 6444:switch(Ur(e,Os(e)-3-(~N5(e,"!important")&&10))){case 107:return $t(e,":",":"+Dt)+e;case 101:return $t(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Dt+(Ur(e,14)===45?"inline-":"")+"box$3$1"+Dt+"$2$3$1"+Yr+"$2box$3")+e}break;case 5936:switch(Ur(e,t+11)){case 114:return Dt+e+Yr+$t(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Dt+e+Yr+$t(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Dt+e+Yr+$t(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Dt+e+Yr+e+e}return e}var A5e=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case rA:t.return=yV(t.value,t.length);break;case dV:return Sf([vp(t,{value:$t(t.value,"@","@"+Dt)})],i);case nA:if(t.length)return c5e(t.props,function(o){switch(u5e(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Sf([vp(t,{props:[$t(o,/:(read-\w+)/,":"+m_+"$1")]})],i);case"::placeholder":return Sf([vp(t,{props:[$t(o,/:(plac\w+)/,":"+Dt+"input-$1")]}),vp(t,{props:[$t(o,/:(plac\w+)/,":"+m_+"$1")]}),vp(t,{props:[$t(o,/:(plac\w+)/,Yr+"input-$1")]})],i)}return""})}},P5e=[A5e],R5e=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(v){var x=v.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(v),v.setAttribute("data-s",""))})}var i=t.stylisPlugins||P5e,o={},s,a=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(v){for(var x=v.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var M5e={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},N5e=/[A-Z]|^ms/g,L5e=/_EMO_([^_]+?)_([^]*?)_EMO_/g,bV=function(t){return t.charCodeAt(1)===45},tI=function(t){return t!=null&&typeof t!="boolean"},sC=mV(function(e){return bV(e)?e:e.replace(N5e,"-$&").toLowerCase()}),nI=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(L5e,function(r,i,o){return ks={name:i,styles:o,next:ks},i})}return M5e[t]!==1&&!bV(t)&&typeof n=="number"&&n!==0?n+"px":n};function em(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return ks={name:n.name,styles:n.styles,next:ks},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ks={name:r.name,styles:r.styles,next:ks},r=r.next;var i=n.styles+";";return i}return D5e(e,t,n)}case"function":{if(e!==void 0){var o=ks,s=n(e);return ks=o,em(e,t,s)}break}}if(t==null)return n;var a=t[n];return a!==void 0?a:n}function D5e(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return e}var TV=L.createContext({});TV.displayName="ColorModeContext";function sA(){const e=L.useContext(TV);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function MMe(e,t){const{colorMode:n}=sA();return n==="dark"?t:e}function G5e(){const e=sA(),t=CV();return{...e,theme:t}}function H5e(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__breakpoints)==null?void 0:a.asArray)==null?void 0:l[s]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function W5e(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__cssMap)==null?void 0:a[s])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function NMe(e,t,n){const r=CV();return q5e(e,t,n)(r)}function q5e(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const s=i.filter(Boolean),a=r.map((l,u)=>{var d,f;if(e==="breakpoints")return H5e(o,l,(d=s[u])!=null?d:l);const h=`${e}.${l}`;return W5e(o,h,(f=s[u])!=null?f:l)});return Array.isArray(t)?a:a[0]}}var EV=(...e)=>e.filter(Boolean).join(" ");function K5e(){return!1}function La(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var LMe=e=>{const{condition:t,message:n}=e;t&&K5e()&&console.warn(n)};function Ju(e,...t){return X5e(e)?e(...t):e}var X5e=e=>typeof e=="function",DMe=e=>e?"":void 0,$Me=e=>e?!0:void 0;function FMe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function BMe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var y_={exports:{}};y_.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",h="[object Error]",g="[object Function]",m="[object GeneratorFunction]",v="[object Map]",x="[object Number]",_="[object Null]",b="[object Object]",y="[object Proxy]",S="[object RegExp]",C="[object Set]",T="[object String]",E="[object Undefined]",P="[object WeakMap]",k="[object ArrayBuffer]",O="[object DataView]",M="[object Float32Array]",V="[object Float64Array]",B="[object Int8Array]",A="[object Int16Array]",N="[object Int32Array]",D="[object Uint8Array]",U="[object Uint8ClampedArray]",$="[object Uint16Array]",j="[object Uint32Array]",G=/[\\^$.*+?()[\]{}|]/g,q=/^\[object .+?Constructor\]$/,Z=/^(?:0|[1-9]\d*)$/,ee={};ee[M]=ee[V]=ee[B]=ee[A]=ee[N]=ee[D]=ee[U]=ee[$]=ee[j]=!0,ee[a]=ee[l]=ee[k]=ee[d]=ee[O]=ee[f]=ee[h]=ee[g]=ee[v]=ee[x]=ee[b]=ee[S]=ee[C]=ee[T]=ee[P]=!1;var ie=typeof Ze=="object"&&Ze&&Ze.Object===Object&&Ze,se=typeof self=="object"&&self&&self.Object===Object&&self,le=ie||se||Function("return this")(),W=t&&!t.nodeType&&t,ne=W&&!0&&e&&!e.nodeType&&e,fe=ne&&ne.exports===W,pe=fe&&ie.process,ve=function(){try{var H=ne&&ne.require&&ne.require("util").types;return H||pe&&pe.binding&&pe.binding("util")}catch{}}(),ye=ve&&ve.isTypedArray;function Je(H,Y,re){switch(re.length){case 0:return H.call(Y);case 1:return H.call(Y,re[0]);case 2:return H.call(Y,re[0],re[1]);case 3:return H.call(Y,re[0],re[1],re[2])}return H.apply(Y,re)}function Fe(H,Y){for(var re=-1,xe=Array(H);++re-1}function Vo(H,Y){var re=this.__data__,xe=Go(re,H);return xe<0?(++this.size,re.push([H,Y])):re[xe][1]=Y,this}sr.prototype.clear=ji,sr.prototype.delete=bs,sr.prototype.get=fo,sr.prototype.has=tl,sr.prototype.set=Vo;function Mr(H){var Y=-1,re=H==null?0:H.length;for(this.clear();++Y1?re[pt-1]:void 0,et=pt>2?re[2]:void 0;for(Ut=H.length>3&&typeof Ut=="function"?(pt--,Ut):void 0,et&&dy(re[0],re[1],et)&&(Ut=pt<3?void 0:Ut,pt=1),Y=Object(Y);++xe-1&&H%1==0&&H0){if(++Y>=i)return arguments[0]}else Y=0;return H.apply(void 0,arguments)}}function my(H){if(H!=null){try{return At.call(H)}catch{}try{return H+""}catch{}}return""}function Yc(H,Y){return H===Y||H!==H&&Y!==Y}var Ph=Cu(function(){return arguments}())?Cu:function(H){return Tu(H)&&un.call(H,"callee")&&!si.call(H,"callee")},Rh=Array.isArray;function Qc(H){return H!=null&&vy(H.length)&&!Oh(H)}function I2(H){return Tu(H)&&Qc(H)}var yy=ra||L2;function Oh(H){if(!Ho(H))return!1;var Y=rl(H);return Y==g||Y==m||Y==u||Y==y}function vy(H){return typeof H=="number"&&H>-1&&H%1==0&&H<=s}function Ho(H){var Y=typeof H;return H!=null&&(Y=="object"||Y=="function")}function Tu(H){return H!=null&&typeof H=="object"}function M2(H){if(!Tu(H)||rl(H)!=b)return!1;var Y=Rr(H);if(Y===null)return!0;var re=un.call(Y,"constructor")&&Y.constructor;return typeof re=="function"&&re instanceof re&&At.call(re)==Ci}var _y=ye?Ae(ye):il;function N2(H){return ay(H,by(H))}function by(H){return Qc(H)?Sh(H,!0):A2(H)}var Jt=Wc(function(H,Y,re,xe){ry(H,Y,re,xe)});function Kt(H){return function(){return H}}function Sy(H){return H}function L2(){return!1}e.exports=Jt})(y_,y_.exports);var Y5e=y_.exports;const Us=Tc(Y5e);var Q5e=e=>/!(important)?$/.test(e),oI=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,Z5e=(e,t)=>n=>{const r=String(t),i=Q5e(r),o=oI(r),s=e?`${e}.${o}`:o;let a=La(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:t;return a=oI(a),i?`${a} !important`:a};function aA(e){const{scale:t,transform:n,compose:r}=e;return(o,s)=>{var a;const l=Z5e(t,o)(s);let u=(a=n==null?void 0:n(l,s))!=null?a:l;return r&&(u=r(u,s)),u}}var nv=(...e)=>t=>e.reduce((n,r)=>r(n),t);function So(e,t){return n=>{const r={property:n,scale:e};return r.transform=aA({scale:e,transform:t}),r}}var J5e=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function e4e(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:J5e(t),transform:n?aA({scale:n,compose:r}):r}}var AV=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function t4e(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...AV].join(" ")}function n4e(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...AV].join(" ")}var r4e={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},i4e={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function o4e(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var s4e={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},D5={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},a4e=new Set(Object.values(D5)),$5=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),l4e=e=>e.trim();function u4e(e,t){if(e==null||$5.has(e))return e;if(!(F5(e)||$5.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],s=i==null?void 0:i[2];if(!o||!s)return e;const a=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=s.split(",").map(l4e).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const d=l in D5?D5[l]:l;u.unshift(d);const f=u.map(h=>{if(a4e.has(h))return h;const g=h.indexOf(" "),[m,v]=g!==-1?[h.substr(0,g),h.substr(g+1)]:[h],x=F5(v)?v:v&&v.split(" "),_=`colors.${m}`,b=_ in t.__cssMap?t.__cssMap[_].varRef:m;return x?[b,...Array.isArray(x)?x:[x]].join(" "):b});return`${a}(${f.join(", ")})`}var F5=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),c4e=(e,t)=>u4e(e,t??{});function d4e(e){return/^var\(--.+\)$/.test(e)}var f4e=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},Es=e=>t=>`${e}(${t})`,Ot={filter(e){return e!=="auto"?e:r4e},backdropFilter(e){return e!=="auto"?e:i4e},ring(e){return o4e(Ot.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?t4e():e==="auto-gpu"?n4e():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=f4e(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(d4e(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:c4e,blur:Es("blur"),opacity:Es("opacity"),brightness:Es("brightness"),contrast:Es("contrast"),dropShadow:Es("drop-shadow"),grayscale:Es("grayscale"),hueRotate:Es("hue-rotate"),invert:Es("invert"),saturate:Es("saturate"),sepia:Es("sepia"),bgImage(e){return e==null||F5(e)||$5.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=s4e[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},Q={borderWidths:So("borderWidths"),borderStyles:So("borderStyles"),colors:So("colors"),borders:So("borders"),gradients:So("gradients",Ot.gradient),radii:So("radii",Ot.px),space:So("space",nv(Ot.vh,Ot.px)),spaceT:So("space",nv(Ot.vh,Ot.px)),degreeT(e){return{property:e,transform:Ot.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:aA({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:So("sizes",nv(Ot.vh,Ot.px)),sizesT:So("sizes",nv(Ot.vh,Ot.fraction)),shadows:So("shadows"),logical:e4e,blur:So("blur",Ot.blur)},zv={background:Q.colors("background"),backgroundColor:Q.colors("backgroundColor"),backgroundImage:Q.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Ot.bgClip},bgSize:Q.prop("backgroundSize"),bgPosition:Q.prop("backgroundPosition"),bg:Q.colors("background"),bgColor:Q.colors("backgroundColor"),bgPos:Q.prop("backgroundPosition"),bgRepeat:Q.prop("backgroundRepeat"),bgAttachment:Q.prop("backgroundAttachment"),bgGradient:Q.gradients("backgroundImage"),bgClip:{transform:Ot.bgClip}};Object.assign(zv,{bgImage:zv.backgroundImage,bgImg:zv.backgroundImage});var Lt={border:Q.borders("border"),borderWidth:Q.borderWidths("borderWidth"),borderStyle:Q.borderStyles("borderStyle"),borderColor:Q.colors("borderColor"),borderRadius:Q.radii("borderRadius"),borderTop:Q.borders("borderTop"),borderBlockStart:Q.borders("borderBlockStart"),borderTopLeftRadius:Q.radii("borderTopLeftRadius"),borderStartStartRadius:Q.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:Q.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:Q.radii("borderTopRightRadius"),borderStartEndRadius:Q.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:Q.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:Q.borders("borderRight"),borderInlineEnd:Q.borders("borderInlineEnd"),borderBottom:Q.borders("borderBottom"),borderBlockEnd:Q.borders("borderBlockEnd"),borderBottomLeftRadius:Q.radii("borderBottomLeftRadius"),borderBottomRightRadius:Q.radii("borderBottomRightRadius"),borderLeft:Q.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:Q.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:Q.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:Q.borders(["borderLeft","borderRight"]),borderInline:Q.borders("borderInline"),borderY:Q.borders(["borderTop","borderBottom"]),borderBlock:Q.borders("borderBlock"),borderTopWidth:Q.borderWidths("borderTopWidth"),borderBlockStartWidth:Q.borderWidths("borderBlockStartWidth"),borderTopColor:Q.colors("borderTopColor"),borderBlockStartColor:Q.colors("borderBlockStartColor"),borderTopStyle:Q.borderStyles("borderTopStyle"),borderBlockStartStyle:Q.borderStyles("borderBlockStartStyle"),borderBottomWidth:Q.borderWidths("borderBottomWidth"),borderBlockEndWidth:Q.borderWidths("borderBlockEndWidth"),borderBottomColor:Q.colors("borderBottomColor"),borderBlockEndColor:Q.colors("borderBlockEndColor"),borderBottomStyle:Q.borderStyles("borderBottomStyle"),borderBlockEndStyle:Q.borderStyles("borderBlockEndStyle"),borderLeftWidth:Q.borderWidths("borderLeftWidth"),borderInlineStartWidth:Q.borderWidths("borderInlineStartWidth"),borderLeftColor:Q.colors("borderLeftColor"),borderInlineStartColor:Q.colors("borderInlineStartColor"),borderLeftStyle:Q.borderStyles("borderLeftStyle"),borderInlineStartStyle:Q.borderStyles("borderInlineStartStyle"),borderRightWidth:Q.borderWidths("borderRightWidth"),borderInlineEndWidth:Q.borderWidths("borderInlineEndWidth"),borderRightColor:Q.colors("borderRightColor"),borderInlineEndColor:Q.colors("borderInlineEndColor"),borderRightStyle:Q.borderStyles("borderRightStyle"),borderInlineEndStyle:Q.borderStyles("borderInlineEndStyle"),borderTopRadius:Q.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:Q.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:Q.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:Q.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(Lt,{rounded:Lt.borderRadius,roundedTop:Lt.borderTopRadius,roundedTopLeft:Lt.borderTopLeftRadius,roundedTopRight:Lt.borderTopRightRadius,roundedTopStart:Lt.borderStartStartRadius,roundedTopEnd:Lt.borderStartEndRadius,roundedBottom:Lt.borderBottomRadius,roundedBottomLeft:Lt.borderBottomLeftRadius,roundedBottomRight:Lt.borderBottomRightRadius,roundedBottomStart:Lt.borderEndStartRadius,roundedBottomEnd:Lt.borderEndEndRadius,roundedLeft:Lt.borderLeftRadius,roundedRight:Lt.borderRightRadius,roundedStart:Lt.borderInlineStartRadius,roundedEnd:Lt.borderInlineEndRadius,borderStart:Lt.borderInlineStart,borderEnd:Lt.borderInlineEnd,borderTopStartRadius:Lt.borderStartStartRadius,borderTopEndRadius:Lt.borderStartEndRadius,borderBottomStartRadius:Lt.borderEndStartRadius,borderBottomEndRadius:Lt.borderEndEndRadius,borderStartRadius:Lt.borderInlineStartRadius,borderEndRadius:Lt.borderInlineEndRadius,borderStartWidth:Lt.borderInlineStartWidth,borderEndWidth:Lt.borderInlineEndWidth,borderStartColor:Lt.borderInlineStartColor,borderEndColor:Lt.borderInlineEndColor,borderStartStyle:Lt.borderInlineStartStyle,borderEndStyle:Lt.borderInlineEndStyle});var h4e={color:Q.colors("color"),textColor:Q.colors("color"),fill:Q.colors("fill"),stroke:Q.colors("stroke")},B5={boxShadow:Q.shadows("boxShadow"),mixBlendMode:!0,blendMode:Q.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:Q.prop("backgroundBlendMode"),opacity:!0};Object.assign(B5,{shadow:B5.boxShadow});var p4e={filter:{transform:Ot.filter},blur:Q.blur("--chakra-blur"),brightness:Q.propT("--chakra-brightness",Ot.brightness),contrast:Q.propT("--chakra-contrast",Ot.contrast),hueRotate:Q.degreeT("--chakra-hue-rotate"),invert:Q.propT("--chakra-invert",Ot.invert),saturate:Q.propT("--chakra-saturate",Ot.saturate),dropShadow:Q.propT("--chakra-drop-shadow",Ot.dropShadow),backdropFilter:{transform:Ot.backdropFilter},backdropBlur:Q.blur("--chakra-backdrop-blur"),backdropBrightness:Q.propT("--chakra-backdrop-brightness",Ot.brightness),backdropContrast:Q.propT("--chakra-backdrop-contrast",Ot.contrast),backdropHueRotate:Q.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:Q.propT("--chakra-backdrop-invert",Ot.invert),backdropSaturate:Q.propT("--chakra-backdrop-saturate",Ot.saturate)},v_={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Ot.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:Q.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:Q.space("gap"),rowGap:Q.space("rowGap"),columnGap:Q.space("columnGap")};Object.assign(v_,{flexDir:v_.flexDirection});var PV={gridGap:Q.space("gridGap"),gridColumnGap:Q.space("gridColumnGap"),gridRowGap:Q.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},g4e={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Ot.outline},outlineOffset:!0,outlineColor:Q.colors("outlineColor")},xo={width:Q.sizesT("width"),inlineSize:Q.sizesT("inlineSize"),height:Q.sizes("height"),blockSize:Q.sizes("blockSize"),boxSize:Q.sizes(["width","height"]),minWidth:Q.sizes("minWidth"),minInlineSize:Q.sizes("minInlineSize"),minHeight:Q.sizes("minHeight"),minBlockSize:Q.sizes("minBlockSize"),maxWidth:Q.sizes("maxWidth"),maxInlineSize:Q.sizes("maxInlineSize"),maxHeight:Q.sizes("maxHeight"),maxBlockSize:Q.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:Q.propT("float",Ot.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(xo,{w:xo.width,h:xo.height,minW:xo.minWidth,maxW:xo.maxWidth,minH:xo.minHeight,maxH:xo.maxHeight,overscroll:xo.overscrollBehavior,overscrollX:xo.overscrollBehaviorX,overscrollY:xo.overscrollBehaviorY});var m4e={listStyleType:!0,listStylePosition:!0,listStylePos:Q.prop("listStylePosition"),listStyleImage:!0,listStyleImg:Q.prop("listStyleImage")};function y4e(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},_4e=v4e(y4e),b4e={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},S4e={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},aC=(e,t,n)=>{const r={},i=_4e(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},w4e={srOnly:{transform(e){return e===!0?b4e:e==="focusable"?S4e:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>aC(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>aC(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>aC(t,e,n)}},Gp={position:!0,pos:Q.prop("position"),zIndex:Q.prop("zIndex","zIndices"),inset:Q.spaceT("inset"),insetX:Q.spaceT(["left","right"]),insetInline:Q.spaceT("insetInline"),insetY:Q.spaceT(["top","bottom"]),insetBlock:Q.spaceT("insetBlock"),top:Q.spaceT("top"),insetBlockStart:Q.spaceT("insetBlockStart"),bottom:Q.spaceT("bottom"),insetBlockEnd:Q.spaceT("insetBlockEnd"),left:Q.spaceT("left"),insetInlineStart:Q.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:Q.spaceT("right"),insetInlineEnd:Q.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Gp,{insetStart:Gp.insetInlineStart,insetEnd:Gp.insetInlineEnd});var x4e={ring:{transform:Ot.ring},ringColor:Q.colors("--chakra-ring-color"),ringOffset:Q.prop("--chakra-ring-offset-width"),ringOffsetColor:Q.colors("--chakra-ring-offset-color"),ringInset:Q.prop("--chakra-ring-inset")},dn={margin:Q.spaceT("margin"),marginTop:Q.spaceT("marginTop"),marginBlockStart:Q.spaceT("marginBlockStart"),marginRight:Q.spaceT("marginRight"),marginInlineEnd:Q.spaceT("marginInlineEnd"),marginBottom:Q.spaceT("marginBottom"),marginBlockEnd:Q.spaceT("marginBlockEnd"),marginLeft:Q.spaceT("marginLeft"),marginInlineStart:Q.spaceT("marginInlineStart"),marginX:Q.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:Q.spaceT("marginInline"),marginY:Q.spaceT(["marginTop","marginBottom"]),marginBlock:Q.spaceT("marginBlock"),padding:Q.space("padding"),paddingTop:Q.space("paddingTop"),paddingBlockStart:Q.space("paddingBlockStart"),paddingRight:Q.space("paddingRight"),paddingBottom:Q.space("paddingBottom"),paddingBlockEnd:Q.space("paddingBlockEnd"),paddingLeft:Q.space("paddingLeft"),paddingInlineStart:Q.space("paddingInlineStart"),paddingInlineEnd:Q.space("paddingInlineEnd"),paddingX:Q.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:Q.space("paddingInline"),paddingY:Q.space(["paddingTop","paddingBottom"]),paddingBlock:Q.space("paddingBlock")};Object.assign(dn,{m:dn.margin,mt:dn.marginTop,mr:dn.marginRight,me:dn.marginInlineEnd,marginEnd:dn.marginInlineEnd,mb:dn.marginBottom,ml:dn.marginLeft,ms:dn.marginInlineStart,marginStart:dn.marginInlineStart,mx:dn.marginX,my:dn.marginY,p:dn.padding,pt:dn.paddingTop,py:dn.paddingY,px:dn.paddingX,pb:dn.paddingBottom,pl:dn.paddingLeft,ps:dn.paddingInlineStart,paddingStart:dn.paddingInlineStart,pr:dn.paddingRight,pe:dn.paddingInlineEnd,paddingEnd:dn.paddingInlineEnd});var C4e={textDecorationColor:Q.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:Q.shadows("textShadow")},T4e={clipPath:!0,transform:Q.propT("transform",Ot.transform),transformOrigin:!0,translateX:Q.spaceT("--chakra-translate-x"),translateY:Q.spaceT("--chakra-translate-y"),skewX:Q.degreeT("--chakra-skew-x"),skewY:Q.degreeT("--chakra-skew-y"),scaleX:Q.prop("--chakra-scale-x"),scaleY:Q.prop("--chakra-scale-y"),scale:Q.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:Q.degreeT("--chakra-rotate")},E4e={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:Q.prop("transitionDuration","transition.duration"),transitionProperty:Q.prop("transitionProperty","transition.property"),transitionTimingFunction:Q.prop("transitionTimingFunction","transition.easing")},A4e={fontFamily:Q.prop("fontFamily","fonts"),fontSize:Q.prop("fontSize","fontSizes",Ot.px),fontWeight:Q.prop("fontWeight","fontWeights"),lineHeight:Q.prop("lineHeight","lineHeights"),letterSpacing:Q.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},P4e={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:Q.spaceT("scrollMargin"),scrollMarginTop:Q.spaceT("scrollMarginTop"),scrollMarginBottom:Q.spaceT("scrollMarginBottom"),scrollMarginLeft:Q.spaceT("scrollMarginLeft"),scrollMarginRight:Q.spaceT("scrollMarginRight"),scrollMarginX:Q.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:Q.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:Q.spaceT("scrollPadding"),scrollPaddingTop:Q.spaceT("scrollPaddingTop"),scrollPaddingBottom:Q.spaceT("scrollPaddingBottom"),scrollPaddingLeft:Q.spaceT("scrollPaddingLeft"),scrollPaddingRight:Q.spaceT("scrollPaddingRight"),scrollPaddingX:Q.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:Q.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function RV(e){return La(e)&&e.reference?e.reference:String(e)}var h2=(e,...t)=>t.map(RV).join(` ${e} `).replace(/calc/g,""),sI=(...e)=>`calc(${h2("+",...e)})`,aI=(...e)=>`calc(${h2("-",...e)})`,U5=(...e)=>`calc(${h2("*",...e)})`,lI=(...e)=>`calc(${h2("/",...e)})`,uI=e=>{const t=RV(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:U5(t,-1)},Wu=Object.assign(e=>({add:(...t)=>Wu(sI(e,...t)),subtract:(...t)=>Wu(aI(e,...t)),multiply:(...t)=>Wu(U5(e,...t)),divide:(...t)=>Wu(lI(e,...t)),negate:()=>Wu(uI(e)),toString:()=>e.toString()}),{add:sI,subtract:aI,multiply:U5,divide:lI,negate:uI});function R4e(e,t="-"){return e.replace(/\s+/g,t)}function O4e(e){const t=R4e(e.toString());return I4e(k4e(t))}function k4e(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function I4e(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function M4e(e,t=""){return[t,e].filter(Boolean).join("-")}function N4e(e,t){return`var(${e}${t?`, ${t}`:""})`}function L4e(e,t=""){return O4e(`--${M4e(e,t)}`)}function z5(e,t,n){const r=L4e(e,n);return{variable:r,reference:N4e(r,t)}}function UMe(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=z5(`${e}-${i}`,o);continue}n[r]=z5(`${e}-${r}`)}return n}function D4e(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function $4e(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function V5(e){if(e==null)return e;const{unitless:t}=$4e(e);return t||typeof e=="number"?`${e}px`:e}var OV=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,lA=e=>Object.fromEntries(Object.entries(e).sort(OV));function cI(e){const t=lA(e);return Object.assign(Object.values(t),t)}function F4e(e){const t=Object.keys(lA(e));return new Set(t)}function dI(e){var t;if(!e)return e;e=(t=V5(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function Rp(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${V5(e)})`),t&&n.push("and",`(max-width: ${V5(t)})`),n.join(" ")}function B4e(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=cI(e),r=Object.entries(e).sort(OV).map(([s,a],l,u)=>{var d;let[,f]=(d=u[l+1])!=null?d:[];return f=parseFloat(f)>0?dI(f):void 0,{_minW:dI(a),breakpoint:s,minW:a,maxW:f,maxWQuery:Rp(null,f),minWQuery:Rp(a),minMaxQuery:Rp(a,f)}}),i=F4e(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const a=Object.keys(s);return a.length>0&&a.every(l=>i.has(l))},asObject:lA(e),asArray:cI(e),details:r,get(s){return r.find(a=>a.breakpoint===s)},media:[null,...n.map(s=>Rp(s)).slice(1)],toArrayValue(s){if(!La(s))throw new Error("toArrayValue: value must be an object");const a=o.map(l=>{var u;return(u=s[l])!=null?u:null});for(;D4e(a)===null;)a.pop();return a},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((a,l,u)=>{const d=o[u];return d!=null&&l!=null&&(a[d]=l),a},{})}}}var Dr={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},vl=e=>kV(t=>e(t,"&"),"[role=group]","[data-group]",".group"),ba=e=>kV(t=>e(t,"~ &"),"[data-peer]",".peer"),kV=(e,...t)=>t.map(e).join(", "),p2={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:vl(Dr.hover),_peerHover:ba(Dr.hover),_groupFocus:vl(Dr.focus),_peerFocus:ba(Dr.focus),_groupFocusVisible:vl(Dr.focusVisible),_peerFocusVisible:ba(Dr.focusVisible),_groupActive:vl(Dr.active),_peerActive:ba(Dr.active),_groupDisabled:vl(Dr.disabled),_peerDisabled:ba(Dr.disabled),_groupInvalid:vl(Dr.invalid),_peerInvalid:ba(Dr.invalid),_groupChecked:vl(Dr.checked),_peerChecked:ba(Dr.checked),_groupFocusWithin:vl(Dr.focusWithin),_peerFocusWithin:ba(Dr.focusWithin),_peerPlaceholderShown:ba(Dr.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},IV=Object.keys(p2);function fI(e,t){return z5(String(e).replace(/\./g,"-"),void 0,t)}function U4e(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:s,value:a}=o,{variable:l,reference:u}=fI(i,t==null?void 0:t.cssVarPrefix);if(!s){if(i.startsWith("space")){const h=i.split("."),[g,...m]=h,v=`${g}.-${m.join(".")}`,x=Wu.negate(a),_=Wu.negate(u);r[v]={value:x,var:l,varRef:_}}n[l]=a,r[i]={value:a,var:l,varRef:u};continue}const d=h=>{const m=[String(i).split(".")[0],h].join(".");if(!e[m])return h;const{reference:x}=fI(m,t==null?void 0:t.cssVarPrefix);return x},f=La(a)?a:{default:a};n=Us(n,Object.entries(f).reduce((h,[g,m])=>{var v,x;if(!m)return h;const _=d(`${m}`);if(g==="default")return h[l]=_,h;const b=(x=(v=p2)==null?void 0:v[g])!=null?x:g;return h[b]={[l]:_},h},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function z4e(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function V4e(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function j4e(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function hI(e,t,n={}){const{stop:r,getKey:i}=n;function o(s,a=[]){var l;if(j4e(s)||Array.isArray(s)){const u={};for(const[d,f]of Object.entries(s)){const h=(l=i==null?void 0:i(d))!=null?l:d,g=[...a,h];if(r!=null&&r(s,g))return t(s,a);u[h]=o(f,g)}return u}return t(s,a)}return o(e)}var G4e=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function H4e(e){return V4e(e,G4e)}function W4e(e){return e.semanticTokens}function q4e(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var K4e=e=>IV.includes(e)||e==="default";function X4e({tokens:e,semanticTokens:t}){const n={};return hI(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),hI(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(K4e)}),n}function zMe(e){var t;const n=q4e(e),r=H4e(n),i=W4e(n),o=X4e({tokens:r,semanticTokens:i}),s=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:a,cssVars:l}=U4e(o,{cssVarPrefix:s});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:a,__breakpoints:B4e(n.breakpoints)}),n}var uA=Us({},zv,Lt,h4e,v_,xo,p4e,x4e,g4e,PV,w4e,Gp,B5,dn,P4e,A4e,C4e,T4e,m4e,E4e),Y4e=Object.assign({},dn,xo,v_,PV,Gp),VMe=Object.keys(Y4e),Q4e=[...Object.keys(uA),...IV],Z4e={...uA,...p2},J4e=e=>e in Z4e,eTe=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const s in e){let a=Ju(e[s],t);if(a==null)continue;if(a=La(a)&&n(a)?r(a):a,!Array.isArray(a)){o[s]=a;continue}const l=a.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!nTe(t),iTe=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,d;return(d=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:d.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[s,a]=tTe(t);return t=(r=(n=i(s))!=null?n:o(a))!=null?r:o(t),t};function oTe(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,s=!1)=>{var a,l,u;const d=Ju(o,r),f=eTe(d)(r);let h={};for(let g in f){const m=f[g];let v=Ju(m,r);g in n&&(g=n[g]),rTe(g,v)&&(v=iTe(r,v));let x=t[g];if(x===!0&&(x={property:g}),La(v)){h[g]=(a=h[g])!=null?a:{},h[g]=Us({},h[g],i(v,!0));continue}let _=(u=(l=x==null?void 0:x.transform)==null?void 0:l.call(x,v,r,d))!=null?u:v;_=x!=null&&x.processResult?i(_,!0):_;const b=Ju(x==null?void 0:x.property,r);if(!s&&(x!=null&&x.static)){const y=Ju(x.static,r);h=Us({},h,y)}if(b&&Array.isArray(b)){for(const y of b)h[y]=_;continue}if(b){b==="&"&&La(_)?h=Us({},h,_):h[b]=_;continue}if(La(_)){h=Us({},h,_);continue}h[g]=_}return h};return i}var sTe=e=>t=>oTe({theme:t,pseudos:p2,configs:uA})(e);function jMe(e){return e}function GMe(e){return e}function HMe(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function aTe(e,t){if(Array.isArray(e))return e;if(La(e))return t(e);if(e!=null)return[e]}function lTe(e,t){for(let n=t+1;n{Us(u,{[y]:h?b[y]:{[_]:b[y]}})});continue}if(!g){h?Us(u,b):u[_]=b;continue}u[_]=b}}return u}}function cTe(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,s=uTe(o);return Us({},Ju((n=e.baseStyle)!=null?n:{},t),s(e,"sizes",i,t),s(e,"variants",r,t))}}function WMe(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function MV(e){return z4e(e,["styleConfig","size","variant","colorScheme"])}function dTe(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function fTe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},pTe=hTe(fTe);function NV(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var LV=e=>NV(e,t=>t!=null);function gTe(e){return typeof e=="function"}function mTe(e,...t){return gTe(e)?e(...t):e}function qMe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var yTe=typeof Element<"u",vTe=typeof Map=="function",_Te=typeof Set=="function",bTe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Vv(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Vv(e[r],t[r]))return!1;return!0}var o;if(vTe&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!Vv(r.value[1],t.get(r.value[0])))return!1;return!0}if(_Te&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(bTe&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(yTe&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!Vv(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var STe=function(t,n){try{return Vv(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const wTe=Tc(STe);function DV(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:s}=G5e(),a=e?pTe(o,`components.${e}`):void 0,l=r||a,u=Us({theme:o,colorMode:s},(n=l==null?void 0:l.defaultProps)!=null?n:{},LV(dTe(i,["children"]))),d=L.useRef({});if(l){const h=cTe(l)(u);wTe(d.current,h)||(d.current=h)}return d.current}function $V(e,t={}){return DV(e,t)}function KMe(e,t={}){return DV(e,t)}var xTe=new Set([...Q4e,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),CTe=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function TTe(e){return CTe.has(e)||!xTe.has(e)}function ETe(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}var ATe=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,PTe=mV(function(e){return ATe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),RTe=PTe,OTe=function(t){return t!=="theme"},pI=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?RTe:OTe},gI=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(s){return t.__emotion_forwardProp(s)&&o(s)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},kTe=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return vV(n,r,i),F5e(function(){return _V(n,r,i)}),null},ITe=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,s;n!==void 0&&(o=n.label,s=n.target);var a=gI(t,n,r),l=a||pI(i),u=!l("as");return function(){var d=arguments,f=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&f.push("label:"+o+";"),d[0]==null||d[0].raw===void 0)f.push.apply(f,d);else{f.push(d[0][0]);for(var h=d.length,g=1;gt=>{const{theme:n,css:r,__css:i,sx:o,...s}=t,a=NV(s,(f,h)=>J4e(h)),l=mTe(e,t),u=ETe({},i,l,LV(a),o),d=sTe(u)(t.theme);return r?[d,r]:d};function lC(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=TTe);const i=LTe({baseStyle:n}),o=NTe(e,r)(i);return jt.forwardRef(function(l,u){const{colorMode:d,forced:f}=sA();return jt.createElement(o,{ref:u,"data-theme":f?d:void 0,...l})})}function DTe(){const e=new Map;return new Proxy(lC,{apply(t,n,r){return lC(...r)},get(t,n){return e.has(n)||e.set(n,lC(n)),e.get(n)}})}var Cc=DTe();function zc(e){return L.forwardRef(e)}const FV=L.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),g2=L.createContext({}),Km=L.createContext(null),m2=typeof document<"u",b_=m2?L.useLayoutEffect:L.useEffect,BV=L.createContext({strict:!1});function $Te(e,t,n,r){const{visualElement:i}=L.useContext(g2),o=L.useContext(BV),s=L.useContext(Km),a=L.useContext(FV).reducedMotion,l=L.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:a}));const u=l.current;return L.useInsertionEffect(()=>{u&&u.update(n,s)}),b_(()=>{u&&u.render()}),L.useEffect(()=>{u&&u.updateFeatures()}),(window.HandoffAppearAnimations?b_:L.useEffect)(()=>{u&&u.animationState&&u.animationState.animateChanges()}),u}function Xd(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function FTe(e,t,n){return L.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Xd(n)&&(n.current=r))},[t])}function nm(e){return typeof e=="string"||Array.isArray(e)}function y2(e){return typeof e=="object"&&typeof e.start=="function"}const cA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],dA=["initial",...cA];function v2(e){return y2(e.animate)||dA.some(t=>nm(e[t]))}function UV(e){return!!(v2(e)||e.variants)}function BTe(e,t){if(v2(e)){const{initial:n,animate:r}=e;return{initial:n===!1||nm(n)?n:void 0,animate:nm(r)?r:void 0}}return e.inherit!==!1?t:{}}function UTe(e){const{initial:t,animate:n}=BTe(e,L.useContext(g2));return L.useMemo(()=>({initial:t,animate:n}),[yI(t),yI(n)])}function yI(e){return Array.isArray(e)?e.join(" "):e}const vI={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},rm={};for(const e in vI)rm[e]={isEnabled:t=>vI[e].some(n=>!!t[n])};function zTe(e){for(const t in e)rm[t]={...rm[t],...e[t]}}const fA=L.createContext({}),zV=L.createContext({}),VTe=Symbol.for("motionComponentSymbol");function jTe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&zTe(e);function o(a,l){let u;const d={...L.useContext(FV),...a,layoutId:GTe(a)},{isStatic:f}=d,h=UTe(a),g=r(a,f);if(!f&&m2){h.visualElement=$Te(i,g,d,t);const m=L.useContext(zV),v=L.useContext(BV).strict;h.visualElement&&(u=h.visualElement.loadFeatures(d,v,e,m))}return L.createElement(g2.Provider,{value:h},u&&h.visualElement?L.createElement(u,{visualElement:h.visualElement,...d}):null,n(i,a,FTe(g,h.visualElement,l),g,f,h.visualElement))}const s=L.forwardRef(o);return s[VTe]=i,s}function GTe({layoutId:e}){const t=L.useContext(fA).id;return t&&e!==void 0?t+"-"+e:e}function HTe(e){function t(r,i={}){return jTe(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const WTe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function hA(e){return typeof e!="string"||e.includes("-")?!1:!!(WTe.indexOf(e)>-1||/[A-Z]/.test(e))}const S_={};function qTe(e){Object.assign(S_,e)}const Xm=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Vc=new Set(Xm);function VV(e,{layout:t,layoutId:n}){return Vc.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!S_[e]||e==="opacity")}const zi=e=>!!(e&&e.getVelocity),KTe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},XTe=Xm.length;function YTe(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let s=0;st=>typeof t=="string"&&t.startsWith(e),GV=jV("--"),j5=jV("var(--"),QTe=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,ZTe=(e,t)=>t&&typeof e=="number"?t.transform(e):e,au=(e,t,n)=>Math.min(Math.max(n,e),t),jc={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Hp={...jc,transform:e=>au(0,1,e)},rv={...jc,default:1},Wp=e=>Math.round(e*1e5)/1e5,_2=/(-)?([\d]*\.?[\d])+/g,HV=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,JTe=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Ym(e){return typeof e=="string"}const Qm=e=>({test:t=>Ym(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),bl=Qm("deg"),qs=Qm("%"),He=Qm("px"),eEe=Qm("vh"),tEe=Qm("vw"),_I={...qs,parse:e=>qs.parse(e)/100,transform:e=>qs.transform(e*100)},bI={...jc,transform:Math.round},WV={borderWidth:He,borderTopWidth:He,borderRightWidth:He,borderBottomWidth:He,borderLeftWidth:He,borderRadius:He,radius:He,borderTopLeftRadius:He,borderTopRightRadius:He,borderBottomRightRadius:He,borderBottomLeftRadius:He,width:He,maxWidth:He,height:He,maxHeight:He,size:He,top:He,right:He,bottom:He,left:He,padding:He,paddingTop:He,paddingRight:He,paddingBottom:He,paddingLeft:He,margin:He,marginTop:He,marginRight:He,marginBottom:He,marginLeft:He,rotate:bl,rotateX:bl,rotateY:bl,rotateZ:bl,scale:rv,scaleX:rv,scaleY:rv,scaleZ:rv,skew:bl,skewX:bl,skewY:bl,distance:He,translateX:He,translateY:He,translateZ:He,x:He,y:He,z:He,perspective:He,transformPerspective:He,opacity:Hp,originX:_I,originY:_I,originZ:He,zIndex:bI,fillOpacity:Hp,strokeOpacity:Hp,numOctaves:bI};function pA(e,t,n,r){const{style:i,vars:o,transform:s,transformOrigin:a}=e;let l=!1,u=!1,d=!0;for(const f in t){const h=t[f];if(GV(f)){o[f]=h;continue}const g=WV[f],m=ZTe(h,g);if(Vc.has(f)){if(l=!0,s[f]=m,!d)continue;h!==(g.default||0)&&(d=!1)}else f.startsWith("origin")?(u=!0,a[f]=m):i[f]=m}if(t.transform||(l||r?i.transform=YTe(e.transform,n,d,r):i.transform&&(i.transform="none")),u){const{originX:f="50%",originY:h="50%",originZ:g=0}=a;i.transformOrigin=`${f} ${h} ${g}`}}const gA=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function qV(e,t,n){for(const r in t)!zi(t[r])&&!VV(r,n)&&(e[r]=t[r])}function nEe({transformTemplate:e},t,n){return L.useMemo(()=>{const r=gA();return pA(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function rEe(e,t,n){const r=e.style||{},i={};return qV(i,r,e),Object.assign(i,nEe(e,t,n)),e.transformValues?e.transformValues(i):i}function iEe(e,t,n){const r={},i=rEe(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const oEe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function w_(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||oEe.has(e)}let KV=e=>!w_(e);function sEe(e){e&&(KV=t=>t.startsWith("on")?!w_(t):e(t))}try{sEe(require("@emotion/is-prop-valid").default)}catch{}function aEe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(KV(i)||n===!0&&w_(i)||!t&&!w_(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function SI(e,t,n){return typeof e=="string"?e:He.transform(t+n*e)}function lEe(e,t,n){const r=SI(t,e.x,e.width),i=SI(n,e.y,e.height);return`${r} ${i}`}const uEe={offset:"stroke-dashoffset",array:"stroke-dasharray"},cEe={offset:"strokeDashoffset",array:"strokeDasharray"};function dEe(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?uEe:cEe;e[o.offset]=He.transform(-r);const s=He.transform(t),a=He.transform(n);e[o.array]=`${s} ${a}`}function mA(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...u},d,f,h){if(pA(e,u,d,h),f){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:m,dimensions:v}=e;g.transform&&(v&&(m.transform=g.transform),delete g.transform),v&&(i!==void 0||o!==void 0||m.transform)&&(m.transformOrigin=lEe(v,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(g.x=t),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),s!==void 0&&dEe(g,s,a,l,!1)}const XV=()=>({...gA(),attrs:{}}),yA=e=>typeof e=="string"&&e.toLowerCase()==="svg";function fEe(e,t,n,r){const i=L.useMemo(()=>{const o=XV();return mA(o,t,{enableHardwareAcceleration:!1},yA(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};qV(o,e.style,e),i.style={...o,...i.style}}return i}function hEe(e=!1){return(n,r,i,{latestValues:o},s)=>{const l=(hA(n)?fEe:iEe)(r,o,s,n),d={...aEe(r,typeof n=="string",e),...l,ref:i},{children:f}=r,h=L.useMemo(()=>zi(f)?f.get():f,[f]);return L.createElement(n,{...d,children:h})}}const vA=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function YV(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const QV=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function ZV(e,t,n,r){YV(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(QV.has(i)?i:vA(i),t.attrs[i])}function _A(e,t){const{style:n}=e,r={};for(const i in n)(zi(n[i])||t.style&&zi(t.style[i])||VV(i,e))&&(r[i]=n[i]);return r}function JV(e,t){const n=_A(e,t);for(const r in e)if(zi(e[r])||zi(t[r])){const i=Xm.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function bA(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function ej(e){const t=L.useRef(null);return t.current===null&&(t.current=e()),t.current}const x_=e=>Array.isArray(e),pEe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),gEe=e=>x_(e)?e[e.length-1]||0:e;function jv(e){const t=zi(e)?e.get():e;return pEe(t)?t.toValue():t}function mEe({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const s={latestValues:yEe(r,i,o,e),renderState:t()};return n&&(s.mount=a=>n(r,a,s)),s}const tj=e=>(t,n)=>{const r=L.useContext(g2),i=L.useContext(Km),o=()=>mEe(e,t,r,i);return n?o():ej(o)};function yEe(e,t,n,r){const i={},o=r(e,{});for(const h in o)i[h]=jv(o[h]);let{initial:s,animate:a}=e;const l=v2(e),u=UV(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let d=n?n.initial===!1:!1;d=d||s===!1;const f=d?a:s;return f&&typeof f!="boolean"&&!y2(f)&&(Array.isArray(f)?f:[f]).forEach(g=>{const m=bA(e,g);if(!m)return;const{transitionEnd:v,transition:x,..._}=m;for(const b in _){let y=_[b];if(Array.isArray(y)){const S=d?y.length-1:0;y=y[S]}y!==null&&(i[b]=y)}for(const b in v)i[b]=v[b]}),i}const vEe={useVisualState:tj({scrapeMotionValuesFromProps:JV,createRenderState:XV,onMount:(e,t,{renderState:n,latestValues:r})=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}mA(n,r,{enableHardwareAcceleration:!1},yA(t.tagName),e.transformTemplate),ZV(t,n)}})},_Ee={useVisualState:tj({scrapeMotionValuesFromProps:_A,createRenderState:gA})};function bEe(e,{forwardMotionProps:t=!1},n,r){return{...hA(e)?vEe:_Ee,preloadedFeatures:n,useRender:hEe(t),createVisualElement:r,Component:e}}function ka(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const nj=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function b2(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const SEe=e=>t=>nj(t)&&e(t,b2(t));function Da(e,t,n,r){return ka(e,t,SEe(n),r)}const wEe=(e,t)=>n=>t(e(n)),ql=(...e)=>e.reduce(wEe);function rj(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const wI=rj("dragHorizontal"),xI=rj("dragVertical");function ij(e){let t=!1;if(e==="y")t=xI();else if(e==="x")t=wI();else{const n=wI(),r=xI();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function oj(){const e=ij(!0);return e?(e(),!1):!0}class xu{constructor(t){this.isMounted=!1,this.node=t}update(){}}const tr=e=>e;function xEe(e){let t=[],n=[],r=0,i=!1,o=!1;const s=new WeakSet,a={schedule:(l,u=!1,d=!1)=>{const f=d&&i,h=f?t:n;return u&&s.add(l),h.indexOf(l)===-1&&(h.push(l),f&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),s.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(f[h]=xEe(()=>n=!0),f),{}),s=f=>o[f].process(i),a=f=>{n=!1,i.delta=r?1e3/60:Math.max(Math.min(f-i.timestamp,CEe),1),i.timestamp=f,i.isProcessing=!0,iv.forEach(s),i.isProcessing=!1,n&&t&&(r=!1,e(a))},l=()=>{n=!0,r=!0,i.isProcessing||e(a)};return{schedule:iv.reduce((f,h)=>{const g=o[h];return f[h]=(m,v=!1,x=!1)=>(n||l(),g.schedule(m,v,x)),f},{}),cancel:f=>iv.forEach(h=>o[h].cancel(f)),state:i,steps:o}}const{schedule:Sn,cancel:Wa,state:Zr,steps:uC}=TEe(typeof requestAnimationFrame<"u"?requestAnimationFrame:tr,!0);function CI(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,s)=>{if(o.type==="touch"||oj())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t),a[r]&&Sn.update(()=>a[r](o,s))};return Da(e.current,n,i,{passive:!e.getProps()[r]})}class EEe extends xu{mount(){this.unmount=ql(CI(this.node,!0),CI(this.node,!1))}unmount(){}}class AEe extends xu{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ql(ka(this.node.current,"focus",()=>this.onFocus()),ka(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const sj=(e,t)=>t?e===t?!0:sj(e,t.parentElement):!1;function cC(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,b2(n))}class PEe extends xu{constructor(){super(...arguments),this.removeStartListeners=tr,this.removeEndListeners=tr,this.removeAccessibleListeners=tr,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Da(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:d}=this.node.getProps();Sn.update(()=>{sj(this.node.current,a.target)?u&&u(a,l):d&&d(a,l)})},{passive:!(r.onTap||r.onPointerUp)}),s=Da(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=ql(o,s),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const s=a=>{a.key!=="Enter"||!this.checkPressEnd()||cC("up",(l,u)=>{const{onTap:d}=this.node.getProps();d&&Sn.update(()=>d(l,u))})};this.removeEndListeners(),this.removeEndListeners=ka(this.node.current,"keyup",s),cC("down",(a,l)=>{this.startPress(a,l)})},n=ka(this.node.current,"keydown",t),r=()=>{this.isPressing&&cC("cancel",(o,s)=>this.cancelPress(o,s))},i=ka(this.node.current,"blur",r);this.removeAccessibleListeners=ql(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Sn.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!oj()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Sn.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Da(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=ka(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=ql(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const G5=new WeakMap,dC=new WeakMap,REe=e=>{const t=G5.get(e.target);t&&t(e)},OEe=e=>{e.forEach(REe)};function kEe({root:e,...t}){const n=e||document;dC.has(n)||dC.set(n,{});const r=dC.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(OEe,{root:e,...t})),r[i]}function IEe(e,t,n){const r=kEe(t);return G5.set(e,n),r.observe(e),()=>{G5.delete(e),r.unobserve(e)}}const MEe={some:0,all:1};class NEe extends xu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:MEe[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(l)};return IEe(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(LEe(t,n))&&this.startObserver()}unmount(){}}function LEe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const DEe={inView:{Feature:NEe},tap:{Feature:PEe},focus:{Feature:AEe},hover:{Feature:EEe}};function aj(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function FEe(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function S2(e,t,n){const r=e.getProps();return bA(r,t,n!==void 0?n:r.custom,$Ee(e),FEe(e))}const BEe="framerAppearId",UEe="data-"+vA(BEe);let zEe=tr,SA=tr;const Kl=e=>e*1e3,$a=e=>e/1e3,VEe={current:!1},lj=e=>Array.isArray(e)&&typeof e[0]=="number";function uj(e){return!!(!e||typeof e=="string"&&cj[e]||lj(e)||Array.isArray(e)&&e.every(uj))}const Op=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,cj={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Op([0,.65,.55,1]),circOut:Op([.55,0,1,.45]),backIn:Op([.31,.01,.66,-.59]),backOut:Op([.33,1.53,.69,.99])};function dj(e){if(e)return lj(e)?Op(e):Array.isArray(e)?e.map(dj):cj[e]}function jEe(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:s="loop",ease:a,times:l}={}){const u={[t]:n};l&&(u.offset=l);const d=dj(a);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"})}const TI={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},fC={},fj={};for(const e in TI)fj[e]=()=>(fC[e]===void 0&&(fC[e]=TI[e]()),fC[e]);function GEe(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const hj=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,HEe=1e-7,WEe=12;function qEe(e,t,n,r,i){let o,s,a=0;do s=t+(n-t)/2,o=hj(s,r,i)-e,o>0?n=s:t=s;while(Math.abs(o)>HEe&&++aqEe(o,0,1,e,n);return o=>o===0||o===1?o:hj(i(o),t,r)}const KEe=Zm(.42,0,1,1),XEe=Zm(0,0,.58,1),pj=Zm(.42,0,.58,1),YEe=e=>Array.isArray(e)&&typeof e[0]!="number",gj=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,mj=e=>t=>1-e(1-t),yj=e=>1-Math.sin(Math.acos(e)),wA=mj(yj),QEe=gj(wA),vj=Zm(.33,1.53,.69,.99),xA=mj(vj),ZEe=gj(xA),JEe=e=>(e*=2)<1?.5*xA(e):.5*(2-Math.pow(2,-10*(e-1))),eAe={linear:tr,easeIn:KEe,easeInOut:pj,easeOut:XEe,circIn:yj,circInOut:QEe,circOut:wA,backIn:xA,backInOut:ZEe,backOut:vj,anticipate:JEe},EI=e=>{if(Array.isArray(e)){SA(e.length===4);const[t,n,r,i]=e;return Zm(t,n,r,i)}else if(typeof e=="string")return eAe[e];return e},CA=(e,t)=>n=>!!(Ym(n)&&JTe.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),_j=(e,t,n)=>r=>{if(!Ym(r))return r;const[i,o,s,a]=r.match(_2);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},tAe=e=>au(0,255,e),hC={...jc,transform:e=>Math.round(tAe(e))},ec={test:CA("rgb","red"),parse:_j("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+hC.transform(e)+", "+hC.transform(t)+", "+hC.transform(n)+", "+Wp(Hp.transform(r))+")"};function nAe(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const H5={test:CA("#"),parse:nAe,transform:ec.transform},Yd={test:CA("hsl","hue"),parse:_j("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+qs.transform(Wp(t))+", "+qs.transform(Wp(n))+", "+Wp(Hp.transform(r))+")"},hi={test:e=>ec.test(e)||H5.test(e)||Yd.test(e),parse:e=>ec.test(e)?ec.parse(e):Yd.test(e)?Yd.parse(e):H5.parse(e),transform:e=>Ym(e)?e:e.hasOwnProperty("red")?ec.transform(e):Yd.transform(e)},Pn=(e,t,n)=>-n*e+n*t+e;function pC(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function rAe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,s=0;if(!t)i=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=pC(l,a,e+1/3),o=pC(l,a,e),s=pC(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}const gC=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},iAe=[H5,ec,Yd],oAe=e=>iAe.find(t=>t.test(e));function AI(e){const t=oAe(e);let n=t.parse(e);return t===Yd&&(n=rAe(n)),n}const bj=(e,t)=>{const n=AI(e),r=AI(t),i={...n};return o=>(i.red=gC(n.red,r.red,o),i.green=gC(n.green,r.green,o),i.blue=gC(n.blue,r.blue,o),i.alpha=Pn(n.alpha,r.alpha,o),ec.transform(i))};function sAe(e){var t,n;return isNaN(e)&&Ym(e)&&(((t=e.match(_2))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(HV))===null||n===void 0?void 0:n.length)||0)>0}const Sj={regex:QTe,countKey:"Vars",token:"${v}",parse:tr},wj={regex:HV,countKey:"Colors",token:"${c}",parse:hi.parse},xj={regex:_2,countKey:"Numbers",token:"${n}",parse:jc.parse};function mC(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function C_(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&mC(n,Sj),mC(n,wj),mC(n,xj),n}function Cj(e){return C_(e).values}function Tj(e){const{values:t,numColors:n,numVars:r,tokenised:i}=C_(e),o=t.length;return s=>{let a=i;for(let l=0;ltypeof e=="number"?0:e;function lAe(e){const t=Cj(e);return Tj(e)(t.map(aAe))}const lu={test:sAe,parse:Cj,createTransformer:Tj,getAnimatableNone:lAe},Ej=(e,t)=>n=>`${n>0?t:e}`;function Aj(e,t){return typeof e=="number"?n=>Pn(e,t,n):hi.test(e)?bj(e,t):e.startsWith("var(")?Ej(e,t):Rj(e,t)}const Pj=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,s)=>Aj(o,t[s]));return o=>{for(let s=0;s{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Aj(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},Rj=(e,t)=>{const n=lu.createTransformer(t),r=C_(e),i=C_(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?ql(Pj(r.values,i.values),n):Ej(e,t)},im=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},PI=(e,t)=>n=>Pn(e,t,n);function cAe(e){return typeof e=="number"?PI:typeof e=="string"?hi.test(e)?bj:Rj:Array.isArray(e)?Pj:typeof e=="object"?uAe:PI}function dAe(e,t,n){const r=[],i=n||cAe(e[0]),o=e.length-1;for(let s=0;st[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=dAe(t,r,i),a=s.length,l=u=>{let d=0;if(a>1)for(;dl(au(e[0],e[o-1],u)):l}function fAe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=im(0,t,r);e.push(Pn(n,1,i))}}function hAe(e){const t=[0];return fAe(t,e.length-1),t}function pAe(e,t){return e.map(n=>n*t)}function gAe(e,t){return e.map(()=>t||pj).splice(0,e.length-1)}function T_({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=YEe(r)?r.map(EI):EI(r),o={done:!1,value:t[0]},s=pAe(n&&n.length===t.length?n:hAe(t),e),a=Oj(s,t,{ease:Array.isArray(i)?i:gAe(t,i)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}function kj(e,t){return t?e*(1e3/t):0}const mAe=5;function Ij(e,t,n){const r=Math.max(t-mAe,0);return kj(n-e(r),t-r)}const yC=.001,yAe=.01,RI=10,vAe=.05,_Ae=1;function bAe({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;zEe(e<=Kl(RI));let s=1-t;s=au(vAe,_Ae,s),e=au(yAe,RI,$a(e)),s<1?(i=u=>{const d=u*s,f=d*e,h=d-n,g=W5(u,s),m=Math.exp(-f);return yC-h/g*m},o=u=>{const f=u*s*e,h=f*n+n,g=Math.pow(s,2)*Math.pow(u,2)*e,m=Math.exp(-f),v=W5(Math.pow(u,2),s);return(-i(u)+yC>0?-1:1)*((h-g)*m)/v}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-yC+d*f},o=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const a=5/e,l=wAe(i,o,a);if(e=Kl(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}const SAe=12;function wAe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function TAe(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!OI(e,CAe)&&OI(e,xAe)){const n=bAe(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function Mj({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],s={done:!1,value:i},{stiffness:a,damping:l,mass:u,velocity:d,duration:f,isResolvedFromDuration:h}=TAe(r),g=d?-$a(d):0,m=l/(2*Math.sqrt(a*u)),v=o-i,x=$a(Math.sqrt(a/u)),_=Math.abs(v)<5;n||(n=_?.01:2),t||(t=_?.005:.5);let b;if(m<1){const y=W5(x,m);b=S=>{const C=Math.exp(-m*x*S);return o-C*((g+m*x*v)/y*Math.sin(y*S)+v*Math.cos(y*S))}}else if(m===1)b=y=>o-Math.exp(-x*y)*(v+(g+x*v)*y);else{const y=x*Math.sqrt(m*m-1);b=S=>{const C=Math.exp(-m*x*S),T=Math.min(y*S,300);return o-C*((g+m*x*v)*Math.sinh(T)+y*v*Math.cosh(T))/y}}return{calculatedDuration:h&&f||null,next:y=>{const S=b(y);if(h)s.done=y>=f;else{let C=g;y!==0&&(m<1?C=Ij(b,y,S):C=0);const T=Math.abs(C)<=n,E=Math.abs(o-S)<=t;s.done=T&&E}return s.value=s.done?o:S,s}}}function kI({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},g=P=>a!==void 0&&Pl,m=P=>a===void 0?l:l===void 0||Math.abs(a-P)-v*Math.exp(-P/r),y=P=>_+b(P),S=P=>{const k=b(P),O=y(P);h.done=Math.abs(k)<=u,h.value=h.done?_:O};let C,T;const E=P=>{g(h.value)&&(C=P,T=Mj({keyframes:[h.value,m(h.value)],velocity:Ij(y,P,h.value),damping:i,stiffness:o,restDelta:u,restSpeed:d}))};return E(0),{calculatedDuration:null,next:P=>{let k=!1;return!T&&C===void 0&&(k=!0,S(P),E(P)),C!==void 0&&P>C?T.next(P-C):(!k&&S(P),h)}}}const EAe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Sn.update(t,!0),stop:()=>Wa(t),now:()=>Zr.isProcessing?Zr.timestamp:performance.now()}},II=2e4;function MI(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=II?1/0:t}const AAe={decay:kI,inertia:kI,tween:T_,keyframes:T_,spring:Mj};function E_({autoplay:e=!0,delay:t=0,driver:n=EAe,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:s=0,repeatType:a="loop",onPlay:l,onStop:u,onComplete:d,onUpdate:f,...h}){let g=1,m=!1,v,x;const _=()=>{x=new Promise(q=>{v=q})};_();let b;const y=AAe[i]||T_;let S;y!==T_&&typeof r[0]!="number"&&(S=Oj([0,100],r,{clamp:!1}),r=[0,100]);const C=y({...h,keyframes:r});let T;a==="mirror"&&(T=y({...h,keyframes:[...r].reverse(),velocity:-(h.velocity||0)}));let E="idle",P=null,k=null,O=null;C.calculatedDuration===null&&o&&(C.calculatedDuration=MI(C));const{calculatedDuration:M}=C;let V=1/0,B=1/0;M!==null&&(V=M+s,B=V*(o+1)-s);let A=0;const N=q=>{if(k===null)return;g>0&&(k=Math.min(k,q)),g<0&&(k=Math.min(q-B/g,k)),P!==null?A=P:A=Math.round(q-k)*g;const Z=A-t*(g>=0?1:-1),ee=g>=0?Z<0:Z>B;A=Math.max(Z,0),E==="finished"&&P===null&&(A=B);let ie=A,se=C;if(o){const fe=A/V;let pe=Math.floor(fe),ve=fe%1;!ve&&fe>=1&&(ve=1),ve===1&&pe--,pe=Math.min(pe,o+1);const ye=!!(pe%2);ye&&(a==="reverse"?(ve=1-ve,s&&(ve-=s/V)):a==="mirror"&&(se=T));let Je=au(0,1,ve);A>B&&(Je=a==="reverse"&&ye?1:0),ie=Je*V}const le=ee?{done:!1,value:r[0]}:se.next(ie);S&&(le.value=S(le.value));let{done:W}=le;!ee&&M!==null&&(W=g>=0?A>=B:A<=0);const ne=P===null&&(E==="finished"||E==="running"&&W);return f&&f(le.value),ne&&$(),le},D=()=>{b&&b.stop(),b=void 0},U=()=>{E="idle",D(),v(),_(),k=O=null},$=()=>{E="finished",d&&d(),D(),v()},j=()=>{if(m)return;b||(b=n(N));const q=b.now();l&&l(),P!==null?k=q-P:(!k||E==="finished")&&(k=q),E==="finished"&&_(),O=k,P=null,E="running",b.start()};e&&j();const G={then(q,Z){return x.then(q,Z)},get time(){return $a(A)},set time(q){q=Kl(q),A=q,P!==null||!b||g===0?P=q:k=b.now()-q/g},get duration(){const q=C.calculatedDuration===null?MI(C):C.calculatedDuration;return $a(q)},get speed(){return g},set speed(q){q===g||!b||(g=q,G.time=$a(A))},get state(){return E},play:j,pause:()=>{E="paused",P=A},stop:()=>{m=!0,E!=="idle"&&(E="idle",u&&u(),U())},cancel:()=>{O!==null&&N(O),U()},complete:()=>{E="finished"},sample:q=>(k=0,N(q))};return G}const PAe=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),ov=10,RAe=2e4,OAe=(e,t)=>t.type==="spring"||e==="backgroundColor"||!uj(t.ease);function kAe(e,t,{onUpdate:n,onComplete:r,...i}){if(!(fj.waapi()&&PAe.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let s=!1,a,l;const u=()=>{l=new Promise(_=>{a=_})};u();let{keyframes:d,duration:f=300,ease:h,times:g}=i;if(OAe(t,i)){const _=E_({...i,repeat:0,delay:0});let b={done:!1,value:d[0]};const y=[];let S=0;for(;!b.done&&Sm.cancel(),x=()=>{Sn.update(v),a(),u()};return m.onfinish=()=>{e.set(GEe(d,i)),r&&r(),x()},{then(_,b){return l.then(_,b)},get time(){return $a(m.currentTime||0)},set time(_){m.currentTime=Kl(_)},get speed(){return m.playbackRate},set speed(_){m.playbackRate=_},get duration(){return $a(f)},play:()=>{s||(m.play(),Wa(v))},pause:()=>m.pause(),stop:()=>{if(s=!0,m.playState==="idle")return;const{currentTime:_}=m;if(_){const b=E_({...i,autoplay:!1});e.setWithVelocity(b.sample(_-ov).value,b.sample(_).value,ov)}x()},complete:()=>m.finish(),cancel:x}}function IAe({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:tr,pause:tr,stop:tr,then:o=>(o(),Promise.resolve()),cancel:tr,complete:tr});return t?E_({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const MAe={type:"spring",stiffness:500,damping:25,restSpeed:10},NAe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),LAe={type:"keyframes",duration:.8},DAe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$Ae=(e,{keyframes:t})=>t.length>2?LAe:Vc.has(e)?e.startsWith("scale")?NAe(t[1]):MAe:DAe,q5=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(lu.test(t)||t==="0")&&!t.startsWith("url(")),FAe=new Set(["brightness","contrast","saturate","opacity"]);function BAe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(_2)||[];if(!r)return e;const i=n.replace(r,"");let o=FAe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const UAe=/([a-z-]*)\(.*?\)/g,K5={...lu,getAnimatableNone:e=>{const t=e.match(UAe);return t?t.map(BAe).join(" "):e}},zAe={...WV,color:hi,backgroundColor:hi,outlineColor:hi,fill:hi,stroke:hi,borderColor:hi,borderTopColor:hi,borderRightColor:hi,borderBottomColor:hi,borderLeftColor:hi,filter:K5,WebkitFilter:K5},TA=e=>zAe[e];function Nj(e,t){let n=TA(e);return n!==K5&&(n=lu),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Lj=e=>/^0[^.\s]+$/.test(e);function VAe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||Lj(e)}function jAe(e,t,n,r){const i=q5(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const s=r.from!==void 0?r.from:e.get();let a;const l=[];for(let u=0;ui=>{const o=Dj(r,e)||{},s=o.delay||r.delay||0;let{elapsed:a=0}=r;a=a-Kl(s);const l=jAe(t,e,n,o),u=l[0],d=l[l.length-1],f=q5(e,u),h=q5(e,d);let g={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-a,onUpdate:m=>{t.set(m),o.onUpdate&&o.onUpdate(m)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(GAe(o)||(g={...g,...$Ae(e,g)}),g.duration&&(g.duration=Kl(g.duration)),g.repeatDelay&&(g.repeatDelay=Kl(g.repeatDelay)),!f||!h||VEe.current||o.type===!1)return IAe(g);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const m=kAe(t,e,g);if(m)return m}return E_(g)};function A_(e){return!!(zi(e)&&e.add)}const HAe=e=>/^\-?\d*\.?\d+$/.test(e);function AA(e,t){e.indexOf(t)===-1&&e.push(t)}function PA(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class RA{constructor(){this.subscriptions=[]}add(t){return AA(this.subscriptions,t),()=>PA(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class qAe{constructor(t,n={}){this.version="10.12.22",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:s}=Zr;this.lastUpdated!==s&&(this.timeDelta=o,this.lastUpdated=s,Sn.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>Sn.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=WAe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new RA);const r=this.events[t].add(n);return t==="change"?()=>{r(),Sn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?kj(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wf(e,t){return new qAe(e,t)}const $j=e=>t=>t.test(e),KAe={test:e=>e==="auto",parse:e=>e},Fj=[jc,He,qs,bl,tEe,eEe,KAe],_p=e=>Fj.find($j(e)),XAe=[...Fj,hi,lu],YAe=e=>XAe.find($j(e));function QAe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Wf(n))}function ZAe(e,t){const n=S2(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const s in o){const a=gEe(o[s]);QAe(e,s,a)}}function JAe(e,t,n){var r,i;const o=Object.keys(t).filter(a=>!e.hasValue(a)),s=o.length;if(s)for(let a=0;al.remove(f))),u.push(v)}return s&&Promise.all(u).then(()=>{s&&ZAe(e,s)}),u}function X5(e,t,n={}){const r=S2(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(Bj(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:f}=i;return r6e(e,t,u+l,d,f,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,u]=a==="beforeChildren"?[o,s]:[s,o];return l().then(()=>u())}else return Promise.all([o(),s(n.delay)])}function r6e(e,t,n=0,r=0,i=1,o){const s=[],a=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(i6e).forEach((u,d)=>{u.notify("AnimationStart",t),s.push(X5(u,t,{...o,delay:n+l(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(s)}function i6e(e,t){return e.sortNodePosition(t)}function o6e(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>X5(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=X5(e,t,n);else{const i=typeof t=="function"?S2(e,t,n.custom):t;r=Promise.all(Bj(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const s6e=[...cA].reverse(),a6e=cA.length;function l6e(e){return t=>Promise.all(t.map(({animation:n,options:r})=>o6e(e,n,r)))}function u6e(e){let t=l6e(e);const n=d6e();let r=!0;const i=(l,u)=>{const d=S2(e,u);if(d){const{transition:f,transitionEnd:h,...g}=d;l={...l,...g,...h}}return l};function o(l){t=l(e)}function s(l,u){const d=e.getProps(),f=e.getVariantContext(!0)||{},h=[],g=new Set;let m={},v=1/0;for(let _=0;_v&&C;const O=Array.isArray(S)?S:[S];let M=O.reduce(i,{});T===!1&&(M={});const{prevResolvedValues:V={}}=y,B={...V,...M},A=N=>{k=!0,g.delete(N),y.needsAnimating[N]=!0};for(const N in B){const D=M[N],U=V[N];m.hasOwnProperty(N)||(D!==U?x_(D)&&x_(U)?!aj(D,U)||P?A(N):y.protectedKeys[N]=!0:D!==void 0?A(N):g.add(N):D!==void 0&&g.has(N)?A(N):y.protectedKeys[N]=!0)}y.prevProp=S,y.prevResolvedValues=M,y.isActive&&(m={...m,...M}),r&&e.blockInitialAnimation&&(k=!1),k&&!E&&h.push(...O.map(N=>({animation:N,options:{type:b,...l}})))}if(g.size){const _={};g.forEach(b=>{const y=e.getBaseTarget(b);y!==void 0&&(_[b]=y)}),h.push({animation:_})}let x=!!h.length;return r&&d.initial===!1&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,x?t(h):Promise.resolve()}function a(l,u,d){var f;if(n[l].isActive===u)return Promise.resolve();(f=e.variantChildren)===null||f===void 0||f.forEach(g=>{var m;return(m=g.animationState)===null||m===void 0?void 0:m.setActive(l,u)}),n[l].isActive=u;const h=s(d,l);for(const g in n)n[g].protectedKeys={};return h}return{animateChanges:s,setActive:a,setAnimateFunction:o,getState:()=>n}}function c6e(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!aj(t,e):!1}function Fu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function d6e(){return{animate:Fu(!0),whileInView:Fu(),whileHover:Fu(),whileTap:Fu(),whileDrag:Fu(),whileFocus:Fu(),exit:Fu()}}class f6e extends xu{constructor(t){super(t),t.animationState||(t.animationState=u6e(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),y2(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let h6e=0;class p6e extends xu{constructor(){super(...arguments),this.id=h6e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const g6e={animation:{Feature:f6e},exit:{Feature:p6e}},NI=(e,t)=>Math.abs(e-t);function m6e(e,t){const n=NI(e.x,t.x),r=NI(e.y,t.y);return Math.sqrt(n**2+r**2)}class Uj{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=_C(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,f=m6e(u.offset,{x:0,y:0})>=3;if(!d&&!f)return;const{point:h}=u,{timestamp:g}=Zr;this.history.push({...h,timestamp:g});const{onStart:m,onMove:v}=this.handlers;d||(m&&m(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,u)},this.handlePointerMove=(u,d)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=vC(d,this.transformPagePoint),Sn.update(this.updatePoint,!0)},this.handlePointerUp=(u,d)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:h}=this.handlers,g=_C(u.type==="pointercancel"?this.lastMoveEventInfo:vC(d,this.transformPagePoint),this.history);this.startEvent&&f&&f(u,g),h&&h(u,g)},!nj(t))return;this.handlers=n,this.transformPagePoint=r;const i=b2(t),o=vC(i,this.transformPagePoint),{point:s}=o,{timestamp:a}=Zr;this.history=[{...s,timestamp:a}];const{onSessionStart:l}=n;l&&l(t,_C(o,this.history)),this.removeListeners=ql(Da(window,"pointermove",this.handlePointerMove),Da(window,"pointerup",this.handlePointerUp),Da(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Wa(this.updatePoint)}}function vC(e,t){return t?{point:t(e.point)}:e}function LI(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _C({point:e},t){return{point:e,delta:LI(e,zj(t)),offset:LI(e,y6e(t)),velocity:v6e(t,.1)}}function y6e(e){return e[0]}function zj(e){return e[e.length-1]}function v6e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=zj(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Kl(t)));)n--;if(!r)return{x:0,y:0};const o=$a(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function oo(e){return e.max-e.min}function Y5(e,t=0,n=.01){return Math.abs(e-t)<=n}function DI(e,t,n,r=.5){e.origin=r,e.originPoint=Pn(t.min,t.max,e.origin),e.scale=oo(n)/oo(t),(Y5(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Pn(n.min,n.max,e.origin)-e.originPoint,(Y5(e.translate)||isNaN(e.translate))&&(e.translate=0)}function qp(e,t,n,r){DI(e.x,t.x,n.x,r?r.originX:void 0),DI(e.y,t.y,n.y,r?r.originY:void 0)}function $I(e,t,n){e.min=n.min+t.min,e.max=e.min+oo(t)}function _6e(e,t,n){$I(e.x,t.x,n.x),$I(e.y,t.y,n.y)}function FI(e,t,n){e.min=t.min-n.min,e.max=e.min+oo(t)}function Kp(e,t,n){FI(e.x,t.x,n.x),FI(e.y,t.y,n.y)}function b6e(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Pn(n,e,r.max):Math.min(e,n)),e}function BI(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function S6e(e,{top:t,left:n,bottom:r,right:i}){return{x:BI(e.x,n,i),y:BI(e.y,t,r)}}function UI(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=im(t.min,t.max-r,e.min):r>i&&(n=im(e.min,e.max-i,t.min)),au(0,1,n)}function C6e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Q5=.35;function T6e(e=Q5){return e===!1?e=0:e===!0&&(e=Q5),{x:zI(e,"left","right"),y:zI(e,"top","bottom")}}function zI(e,t,n){return{min:VI(e,t),max:VI(e,n)}}function VI(e,t){return typeof e=="number"?e:e[t]||0}const jI=()=>({translate:0,scale:1,origin:0,originPoint:0}),Qd=()=>({x:jI(),y:jI()}),GI=()=>({min:0,max:0}),Xn=()=>({x:GI(),y:GI()});function Ps(e){return[e("x"),e("y")]}function Vj({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function E6e({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function A6e(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function bC(e){return e===void 0||e===1}function Z5({scale:e,scaleX:t,scaleY:n}){return!bC(e)||!bC(t)||!bC(n)}function ju(e){return Z5(e)||jj(e)||e.z||e.rotate||e.rotateX||e.rotateY}function jj(e){return HI(e.x)||HI(e.y)}function HI(e){return e&&e!=="0%"}function P_(e,t,n){const r=e-n,i=t*r;return n+i}function WI(e,t,n,r,i){return i!==void 0&&(e=P_(e,i,r)),P_(e,n,r)+t}function J5(e,t=0,n=1,r,i){e.min=WI(e.min,t,n,r,i),e.max=WI(e.max,t,n,r,i)}function Gj(e,{x:t,y:n}){J5(e.x,t.translate,t.scale,t.originPoint),J5(e.y,n.translate,n.scale,n.originPoint)}function P6e(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,s;for(let a=0;a1.0000000000001||e<.999999999999?e:1}function Tl(e,t){e.min=e.min+t,e.max=e.max+t}function KI(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,s=Pn(e.min,e.max,o);J5(e,t[n],t[r],s,t.scale)}const R6e=["x","scaleX","originX"],O6e=["y","scaleY","originY"];function Zd(e,t){KI(e.x,t,R6e),KI(e.y,t,O6e)}function Hj(e,t){return Vj(A6e(e.getBoundingClientRect(),t))}function k6e(e,t,n){const r=Hj(e,n),{scroll:i}=t;return i&&(Tl(r.x,i.offset.x),Tl(r.y,i.offset.y)),r}const I6e=new WeakMap;class M6e{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Xn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(b2(l,"page").point)},o=(l,u)=>{const{drag:d,dragPropagation:f,onDragStart:h}=this.getProps();if(d&&!f&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=ij(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ps(m=>{let v=this.getAxisMotionValue(m).get()||0;if(qs.test(v)){const{projection:x}=this.visualElement;if(x&&x.layout){const _=x.layout.layoutBox[m];_&&(v=oo(_)*(parseFloat(v)/100))}}this.originPoint[m]=v}),h&&Sn.update(()=>h(l,u),!1,!0);const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},s=(l,u)=>{const{dragPropagation:d,dragDirectionLock:f,onDirectionLock:h,onDrag:g}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:m}=u;if(f&&this.currentDirection===null){this.currentDirection=N6e(m),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",u.point,m),this.updateAxis("y",u.point,m),this.visualElement.render(),g&&g(l,u)},a=(l,u)=>this.stop(l,u);this.panSession=new Uj(t,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&Sn.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!sv(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=b6e(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&Xd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=S6e(r.layoutBox,t):this.constraints=!1,this.elastic=T6e(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ps(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=C6e(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Xd(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=k6e(r,i.root,this.visualElement.getTransformPagePoint());let s=w6e(i.layout.layoutBox,o);if(n){const a=n(E6e(s));this.hasMutatedConstraints=!!a,a&&(s=Vj(a))}return s}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Ps(d=>{if(!sv(d,n,this.currentDirection))return;let f=l&&l[d]||{};s&&(f={min:0,max:0});const h=i?200:1e6,g=i?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(EA(t,r,0,n))}stopAnimation(){Ps(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ps(n=>{const{drag:r}=this.getProps();if(!sv(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:a}=i.layout.layoutBox[n];o.set(t[n]-Pn(s,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Xd(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Ps(s=>{const a=this.getAxisMotionValue(s);if(a){const l=a.get();i[s]=x6e({min:l,max:l},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ps(s=>{if(!sv(s,t,null))return;const a=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];a.set(Pn(l,u,i[s]))})}addListeners(){if(!this.visualElement.current)return;I6e.set(this.visualElement,this);const t=this.visualElement.current,n=Da(t,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Xd(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const s=ka(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ps(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=l[d].translate,f.set(f.get()+l[d].translate))}),this.visualElement.render())});return()=>{s(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:s=Q5,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function sv(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function N6e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class L6e extends xu{constructor(t){super(t),this.removeGroupControls=tr,this.removeListeners=tr,this.controls=new M6e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tr}unmount(){this.removeGroupControls(),this.removeListeners()}}const XI=e=>(t,n)=>{e&&Sn.update(()=>e(t,n))};class D6e extends xu{constructor(){super(...arguments),this.removePointerDownListener=tr}onPointerDown(t){this.session=new Uj(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:XI(t),onStart:XI(n),onMove:r,onEnd:(o,s)=>{delete this.session,i&&Sn.update(()=>i(o,s))}}}mount(){this.removePointerDownListener=Da(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function $6e(){const e=L.useContext(Km);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=L.useId();return L.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function XMe(){return F6e(L.useContext(Km))}function F6e(e){return e===null?!0:e.isPresent}const Gv={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function YI(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const bp={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(He.test(e))e=parseFloat(e);else return e;const n=YI(e,t.target.x),r=YI(e,t.target.y);return`${n}% ${r}%`}},B6e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=lu.parse(e);if(i.length>5)return r;const o=lu.createTransformer(e),s=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+s]/=a,i[1+s]/=l;const u=Pn(a,l,.5);return typeof i[2+s]=="number"&&(i[2+s]/=u),typeof i[3+s]=="number"&&(i[3+s]/=u),o(i)}};class U6e extends jt.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;qTe(z6e),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),Gv.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,s=r.projection;return s&&(s.isPresent=o,i||t.layoutDependency!==n||n===void 0?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||Sn.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Wj(e){const[t,n]=$6e(),r=L.useContext(fA);return jt.createElement(U6e,{...e,layoutGroup:r,switchLayoutGroup:L.useContext(zV),isPresent:t,safeToRemove:n})}const z6e={borderRadius:{...bp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:bp,borderTopRightRadius:bp,borderBottomLeftRadius:bp,borderBottomRightRadius:bp,boxShadow:B6e},qj=["TopLeft","TopRight","BottomLeft","BottomRight"],V6e=qj.length,QI=e=>typeof e=="string"?parseFloat(e):e,ZI=e=>typeof e=="number"||He.test(e);function j6e(e,t,n,r,i,o){i?(e.opacity=Pn(0,n.opacity!==void 0?n.opacity:1,G6e(r)),e.opacityExit=Pn(t.opacity!==void 0?t.opacity:1,0,H6e(r))):o&&(e.opacity=Pn(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let s=0;srt?1:n(im(e,t,r))}function e7(e,t){e.min=t.min,e.max=t.max}function wo(e,t){e7(e.x,t.x),e7(e.y,t.y)}function t7(e,t,n,r,i){return e-=t,e=P_(e,1/n,r),i!==void 0&&(e=P_(e,1/i,r)),e}function W6e(e,t=0,n=1,r=.5,i,o=e,s=e){if(qs.test(t)&&(t=parseFloat(t),t=Pn(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=Pn(o.min,o.max,r);e===o&&(a-=t),e.min=t7(e.min,t,n,a,i),e.max=t7(e.max,t,n,a,i)}function n7(e,t,[n,r,i],o,s){W6e(e,t[n],t[r],t[i],t.scale,o,s)}const q6e=["x","scaleX","originX"],K6e=["y","scaleY","originY"];function r7(e,t,n,r){n7(e.x,t,q6e,n?n.x:void 0,r?r.x:void 0),n7(e.y,t,K6e,n?n.y:void 0,r?r.y:void 0)}function i7(e){return e.translate===0&&e.scale===1}function Xj(e){return i7(e.x)&&i7(e.y)}function e4(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function o7(e){return oo(e.x)/oo(e.y)}class X6e{constructor(){this.members=[]}add(t){AA(this.members,t),t.scheduleRender()}remove(t){if(PA(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function s7(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:d}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),d&&(r+=`rotateY(${d}deg) `)}const s=e.x.scale*t.x,a=e.y.scale*t.y;return(s!==1||a!==1)&&(r+=`scale(${s}, ${a})`),r||"none"}const Y6e=(e,t)=>e.depth-t.depth;class Q6e{constructor(){this.children=[],this.isDirty=!1}add(t){AA(this.children,t),this.isDirty=!0}remove(t){PA(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Y6e),this.isDirty=!1,this.children.forEach(t)}}function Z6e(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(Wa(r),e(o-t))};return Sn.read(r,!0),()=>Wa(r)}function J6e(e){window.MotionDebug&&window.MotionDebug.record(e)}function ePe(e){return e instanceof SVGElement&&e.tagName!=="svg"}function tPe(e,t,n){const r=zi(e)?e:Wf(e);return r.start(EA("",r,t,n)),r.animation}const a7=["","X","Y","Z"],l7=1e3;let nPe=0;const Gu={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Yj({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},a=t==null?void 0:t()){this.id=nPe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{Gu.totalNodes=Gu.resolvedTargetDeltas=Gu.recalculatedProjection=0,this.nodes.forEach(oPe),this.nodes.forEach(cPe),this.nodes.forEach(dPe),this.nodes.forEach(sPe),J6e(Gu)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(s,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=Z6e(h,250),Gv.hasAnimatedSinceResize&&(Gv.hasAnimatedSinceResize=!1,this.nodes.forEach(c7))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:g,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||d.getDefaultTransition()||mPe,{onLayoutAnimationStart:x,onLayoutAnimationComplete:_}=d.getProps(),b=!this.targetLayout||!e4(this.targetLayout,m)||g,y=!h&&g;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const S={...Dj(v,"layout"),onPlay:x,onComplete:_};(d.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S)}else h||c7(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Wa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(fPe),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;dthis.update()))}clearAllSnapshots(){this.nodes.forEach(aPe),this.sharedNodes.forEach(hPe)}scheduleUpdateProjection(){Sn.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){Sn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const C=S/1e3;d7(f.x,s.x,C),d7(f.y,s.y,C),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Kp(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),pPe(this.relativeTarget,this.relativeTargetOrigin,h,C),y&&e4(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=Xn()),wo(y,this.relativeTarget)),v&&(this.animationValues=d,j6e(d,u,this.latestValues,C,b,_)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Wa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Sn.update(()=>{Gv.hasAnimatedSinceResize=!0,this.currentAnimation=tPe(0,l7,{...s,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(l7),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:d}=s;if(!(!a||!l||!u)){if(this!==s&&this.layout&&u&&Qj(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Xn();const f=oo(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+f;const h=oo(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+h}wo(a,l),Zd(a,d),qp(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new X6e),this.sharedNodes.get(s).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){var s;const{layoutId:a}=this.options;return a?((s=this.getStack())===null||s===void 0?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:a}=this.options;return a?(s=this.getStack())===null||s===void 0?void 0:s.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const u={};for(let d=0;d{var a;return(a=s.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(u7),this.root.sharedNodes.clear()}}}function rPe(e){e.updateLayout()}function iPe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,s=n.source!==e.layout.source;o==="size"?Ps(f=>{const h=s?n.measuredBox[f]:n.layoutBox[f],g=oo(h);h.min=r[f].min,h.max=h.min+g}):Qj(o,n.layoutBox,r)&&Ps(f=>{const h=s?n.measuredBox[f]:n.layoutBox[f],g=oo(r[f]);h.max=h.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+g)});const a=Qd();qp(a,r,n.layoutBox);const l=Qd();s?qp(l,e.applyTransform(i,!0),n.measuredBox):qp(l,r,n.layoutBox);const u=!Xj(a);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:g}=f;if(h&&g){const m=Xn();Kp(m,n.layoutBox,h.layoutBox);const v=Xn();Kp(v,r,g.layoutBox),e4(m,v)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function oPe(e){Gu.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function sPe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function aPe(e){e.clearSnapshot()}function u7(e){e.clearMeasurements()}function lPe(e){e.isLayoutDirty=!1}function uPe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function c7(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function cPe(e){e.resolveTargetDelta()}function dPe(e){e.calcProjection()}function fPe(e){e.resetRotation()}function hPe(e){e.removeLeadSnapshot()}function d7(e,t,n){e.translate=Pn(t.translate,0,n),e.scale=Pn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function f7(e,t,n,r){e.min=Pn(t.min,n.min,r),e.max=Pn(t.max,n.max,r)}function pPe(e,t,n,r){f7(e.x,t.x,n.x,r),f7(e.y,t.y,n.y,r)}function gPe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const mPe={duration:.45,ease:[.4,0,.1,1]};function h7(e){e.min=Math.round(e.min*2)/2,e.max=Math.round(e.max*2)/2}function yPe(e){h7(e.x),h7(e.y)}function Qj(e,t,n){return e==="position"||e==="preserve-aspect"&&!Y5(o7(t),o7(n),.2)}const vPe=Yj({attachResizeListener:(e,t)=>ka(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),SC={current:void 0},Zj=Yj({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!SC.current){const e=new vPe({});e.mount(window),e.setOptions({layoutScroll:!0}),SC.current=e}return SC.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),_Pe={pan:{Feature:D6e},drag:{Feature:L6e,ProjectionNode:Zj,MeasureLayout:Wj}},bPe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function SPe(e){const t=bPe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function t4(e,t,n=1){const[r,i]=SPe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);return o?o.trim():j5(i)?t4(i,t,n+1):i}function wPe(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!j5(o))return;const s=t4(o,r);s&&i.set(s)});for(const i in t){const o=t[i];if(!j5(o))continue;const s=t4(o,r);s&&(t[i]=s,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const xPe=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Jj=e=>xPe.has(e),CPe=e=>Object.keys(e).some(Jj),p7=e=>e===jc||e===He,g7=(e,t)=>parseFloat(e.split(", ")[t]),m7=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return g7(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?g7(o[1],e):0}},TPe=new Set(["x","y","z"]),EPe=Xm.filter(e=>!TPe.has(e));function APe(e){const t=[];return EPe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const qf={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:m7(4,13),y:m7(5,14)};qf.translateX=qf.x;qf.translateY=qf.y;const PPe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:s}=o,a={};s==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{a[u]=qf[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const d=t.getValue(u);d&&d.jump(a[u]),e[u]=qf[u](l,o)}),e},RPe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(Jj);let o=[],s=!1;const a=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let d=n[l],f=_p(d);const h=t[l];let g;if(x_(h)){const m=h.length,v=h[0]===null?1:0;d=h[v],f=_p(d);for(let x=v;x=0?window.pageYOffset:null,u=PPe(t,e,a);return o.length&&o.forEach(([d,f])=>{e.getValue(d).set(f)}),e.render(),m2&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function OPe(e,t,n,r){return CPe(t)?RPe(e,t,n,r):{target:t,transitionEnd:r}}const kPe=(e,t,n,r)=>{const i=wPe(e,t,r);return t=i.target,r=i.transitionEnd,OPe(e,t,n,r)},n4={current:null},eG={current:!1};function IPe(){if(eG.current=!0,!!m2)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>n4.current=e.matches;e.addListener(t),t()}else n4.current=!1}function MPe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],s=n[i];if(zi(o))e.addValue(i,o),A_(r)&&r.add(i);else if(zi(s))e.addValue(i,Wf(o,{owner:e})),A_(r)&&r.remove(i);else if(s!==o)if(e.hasValue(i)){const a=e.getValue(i);!a.hasAnimated&&a.set(o)}else{const a=e.getStaticValue(i);e.addValue(i,Wf(a!==void 0?a:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const y7=new WeakMap,tG=Object.keys(rm),NPe=tG.length,v7=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],LPe=dA.length;class DPe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>Sn.render(this.render,!1,!0);const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=s,this.isControllingVariants=v2(n),this.isVariantNode=UV(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...d}=this.scrapeMotionValuesFromProps(n,{});for(const f in d){const h=d[f];a[f]!==void 0&&zi(h)&&(h.set(a[f],!1),A_(u)&&u.add(f))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,y7.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),eG.current||IPe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:n4.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){y7.delete(this.current),this.projection&&this.projection.unmount(),Wa(this.notifyUpdate),Wa(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=Vc.has(t),i=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&Sn.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let s,a;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}return a}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Xn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Wf(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=bA(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!zi(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new RA),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class nG extends DPe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let s=t6e(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),s&&(s=i(s))),o){JAe(this,r,s);const a=kPe(this,r,s,n);n=a.transitionEnd,r=a.target}return{transition:t,transitionEnd:n,...r}}}function $Pe(e){return window.getComputedStyle(e)}class FPe extends nG{readValueFromInstance(t,n){if(Vc.has(n)){const r=TA(n);return r&&r.default||0}else{const r=$Pe(t),i=(GV(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Hj(t,n)}build(t,n,r,i){pA(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return _A(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;zi(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){YV(t,n,r,i)}}class BPe extends nG{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Vc.has(n)){const r=TA(n);return r&&r.default||0}return n=QV.has(n)?n:vA(n),t.getAttribute(n)}measureInstanceViewportBox(){return Xn()}scrapeMotionValuesFromProps(t,n){return JV(t,n)}build(t,n,r,i){mA(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){ZV(t,n,r,i)}mount(t){this.isSVGTag=yA(t.tagName),super.mount(t)}}const UPe=(e,t)=>hA(e)?new BPe(t,{enableHardwareAcceleration:!1}):new FPe(t,{enableHardwareAcceleration:!0}),zPe={layout:{ProjectionNode:Zj,MeasureLayout:Wj}},VPe={...g6e,...DEe,..._Pe,...zPe},jPe=HTe((e,t)=>bEe(e,t,VPe,UPe));function rG(){const e=L.useRef(!1);return b_(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function GPe(){const e=rG(),[t,n]=L.useState(0),r=L.useCallback(()=>{e.current&&n(t+1)},[t]);return[L.useCallback(()=>Sn.postRender(r),[r]),t]}class HPe extends L.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function WPe({children:e,isPresent:t}){const n=L.useId(),r=L.useRef(null),i=L.useRef({width:0,height:0,top:0,left:0});return L.useInsertionEffect(()=>{const{width:o,height:s,top:a,left:l}=i.current;if(t||!r.current||!o||!s)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${o}px !important; height: ${s}px !important; top: ${a}px !important; left: ${l}px !important; } `),()=>{document.head.removeChild(u)}},[t]),L.createElement(HPe,{isPresent:t,childRef:r,sizeRef:i},L.cloneElement(e,{ref:r}))}const wC=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:s})=>{const a=ej(qPe),l=L.useId(),u=L.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:d=>{a.set(d,!0);for(const f of a.values())if(!f)return;r&&r()},register:d=>(a.set(d,!1),()=>a.delete(d))}),o?void 0:[n]);return L.useMemo(()=>{a.forEach((d,f)=>a.set(f,!1))},[n]),L.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),s==="popLayout"&&(e=L.createElement(WPe,{isPresent:n},e)),L.createElement(Km.Provider,{value:u},e)};function qPe(){return new Map}function KPe(e){return L.useEffect(()=>()=>e(),[])}const Nd=e=>e.key||"";function XPe(e,t){e.forEach(n=>{const r=Nd(n);t.set(r,n)})}function YPe(e){const t=[];return L.Children.forEach(e,n=>{L.isValidElement(n)&&t.push(n)}),t}const QPe=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:s="sync"})=>{const a=L.useContext(fA).forceRender||GPe()[0],l=rG(),u=YPe(e);let d=u;const f=L.useRef(new Map).current,h=L.useRef(d),g=L.useRef(new Map).current,m=L.useRef(!0);if(b_(()=>{m.current=!1,XPe(u,g),h.current=d}),KPe(()=>{m.current=!0,g.clear(),f.clear()}),m.current)return L.createElement(L.Fragment,null,d.map(b=>L.createElement(wC,{key:Nd(b),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:s},b)));d=[...d];const v=h.current.map(Nd),x=u.map(Nd),_=v.length;for(let b=0;b<_;b++){const y=v[b];x.indexOf(y)===-1&&!f.has(y)&&f.set(y,void 0)}return s==="wait"&&f.size&&(d=[]),f.forEach((b,y)=>{if(x.indexOf(y)!==-1)return;const S=g.get(y);if(!S)return;const C=v.indexOf(y);let T=b;if(!T){const E=()=>{g.delete(y),f.delete(y);const P=h.current.findIndex(k=>k.key===y);if(h.current.splice(P,1),!f.size){if(h.current=u,l.current===!1)return;a(),r&&r()}};T=L.createElement(wC,{key:Nd(S),isPresent:!1,onExitComplete:E,custom:t,presenceAffectsLayout:o,mode:s},S),f.set(y,T)}d.splice(C,0,T)}),d=d.map(b=>{const y=b.key;return f.has(y)?b:L.createElement(wC,{key:Nd(b),isPresent:!0,presenceAffectsLayout:o,mode:s},b)}),L.createElement(L.Fragment,null,f.size?d:d.map(b=>L.cloneElement(b)))};var ZPe=V5e({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),iG=zc((e,t)=>{const n=$V("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:s="transparent",className:a,...l}=MV(e),u=EV("chakra-spinner",a),d={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${ZPe} ${o} linear infinite`,...n};return ue.jsx(Cc.div,{ref:t,__css:d,className:u,...l,children:r&&ue.jsx(Cc.span,{srOnly:!0,children:r})})});iG.displayName="Spinner";var r4=zc(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...s}=t;return ue.jsx("img",{width:r,height:i,ref:n,alt:o,...s})});r4.displayName="NativeImage";function JPe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:s,sizes:a,ignoreFallback:l}=e,[u,d]=L.useState("pending");L.useEffect(()=>{d(n?"loading":"pending")},[n]);const f=L.useRef(),h=L.useCallback(()=>{if(!n)return;g();const m=new Image;m.src=n,s&&(m.crossOrigin=s),r&&(m.srcset=r),a&&(m.sizes=a),t&&(m.loading=t),m.onload=v=>{g(),d("loaded"),i==null||i(v)},m.onerror=v=>{g(),d("failed"),o==null||o(v)},f.current=m},[n,s,r,a,i,o,t]),g=()=>{f.current&&(f.current.onload=null,f.current.onerror=null,f.current=null)};return j5e(()=>{if(!l)return u==="loading"&&h(),()=>{g()}},[u,h,l]),l?"loaded":u}var e8e=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function t8e(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var OA=zc(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:s,align:a,fit:l,loading:u,ignoreFallback:d,crossOrigin:f,fallbackStrategy:h="beforeLoadOrError",referrerPolicy:g,...m}=t,v=r!==void 0||i!==void 0,x=u!=null||d||!v,_=JPe({...t,crossOrigin:f,ignoreFallback:x}),b=e8e(_,h),y={ref:n,objectFit:l,objectPosition:a,...x?m:t8e(m,["onError","onLoad"])};return b?i||ue.jsx(Cc.img,{as:r4,className:"chakra-image__placeholder",src:r,...y}):ue.jsx(Cc.img,{as:r4,src:o,srcSet:s,crossOrigin:f,loading:u,referrerPolicy:g,className:"chakra-image",...y})});OA.displayName="Image";var i4=zc(function(t,n){const r=$V("Heading",t),{className:i,...o}=MV(t);return ue.jsx(Cc.h2,{ref:n,className:EV("chakra-heading",t.className),...o,__css:r})});i4.displayName="Heading";var kA=Cc("div");kA.displayName="Box";var oG=zc(function(t,n){const{size:r,centerContent:i=!0,...o}=t,s=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return ue.jsx(kA,{ref:n,boxSize:r,__css:{...s,flexShrink:0,flexGrow:0},...o})});oG.displayName="Square";var n8e=zc(function(t,n){const{size:r,...i}=t;return ue.jsx(oG,{size:r,ref:n,borderRadius:"9999px",...i})});n8e.displayName="Circle";var IA=zc(function(t,n){const{direction:r,align:i,justify:o,wrap:s,basis:a,grow:l,shrink:u,...d}=t,f={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:s,flexBasis:a,flexGrow:l,flexShrink:u};return ue.jsx(Cc.div,{ref:n,__css:f,...d})});IA.displayName="Flex";const r8e=""+new URL("logo-13003d72.png",import.meta.url).href,i8e=()=>ue.jsxs(IA,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[ue.jsx(OA,{src:r8e,w:"8rem",h:"8rem"}),ue.jsx(iG,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),o8e=L.memo(i8e);function o4(e){"@babel/helpers - typeof";return o4=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o4(e)}var sG=[],s8e=sG.forEach,a8e=sG.slice;function s4(e){return s8e.call(a8e.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function aG(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":o4(XMLHttpRequest))==="object"}function l8e(e){return!!e&&typeof e.then=="function"}function u8e(e){return l8e(e)?e:Promise.resolve(e)}function c8e(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var a4={exports:{}},av={exports:{}},_7;function d8e(){return _7||(_7=1,function(e,t){var n=typeof self<"u"?self:Ze,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(s){var a={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(A){return A&&DataView.prototype.isPrototypeOf(A)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(A){return A&&u.indexOf(Object.prototype.toString.call(A))>-1};function f(A){if(typeof A!="string"&&(A=String(A)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(A))throw new TypeError("Invalid character in header field name");return A.toLowerCase()}function h(A){return typeof A!="string"&&(A=String(A)),A}function g(A){var N={next:function(){var D=A.shift();return{done:D===void 0,value:D}}};return a.iterable&&(N[Symbol.iterator]=function(){return N}),N}function m(A){this.map={},A instanceof m?A.forEach(function(N,D){this.append(D,N)},this):Array.isArray(A)?A.forEach(function(N){this.append(N[0],N[1])},this):A&&Object.getOwnPropertyNames(A).forEach(function(N){this.append(N,A[N])},this)}m.prototype.append=function(A,N){A=f(A),N=h(N);var D=this.map[A];this.map[A]=D?D+", "+N:N},m.prototype.delete=function(A){delete this.map[f(A)]},m.prototype.get=function(A){return A=f(A),this.has(A)?this.map[A]:null},m.prototype.has=function(A){return this.map.hasOwnProperty(f(A))},m.prototype.set=function(A,N){this.map[f(A)]=h(N)},m.prototype.forEach=function(A,N){for(var D in this.map)this.map.hasOwnProperty(D)&&A.call(N,this.map[D],D,this)},m.prototype.keys=function(){var A=[];return this.forEach(function(N,D){A.push(D)}),g(A)},m.prototype.values=function(){var A=[];return this.forEach(function(N){A.push(N)}),g(A)},m.prototype.entries=function(){var A=[];return this.forEach(function(N,D){A.push([D,N])}),g(A)},a.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function v(A){if(A.bodyUsed)return Promise.reject(new TypeError("Already read"));A.bodyUsed=!0}function x(A){return new Promise(function(N,D){A.onload=function(){N(A.result)},A.onerror=function(){D(A.error)}})}function _(A){var N=new FileReader,D=x(N);return N.readAsArrayBuffer(A),D}function b(A){var N=new FileReader,D=x(N);return N.readAsText(A),D}function y(A){for(var N=new Uint8Array(A),D=new Array(N.length),U=0;U-1?N:A}function P(A,N){N=N||{};var D=N.body;if(A instanceof P){if(A.bodyUsed)throw new TypeError("Already read");this.url=A.url,this.credentials=A.credentials,N.headers||(this.headers=new m(A.headers)),this.method=A.method,this.mode=A.mode,this.signal=A.signal,!D&&A._bodyInit!=null&&(D=A._bodyInit,A.bodyUsed=!0)}else this.url=String(A);if(this.credentials=N.credentials||this.credentials||"same-origin",(N.headers||!this.headers)&&(this.headers=new m(N.headers)),this.method=E(N.method||this.method||"GET"),this.mode=N.mode||this.mode||null,this.signal=N.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}P.prototype.clone=function(){return new P(this,{body:this._bodyInit})};function k(A){var N=new FormData;return A.trim().split("&").forEach(function(D){if(D){var U=D.split("="),$=U.shift().replace(/\+/g," "),j=U.join("=").replace(/\+/g," ");N.append(decodeURIComponent($),decodeURIComponent(j))}}),N}function O(A){var N=new m,D=A.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(U){var $=U.split(":"),j=$.shift().trim();if(j){var G=$.join(":").trim();N.append(j,G)}}),N}C.call(P.prototype);function M(A,N){N||(N={}),this.type="default",this.status=N.status===void 0?200:N.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in N?N.statusText:"OK",this.headers=new m(N.headers),this.url=N.url||"",this._initBody(A)}C.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},M.error=function(){var A=new M(null,{status:0,statusText:""});return A.type="error",A};var V=[301,302,303,307,308];M.redirect=function(A,N){if(V.indexOf(N)===-1)throw new RangeError("Invalid status code");return new M(null,{status:N,headers:{location:A}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(N,D){this.message=N,this.name=D;var U=Error(N);this.stack=U.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function B(A,N){return new Promise(function(D,U){var $=new P(A,N);if($.signal&&$.signal.aborted)return U(new s.DOMException("Aborted","AbortError"));var j=new XMLHttpRequest;function G(){j.abort()}j.onload=function(){var q={status:j.status,statusText:j.statusText,headers:O(j.getAllResponseHeaders()||"")};q.url="responseURL"in j?j.responseURL:q.headers.get("X-Request-URL");var Z="response"in j?j.response:j.responseText;D(new M(Z,q))},j.onerror=function(){U(new TypeError("Network request failed"))},j.ontimeout=function(){U(new TypeError("Network request failed"))},j.onabort=function(){U(new s.DOMException("Aborted","AbortError"))},j.open($.method,$.url,!0),$.credentials==="include"?j.withCredentials=!0:$.credentials==="omit"&&(j.withCredentials=!1),"responseType"in j&&a.blob&&(j.responseType="blob"),$.headers.forEach(function(q,Z){j.setRequestHeader(Z,q)}),$.signal&&($.signal.addEventListener("abort",G),j.onreadystatechange=function(){j.readyState===4&&$.signal.removeEventListener("abort",G)}),j.send(typeof $._bodyInit>"u"?null:$._bodyInit)})}return B.polyfill=!0,o.fetch||(o.fetch=B,o.Headers=m,o.Request=P,o.Response=M),s.Headers=m,s.Request=P,s.Response=M,s.fetch=B,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(av,av.exports)),av.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof Ze<"u"&&Ze.fetch?n=Ze.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof c8e<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||d8e();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(a4,a4.exports);var lG=a4.exports;const uG=Tc(lG),b7=$7({__proto__:null,default:uG},[lG]);function R_(e){"@babel/helpers - typeof";return R_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R_(e)}var Fa;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Fa=global.fetch:typeof window<"u"&&window.fetch?Fa=window.fetch:Fa=fetch);var om;aG()&&(typeof global<"u"&&global.XMLHttpRequest?om=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(om=window.XMLHttpRequest));var O_;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?O_=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(O_=window.ActiveXObject));!Fa&&b7&&!om&&!O_&&(Fa=uG||b7);typeof Fa!="function"&&(Fa=void 0);var l4=function(t,n){if(n&&R_(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},S7=function(t,n,r){Fa(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},w7=!1,f8e=function(t,n,r,i){t.queryStringParams&&(n=l4(n,t.queryStringParams));var o=s4({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var s=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,a=s4({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},w7?{}:s);try{S7(n,a,i)}catch(l){if(!s||Object.keys(s).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(s).forEach(function(u){delete a[u]}),S7(n,a,i),w7=!0}catch(u){i(u)}}},h8e=function(t,n,r,i){r&&R_(r)==="object"&&(r=l4("",r).slice(1)),t.queryStringParams&&(n=l4(n,t.queryStringParams));try{var o;om?o=new om:o=new O_("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var s=t.customHeaders;if(s=typeof s=="function"?s():s,s)for(var a in s)o.setRequestHeader(a,s[a]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},p8e=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Fa&&n.indexOf("file:")!==0)return f8e(t,n,r,i);if(aG()||typeof ActiveXObject=="function")return h8e(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function sm(e){"@babel/helpers - typeof";return sm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sm(e)}function g8e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x7(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};g8e(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return m8e(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=s4(i,this.options||{},_8e()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,s){var a=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=u8e(l),l.then(function(u){if(!u)return s(null,{});var d=a.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});a.loadUrl(d,s,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var s=this,a=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(a,l);this.options.request(this.options,n,u,function(d,f){if(f&&(f.status>=500&&f.status<600||!f.status))return r("failed loading "+n+"; status code: "+f.status,!0);if(f&&f.status>=400&&f.status<500)return r("failed loading "+n+"; status code: "+f.status,!1);if(!f&&d&&d.message&&d.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+d.message,!0);if(d)return r(d,!1);var h,g;try{typeof f.data=="string"?h=s.options.parse(f.data,i,o):h=f.data}catch{g="failed parsing "+n+" to json"}if(g)return r(g,!1);r(null,h)})}},{key:"create",value:function(n,r,i,o,s){var a=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,d=[],f=[];n.forEach(function(h){var g=a.options.addPath;typeof a.options.addPath=="function"&&(g=a.options.addPath(h,r));var m=a.services.interpolator.interpolate(g,{lng:h,ns:r});a.options.request(a.options,m,l,function(v,x){u+=1,d.push(v),f.push(x),u===n.length&&typeof s=="function"&&s(d,f)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,s=r.logger,a=i.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(f){var h=o.toResolveHierarchy(f);h.forEach(function(g){l.indexOf(g)<0&&l.push(g)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(d){return u(d)}),l.forEach(function(d){n.allOptions.ns.forEach(function(f){i.read(d,f,"read",null,null,function(h,g){h&&s.warn("loading namespace ".concat(f," for language ").concat(d," failed"),h),!h&&g&&s.log("loaded namespace ".concat(f," for language ").concat(d),g),i.loaded("".concat(d,"|").concat(f),h,g)})})})}}}]),e}();dG.type="backend";const b8e=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,S8e={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},w8e=e=>S8e[e],x8e=e=>e.replace(b8e,w8e);let u4={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:x8e};function C8e(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};u4={...u4,...e}}function QMe(){return u4}let fG;function T8e(e){fG=e}function ZMe(){return fG}const E8e={type:"3rdParty",init(e){C8e(e.options.react),T8e(e)}};oi.use(dG).use(E8e).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const w2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function dh(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function MA(e){return"nodeType"in e}function xi(e){var t,n;return e?dh(e)?e:MA(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function NA(e){const{Document:t}=xi(e);return e instanceof t}function Jm(e){return dh(e)?!1:e instanceof xi(e).HTMLElement}function A8e(e){return e instanceof xi(e).SVGElement}function fh(e){return e?dh(e)?e.document:MA(e)?NA(e)?e:Jm(e)?e.ownerDocument:document:document:document}const Zs=w2?L.useLayoutEffect:L.useEffect;function x2(e){const t=L.useRef(e);return Zs(()=>{t.current=e}),L.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=L.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function am(e,t){t===void 0&&(t=[e]);const n=L.useRef(e);return Zs(()=>{n.current!==e&&(n.current=e)},t),n}function ey(e,t){const n=L.useRef();return L.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function k_(e){const t=x2(e),n=L.useRef(null),r=L.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function I_(e){const t=L.useRef();return L.useEffect(()=>{t.current=e},[e]),t.current}let xC={};function C2(e,t){return L.useMemo(()=>{if(t)return t;const n=xC[e]==null?0:xC[e]+1;return xC[e]=n,e+"-"+n},[e,t])}function hG(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const a=Object.entries(s);for(const[l,u]of a){const d=o[l];d!=null&&(o[l]=d+e*u)}return o},{...t})}}const wf=hG(1),M_=hG(-1);function R8e(e){return"clientX"in e&&"clientY"in e}function LA(e){if(!e)return!1;const{KeyboardEvent:t}=xi(e.target);return t&&e instanceof t}function O8e(e){if(!e)return!1;const{TouchEvent:t}=xi(e.target);return t&&e instanceof t}function lm(e){if(O8e(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return R8e(e)?{x:e.clientX,y:e.clientY}:null}const um=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[um.Translate.toString(e),um.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),C7="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function k8e(e){return e.matches(C7)?e:e.querySelector(C7)}const I8e={display:"none"};function M8e(e){let{id:t,value:n}=e;return jt.createElement("div",{id:t,style:I8e},n)}const N8e={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function L8e(e){let{id:t,announcement:n}=e;return jt.createElement("div",{id:t,style:N8e,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function D8e(){const[e,t]=L.useState("");return{announce:L.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const pG=L.createContext(null);function $8e(e){const t=L.useContext(pG);L.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function F8e(){const[e]=L.useState(()=>new Set),t=L.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[L.useCallback(r=>{let{type:i,event:o}=r;e.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[e]),t]}const B8e={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. `},U8e={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function z8e(e){let{announcements:t=U8e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=B8e}=e;const{announce:o,announcement:s}=D8e(),a=C2("DndLiveRegion"),[l,u]=L.useState(!1);if(L.useEffect(()=>{u(!0)},[]),$8e(L.useMemo(()=>({onDragStart(f){let{active:h}=f;o(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:g}=f;t.onDragMove&&o(t.onDragMove({active:h,over:g}))},onDragOver(f){let{active:h,over:g}=f;o(t.onDragOver({active:h,over:g}))},onDragEnd(f){let{active:h,over:g}=f;o(t.onDragEnd({active:h,over:g}))},onDragCancel(f){let{active:h,over:g}=f;o(t.onDragCancel({active:h,over:g}))}}),[o,t])),!l)return null;const d=jt.createElement(jt.Fragment,null,jt.createElement(M8e,{id:r,value:i.draggable}),jt.createElement(L8e,{id:a,announcement:s}));return n?Ms.createPortal(d,n):d}var fr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(fr||(fr={}));function N_(){}function T7(e,t){return L.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function V8e(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const ms=Object.freeze({x:0,y:0});function j8e(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function G8e(e,t){const n=lm(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function H8e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function W8e(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function q8e(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function K8e(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function X8e(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=X8e(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(W8e)};function Q8e(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const Z8e=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&Q8e(r,a)){const u=q8e(a).reduce((f,h)=>f+j8e(r,h),0),d=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:d}})}}return i.sort(H8e)};function J8e(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function gG(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ms}function e9e(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const t9e=e9e(1);function mG(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function n9e(e,t,n){const r=mG(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,f=o?e.height/o:e.height;return{width:d,height:f,top:u,right:l+d,bottom:u+f,left:l}}const r9e={ignoreTransform:!1};function ty(e,t){t===void 0&&(t=r9e);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=xi(e).getComputedStyle(e);u&&(n=n9e(n,u,d))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function E7(e){return ty(e,{ignoreTransform:!0})}function i9e(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function o9e(e,t){return t===void 0&&(t=xi(e).getComputedStyle(e)),t.position==="fixed"}function s9e(e,t){t===void 0&&(t=xi(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function DA(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(NA(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Jm(i)||A8e(i)||n.includes(i))return n;const o=xi(e).getComputedStyle(i);return i!==e&&s9e(i,o)&&n.push(i),o9e(i,o)?n:r(i.parentNode)}return e?r(e):n}function yG(e){const[t]=DA(e,1);return t??null}function CC(e){return!w2||!e?null:dh(e)?e:MA(e)?NA(e)||e===fh(e).scrollingElement?window:Jm(e)?e:null:null}function vG(e){return dh(e)?e.scrollX:e.scrollLeft}function _G(e){return dh(e)?e.scrollY:e.scrollTop}function c4(e){return{x:vG(e),y:_G(e)}}var xr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(xr||(xr={}));function bG(e){return!w2||!e?!1:e===document.scrollingElement}function SG(e){const t={x:0,y:0},n=bG(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const a9e={x:.2,y:.2};function l9e(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=a9e);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=SG(e),g={x:0,y:0},m={x:0,y:0},v={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+v.height?(g.y=xr.Backward,m.y=r*Math.abs((t.top+v.height-o)/v.height)):!d&&l>=t.bottom-v.height&&(g.y=xr.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&a>=t.right-v.width?(g.x=xr.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!f&&s<=t.left+v.width&&(g.x=xr.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:g,speed:m}}function u9e(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function wG(e){return e.reduce((t,n)=>wf(t,c4(n)),ms)}function c9e(e){return e.reduce((t,n)=>t+vG(n),0)}function d9e(e){return e.reduce((t,n)=>t+_G(n),0)}function xG(e,t){if(t===void 0&&(t=ty),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);yG(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const f9e=[["x",["left","right"],c9e],["y",["top","bottom"],d9e]];class $A{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=DA(n),i=wG(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of f9e)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),d=i[o]-u;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xp{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function h9e(e){const{EventTarget:t}=xi(e);return e instanceof t?e:fh(e)}function TC(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Co;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Co||(Co={}));function A7(e){e.preventDefault()}function p9e(e){e.stopPropagation()}var on;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(on||(on={}));const CG={start:[on.Space,on.Enter],cancel:[on.Esc],end:[on.Space,on.Enter]},g9e=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case on.Right:return{...n,x:n.x+25};case on.Left:return{...n,x:n.x-25};case on.Down:return{...n,y:n.y+25};case on.Up:return{...n,y:n.y-25}}};class TG{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xp(fh(n)),this.windowListeners=new Xp(xi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Co.Resize,this.handleCancel),this.windowListeners.add(Co.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Co.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&xG(r),n(ms)}handleKeyDown(t){if(LA(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=CG,coordinateGetter:s=g9e,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:ms;this.referenceCoordinates||(this.referenceCoordinates=d);const f=s(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=M_(f,d),g={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const x=t.code,{isTop:_,isRight:b,isLeft:y,isBottom:S,maxScroll:C,minScroll:T}=SG(v),E=u9e(v),P={x:Math.min(x===on.Right?E.right-E.width/2:E.right,Math.max(x===on.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(x===on.Down?E.bottom-E.height/2:E.bottom,Math.max(x===on.Down?E.top:E.top+E.height/2,f.y))},k=x===on.Right&&!b||x===on.Left&&!y,O=x===on.Down&&!S||x===on.Up&&!_;if(k&&P.x!==f.x){const M=v.scrollLeft+h.x,V=x===on.Right&&M<=C.x||x===on.Left&&M>=T.x;if(V&&!h.y){v.scrollTo({left:M,behavior:a});return}V?g.x=v.scrollLeft-M:g.x=x===on.Right?v.scrollLeft-C.x:v.scrollLeft-T.x,g.x&&v.scrollBy({left:-g.x,behavior:a});break}else if(O&&P.y!==f.y){const M=v.scrollTop+h.y,V=x===on.Down&&M<=C.y||x===on.Up&&M>=T.y;if(V&&!h.x){v.scrollTo({top:M,behavior:a});return}V?g.y=v.scrollTop-M:g.y=x===on.Down?v.scrollTop-C.y:v.scrollTop-T.y,g.y&&v.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,wf(M_(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}TG.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=CG,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function P7(e){return!!(e&&"distance"in e)}function R7(e){return!!(e&&"delay"in e)}class FA{constructor(t,n,r){var i;r===void 0&&(r=h9e(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=fh(s),this.documentListeners=new Xp(this.document),this.listeners=new Xp(r),this.windowListeners=new Xp(xi(s)),this.initialCoordinates=(i=lm(o))!=null?i:ms,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(Co.Resize,this.handleCancel),this.windowListeners.add(Co.DragStart,A7),this.windowListeners.add(Co.VisibilityChange,this.handleCancel),this.windowListeners.add(Co.ContextMenu,A7),this.documentListeners.add(Co.Keydown,this.handleKeydown),n){if(P7(n))return;if(R7(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Co.Click,p9e,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Co.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=lm(t))!=null?n:ms,u=M_(i,l);if(!r&&a){if(R7(a))return TC(u,a.tolerance)?this.handleCancel():void 0;if(P7(a))return a.tolerance!=null&&TC(u,a.tolerance)?this.handleCancel():TC(u,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===on.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const m9e={move:{name:"pointermove"},end:{name:"pointerup"}};class EG extends FA{constructor(t){const{event:n}=t,r=fh(n.target);super(t,m9e,r)}}EG.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const y9e={move:{name:"mousemove"},end:{name:"mouseup"}};var d4;(function(e){e[e.RightClick=2]="RightClick"})(d4||(d4={}));class AG extends FA{constructor(t){super(t,y9e,fh(t.event.target))}}AG.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===d4.RightClick?!1:(r==null||r({event:n}),!0)}}];const EC={move:{name:"touchmove"},end:{name:"touchend"}};class PG extends FA{constructor(t){super(t,EC)}static setup(){return window.addEventListener(EC.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(EC.move.name,t)};function t(){}}}PG.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Yp;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Yp||(Yp={}));var L_;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(L_||(L_={}));function v9e(e){let{acceleration:t,activator:n=Yp.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=L_.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const g=b9e({delta:f,disabled:!o}),[m,v]=P8e(),x=L.useRef({x:0,y:0}),_=L.useRef({x:0,y:0}),b=L.useMemo(()=>{switch(n){case Yp.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Yp.DraggableRect:return i}},[n,i,l]),y=L.useRef(null),S=L.useCallback(()=>{const T=y.current;if(!T)return;const E=x.current.x*_.current.x,P=x.current.y*_.current.y;T.scrollBy(E,P)},[]),C=L.useMemo(()=>a===L_.TreeOrder?[...u].reverse():u,[a,u]);L.useEffect(()=>{if(!o||!u.length||!b){v();return}for(const T of C){if((r==null?void 0:r(T))===!1)continue;const E=u.indexOf(T),P=d[E];if(!P)continue;const{direction:k,speed:O}=l9e(T,P,b,t,h);for(const M of["x","y"])g[M][k[M]]||(O[M]=0,k[M]=0);if(O.x>0||O.y>0){v(),y.current=T,m(S,s),x.current=O,_.current=k;return}}x.current={x:0,y:0},_.current={x:0,y:0},v()},[t,S,r,v,o,s,JSON.stringify(b),JSON.stringify(g),m,u,C,d,JSON.stringify(h)])}const _9e={x:{[xr.Backward]:!1,[xr.Forward]:!1},y:{[xr.Backward]:!1,[xr.Forward]:!1}};function b9e(e){let{delta:t,disabled:n}=e;const r=I_(t);return ey(i=>{if(n||!r||!i)return _9e;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[xr.Backward]:i.x[xr.Backward]||o.x===-1,[xr.Forward]:i.x[xr.Forward]||o.x===1},y:{[xr.Backward]:i.y[xr.Backward]||o.y===-1,[xr.Forward]:i.y[xr.Forward]||o.y===1}}},[n,t,r])}function S9e(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return ey(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function w9e(e,t){return L.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var cm;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(cm||(cm={}));var f4;(function(e){e.Optimized="optimized"})(f4||(f4={}));const O7=new Map;function x9e(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=L.useState(null),{frequency:a,measure:l,strategy:u}=i,d=L.useRef(e),f=x(),h=am(f),g=L.useCallback(function(_){_===void 0&&(_=[]),!h.current&&s(b=>b===null?_:b.concat(_.filter(y=>!b.includes(y))))},[h]),m=L.useRef(null),v=ey(_=>{if(f&&!n)return O7;if(!_||_===O7||d.current!==e||o!=null){const b=new Map;for(let y of e){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){b.set(y.id,y.rect.current);continue}const S=y.node.current,C=S?new $A(l(S),S):null;y.rect.current=C,C&&b.set(y.id,C)}return b}return _},[e,o,n,f,l]);return L.useEffect(()=>{d.current=e},[e]),L.useEffect(()=>{f||g()},[n,f]),L.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),L.useEffect(()=>{f||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{g(),m.current=null},a))},[a,f,g,...r]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:o!=null};function x(){switch(u){case cm.Always:return!1;case cm.BeforeDragging:return n;default:return!n}}}function BA(e,t){return ey(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function C9e(e,t){return BA(e,t)}function T9e(e){let{callback:t,disabled:n}=e;const r=x2(t),i=L.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return L.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function T2(e){let{callback:t,disabled:n}=e;const r=x2(t),i=L.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return L.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function E9e(e){return new $A(ty(e),e)}function k7(e,t,n){t===void 0&&(t=E9e);const[r,i]=L.useReducer(a,null),o=T9e({callback(l){if(e)for(const u of l){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),s=T2({callback:i});return Zs(()=>{i(),e?(s==null||s.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),o==null||o.disconnect())},[e]),r;function a(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const d=t(e);return JSON.stringify(l)===JSON.stringify(d)?l:d}}function A9e(e){const t=BA(e);return gG(e,t)}const I7=[];function P9e(e){const t=L.useRef(e),n=ey(r=>e?r&&r!==I7&&e&&t.current&&e.parentNode===t.current.parentNode?r:DA(e):I7,[e]);return L.useEffect(()=>{t.current=e},[e]),n}function R9e(e){const[t,n]=L.useState(null),r=L.useRef(e),i=L.useCallback(o=>{const s=CC(o.target);s&&n(a=>a?(a.set(s,c4(s)),new Map(a)):null)},[]);return L.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const u=CC(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,c4(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const u=CC(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),L.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>wf(o,s),ms):wG(e):ms,[e,t])}function M7(e,t){t===void 0&&(t=[]);const n=L.useRef(null);return L.useEffect(()=>{n.current=null},t),L.useEffect(()=>{const r=e!==ms;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?M_(e,n.current):ms}function O9e(e){L.useEffect(()=>{if(!w2)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function k9e(e,t){return L.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function RG(e){return L.useMemo(()=>e?i9e(e):null,[e])}const AC=[];function I9e(e,t){t===void 0&&(t=ty);const[n]=e,r=RG(n?xi(n):null),[i,o]=L.useReducer(a,AC),s=T2({callback:o});return e.length>0&&i===AC&&o(),Zs(()=>{e.length?e.forEach(l=>s==null?void 0:s.observe(l)):(s==null||s.disconnect(),o())},[e]),i;function a(){return e.length?e.map(l=>bG(l)?r:new $A(t(l),l)):AC}}function OG(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Jm(t)?t:e}function M9e(e){let{measure:t}=e;const[n,r]=L.useState(null),i=L.useCallback(u=>{for(const{target:d}of u)if(Jm(d)){r(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),o=T2({callback:i}),s=L.useCallback(u=>{const d=OG(u);o==null||o.disconnect(),d&&(o==null||o.observe(d)),r(d?t(d):null)},[t,o]),[a,l]=k_(s);return L.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const N9e=[{sensor:EG,options:{}},{sensor:TG,options:{}}],L9e={current:{}},Hv={draggable:{measure:E7},droppable:{measure:E7,strategy:cm.WhileDragging,frequency:f4.Optimized},dragOverlay:{measure:ty}};class Qp extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const D9e={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qp,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:N_},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hv,measureDroppableContainers:N_,windowRect:null,measuringScheduled:!1},kG={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:N_,draggableNodes:new Map,over:null,measureDroppableContainers:N_},ny=L.createContext(kG),IG=L.createContext(D9e);function $9e(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qp}}}function F9e(e,t){switch(t.type){case fr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case fr.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case fr.DragEnd:case fr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case fr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Qp(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case fr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Qp(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case fr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Qp(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function B9e(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=L.useContext(ny),o=I_(r),s=I_(n==null?void 0:n.id);return L.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!LA(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[l.current,u.current]){if(!d)continue;const f=k8e(d);if(f){f.focus();break}}})}},[r,t,i,s,o]),null}function MG(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function U9e(e){return L.useMemo(()=>({draggable:{...Hv.draggable,...e==null?void 0:e.draggable},droppable:{...Hv.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Hv.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function z9e(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=L.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Zs(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=gG(d,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=yG(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,s,a,r,n])}const E2=L.createContext({...ms,scaleX:1,scaleY:1});var El;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(El||(El={}));const V9e=L.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:d=N9e,collisionDetection:f=Y8e,measuring:h,modifiers:g,...m}=t;const v=L.useReducer(F9e,void 0,$9e),[x,_]=v,[b,y]=F8e(),[S,C]=L.useState(El.Uninitialized),T=S===El.Initialized,{draggable:{active:E,nodes:P,translate:k},droppable:{containers:O}}=x,M=E?P.get(E):null,V=L.useRef({initial:null,translated:null}),B=L.useMemo(()=>{var nn;return E!=null?{id:E,data:(nn=M==null?void 0:M.data)!=null?nn:L9e,rect:V}:null},[E,M]),A=L.useRef(null),[N,D]=L.useState(null),[U,$]=L.useState(null),j=am(m,Object.values(m)),G=C2("DndDescribedBy",s),q=L.useMemo(()=>O.getEnabled(),[O]),Z=U9e(h),{droppableRects:ee,measureDroppableContainers:ie,measuringScheduled:se}=x9e(q,{dragging:T,dependencies:[k.x,k.y],config:Z.droppable}),le=S9e(P,E),W=L.useMemo(()=>U?lm(U):null,[U]),ne=ia(),fe=C9e(le,Z.draggable.measure);z9e({activeNode:E?P.get(E):null,config:ne.layoutShiftCompensation,initialRect:fe,measure:Z.draggable.measure});const pe=k7(le,Z.draggable.measure,fe),ve=k7(le?le.parentElement:null),ye=L.useRef({activatorEvent:null,active:null,activeNode:le,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Je=O.getNodeFor((n=ye.current.over)==null?void 0:n.id),Fe=M9e({measure:Z.dragOverlay.measure}),Ae=(r=Fe.nodeRef.current)!=null?r:le,vt=T?(i=Fe.rect)!=null?i:pe:null,_e=!!(Fe.nodeRef.current&&Fe.rect),Qt=A9e(_e?null:pe),rr=RG(Ae?xi(Ae):null),qt=P9e(T?Je??le:null),ht=I9e(qt),At=MG(g,{transform:{x:k.x-Qt.x,y:k.y-Qt.y,scaleX:1,scaleY:1},activatorEvent:U,active:B,activeNodeRect:pe,containerNodeRect:ve,draggingNodeRect:vt,over:ye.current.over,overlayNodeRect:Fe.rect,scrollableAncestors:qt,scrollableAncestorRects:ht,windowRect:rr}),un=W?wf(W,k):null,Gr=R9e(qt),Pr=M7(Gr),Ci=M7(Gr,[pe]),In=wf(At,Pr),gn=vt?t9e(vt,At):null,ir=B&&gn?f({active:B,collisionRect:gn,droppableRects:ee,droppableContainers:q,pointerCoordinates:un}):null,mn=K8e(ir,"id"),[Zt,Rr]=L.useState(null),Hr=_e?At:wf(At,Ci),si=J8e(Hr,(o=Zt==null?void 0:Zt.rect)!=null?o:null,pe),Vi=L.useCallback((nn,Ft)=>{let{sensor:or,options:qn}=Ft;if(A.current==null)return;const yr=P.get(A.current);if(!yr)return;const Or=nn.nativeEvent,kr=new or({active:A.current,activeNode:yr,event:Or,options:qn,context:ye,onStart(Ir){const sr=A.current;if(sr==null)return;const ji=P.get(sr);if(!ji)return;const{onDragStart:bs}=j.current,fo={active:{id:sr,data:ji.data,rect:V}};Ms.unstable_batchedUpdates(()=>{bs==null||bs(fo),C(El.Initializing),_({type:fr.DragStart,initialCoordinates:Ir,active:sr}),b({type:"onDragStart",event:fo})})},onMove(Ir){_({type:fr.DragMove,coordinates:Ir})},onEnd:co(fr.DragEnd),onCancel:co(fr.DragCancel)});Ms.unstable_batchedUpdates(()=>{D(kr),$(nn.nativeEvent)});function co(Ir){return async function(){const{active:ji,collisions:bs,over:fo,scrollAdjustedTranslate:tl}=ye.current;let Vo=null;if(ji&&tl){const{cancelDrop:Mr}=j.current;Vo={activatorEvent:Or,active:ji,collisions:bs,delta:tl,over:fo},Ir===fr.DragEnd&&typeof Mr=="function"&&await Promise.resolve(Mr(Vo))&&(Ir=fr.DragCancel)}A.current=null,Ms.unstable_batchedUpdates(()=>{_({type:Ir}),C(El.Uninitialized),Rr(null),D(null),$(null);const Mr=Ir===fr.DragEnd?"onDragEnd":"onDragCancel";if(Vo){const oa=j.current[Mr];oa==null||oa(Vo),b({type:Mr,event:Vo})}})}}},[P]),$n=L.useCallback((nn,Ft)=>(or,qn)=>{const yr=or.nativeEvent,Or=P.get(qn);if(A.current!==null||!Or||yr.dndKit||yr.defaultPrevented)return;const kr={active:Or};nn(or,Ft.options,kr)===!0&&(yr.dndKit={capturedBy:Ft.sensor},A.current=qn,Vi(or,Ft))},[P,Vi]),ai=w9e(d,$n);O9e(d),Zs(()=>{pe&&S===El.Initializing&&C(El.Initialized)},[pe,S]),L.useEffect(()=>{const{onDragMove:nn}=j.current,{active:Ft,activatorEvent:or,collisions:qn,over:yr}=ye.current;if(!Ft||!or)return;const Or={active:Ft,activatorEvent:or,collisions:qn,delta:{x:In.x,y:In.y},over:yr};Ms.unstable_batchedUpdates(()=>{nn==null||nn(Or),b({type:"onDragMove",event:Or})})},[In.x,In.y]),L.useEffect(()=>{const{active:nn,activatorEvent:Ft,collisions:or,droppableContainers:qn,scrollAdjustedTranslate:yr}=ye.current;if(!nn||A.current==null||!Ft||!yr)return;const{onDragOver:Or}=j.current,kr=qn.get(mn),co=kr&&kr.rect.current?{id:kr.id,rect:kr.rect.current,data:kr.data,disabled:kr.disabled}:null,Ir={active:nn,activatorEvent:Ft,collisions:or,delta:{x:yr.x,y:yr.y},over:co};Ms.unstable_batchedUpdates(()=>{Rr(co),Or==null||Or(Ir),b({type:"onDragOver",event:Ir})})},[mn]),Zs(()=>{ye.current={activatorEvent:U,active:B,activeNode:le,collisionRect:gn,collisions:ir,droppableRects:ee,draggableNodes:P,draggingNode:Ae,draggingNodeRect:vt,droppableContainers:O,over:Zt,scrollableAncestors:qt,scrollAdjustedTranslate:In},V.current={initial:vt,translated:gn}},[B,le,ir,gn,P,Ae,vt,ee,O,Zt,qt,In]),v9e({...ne,delta:k,draggingRect:gn,pointerCoordinates:un,scrollableAncestors:qt,scrollableAncestorRects:ht});const ra=L.useMemo(()=>({active:B,activeNode:le,activeNodeRect:pe,activatorEvent:U,collisions:ir,containerNodeRect:ve,dragOverlay:Fe,draggableNodes:P,droppableContainers:O,droppableRects:ee,over:Zt,measureDroppableContainers:ie,scrollableAncestors:qt,scrollableAncestorRects:ht,measuringConfiguration:Z,measuringScheduled:se,windowRect:rr}),[B,le,pe,U,ir,ve,Fe,P,O,ee,Zt,ie,qt,ht,Z,se,rr]),uo=L.useMemo(()=>({activatorEvent:U,activators:ai,active:B,activeNodeRect:pe,ariaDescribedById:{draggable:G},dispatch:_,draggableNodes:P,over:Zt,measureDroppableContainers:ie}),[U,ai,B,pe,_,G,P,Zt,ie]);return jt.createElement(pG.Provider,{value:y},jt.createElement(ny.Provider,{value:uo},jt.createElement(IG.Provider,{value:ra},jt.createElement(E2.Provider,{value:si},u)),jt.createElement(B9e,{disabled:(a==null?void 0:a.restoreFocus)===!1})),jt.createElement(z8e,{...a,hiddenTextDescribedById:G}));function ia(){const nn=(N==null?void 0:N.autoScrollEnabled)===!1,Ft=typeof l=="object"?l.enabled===!1:l===!1,or=T&&!nn&&!Ft;return typeof l=="object"?{...l,enabled:or}:{enabled:or}}}),j9e=L.createContext(null),N7="button",G9e="Droppable";function H9e(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=C2(G9e),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=L.useContext(ny),{role:g=N7,roleDescription:m="draggable",tabIndex:v=0}=i??{},x=(l==null?void 0:l.id)===t,_=L.useContext(x?E2:j9e),[b,y]=k_(),[S,C]=k_(),T=k9e(s,t),E=am(n);Zs(()=>(f.set(t,{id:t,key:o,node:b,activatorNode:S,data:E}),()=>{const k=f.get(t);k&&k.key===o&&f.delete(t)}),[f,t]);const P=L.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&g===N7?!0:void 0,"aria-roledescription":m,"aria-describedby":d.draggable}),[r,g,v,x,m,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:P,isDragging:x,listeners:r?void 0:T,node:b,over:h,setNodeRef:y,setActivatorNodeRef:C,transform:_}}function W9e(){return L.useContext(IG)}const q9e="Droppable",K9e={timeout:25};function X9e(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=C2(q9e),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=L.useContext(ny),d=L.useRef({disabled:n}),f=L.useRef(!1),h=L.useRef(null),g=L.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:x}={...K9e,...i},_=am(v??r),b=L.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(_.current)?_.current:[_.current]),g.current=null},x)},[x]),y=T2({callback:b,disabled:m||!s}),S=L.useCallback((P,k)=>{y&&(k&&(y.unobserve(k),f.current=!1),P&&y.observe(P))},[y]),[C,T]=k_(S),E=am(t);return L.useEffect(()=>{!y||!C.current||(y.disconnect(),f.current=!1,y.observe(C.current))},[C,y]),Zs(()=>(a({type:fr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:C,rect:h,data:E}}),()=>a({type:fr.UnregisterDroppable,key:o,id:r})),[r]),L.useEffect(()=>{n!==d.current.disabled&&(a({type:fr.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:(l==null?void 0:l.id)===r,node:C,over:l,setNodeRef:T}}function Y9e(e){let{animation:t,children:n}=e;const[r,i]=L.useState(null),[o,s]=L.useState(null),a=I_(n);return!n&&!r&&a&&i(a),Zs(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),jt.createElement(jt.Fragment,null,n,r?L.cloneElement(r,{ref:s}):null)}const Q9e={x:0,y:0,scaleX:1,scaleY:1};function Z9e(e){let{children:t}=e;return jt.createElement(ny.Provider,{value:kG},jt.createElement(E2.Provider,{value:Q9e},t))}const J9e={position:"fixed",touchAction:"none"},eRe=e=>LA(e)?"transform 250ms ease":void 0,tRe=L.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:u,transition:d=eRe}=e;if(!a)return null;const f=i?u:{...u,scaleX:1,scaleY:1},h={...J9e,width:a.width,height:a.height,top:a.top,left:a.left,transform:um.Transform.toString(f),transformOrigin:i&&r?G8e(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return jt.createElement(n,{className:s,style:h,ref:t},o)}),nRe=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);s!=null&&s.active&&n.node.classList.remove(s.active)}},rRe=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:um.Transform.toString(t)},{transform:um.Transform.toString(n)}]},iRe={duration:250,easing:"ease",keyframes:rRe,sideEffects:nRe({styles:{active:{opacity:"0"}}})};function oRe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return x2((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const u=OG(s);if(!u)return;const{transform:d}=xi(s).getComputedStyle(s),f=mG(d);if(!f)return;const h=typeof t=="function"?t:sRe(t);return xG(l,i.draggable.measure),h({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:f})})}function sRe(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...iRe,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...u}=o;if(!t)return;const d={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},f={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-d.x,y:l.y-d.y,...f},g=i({...u,active:s,dragOverlay:a,transform:{initial:l,final:h}}),[m]=g,v=g[g.length-1];if(JSON.stringify(m)===JSON.stringify(v))return;const x=r==null?void 0:r({active:s,dragOverlay:a,...u}),_=a.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(b=>{_.onfinish=()=>{x==null||x(),b()}})}}let L7=0;function aRe(e){return L.useMemo(()=>{if(e!=null)return L7++,L7},[e])}const lRe=jt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:g,draggableNodes:m,droppableContainers:v,dragOverlay:x,over:_,measuringConfiguration:b,scrollableAncestors:y,scrollableAncestorRects:S,windowRect:C}=W9e(),T=L.useContext(E2),E=aRe(f==null?void 0:f.id),P=MG(s,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:g,draggingNodeRect:x.rect,over:_,overlayNodeRect:x.rect,scrollableAncestors:y,scrollableAncestorRects:S,transform:T,windowRect:C}),k=BA(h),O=oRe({config:r,draggableNodes:m,droppableContainers:v,measuringConfiguration:b}),M=k?x.setRef:void 0;return jt.createElement(Z9e,null,jt.createElement(Y9e,{animation:O},f&&E?jt.createElement(tRe,{key:E,id:f.id,ref:M,as:a,activatorEvent:d,adjustScale:t,className:l,transition:o,rect:k,style:{zIndex:u,...i},transform:P},n):null))}),uRe=e=>{let{activatorEvent:t,draggingNodeRect:n,transform:r}=e;if(n&&t){const i=lm(t);if(!i)return r;const o=i.x-n.left,s=i.y-n.top;return{...r,x:r.x+o-n.width/2,y:r.y+s-n.height/2}}return r},cRe=()=>Q$(),JMe=j$,lv=28,D7={w:lv,h:lv,maxW:lv,maxH:lv,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},dRe=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return ue.jsx(kA,{sx:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",cursor:"none"},children:ue.jsx(OA,{sx:{...D7},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?ue.jsxs(IA,{sx:{cursor:"none",userSelect:"none",position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...D7},children:[ue.jsx(i4,{children:e.dragData.payload.imageDTOs.length}),ue.jsx(i4,{size:"sm",children:"Images"})]}):null},fRe=L.memo(dRe);function eNe(e){return X9e(e)}function tNe(e){return H9e(e)}const nNe=(e,t)=>{if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROLNET_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:o}=t.data.current.payload,s=o.board_id??"none",a=e.context.boardId;return s!==a}return r==="IMAGE_DTOS"}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:o}=t.data.current.payload;return o.board_id!=="none"}return r==="IMAGE_DTOS"}default:return!1}};function hRe(e){return ue.jsx(V9e,{...e})}const pRe=e=>{const[t,n]=L.useState(null),r=ke("images"),i=cRe(),o=L.useCallback(d=>{r.trace({dragData:d.active.data.current},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),s=L.useCallback(d=>{var h;r.trace({dragData:d.active.data.current},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(iz({overData:f,activeData:t})),n(null))},[t,i,r]),a=T7(AG,{activationConstraint:{distance:10}}),l=T7(PG,{activationConstraint:{distance:10}}),u=V8e(a,l);return ue.jsxs(hRe,{onDragStart:o,onDragEnd:s,sensors:u,collisionDetection:Z8e,children:[e.children,ue.jsx(lRe,{dropAnimation:null,modifiers:[uRe],children:ue.jsx(QPe,{children:t&&ue.jsx(jPe.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:ue.jsx(fRe,{dragData:t})},"overlay-drag-image")})})]})},gRe=L.memo(pRe),mRe=L.lazy(()=>QN(()=>import("./App-7d912410.js"),["./App-7d912410.js","./menu-971c0572.js","./App-6125620a.css"],import.meta.url)),yRe=L.lazy(()=>QN(()=>import("./ThemeLocaleProvider-bc3e6f20.js"),["./ThemeLocaleProvider-bc3e6f20.js","./menu-971c0572.js","./ThemeLocaleProvider-5b992bc7.css"],import.meta.url)),vRe=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o})=>(L.useEffect(()=>(t&&Dg.set(t),e&&$g.set(e),o&&N1.set(o),HU(),i&&i.length>0?d5(Yk(),...i):d5(Yk()),()=>{$g.set(void 0),Dg.set(void 0),N1.set(void 0)}),[e,t,i,o]),ue.jsx(jt.StrictMode,{children:ue.jsx(Fde,{store:u3e,children:ue.jsx(jt.Suspense,{fallback:ue.jsx(o8e,{}),children:ue.jsx(yRe,{children:ue.jsx(gRe,{children:ue.jsx(mRe,{config:n,headerComponent:r})})})})})})),_Re=L.memo(vRe);PC.createRoot(document.getElementById("root")).render(ue.jsx(_Re,{}));export{KMe as $,L as A,ue as B,$o as C,Gn as D,mf as E,ii as F,rs as G,fme as H,Bi as I,Hl as J,Rs as K,i7e as L,CB as M,Ame as N,rye as O,gme as P,wpe as Q,Uf as R,Cg as S,G5e as T,zc as U,Cc as V,EV as W,FMe as X,LMe as Y,QPe as Z,jPe as _,VL as a,dQ as a$,MV as a0,iG as a1,$V as a2,DMe as a3,$Me as a4,j5e as a5,V5e as a6,BMe as a7,Ju as a8,Tc as a9,IA as aA,i4 as aB,OMe as aC,Kz as aD,_Ie as aE,R5e as aF,oA as aG,_V as aH,k5e as aI,Ms as aJ,HP as aK,sA as aL,Y7e as aM,sIe as aN,SIe as aO,wIe as aP,JIe as aQ,QIe as aR,Hu as aS,D_e as aT,JU as aU,M7e as aV,YIe as aW,nE as aX,OE as aY,eR as aZ,Cke as a_,U1 as aa,ZJ as ab,jt as ac,mTe as ad,qMe as ae,La as af,CV as ag,$6e as ah,VMe as ai,z5 as aj,NMe as ak,WMe as al,mi as am,PE as an,gb as ao,JMe as ap,s7e as aq,Bm as ar,oU as as,kU as at,fS as au,cRe as av,$7e as aw,Yn as ax,lc as ay,kA as az,CT as b,k7e as b$,xRe as b0,SRe as b1,wRe as b2,Ze as b3,dIe as b4,PIe as b5,AIe as b6,uIe as b7,XIe as b8,ZCe as b9,DRe as bA,lOe as bB,MRe as bC,YRe as bD,BRe as bE,mbe as bF,NRe as bG,oOe as bH,IRe as bI,hOe as bJ,$Re as bK,QRe as bL,FRe as bM,ZRe as bN,jRe as bO,eOe as bP,gbe as bQ,URe as bR,kO as bS,E7e as bT,A7e as bU,P7e as bV,GRe as bW,R7e as bX,HRe as bY,O7e as bZ,WRe as b_,eNe as ba,nNe as bb,WIe as bc,aIe as bd,lIe as be,gIe as bf,W3 as bg,cIe as bh,OA as bi,r8e as bj,NOe as bk,Ml as bl,T0 as bm,HIe as bn,jIe as bo,KIe as bp,GIe as bq,bRe as br,PRe as bs,RRe as bt,ORe as bu,kRe as bv,rOe as bw,iOe as bx,w7e as by,x7e as bz,Kte as c,kd as c$,Me as c0,mIe as c1,Efe as c2,T$ as c3,fke as c4,b$ as c5,ZIe as c6,tNe as c7,MMe as c8,rz as c9,D1e as cA,OOe as cB,FOe as cC,H7e as cD,que as cE,o7e as cF,D7e as cG,FT as cH,VIe as cI,BIe as cJ,UIe as cK,zIe as cL,t7e as cM,n7e as cN,$F as cO,aMe as cP,gc as cQ,CRe as cR,e7e as cS,DT as cT,ke as cU,VRe as cV,sMe as cW,PR as cX,NIe as cY,eE as cZ,vfe as c_,hIe as ca,j1 as cb,qIe as cc,pIe as cd,tR as ce,G1 as cf,RMe as cg,nMe as ch,IOe as ci,Z7e as cj,fIe as ck,bIe as cl,tE as cm,BT as cn,LRe as co,BOe as cp,oi as cq,j7e as cr,J7e as cs,Q7e as ct,p_e as cu,V7e as cv,W7e as cw,q7e as cx,Gue as cy,L1e as cz,Dae as d,bMe as d$,RR as d0,LIe as d1,DIe as d2,$Ie as d3,_fe as d4,FIe as d5,RF as d6,kIe as d7,MIe as d8,RIe as d9,uMe as dA,m$ as dB,TOe as dC,Hue as dD,Ns as dE,JRe as dF,cOe as dG,ARe as dH,Ale as dI,fOe as dJ,T7e as dK,EOe as dL,S7e as dM,ASe as dN,POe as dO,we as dP,Yi as dQ,Cn as dR,Gs as dS,rMe as dT,xOe as dU,Ele as dV,SOe as dW,wOe as dX,vOe as dY,_Oe as dZ,yOe as d_,NCe as da,QO as db,OIe as dc,COe as dd,pOe as de,bOe as df,nOe as dg,F7e as dh,Oc as di,U7e as dj,Aa as dk,CSe as dl,qRe as dm,zm as dn,lMe as dp,C7e as dq,iMe as dr,TMe as ds,h$ as dt,vMe as du,f1e as dv,tOe as dw,p$ as dx,oMe as dy,$ue as dz,VD as e,nke as e$,hMe as e0,X7e as e1,fMe as e2,CMe as e3,_Me as e4,K7e as e5,gMe as e6,pMe as e7,cMe as e8,yMe as e9,a7e as eA,l7e as eB,d7e as eC,c7e as eD,f7e as eE,y7e as eF,e0e as eG,rU as eH,jue as eI,gOe as eJ,qOe as eK,yke as eL,nIe as eM,sOe as eN,aOe as eO,gke as eP,vke as eQ,hz as eR,MQ as eS,ft as eT,kke as eU,Yke as eV,Xke as eW,cke as eX,Uke as eY,Zke as eZ,G_e as e_,ERe as ea,dMe as eb,mMe as ec,TRe as ed,qB as ee,LT as ef,SMe as eg,e_ as eh,Ue as ei,wMe as ej,NU as ek,zRe as el,xMe as em,j$ as en,Q$ as eo,b7e as ep,h7e as eq,p7e as er,g7e as es,xE as et,v7e as eu,_7e as ev,qg as ew,mb as ex,u7e as ey,e3e as ez,YL as f,PMe as f$,Eke as f0,mp as f1,wke as f2,rke as f3,gS as f4,Tke as f5,JOe as f6,xke as f7,eke as f8,ske as f9,Ske as fA,hke as fB,Mke as fC,Bke as fD,Nke as fE,uke as fF,tke as fG,Wke as fH,Hke as fI,$ke as fJ,Lke as fK,Dke as fL,rIe as fM,jke as fN,iIe as fO,bke as fP,_ke as fQ,ZOe as fR,QOe as fS,tIe as fT,dke as fU,V_e as fV,B_e as fW,U_e as fX,z_e as fY,WOe as fZ,AOe as f_,jOe as fa,VOe as fb,zOe as fc,Qke as fd,w$ as fe,Dg as ff,KOe as fg,XOe as fh,YOe as fi,Kke as fj,lke as fk,ake as fl,dce as fm,qke as fn,j_e as fo,ike as fp,OCe as fq,MCe as fr,pke as fs,Ike as ft,Oke as fu,Ake as fv,GOe as fw,HOe as fx,eMe as fy,tMe as fz,Rae as g,MOe as g0,y$ as g1,DOe as g2,LOe as g3,$Oe as g4,Cle as g5,N_e as g6,IMe as g7,TV as g8,HMe as g9,jMe as ga,UMe as gb,GMe as gc,Us as gd,zMe as ge,kMe as gf,pTe as gg,sTe as gh,XMe as gi,QMe as gj,ZMe as gk,oD as h,vi as i,Jf as j,hb as k,Er as l,fb as m,Tm as n,ps as o,gu as p,cb as q,Js as r,Am as s,vx as t,bT as u,KL as v,PT as w,LD as x,QL as y,Sle as z};