var lQ=Object.defineProperty;var uQ=(e,t,n)=>t in e?lQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Lw=(e,t,n)=>(uQ(e,typeof t!="symbol"?t+"":t,n),n),Fw=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var ae=(e,t,n)=>(Fw(e,t,"read from private field"),n?n.call(e):t.get(e)),Yn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},ca=(e,t,n,r)=>(Fw(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Vp=(e,t,n,r)=>({set _(i){ca(e,t,i,n)},get _(){return ae(e,t,r)}}),Ss=(e,t,n)=>(Fw(e,t,"access private method"),n);function aN(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 a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ES(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):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 sN={exports:{}},TS={},lN={exports:{}},Dt={};/** * @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 ry=Symbol.for("react.element"),cQ=Symbol.for("react.portal"),dQ=Symbol.for("react.fragment"),fQ=Symbol.for("react.strict_mode"),hQ=Symbol.for("react.profiler"),pQ=Symbol.for("react.provider"),gQ=Symbol.for("react.context"),mQ=Symbol.for("react.forward_ref"),yQ=Symbol.for("react.suspense"),vQ=Symbol.for("react.memo"),bQ=Symbol.for("react.lazy"),o6=Symbol.iterator;function _Q(e){return e===null||typeof e!="object"?null:(e=o6&&e[o6]||e["@@iterator"],typeof e=="function"?e:null)}var uN={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cN=Object.assign,dN={};function _p(e,t,n){this.props=e,this.context=t,this.refs=dN,this.updater=n||uN}_p.prototype.isReactComponent={};_p.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")};_p.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function fN(){}fN.prototype=_p.prototype;function uT(e,t,n){this.props=e,this.context=t,this.refs=dN,this.updater=n||uN}var cT=uT.prototype=new fN;cT.constructor=uT;cN(cT,_p.prototype);cT.isPureReactComponent=!0;var a6=Array.isArray,hN=Object.prototype.hasOwnProperty,dT={current:null},pN={key:!0,ref:!0,__self:!0,__source:!0};function gN(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)hN.call(t,r)&&!pN.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1>>1,U=M[B];if(0>>1;Bi(ee,$))Ji(j,ee)?(M[B]=j,M[J]=$,B=J):(M[B]=ee,M[Y]=$,B=Y);else if(Ji(j,$))M[B]=j,M[J]=$,B=J;else break e}}return R}function i(M,R){var $=M.sortIndex-R.sortIndex;return $!==0?$:M.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,_=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(M){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=M)r(u),R.sortIndex=R.expirationTime,t(l,R);else break;R=n(u)}}function v(M){if(m=!1,g(M),!p)if(n(l)!==null)p=!0,D(S);else{var R=n(u);R!==null&&L(v,R.startTime-M)}}function S(M,R){p=!1,m&&(m=!1,b(C),C=-1),h=!0;var $=f;try{for(g(R),d=n(l);d!==null&&(!(d.expirationTime>R)||M&&!k());){var B=d.callback;if(typeof B=="function"){d.callback=null,f=d.priorityLevel;var U=B(d.expirationTime<=R);R=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),g(R)}else r(l);d=n(l)}if(d!==null)var G=!0;else{var Y=n(u);Y!==null&&L(v,Y.startTime-R),G=!1}return G}finally{d=null,f=$,h=!1}}var x=!1,w=null,C=-1,T=5,E=-1;function k(){return!(e.unstable_now()-EM||125B?(M.sortIndex=$,t(u,M),n(l)===null&&M===n(u)&&(m?(b(C),C=-1):m=!0,L(v,$-B))):(M.sortIndex=U,t(l,M),p||h||(p=!0,D(S))),M},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(M){var R=f;return function(){var $=f;f=R;try{return M.apply(this,arguments)}finally{f=$}}}})(bN);vN.exports=bN;var RQ=vN.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 _N=I,ta=RQ;function le(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"),l3=Object.prototype.hasOwnProperty,OQ=/^[: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]*$/,u6={},c6={};function MQ(e){return l3.call(c6,e)?!0:l3.call(u6,e)?!1:OQ.test(e)?c6[e]=!0:(u6[e]=!0,!1)}function $Q(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 NQ(e,t,n,r){if(t===null||typeof t>"u"||$Q(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 ho(e,t,n,r,i,o,a){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=a}var Ri={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ri[e]=new ho(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ri[t]=new ho(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ri[e]=new ho(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ri[e]=new ho(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){Ri[e]=new ho(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ri[e]=new ho(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ri[e]=new ho(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ri[e]=new ho(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ri[e]=new ho(e,5,!1,e.toLowerCase(),null,!1,!1)});var hT=/[\-:]([a-z])/g;function pT(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(hT,pT);Ri[t]=new ho(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(hT,pT);Ri[t]=new ho(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(hT,pT);Ri[t]=new ho(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ri[e]=new ho(e,1,!1,e.toLowerCase(),null,!1,!1)});Ri.xlinkHref=new ho("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ri[e]=new ho(e,1,!1,e.toLowerCase(),null,!0,!0)});function gT(e,t,n,r){var i=Ri.hasOwnProperty(t)?Ri[t]:null;(i!==null?i.type!==0:r||!(2s||i[a]!==o[s]){var l=` `+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{jw=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Cg(e):""}function DQ(e){switch(e.tag){case 5:return Cg(e.type);case 16:return Cg("Lazy");case 13:return Cg("Suspense");case 19:return Cg("SuspenseList");case 0:case 2:case 15:return e=Uw(e.type,!1),e;case 11:return e=Uw(e.type.render,!1),e;case 1:return e=Uw(e.type,!0),e;default:return""}}function f3(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 Ff:return"Fragment";case Lf:return"Portal";case u3:return"Profiler";case mT:return"StrictMode";case c3:return"Suspense";case d3:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case wN:return(e.displayName||"Context")+".Consumer";case xN:return(e._context.displayName||"Context")+".Provider";case yT:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vT:return t=e.displayName||null,t!==null?t:f3(e.type)||"Memo";case Cu:t=e._payload,e=e._init;try{return f3(e(t))}catch{}}return null}function LQ(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 f3(t);case 8:return t===mT?"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 ac(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function AN(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function FQ(e){var t=AN(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(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ov(e){e._valueTracker||(e._valueTracker=FQ(e))}function EN(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=AN(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Eb(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 h3(e,t){var n=t.checked;return dr({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function f6(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ac(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 TN(e,t){t=t.checked,t!=null&&gT(e,"checked",t,!1)}function p3(e,t){TN(e,t);var n=ac(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")?g3(e,t.type,n):t.hasOwnProperty("defaultValue")&&g3(e,t.type,ac(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function h6(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 g3(e,t,n){(t!=="number"||Eb(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ag=Array.isArray;function ah(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=av.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xm(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gg={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},BQ=["Webkit","ms","Moz","O"];Object.keys(Gg).forEach(function(e){BQ.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Gg[t]=Gg[e]})});function RN(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Gg.hasOwnProperty(e)&&Gg[e]?(""+t).trim():t+"px"}function ON(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=RN(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var zQ=dr({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 v3(e,t){if(t){if(zQ[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(le(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(le(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(le(61))}if(t.style!=null&&typeof t.style!="object")throw Error(le(62))}}function b3(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 _3=null;function bT(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var S3=null,sh=null,lh=null;function m6(e){if(e=ay(e)){if(typeof S3!="function")throw Error(le(280));var t=e.stateNode;t&&(t=OS(t),S3(e.stateNode,e.type,t))}}function MN(e){sh?lh?lh.push(e):lh=[e]:sh=e}function $N(){if(sh){var e=sh,t=lh;if(lh=sh=null,m6(e),t)for(e=0;e>>=0,e===0?32:31-(YQ(e)/ZQ|0)|0}var sv=64,lv=4194304;function Eg(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 Ib(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=Eg(s):(o&=a,o!==0&&(r=Eg(o)))}else a=n&~i,a!==0?r=Eg(a):o!==0&&(r=Eg(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 iy(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-as(t),e[t]=n}function nX(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=qg),A6=String.fromCharCode(32),E6=!1;function eD(e,t){switch(e){case"keyup":return IX.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tD(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bf=!1;function OX(e,t){switch(e){case"compositionend":return tD(t);case"keypress":return t.which!==32?null:(E6=!0,A6);case"textInput":return e=t.data,e===A6&&E6?null:e;default:return null}}function MX(e,t){if(Bf)return e==="compositionend"||!TT&&eD(e,t)?(e=ZN(),D1=CT=Fu=null,Bf=!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=I6(n)}}function oD(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?oD(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function aD(){for(var e=window,t=Eb();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Eb(e.document)}return t}function kT(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 UX(e){var t=aD(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&oD(n.ownerDocument.documentElement,n)){if(r!==null&&kT(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=R6(n,o);var a=R6(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,zf=null,T3=null,Kg=null,k3=!1;function O6(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;k3||zf==null||zf!==Eb(r)||(r=zf,"selectionStart"in r&&kT(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}),Kg&&km(Kg,r)||(Kg=r,r=Mb(T3,"onSelect"),0Vf||(e.current=$3[Vf],$3[Vf]=null,Vf--)}function $n(e,t){Vf++,$3[Vf]=e.current,e.current=t}var sc={},Wi=Cc(sc),Po=Cc(!1),Pd=sc;function Vh(e,t){var n=e.type.contextTypes;if(!n)return sc;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 Io(e){return e=e.childContextTypes,e!=null}function Nb(){Kn(Po),Kn(Wi)}function B6(e,t,n){if(Wi.current!==sc)throw Error(le(168));$n(Wi,t),$n(Po,n)}function gD(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(le(108,LQ(e)||"Unknown",i));return dr({},n,r)}function Db(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||sc,Pd=Wi.current,$n(Wi,e),$n(Po,Po.current),!0}function z6(e,t,n){var r=e.stateNode;if(!r)throw Error(le(169));n?(e=gD(e,t,Pd),r.__reactInternalMemoizedMergedChildContext=e,Kn(Po),Kn(Wi),$n(Wi,e)):Kn(Po),$n(Po,n)}var wl=null,MS=!1,nC=!1;function mD(e){wl===null?wl=[e]:wl.push(e)}function eY(e){MS=!0,mD(e)}function Ac(){if(!nC&&wl!==null){nC=!0;var e=0,t=yn;try{var n=wl;for(yn=1;e>=a,i-=a,Ml=1<<32-as(t)+i|n<C?(T=w,w=null):T=w.sibling;var E=f(b,w,g[C],v);if(E===null){w===null&&(w=T);break}e&&w&&E.alternate===null&&t(b,w),y=o(E,y,C),x===null?S=E:x.sibling=E,x=E,w=T}if(C===g.length)return n(b,w),tr&&Hc(b,C),S;if(w===null){for(;CC?(T=w,w=null):T=w.sibling;var k=f(b,w,E.value,v);if(k===null){w===null&&(w=T);break}e&&w&&k.alternate===null&&t(b,w),y=o(k,y,C),x===null?S=k:x.sibling=k,x=k,w=T}if(E.done)return n(b,w),tr&&Hc(b,C),S;if(w===null){for(;!E.done;C++,E=g.next())E=d(b,E.value,v),E!==null&&(y=o(E,y,C),x===null?S=E:x.sibling=E,x=E);return tr&&Hc(b,C),S}for(w=r(b,w);!E.done;C++,E=g.next())E=h(w,b,C,E.value,v),E!==null&&(e&&E.alternate!==null&&w.delete(E.key===null?C:E.key),y=o(E,y,C),x===null?S=E:x.sibling=E,x=E);return e&&w.forEach(function(N){return t(b,N)}),tr&&Hc(b,C),S}function _(b,y,g,v){if(typeof g=="object"&&g!==null&&g.type===Ff&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case iv:e:{for(var S=g.key,x=y;x!==null;){if(x.key===S){if(S=g.type,S===Ff){if(x.tag===7){n(b,x.sibling),y=i(x,g.props.children),y.return=b,b=y;break e}}else if(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Cu&&W6(S)===x.type){n(b,x.sibling),y=i(x,g.props),y.ref=Qp(b,x,g),y.return=b,b=y;break e}n(b,x);break}else t(b,x);x=x.sibling}g.type===Ff?(y=bd(g.props.children,b.mode,v,g.key),y.return=b,b=y):(v=G1(g.type,g.key,g.props,null,b.mode,v),v.ref=Qp(b,y,g),v.return=b,b=v)}return a(b);case Lf:e:{for(x=g.key;y!==null;){if(y.key===x)if(y.tag===4&&y.stateNode.containerInfo===g.containerInfo&&y.stateNode.implementation===g.implementation){n(b,y.sibling),y=i(y,g.children||[]),y.return=b,b=y;break e}else{n(b,y);break}else t(b,y);y=y.sibling}y=cC(g,b.mode,v),y.return=b,b=y}return a(b);case Cu:return x=g._init,_(b,y,x(g._payload),v)}if(Ag(g))return p(b,y,g,v);if(Gp(g))return m(b,y,g,v);gv(b,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,y!==null&&y.tag===6?(n(b,y.sibling),y=i(y,g),y.return=b,b=y):(n(b,y),y=uC(g,b.mode,v),y.return=b,b=y),a(b)):n(b,y)}return _}var Hh=CD(!0),AD=CD(!1),sy={},Hs=Cc(sy),Om=Cc(sy),Mm=Cc(sy);function sd(e){if(e===sy)throw Error(le(174));return e}function LT(e,t){switch($n(Mm,t),$n(Om,e),$n(Hs,sy),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:y3(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=y3(t,e)}Kn(Hs),$n(Hs,t)}function qh(){Kn(Hs),Kn(Om),Kn(Mm)}function ED(e){sd(Mm.current);var t=sd(Hs.current),n=y3(t,e.type);t!==n&&($n(Om,e),$n(Hs,n))}function FT(e){Om.current===e&&(Kn(Hs),Kn(Om))}var lr=Cc(0);function Ub(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 rC=[];function BT(){for(var e=0;en?n:4,e(!0);var r=iC.transition;iC.transition={};try{e(!1),t()}finally{yn=n,iC.transition=r}}function UD(){return Ta().memoizedState}function iY(e,t,n){var r=Xu(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},VD(e))GD(t,n);else if(n=_D(e,t,n,r),n!==null){var i=so();ss(n,e,r,i),HD(n,t,r)}}function oY(e,t,n){var r=Xu(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(VD(e))GD(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,fs(s,a)){var l=t.interleaved;l===null?(i.next=i,NT(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=_D(e,t,i,r),n!==null&&(i=so(),ss(n,e,r,i),HD(n,t,r))}}function VD(e){var t=e.alternate;return e===cr||t!==null&&t===cr}function GD(e,t){Qg=Vb=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function HD(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ST(e,n)}}var Gb={readContext:Ea,useCallback:Li,useContext:Li,useEffect:Li,useImperativeHandle:Li,useInsertionEffect:Li,useLayoutEffect:Li,useMemo:Li,useReducer:Li,useRef:Li,useState:Li,useDebugValue:Li,useDeferredValue:Li,useTransition:Li,useMutableSource:Li,useSyncExternalStore:Li,useId:Li,unstable_isNewReconciler:!1},aY={readContext:Ea,useCallback:function(e,t){return Es().memoizedState=[e,t===void 0?null:t],e},useContext:Ea,useEffect:Q6,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,z1(4194308,4,LD.bind(null,t,e),n)},useLayoutEffect:function(e,t){return z1(4194308,4,e,t)},useInsertionEffect:function(e,t){return z1(4,2,e,t)},useMemo:function(e,t){var n=Es();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Es();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=iY.bind(null,cr,e),[r.memoizedState,e]},useRef:function(e){var t=Es();return e={current:e},t.memoizedState=e},useState:K6,useDebugValue:GT,useDeferredValue:function(e){return Es().memoizedState=e},useTransition:function(){var e=K6(!1),t=e[0];return e=rY.bind(null,e[1]),Es().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=cr,i=Es();if(tr){if(n===void 0)throw Error(le(407));n=n()}else{if(n=t(),di===null)throw Error(le(349));Rd&30||PD(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Q6(RD.bind(null,r,o,e),[e]),r.flags|=2048,Dm(9,ID.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Es(),t=di.identifierPrefix;if(tr){var n=$l,r=Ml;n=(r&~(1<<32-as(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=$m++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[Ns]=t,e[Rm]=r,eL(e,t,!1,!1),t.stateNode=e;e:{switch(a=b3(n,r),n){case"dialog":jn("cancel",e),jn("close",e),i=r;break;case"iframe":case"object":case"embed":jn("load",e),i=r;break;case"video":case"audio":for(i=0;iKh&&(t.flags|=128,r=!0,Xp(o,!1),t.lanes=4194304)}else{if(!r)if(e=Ub(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Xp(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!tr)return Fi(t),null}else 2*Ar()-o.renderingStartTime>Kh&&n!==1073741824&&(t.flags|=128,r=!0,Xp(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ar(),t.sibling=null,n=lr.current,$n(lr,r?n&1|2:n&1),t):(Fi(t),null);case 22:case 23:return XT(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Go&1073741824&&(Fi(t),t.subtreeFlags&6&&(t.flags|=8192)):Fi(t),null;case 24:return null;case 25:return null}throw Error(le(156,t.tag))}function pY(e,t){switch(IT(t),t.tag){case 1:return Io(t.type)&&Nb(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qh(),Kn(Po),Kn(Wi),BT(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return FT(t),null;case 13:if(Kn(lr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(le(340));Gh()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Kn(lr),null;case 4:return qh(),null;case 10:return $T(t.type._context),null;case 22:case 23:return XT(),null;case 24:return null;default:return null}}var yv=!1,Gi=!1,gY=typeof WeakSet=="function"?WeakSet:Set,Fe=null;function Wf(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){mr(e,t,r)}else n.current=null}function q3(e,t,n){try{n()}catch(r){mr(e,t,r)}}var i8=!1;function mY(e,t){if(P3=Rb,e=aD(),kT(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 a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(I3={focusedElem:e,selectionRange:n},Rb=!1,Fe=t;Fe!==null;)if(t=Fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Fe=e;else for(;Fe!==null;){t=Fe;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,_=p.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:Qa(t.type,m),_);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(le(163))}}catch(v){mr(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,Fe=e;break}Fe=t.return}return p=i8,i8=!1,p}function Xg(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&&q3(t,n,o)}i=i.next}while(i!==r)}}function DS(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 W3(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 rL(e){var t=e.alternate;t!==null&&(e.alternate=null,rL(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ns],delete t[Rm],delete t[M3],delete t[ZX],delete t[JX])),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 iL(e){return e.tag===5||e.tag===3||e.tag===4}function o8(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||iL(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 K3(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=$b));else if(r!==4&&(e=e.child,e!==null))for(K3(e,t,n),e=e.sibling;e!==null;)K3(e,t,n),e=e.sibling}function Q3(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(Q3(e,t,n),e=e.sibling;e!==null;)Q3(e,t,n),e=e.sibling}var wi=null,Ya=!1;function pu(e,t,n){for(n=n.child;n!==null;)oL(e,t,n),n=n.sibling}function oL(e,t,n){if(Gs&&typeof Gs.onCommitFiberUnmount=="function")try{Gs.onCommitFiberUnmount(kS,n)}catch{}switch(n.tag){case 5:Gi||Wf(n,t);case 6:var r=wi,i=Ya;wi=null,pu(e,t,n),wi=r,Ya=i,wi!==null&&(Ya?(e=wi,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):wi.removeChild(n.stateNode));break;case 18:wi!==null&&(Ya?(e=wi,n=n.stateNode,e.nodeType===8?tC(e.parentNode,n):e.nodeType===1&&tC(e,n),Em(e)):tC(wi,n.stateNode));break;case 4:r=wi,i=Ya,wi=n.stateNode.containerInfo,Ya=!0,pu(e,t,n),wi=r,Ya=i;break;case 0:case 11:case 14:case 15:if(!Gi&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&q3(n,t,a),i=i.next}while(i!==r)}pu(e,t,n);break;case 1:if(!Gi&&(Wf(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){mr(n,t,s)}pu(e,t,n);break;case 21:pu(e,t,n);break;case 22:n.mode&1?(Gi=(r=Gi)||n.memoizedState!==null,pu(e,t,n),Gi=r):pu(e,t,n);break;default:pu(e,t,n)}}function a8(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gY),t.forEach(function(r){var i=AY.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ha(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=Ar()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*vY(r/1960))-r,10e?16:e,Bu===null)var r=!1;else{if(e=Bu,Bu=null,Wb=0,qt&6)throw Error(le(331));var i=qt;for(qt|=4,Fe=e.current;Fe!==null;){var o=Fe,a=o.child;if(Fe.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lAr()-KT?vd(e,0):WT|=n),Ro(e,t)}function hL(e,t){t===0&&(e.mode&1?(t=lv,lv<<=1,!(lv&130023424)&&(lv=4194304)):t=1);var n=so();e=Wl(e,t),e!==null&&(iy(e,t,n),Ro(e,n))}function CY(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hL(e,n)}function AY(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(le(314))}r!==null&&r.delete(t),hL(e,n)}var pL;pL=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Po.current)Ao=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ao=!1,fY(e,t,n);Ao=!!(e.flags&131072)}else Ao=!1,tr&&t.flags&1048576&&yD(t,Fb,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;j1(e,t),e=t.pendingProps;var i=Vh(t,Wi.current);ch(t,n),i=jT(null,t,r,e,i,n);var o=UT();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,Io(r)?(o=!0,Db(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,DT(t),i.updater=$S,t.stateNode=i,i._reactInternals=t,B3(t,r,e,n),t=U3(null,t,r,!0,o,n)):(t.tag=0,tr&&o&&PT(t),io(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(j1(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=TY(r),e=Qa(r,e),i){case 0:t=j3(null,t,r,e,n);break e;case 1:t=t8(null,t,r,e,n);break e;case 11:t=J6(null,t,r,e,n);break e;case 14:t=e8(null,t,r,Qa(r.type,e),n);break e}throw Error(le(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Qa(r,i),j3(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Qa(r,i),t8(e,t,r,i,n);case 3:e:{if(YD(t),e===null)throw Error(le(387));r=t.pendingProps,o=t.memoizedState,i=o.element,SD(e,t),jb(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Wh(Error(le(423)),t),t=n8(e,t,r,n,i);break e}else if(r!==i){i=Wh(Error(le(424)),t),t=n8(e,t,r,n,i);break e}else for(Xo=Wu(t.stateNode.containerInfo.firstChild),Zo=t,tr=!0,Ja=null,n=AD(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gh(),r===i){t=Kl(e,t,n);break e}io(e,t,r,n)}t=t.child}return t;case 5:return ED(t),e===null&&D3(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,R3(r,i)?a=null:o!==null&&R3(r,o)&&(t.flags|=32),XD(e,t),io(e,t,a,n),t.child;case 6:return e===null&&D3(t),null;case 13:return ZD(e,t,n);case 4:return LT(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Hh(t,null,r,n):io(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Qa(r,i),J6(e,t,r,i,n);case 7:return io(e,t,t.pendingProps,n),t.child;case 8:return io(e,t,t.pendingProps.children,n),t.child;case 12:return io(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,$n(Bb,r._currentValue),r._currentValue=a,o!==null)if(fs(o.value,a)){if(o.children===i.children&&!Po.current){t=Kl(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Fl(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),L3(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(le(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),L3(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}io(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ch(t,n),i=Ea(i),r=r(i),t.flags|=1,io(e,t,r,n),t.child;case 14:return r=t.type,i=Qa(r,t.pendingProps),i=Qa(r.type,i),e8(e,t,r,i,n);case 15:return KD(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Qa(r,i),j1(e,t),t.tag=1,Io(r)?(e=!0,Db(t)):e=!1,ch(t,n),wD(t,r,i),B3(t,r,i,n),U3(null,t,r,!0,e,n);case 19:return JD(e,t,n);case 22:return QD(e,t,n)}throw Error(le(156,t.tag))};function gL(e,t){return jN(e,t)}function EY(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 wa(e,t,n,r){return new EY(e,t,n,r)}function ZT(e){return e=e.prototype,!(!e||!e.isReactComponent)}function TY(e){if(typeof e=="function")return ZT(e)?1:0;if(e!=null){if(e=e.$$typeof,e===yT)return 11;if(e===vT)return 14}return 2}function Yu(e,t){var n=e.alternate;return n===null?(n=wa(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 G1(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")ZT(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ff:return bd(n.children,i,o,t);case mT:a=8,i|=8;break;case u3:return e=wa(12,n,t,i|2),e.elementType=u3,e.lanes=o,e;case c3:return e=wa(13,n,t,i),e.elementType=c3,e.lanes=o,e;case d3:return e=wa(19,n,t,i),e.elementType=d3,e.lanes=o,e;case CN:return FS(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xN:a=10;break e;case wN:a=9;break e;case yT:a=11;break e;case vT:a=14;break e;case Cu:a=16,r=null;break e}throw Error(le(130,e==null?e:typeof e,""))}return t=wa(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function bd(e,t,n,r){return e=wa(7,e,r,t),e.lanes=n,e}function FS(e,t,n,r){return e=wa(22,e,r,t),e.elementType=CN,e.lanes=n,e.stateNode={isHidden:!1},e}function uC(e,t,n){return e=wa(6,e,null,t),e.lanes=n,e}function cC(e,t,n){return t=wa(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function kY(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 JT(e,t,n,r,i,o,a,s,l){return e=new kY(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=wa(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},DT(o),e}function PY(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bL)}catch(e){console.error(e)}}bL(),yN.exports=oa;var Wo=yN.exports;const MUe=xc(Wo);var p8=Wo;s3.createRoot=p8.createRoot,s3.hydrateRoot=p8.hydrateRoot;const $Y="modulepreload",NY=function(e,t){return new URL(e,t).href},g8={},_L=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=NY(o,r),o in g8)return;g8[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":$Y,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function ci(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:VS(e)?2:GS(e)?3:0}function Zu(e,t){return lc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function H1(e,t){return lc(e)===2?e.get(t):e[t]}function SL(e,t,n){var r=lc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function xL(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function VS(e){return jY&&e instanceof Map}function GS(e){return UY&&e instanceof Set}function ri(e){return e.o||e.t}function i4(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=CL(e);delete t[St];for(var n=hh(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=DY),Object.freeze(e),t&&Ql(e,function(n,r){return ly(r,!0)},!0)),e}function DY(){ci(2)}function o4(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function qs(e){var t=tA[e];return t||ci(18,e),t}function a4(e,t){tA[e]||(tA[e]=t)}function Fm(){return zm}function dC(e,t){t&&(qs("Patches"),e.u=[],e.s=[],e.v=t)}function Xb(e){eA(e),e.p.forEach(LY),e.p=null}function eA(e){e===zm&&(zm=e.l)}function m8(e){return zm={p:[],l:zm,h:e,m:!0,_:0}}function LY(e){var t=e[St];t.i===0||t.i===1?t.j():t.g=!0}function fC(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||qs("ES5").S(t,e,r),r?(n[St].P&&(Xb(t),ci(4)),Oo(e)&&(e=Yb(t,e),t.l||Zb(t,e)),t.u&&qs("Patches").M(n[St].t,e,t.u,t.s)):e=Yb(t,n,[]),Xb(t),t.u&&t.v(t.u,t.s),e!==qS?e:void 0}function Yb(e,t,n){if(o4(t))return t;var r=t[St];if(!r)return Ql(t,function(s,l){return y8(e,r,t,s,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Zb(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=i4(r.k):r.o,o=i,a=!1;r.i===3&&(o=new Set(i),i.clear(),a=!0),Ql(o,function(s,l){return y8(e,r,i,s,l,n,a)}),Zb(e,i,!1),n&&e.u&&qs("Patches").N(r,n,e.u,e.s)}return r.o}function y8(e,t,n,r,i,o,a){if(uo(i)){var s=Yb(e,i,o&&t&&t.i!==3&&!Zu(t.R,r)?o.concat(r):void 0);if(SL(n,r,s),!uo(s))return;e.m=!1}else a&&n.add(i);if(Oo(i)&&!o4(i)){if(!e.h.D&&e._<1)return;Yb(e,i),t&&t.A.l||Zb(e,i)}}function Zb(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&ly(t,n)}function hC(e,t){var n=e[St];return(n?ri(n):e)[t]}function v8(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 wo(e){e.P||(e.P=!0,e.l&&wo(e.l))}function pC(e){e.o||(e.o=i4(e.t))}function Bm(e,t,n){var r=VS(t)?qs("MapSet").F(t,n):GS(t)?qs("MapSet").T(t,n):e.O?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Fm(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=jm;a&&(l=[s],u=kg);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(t,n):qs("ES5").J(t,n);return(n?n.A:Fm()).p.push(r),r}function HS(e){return uo(e)||ci(22,e),function t(n){if(!Oo(n))return n;var r,i=n[St],o=lc(n);if(i){if(!i.P&&(i.i<4||!qs("ES5").K(i)))return i.t;i.I=!0,r=b8(n,o),i.I=!1}else r=b8(n,o);return Ql(r,function(a,s){i&&H1(i.t,a)===s||SL(r,a,t(s))}),o===3?new Set(r):r}(e)}function b8(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return i4(e)}function s4(){function e(o,a){var s=i[o];return s?s.enumerable=a:i[o]=s={configurable:!0,enumerable:a,get:function(){var l=this[St];return jm.get(l,o)},set:function(l){var u=this[St];jm.set(u,o,l)}},s}function t(o){for(var a=o.length-1;a>=0;a--){var s=o[a][St];if(!s.P)switch(s.i){case 5:r(s)&&wo(s);break;case 4:n(s)&&wo(s)}}}function n(o){for(var a=o.t,s=o.k,l=hh(s),u=l.length-1;u>=0;u--){var c=l[u];if(c!==St){var d=a[c];if(d===void 0&&!Zu(a,c))return!0;var f=s[c],h=f&&f[St];if(h?h.t!==d:!xL(f,d))return!0}}var p=!!a[St];return l.length!==hh(a).length+(p?0:1)}function r(o){var a=o.k;if(a.length!==o.t.length)return!0;var s=Object.getOwnPropertyDescriptor(a,a.length-1);if(s&&!s.get)return!0;for(var l=0;l1?b-1:0),g=1;g1?c-1:0),f=1;f=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 a=qs("Patches").$;return uo(n)?a(n,r):this.produce(n,function(s){return a(s,r)})},e}(),na=new AL,EL=na.produce,c4=na.produceWithPatches.bind(na),GY=na.setAutoFreeze.bind(na),HY=na.setUseProxies.bind(na),nA=na.applyPatches.bind(na),qY=na.createDraft.bind(na),WY=na.finishDraft.bind(na);const Ec=EL,KY=Object.freeze(Object.defineProperty({__proto__:null,Immer:AL,applyPatches:nA,castDraft:BY,castImmutable:zY,createDraft:qY,current:HS,default:Ec,enableAllPlugins:FY,enableES5:s4,enableMapSet:wL,enablePatches:l4,finishDraft:WY,freeze:ly,immerable:fh,isDraft:uo,isDraftable:Oo,nothing:qS,original:r4,produce:EL,produceWithPatches:c4,setAutoFreeze:GY,setUseProxies:HY},Symbol.toStringTag,{value:"Module"}));function Um(e){"@babel/helpers - typeof";return Um=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Um(e)}function QY(e,t){if(Um(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Um(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function XY(e){var t=QY(e,"string");return Um(t)==="symbol"?t:String(t)}function YY(e,t,n){return t=XY(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x8(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 w8(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Ci(1));return n(uy)(e,t)}if(typeof e!="function")throw new Error(Ci(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(Ci(3));return o}function d(m){if(typeof m!="function")throw new Error(Ci(4));if(l)throw new Error(Ci(5));var _=!0;return u(),s.push(m),function(){if(_){if(l)throw new Error(Ci(6));_=!1,u();var y=s.indexOf(m);s.splice(y,1),a=null}}}function f(m){if(!ZY(m))throw new Error(Ci(7));if(typeof m.type>"u")throw new Error(Ci(8));if(l)throw new Error(Ci(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var _=a=s,b=0;b<_.length;b++){var y=_[b];y()}return m}function h(m){if(typeof m!="function")throw new Error(Ci(10));i=m,f({type:Qh.REPLACE})}function p(){var m,_=d;return m={subscribe:function(y){if(typeof y!="object"||y===null)throw new Error(Ci(11));function g(){y.next&&y.next(c())}g();var v=_(g);return{unsubscribe:v}}},m[C8]=function(){return this},m}return f({type:Qh.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[C8]=p,r}var TL=uy;function JY(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:Qh.INIT});if(typeof r>"u")throw new Error(Ci(12));if(typeof n(void 0,{type:Qh.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Ci(13))})}function wp(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Ci(14));d[h]=_,c=c||_!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function A8(e,t){return function(){return t(e.apply(this,arguments))}}function kL(e,t){if(typeof e=="function")return A8(e,t);if(typeof e!="object"||e===null)throw new Error(Ci(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=A8(i,t))}return n}function Xh(){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 Jb}function i(s,l){r(s)===Jb&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var PL=function(t,n){return t===n};function rZ(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 s=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,b){var y=t?t+"."+_:_;if(l){var g=i.some(function(v){return v instanceof RegExp?v.test(y):y===v});if(g)return"continue"}if(!n(b))return{value:{keyPath:y,value:b}};if(typeof b=="object"&&(a=LL(b,y,n,r,i,o),a))return{value:a}},c=0,d=s;c-1}function _Z(e){return""+e}function UL(e){var t={},n=[],r,i={addCase:function(o,a){var s=typeof o=="string"?o:o.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=a,i},addMatcher:function(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function SZ(e){return typeof e=="function"}function VL(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?UL(t):[t,n,r],o=i[0],a=i[1],s=i[2],l;if(SZ(e))l=function(){return rA(e())};else{var u=rA(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=uc([o[f.type]],a.filter(function(p){var m=p.matcher;return m(f)}).map(function(p){var m=p.reducer;return m}));return h.filter(function(p){return!!p}).length===0&&(h=[s]),h.reduce(function(p,m){if(m)if(uo(p)){var _=p,b=m(_,f);return b===void 0?p:b}else{if(Oo(p))return Ec(p,function(y){return m(y,f)});var b=m(p,f);if(b===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return b}return p},d)}return c.getInitialState=l,c}function xZ(e,t){return e+"/"+t}function nr(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:rA(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},a={},s={};i.forEach(function(c){var d=r[c],f=xZ(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,a[f]=h,s[c]=p?De(f,p):De(f)});function l(){var c=typeof e.extraReducers=="function"?UL(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],_=m===void 0?void 0:m,b=Eo(Eo({},f),a);return VL(n,function(y){for(var g in b)y.addCase(g,b[g]);for(var v=0,S=p;v0;if(y){var g=p.filter(function(v){return u(_,v,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var _=GL(p,e,m),b=_[0],y=_[1];d(y,m),n(b,m)}return{removeAll:EZ(l),addOne:wr(t),addMany:wr(n),setOne:wr(r),setMany:wr(i),setAll:wr(o),updateOne:wr(c),updateMany:wr(d),upsertOne:wr(f),upsertMany:wr(h),removeOne:wr(a),removeMany:wr(s)}}function TZ(e,t){var n=HL(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function a(y,g){return s([y],g)}function s(y,g){y=_d(y);var v=y.filter(function(S){return!(Jg(S,e)in g.entities)});v.length!==0&&_(v,g)}function l(y,g){return u([y],g)}function u(y,g){y=_d(y),y.length!==0&&_(y,g)}function c(y,g){y=_d(y),g.entities={},g.ids=[],s(y,g)}function d(y,g){return f([y],g)}function f(y,g){for(var v=!1,S=0,x=y;S-1;return n&&r}function fy(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function QS(){for(var e=[],t=0;t0)for(var g=h.getState(),v=Array.from(n.values()),S=0,x=v;SMath.floor(e/t)*t,qo=(e,t)=>Math.round(e/t)*t;var qZ=typeof global=="object"&&global&&global.Object===Object&&global;const uF=qZ;var WZ=typeof self=="object"&&self&&self.Object===Object&&self,KZ=uF||WZ||Function("return this")();const al=KZ;var QZ=al.Symbol;const ka=QZ;var cF=Object.prototype,XZ=cF.hasOwnProperty,YZ=cF.toString,Zp=ka?ka.toStringTag:void 0;function ZZ(e){var t=XZ.call(e,Zp),n=e[Zp];try{e[Zp]=void 0;var r=!0}catch{}var i=YZ.call(e);return r&&(t?e[Zp]=n:delete e[Zp]),i}var JZ=Object.prototype,eJ=JZ.toString;function tJ(e){return eJ.call(e)}var nJ="[object Null]",rJ="[object Undefined]",M8=ka?ka.toStringTag:void 0;function ys(e){return e==null?e===void 0?rJ:nJ:M8&&M8 in Object(e)?ZZ(e):tJ(e)}function Mo(e){return e!=null&&typeof e=="object"}var iJ="[object Symbol]";function XS(e){return typeof e=="symbol"||Mo(e)&&ys(e)==iJ}function dF(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=LJ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function jJ(e){return function(){return e}}var UJ=function(){try{var e=Qd(Object,"defineProperty");return e({},"",{}),e}catch{}}();const o_=UJ;var VJ=o_?function(e,t){return o_(e,"toString",{configurable:!0,enumerable:!1,value:jJ(t),writable:!0})}:YS;const GJ=VJ;var HJ=zJ(GJ);const gF=HJ;function mF(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var YJ=9007199254740991,ZJ=/^(?:0|[1-9]\d*)$/;function m4(e,t){var n=typeof e;return t=t??YJ,!!t&&(n=="number"||n!="symbol"&&ZJ.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=tee}function Ap(e){return e!=null&&y4(e.length)&&!g4(e)}function JS(e,t,n){if(!$o(n))return!1;var r=typeof t;return(r=="number"?Ap(n)&&m4(t,n.length):r=="string"&&t in n)?my(n[t],e):!1}function _F(e){return bF(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&JS(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function mte(e,t){var n=this.__data__,r=t2(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function ru(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(s)?t>1?TF(s,t-1,n,r,i):w4(i,s):r||(i[i.length]=s)}return i}function Mte(e){var t=e==null?0:e.length;return t?TF(e,1):[]}function $te(e){return gF(vF(e,void 0,Mte),e+"")}var Nte=AF(Object.getPrototypeOf,Object);const C4=Nte;var Dte="[object Object]",Lte=Function.prototype,Fte=Object.prototype,kF=Lte.toString,Bte=Fte.hasOwnProperty,zte=kF.call(Object);function PF(e){if(!Mo(e)||ys(e)!=Dte)return!1;var t=C4(e);if(t===null)return!0;var n=Bte.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&kF.call(n)==zte}function IF(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:IF(e,t,n)}var jte="\\ud800-\\udfff",Ute="\\u0300-\\u036f",Vte="\\ufe20-\\ufe2f",Gte="\\u20d0-\\u20ff",Hte=Ute+Vte+Gte,qte="\\ufe0e\\ufe0f",Wte="\\u200d",Kte=RegExp("["+Wte+jte+Hte+qte+"]");function i2(e){return Kte.test(e)}function Qte(e){return e.split("")}var OF="\\ud800-\\udfff",Xte="\\u0300-\\u036f",Yte="\\ufe20-\\ufe2f",Zte="\\u20d0-\\u20ff",Jte=Xte+Yte+Zte,ene="\\ufe0e\\ufe0f",tne="["+OF+"]",sA="["+Jte+"]",lA="\\ud83c[\\udffb-\\udfff]",nne="(?:"+sA+"|"+lA+")",MF="[^"+OF+"]",$F="(?:\\ud83c[\\udde6-\\uddff]){2}",NF="[\\ud800-\\udbff][\\udc00-\\udfff]",rne="\\u200d",DF=nne+"?",LF="["+ene+"]?",ine="(?:"+rne+"(?:"+[MF,$F,NF].join("|")+")"+LF+DF+")*",one=LF+DF+ine,ane="(?:"+[MF+sA+"?",sA,$F,NF,tne].join("|")+")",sne=RegExp(lA+"(?="+lA+")|"+ane+one,"g");function lne(e){return e.match(sne)||[]}function FF(e){return i2(e)?lne(e):Qte(e)}function une(e){return function(t){t=Zh(t);var n=i2(t)?FF(t):void 0,r=n?n[0]:t.charAt(0),i=n?RF(n,1).join(""):t.slice(1);return r[e]()+i}}var cne=une("toUpperCase");const BF=cne;function zF(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 zu(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=W1(n),n=n===n?n:0),t!==void 0&&(t=W1(t),t=t===t?t:0),ere(W1(e),t,n)}function tre(){this.__data__=new ru,this.size=0}function nre(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function rre(e){return this.__data__.get(e)}function ire(e){return this.__data__.has(e)}var ore=200;function are(e,t){var n=this.__data__;if(n instanceof ru){var r=n.__data__;if(!qm||r.lengths))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&jie?new Wm:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),Cp(e,oB(e),n),r&&(n=tm(n,rae|iae|oae,nae));for(var i=t.length;i--;)SB(n,t[i]);return n});const _y=aae;var sae=yB("length");const lae=sae;var xB="\\ud800-\\udfff",uae="\\u0300-\\u036f",cae="\\ufe20-\\ufe2f",dae="\\u20d0-\\u20ff",fae=uae+cae+dae,hae="\\ufe0e\\ufe0f",pae="["+xB+"]",pA="["+fae+"]",gA="\\ud83c[\\udffb-\\udfff]",gae="(?:"+pA+"|"+gA+")",wB="[^"+xB+"]",CB="(?:\\ud83c[\\udde6-\\uddff]){2}",AB="[\\ud800-\\udbff][\\udc00-\\udfff]",mae="\\u200d",EB=gae+"?",TB="["+hae+"]?",yae="(?:"+mae+"(?:"+[wB,CB,AB].join("|")+")"+TB+EB+")*",vae=TB+EB+yae,bae="(?:"+[wB+pA+"?",pA,CB,AB,pae].join("|")+")",pI=RegExp(gA+"(?="+gA+")|"+bae+vae,"g");function _ae(e){for(var t=pI.lastIndex=0;pI.test(e);)++t;return t}function kB(e){return i2(e)?_ae(e):lae(e)}var Sae=Math.floor,xae=Math.random;function wae(e,t){return e+Sae(xae()*(t-e+1))}var Cae=parseFloat,Aae=Math.min,Eae=Math.random;function Tae(e,t,n){if(n&&typeof n!="boolean"&&JS(e,t,n)&&(t=n=void 0),n===void 0&&(typeof t=="boolean"?(n=t,t=void 0):typeof e=="boolean"&&(n=e,e=void 0)),e===void 0&&t===void 0?(e=0,t=1):(e=yh(e),t===void 0?(t=e,e=0):t=yh(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=Eae();return Aae(e+i*(t-e+Cae("1e-"+((i+"").length-1))),t)}return wae(e,t)}var kae=Math.ceil,Pae=Math.max;function Iae(e,t,n,r){for(var i=-1,o=Pae(kae((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function Rae(e){return function(t,n,r){return r&&typeof r!="number"&&JS(t,n,r)&&(n=r=void 0),t=yh(t),n===void 0?(n=t,t=0):n=yh(n),r=r===void 0?t=o)return e;var s=n-kB(r);if(s<1)return r;var l=a?RF(a,0,s).join(""):e.slice(0,s);if(i===void 0)return l+r;if(a&&(s+=l.length-s),Joe(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,Zh(Uae.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?s:d)}}else if(e.indexOf(i_(i),s)!=s){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var Vae=1/0,Gae=bh&&1/T4(new bh([,-0]))[1]==Vae?function(e){return new bh(e)}:DJ;const Hae=Gae;var qae=200;function PB(e,t,n){var r=-1,i=XJ,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=Loe;else if(o>=qae){var u=t?null:Hae(e);if(u)return T4(u);a=!1,i=fB,l=new Wm}else l=t?[]:s;e:for(;++r{_h(e,t.payload)}}}),{configChanged:Kae}=RB.actions,Qae=RB.reducer,OB=De("socket/socketConnected"),R4=De("socket/appSocketConnected"),MB=De("socket/socketDisconnected"),$B=De("socket/appSocketDisconnected"),Xae=De("socket/socketSubscribedSession"),Yae=De("socket/appSocketSubscribedSession"),Zae=De("socket/socketUnsubscribedSession"),Jae=De("socket/appSocketUnsubscribedSession"),NB=De("socket/socketInvocationStarted"),O4=De("socket/appSocketInvocationStarted"),M4=De("socket/socketInvocationComplete"),$4=De("socket/appSocketInvocationComplete"),DB=De("socket/socketInvocationError"),c2=De("socket/appSocketInvocationError"),LB=De("socket/socketGraphExecutionStateComplete"),FB=De("socket/appSocketGraphExecutionStateComplete"),BB=De("socket/socketGeneratorProgress"),N4=De("socket/appSocketGeneratorProgress"),zB=De("socket/socketModelLoadStarted"),jB=De("socket/appSocketModelLoadStarted"),UB=De("socket/socketModelLoadCompleted"),VB=De("socket/appSocketModelLoadCompleted"),GB=De("socket/socketSessionRetrievalError"),HB=De("socket/appSocketSessionRetrievalError"),qB=De("socket/socketInvocationRetrievalError"),WB=De("socket/appSocketInvocationRetrievalError"),KB=De("socket/socketQueueItemStatusChanged"),d2=De("socket/appSocketQueueItemStatusChanged");let wv;const ese=new Uint8Array(16);function tse(){if(!wv&&(wv=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!wv))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return wv(ese)}const xi=[];for(let e=0;e<256;++e)xi.push((e+256).toString(16).slice(1));function nse(e,t=0){return(xi[e[t+0]]+xi[e[t+1]]+xi[e[t+2]]+xi[e[t+3]]+"-"+xi[e[t+4]]+xi[e[t+5]]+"-"+xi[e[t+6]]+xi[e[t+7]]+"-"+xi[e[t+8]]+xi[e[t+9]]+"-"+xi[e[t+10]]+xi[e[t+11]]+xi[e[t+12]]+xi[e[t+13]]+xi[e[t+14]]+xi[e[t+15]]).toLowerCase()}const rse=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),yI={randomUUID:rse};function nm(e,t,n){if(yI.randomUUID&&!t&&!e)return yI.randomUUID();e=e||{};const r=e.random||(e.rng||tse)();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 nse(r)}const ise={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 s_{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||ise,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{a(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(a=>{a.apply(a,[t,...r])})}}function Jp(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function vI(e){return e==null?"":""+e}function ose(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function D4(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const a=r(o.shift());!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function bI(e,t,n){const{obj:r,k:i}=D4(e,t,Object);r[i]=n}function ase(e,t,n,r){const{obj:i,k:o}=D4(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function l_(e,t){const{obj:n,k:r}=D4(e,t);if(n)return n[r]}function sse(e,t,n){const r=l_(e,n);return r!==void 0?r:l_(t,n)}function QB(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]):QB(e[r],t[r],n):e[r]=t[r]);return e}function hf(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var lse={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function use(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>lse[t]):e}const cse=[" ",",","?","!",";"];function dse(e,t,n){t=t||"",n=n||"";const r=cse.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(e);if(!o){const a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function u_(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+a;)a++,s=r.slice(o,o+a).join(n),l=i[s];if(l===void 0)return;if(l===null)return null;if(t.endsWith(s)){if(typeof l=="string")return l;if(s&&typeof l[s]=="string")return l[s]}const u=r.slice(o+a).join(n);return u?u_(l,u,n):void 0}i=i[r[o]]}return i}function c_(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class _I extends f2{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,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s=[t,n];r&&typeof r!="string"&&(s=s.concat(r)),r&&typeof r=="string"&&(s=s.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(s=t.split("."));const l=l_(this.data,s);return l||!a||typeof r!="string"?l:u_(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 a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[t,n];r&&(s=s.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),bI(this.data,s,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 a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let l=l_(this.data,s)||{};i?QB(l,r,o):l={...l,...r},bI(this.data,s,l),a.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 XB={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 SI={};class d_ extends f2{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ose(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=zs.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 a=r&&t.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!dse(t,r,i);if(a&&!s){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:a,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const v=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${v}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:`${l}${v}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,p=d&&d.exactUsedKey||a,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof b=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const v=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(d.res=v,d):v}if(o){const v=m==="[object Array]",S=v?[]:{},x=v?p:h;for(const w in f)if(Object.prototype.hasOwnProperty.call(f,w)){const C=`${x}${o}${w}`;S[w]=this.translate(C,{...n,joinArrays:!1,ns:s}),S[w]===C&&(S[w]=f[w])}f=S}}else if(y&&typeof b=="string"&&m==="[object Array]")f=f.join(b),f&&(f=this.extendTranslation(f,t,n,r));else{let v=!1,S=!1;const x=n.count!==void 0&&typeof n.count!="string",w=d_.hasDefaultValue(n),C=x?this.pluralResolver.getSuffix(u,n.count,n):"",T=n.ordinal&&x?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",E=n[`defaultValue${C}`]||n[`defaultValue${T}`]||n.defaultValue;!this.isValidLookup(f)&&w&&(v=!0,f=E),this.isValidLookup(f)||(S=!0,f=a);const N=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,O=w&&E!==f&&this.options.updateMissing;if(S||v||O){if(this.logger.log(O?"updateKey":"missingKey",u,l,a,O?E:f),o){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.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 P=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&P&&P[0])for(let L=0;L{const $=w&&R!==f?R:N;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,M,$,O,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,M,$,O,n),this.emit("missingKey",L,l,M,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?A.forEach(L=>{this.pluralResolver.getSuffixes(L,n).forEach(M=>{D([L],a+M,n[`defaultValue${M}`]||E)})}):D(A,a,E))}f=this.extendTranslation(f,t,n,d,r),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(S||v)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,v?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var a=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 c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,s;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(s=_,!SI[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(SI[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" 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!!!")),m.forEach(b=>{if(this.isValidLookup(r))return;a=b;const y=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,c,b,_,n);else{let v;f&&(v=this.pluralResolver.getSuffix(b,n.count,n));const S=`${this.options.pluralSeparator}zero`,x=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(y.push(c+v),n.ordinal&&v.indexOf(x)===0&&y.push(c+v.replace(x,this.options.pluralSeparator)),h&&y.push(c+S)),p){const w=`${c}${this.options.contextSeparator}${n.context}`;y.push(w),f&&(y.push(w+v),n.ordinal&&v.indexOf(x)===0&&y.push(w+v.replace(x,this.options.pluralSeparator)),h&&y.push(w+S))}}let g;for(;g=y.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(b,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:s}}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 SC(e){return e.charAt(0).toUpperCase()+e.slice(1)}class xI{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=zs.create("languageUtils")}getScriptPartFromCode(t){if(t=c_(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=c_(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]=SC(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]=SC(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=SC(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=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};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(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}let fse=[{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}],hse={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 pse=["v1","v2","v3"],gse=["v4"],wI={zero:0,one:1,two:2,few:3,many:4,other:5};function mse(){const e={};return fse.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:hse[t.fc]}})}),e}class yse{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=zs.create("pluralResolver"),(!this.options.compatibilityJSON||gse.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=mse()}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(c_(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)=>wI[i]-wI[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!pse.includes(this.options.compatibilityJSON)}}function CI(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=sse(e,t,n);return!o&&i&&typeof n=="string"&&(o=u_(e,n,r),o===void 0&&(o=u_(t,n,r))),o}class vse{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=zs.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:use,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?hf(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?hf(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?hf(n.nestingPrefix):n.nestingPrefixEscaped||hf("$t("),this.nestingSuffix=n.nestingSuffix?hf(n.nestingSuffix):n.nestingSuffixEscaped||hf(")"),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,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const y=CI(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...n,interpolationkey:p}):y}const m=p.split(this.formatSeparator),_=m.shift().trim(),b=m.join(this.formatSeparator).trim();return this.format(CI(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(s=0;o=p.regex.exec(t);){const m=o[1].trim();if(a=c(m),a===void 0)if(typeof d=="function"){const b=d(t,o,i);a=typeof b=="string"?b:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=vI(a));const _=p.safeValue(a);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;function s(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete a.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(s.call(this,i[1].trim(),a),a),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=vI(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function bse(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(a=>{if(!a)return;const[s,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=u),u==="false"&&(n[s.trim()]=!1),u==="true"&&(n[s.trim()]=!0),isNaN(u)||(n[s.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function pf(e){const t={};return function(r,i,o){const a=i+JSON.stringify(o);let s=t[a];return s||(s=e(c_(i),o),t[a]=s),s(r)}}class _se{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=zs.create("formatter"),this.options=t,this.formats={number:pf((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:pf((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:pf((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:pf((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:pf((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()]=pf(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((s,l)=>{const{formatName:u,formatOptions:c}=bse(l);if(this.formats[u]){let d=s;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](s,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}function Sse(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class xse extends f2{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=zs.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={},a={},s={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(s[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),r&&this.store.addResourceBundle(o,a,r),this.state[t]=n?-1:2;const s={};this.queue.forEach(l=>{ase(l.loaded,[o],a),Sse(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{s[u][d]===void 0&&(s[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),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,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const s=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,a)},o);return}a(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>s(null,c)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}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(a=>{this.loadOne(a)})}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,(a,s)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&s&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,s),this.loaded(t,a,s)})}saveMissing(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=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={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}else u(t,n,r,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function AI(){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 EI(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 Cv(){}function wse(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Km extends f2{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=EI(t),this.services={},this.logger=zs,this.modules={external:[]},wse(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=AI();this.options={...i,...this.options,...EI(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(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?zs.init(o(this.modules.logger),this.options):zs.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=_se);const d=new xI(this.options);this.store=new _I(this.options.resources,this.options);const f=this.services;f.logger=zs,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new yse(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new vse(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new xse(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Cv),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[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(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=Jp(),u=()=>{const c=(d,f)=>{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(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};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]:Cv;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=[],a=s=>{if(!s)return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(s=>a(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(t,n,r){const i=Jp();return t||(t=this.languages),n||(n=this.options.ns),r||(r=Cv),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"&&XB.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=Jp();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(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)})},s=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,c=>{a(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,r){var i=this;const o=function(a,s){let l;if(typeof s!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,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 a=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};if(n.precheck){const s=n.precheck(this,a);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!i||a(o,t)))}loadNamespaces(t,n){const r=Jp();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=Jp();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(a=>i.indexOf(a)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),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 xI(AI());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 Km(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Cv;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Km(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new _I(this.store.data,i),o.services.resourceStore=o.store),o.translator=new d_(o.services,i),o.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c{switch(t){case"controlnet":return _h(Ut(Cse),{id:e,...n});case"t2i_adapter":return _h(Ut(Ase),{id:e,...n});case"ip_adapter":return _h(Ut(Ese),{id:e,...n});default:throw new Error(`Unknown control adapter type: ${t}`)}},L4=De("controlAdapters/imageProcessed"),h2=e=>e.type==="controlnet",YB=e=>e.type==="ip_adapter",F4=e=>e.type==="t2i_adapter",Ho=e=>h2(e)||F4(e),ar=Ra(),{selectById:eo,selectAll:Pa,selectEntities:$Ue,selectIds:NUe,selectTotal:DUe}=ar.getSelectors(),vA=ar.getInitialState({pendingControlImages:[]}),ZB=e=>Pa(e).filter(h2),Tse=e=>Pa(e).filter(h2).filter(t=>t.isEnabled&&t.model&&(!!t.processedControlImage||t.processorType==="none"&&!!t.controlImage)),kse=e=>Pa(e).filter(YB),Pse=e=>Pa(e).filter(YB).filter(t=>t.isEnabled&&t.model&&!!t.controlImage),JB=e=>Pa(e).filter(F4),Ise=e=>Pa(e).filter(F4).filter(t=>t.isEnabled&&t.model&&(!!t.processedControlImage||t.processorType==="none"&&!!t.controlImage)),Rse=(e,t)=>{const n=ZB(e).filter(r=>r.id!==t).map(r=>({id:r.id,changes:{isEnabled:!1}}));ar.updateMany(e,n)},Ose=(e,t)=>{const n=JB(e).filter(r=>r.id!==t).map(r=>({id:r.id,changes:{isEnabled:!1}}));ar.updateMany(e,n)},eg=(e,t,n)=>{t==="controlnet"&&Ose(e,n),t==="t2i_adapter"&&Rse(e,n)},ez=nr({name:"controlAdapters",initialState:vA,reducers:{controlAdapterAdded:{reducer:(e,t)=>{const{id:n,type:r,overrides:i}=t.payload;ar.addOne(e,TI(n,r,i)),eg(e,r,n)},prepare:({type:e,overrides:t})=>({payload:{id:nm(),type:e,overrides:t}})},controlAdapterRecalled:(e,t)=>{ar.addOne(e,t.payload);const{type:n,id:r}=t.payload;eg(e,n,r)},controlAdapterDuplicated:{reducer:(e,t)=>{const{id:n,newId:r}=t.payload,i=eo(e,n);if(!i)return;const o=_h(Ut(i),{id:r,isEnabled:!0});ar.addOne(e,o);const{type:a}=o;eg(e,a,r)},prepare:e=>({payload:{id:e,newId:nm()}})},controlAdapterAddedFromImage:{reducer:(e,t)=>{const{id:n,type:r,controlImage:i}=t.payload;ar.addOne(e,TI(n,r,{controlImage:i})),eg(e,r,n)},prepare:e=>({payload:{...e,id:nm()}})},controlAdapterRemoved:(e,t)=>{ar.removeOne(e,t.payload.id)},controlAdapterIsEnabledChanged:(e,t)=>{const{id:n,isEnabled:r}=t.payload;if(ar.updateOne(e,{id:n,changes:{isEnabled:r}}),r){const i=eo(e,n);i&&eg(e,i.type,n)}},controlAdapterImageChanged:(e,t)=>{const{id:n,controlImage:r}=t.payload,i=eo(e,n);i&&(ar.updateOne(e,{id:n,changes:{controlImage:r,processedControlImage:null}}),r!==null&&Ho(i)&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlAdapterProcessedImageChanged:(e,t)=>{const{id:n,processedControlImage:r}=t.payload,i=eo(e,n);i&&Ho(i)&&(ar.updateOne(e,{id:n,changes:{processedControlImage:r}}),e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlAdapterModelCleared:(e,t)=>{ar.updateOne(e,{id:t.payload.id,changes:{model:null}})},controlAdapterModelChanged:(e,t)=>{const{id:n,model:r}=t.payload,i=eo(e,n);if(!i)return;if(!Ho(i)){ar.updateOne(e,{id:n,changes:{model:r}});return}const o={id:n,changes:{model:r}};if(o.changes.processedControlImage=null,i.shouldAutoConfig){let a;for(const s in Av)if(r.model_name.includes(s)){a=Av[s];break}a?(o.changes.processorType=a,o.changes.processorNode=Zc[a].default):(o.changes.processorType="none",o.changes.processorNode=Zc.none.default)}ar.updateOne(e,o)},controlAdapterWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload;ar.updateOne(e,{id:n,changes:{weight:r}})},controlAdapterBeginStepPctChanged:(e,t)=>{const{id:n,beginStepPct:r}=t.payload;ar.updateOne(e,{id:n,changes:{beginStepPct:r}})},controlAdapterEndStepPctChanged:(e,t)=>{const{id:n,endStepPct:r}=t.payload;ar.updateOne(e,{id:n,changes:{endStepPct:r}})},controlAdapterControlModeChanged:(e,t)=>{const{id:n,controlMode:r}=t.payload,i=eo(e,n);!i||!h2(i)||ar.updateOne(e,{id:n,changes:{controlMode:r}})},controlAdapterResizeModeChanged:(e,t)=>{const{id:n,resizeMode:r}=t.payload,i=eo(e,n);!i||!Ho(i)||ar.updateOne(e,{id:n,changes:{resizeMode:r}})},controlAdapterProcessorParamsChanged:(e,t)=>{const{id:n,params:r}=t.payload,i=eo(e,n);if(!i||!Ho(i)||!i.processorNode)return;const o=_h(Ut(i.processorNode),r);ar.updateOne(e,{id:n,changes:{shouldAutoConfig:!1,processorNode:o}})},controlAdapterProcessortTypeChanged:(e,t)=>{const{id:n,processorType:r}=t.payload,i=eo(e,n);if(!i||!Ho(i))return;const o=Ut(Zc[r].default);ar.updateOne(e,{id:n,changes:{processorType:r,processedControlImage:null,processorNode:o,shouldAutoConfig:!1}})},controlAdapterAutoConfigToggled:(e,t)=>{var o;const{id:n}=t.payload,r=eo(e,n);if(!r||!Ho(r))return;const i={id:n,changes:{shouldAutoConfig:!r.shouldAutoConfig}};if(i.changes.shouldAutoConfig){let a;for(const s in Av)if((o=r.model)!=null&&o.model_name.includes(s)){a=Av[s];break}a?(i.changes.processorType=a,i.changes.processorNode=Zc[a].default):(i.changes.processorType="none",i.changes.processorNode=Zc.none.default)}ar.updateOne(e,i)},controlAdaptersReset:()=>Ut(vA),pendingControlImagesCleared:e=>{e.pendingControlImages=[]}},extraReducers:e=>{e.addCase(L4,(t,n)=>{const r=eo(t,n.payload.id);r&&r.controlImage!==null&&(t.pendingControlImages=Wae(t.pendingControlImages.concat(n.payload.id)))}),e.addCase(c2,t=>{t.pendingControlImages=[]})}}),{controlAdapterAdded:B4,controlAdapterRecalled:z4,controlAdapterDuplicated:LUe,controlAdapterAddedFromImage:j4,controlAdapterRemoved:FUe,controlAdapterImageChanged:kc,controlAdapterProcessedImageChanged:U4,controlAdapterIsEnabledChanged:Sy,controlAdapterModelChanged:kI,controlAdapterWeightChanged:BUe,controlAdapterBeginStepPctChanged:zUe,controlAdapterEndStepPctChanged:jUe,controlAdapterControlModeChanged:UUe,controlAdapterResizeModeChanged:VUe,controlAdapterProcessorParamsChanged:Mse,controlAdapterProcessortTypeChanged:$se,controlAdaptersReset:Nse,controlAdapterAutoConfigToggled:PI,pendingControlImagesCleared:Dse,controlAdapterModelCleared:xC}=ez.actions,Lse=ez.reducer,Fse=Qi(B4,j4,z4),GUe={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},HUe={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},Bse={any:{maxClip:0,markers:[]},"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]}},qUe={lycoris:"LyCORIS",diffusers:"Diffusers"},zse=0,rm=4294967295;var Yt;(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 a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},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 a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},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(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Yt||(Yt={}));var bA;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(bA||(bA={}));const Oe=Yt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ou=e=>{switch(typeof e){case"undefined":return Oe.undefined;case"string":return Oe.string;case"number":return isNaN(e)?Oe.nan:Oe.number;case"boolean":return Oe.boolean;case"function":return Oe.function;case"bigint":return Oe.bigint;case"symbol":return Oe.symbol;case"object":return Array.isArray(e)?Oe.array:e===null?Oe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Oe.promise:typeof Map<"u"&&e instanceof Map?Oe.map:typeof Set<"u"&&e instanceof Set?Oe.set:typeof Date<"u"&&e instanceof Date?Oe.date:Oe.object;default:return Oe.unknown}},he=Yt.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"]),jse=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 a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=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 Qm=(e,t)=>{let n;switch(e.code){case he.invalid_type:e.received===Oe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case he.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Yt.jsonStringifyReplacer)}`;break;case he.unrecognized_keys:n=`Unrecognized key(s) in object: ${Yt.joinValues(e.keys,", ")}`;break;case he.invalid_union:n="Invalid input";break;case he.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Yt.joinValues(e.options)}`;break;case he.invalid_enum_value:n=`Invalid enum value. Expected ${Yt.joinValues(e.options)}, received '${e.received}'`;break;case he.invalid_arguments:n="Invalid function arguments";break;case he.invalid_return_type:n="Invalid function return type";break;case he.invalid_date:n="Invalid date";break;case he.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}"`:Yt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case he.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 he.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 he.custom:n="Invalid input";break;case he.invalid_intersection_types:n="Intersection results could not be merged";break;case he.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case he.not_finite:n="Number must be finite";break;default:n=t.defaultError,Yt.assertNever(e)}return{message:n}};let tz=Qm;function Use(e){tz=e}function f_(){return tz}const h_=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:i.message||s}},Vse=[];function $e(e,t){const n=h_({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,f_(),Qm].filter(r=>!!r)});e.common.issues.push(n)}class Ki{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 vt;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 Ki.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return vt;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const vt=Object.freeze({status:"aborted"}),nz=e=>({status:"dirty",value:e}),co=e=>({status:"valid",value:e}),_A=e=>e.status==="aborted",SA=e=>e.status==="dirty",Xm=e=>e.status==="valid",p_=e=>typeof Promise<"u"&&e instanceof Promise;var rt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(rt||(rt={}));class tl{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 II=(e,t)=>{if(Xm(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 xt(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:(a,s)=>a.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class At{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Ou(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Ou(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ki,ctx:{common:t.parent.common,data:t.data,parsedType:Ou(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(p_(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:Ou(t)},o=this._parseSync({data:t,path:i.path,parent:i});return II(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:Ou(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(p_(i)?i:Promise.resolve(i));return II(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 a=t(i),s=()=>o.addIssue({code:he.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!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 ps({schema:this,typeName:lt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Bl.create(this,this._def)}nullable(){return Ld.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cs.create(this,this._def)}promise(){return tp.create(this,this._def)}or(t){return e0.create([this,t],this._def)}and(t){return t0.create(this,t,this._def)}transform(t){return new ps({...xt(this._def),schema:this,typeName:lt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new a0({...xt(this._def),innerType:this,defaultValue:n,typeName:lt.ZodDefault})}brand(){return new iz({typeName:lt.ZodBranded,type:this,...xt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new v_({...xt(this._def),innerType:this,catchValue:n,typeName:lt.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return xy.create(this,t)}readonly(){return __.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Gse=/^c[^\s-]{8,}$/i,Hse=/^[a-z][a-z0-9]*$/,qse=/[0-9A-HJKMNP-TV-Z]{26}/,Wse=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Kse=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qse=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Xse=/^(((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}))$/,Yse=/^(([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})))$/,Zse=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 Jse(e,t){return!!((t==="v4"||!t)&&Xse.test(e)||(t==="v6"||!t)&&Yse.test(e))}class is extends At{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:he.invalid_string,...rt.errToObj(r)}),this.nonempty=t=>this.min(1,rt.errToObj(t)),this.trim=()=>new is({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new is({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new is({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Oe.string){const o=this._getOrReturnCtx(t);return $e(o,{code:he.invalid_type,expected:Oe.string,received:o.parsedType}),vt}const r=new Ki;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),$e(i,{code:he.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=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,...rt.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...rt.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...rt.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...rt.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...rt.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...rt.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...rt.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...rt.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 is({checks:[],typeName:lt.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};function ele(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(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class dc extends At{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)!==Oe.number){const o=this._getOrReturnCtx(t);return $e(o,{code:he.invalid_type,expected:Oe.number,received:o.parsedType}),vt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="int"?Yt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),$e(r,{code:he.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),$e(r,{code:he.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?ele(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),$e(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),$e(r,{code:he.not_finite,message:o.message}),i.dirty()):Yt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new dc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new dc({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:rt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:rt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.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"&&Yt.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 dc({checks:[],typeName:lt.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class fc extends At{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)!==Oe.bigint){const o=this._getOrReturnCtx(t);return $e(o,{code:he.invalid_type,expected:Oe.bigint,received:o.parsedType}),vt}let r;const i=new Ki;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),$e(r,{code:he.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),$e(r,{code:he.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Yt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rt.toString(n))}setLimit(t,n,r,i){return new fc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:rt.toString(i)}]})}_addCheck(t){return new fc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rt.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 fc({checks:[],typeName:lt.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...xt(e)})};class Ym extends At{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Oe.boolean){const r=this._getOrReturnCtx(t);return $e(r,{code:he.invalid_type,expected:Oe.boolean,received:r.parsedType}),vt}return co(t.data)}}Ym.create=e=>new Ym({typeName:lt.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...xt(e)});class Nd extends At{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Oe.date){const o=this._getOrReturnCtx(t);return $e(o,{code:he.invalid_type,expected:Oe.date,received:o.parsedType}),vt}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return $e(o,{code:he.invalid_date}),vt}const r=new Ki;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),$e(i,{code:he.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Yt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Nd({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:rt.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:rt.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 Nd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:lt.ZodDate,...xt(e)});class g_ extends At{_parse(t){if(this._getType(t)!==Oe.symbol){const r=this._getOrReturnCtx(t);return $e(r,{code:he.invalid_type,expected:Oe.symbol,received:r.parsedType}),vt}return co(t.data)}}g_.create=e=>new g_({typeName:lt.ZodSymbol,...xt(e)});class Zm extends At{_parse(t){if(this._getType(t)!==Oe.undefined){const r=this._getOrReturnCtx(t);return $e(r,{code:he.invalid_type,expected:Oe.undefined,received:r.parsedType}),vt}return co(t.data)}}Zm.create=e=>new Zm({typeName:lt.ZodUndefined,...xt(e)});class Jm extends At{_parse(t){if(this._getType(t)!==Oe.null){const r=this._getOrReturnCtx(t);return $e(r,{code:he.invalid_type,expected:Oe.null,received:r.parsedType}),vt}return co(t.data)}}Jm.create=e=>new Jm({typeName:lt.ZodNull,...xt(e)});class ep extends At{constructor(){super(...arguments),this._any=!0}_parse(t){return co(t.data)}}ep.create=e=>new ep({typeName:lt.ZodAny,...xt(e)});class Sd extends At{constructor(){super(...arguments),this._unknown=!0}_parse(t){return co(t.data)}}Sd.create=e=>new Sd({typeName:lt.ZodUnknown,...xt(e)});class Yl extends At{_parse(t){const n=this._getOrReturnCtx(t);return $e(n,{code:he.invalid_type,expected:Oe.never,received:n.parsedType}),vt}}Yl.create=e=>new Yl({typeName:lt.ZodNever,...xt(e)});class m_ extends At{_parse(t){if(this._getType(t)!==Oe.undefined){const r=this._getOrReturnCtx(t);return $e(r,{code:he.invalid_type,expected:Oe.void,received:r.parsedType}),vt}return co(t.data)}}m_.create=e=>new m_({typeName:lt.ZodVoid,...xt(e)});class cs extends At{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Oe.array)return $e(n,{code:he.invalid_type,expected:Oe.array,received:n.parsedType}),vt;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.lengthi.maxLength.value&&($e(n,{code:he.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((a,s)=>i.type._parseAsync(new tl(n,a,n.path,s)))).then(a=>Ki.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new tl(n,a,n.path,s)));return Ki.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new cs({...this._def,minLength:{value:t,message:rt.toString(n)}})}max(t,n){return new cs({...this._def,maxLength:{value:t,message:rt.toString(n)}})}length(t,n){return new cs({...this._def,exactLength:{value:t,message:rt.toString(n)}})}nonempty(t){return this.min(1,t)}}cs.create=(e,t)=>new cs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:lt.ZodArray,...xt(t)});function Of(e){if(e instanceof sr){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Bl.create(Of(r))}return new sr({...e._def,shape:()=>t})}else return e instanceof cs?new cs({...e._def,type:Of(e.element)}):e instanceof Bl?Bl.create(Of(e.unwrap())):e instanceof Ld?Ld.create(Of(e.unwrap())):e instanceof nl?nl.create(e.items.map(t=>Of(t))):e}class sr extends At{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=Yt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Oe.object){const u=this._getOrReturnCtx(t);return $e(u,{code:he.invalid_type,expected:Oe.object,received:u.parsedType}),vt}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Yl&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const l=[];for(const u of a){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new tl(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Yl){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&($e(i,{code:he.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new tl(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>Ki.mergeObjectSync(r,u)):Ki.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return rt.errToObj,new sr({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const l=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=rt.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new sr({...this._def,unknownKeys:"strip"})}passthrough(){return new sr({...this._def,unknownKeys:"passthrough"})}extend(t){return new sr({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new sr({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:lt.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new sr({...this._def,catchall:t})}pick(t){const n={};return Yt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new sr({...this._def,shape:()=>n})}omit(t){const n={};return Yt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new sr({...this._def,shape:()=>n})}deepPartial(){return Of(this)}partial(t){const n={};return Yt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new sr({...this._def,shape:()=>n})}required(t){const n={};return Yt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Bl;)o=o._def.innerType;n[r]=o}}),new sr({...this._def,shape:()=>n})}keyof(){return rz(Yt.objectKeys(this.shape))}}sr.create=(e,t)=>new sr({shape:()=>e,unknownKeys:"strip",catchall:Yl.create(),typeName:lt.ZodObject,...xt(t)});sr.strictCreate=(e,t)=>new sr({shape:()=>e,unknownKeys:"strict",catchall:Yl.create(),typeName:lt.ZodObject,...xt(t)});sr.lazycreate=(e,t)=>new sr({shape:e,unknownKeys:"strip",catchall:Yl.create(),typeName:lt.ZodObject,...xt(t)});class e0 extends At{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new us(s.ctx.common.issues));return $e(n,{code:he.invalid_union,unionErrors:a}),vt}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(l=>new us(l));return $e(n,{code:he.invalid_union,unionErrors:s}),vt}}get options(){return this._def.options}}e0.create=(e,t)=>new e0({options:e,typeName:lt.ZodUnion,...xt(t)});const K1=e=>e instanceof r0?K1(e.schema):e instanceof ps?K1(e.innerType()):e instanceof i0?[e.value]:e instanceof hc?e.options:e instanceof o0?Object.keys(e.enum):e instanceof a0?K1(e._def.innerType):e instanceof Zm?[void 0]:e instanceof Jm?[null]:null;class p2 extends At{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Oe.object)return $e(n,{code:he.invalid_type,expected:Oe.object,received:n.parsedType}),vt;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}):($e(n,{code:he.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),vt)}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 a=K1(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new p2({typeName:lt.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...xt(r)})}}function xA(e,t){const n=Ou(e),r=Ou(t);if(e===t)return{valid:!0,data:e};if(n===Oe.object&&r===Oe.object){const i=Yt.objectKeys(t),o=Yt.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const l=xA(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===Oe.array&&r===Oe.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(_A(o)||_A(a))return vt;const s=xA(o.value,a.value);return s.valid?((SA(o)||SA(a))&&n.dirty(),{status:n.value,value:s.data}):($e(r,{code:he.invalid_intersection_types}),vt)};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,a])=>i(o,a)):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}))}}t0.create=(e,t,n)=>new t0({left:e,right:t,typeName:lt.ZodIntersection,...xt(n)});class nl extends At{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Oe.array)return $e(r,{code:he.invalid_type,expected:Oe.array,received:r.parsedType}),vt;if(r.data.lengththis._def.items.length&&($e(r,{code:he.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new tl(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>Ki.mergeArray(n,a)):Ki.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new nl({...this._def,rest:t})}}nl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nl({items:e,typeName:lt.ZodTuple,rest:null,...xt(t)})};class n0 extends At{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!==Oe.object)return $e(r,{code:he.invalid_type,expected:Oe.object,received:r.parsedType}),vt;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new tl(r,s,r.path,s)),value:a._parse(new tl(r,r.data[s],r.path,s))});return r.common.async?Ki.mergeObjectAsync(n,i):Ki.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof At?new n0({keyType:t,valueType:n,typeName:lt.ZodRecord,...xt(r)}):new n0({keyType:is.create(),valueType:t,typeName:lt.ZodRecord,...xt(n)})}}class y_ extends At{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!==Oe.map)return $e(r,{code:he.invalid_type,expected:Oe.map,received:r.parsedType}),vt;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,l],u)=>({key:i._parse(new tl(r,s,r.path,[u,"key"])),value:o._parse(new tl(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return vt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return vt;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}y_.create=(e,t,n)=>new y_({valueType:t,keyType:e,typeName:lt.ZodMap,...xt(n)});class Dd extends At{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Oe.set)return $e(r,{code:he.invalid_type,expected:Oe.set,received:r.parsedType}),vt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&($e(r,{code:he.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(l){const u=new Set;for(const c of l){if(c.status==="aborted")return vt;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new tl(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Dd({...this._def,minSize:{value:t,message:rt.toString(n)}})}max(t,n){return new Dd({...this._def,maxSize:{value:t,message:rt.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Dd.create=(e,t)=>new Dd({valueType:e,minSize:null,maxSize:null,typeName:lt.ZodSet,...xt(t)});class Sh extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Oe.function)return $e(n,{code:he.invalid_type,expected:Oe.function,received:n.parsedType}),vt;function r(s,l){return h_({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,f_(),Qm].filter(u=>!!u),issueData:{code:he.invalid_arguments,argumentsError:l}})}function i(s,l){return h_({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,f_(),Qm].filter(u=>!!u),issueData:{code:he.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof tp){const s=this;return co(async function(...l){const u=new us([]),c=await s._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return co(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new us([r(l,u.error)]);const c=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new us([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Sh({...this._def,args:nl.create(t).rest(Sd.create())})}returns(t){return new Sh({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Sh({args:t||nl.create([]).rest(Sd.create()),returns:n||Sd.create(),typeName:lt.ZodFunction,...xt(r)})}}class r0 extends At{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})}}r0.create=(e,t)=>new r0({getter:e,typeName:lt.ZodLazy,...xt(t)});class i0 extends At{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return $e(n,{received:n.data,code:he.invalid_literal,expected:this._def.value}),vt}return{status:"valid",value:t.data}}get value(){return this._def.value}}i0.create=(e,t)=>new i0({value:e,typeName:lt.ZodLiteral,...xt(t)});function rz(e,t){return new hc({values:e,typeName:lt.ZodEnum,...xt(t)})}class hc extends At{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return $e(n,{expected:Yt.joinValues(r),received:n.parsedType,code:he.invalid_type}),vt}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return $e(n,{received:n.data,code:he.invalid_enum_value,options:r}),vt}return co(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 hc.create(t)}exclude(t){return hc.create(this.options.filter(n=>!t.includes(n)))}}hc.create=rz;class o0 extends At{_parse(t){const n=Yt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Oe.string&&r.parsedType!==Oe.number){const i=Yt.objectValues(n);return $e(r,{expected:Yt.joinValues(i),received:r.parsedType,code:he.invalid_type}),vt}if(n.indexOf(t.data)===-1){const i=Yt.objectValues(n);return $e(r,{received:r.data,code:he.invalid_enum_value,options:i}),vt}return co(t.data)}get enum(){return this._def.values}}o0.create=(e,t)=>new o0({values:e,typeName:lt.ZodNativeEnum,...xt(t)});class tp extends At{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Oe.promise&&n.common.async===!1)return $e(n,{code:he.invalid_type,expected:Oe.promise,received:n.parsedType}),vt;const r=n.parsedType===Oe.promise?n.data:Promise.resolve(n.data);return co(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}tp.create=(e,t)=>new tp({type:e,typeName:lt.ZodPromise,...xt(t)});class ps extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===lt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{$e(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(a).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}if(i.type==="refinement"){const a=s=>{const l=i.refinement(s,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 s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?vt:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?vt:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Xm(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Xm(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);Yt.assertNever(i)}}ps.create=(e,t,n)=>new ps({schema:e,typeName:lt.ZodEffects,effect:t,...xt(n)});ps.createWithPreprocess=(e,t,n)=>new ps({schema:t,effect:{type:"preprocess",transform:e},typeName:lt.ZodEffects,...xt(n)});class Bl extends At{_parse(t){return this._getType(t)===Oe.undefined?co(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Bl.create=(e,t)=>new Bl({innerType:e,typeName:lt.ZodOptional,...xt(t)});class Ld extends At{_parse(t){return this._getType(t)===Oe.null?co(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ld.create=(e,t)=>new Ld({innerType:e,typeName:lt.ZodNullable,...xt(t)});class a0 extends At{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Oe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}a0.create=(e,t)=>new a0({innerType:e,typeName:lt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...xt(t)});class v_ extends At{_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 p_(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}}v_.create=(e,t)=>new v_({innerType:e,typeName:lt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...xt(t)});class b_ extends At{_parse(t){if(this._getType(t)!==Oe.nan){const r=this._getOrReturnCtx(t);return $e(r,{code:he.invalid_type,expected:Oe.nan,received:r.parsedType}),vt}return{status:"valid",value:t.data}}}b_.create=e=>new b_({typeName:lt.ZodNaN,...xt(e)});const tle=Symbol("zod_brand");class iz extends At{_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 xy extends At{_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"?vt:o.status==="dirty"?(n.dirty(),nz(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"?vt: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 xy({in:t,out:n,typeName:lt.ZodPipeline})}}class __ extends At{_parse(t){const n=this._def.innerType._parse(t);return Xm(n)&&(n.value=Object.freeze(n.value)),n}}__.create=(e,t)=>new __({innerType:e,typeName:lt.ZodReadonly,...xt(t)});const oz=(e,t={},n)=>e?ep.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):ep.create(),nle={object:sr.lazycreate};var lt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(lt||(lt={}));const rle=(e,t={message:`Input not instance of ${e.name}`})=>oz(n=>n instanceof e,t),az=is.create,sz=dc.create,ile=b_.create,ole=fc.create,lz=Ym.create,ale=Nd.create,sle=g_.create,lle=Zm.create,ule=Jm.create,cle=ep.create,dle=Sd.create,fle=Yl.create,hle=m_.create,ple=cs.create,gle=sr.create,mle=sr.strictCreate,yle=e0.create,vle=p2.create,ble=t0.create,_le=nl.create,Sle=n0.create,xle=y_.create,wle=Dd.create,Cle=Sh.create,Ale=r0.create,Ele=i0.create,Tle=hc.create,kle=o0.create,Ple=tp.create,RI=ps.create,Ile=Bl.create,Rle=Ld.create,Ole=ps.createWithPreprocess,Mle=xy.create,$le=()=>az().optional(),Nle=()=>sz().optional(),Dle=()=>lz().optional(),Lle={string:e=>is.create({...e,coerce:!0}),number:e=>dc.create({...e,coerce:!0}),boolean:e=>Ym.create({...e,coerce:!0}),bigint:e=>fc.create({...e,coerce:!0}),date:e=>Nd.create({...e,coerce:!0})},Fle=vt;var z=Object.freeze({__proto__:null,defaultErrorMap:Qm,setErrorMap:Use,getErrorMap:f_,makeIssue:h_,EMPTY_PATH:Vse,addIssueToContext:$e,ParseStatus:Ki,INVALID:vt,DIRTY:nz,OK:co,isAborted:_A,isDirty:SA,isValid:Xm,isAsync:p_,get util(){return Yt},get objectUtil(){return bA},ZodParsedType:Oe,getParsedType:Ou,ZodType:At,ZodString:is,ZodNumber:dc,ZodBigInt:fc,ZodBoolean:Ym,ZodDate:Nd,ZodSymbol:g_,ZodUndefined:Zm,ZodNull:Jm,ZodAny:ep,ZodUnknown:Sd,ZodNever:Yl,ZodVoid:m_,ZodArray:cs,ZodObject:sr,ZodUnion:e0,ZodDiscriminatedUnion:p2,ZodIntersection:t0,ZodTuple:nl,ZodRecord:n0,ZodMap:y_,ZodSet:Dd,ZodFunction:Sh,ZodLazy:r0,ZodLiteral:i0,ZodEnum:hc,ZodNativeEnum:o0,ZodPromise:tp,ZodEffects:ps,ZodTransformer:ps,ZodOptional:Bl,ZodNullable:Ld,ZodDefault:a0,ZodCatch:v_,ZodNaN:b_,BRAND:tle,ZodBranded:iz,ZodPipeline:xy,ZodReadonly:__,custom:oz,Schema:At,ZodSchema:At,late:nle,get ZodFirstPartyTypeKind(){return lt},coerce:Lle,any:cle,array:ple,bigint:ole,boolean:lz,date:ale,discriminatedUnion:vle,effect:RI,enum:Tle,function:Cle,instanceof:rle,intersection:ble,lazy:Ale,literal:Ele,map:xle,nan:ile,nativeEnum:kle,never:fle,null:ule,nullable:Rle,number:sz,object:gle,oboolean:Dle,onumber:Nle,optional:Ile,ostring:$le,pipeline:Mle,preprocess:Ole,promise:Ple,record:Sle,set:wle,strictObject:mle,string:az,symbol:sle,transformer:RI,tuple:_le,undefined:lle,union:yle,unknown:dle,void:hle,NEVER:Fle,ZodIssueCode:he,quotelessJson:jse,ZodError:us});const Ble=z.string(),WUe=e=>Ble.safeParse(e).success,zle=z.string(),KUe=e=>zle.safeParse(e).success,jle=z.string(),QUe=e=>jle.safeParse(e).success,Ule=z.string(),XUe=e=>Ule.safeParse(e).success,Vle=z.number().int().min(1),YUe=e=>Vle.safeParse(e).success,Gle=z.number().min(1),ZUe=e=>Gle.safeParse(e).success,uz=z.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"]),JUe=e=>uz.safeParse(e).success,eVe={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"},Hle=z.number().int().min(0).max(rm),tVe=e=>Hle.safeParse(e).success,cz=z.number().multipleOf(8).min(64),nVe=e=>cz.safeParse(e).success,dz=z.number().multipleOf(8).min(64),rVe=e=>dz.safeParse(e).success;z.tuple([cz,dz]);const Pc=z.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),g2=z.object({model_name:z.string().min(1),base_model:Pc,model_type:z.literal("main")}),iVe=e=>g2.safeParse(e).success,V4=z.object({model_name:z.string().min(1),base_model:z.literal("sdxl-refiner"),model_type:z.literal("main")}),oVe=e=>V4.safeParse(e).success,fz=z.object({model_name:z.string().min(1),base_model:Pc,model_type:z.literal("onnx")}),wy=z.union([g2,fz]),qle=z.object({model_name:z.string().min(1),base_model:Pc}),Wle=z.object({model_name:z.string().min(1),base_model:Pc}),aVe=e=>Wle.safeParse(e).success,Kle=z.object({model_name:z.string().min(1),base_model:Pc}),sVe=e=>Kle.safeParse(e).success,Qle=z.object({model_name:z.string().min(1),base_model:Pc}),Xle=z.object({model_name:z.string().min(1),base_model:Pc}),lVe=e=>Xle.safeParse(e).success,uVe=e=>Qle.safeParse(e).success,Yle=z.number().min(0).max(1),cVe=e=>Yle.safeParse(e).success;z.enum(["fp16","fp32"]);const Zle=z.number().min(1).max(10),dVe=e=>Zle.safeParse(e).success,Jle=z.number().min(1).max(10),fVe=e=>Jle.safeParse(e).success,eue=z.number().min(0).max(1),hVe=e=>eue.safeParse(e).success;z.enum(["box","gaussian"]);z.enum(["unmasked","mask","edge"]);const G4={hrfHeight:64,hrfWidth:64,hrfStrength:.75,hrfEnabled:!1,cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",canvasCoherenceMode:"unmasked",canvasCoherenceSteps:20,canvasCoherenceStrength:.3,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,infillTileSize:32,infillPatchmatchDownscaleSize:1,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,shouldLockAspectRatio:!1},tue=G4,hz=nr({name:"generation",initialState:tue,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=zu(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=zu(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,...G4}),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},setCanvasCoherenceMode:(e,t)=>{e.canvasCoherenceMode=t.payload},setCanvasCoherenceSteps:(e,t)=>{e.canvasCoherenceSteps=t.payload},setCanvasCoherenceStrength:(e,t)=>{e.canvasCoherenceStrength=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setInfillTileSize:(e,t)=>{e.infillTileSize=t.payload},setInfillPatchmatchDownscaleSize:(e,t)=>{e.infillPatchmatchDownscaleSize=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=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}=Bse[e.model.base_model];e.clipSkip=zu(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},setHrfHeight:(e,t)=>{e.hrfHeight=t.payload},setHrfWidth:(e,t)=>{e.hrfWidth=t.payload},setHrfStrength:(e,t)=>{e.hrfStrength=t.payload},setHrfEnabled:(e,t)=>{e.hrfEnabled=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=qo(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(Kae,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,a,s]=r.split("/"),l=g2.safeParse({model_name:s,base_model:o,model_type:a});l.success&&(t.model=l.data)}}),e.addMatcher(Fse,(t,n)=>{n.payload.type==="t2i_adapter"&&(t.width=qo(t.width,64),t.height=qo(t.height,64))})}}),{clampSymmetrySteps:pVe,clearInitialImage:H4,resetParametersState:gVe,resetSeed:mVe,setCfgScale:yVe,setWidth:OI,setHeight:MI,toggleSize:vVe,setImg2imgStrength:bVe,setInfillMethod:nue,setIterations:_Ve,setPerlin:SVe,setPositivePrompt:rue,setNegativePrompt:xVe,setScheduler:wVe,setMaskBlur:CVe,setMaskBlurMethod:AVe,setCanvasCoherenceMode:EVe,setCanvasCoherenceSteps:TVe,setCanvasCoherenceStrength:kVe,setSeed:PVe,setSeedWeights:IVe,setShouldFitToWidthHeight:RVe,setShouldGenerateVariations:OVe,setShouldRandomizeSeed:MVe,setSteps:$Ve,setThreshold:NVe,setInfillTileSize:DVe,setInfillPatchmatchDownscaleSize:LVe,setVariationAmount:FVe,setShouldUseSymmetry:BVe,setHorizontalSymmetrySteps:zVe,setVerticalSymmetrySteps:jVe,initialImageChanged:m2,modelChanged:ju,vaeSelected:pz,setSeamlessXAxis:UVe,setSeamlessYAxis:VVe,setClipSkip:GVe,setHrfHeight:HVe,setHrfWidth:qVe,setHrfStrength:WVe,setHrfEnabled:KVe,shouldUseCpuNoiseChanged:QVe,setAspectRatio:iue,setShouldLockAspectRatio:XVe,vaePrecisionChanged:YVe}=hz.actions,oue=hz.reducer,Ev=(e,t,n,r,i,o,a)=>{const s=Math.floor(e/2-(n+i/2)*a),l=Math.floor(t/2-(r+o/2)*a);return{x:s,y:l}},Tv=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r,s=Math.min(1,Math.min(o,a));return s||1},ZVe=.999,JVe=.1,eGe=20,kv=.95,tGe=30,nGe=10,aue=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),gf=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let a=t*n,s=448;for(;a1?(r.width=s,r.height=qo(s/o,64)):o<1&&(r.height=s,r.width=qo(s*o,64)),a=r.width*r.height;return r},sue=e=>({width:qo(e.width,64),height:qo(e.height,64)}),rGe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],iGe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],gz=e=>e.kind==="line"&&e.layer==="mask",oGe=e=>e.kind==="line"&&e.layer==="base",lue=e=>e.kind==="image"&&e.layer==="base",aGe=e=>e.kind==="fillRect"&&e.layer==="base",sGe=e=>e.kind==="eraseRect"&&e.layer==="base",uue=e=>e.kind==="line",Pg={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},mz={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,colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,futureLayerStates:[],isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Pg,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",batchIds:[]},yz=nr({name:"canvas",initialState:mz,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(Ut(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!gz(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,a={width:Sv(zu(r,64,512),64),height:Sv(zu(i,64,512),64)},s={x:qo(r/2-a.width/2,64),y:qo(i/2-a.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=gf(a);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=a,e.boundingBoxCoordinates=s,e.pastLayerStates.push(Ut(e.layerState)),e.layerState={...Ut(Pg),objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.batchIds=[];const l=Tv(o.width,o.height,r,i,kv),u=Ev(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=sue(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=gf(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height],[r,i]=[e.scaledBoundingBoxDimensions.width,e.scaledBoundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t},e.scaledBoundingBoxDimensions={width:i,height:r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=aue(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=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},canvasBatchIdAdded:(e,t)=>{e.batchIds.push(t.payload)},canvasBatchIdsReset:e=>{e.batchIds=[]},stagingAreaInitialized:(e,t)=>{const{boundingBox:n}=t.payload;e.layerState.stagingArea={boundingBox:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(Ut(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(Ut(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea=Ut(Ut(Pg)).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Ut(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(Ut(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:a}=e;if(n==="move"||n==="colorPicker")return;const s=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(Ut(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(uue);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Ut(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Ut(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(Ut(e.layerState)),e.layerState=Ut(Pg),e.futureLayerStates=[],e.batchIds=[]},canvasResized:(e,t)=>{const{width:n,height:r}=t.payload,i={width:Math.floor(n),height:Math.floor(r)};if(e.stageDimensions=i,!e.layerState.objects.find(lue)){const o=Tv(i.width,i.height,512,512,kv),a=Ev(i.width,i.height,0,0,512,512,o),s={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=a,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const l=gf(s);e.scaledBoundingBoxDimensions=l}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:a,y:s,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:Tv(i,o,l,u,kv),d=Ev(i,o,a,s,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=Tv(i,o,512,512,kv),d=Ev(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=gf(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex+1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t>n?0:t},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex-1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t<0?n:t},commitStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(Ut(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const r=t[n];r&&e.layerState.objects.push({...r}),e.layerState.stagingArea=Ut(Pg).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,a=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>a){const s={width:Sv(zu(o,64,512),64),height:Sv(zu(a,64,512),64)},l={x:qo(o/2-s.width/2,64),y:qo(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=gf(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=gf(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(Ut(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(d2,(t,n)=>{const r=n.payload.data.batch_status;t.batchIds.includes(r.batch_id)&&r.in_progress===0&&r.pending===0&&(t.batchIds=t.batchIds.filter(i=>i!==r.batch_id))}),e.addCase(iue,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=qo(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=qo(t.scaledBoundingBoxDimensions.width/r,64))})}}),{addEraseRect:lGe,addFillRect:uGe,addImageToStagingArea:cue,addLine:cGe,addPointToCurrentLine:dGe,clearCanvasHistory:fGe,clearMask:hGe,commitColorPickerColor:pGe,commitStagingAreaImage:due,discardStagedImages:fue,fitBoundingBoxToStage:gGe,mouseLeftCanvas:mGe,nextStagingAreaImage:yGe,prevStagingAreaImage:vGe,redo:bGe,resetCanvas:q4,resetCanvasInteractionState:_Ge,resetCanvasView:SGe,setBoundingBoxCoordinates:xGe,setBoundingBoxDimensions:$I,setBoundingBoxPreviewFill:wGe,setBoundingBoxScaleMethod:CGe,flipBoundingBoxAxes:AGe,setBrushColor:EGe,setBrushSize:TGe,setColorPickerColor:kGe,setCursorPosition:PGe,setInitialCanvasImage:vz,setIsDrawing:IGe,setIsMaskEnabled:RGe,setIsMouseOverBoundingBox:OGe,setIsMoveBoundingBoxKeyHeld:MGe,setIsMoveStageKeyHeld:$Ge,setIsMovingBoundingBox:NGe,setIsMovingStage:DGe,setIsTransformingBoundingBox:LGe,setLayer:FGe,setMaskColor:BGe,setMergedCanvas:hue,setShouldAutoSave:zGe,setShouldCropToBoundingBoxOnSave:jGe,setShouldDarkenOutsideBoundingBox:UGe,setShouldLockBoundingBox:VGe,setShouldPreserveMaskedArea:GGe,setShouldShowBoundingBox:HGe,setShouldShowBrush:qGe,setShouldShowBrushPreview:WGe,setShouldShowCanvasDebugInfo:KGe,setShouldShowCheckboardTransparency:QGe,setShouldShowGrid:XGe,setShouldShowIntermediates:YGe,setShouldShowStagingImage:ZGe,setShouldShowStagingOutline:JGe,setShouldSnapToGrid:eHe,setStageCoordinates:tHe,setStageScale:nHe,setTool:rHe,toggleShouldLockBoundingBox:iHe,toggleTool:oHe,undo:aHe,setScaledBoundingBoxDimensions:sHe,setShouldRestrictStrokesToBox:lHe,stagingAreaInitialized:pue,setShouldAntialias:uHe,canvasResized:cHe,canvasBatchIdAdded:gue,canvasBatchIdsReset:mue}=yz.actions,yue=yz.reducer,vue={isModalOpen:!1,imagesToChange:[]},bz=nr({name:"changeBoardModal",initialState:vue,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:dHe,imagesToChangeSelected:fHe,changeBoardReset:hHe}=bz.actions,bue=bz.reducer,_ue={imagesToDelete:[],isModalOpen:!1},_z=nr({name:"deleteImageModal",initialState:_ue,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:W4,imagesToDeleteSelected:Sue,imageDeletionCanceled:pHe}=_z.actions,xue=_z.reducer,K4={maxPrompts:100,combinatorial:!0,prompts:[],parsingError:void 0,isError:!1,isLoading:!1,seedBehaviour:"PER_ITERATION"},wue=K4,Sz=nr({name:"dynamicPrompts",initialState:wue,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=K4.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},promptsChanged:(e,t)=>{e.prompts=t.payload},parsingErrorChanged:(e,t)=>{e.parsingError=t.payload},isErrorChanged:(e,t)=>{e.isError=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},seedBehaviourChanged:(e,t)=>{e.seedBehaviour=t.payload}}}),{maxPromptsChanged:Cue,maxPromptsReset:Aue,combinatorialToggled:Eue,promptsChanged:Tue,parsingErrorChanged:kue,isErrorChanged:NI,isLoadingChanged:wC,seedBehaviourChanged:gHe}=Sz.actions,Pue=Sz.reducer,ii=["general"],to=["control","mask","user","other"],Iue=100,Pv=20;var S_=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,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}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 zue(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var BI=hs;function Cz(e,t){if(e===t||!(BI(e)&&BI(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)?[]:{},a=0,s=n;a=200&&e.status<=299},Uue=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function jI(e){if(!hs(e))return e;for(var t=Cr({},e),n=0,r=Object.entries(t);n"u"&&s===zI&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,v){return C_(t,null,function(){var S,x,w,C,T,E,k,N,O,A,P,D,L,M,R,$,B,U,G,Y,ee,J,j,Q,ne,se,Se,ce,bt,ot,ze,mt,Ie,en,Ir,Dn;return S_(this,function(Tn){switch(Tn.label){case 0:return S=v.signal,x=v.getState,w=v.extra,C=v.endpoint,T=v.forced,E=v.type,N=typeof g=="string"?{url:g}:g,O=N.url,A=N.headers,P=A===void 0?new Headers(b.headers):A,D=N.params,L=D===void 0?void 0:D,M=N.responseHandler,R=M===void 0?m??"json":M,$=N.validateStatus,B=$===void 0?_??jue:$,U=N.timeout,G=U===void 0?p:U,Y=LI(N,["url","headers","params","responseHandler","validateStatus","timeout"]),ee=Cr(js(Cr({},b),{signal:S}),Y),P=new Headers(jI(P)),J=ee,[4,o(P,{getState:x,extra:w,endpoint:C,forced:T,type:E})];case 1:J.headers=Tn.sent()||P,j=function(tn){return typeof tn=="object"&&(hs(tn)||Array.isArray(tn)||typeof tn.toJSON=="function")},!ee.headers.has("content-type")&&j(ee.body)&&ee.headers.set("content-type",f),j(ee.body)&&c(ee.headers)&&(ee.body=JSON.stringify(ee.body,h)),L&&(Q=~O.indexOf("?")?"&":"?",ne=l?l(L):new URLSearchParams(jI(L)),O+=Q+ne),O=Fue(r,O),se=new Request(O,ee),Se=se.clone(),k={request:Se},bt=!1,ot=G&&setTimeout(function(){bt=!0,v.abort()},G),Tn.label=2;case 2:return Tn.trys.push([2,4,5,6]),[4,s(se)];case 3:return ce=Tn.sent(),[3,6];case 4:return ze=Tn.sent(),[2,{error:{status:bt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ze)},meta:k}];case 5:return ot&&clearTimeout(ot),[7];case 6:mt=ce.clone(),k.response=mt,en="",Tn.label=7;case 7:return Tn.trys.push([7,9,,10]),[4,Promise.all([y(ce,R).then(function(tn){return Ie=tn},function(tn){return Ir=tn}),mt.text().then(function(tn){return en=tn},function(){})])];case 8:if(Tn.sent(),Ir)throw Ir;return[3,10];case 9:return Dn=Tn.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:ce.status,data:en,error:String(Dn)},meta:k}];case 10:return[2,B(ce,Ie)?{data:Ie,meta:k}:{error:{status:ce.status,data:Ie},meta:k}]}})})};function y(g,v){return C_(this,null,function(){var S;return S_(this,function(x){switch(x.label){case 0:return typeof v=="function"?[2,v(g)]:(v==="content-type"&&(v=c(g.headers)?"json":"text"),v!=="json"?[3,2]:[4,g.text()]);case 1:return S=x.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var UI=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),Q4=De("__rtkq/focused"),Az=De("__rtkq/unfocused"),X4=De("__rtkq/online"),Ez=De("__rtkq/offline"),rl;(function(e){e.query="query",e.mutation="mutation"})(rl||(rl={}));function Tz(e){return e.type===rl.query}function Gue(e){return e.type===rl.mutation}function kz(e,t,n,r,i,o){return Hue(e)?e(t,n,r,i).map(wA).map(o):Array.isArray(e)?e.map(wA).map(o):[]}function Hue(e){return typeof e=="function"}function wA(e){return typeof e=="string"?{type:e}:e}function CC(e){return e!=null}var s0=Symbol("forceQueryFn"),CA=function(e){return typeof e[s0]=="function"};function que(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,a=new Map,s=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:y,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:_,getRunningMutationsThunk:b,getRunningOperationPromises:h,removalWarning:f};function f(){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 h(){typeof process<"u";var v=function(S){return Array.from(S.values()).flatMap(function(x){return x?Object.values(x):[]})};return x_(x_([],v(a)),v(s)).filter(CC)}function p(v,S){return function(x){var w,C=o.endpointDefinitions[v],T=t({queryArgs:S,endpointDefinition:C,endpointName:v});return(w=a.get(x))==null?void 0:w[T]}}function m(v,S){return function(x){var w;return(w=s.get(x))==null?void 0:w[S]}}function _(){return function(v){return Object.values(a.get(v)||{}).filter(CC)}}function b(){return function(v){return Object.values(s.get(v)||{}).filter(CC)}}function y(v,S){var x=function(w,C){var T=C===void 0?{}:C,E=T.subscribe,k=E===void 0?!0:E,N=T.forceRefetch,O=T.subscriptionOptions,A=s0,P=T[A];return function(D,L){var M,R,$=t({queryArgs:w,endpointDefinition:S,endpointName:v}),B=n((M={type:"query",subscribe:k,forceRefetch:N,subscriptionOptions:O,endpointName:v,originalArgs:w,queryCacheKey:$},M[s0]=P,M)),U=i.endpoints[v].select(w),G=D(B),Y=U(L()),ee=G.requestId,J=G.abort,j=Y.requestId!==ee,Q=(R=a.get(D))==null?void 0:R[$],ne=function(){return U(L())},se=Object.assign(P?G.then(ne):j&&!Q?Promise.resolve(Y):Promise.all([Q,G]).then(ne),{arg:w,requestId:ee,subscriptionOptions:O,queryCacheKey:$,abort:J,unwrap:function(){return C_(this,null,function(){var ce;return S_(this,function(bt){switch(bt.label){case 0:return[4,se];case 1:if(ce=bt.sent(),ce.isError)throw ce.error;return[2,ce.data]}})})},refetch:function(){return D(x(w,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){k&&D(u({queryCacheKey:$,requestId:ee}))},updateSubscriptionOptions:function(ce){se.subscriptionOptions=ce,D(d({endpointName:v,requestId:ee,queryCacheKey:$,options:ce}))}});if(!Q&&!j&&!P){var Se=a.get(D)||{};Se[$]=se,a.set(D,Se),se.then(function(){delete Se[$],Object.keys(Se).length||a.delete(D)})}return se}};return x}function g(v){return function(S,x){var w=x===void 0?{}:x,C=w.track,T=C===void 0?!0:C,E=w.fixedCacheKey;return function(k,N){var O=r({type:"mutation",endpointName:v,originalArgs:S,track:T,fixedCacheKey:E}),A=k(O),P=A.requestId,D=A.abort,L=A.unwrap,M=A.unwrap().then(function(U){return{data:U}}).catch(function(U){return{error:U}}),R=function(){k(c({requestId:P,fixedCacheKey:E}))},$=Object.assign(M,{arg:A.arg,requestId:P,abort:D,unwrap:L,unsubscribe:R,reset:R}),B=s.get(k)||{};return s.set(k,B),B[P]=$,$.then(function(){delete B[P],Object.keys(B).length||s.delete(k)}),E&&(B[E]=$,$.then(function(){B[E]===$&&(delete B[E],Object.keys(B).length||s.delete(k))})),$}}}}function VI(e){return e}function Wue(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,a=e.api,s=function(g,v,S){return function(x){var w=i[g];x(a.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:v,endpointDefinition:w,endpointName:g}),patches:S}))}},l=function(g,v,S){return function(x,w){var C,T,E=a.endpoints[g].select(v)(w()),k={patches:[],inversePatches:[],undo:function(){return x(a.util.patchQueryData(g,v,k.inversePatches))}};if(E.status===er.uninitialized)return k;if("data"in E)if(Oo(E.data)){var N=c4(E.data,S),O=N[1],A=N[2];(C=k.patches).push.apply(C,O),(T=k.inversePatches).push.apply(T,A)}else{var P=S(E.data);k.patches.push({op:"replace",path:[],value:P}),k.inversePatches.push({op:"replace",path:[],value:E.data})}return x(a.util.patchQueryData(g,v,k.patches)),k}},u=function(g,v,S){return function(x){var w;return x(a.endpoints[g].initiate(v,(w={subscribe:!1,forceRefetch:!0},w[s0]=function(){return{data:S}},w)))}},c=function(g,v){return C_(t,[g,v],function(S,x){var w,C,T,E,k,N,O,A,P,D,L,M,R,$,B,U,G,Y,ee=x.signal,J=x.abort,j=x.rejectWithValue,Q=x.fulfillWithValue,ne=x.dispatch,se=x.getState,Se=x.extra;return S_(this,function(ce){switch(ce.label){case 0:w=i[S.endpointName],ce.label=1;case 1:return ce.trys.push([1,8,,13]),C=VI,T=void 0,E={signal:ee,abort:J,dispatch:ne,getState:se,extra:Se,endpoint:S.endpointName,type:S.type,forced:S.type==="query"?d(S,se()):void 0},k=S.type==="query"?S[s0]:void 0,k?(T=k(),[3,6]):[3,2];case 2:return w.query?[4,r(w.query(S.originalArgs),E,w.extraOptions)]:[3,4];case 3:return T=ce.sent(),w.transformResponse&&(C=w.transformResponse),[3,6];case 4:return[4,w.queryFn(S.originalArgs,E,w.extraOptions,function(bt){return r(bt,E,w.extraOptions)})];case 5:T=ce.sent(),ce.label=6;case 6:if(typeof process<"u",T.error)throw new UI(T.error,T.meta);return L=Q,[4,C(T.data,T.meta,S.originalArgs)];case 7:return[2,L.apply(void 0,[ce.sent(),(G={fulfilledTimeStamp:Date.now(),baseQueryMeta:T.meta},G[ld]=!0,G)])];case 8:if(M=ce.sent(),R=M,!(R instanceof UI))return[3,12];$=VI,w.query&&w.transformErrorResponse&&($=w.transformErrorResponse),ce.label=9;case 9:return ce.trys.push([9,11,,12]),B=j,[4,$(R.value,R.meta,S.originalArgs)];case 10:return[2,B.apply(void 0,[ce.sent(),(Y={baseQueryMeta:R.meta},Y[ld]=!0,Y)])];case 11:return U=ce.sent(),R=U,[3,12];case 12:throw typeof process<"u",console.error(R),R;case 13:return[2]}})})};function d(g,v){var S,x,w,C,T=(x=(S=v[n])==null?void 0:S.queries)==null?void 0:x[g.queryCacheKey],E=(w=v[n])==null?void 0:w.config.refetchOnMountOrArgChange,k=T==null?void 0:T.fulfilledTimeStamp,N=(C=g.forceRefetch)!=null?C:g.subscribe&&E;return N?N===!0||(Number(new Date)-Number(k))/1e3>=N:!1}var f=t_(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[ld]=!0,g},condition:function(g,v){var S=v.getState,x,w,C,T=S(),E=(w=(x=T[n])==null?void 0:x.queries)==null?void 0:w[g.queryCacheKey],k=E==null?void 0:E.fulfilledTimeStamp,N=g.originalArgs,O=E==null?void 0:E.originalArgs,A=i[g.endpointName];return CA(g)?!0:(E==null?void 0:E.status)==="pending"?!1:d(g,T)||Tz(A)&&((C=A==null?void 0:A.forceRefetch)!=null&&C.call(A,{currentArg:N,previousArg:O,endpointState:E,state:T}))?!0:!k},dispatchConditionRejection:!0}),h=t_(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[ld]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},_=function(g,v,S){return function(x,w){var C=p(S)&&S.force,T=m(S)&&S.ifOlderThan,E=function(A){return A===void 0&&(A=!0),a.endpoints[g].initiate(v,{forceRefetch:A})},k=a.endpoints[g].select(v)(w());if(C)x(E());else if(T){var N=k==null?void 0:k.fulfilledTimeStamp;if(!N){x(E());return}var O=(Number(new Date)-Number(new Date(N)))/1e3>=T;O&&x(E())}else x(E(!1))}};function b(g){return function(v){var S,x;return((x=(S=v==null?void 0:v.meta)==null?void 0:S.arg)==null?void 0:x.endpointName)===g}}function y(g,v){return{matchPending:ph(QS(g),b(v)),matchFulfilled:ph(Tc(g),b(v)),matchRejected:ph(Yh(g),b(v))}}return{queryThunk:f,mutationThunk:h,prefetch:_,updateQueryData:l,upsertQueryData:u,patchQueryData:s,buildMatchThunkActions:y}}function Pz(e,t,n,r){return kz(n[e.meta.arg.endpointName][t],Tc(e)?e.payload:void 0,hy(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function Iv(e,t,n){var r=e[t];r&&n(r)}function l0(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function GI(e,t,n){var r=e[l0(t)];r&&n(r)}var tg={};function Kue(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,a=i.apiUid,s=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=De(t+"/resetApiState"),f=nr({name:t+"/queries",initialState:tg,reducers:{removeQueryResult:{reducer:function(S,x){var w=x.payload.queryCacheKey;delete S[w]},prepare:q1()},queryResultPatched:function(S,x){var w=x.payload,C=w.queryCacheKey,T=w.patches;Iv(S,C,function(E){E.data=nA(E.data,T.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(x,w){var C=w.meta,T=w.meta.arg,E,k,N=CA(T);(T.subscribe||N)&&((k=x[E=T.queryCacheKey])!=null||(x[E]={status:er.uninitialized,endpointName:T.endpointName})),Iv(x,T.queryCacheKey,function(O){O.status=er.pending,O.requestId=N&&O.requestId?O.requestId:C.requestId,T.originalArgs!==void 0&&(O.originalArgs=T.originalArgs),O.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(x,w){var C=w.meta,T=w.payload;Iv(x,C.arg.queryCacheKey,function(E){var k;if(!(E.requestId!==C.requestId&&!CA(C.arg))){var N=o[C.arg.endpointName].merge;if(E.status=er.fulfilled,N)if(E.data!==void 0){var O=C.fulfilledTimeStamp,A=C.arg,P=C.baseQueryMeta,D=C.requestId,L=Ec(E.data,function(M){return N(M,T,{arg:A.originalArgs,baseQueryMeta:P,fulfilledTimeStamp:O,requestId:D})});E.data=L}else E.data=T;else E.data=(k=o[C.arg.endpointName].structuralSharing)==null||k?Cz(uo(E.data)?r4(E.data):E.data,T):T;delete E.error,E.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(x,w){var C=w.meta,T=C.condition,E=C.arg,k=C.requestId,N=w.error,O=w.payload;Iv(x,E.queryCacheKey,function(A){if(!T){if(A.requestId!==k)return;A.status=er.rejected,A.error=O??N}})}).addMatcher(l,function(x,w){for(var C=s(w).queries,T=0,E=Object.entries(C);T"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?yce:mce;Oz.useSyncExternalStore=np.useSyncExternalStore!==void 0?np.useSyncExternalStore:vce;Rz.exports=Oz;var bce=Rz.exports,Mz={exports:{}},$z={};/** * @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 y2=I,_ce=bce;function Sce(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xce=typeof Object.is=="function"?Object.is:Sce,wce=_ce.useSyncExternalStore,Cce=y2.useRef,Ace=y2.useEffect,Ece=y2.useMemo,Tce=y2.useDebugValue;$z.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Cce(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=Ece(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&a.hasValue){var p=a.value;if(i(p,h))return d=p}return d=h}if(p=d,xce(c,h))return p;var m=r(h);return i!==void 0&&i(p,m)?p:(c=h,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=wce(e,o[0],o[1]);return Ace(function(){a.hasValue=!0,a.value=s},[s]),Tce(s),s};Mz.exports=$z;var Nz=Mz.exports;const kce=xc(Nz);function Pce(e){e()}let Dz=Pce;const Ice=e=>Dz=e,Rce=()=>Dz,YI=Symbol.for("react-redux-context"),ZI=typeof globalThis<"u"?globalThis:{};function Oce(){var e;if(!I.createContext)return{};const t=(e=ZI[YI])!=null?e:ZI[YI]=new Map;let n=t.get(I.createContext);return n||(n=I.createContext(null),t.set(I.createContext,n)),n}const pc=Oce();function Y4(e=pc){return function(){return I.useContext(e)}}const Lz=Y4(),Mce=()=>{throw new Error("uSES not initialized!")};let Fz=Mce;const $ce=e=>{Fz=e},Nce=(e,t)=>e===t;function Dce(e=pc){const t=e===pc?Lz:Y4(e);return function(r,i={}){const{equalityFn:o=Nce,stabilityCheck:a=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();I.useRef(!0);const h=I.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,a]),p=Fz(u.addNestedSub,l.getState,c||l.getState,h,o);return I.useDebugValue(p),p}}const Bz=Dce();function A_(){return A_=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 JI={notify(){},get:()=>[]};function Kce(e,t){let n,r=JI;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function a(){c.onStateChange&&c.onStateChange()}function s(){return!!n}function l(){n||(n=t?t.addNestedSub(a):e.subscribe(a),r=Wce())}function u(){n&&(n(),n=void 0,r.clear(),r=JI)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:a,isSubscribed:s,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const Qce=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Xce=Qce?I.useLayoutEffect:I.useEffect;function eR(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function E_(e,t){if(eR(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=Kce(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),s=I.useMemo(()=>e.getState(),[e]);Xce(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,s]);const l=t||pc;return I.createElement(l.Provider,{value:a},n)}function Hz(e=pc){const t=e===pc?Lz:Y4(e);return function(){const{store:r}=t();return r}}const qz=Hz();function Zce(e=pc){const t=e===pc?qz:Hz(e);return function(){return t().dispatch}}const Wz=Zce();$ce(Nz.useSyncExternalStoreWithSelector);Ice(Wo.unstable_batchedUpdates);var Jce=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n{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 a=n.indexOf(i);~a&&(n.splice(a,2),r.lc--,r.lc||r.off())}},notify(i){let o=!Zi.length;for(let a=0;a(e.events=e.events||{},e.events[n+Nv]||(e.events[n+Nv]=r(i=>{e.events[n].reduceRight((o,a)=>(a(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+Nv](),delete e.events[n+Nv])}),yde=1e3,vde=(e,t)=>mde(e,r=>{let i=t(r);i&&e.events[$v].push(i)},gde,r=>{let i=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...a));let o=e.off;return e.events[$v]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[$v])a();e.events[$v]=[]}},yde)},()=>{e.listen=i,e.off=o}}),bde=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(a=>a.get());(n===void 0||o.some((a,s)=>a!==n[s]))&&(n=o,i.set(t(...o)))},i=sl(void 0,Math.max(...e.map(o=>o.l))+1);return vde(i,()=>{let o=e.map(a=>a.listen(r,i.l));return r(),()=>{for(let a of o)a()}}),i};const _de={"Content-Type":"application/json"},Sde=/\/*$/;function xde(e={}){const{fetch:t=globalThis.fetch,querySerializer:n,bodySerializer:r,...i}=e;async function o(a,s){const{headers:l,body:u,params:c={},parseAs:d="json",querySerializer:f=n??wde,bodySerializer:h=r??Cde,...p}=s||{},m=Ade(a,{baseUrl:i.baseUrl,params:c,querySerializer:f}),_=Ede(_de,e==null?void 0:e.headers,l,c.header),b={redirect:"follow",...i,...p,headers:_};u&&(b.body=h(u)),b.body instanceof FormData&&_.delete("Content-Type");const y=await t(m,b);if(y.status===204||y.headers.get("Content-Length")==="0")return y.ok?{data:{},response:y}:{error:{},response:y};if(y.ok){let v=y.body;if(d!=="stream"){const S=y.clone();v=typeof S[d]=="function"?await S[d]():await S.text()}return{data:v,response:y}}let g={};try{g=await y.clone().json()}catch{g=await y.clone().text()}return{error:g,response:y}}return{async GET(a,s){return o(a,{...s,method:"GET"})},async PUT(a,s){return o(a,{...s,method:"PUT"})},async POST(a,s){return o(a,{...s,method:"POST"})},async DELETE(a,s){return o(a,{...s,method:"DELETE"})},async OPTIONS(a,s){return o(a,{...s,method:"OPTIONS"})},async HEAD(a,s){return o(a,{...s,method:"HEAD"})},async PATCH(a,s){return o(a,{...s,method:"PATCH"})},async TRACE(a,s){return o(a,{...s,method:"TRACE"})}}}function wde(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 Cde(e){return JSON.stringify(e)}function Ade(e,t){let n=`${t.baseUrl?t.baseUrl.replace(Sde,""):""}${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 Ede(...e){const t=new Headers;for(const n of e){if(!n||typeof n!="object")continue;const r=n instanceof Headers?n.entries():Object.entries(n);for(const[i,o]of r)o===null?t.delete(i):o!==void 0&&t.set(i,o)}return t}const rp=sl(),u0=sl(),c0=sl();bde([rp,u0,c0],(e,t,n)=>xde({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`}));const Tde=["AppVersion","AppConfig","Board","BoardImagesTotal","BoardAssetsTotal","Image","ImageNameList","ImageList","ImageMetadata","ImageMetadataFromFile","IntermediatesCount","SessionQueueItem","SessionQueueStatus","SessionProcessorStatus","CurrentSessionQueueItem","NextSessionQueueItem","BatchStatus","InvocationCacheStatus","Model","T2IAdapterModel","MainModel","OnnxModel","VaeModel","IPAdapterModel","TextualInversionModel","ControlNetModel","LoRAModel","SDXLRefinerModel"],no="LIST",kde=async(e,t,n)=>{const r=u0.get(),i=rp.get(),o=c0.get();return Vue({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),o&&s.set("project-id",o),s)})(e,t,n)},gs=pde({baseQuery:kde,reducerPath:"api",tagTypes:Tde,endpoints:()=>({})}),Pde=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,Nde=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),EA=Symbol("encodeFragmentIdentifier");function Dde(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,[Nr(t,e),"[",i,"]"].join("")]:[...n,[Nr(t,e),"[",Nr(i,e),"]=",Nr(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Nr(t,e),"[]"].join("")]:[...n,[Nr(t,e),"[]=",Nr(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,[Nr(t,e),":list="].join("")]:[...n,[Nr(t,e),":list=",Nr(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?[[Nr(n,e),t,Nr(i,e)].join("")]:[[r,Nr(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Nr(t,e)]:[...n,[Nr(t,e),"=",Nr(r,e)].join("")]}}function Lde(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),a=typeof r=="string"&&!o&&Cl(r,e).includes(e.arrayFormatSeparator);r=a?Cl(r,e):r;const s=o||a?r.split(e.arrayFormatSeparator).map(l=>Cl(l,e)):r===null?r:Cl(r,e);i[n]=s};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Cl(r,e);return}const a=r===null?[]:r.split(e.arrayFormatSeparator).map(s=>Cl(s,e));if(i[n]===void 0){i[n]=a;return}i[n]=[...i[n],...a]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function Xz(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Nr(e,t){return t.encode?t.strict?Nde(e):encodeURIComponent(e):e}function Cl(e,t){return t.decode?Ode(e):e}function Yz(e){return Array.isArray(e)?e.sort():typeof e=="object"?Yz(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function Zz(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function Fde(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function aR(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 rk(e){e=Zz(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function ik(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},Xz(t.arrayFormatSeparator);const n=Lde(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[a,s]=Qz(o,"=");a===void 0&&(a=o),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:Cl(s,t),n(Cl(a,t),s,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,s]of Object.entries(o))o[a]=aR(s,t);else r[i]=aR(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?i[o]=Yz(a):i[o]=a,i},Object.create(null))}function Jz(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},Xz(t.arrayFormatSeparator);const n=a=>t.skipNull&&$de(e[a])||t.skipEmptyString&&e[a]==="",r=Dde(t),i={};for(const[a,s]of Object.entries(e))n(a)||(i[a]=s);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(a=>{const s=e[a];return s===void 0?"":s===null?Nr(a,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Nr(a,t)+"[]":s.reduce(r(a),[]).join("&"):Nr(a,t)+"="+Nr(s,t)}).filter(a=>a.length>0).join("&")}function ej(e,t){var i;t={decode:!0,...t};let[n,r]=Qz(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:ik(rk(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Cl(r,t)}:{}}}function tj(e,t){t={encode:!0,strict:!0,[EA]:!0,...t};const n=Zz(e.url).split("?")[0]||"",r=rk(e.url),i={...ik(r,{sort:!1}),...e.query};let o=Jz(i,t);o&&(o=`?${o}`);let a=Fde(e.url);if(e.fragmentIdentifier){const s=new URL(n);s.hash=e.fragmentIdentifier,a=t[EA]?s.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${a}`}function nj(e,t,n){n={parseFragmentIdentifier:!0,[EA]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=ej(e,n);return tj({url:r,query:Mde(i,t),fragmentIdentifier:o},n)}function Bde(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return nj(e,r,n)}const im=Object.freeze(Object.defineProperty({__proto__:null,exclude:Bde,extract:rk,parse:ik,parseUrl:ej,pick:nj,stringify:Jz,stringifyUrl:tj},Symbol.toStringTag,{value:"Module"})),Fc=(e,t)=>{if(!e)return!1;const n=d0.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=s}else{const o=i[i.length-1];if(!o)return!1;const a=new Date(t.created_at),s=new Date(o.created_at);return a>=s}},da=e=>ii.includes(e.image_category)?ii:to,Vn=Ra({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:Pde(t.created_at,e.created_at)}),d0=Vn.getSelectors(),jo=e=>`images/?${im.stringify(e,{arrayFormat:"none"})}`,Lt=gs.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:no}];return t&&n.push(...t.items.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:t=>{const n=[{type:"Board",id:no}];return t&&n.push(...t.map(({board_id:r})=>({type:"Board",id:r}))),n}}),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:ii,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>({total:t.total})}),getBoardAssetsTotal:e.query({query:t=>({url:jo({board_id:t??"none",categories:to,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>({total:t.total})}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:no}]}),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:mHe,useListAllBoardsQuery:yHe,useGetBoardImagesTotalQuery:vHe,useGetBoardAssetsTotalQuery:bHe,useCreateBoardMutation:_He,useUpdateBoardMutation:SHe,useListAllImageNamesForBoardQuery:xHe}=Lt;var rj={exports:{}},ij={};const zo=ES(HZ),ng=ES(KY),zde=ES(aZ);(function(e){var t,n,r=yt&&yt.__generator||function(q,te){var re,de,oe,je,Ge={label:0,sent:function(){if(1&oe[0])throw oe[1];return oe[1]},trys:[],ops:[]};return je={next:ut(0),throw:ut(1),return:ut(2)},typeof Symbol=="function"&&(je[Symbol.iterator]=function(){return this}),je;function ut(Le){return function(He){return function(Re){if(re)throw new TypeError("Generator is already executing.");for(;Ge;)try{if(re=1,de&&(oe=2&Re[0]?de.return:Re[0]?de.throw||((oe=de.return)&&oe.call(de),0):de.next)&&!(oe=oe.call(de,Re[1])).done)return oe;switch(de=0,oe&&(Re=[2&Re[0],oe.value]),Re[0]){case 0:case 1:oe=Re;break;case 4:return Ge.label++,{value:Re[1],done:!1};case 5:Ge.label++,de=Re[1],Re=[0];continue;case 7:Re=Ge.ops.pop(),Ge.trys.pop();continue;default:if(!((oe=(oe=Ge.trys).length>0&&oe[oe.length-1])||Re[0]!==6&&Re[0]!==2)){Ge=0;continue}if(Re[0]===3&&(!oe||Re[1]>oe[0]&&Re[1]=200&&q.status<=299},N=function(q){return/ion\/(vnd\.api\+)?json/.test(q.get("content-type")||"")};function O(q){if(!(0,T.isPlainObject)(q))return q;for(var te=_({},q),re=0,de=Object.entries(te);re"u"&&Ge===E&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(wt,Et){return S(te,null,function(){var dn,fn,Ni,Bo,Di,Sr,vi,Qn,bo,Ga,it,hn,rn,ir,xr,bi,Sn,Mt,Wt,xn,on,mn,Ce,Je,Ue,ke,We,pt,Ve,Ae,ue,Te,fe,ge,Ee,et;return r(this,function(Qe){switch(Qe.label){case 0:return dn=Et.signal,fn=Et.getState,Ni=Et.extra,Bo=Et.endpoint,Di=Et.forced,Sr=Et.type,bo=(Qn=typeof wt=="string"?{url:wt}:wt).url,it=(Ga=Qn.headers)===void 0?new Headers(ht.headers):Ga,rn=(hn=Qn.params)===void 0?void 0:hn,xr=(ir=Qn.responseHandler)===void 0?Ze??"json":ir,Sn=(bi=Qn.validateStatus)===void 0?ct??k:bi,Wt=(Mt=Qn.timeout)===void 0?Ye:Mt,xn=g(Qn,["url","headers","params","responseHandler","validateStatus","timeout"]),on=_(b(_({},ht),{signal:dn}),xn),it=new Headers(O(it)),mn=on,[4,oe(it,{getState:fn,extra:Ni,endpoint:Bo,forced:Di,type:Sr})];case 1:mn.headers=Qe.sent()||it,Ce=function(Pe){return typeof Pe=="object"&&((0,T.isPlainObject)(Pe)||Array.isArray(Pe)||typeof Pe.toJSON=="function")},!on.headers.has("content-type")&&Ce(on.body)&&on.headers.set("content-type",ie),Ce(on.body)&&He(on.headers)&&(on.body=JSON.stringify(on.body,we)),rn&&(Je=~bo.indexOf("?")?"&":"?",Ue=ut?ut(rn):new URLSearchParams(O(rn)),bo+=Je+Ue),bo=function(Pe,Tt){if(!Pe)return Tt;if(!Tt)return Pe;if(function(Gt){return new RegExp("(^|:)//").test(Gt)}(Tt))return Tt;var jt=Pe.endsWith("/")||!Tt.startsWith("?")?"/":"";return Pe=function(Gt){return Gt.replace(/\/$/,"")}(Pe),""+Pe+jt+function(Gt){return Gt.replace(/^\//,"")}(Tt)}(re,bo),ke=new Request(bo,on),We=ke.clone(),vi={request:We},Ve=!1,Ae=Wt&&setTimeout(function(){Ve=!0,Et.abort()},Wt),Qe.label=2;case 2:return Qe.trys.push([2,4,5,6]),[4,Ge(ke)];case 3:return pt=Qe.sent(),[3,6];case 4:return ue=Qe.sent(),[2,{error:{status:Ve?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ue)},meta:vi}];case 5:return Ae&&clearTimeout(Ae),[7];case 6:Te=pt.clone(),vi.response=Te,ge="",Qe.label=7;case 7:return Qe.trys.push([7,9,,10]),[4,Promise.all([_t(pt,xr).then(function(Pe){return fe=Pe},function(Pe){return Ee=Pe}),Te.text().then(function(Pe){return ge=Pe},function(){})])];case 8:if(Qe.sent(),Ee)throw Ee;return[3,10];case 9:return et=Qe.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:pt.status,data:ge,error:String(et)},meta:vi}];case 10:return[2,Sn(pt,fe)?{data:fe,meta:vi}:{error:{status:pt.status,data:fe},meta:vi}]}})})};function _t(wt,Et){return S(this,null,function(){var dn;return r(this,function(fn){switch(fn.label){case 0:return typeof Et=="function"?[2,Et(wt)]:(Et==="content-type"&&(Et=He(wt.headers)?"json":"text"),Et!=="json"?[3,2]:[4,wt.text()]);case 1:return[2,(dn=fn.sent()).length?JSON.parse(dn):null];case 2:return[2,wt.text()]}})})}}var P=function(q,te){te===void 0&&(te=void 0),this.value=q,this.meta=te};function D(q,te){return q===void 0&&(q=0),te===void 0&&(te=5),S(this,null,function(){var re,de;return r(this,function(oe){switch(oe.label){case 0:return re=Math.min(q,te),de=~~((Math.random()+.4)*(300<=Te)}var xn=(0,en.createAsyncThunk)(rn+"/executeQuery",Mt,{getPendingMeta:function(){var Ce;return(Ce={startedTimeStamp:Date.now()})[en.SHOULD_AUTOBATCH]=!0,Ce},condition:function(Ce,Je){var Ue,ke,We,pt=(0,Je.getState)(),Ve=(ke=(Ue=pt[rn])==null?void 0:Ue.queries)==null?void 0:ke[Ce.queryCacheKey],Ae=Ve==null?void 0:Ve.fulfilledTimeStamp,ue=Ce.originalArgs,Te=Ve==null?void 0:Ve.originalArgs,fe=xr[Ce.endpointName];return!(!ze(Ce)&&((Ve==null?void 0:Ve.status)==="pending"||!Wt(Ce,pt)&&(!ne(fe)||!((We=fe==null?void 0:fe.forceRefetch)!=null&&We.call(fe,{currentArg:ue,previousArg:Te,endpointState:Ve,state:pt})))&&Ae))},dispatchConditionRejection:!0}),on=(0,en.createAsyncThunk)(rn+"/executeMutation",Mt,{getPendingMeta:function(){var Ce;return(Ce={startedTimeStamp:Date.now()})[en.SHOULD_AUTOBATCH]=!0,Ce}});function mn(Ce){return function(Je){var Ue,ke;return((ke=(Ue=Je==null?void 0:Je.meta)==null?void 0:Ue.arg)==null?void 0:ke.endpointName)===Ce}}return{queryThunk:xn,mutationThunk:on,prefetch:function(Ce,Je,Ue){return function(ke,We){var pt=function(fe){return"force"in fe}(Ue)&&Ue.force,Ve=function(fe){return"ifOlderThan"in fe}(Ue)&&Ue.ifOlderThan,Ae=function(fe){return fe===void 0&&(fe=!0),Sn.endpoints[Ce].initiate(Je,{forceRefetch:fe})},ue=Sn.endpoints[Ce].select(Je)(We());if(pt)ke(Ae());else if(Ve){var Te=ue==null?void 0:ue.fulfilledTimeStamp;if(!Te)return void ke(Ae());(Number(new Date)-Number(new Date(Te)))/1e3>=Ve&&ke(Ae())}else ke(Ae(!1))}},updateQueryData:function(Ce,Je,Ue){return function(ke,We){var pt,Ve,Ae=Sn.endpoints[Ce].select(Je)(We()),ue={patches:[],inversePatches:[],undo:function(){return ke(Sn.util.patchQueryData(Ce,Je,ue.inversePatches))}};if(Ae.status===t.uninitialized)return ue;if("data"in Ae)if((0,Ie.isDraftable)(Ae.data)){var Te=(0,Ie.produceWithPatches)(Ae.data,Ue),fe=Te[2];(pt=ue.patches).push.apply(pt,Te[1]),(Ve=ue.inversePatches).push.apply(Ve,fe)}else{var ge=Ue(Ae.data);ue.patches.push({op:"replace",path:[],value:ge}),ue.inversePatches.push({op:"replace",path:[],value:Ae.data})}return ke(Sn.util.patchQueryData(Ce,Je,ue.patches)),ue}},upsertQueryData:function(Ce,Je,Ue){return function(ke){var We;return ke(Sn.endpoints[Ce].initiate(Je,((We={subscribe:!1,forceRefetch:!0})[ot]=function(){return{data:Ue}},We)))}},patchQueryData:function(Ce,Je,Ue){return function(ke){ke(Sn.internalActions.queryResultPatched({queryCacheKey:bi({queryArgs:Je,endpointDefinition:xr[Ce],endpointName:Ce}),patches:Ue}))}},buildMatchThunkActions:function(Ce,Je){return{matchPending:(0,mt.isAllOf)((0,mt.isPending)(Ce),mn(Je)),matchFulfilled:(0,mt.isAllOf)((0,mt.isFulfilled)(Ce),mn(Je)),matchRejected:(0,mt.isAllOf)((0,mt.isRejected)(Ce),mn(Je))}}}}({baseQuery:de,reducerPath:oe,context:re,api:q,serializeQueryArgs:je}),we=ie.queryThunk,Ye=ie.mutationThunk,Ze=ie.patchQueryData,ct=ie.updateQueryData,ht=ie.upsertQueryData,_t=ie.prefetch,wt=ie.buildMatchThunkActions,Et=function(it){var hn=it.reducerPath,rn=it.queryThunk,ir=it.mutationThunk,xr=it.context,bi=xr.endpointDefinitions,Sn=xr.apiUid,Mt=xr.extractRehydrationInfo,Wt=xr.hasRehydrationInfo,xn=it.assertTagType,on=it.config,mn=(0,ce.createAction)(hn+"/resetApiState"),Ce=(0,ce.createSlice)({name:hn+"/queries",initialState:Jr,reducers:{removeQueryResult:{reducer:function(Ae,ue){delete Ae[ue.payload.queryCacheKey]},prepare:(0,ce.prepareAutoBatched)()},queryResultPatched:function(Ae,ue){var Te=ue.payload,fe=Te.patches;Ln(Ae,Te.queryCacheKey,function(ge){ge.data=(0,tn.applyPatches)(ge.data,fe.concat())})}},extraReducers:function(Ae){Ae.addCase(rn.pending,function(ue,Te){var fe,ge=Te.meta,Ee=Te.meta.arg,et=ze(Ee);(Ee.subscribe||et)&&(ue[fe=Ee.queryCacheKey]!=null||(ue[fe]={status:t.uninitialized,endpointName:Ee.endpointName})),Ln(ue,Ee.queryCacheKey,function(Qe){Qe.status=t.pending,Qe.requestId=et&&Qe.requestId?Qe.requestId:ge.requestId,Ee.originalArgs!==void 0&&(Qe.originalArgs=Ee.originalArgs),Qe.startedTimeStamp=ge.startedTimeStamp})}).addCase(rn.fulfilled,function(ue,Te){var fe=Te.meta,ge=Te.payload;Ln(ue,fe.arg.queryCacheKey,function(Ee){var et;if(Ee.requestId===fe.requestId||ze(fe.arg)){var Qe=bi[fe.arg.endpointName].merge;if(Ee.status=t.fulfilled,Qe)if(Ee.data!==void 0){var Pe=fe.fulfilledTimeStamp,Tt=fe.arg,jt=fe.baseQueryMeta,Gt=fe.requestId,or=(0,ce.createNextState)(Ee.data,function(gr){return Qe(gr,ge,{arg:Tt.originalArgs,baseQueryMeta:jt,fulfilledTimeStamp:Pe,requestId:Gt})});Ee.data=or}else Ee.data=ge;else Ee.data=(et=bi[fe.arg.endpointName].structuralSharing)==null||et?C((0,Tn.isDraft)(Ee.data)?(0,tn.original)(Ee.data):Ee.data,ge):ge;delete Ee.error,Ee.fulfilledTimeStamp=fe.fulfilledTimeStamp}})}).addCase(rn.rejected,function(ue,Te){var fe=Te.meta,ge=fe.condition,Ee=fe.requestId,et=Te.error,Qe=Te.payload;Ln(ue,fe.arg.queryCacheKey,function(Pe){if(!ge){if(Pe.requestId!==Ee)return;Pe.status=t.rejected,Pe.error=Qe??et}})}).addMatcher(Wt,function(ue,Te){for(var fe=Mt(Te).queries,ge=0,Ee=Object.entries(fe);ge"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},on),reducers:{middlewareRegistered:function(Ae,ue){Ae.middlewareRegistered=Ae.middlewareRegistered!=="conflict"&&Sn===ue.payload||"conflict"}},extraReducers:function(Ae){Ae.addCase(U,function(ue){ue.online=!0}).addCase(G,function(ue){ue.online=!1}).addCase($,function(ue){ue.focused=!0}).addCase(B,function(ue){ue.focused=!1}).addMatcher(Wt,function(ue){return _({},ue)})}}),Ve=(0,ce.combineReducers)({queries:Ce.reducer,mutations:Je.reducer,provided:Ue.reducer,subscriptions:We.reducer,config:pt.reducer});return{reducer:function(Ae,ue){return Ve(mn.match(ue)?void 0:Ae,ue)},actions:b(_(_(_(_(_({},pt.actions),Ce.actions),ke.actions),We.actions),Je.actions),{unsubscribeMutationResult:Je.actions.removeMutationResult,resetApiState:mn})}}({context:re,queryThunk:we,mutationThunk:Ye,reducerPath:oe,assertTagType:Re,config:{refetchOnFocus:Le,refetchOnReconnect:He,refetchOnMountOrArgChange:ut,keepUnusedDataFor:Ge,reducerPath:oe}}),dn=Et.reducer,fn=Et.actions;yi(q.util,{patchQueryData:Ze,updateQueryData:ct,upsertQueryData:ht,prefetch:_t,resetApiState:fn.resetApiState}),yi(q.internalActions,fn);var Ni=function(it){var hn=it.reducerPath,rn=it.queryThunk,ir=it.api,xr=it.context,bi=xr.apiUid,Sn={invalidateTags:(0,fl.createAction)(hn+"/invalidateTags")},Mt=[Ur,Bn,jr,Mr,$i,mi];return{middleware:function(xn){var on=!1,mn=b(_({},it),{internalState:{currentSubscriptions:{}},refetchQuery:Wt}),Ce=Mt.map(function(ke){return ke(mn)}),Je=function(ke){var We=ke.api,pt=ke.queryThunk,Ve=ke.internalState,Ae=We.reducerPath+"/subscriptions",ue=null,Te=!1,fe=We.internalActions,ge=fe.updateSubscriptionOptions,Ee=fe.unsubscribeQueryResult;return function(et,Qe){var Pe,Tt;if(ue||(ue=JSON.parse(JSON.stringify(Ve.currentSubscriptions))),We.util.resetApiState.match(et))return ue=Ve.currentSubscriptions={},[!0,!1];if(We.internalActions.internal_probeSubscription.match(et)){var jt=et.payload;return[!1,!!((Pe=Ve.currentSubscriptions[jt.queryCacheKey])!=null&&Pe[jt.requestId])]}var Gt=function(zn,kn){var Yi,F,V,X,pe,Ct,pn,Pn,It;if(ge.match(kn)){var wn=kn.payload,_i=wn.queryCacheKey,Xn=wn.requestId;return(Yi=zn==null?void 0:zn[_i])!=null&&Yi[Xn]&&(zn[_i][Xn]=wn.options),!0}if(Ee.match(kn)){var fu=kn.payload;return Xn=fu.requestId,zn[_i=fu.queryCacheKey]&&delete zn[_i][Xn],!0}if(We.internalActions.removeQueryResult.match(kn))return delete zn[kn.payload.queryCacheKey],!0;if(pt.pending.match(kn)){var uf=kn.meta;if(Xn=uf.requestId,(df=uf.arg).subscribe)return(hu=(V=zn[F=df.queryCacheKey])!=null?V:zn[F]={})[Xn]=(pe=(X=df.subscriptionOptions)!=null?X:hu[Xn])!=null?pe:{},!0}if(pt.rejected.match(kn)){var hu,cf=kn.meta,df=cf.arg;if(Xn=cf.requestId,cf.condition&&df.subscribe)return(hu=(pn=zn[Ct=df.queryCacheKey])!=null?pn:zn[Ct]={})[Xn]=(It=(Pn=df.subscriptionOptions)!=null?Pn:hu[Xn])!=null?It:{},!0}return!1}(Ve.currentSubscriptions,et);if(Gt){Te||(_s(function(){var zn=JSON.parse(JSON.stringify(Ve.currentSubscriptions)),kn=(0,Va.produceWithPatches)(ue,function(){return zn});Qe.next(We.internalActions.subscriptionsUpdated(kn[1])),ue=zn,Te=!1}),Te=!0);var or=!!((Tt=et.type)!=null&&Tt.startsWith(Ae)),gr=pt.rejected.match(et)&&et.meta.condition&&!!et.meta.arg.subscribe;return[!or&&!gr,!1]}return[!0,!1]}}(mn),Ue=function(ke){var We=ke.reducerPath,pt=ke.context,Ve=ke.refetchQuery,Ae=ke.internalState,ue=ke.api.internalActions.removeQueryResult;function Te(fe,ge){var Ee=fe.getState()[We],et=Ee.queries,Qe=Ae.currentSubscriptions;pt.batch(function(){for(var Pe=0,Tt=Object.keys(Qe);Peaj.safeParse(e).success||Ude.safeParse(e).success;z.enum(["connection","direct","any"]);const sj=z.object({id:z.string().trim().min(1),name:z.string().trim().min(1),type:aj}),Vde=sj.extend({fieldKind:z.literal("output")}),at=sj.extend({fieldKind:z.literal("input"),label:z.string()}),ou=z.object({model_name:z.string().trim().min(1),base_model:Pc}),Ep=z.object({image_name:z.string().trim().min(1)}),Gde=z.object({board_id:z.string().trim().min(1)}),k_=z.object({latents_name:z.string().trim().min(1),seed:z.number().int().optional()}),P_=z.object({conditioning_name:z.string().trim().min(1)}),Hde=z.object({mask_name:z.string().trim().min(1),masked_latents_name:z.string().trim().min(1).optional()}),qde=at.extend({type:z.literal("integer"),value:z.number().int().optional()}),Wde=at.extend({type:z.literal("IntegerCollection"),value:z.array(z.number().int()).optional()}),Kde=at.extend({type:z.literal("IntegerPolymorphic"),value:z.number().int().optional()}),Qde=at.extend({type:z.literal("float"),value:z.number().optional()}),Xde=at.extend({type:z.literal("FloatCollection"),value:z.array(z.number()).optional()}),Yde=at.extend({type:z.literal("FloatPolymorphic"),value:z.number().optional()}),Zde=at.extend({type:z.literal("string"),value:z.string().optional()}),Jde=at.extend({type:z.literal("StringCollection"),value:z.array(z.string()).optional()}),efe=at.extend({type:z.literal("StringPolymorphic"),value:z.string().optional()}),tfe=at.extend({type:z.literal("boolean"),value:z.boolean().optional()}),nfe=at.extend({type:z.literal("BooleanCollection"),value:z.array(z.boolean()).optional()}),rfe=at.extend({type:z.literal("BooleanPolymorphic"),value:z.boolean().optional()}),ife=at.extend({type:z.literal("enum"),value:z.string().optional()}),ofe=at.extend({type:z.literal("LatentsField"),value:k_.optional()}),afe=at.extend({type:z.literal("LatentsCollection"),value:z.array(k_).optional()}),sfe=at.extend({type:z.literal("LatentsPolymorphic"),value:z.union([k_,z.array(k_)]).optional()}),lfe=at.extend({type:z.literal("DenoiseMaskField"),value:Hde.optional()}),ufe=at.extend({type:z.literal("ConditioningField"),value:P_.optional()}),cfe=at.extend({type:z.literal("ConditioningCollection"),value:z.array(P_).optional()}),dfe=at.extend({type:z.literal("ConditioningPolymorphic"),value:z.union([P_,z.array(P_)]).optional()}),ffe=ou,f0=z.object({image:Ep,control_model:ffe,control_weight:z.union([z.number(),z.array(z.number())]).optional(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional(),control_mode:z.enum(["balanced","more_prompt","more_control","unbalanced"]).optional(),resize_mode:z.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),hfe=at.extend({type:z.literal("ControlField"),value:f0.optional()}),pfe=at.extend({type:z.literal("ControlPolymorphic"),value:z.union([f0,z.array(f0)]).optional()}),gfe=at.extend({type:z.literal("ControlCollection"),value:z.array(f0).optional()}),mfe=ou,h0=z.object({image:Ep,ip_adapter_model:mfe,weight:z.number(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional()}),yfe=at.extend({type:z.literal("IPAdapterField"),value:h0.optional()}),vfe=at.extend({type:z.literal("IPAdapterPolymorphic"),value:z.union([h0,z.array(h0)]).optional()}),bfe=at.extend({type:z.literal("IPAdapterCollection"),value:z.array(h0).optional()}),_fe=ou,p0=z.object({image:Ep,t2i_adapter_model:_fe,weight:z.union([z.number(),z.array(z.number())]).optional(),begin_step_percent:z.number().optional(),end_step_percent:z.number().optional(),resize_mode:z.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),Sfe=at.extend({type:z.literal("T2IAdapterField"),value:p0.optional()}),xfe=at.extend({type:z.literal("T2IAdapterPolymorphic"),value:z.union([p0,z.array(p0)]).optional()}),wfe=at.extend({type:z.literal("T2IAdapterCollection"),value:z.array(p0).optional()}),Cfe=z.enum(["onnx","main","vae","lora","controlnet","embedding"]),Afe=z.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),ip=ou.extend({model_type:Cfe,submodel:Afe.optional()}),lj=ip.extend({weight:z.number().optional()}),Efe=z.object({unet:ip,scheduler:ip,loras:z.array(lj)}),Tfe=at.extend({type:z.literal("UNetField"),value:Efe.optional()}),kfe=z.object({tokenizer:ip,text_encoder:ip,skipped_layers:z.number(),loras:z.array(lj)}),Pfe=at.extend({type:z.literal("ClipField"),value:kfe.optional()}),Ife=z.object({vae:ip}),Rfe=at.extend({type:z.literal("VaeField"),value:Ife.optional()}),Ofe=at.extend({type:z.literal("ImageField"),value:Ep.optional()}),Mfe=at.extend({type:z.literal("BoardField"),value:Gde.optional()}),$fe=at.extend({type:z.literal("ImagePolymorphic"),value:Ep.optional()}),Nfe=at.extend({type:z.literal("ImageCollection"),value:z.array(Ep).optional()}),Dfe=at.extend({type:z.literal("MainModelField"),value:wy.optional()}),Lfe=at.extend({type:z.literal("SDXLMainModelField"),value:wy.optional()}),Ffe=at.extend({type:z.literal("SDXLRefinerModelField"),value:wy.optional()}),uj=ou,Bfe=at.extend({type:z.literal("VaeModelField"),value:uj.optional()}),cj=ou,zfe=at.extend({type:z.literal("LoRAModelField"),value:cj.optional()}),jfe=ou,Ufe=at.extend({type:z.literal("ControlNetModelField"),value:jfe.optional()}),Vfe=ou,Gfe=at.extend({type:z.literal("IPAdapterModelField"),value:Vfe.optional()}),Hfe=ou,qfe=at.extend({type:z.literal("T2IAdapterModelField"),value:Hfe.optional()}),Wfe=at.extend({type:z.literal("Collection"),value:z.array(z.any()).optional()}),Kfe=at.extend({type:z.literal("CollectionItem"),value:z.any().optional()}),I_=z.object({r:z.number().int().min(0).max(255),g:z.number().int().min(0).max(255),b:z.number().int().min(0).max(255),a:z.number().int().min(0).max(255)}),Qfe=at.extend({type:z.literal("ColorField"),value:I_.optional()}),Xfe=at.extend({type:z.literal("ColorCollection"),value:z.array(I_).optional()}),Yfe=at.extend({type:z.literal("ColorPolymorphic"),value:z.union([I_,z.array(I_)]).optional()}),Zfe=at.extend({type:z.literal("Scheduler"),value:uz.optional()}),Jfe=z.discriminatedUnion("type",[Mfe,nfe,tfe,rfe,Pfe,Wfe,Kfe,Qfe,Xfe,Yfe,ufe,cfe,dfe,hfe,Ufe,gfe,pfe,lfe,ife,Xde,Qde,Yde,Nfe,$fe,Ofe,Wde,Kde,qde,yfe,Gfe,bfe,vfe,ofe,afe,sfe,zfe,Dfe,Zfe,Lfe,Ffe,Jde,efe,Zde,Sfe,qfe,wfe,xfe,Tfe,Rfe,Bfe]),wHe=e=>!!(e&&e.fieldKind==="input"),CHe=e=>!!(e&&e.fieldKind==="input"),ehe=e=>!!(e&&!("$ref"in e)),lR=e=>!!(e&&!("$ref"in e)&&e.type==="array"),Dv=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),rg=e=>!!(e&&"$ref"in e),the=e=>"class"in e&&e.class==="invocation",nhe=e=>"class"in e&&e.class==="output",uR=e=>!("$ref"in e),rhe=z.object({lora:cj.deepPartial(),weight:z.number()}),ihe=f0.deepPartial(),ohe=h0.deepPartial(),ahe=p0.deepPartial(),dj=z.object({app_version:z.string().nullish().catch(null),generation_mode:z.string().nullish().catch(null),created_by:z.string().nullish().catch(null),positive_prompt:z.string().nullish().catch(null),negative_prompt:z.string().nullish().catch(null),width:z.number().int().nullish().catch(null),height:z.number().int().nullish().catch(null),seed:z.number().int().nullish().catch(null),rand_device:z.string().nullish().catch(null),cfg_scale:z.number().nullish().catch(null),steps:z.number().int().nullish().catch(null),scheduler:z.string().nullish().catch(null),clip_skip:z.number().int().nullish().catch(null),model:z.union([g2.deepPartial(),fz.deepPartial()]).nullish().catch(null),controlnets:z.array(ihe).nullish().catch(null),ipAdapters:z.array(ohe).nullish().catch(null),t2iAdapters:z.array(ahe).nullish().catch(null),loras:z.array(rhe).nullish().catch(null),vae:uj.nullish().catch(null),strength:z.number().nullish().catch(null),init_image:z.string().nullish().catch(null),positive_style_prompt:z.string().nullish().catch(null),negative_style_prompt:z.string().nullish().catch(null),refiner_model:V4.deepPartial().nullish().catch(null),refiner_cfg_scale:z.number().nullish().catch(null),refiner_steps:z.number().int().nullish().catch(null),refiner_scheduler:z.string().nullish().catch(null),refiner_positive_aesthetic_score:z.number().nullish().catch(null),refiner_negative_aesthetic_score:z.number().nullish().catch(null),refiner_start:z.number().nullish().catch(null)}).passthrough(),ok=z.string().refine(e=>{const[t,n,r]=e.split(".");return t!==void 0&&Number.isInteger(Number(t))&&n!==void 0&&Number.isInteger(Number(n))&&r!==void 0&&Number.isInteger(Number(r))});ok.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}});const cR=z.object({id:z.string().trim().min(1),type:z.string().trim().min(1),inputs:z.record(Jfe),outputs:z.record(Vde),label:z.string(),isOpen:z.boolean(),notes:z.string(),embedWorkflow:z.boolean(),isIntermediate:z.boolean(),useCache:z.boolean().optional(),version:ok.optional()}),she=z.preprocess(e=>{var t;try{const n=cR.parse(e);if(!Voe(n,"useCache")){const r=(t=oj.get())==null?void 0:t.getState().nodes.nodeTemplates,i=r==null?void 0:r[n.type];let o=!0;i&&(o=i.useCache),Object.assign(n,{useCache:o})}return n}catch{return e}},cR.extend({useCache:z.boolean()})),lhe=z.object({id:z.string().trim().min(1),type:z.literal("notes"),label:z.string(),isOpen:z.boolean(),notes:z.string()}),fj=z.object({x:z.number(),y:z.number()}).default({x:0,y:0}),R_=z.number().gt(0).nullish(),hj=z.object({id:z.string().trim().min(1),type:z.literal("invocation"),data:she,width:R_,height:R_,position:fj}),TA=e=>hj.safeParse(e).success,uhe=z.object({id:z.string().trim().min(1),type:z.literal("notes"),data:lhe,width:R_,height:R_,position:fj}),pj=z.discriminatedUnion("type",[hj,uhe]),che=z.object({source:z.string().trim().min(1),sourceHandle:z.string().trim().min(1),target:z.string().trim().min(1),targetHandle:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("default")}),dhe=z.object({source:z.string().trim().min(1),target:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("collapsed")}),gj=z.union([che,dhe]),fhe=z.object({nodeId:z.string().trim().min(1),fieldName:z.string().trim().min(1)}),hhe="1.0.0",mj=z.object({name:z.string().default(""),author:z.string().default(""),description:z.string().default(""),version:z.string().default(""),contact:z.string().default(""),tags:z.string().default(""),notes:z.string().default(""),nodes:z.array(pj).default([]),edges:z.array(gj).default([]),exposedFields:z.array(fhe).default([]),meta:z.object({version:ok}).default({version:hhe})});mj.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(TA),o=I4(i,"id");return n.forEach((a,s)=>{const l=o[a.source],u=o[a.target],c=[];if(l?a.type==="default"&&!(a.sourceHandle in l.data.outputs)&&c.push(`${me.t("nodes.outputField")}"${a.source}.${a.sourceHandle}" ${me.t("nodes.doesNotExist")}`):c.push(`${me.t("nodes.outputNode")} ${a.source} ${me.t("nodes.doesNotExist")}`),u?a.type==="default"&&!(a.targetHandle in u.data.inputs)&&c.push(`${me.t("nodes.inputField")} "${a.target}.${a.targetHandle}" ${me.t("nodes.doesNotExist")}`):c.push(`${me.t("nodes.inputNode")} ${a.target} ${me.t("nodes.doesNotExist")}`),c.length){delete n[s];const d=a.type==="default"?a.sourceHandle:a.source,f=a.type==="default"?a.targetHandle:a.target;r.push({message:`${me.t("nodes.edge")} "${d} -> ${f}" ${me.t("nodes.skipped")}`,issues:c,data:a})}}),{workflow:e,warnings:r}});const Vr=e=>!!(e&&e.type==="invocation"),AHe=e=>!!(e&&!["notes","current_image"].includes(e.type)),dR=e=>!!(e&&e.type==="notes");var Jc=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(Jc||{});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const phe=4,fR=0,hR=1,ghe=2;function Tp(e){let t=e.length;for(;--t>=0;)e[t]=0}const mhe=0,yj=1,yhe=2,vhe=3,bhe=258,ak=29,Cy=256,g0=Cy+1+ak,xh=30,sk=19,vj=2*g0+1,cd=15,PC=16,_he=7,lk=256,bj=16,_j=17,Sj=18,kA=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),X1=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),She=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),xj=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xhe=512,Al=new Array((g0+2)*2);Tp(Al);const om=new Array(xh*2);Tp(om);const m0=new Array(xhe);Tp(m0);const y0=new Array(bhe-vhe+1);Tp(y0);const uk=new Array(ak);Tp(uk);const O_=new Array(xh);Tp(O_);function IC(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let wj,Cj,Aj;function RC(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const Ej=e=>e<256?m0[e]:m0[256+(e>>>7)],v0=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},To=(e,t,n)=>{e.bi_valid>PC-n?(e.bi_buf|=t<>PC-e.bi_valid,e.bi_valid+=n-PC):(e.bi_buf|=t<{To(e,n[t*2],n[t*2+1])},Tj=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},whe=e=>{e.bi_valid===16?(v0(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Che=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,f,h,p,m=0;for(f=0;f<=cd;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ul&&(f=l,m++),n[c*2+1]=f,!(c>r)&&(e.bl_count[f]++,h=0,c>=s&&(h=a[c-s]),p=n[c*2],e.opt_len+=p*(f+h),o&&(e.static_len+=p*(i[c*2+1]+h)));if(m!==0){do{for(f=l-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(c=e.bl_count[f];c!==0;)d=e.heap[--u],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),c--)}},kj=(e,t,n)=>{const r=new Array(cd+1);let i=0,o,a;for(o=1;o<=cd;o++)i=i+n[o-1]<<1,r[o]=i;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=Tj(r[s]++,s))}},Ahe=()=>{let e,t,n,r,i;const o=new Array(cd+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?v0(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},pR=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,o=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Ds(e,i,t):(a=y0[i],Ds(e,a+Cy+1,t),s=kA[a],s!==0&&(i-=uk[a],To(e,i,s)),r--,a=Ej(r),Ds(e,a,n),s=X1[a],s!==0&&(r-=O_[a],To(e,r,s)));while(o{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,l=-1,u;for(e.heap_len=0,e.heap_max=vj,a=0;a>1;a>=1;a--)OC(e,n,a);u=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],OC(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,OC(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Che(e,t),kj(n,l,e.bl_count)},mR=(e,t,n)=>{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=a,a=t[(r+1)*2+1],!(++s{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=n;r++)if(o=a,a=t[(r+1)*2+1],!(++s{let t;for(mR(e,e.dyn_ltree,e.l_desc.max_code),mR(e,e.dyn_dtree,e.d_desc.max_code),PA(e,e.bl_desc),t=sk-1;t>=3&&e.bl_tree[xj[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},The=(e,t,n,r)=>{let i;for(To(e,t-257,5),To(e,n-1,5),To(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return fR;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return hR;for(n=32;n{vR||(Ahe(),vR=!0),e.l_desc=new RC(e.dyn_ltree,wj),e.d_desc=new RC(e.dyn_dtree,Cj),e.bl_desc=new RC(e.bl_tree,Aj),e.bi_buf=0,e.bi_valid=0,Pj(e)},Rj=(e,t,n,r)=>{To(e,(mhe<<1)+(r?1:0),3),Ij(e),v0(e,n),v0(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Ihe=e=>{To(e,yj<<1,3),Ds(e,lk,Al),whe(e)},Rhe=(e,t,n,r)=>{let i,o,a=0;e.level>0?(e.strm.data_type===ghe&&(e.strm.data_type=khe(e)),PA(e,e.l_desc),PA(e,e.d_desc),a=Ehe(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?Rj(e,t,n,r):e.strategy===phe||o===i?(To(e,(yj<<1)+(r?1:0),3),gR(e,Al,om)):(To(e,(yhe<<1)+(r?1:0),3),The(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),gR(e,e.dyn_ltree,e.dyn_dtree)),Pj(e),r&&Ij(e)},Ohe=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(y0[n]+Cy+1)*2]++,e.dyn_dtree[Ej(t)*2]++),e.sym_next===e.sym_end);var Mhe=Phe,$he=Rj,Nhe=Rhe,Dhe=Ohe,Lhe=Ihe,Fhe={_tr_init:Mhe,_tr_stored_block:$he,_tr_flush_block:Nhe,_tr_tally:Dhe,_tr_align:Lhe};const Bhe=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0};var b0=Bhe;const zhe=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},jhe=new Uint32Array(zhe()),Uhe=(e,t,n,r)=>{const i=jhe,o=r+n;e^=-1;for(let a=r;a>>8^i[(e^t[a])&255];return e^-1};var ai=Uhe,op={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ay={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Vhe,_tr_stored_block:IA,_tr_flush_block:Ghe,_tr_tally:Ju,_tr_align:Hhe}=Fhe,{Z_NO_FLUSH:ec,Z_PARTIAL_FLUSH:qhe,Z_FULL_FLUSH:Whe,Z_FINISH:xa,Z_BLOCK:bR,Z_OK:Ai,Z_STREAM_END:_R,Z_STREAM_ERROR:Ws,Z_DATA_ERROR:Khe,Z_BUF_ERROR:MC,Z_DEFAULT_COMPRESSION:Qhe,Z_FILTERED:Xhe,Z_HUFFMAN_ONLY:Lv,Z_RLE:Yhe,Z_FIXED:Zhe,Z_DEFAULT_STRATEGY:Jhe,Z_UNKNOWN:epe,Z_DEFLATED:F2}=Ay,tpe=9,npe=15,rpe=8,ipe=29,ope=256,RA=ope+1+ipe,ape=30,spe=19,lpe=2*RA+1,upe=15,Bt=3,Uu=258,Ks=Uu+Bt+1,cpe=32,ap=42,ck=57,OA=69,MA=73,$A=91,NA=103,dd=113,Ig=666,oo=1,kp=2,Fd=3,Pp=4,dpe=3,fd=(e,t)=>(e.msg=op[t],t),SR=e=>e*2-(e>4?9:0),Mu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},fpe=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let hpe=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Yo=(e,t)=>{Ghe(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Uo(e.strm)},an=(e,t)=>{e.pending_buf[e.pending++]=t},ig=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},DA=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=b0(e.adler,t,i,n):e.state.wrap===2&&(e.adler=ai(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},Oj=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,a=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-Ks?e.strstart-(e.w_size-Ks):0,u=e.window,c=e.w_mask,d=e.prev,f=e.strstart+Uu;let h=u[r+a-1],p=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(u[i+a]!==p||u[i+a-1]!==h||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&ra){if(e.match_start=t,a=o,o>=s)break;h=u[r+a-1],p=u[r+a]}}while((t=d[t&c])>l&&--n!==0);return a<=e.lookahead?a:e.lookahead},sp=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ks)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),fpe(e),r+=t),e.strm.avail_in===0)break;if(n=DA(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Bt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=tc(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=tc(e,e.ins_h,e.window[i+Bt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,a=0,s=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Uo(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(DA(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watero&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(DA(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===xa)&&t!==ec&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,a=t===xa&&e.strm.avail_in===0&&r===i?1:0,IA(e,e.block_start,r,a),e.block_start+=r,Uo(e.strm)),a?Fd:oo)},$C=(e,t)=>{let n,r;for(;;){if(e.lookahead=Bt&&(e.ins_h=tc(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Ks&&(e.match_length=Oj(e,n)),e.match_length>=Bt)if(r=Ju(e,e.strstart-e.match_start,e.match_length-Bt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Bt){e.match_length--;do e.strstart++,e.ins_h=tc(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=tc(e,e.ins_h,e.window[e.strstart+1]);else r=Ju(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Yo(e,!1),e.strm.avail_out===0))return oo}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=Bt&&(e.ins_h=tc(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Bt-1,n!==0&&e.prev_length4096)&&(e.match_length=Bt-1)),e.prev_length>=Bt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Bt,r=Ju(e,e.strstart-1-e.prev_match,e.prev_length-Bt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=tc(e,e.ins_h,e.window[e.strstart+Bt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Bt-1,e.strstart++,r&&(Yo(e,!1),e.strm.avail_out===0))return oo}else if(e.match_available){if(r=Ju(e,0,e.window[e.strstart-1]),r&&Yo(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return oo}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ju(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=Uu){if(sp(e),e.lookahead<=Uu&&t===ec)return oo;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Bt&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+Uu;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Bt?(n=Ju(e,1,e.match_length-Bt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ju(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Yo(e,!1),e.strm.avail_out===0))return oo}return e.insert=0,t===xa?(Yo(e,!0),e.strm.avail_out===0?Fd:Pp):e.sym_next&&(Yo(e,!1),e.strm.avail_out===0)?oo:kp},gpe=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(sp(e),e.lookahead===0)){if(t===ec)return oo;break}if(e.match_length=0,n=Ju(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Yo(e,!1),e.strm.avail_out===0))return oo}return e.insert=0,t===xa?(Yo(e,!0),e.strm.avail_out===0?Fd:Pp):e.sym_next&&(Yo(e,!1),e.strm.avail_out===0)?oo:kp};function ws(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const Rg=[new ws(0,0,0,0,Mj),new ws(4,4,8,4,$C),new ws(4,5,16,8,$C),new ws(4,6,32,32,$C),new ws(4,4,16,16,mf),new ws(8,16,32,32,mf),new ws(8,16,128,128,mf),new ws(8,32,128,256,mf),new ws(32,128,258,1024,mf),new ws(32,258,258,4096,mf)],mpe=e=>{e.window_size=2*e.w_size,Mu(e.head),e.max_lazy_match=Rg[e.level].max_lazy,e.good_match=Rg[e.level].good_length,e.nice_match=Rg[e.level].nice_length,e.max_chain_length=Rg[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Bt-1,e.match_available=0,e.ins_h=0};function ype(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=F2,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(lpe*2),this.dyn_dtree=new Uint16Array((2*ape+1)*2),this.bl_tree=new Uint16Array((2*spe+1)*2),Mu(this.dyn_ltree),Mu(this.dyn_dtree),Mu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(upe+1),this.heap=new Uint16Array(2*RA+1),Mu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*RA+1),Mu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ey=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ap&&t.status!==ck&&t.status!==OA&&t.status!==MA&&t.status!==$A&&t.status!==NA&&t.status!==dd&&t.status!==Ig?1:0},$j=e=>{if(Ey(e))return fd(e,Ws);e.total_in=e.total_out=0,e.data_type=epe;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?ck:t.wrap?ap:dd,e.adler=t.wrap===2?0:1,t.last_flush=-2,Vhe(t),Ai},Nj=e=>{const t=$j(e);return t===Ai&&mpe(e.state),t},vpe=(e,t)=>Ey(e)||e.state.wrap!==2?Ws:(e.state.gzhead=t,Ai),Dj=(e,t,n,r,i,o)=>{if(!e)return Ws;let a=1;if(t===Qhe&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>tpe||n!==F2||r<8||r>15||t<0||t>9||o<0||o>Zhe||r===8&&a!==1)return fd(e,Ws);r===8&&(r=9);const s=new ype;return e.state=s,s.strm=e,s.status=ap,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<Dj(e,t,F2,npe,rpe,Jhe),_pe=(e,t)=>{if(Ey(e)||t>bR||t<0)return e?fd(e,Ws):Ws;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Ig&&t!==xa)return fd(e,e.avail_out===0?MC:Ws);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Uo(e),e.avail_out===0)return n.last_flush=-1,Ai}else if(e.avail_in===0&&SR(t)<=SR(r)&&t!==xa)return fd(e,MC);if(n.status===Ig&&e.avail_in!==0)return fd(e,MC);if(n.status===ap&&n.wrap===0&&(n.status=dd),n.status===ap){let i=F2+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=Lv||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=cpe),i+=31-i%31,ig(n,i),n.strstart!==0&&(ig(n,e.adler>>>16),ig(n,e.adler&65535)),e.adler=1,n.status=dd,Uo(e),n.pending!==0)return n.last_flush=-1,Ai}if(n.status===ck){if(e.adler=0,an(n,31),an(n,139),an(n,8),n.gzhead)an(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),an(n,n.gzhead.time&255),an(n,n.gzhead.time>>8&255),an(n,n.gzhead.time>>16&255),an(n,n.gzhead.time>>24&255),an(n,n.level===9?2:n.strategy>=Lv||n.level<2?4:0),an(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(an(n,n.gzhead.extra.length&255),an(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=ai(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=OA;else if(an(n,0),an(n,0),an(n,0),an(n,0),an(n,0),an(n,n.level===9?2:n.strategy>=Lv||n.level<2?4:0),an(n,dpe),n.status=dd,Uo(e),n.pending!==0)return n.last_flush=-1,Ai}if(n.status===OA){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,Uo(e),n.pending!==0)return n.last_flush=-1,Ai;i=0,o-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=MA}if(n.status===MA){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Uo(e),n.pending!==0)return n.last_flush=-1,Ai;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=$A}if(n.status===$A){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i)),Uo(e),n.pending!==0)return n.last_flush=-1,Ai;i=0}n.gzindexi&&(e.adler=ai(e.adler,n.pending_buf,n.pending-i,i))}n.status=NA}if(n.status===NA){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Uo(e),n.pending!==0))return n.last_flush=-1,Ai;an(n,e.adler&255),an(n,e.adler>>8&255),e.adler=0}if(n.status=dd,Uo(e),n.pending!==0)return n.last_flush=-1,Ai}if(e.avail_in!==0||n.lookahead!==0||t!==ec&&n.status!==Ig){let i=n.level===0?Mj(n,t):n.strategy===Lv?gpe(n,t):n.strategy===Yhe?ppe(n,t):Rg[n.level].func(n,t);if((i===Fd||i===Pp)&&(n.status=Ig),i===oo||i===Fd)return e.avail_out===0&&(n.last_flush=-1),Ai;if(i===kp&&(t===qhe?Hhe(n):t!==bR&&(IA(n,0,0,!1),t===Whe&&(Mu(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Uo(e),e.avail_out===0))return n.last_flush=-1,Ai}return t!==xa?Ai:n.wrap<=0?_R:(n.wrap===2?(an(n,e.adler&255),an(n,e.adler>>8&255),an(n,e.adler>>16&255),an(n,e.adler>>24&255),an(n,e.total_in&255),an(n,e.total_in>>8&255),an(n,e.total_in>>16&255),an(n,e.total_in>>24&255)):(ig(n,e.adler>>>16),ig(n,e.adler&65535)),Uo(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Ai:_R)},Spe=e=>{if(Ey(e))return Ws;const t=e.state.status;return e.state=null,t===dd?fd(e,Khe):Ai},xpe=(e,t)=>{let n=t.length;if(Ey(e))return Ws;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==ap||r.lookahead)return Ws;if(i===1&&(e.adler=b0(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Mu(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,sp(r);r.lookahead>=Bt;){let l=r.strstart,u=r.lookahead-(Bt-1);do r.ins_h=tc(r,r.ins_h,r.window[l+Bt-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=Bt-1,sp(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Bt-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,Ai};var wpe=bpe,Cpe=Dj,Ape=Nj,Epe=$j,Tpe=vpe,kpe=_pe,Ppe=Spe,Ipe=xpe,Rpe="pako deflate (from Nodeca project)",am={deflateInit:wpe,deflateInit2:Cpe,deflateReset:Ape,deflateResetKeep:Epe,deflateSetHeader:Tpe,deflate:kpe,deflateEnd:Ppe,deflateSetDictionary:Ipe,deflateInfo:Rpe};const Ope=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Mpe=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)Ope(n,r)&&(e[r]=n[r])}}return e},$pe=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;_0[254]=_0[254]=1;var Npe=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const Dpe=(e,t)=>{if(t<65534&&e.subarray&&Lj)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r4){o[i++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}a<65536?o[i++]=a:(a-=65536,o[i++]=55296|a>>10&1023,o[i++]=56320|a&1023)}return Dpe(o,i)},Fpe=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+_0[e[n]]>t?n:t},S0={string2buf:Npe,buf2string:Lpe,utf8border:Fpe};function Bpe(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Fj=Bpe;const Bj=Object.prototype.toString,{Z_NO_FLUSH:zpe,Z_SYNC_FLUSH:jpe,Z_FULL_FLUSH:Upe,Z_FINISH:Vpe,Z_OK:M_,Z_STREAM_END:Gpe,Z_DEFAULT_COMPRESSION:Hpe,Z_DEFAULT_STRATEGY:qpe,Z_DEFLATED:Wpe}=Ay;function dk(e){this.options=B2.assign({level:Hpe,method:Wpe,chunkSize:16384,windowBits:15,memLevel:8,strategy:qpe},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fj,this.strm.avail_out=0;let n=am.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==M_)throw new Error(op[n]);if(t.header&&am.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=S0.string2buf(t.dictionary):Bj.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=am.deflateSetDictionary(this.strm,r),n!==M_)throw new Error(op[n]);this._dict_set=!0}}dk.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?Vpe:zpe,typeof e=="string"?n.input=S0.string2buf(e):Bj.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===jpe||o===Upe)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=am.deflate(n,o),i===Gpe)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=am.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===M_;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};dk.prototype.onData=function(e){this.chunks.push(e)};dk.prototype.onEnd=function(e){e===M_&&(this.result=B2.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const Fv=16209,Kpe=16191;var Qpe=function(t,n){let r,i,o,a,s,l,u,c,d,f,h,p,m,_,b,y,g,v,S,x,w,C,T,E;const k=t.state;r=t.next_in,T=t.input,i=r+(t.avail_in-5),o=t.next_out,E=t.output,a=o-(n-t.avail_out),s=o+(t.avail_out-257),l=k.dmax,u=k.wsize,c=k.whave,d=k.wnext,f=k.window,h=k.hold,p=k.bits,m=k.lencode,_=k.distcode,b=(1<>>24,h>>>=v,p-=v,v=g>>>16&255,v===0)E[o++]=g&65535;else if(v&16){S=g&65535,v&=15,v&&(p>>=v,p-=v),p<15&&(h+=T[r++]<>>24,h>>>=v,p-=v,v=g>>>16&255,v&16){if(x=g&65535,v&=15,pl){t.msg="invalid distance too far back",k.mode=Fv;break e}if(h>>>=v,p-=v,v=o-a,x>v){if(v=x-v,v>c&&k.sane){t.msg="invalid distance too far back",k.mode=Fv;break e}if(w=0,C=f,d===0){if(w+=u-v,v2;)E[o++]=C[w++],E[o++]=C[w++],E[o++]=C[w++],S-=3;S&&(E[o++]=C[w++],S>1&&(E[o++]=C[w++]))}else{w=o-x;do E[o++]=E[w++],E[o++]=E[w++],E[o++]=E[w++],S-=3;while(S>2);S&&(E[o++]=E[w++],S>1&&(E[o++]=E[w++]))}}else if(v&64){t.msg="invalid distance code",k.mode=Fv;break e}else{g=_[(g&65535)+(h&(1<>3,r-=S,p-=S<<3,h&=(1<{const l=s.bits;let u=0,c=0,d=0,f=0,h=0,p=0,m=0,_=0,b=0,y=0,g,v,S,x,w,C=null,T;const E=new Uint16Array(yf+1),k=new Uint16Array(yf+1);let N=null,O,A,P;for(u=0;u<=yf;u++)E[u]=0;for(c=0;c=1&&E[f]===0;f--);if(h>f&&(h=f),f===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d0&&(e===CR||f!==1))return-1;for(k[1]=0,u=1;uxR||e===AR&&b>wR)return 1;for(;;){O=u-m,a[c]+1=T?(A=N[a[c]-T],P=C[a[c]-T]):(A=32+64,P=0),g=1<>m)+v]=O<<24|A<<16|P|0;while(v!==0);for(g=1<>=1;if(g!==0?(y&=g-1,y+=g):y=0,c++,--E[u]===0){if(u===f)break;u=t[n+a[c]]}if(u>h&&(y&x)!==S){for(m===0&&(m=h),w+=d,p=u-m,_=1<xR||e===AR&&b>wR)return 1;S=y&x,i[S]=h<<24|p<<16|w-o|0}}return y!==0&&(i[w+y]=u-m<<24|64<<16|0),s.bits=h,0};var sm=ege;const tge=0,zj=1,jj=2,{Z_FINISH:ER,Z_BLOCK:nge,Z_TREES:Bv,Z_OK:Bd,Z_STREAM_END:rge,Z_NEED_DICT:ige,Z_STREAM_ERROR:Ia,Z_DATA_ERROR:Uj,Z_MEM_ERROR:Vj,Z_BUF_ERROR:oge,Z_DEFLATED:TR}=Ay,z2=16180,kR=16181,PR=16182,IR=16183,RR=16184,OR=16185,MR=16186,$R=16187,NR=16188,DR=16189,$_=16190,pl=16191,DC=16192,LR=16193,LC=16194,FR=16195,BR=16196,zR=16197,jR=16198,zv=16199,jv=16200,UR=16201,VR=16202,GR=16203,HR=16204,qR=16205,FC=16206,WR=16207,KR=16208,Zn=16209,Gj=16210,Hj=16211,age=852,sge=592,lge=15,uge=lge,QR=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function cge(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Xd=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeHj?1:0},qj=e=>{if(Xd(e))return Ia;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=z2,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(age),t.distcode=t.distdyn=new Int32Array(sge),t.sane=1,t.back=-1,Bd},Wj=e=>{if(Xd(e))return Ia;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,qj(e)},Kj=(e,t)=>{let n;if(Xd(e))return Ia;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Ia:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Wj(e))},Qj=(e,t)=>{if(!e)return Ia;const n=new cge;e.state=n,n.strm=e,n.window=null,n.mode=z2;const r=Kj(e,t);return r!==Bd&&(e.state=null),r},dge=e=>Qj(e,uge);let XR=!0,BC,zC;const fge=e=>{if(XR){BC=new Int32Array(512),zC=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(sm(zj,e.lens,0,288,BC,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;sm(jj,e.lens,0,32,zC,0,e.work,{bits:5}),XR=!1}e.lencode=BC,e.lenbits=9,e.distcode=zC,e.distbits=5},Xj=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let n,r,i,o,a,s,l,u,c,d,f,h,p,m,_=0,b,y,g,v,S,x,w,C;const T=new Uint8Array(4);let E,k;const N=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Xd(e)||!e.output||!e.input&&e.avail_in!==0)return Ia;n=e.state,n.mode===pl&&(n.mode=DC),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,d=s,f=l,C=Bd;e:for(;;)switch(n.mode){case z2:if(n.wrap===0){n.mode=DC;break}for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,T,2,0),u=0,c=0,n.mode=kR;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Zn;break}if((u&15)!==TR){e.msg="unknown compression method",n.mode=Zn;break}if(u>>>=4,c-=4,w=(u&15)+8,n.wbits===0&&(n.wbits=w),w>15||w>n.wbits){e.msg="invalid window size",n.mode=Zn;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0,n.mode=PR;case PR:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>8&255,T[2]=u>>>16&255,T[3]=u>>>24&255,n.check=ai(n.check,T,4,0)),u=0,c=0,n.mode=IR;case IR:for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>8),n.flags&512&&n.wrap&4&&(T[0]=u&255,T[1]=u>>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0,n.mode=RR;case RR:if(n.flags&1024){for(;c<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=ai(n.check,T,2,0)),u=0,c=0}else n.head&&(n.head.extra=null);n.mode=OR;case OR:if(n.flags&1024&&(h=n.length,h>s&&(h=s),h&&(n.head&&(w=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+h),w)),n.flags&512&&n.wrap&4&&(n.check=ai(n.check,r,h,o)),s-=h,o+=h,n.length-=h),n.length))break e;n.length=0,n.mode=MR;case MR:if(n.flags&2048){if(s===0)break e;h=0;do w=r[o+h++],n.head&&w&&n.length<65536&&(n.head.name+=String.fromCharCode(w));while(w&&h>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=pl;break;case DR:for(;c<32;){if(s===0)break e;s--,u+=r[o++]<>>=c&7,c-=c&7,n.mode=FC;break}for(;c<3;){if(s===0)break e;s--,u+=r[o++]<>>=1,c-=1,u&3){case 0:n.mode=LR;break;case 1:if(fge(n),n.mode=zv,t===Bv){u>>>=2,c-=2;break e}break;case 2:n.mode=BR;break;case 3:e.msg="invalid block type",n.mode=Zn}u>>>=2,c-=2;break;case LR:for(u>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Zn;break}if(n.length=u&65535,u=0,c=0,n.mode=LC,t===Bv)break e;case LC:n.mode=FR;case FR:if(h=n.length,h){if(h>s&&(h=s),h>l&&(h=l),h===0)break e;i.set(r.subarray(o,o+h),a),s-=h,o+=h,l-=h,a+=h,n.length-=h;break}n.mode=pl;break;case BR:for(;c<14;){if(s===0)break e;s--,u+=r[o++]<>>=5,c-=5,n.ndist=(u&31)+1,u>>>=5,c-=5,n.ncode=(u&15)+4,u>>>=4,c-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Zn;break}n.have=0,n.mode=zR;case zR:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[N[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,E={bits:n.lenbits},C=sm(tge,n.lens,0,19,n.lencode,0,n.work,E),n.lenbits=E.bits,C){e.msg="invalid code lengths set",n.mode=Zn;break}n.have=0,n.mode=jR;case jR:for(;n.have>>24,y=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=b,c-=b,n.lens[n.have++]=g;else{if(g===16){for(k=b+2;c>>=b,c-=b,n.have===0){e.msg="invalid bit length repeat",n.mode=Zn;break}w=n.lens[n.have-1],h=3+(u&3),u>>>=2,c-=2}else if(g===17){for(k=b+3;c>>=b,c-=b,w=0,h=3+(u&7),u>>>=3,c-=3}else{for(k=b+7;c>>=b,c-=b,w=0,h=11+(u&127),u>>>=7,c-=7}if(n.have+h>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Zn;break}for(;h--;)n.lens[n.have++]=w}}if(n.mode===Zn)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Zn;break}if(n.lenbits=9,E={bits:n.lenbits},C=sm(zj,n.lens,0,n.nlen,n.lencode,0,n.work,E),n.lenbits=E.bits,C){e.msg="invalid literal/lengths set",n.mode=Zn;break}if(n.distbits=6,n.distcode=n.distdyn,E={bits:n.distbits},C=sm(jj,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,E),n.distbits=E.bits,C){e.msg="invalid distances set",n.mode=Zn;break}if(n.mode=zv,t===Bv)break e;case zv:n.mode=jv;case jv:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=c,Qpe(e,f),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,c=n.bits,n.mode===pl&&(n.back=-1);break}for(n.back=0;_=n.lencode[u&(1<>>24,y=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>v)],b=_>>>24,y=_>>>16&255,g=_&65535,!(v+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=v,c-=v,n.back+=v}if(u>>>=b,c-=b,n.back+=b,n.length=g,y===0){n.mode=qR;break}if(y&32){n.back=-1,n.mode=pl;break}if(y&64){e.msg="invalid literal/length code",n.mode=Zn;break}n.extra=y&15,n.mode=UR;case UR:if(n.extra){for(k=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=VR;case VR:for(;_=n.distcode[u&(1<>>24,y=_>>>16&255,g=_&65535,!(b<=c);){if(s===0)break e;s--,u+=r[o++]<>v)],b=_>>>24,y=_>>>16&255,g=_&65535,!(v+b<=c);){if(s===0)break e;s--,u+=r[o++]<>>=v,c-=v,n.back+=v}if(u>>>=b,c-=b,n.back+=b,y&64){e.msg="invalid distance code",n.mode=Zn;break}n.offset=g,n.extra=y&15,n.mode=GR;case GR:if(n.extra){for(k=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Zn;break}n.mode=HR;case HR:if(l===0)break e;if(h=f-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Zn;break}h>n.wnext?(h-=n.wnext,p=n.wsize-h):p=n.wnext-h,h>n.length&&(h=n.length),m=n.window}else m=i,p=a-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[a++]=m[p++];while(--h);n.length===0&&(n.mode=jv);break;case qR:if(l===0)break e;i[a++]=n.length,l--,n.mode=jv;break;case FC:if(n.wrap){for(;c<32;){if(s===0)break e;s--,u|=r[o++]<{if(Xd(e))return Ia;let t=e.state;return t.window&&(t.window=null),e.state=null,Bd},gge=(e,t)=>{if(Xd(e))return Ia;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Bd):Ia},mge=(e,t)=>{const n=t.length;let r,i,o;return Xd(e)||(r=e.state,r.wrap!==0&&r.mode!==$_)?Ia:r.mode===$_&&(i=1,i=b0(i,t,n,0),i!==r.check)?Uj:(o=Xj(e,t,n,n),o?(r.mode=Gj,Vj):(r.havedict=1,Bd))};var yge=Wj,vge=Kj,bge=qj,_ge=dge,Sge=Qj,xge=hge,wge=pge,Cge=gge,Age=mge,Ege="pako inflate (from Nodeca project)",El={inflateReset:yge,inflateReset2:vge,inflateResetKeep:bge,inflateInit:_ge,inflateInit2:Sge,inflate:xge,inflateEnd:wge,inflateGetHeader:Cge,inflateSetDictionary:Age,inflateInfo:Ege};function Tge(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var kge=Tge;const Yj=Object.prototype.toString,{Z_NO_FLUSH:Pge,Z_FINISH:Ige,Z_OK:x0,Z_STREAM_END:jC,Z_NEED_DICT:UC,Z_STREAM_ERROR:Rge,Z_DATA_ERROR:YR,Z_MEM_ERROR:Oge}=Ay;function Ty(e){this.options=B2.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Fj,this.strm.avail_out=0;let n=El.inflateInit2(this.strm,t.windowBits);if(n!==x0)throw new Error(op[n]);if(this.header=new kge,El.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=S0.string2buf(t.dictionary):Yj.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=El.inflateSetDictionary(this.strm,t.dictionary),n!==x0)))throw new Error(op[n])}Ty.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?Ige:Pge,Yj.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=El.inflate(n,a),o===UC&&i&&(o=El.inflateSetDictionary(n,i),o===x0?o=El.inflate(n,a):o===YR&&(o=UC));n.avail_in>0&&o===jC&&n.state.wrap>0&&e[n.next_in]!==0;)El.inflateReset(n),o=El.inflate(n,a);switch(o){case Rge:case YR:case UC:case Oge:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||o===jC))if(this.options.to==="string"){let l=S0.utf8border(n.output,n.next_out),u=n.next_out-l,c=S0.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(c)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===x0&&s===0)){if(o===jC)return o=El.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Ty.prototype.onData=function(e){this.chunks.push(e)};Ty.prototype.onEnd=function(e){e===x0&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=B2.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function fk(e,t){const n=new Ty(t);if(n.push(e),n.err)throw n.msg||op[n.err];return n.result}function Mge(e,t){return t=t||{},t.raw=!0,fk(e,t)}var $ge=Ty,Nge=fk,Dge=Mge,Lge=fk,Fge=Ay,Bge={Inflate:$ge,inflate:Nge,inflateRaw:Dge,ungzip:Lge,constants:Fge};const{Inflate:EHe,inflate:zge,inflateRaw:THe,ungzip:kHe}=Bge;var Zj=zge;const Jj=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;Jj[e]=t}function jge(e){let t=-1;for(let n=0;n>>8;return t^-1}var Jn;(function(e){e[e.GRAYSCALE=0]="GRAYSCALE",e[e.TRUE_COLOR=2]="TRUE_COLOR",e[e.PALETTE=3]="PALETTE",e[e.GRAYSCALE_WITH_ALPHA=4]="GRAYSCALE_WITH_ALPHA",e[e.TRUE_COLOR_WITH_ALPHA=6]="TRUE_COLOR_WITH_ALPHA"})(Jn||(Jn={}));const Uge={[Jn.GRAYSCALE]:1,[Jn.TRUE_COLOR]:3,[Jn.PALETTE]:1,[Jn.GRAYSCALE_WITH_ALPHA]:2,[Jn.TRUE_COLOR_WITH_ALPHA]:4},Vge=1;var Ko;(function(e){e[e.NONE=0]="NONE",e[e.SUB=1]="SUB",e[e.UP=2]="UP",e[e.AVERAGE=3]="AVERAGE",e[e.PAETH=4]="PAETH"})(Ko||(Ko={}));const Gge={[Ko.NONE](e){return e},[Ko.SUB](e,t){const n=new Uint8Array(e.length);for(let r=0;r>1;r[i]=e[i]+s}return r},[Ko.PAETH](e,t,n){const r=new Uint8Array(e.length);for(let i=0;i>7&1,i>>6&1,i>>5&1,i>>4&1,i>>3&1,i>>2&1,i>>1&1,i&1)}else if(t===2){const i=e[r++];n.push(i>>6&3,i>>4&3,i>>2&3,i&3)}else if(t===4){const i=e[r++];n.push(i>>4&15,i&15)}else if(t===8){const i=e[r++];n.push(i)}else if(t===16)n.push(e[r++]<<8|e[r++]);else throw new Error("Unsupported depth: "+t);return n}const tU=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];function qge(e,t,n){if(!e)return[{passWidth:t,passHeight:n,passIndex:0}];const r=[];return tU.forEach(function({x:i,y:o},a){const s=t%8,l=n%8,u=t-s>>3,c=n-l>>3;let d=u*i.length;for(let h=0;h>3||1;let p=0,m=new Uint8Array;for(let _=0;_>3)+Vge,x=u[p];if(!(x in Ko))throw new Error("Unsupported filter type: "+x);const w=Gge[x],C=w(u.slice(p+1,p+S),h,m);m=C;let T=0;const E=Hge(C,o);for(let N=0;N127)if(r>191&&r<224){if(t>=e.length)throw new Error("UTF-8 decode: incomplete 2-byte sequence");r=(r&31)<<6|e[t++]&63}else if(r>223&&r<240){if(t+1>=e.length)throw new Error("UTF-8 decode: incomplete 3-byte sequence");r=(r&15)<<12|(e[t++]&63)<<6|e[t++]&63}else if(r>239&&r<248){if(t+2>=e.length)throw new Error("UTF-8 decode: incomplete 4-byte sequence");r=(r&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63}else throw new Error("UTF-8 decode: unknown multibyte start 0x"+r.toString(16)+" at index "+(t-1));if(r<=65535)n+=String.fromCharCode(r);else if(r<=1114111)r-=65536,n+=String.fromCharCode(r>>10|55296),n+=String.fromCharCode(r&1023|56320);else throw new Error("UTF-8 decode: code point 0x"+r.toString(16)+" exceeds UTF-16 reach")}return n}function Xge(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}const mu=1e5;function Yge(e){const t=new Uint8Array(e);let n=new Uint8Array;const r={width:0,height:0,depth:0,colorType:0,compression:0,interlace:0,filter:0,data:[]};let i=0;function o(){return t[i++]<<24|t[i++]<<16|t[i++]<<8|t[i++]}function a(){return t[i++]<<8|t[i++]}function s(){return t[i++]}function l(){const M=[];let R=0;for(;(R=t[i++])!==0;)M.push(R);return new Uint8Array(M)}function u(M){const R=i+M;let $="";for(;i=0&&ZR.call(t.callee)==="[object Function]"),r},HC,JR;function tme(){if(JR)return HC;JR=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=rU,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},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},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",m=n.call(h)==="[object Function]",_=r(h),b=p&&n.call(h)==="[object String]",y=[];if(!p&&!m&&!_)throw new TypeError("Object.keys called on a non-object");var g=a&&m;if(b&&h.length>0&&!t.call(h,0))for(var v=0;v0)for(var S=0;S"u"||!oi?Nt:oi(Uint8Array),wd={"%AggregateError%":typeof AggregateError>"u"?Nt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Nt:ArrayBuffer,"%ArrayIteratorPrototype%":vf&&oi?oi([][Symbol.iterator]()):Nt,"%AsyncFromSyncIteratorPrototype%":Nt,"%AsyncFunction%":Mf,"%AsyncGenerator%":Mf,"%AsyncGeneratorFunction%":Mf,"%AsyncIteratorPrototype%":Mf,"%Atomics%":typeof Atomics>"u"?Nt:Atomics,"%BigInt%":typeof BigInt>"u"?Nt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Nt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Nt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Nt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Nt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Nt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Nt:FinalizationRegistry,"%Function%":oU,"%GeneratorFunction%":Mf,"%Int8Array%":typeof Int8Array>"u"?Nt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Nt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Nt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vf&&oi?oi(oi([][Symbol.iterator]())):Nt,"%JSON%":typeof JSON=="object"?JSON:Nt,"%Map%":typeof Map>"u"?Nt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vf||!oi?Nt:oi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Nt:Promise,"%Proxy%":typeof Proxy>"u"?Nt:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Nt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Nt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vf||!oi?Nt:oi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Nt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vf&&oi?oi(""[Symbol.iterator]()):Nt,"%Symbol%":vf?Symbol:Nt,"%SyntaxError%":lp,"%ThrowTypeError%":yme,"%TypedArray%":bme,"%TypeError%":wh,"%Uint8Array%":typeof Uint8Array>"u"?Nt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Nt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Nt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Nt:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Nt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Nt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Nt:WeakSet};if(oi)try{null.error}catch(e){var _me=oi(oi(e));wd["%Error.prototype%"]=_me}var Sme=function e(t){var n;if(t==="%AsyncFunction%")n=WC("async function () {}");else if(t==="%GeneratorFunction%")n=WC("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=WC("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&oi&&(n=oi(i.prototype))}return wd[t]=n,n},i9={"%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"]},ky=iU,N_=mme,xme=ky.call(Function.call,Array.prototype.concat),wme=ky.call(Function.apply,Array.prototype.splice),o9=ky.call(Function.call,String.prototype.replace),D_=ky.call(Function.call,String.prototype.slice),Cme=ky.call(Function.call,RegExp.prototype.exec),Ame=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Eme=/\\(\\)?/g,Tme=function(t){var n=D_(t,0,1),r=D_(t,-1);if(n==="%"&&r!=="%")throw new lp("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new lp("invalid intrinsic syntax, expected opening `%`");var i=[];return o9(t,Ame,function(o,a,s,l){i[i.length]=s?o9(l,Eme,"$1"):a||o}),i},kme=function(t,n){var r=t,i;if(N_(i9,r)&&(i=i9[r],r="%"+i[0]+"%"),N_(wd,r)){var o=wd[r];if(o===Mf&&(o=Sme(r)),typeof o>"u"&&!n)throw new wh("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new lp("intrinsic "+t+" does not exist!")},Pme=function(t,n){if(typeof t!="string"||t.length===0)throw new wh("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new wh('"allowMissing" argument must be a boolean');if(Cme(/^%?[^%]*%?$/,t)===null)throw new lp("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Tme(t),i=r.length>0?r[0]:"",o=kme("%"+i+"%",n),a=o.name,s=o.value,l=!1,u=o.alias;u&&(i=u[0],wme(r,xme([0,1],u)));for(var c=1,d=!0;c=r.length){var m=xd(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=N_(s,f),s=s[f];d&&!l&&(wd[a]=s)}}return s},Ime=Pme,LA=Ime("%Object.defineProperty%",!0),FA=function(){if(LA)try{return LA({},"a",{value:1}),!0}catch{return!1}return!1};FA.hasArrayLengthDefineBug=function(){if(!FA())return null;try{return LA([],"length",{value:1}).length!==1}catch{return!0}};var Rme=FA,Ome=ime,Mme=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",$me=Object.prototype.toString,Nme=Array.prototype.concat,aU=Object.defineProperty,Dme=function(e){return typeof e=="function"&&$me.call(e)==="[object Function]"},Lme=Rme(),sU=aU&&Lme,Fme=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!Dme(r)||!r())return}sU?aU(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},lU=function(e,t){var n=arguments.length>2?arguments[2]:{},r=Ome(t);Mme&&(r=Nme.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))}};K2.testComparisonRange=o0e;var Q2={};Object.defineProperty(Q2,"__esModule",{value:!0});Q2.testRange=void 0;var a0e=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};Q2.testRange=a0e;(function(e){var t=yt&&yt.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,u0e.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};X2.highlight=d0e;var Y2={},gU={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(yt,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=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+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,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 c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+m)),d=m}},a.prototype.getSymbolDisplay=function(u){return s(u)},a.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},a.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},a.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},a.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},a.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==a.fail&&u.push(f)}),u.map(function(f){return f.data})};function s(u){var c=typeof u;if(c==="string")return u;if(c==="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 c=typeof u;if(c==="string")return u;if(c==="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:a,Grammar:i,Rule:t}})})(gU);var f0e=gU.exports,zd={},mU={},Ic={};Ic.__esModule=void 0;Ic.__esModule=!0;var h0e=typeof Object.setPrototypeOf=="function",p0e=typeof Object.getPrototypeOf=="function",g0e=typeof Object.defineProperty=="function",m0e=typeof Object.create=="function",y0e=typeof Object.prototype.hasOwnProperty=="function",v0e=function(t,n){h0e?Object.setPrototypeOf(t,n):t.__proto__=n};Ic.setPrototypeOf=v0e;var b0e=function(t){return p0e?Object.getPrototypeOf(t):t.__proto__||t.prototype};Ic.getPrototypeOf=b0e;var a9=!1,_0e=function e(t,n,r){if(g0e&&!a9)try{Object.defineProperty(t,n,r)}catch{a9=!0,e(t,n,r)}else t[n]=r.value};Ic.defineProperty=_0e;var yU=function(t,n){return y0e?t.hasOwnProperty(t,n):t[n]===void 0};Ic.hasOwnProperty=yU;var S0e=function(t,n){if(m0e)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)yU(n,o)&&(i[o]=n[o].value);return i};Ic.objectCreate=S0e;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=Ic,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,a=new Error().toString()==="[object Error]",s="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?s||"Error":_[1]}(),f=d==="Error",h=f?s:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var m=new Error(u);m.name=p.name,p.stack=m.stack}return a&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}s=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(mU);var vU=yt&&yt.__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(zd,"__esModule",{value:!0});zd.SyntaxError=zd.LiqeError=void 0;var x0e=mU,bU=function(e){vU(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(x0e.ExtendableError);zd.LiqeError=bU;var w0e=function(e){vU(t,e);function t(n,r,i,o){var a=e.call(this,n)||this;return a.message=n,a.offset=r,a.line=i,a.column=o,a}return t}(bU);zd.SyntaxError=w0e;var mk={},L_=yt&&yt.__assign||function(){return L_=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:gl},{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"};mk.default=C0e;var _U={},Z2={},Ry={};Object.defineProperty(Ry,"__esModule",{value:!0});Ry.isSafePath=void 0;var A0e=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,E0e=function(e){return A0e.test(e)};Ry.isSafePath=E0e;Object.defineProperty(Z2,"__esModule",{value:!0});Z2.createGetValueFunctionBody=void 0;var T0e=Ry,k0e=function(e){if(!(0,T0e.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};Z2.createGetValueFunctionBody=k0e;(function(e){var t=yt&&yt.__assign||function(){return t=Object.assign||function(o){for(var a,s=1,l=arguments.length;s\d+) col (?\d+)/,$0e=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new xU.default.Parser(O0e),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(M0e);throw r?new P0e.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,R0e.hydrateAst)(n[0]);return i};Y2.parse=$0e;var J2={};Object.defineProperty(J2,"__esModule",{value:!0});J2.test=void 0;var N0e=Py,D0e=function(e,t){return(0,N0e.filter)(e,[t]).length===1};J2.test=D0e;var wU={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,a){return a==="double"?'"'.concat(o,'"'):a==="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 a=o.range,s=a.min,l=a.max,u=a.minInclusive,c=a.maxInclusive;return"".concat(u?"[":"{").concat(s," TO ").concat(l).concat(c?"]":"}")}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 a=o.field,s=o.expression,l=o.operator;if(a.type==="ImplicitField")return n(s);var u=a.quoted?t(a.name,a.quotes):a.name,c=" ".repeat(s.location.start-l.location.end);return u+l.operator+c+n(s)},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 a=" ".repeat(o.expression.location.start-(o.location.start+1)),s=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(a).concat((0,e.serialize)(o.expression)).concat(s,")")}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})(wU);var ex={};Object.defineProperty(ex,"__esModule",{value:!0});ex.isSafeUnquotedExpression=void 0;var L0e=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};ex.isSafeUnquotedExpression=L0e;(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=Py;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=X2;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=Y2;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=J2;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=zd;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var a=wU;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return a.serialize}});var s=ex;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return s.isSafeUnquotedExpression}})})(pU);var Oy={},CU={},jd={};Object.defineProperty(jd,"__esModule",{value:!0});jd.ROARR_LOG_FORMAT_VERSION=jd.ROARR_VERSION=void 0;jd.ROARR_VERSION="5.0.0";jd.ROARR_LOG_FORMAT_VERSION="2.0.0";var My={};Object.defineProperty(My,"__esModule",{value:!0});My.logLevels=void 0;My.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var AU={},tx={};Object.defineProperty(tx,"__esModule",{value:!0});tx.hasOwnProperty=void 0;const F0e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);tx.hasOwnProperty=F0e;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=tx;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(AU);var EU={},nx={},rx={};Object.defineProperty(rx,"__esModule",{value:!0});rx.tokenize=void 0;const B0e=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,z0e=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=B0e.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const a=t[0];i=t.index+a.length,a==="\\%"||a==="%%"?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:a,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};rx.tokenize=z0e;Object.defineProperty(nx,"__esModule",{value:!0});nx.createPrintf=void 0;const s9=hk,j0e=rx,U0e=(e,t)=>t.placeholder,V0e=e=>{var t;const n=(o,a,s)=>s==="-"?o.padEnd(a," "):s==="-+"?((Number(o)>=0?"+":"")+o).padEnd(a," "):s==="+"?((Number(o)>=0?"+":"")+o).padStart(a," "):s==="0"?o.padStart(a,"0"):o.padStart(a," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:U0e,i={};return(o,...a)=>{let s=i[o];s||(s=i[o]=j0e.tokenize(o));let l="";for(const u of s)if(u.type==="literal")l+=u.literal;else{let c=a[u.position];if(c===void 0)l+=r(o,u,a);else if(u.conversion==="b")l+=s9.boolean(c)?"true":"false";else if(u.conversion==="B")l+=s9.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};nx.createPrintf=V0e;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=nx;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(EU);var BA={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(b){return b.length<5e3&&!i.test(b)?`"${b}"`:JSON.stringify(b)}function a(b){if(b.length>200)return b.sort();for(let y=1;yg;)b[v]=b[v-1],v--;b[v]=g}return b}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(b){return s.call(b)!==void 0&&b.length!==0}function u(b,y,g){b.length= 1`)}return g===void 0?1/0:g}function h(b){return b===1?"1 item":`${b} items`}function p(b){const y=new Set;for(const g of b)(typeof g=="string"||typeof g=="number")&&y.add(String(g));return y}function m(b){if(n.call(b,"strict")){const y=b.strict;if(typeof y!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(y)return g=>{let v=`Object can not safely be stringified. Received type ${typeof g}`;throw typeof g!="function"&&(v+=` (${g.toString()})`),new Error(v)}}}function _(b){b={...b};const y=m(b);y&&(b.bigint===void 0&&(b.bigint=!1),"circularValue"in b||(b.circularValue=Error));const g=c(b),v=d(b,"bigint"),S=d(b,"deterministic"),x=f(b,"maximumDepth"),w=f(b,"maximumBreadth");function C(O,A,P,D,L,M){let R=A[O];switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(O)),R=D.call(A,O,R),typeof R){case"string":return o(R);case"object":{if(R===null)return"null";if(P.indexOf(R)!==-1)return g;let $="",B=",";const U=M;if(Array.isArray(R)){if(R.length===0)return"[]";if(xw){const Se=R.length-w-1;$+=`${B}"... ${h(Se)} not stringified"`}return L!==""&&($+=` ${U}`),P.pop(),`[${$}]`}let G=Object.keys(R);const Y=G.length;if(Y===0)return"{}";if(xw){const Q=Y-w;$+=`${J}"...":${ee}"${h(Q)} not stringified"`,J=B}return L!==""&&J.length>1&&($=` ${M}${$} ${U}`),P.pop(),`{${$}}`}case"number":return isFinite(R)?String(R):y?y(R):"null";case"boolean":return R===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(R);default:return y?y(R):void 0}}function T(O,A,P,D,L,M){switch(typeof A=="object"&&A!==null&&typeof A.toJSON=="function"&&(A=A.toJSON(O)),typeof A){case"string":return o(A);case"object":{if(A===null)return"null";if(P.indexOf(A)!==-1)return g;const R=M;let $="",B=",";if(Array.isArray(A)){if(A.length===0)return"[]";if(xw){const j=A.length-w-1;$+=`${B}"... ${h(j)} not stringified"`}return L!==""&&($+=` ${R}`),P.pop(),`[${$}]`}P.push(A);let U="";L!==""&&(M+=L,B=`, ${M}`,U=" ");let G="";for(const Y of D){const ee=T(Y,A[Y],P,D,L,M);ee!==void 0&&($+=`${G}${o(Y)}:${U}${ee}`,G=B)}return L!==""&&G.length>1&&($=` ${M}${$} ${R}`),P.pop(),`{${$}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(A);default:return y?y(A):void 0}}function E(O,A,P,D,L){switch(typeof A){case"string":return o(A);case"object":{if(A===null)return"null";if(typeof A.toJSON=="function"){if(A=A.toJSON(O),typeof A!="object")return E(O,A,P,D,L);if(A===null)return"null"}if(P.indexOf(A)!==-1)return g;const M=L;if(Array.isArray(A)){if(A.length===0)return"[]";if(xw){const se=A.length-w-1;ee+=`${J}"... ${h(se)} not stringified"`}return ee+=` ${M}`,P.pop(),`[${ee}]`}let R=Object.keys(A);const $=R.length;if($===0)return"{}";if(xw){const ee=$-w;U+=`${G}"...": "${h(ee)} not stringified"`,G=B}return G!==""&&(U=` ${L}${U} ${M}`),P.pop(),`{${U}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(A);default:return y?y(A):void 0}}function k(O,A,P){switch(typeof A){case"string":return o(A);case"object":{if(A===null)return"null";if(typeof A.toJSON=="function"){if(A=A.toJSON(O),typeof A!="object")return k(O,A,P);if(A===null)return"null"}if(P.indexOf(A)!==-1)return g;let D="";if(Array.isArray(A)){if(A.length===0)return"[]";if(xw){const Y=A.length-w-1;D+=`,"... ${h(Y)} not stringified"`}return P.pop(),`[${D}]`}let L=Object.keys(A);const M=L.length;if(M===0)return"{}";if(xw){const B=M-w;D+=`${R}"...":"${h(B)} not stringified"`}return P.pop(),`{${D}}`}case"number":return isFinite(A)?String(A):y?y(A):"null";case"boolean":return A===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(A);default:return y?y(A):void 0}}function N(O,A,P){if(arguments.length>1){let D="";if(typeof P=="number"?D=" ".repeat(Math.min(P,10)):typeof P=="string"&&(D=P.slice(0,10)),A!=null){if(typeof A=="function")return C("",{"":O},[],A,D,"");if(Array.isArray(A))return T("",O,[],p(A),D,"")}if(D.length!==0)return E("",O,[],D,"")}return k("",O,[])}return N}})(BA,BA.exports);var G0e=BA.exports;(function(e){var t=yt&&yt.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=jd,r=My,i=AU,o=EU,a=t(pk),s=t(G0e);let l=!1;const u=(0,a.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const g=c().asyncLocalStorage;if(!g)throw new Error("AsyncLocalContext is unavailable.");const v=g.getStore();return v||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const g=f();return(0,i.hasOwnProperty)(g,"sequenceRoot")&&(0,i.hasOwnProperty)(g,"sequence")&&typeof g.sequence=="number"?String(g.sequenceRoot)+"."+String(g.sequence++):String(c().sequence++)}return String(c().sequence++)},m=(g,v)=>(S,x,w,C,T,E,k,N,O,A)=>{g.child({logLevel:v})(S,x,w,C,T,E,k,N,O,A)},_=1e3,b=(g,v)=>(S,x,w,C,T,E,k,N,O,A)=>{const P=(0,s.default)({a:S,b:x,c:w,d:C,e:T,f:E,g:k,h:N,i:O,j:A,logLevel:v});if(!P)throw new Error("Expected key to be a string");const D=c().onceLog;D.has(P)||(D.add(P),D.size>_&&D.clear(),g.child({logLevel:v})(S,x,w,C,T,E,k,N,O,A))},y=(g,v={},S=[])=>{const x=(w,C,T,E,k,N,O,A,P,D)=>{const L=Date.now(),M=p();let R;h()?R=f():R=d();let $,B;if(typeof w=="string"?$={...R.messageContext,...v}:$={...R.messageContext,...v,...w},typeof w=="string"&&C===void 0)B=w;else if(typeof w=="string"){if(!w.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.");B=(0,o.printf)(w,C,T,E,k,N,O,A,P,D)}else{let G=C;if(typeof C!="string")if(C===void 0)G="";else throw new TypeError("Message must be a string. Received "+typeof C+".");B=(0,o.printf)(G,T,E,k,N,O,A,P,D)}let U={context:$,message:B,sequence:M,time:L,version:n.ROARR_LOG_FORMAT_VERSION};for(const G of[...R.transforms,...S])if(U=G(U),typeof U!="object"||U===null)throw new Error("Message transform function must return a message object.");g(U)};return x.child=w=>{let C;return h()?C=f():C=d(),typeof w=="function"?(0,e.createLogger)(g,{...C.messageContext,...v,...w},[w,...S]):(0,e.createLogger)(g,{...C.messageContext,...v,...w},S)},x.getContext=()=>{let w;return h()?w=f():w=d(),{...w.messageContext,...v}},x.adopt=async(w,C)=>{if(!h())return l===!1&&(l=!0,g({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),w();const T=f();let E;(0,i.hasOwnProperty)(T,"sequenceRoot")&&(0,i.hasOwnProperty)(T,"sequence")&&typeof T.sequence=="number"?E=T.sequenceRoot+"."+String(T.sequence++):E=String(c().sequence++);let k={...T.messageContext};const N=[...T.transforms];typeof C=="function"?N.push(C):k={...k,...C};const O=c().asyncLocalStorage;if(!O)throw new Error("Async local context unavailable.");return O.run({messageContext:k,sequence:0,sequenceRoot:E,transforms:N},()=>w())},x.debug=m(x,r.logLevels.debug),x.debugOnce=b(x,r.logLevels.debug),x.error=m(x,r.logLevels.error),x.errorOnce=b(x,r.logLevels.error),x.fatal=m(x,r.logLevels.fatal),x.fatalOnce=b(x,r.logLevels.fatal),x.info=m(x,r.logLevels.info),x.infoOnce=b(x,r.logLevels.info),x.trace=m(x,r.logLevels.trace),x.traceOnce=b(x,r.logLevels.trace),x.warn=m(x,r.logLevels.warn),x.warnOnce=b(x,r.logLevels.warn),x};e.createLogger=y})(CU);var ix={},H0e=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(i[o]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0},q0e=yt&&yt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ix,"__esModule",{value:!0});ix.createRoarrInitialGlobalStateBrowser=void 0;const l9=jd,u9=q0e(H0e),W0e=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(u9.default),t.includes(l9.ROARR_VERSION)||t.push(l9.ROARR_VERSION),t.sort(u9.default),{sequence:0,...e,versions:t}};ix.createRoarrInitialGlobalStateBrowser=W0e;var ox={};Object.defineProperty(ox,"__esModule",{value:!0});ox.getLogLevelName=void 0;const K0e=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";ox.getLogLevelName=K0e;(function(e){var t=yt&&yt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=CU,r=ix,o=(0,t(pk).default)(),a=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=a,o.ROARR=a;const s=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;a.write&&a.write(((f=a.serializeMessage)!==null&&f!==void 0?f:s)(d))});e.Roarr=l;var u=My;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=ox;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(Oy);var Q0e=yt&&yt.__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?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message," %O"),m,_,b,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message),m,_,b)}}};j2.createLogWriter=iye;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=j2;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(nU);Oy.ROARR.write=nU.createLogWriter();const kU={};Oy.Roarr.child(kU);const ax=sl(Oy.Roarr.child(kU)),be=e=>ax.get().child({namespace:e}),PHe=["trace","debug","info","warn","error","fatal"],IHe={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Xt=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},oye=async e=>{const t={},n=await e.arrayBuffer(),r=Yge(n).text,i=vh(r,"invokeai_metadata");if(i){const a=dj.safeParse(JSON.parse(i));a.success?t.metadata=a.data:be("system").error({error:Xt(a.error)},"Problem reading metadata from image")}const o=vh(r,"invokeai_workflow");if(o){const a=mj.safeParse(JSON.parse(o));a.success?t.workflow=a.data:be("system").error({error:Xt(a.error)},"Problem reading workflow from image")}return t},xe=gs.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 Vn.addMany(Vn.getInitialState(),n)},merge:(t,n)=>{Vn.addMany(t,d0.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;d0.selectAll(i).forEach(o=>{n(xe.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}),getImageMetadataFromFile:e.query({queryFn:async(t,n,r,i)=>{var o;if(t.shouldFetchMetadataFromApi){let a;const s=await i(`images/i/${t.image.image_name}/metadata`);if(s.data){const l=dj.safeParse((o=s.data)==null?void 0:o.metadata);l.success&&(a=l.data)}return{data:{metadata:a}}}else{const a=rp.get(),s=c0.get(),u=await jde.fetchBaseQuery({baseUrl:"",prepareHeaders:d=>(a&&d.set("Authorization",`Bearer ${a}`),s&&d.set("project-id",s),d),responseHandler:async d=>await d.blob()})(t.image.image_url,n,r);return{data:await oye(u.data)}}},providesTags:(t,n,{image:r})=>[{type:"ImageMetadataFromFile",id:r.image_name}],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"}),async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,a=to.includes(t.image_category),s={board_id:o??"none",categories:da(t)},l=[];l.push(n(xe.util.updateQueryData("listImages",s,u=>{Vn.removeOne(u,i)}))),l.push(n(Lt.util.updateQueryData(a?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",u=>{u.total=Math.max(u.total-1,0)})));try{await r}catch{l.forEach(u=>{u.undo()})}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=I4(t,"image_name");i.deleted_images.forEach(a=>{const s=o[a];if(s){const l={board_id:s.board_id??"none",categories:da(s)};n(xe.util.updateQueryData("listImages",l,c=>{Vn.removeOne(c,a)}));const u=to.includes(s.image_category);n(Lt.util.updateQueryData(u?"getBoardAssetsTotal":"getBoardImagesTotal",s.board_id??"none",c=>{c.total=Math.max(c.total-1,0)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[];a.push(r(xe.util.updateQueryData("getImageDTO",t.image_name,u=>{Object.assign(u,{is_intermediate:n})})));const s=da(t),l=to.includes(t.image_category);if(n)a.push(r(xe.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:s},u=>{Vn.removeOne(u,t.image_name)}))),a.push(r(Lt.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",u=>{u.total=Math.max(u.total-1,0)})));else{a.push(r(Lt.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",p=>{p.total+=1})));const u={board_id:t.board_id??"none",categories:s},c=xe.endpoints.listImages.select(u)(o()),{data:d}=ii.includes(t.image_category)?Lt.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):Lt.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),f=c.data&&c.data.ids.length>=((d==null?void 0:d.total)??0),h=Fc(c.data,t);(f||h)&&a.push(r(xe.util.updateQueryData("listImages",u,p=>{Vn.upsertOne(p,t)})))}try{await i}catch{a.forEach(u=>u.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(xe.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{o.forEach(a=>a.undo())}}}),starImages:e.mutation({query:({imageDTOs:t})=>({url:"images/star",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=da(r[0]),o=r[0].board_id;return[{type:"ImageList",id:jo({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=da(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(xe.util.updateQueryData("getImageDTO",c,_=>{_.starred=!0}));const d={board_id:l??"none",categories:s},f=xe.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?Lt.endpoints.getBoardImagesTotal.select(l??"none")(i()):Lt.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=Pv?Fc(f.data,u):!0;(p||m)&&n(xe.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!0})}))})}catch{}}}),unstarImages:e.mutation({query:({imageDTOs:t})=>({url:"images/unstar",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=da(r[0]),o=r[0].board_id;return[{type:"ImageList",id:jo({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=da(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(xe.util.updateQueryData("getImageDTO",c,_=>{_.starred=!1}));const d={board_id:l??"none",categories:s},f=xe.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(u.image_category)?Lt.endpoints.getBoardImagesTotal.select(l??"none")(i()):Lt.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=Pv?Fc(f.data,u):!0;(p||m)&&n(xe.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:a})=>{const s=new FormData;return s.append("file",t),{url:"images/upload",method:"POST",body:s,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:a}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(xe.util.upsertQueryData("getImageDTO",i.image_name,i));const o=da(i);n(xe.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},a=>{Vn.addOne(a,i)})),n(Lt.util.updateQueryData("getBoardAssetsTotal",i.board_id??"none",a=>{a.total+=1}))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:no},{type:"ImageList",id:jo({board_id:"none",categories:ii})},{type:"ImageList",id:jo({board_id:"none",categories:to})}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(xe.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))}),n(Lt.util.updateQueryData("getBoardAssetsTotal",t,l=>{l.total=0})),n(Lt.util.updateQueryData("getBoardImagesTotal",t,l=>{l.total=0}));const a=[{categories:ii},{categories:to}],s=o.map(l=>({id:l,changes:{board_id:void 0}}));a.forEach(l=>{n(xe.util.updateQueryData("listImages",l,u=>{Vn.updateMany(u,s)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:no},{type:"ImageList",id:jo({board_id:"none",categories:ii})},{type:"ImageList",id:jo({board_id:"none",categories:to})}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:ii},{categories:to}].forEach(s=>{n(xe.util.updateQueryData("listImages",s,l=>{Vn.removeMany(l,o)}))}),n(Lt.util.updateQueryData("getBoardAssetsTotal",t,s=>{s.total=0})),n(Lt.util.updateQueryData("getBoardImagesTotal",t,s=>{s.total=0}))}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})=>[{type:"Board",id:r}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[],s=da(n),l=to.includes(n.image_category);if(a.push(r(xe.util.updateQueryData("getImageDTO",n.image_name,u=>{u.board_id=t}))),!n.is_intermediate){a.push(r(xe.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:s},p=>{Vn.removeOne(p,n.image_name)}))),a.push(r(Lt.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",n.board_id??"none",p=>{p.total=Math.max(p.total-1,0)}))),a.push(r(Lt.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t??"none",p=>{p.total+=1})));const u={board_id:t??"none",categories:s},c=xe.endpoints.listImages.select(u)(o()),{data:d}=ii.includes(n.image_category)?Lt.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):Lt.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),f=c.data&&c.data.ids.length>=((d==null?void 0:d.total)??0),h=Fc(c.data,n);(f||h)&&a.push(r(xe.util.updateQueryData("listImages",u,p=>{Vn.addOne(p,n)})))}try{await i}catch{a.forEach(u=>u.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"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=da(t),a=[],s=to.includes(t.image_category);a.push(n(xe.util.updateQueryData("getImageDTO",t.image_name,h=>{h.board_id=void 0}))),a.push(n(xe.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},h=>{Vn.removeOne(h,t.image_name)}))),a.push(n(Lt.util.updateQueryData(s?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",h=>{h.total=Math.max(h.total-1,0)}))),a.push(n(Lt.util.updateQueryData(s?"getBoardAssetsTotal":"getBoardImagesTotal","none",h=>{h.total+=1})));const l={board_id:"none",categories:o},u=xe.endpoints.listImages.select(l)(i()),{data:c}=ii.includes(t.image_category)?Lt.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):Lt.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),d=u.data&&u.data.ids.length>=((c==null?void 0:c.total)??0),f=Fc(u.data,t);(d||f)&&a.push(n(xe.util.updateQueryData("listImages",l,h=>{Vn.upsertOne(h,t)})));try{await r}catch{a.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,{board_id:r})=>[{type:"Board",id:r??"none"}],async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:a}=await i,{added_image_names:s}=a;s.forEach(l=>{r(xe.util.updateQueryData("getImageDTO",l,y=>{y.board_id=t==="none"?void 0:t}));const u=n.find(y=>y.image_name===l);if(!u)return;const c=da(u),d=u.board_id,f=to.includes(u.image_category);r(xe.util.updateQueryData("listImages",{board_id:d??"none",categories:c},y=>{Vn.removeOne(y,u.image_name)})),r(Lt.util.updateQueryData(f?"getBoardAssetsTotal":"getBoardImagesTotal",d??"none",y=>{y.total=Math.max(y.total-1,0)})),r(Lt.util.updateQueryData(f?"getBoardAssetsTotal":"getBoardImagesTotal",t??"none",y=>{y.total+=1}));const h={board_id:t,categories:c},p=xe.endpoints.listImages.select(h)(o()),{data:m}=ii.includes(u.image_category)?Lt.endpoints.getBoardImagesTotal.select(t??"none")(o()):Lt.endpoints.getBoardAssetsTotal.select(t??"none")(o()),_=p.data&&p.data.ids.length>=((m==null?void 0:m.total)??0),b=((m==null?void 0:m.total)??0)>=Pv?Fc(p.data,u):!0;(_||b)&&r(xe.util.updateQueryData("listImages",h,y=>{Vn.upsertOne(y,{...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=[];return t==null||t.removed_image_names.forEach(a=>{var l;const s=(l=r.find(u=>u.image_name===a))==null?void 0:l.board_id;!s||i.includes(s)||o.push({type:"Board",id:s})}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:a}=o;a.forEach(s=>{n(xe.util.updateQueryData("getImageDTO",s,_=>{_.board_id=void 0}));const l=t.find(_=>_.image_name===s);if(!l)return;const u=da(l),c=to.includes(l.image_category);n(xe.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},_=>{Vn.removeOne(_,l.image_name)})),n(Lt.util.updateQueryData(c?"getBoardAssetsTotal":"getBoardImagesTotal",l.board_id??"none",_=>{_.total=Math.max(_.total-1,0)})),n(Lt.util.updateQueryData(c?"getBoardAssetsTotal":"getBoardImagesTotal","none",_=>{_.total+=1}));const d={board_id:"none",categories:u},f=xe.endpoints.listImages.select(d)(i()),{data:h}=ii.includes(l.image_category)?Lt.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):Lt.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=Pv?Fc(f.data,l):!0;(p||m)&&n(xe.util.updateQueryData("listImages",d,_=>{Vn.upsertOne(_,{...l,board_id:"none"})}))})}catch{}}}),bulkDownloadImages:e.mutation({query:({image_names:t,board_id:n})=>({url:"images/download",method:"POST",body:{image_names:t,board_id:n}})})})}),{useGetIntermediatesCountQuery:RHe,useListImagesQuery:OHe,useLazyListImagesQuery:MHe,useGetImageDTOQuery:$He,useGetImageMetadataQuery:NHe,useDeleteImageMutation:DHe,useDeleteImagesMutation:LHe,useUploadImageMutation:FHe,useClearIntermediatesMutation:BHe,useAddImagesToBoardMutation:zHe,useRemoveImagesFromBoardMutation:jHe,useAddImageToBoardMutation:UHe,useRemoveImageFromBoardMutation:VHe,useChangeImageIsIntermediateMutation:GHe,useChangeImageSessionIdMutation:HHe,useDeleteBoardAndImagesMutation:qHe,useDeleteBoardMutation:WHe,useStarImagesMutation:KHe,useUnstarImagesMutation:QHe,useGetImageMetadataFromFileQuery:XHe,useBulkDownloadImagesMutation:YHe}=xe,PU={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},IU=nr({name:"gallery",initialState:PU,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=yA(t.payload,n=>n.image_name)},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.boardId,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(sye,(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(Lt.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:Qs,shouldAutoSwitchChanged:ZHe,autoAssignBoardOnClickChanged:JHe,setGalleryImageMinimumWidth:eqe,boardIdSelected:F_,autoAddBoardIdChanged:tqe,galleryViewChanged:zA,selectionChanged:RU,boardSearchTextChanged:nqe}=IU.actions,aye=IU.reducer,sye=Qi(xe.endpoints.deleteBoard.matchFulfilled,xe.endpoints.deleteBoardAndImages.matchFulfilled),d9={weight:.75},lye={loras:{}},OU=nr({name:"lora",initialState:lye,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,...d9}},loraRecalled:(e,t)=>{const{model_name:n,id:r,base_model:i,weight:o}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,weight:o}},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=d9.weight)}}}),{loraAdded:rqe,loraRemoved:MU,loraWeightChanged:iqe,loraWeightReset:oqe,lorasCleared:aqe,loraRecalled:sqe}=OU.actions,uye=OU.reducer;function Ma(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 c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,s),s},cye=e=>e?f9(e):f9,{useSyncExternalStoreWithSelector:dye}=kce;function $U(e,t=e.getState,n){const r=dye(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return I.useDebugValue(r),r}const h9=(e,t)=>{const n=cye(e),r=(i,o=t)=>$U(n,i,o);return Object.assign(r,n),r},fye=(e,t)=>e?h9(e,t):h9;function No(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 sx(){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}})}J1.prototype=sx.prototype={constructor:J1,on:function(e,t){var n=this._,r=pye(e+"",n),i,o=-1,a=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)),g9.hasOwnProperty(t)?{space:g9[t],local:e}:e}function mye(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===jA&&t.documentElement.namespaceURI===jA?t.createElement(e):t.createElementNS(n,e)}}function yye(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function NU(e){var t=lx(e);return(t.local?yye:mye)(t)}function vye(){}function yk(e){return e==null?vye:function(){return this.querySelector(e)}}function bye(e){typeof e!="function"&&(e=yk(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=y+1);!(S=_[g])&&++g=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function Gye(e){e||(e=Hye);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function qye(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Wye(){return Array.from(this)}function Kye(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ove:typeof t=="function"?sve:ave)(e,t,n??"")):up(this.node(),e)}function up(e,t){return e.style.getPropertyValue(t)||zU(e).getComputedStyle(e,null).getPropertyValue(t)}function uve(e){return function(){delete this[e]}}function cve(e,t){return function(){this[e]=t}}function dve(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fve(e,t){return arguments.length>1?this.each((t==null?uve:typeof t=="function"?dve:cve)(e,t)):this.node()[e]}function jU(e){return e.trim().split(/^|\s+/)}function vk(e){return e.classList||new UU(e)}function UU(e){this._node=e,this._names=jU(e.getAttribute("class")||"")}UU.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 VU(e,t){for(var n=vk(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function zve(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function UA(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:u,dispatch:c}){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:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}UA.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Xve(e){return!e.ctrlKey&&!e.button}function Yve(){return this.parentNode}function Zve(e,t){return t??{x:e.x,y:e.y}}function Jve(){return navigator.maxTouchPoints||"ontouchstart"in this}function e1e(){var e=Xve,t=Yve,n=Zve,r=Jve,i={},o=sx("start","drag","end"),a=0,s,l,u,c,d=0;function f(v){v.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",b,Qve).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,S){if(!(c||!e.call(this,v,S))){var x=g(this,t.call(this,v,S),v,S,"mouse");x&&(es(v.view).on("mousemove.drag",p,w0).on("mouseup.drag",m,w0),WU(v.view),XC(v),u=!1,s=v.clientX,l=v.clientY,x("start",v))}}function p(v){if(Ch(v),!u){var S=v.clientX-s,x=v.clientY-l;u=S*S+x*x>d}i.mouse("drag",v)}function m(v){es(v.view).on("mousemove.drag mouseup.drag",null),KU(v.view,u),Ch(v),i.mouse("end",v)}function _(v,S){if(e.call(this,v,S)){var x=v.changedTouches,w=t.call(this,v,S),C=x.length,T,E;for(T=0;T>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Vv(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Vv(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=n1e.exec(e))?new ko(t[1],t[2],t[3],1):(t=r1e.exec(e))?new ko(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=i1e.exec(e))?Vv(t[1],t[2],t[3],t[4]):(t=o1e.exec(e))?Vv(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=a1e.exec(e))?x9(t[1],t[2]/100,t[3]/100,1):(t=s1e.exec(e))?x9(t[1],t[2]/100,t[3]/100,t[4]):m9.hasOwnProperty(e)?b9(m9[e]):e==="transparent"?new ko(NaN,NaN,NaN,0):null}function b9(e){return new ko(e>>16&255,e>>8&255,e&255,1)}function Vv(e,t,n,r){return r<=0&&(e=t=n=NaN),new ko(e,t,n,r)}function c1e(e){return e instanceof Ny||(e=E0(e)),e?(e=e.rgb(),new ko(e.r,e.g,e.b,e.opacity)):new ko}function VA(e,t,n,r){return arguments.length===1?c1e(e):new ko(e,t,n,r??1)}function ko(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}bk(ko,VA,QU(Ny,{brighter(e){return e=e==null?z_:Math.pow(z_,e),new ko(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?C0:Math.pow(C0,e),new ko(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ko(Cd(this.r),Cd(this.g),Cd(this.b),j_(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:_9,formatHex:_9,formatHex8:d1e,formatRgb:S9,toString:S9}));function _9(){return`#${hd(this.r)}${hd(this.g)}${hd(this.b)}`}function d1e(){return`#${hd(this.r)}${hd(this.g)}${hd(this.b)}${hd((isNaN(this.opacity)?1:this.opacity)*255)}`}function S9(){const e=j_(this.opacity);return`${e===1?"rgb(":"rgba("}${Cd(this.r)}, ${Cd(this.g)}, ${Cd(this.b)}${e===1?")":`, ${e})`}`}function j_(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Cd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function hd(e){return e=Cd(e),(e<16?"0":"")+e.toString(16)}function x9(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ts(e,t,n,r)}function XU(e){if(e instanceof ts)return new ts(e.h,e.s,e.l,e.opacity);if(e instanceof Ny||(e=E0(e)),!e)return new ts;if(e instanceof ts)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),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(n-r)/s+(n0&&l<1?0:a,new ts(a,s,l,e.opacity)}function f1e(e,t,n,r){return arguments.length===1?XU(e):new ts(e,t,n,r??1)}function ts(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}bk(ts,f1e,QU(Ny,{brighter(e){return e=e==null?z_:Math.pow(z_,e),new ts(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?C0:Math.pow(C0,e),new ts(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 ko(YC(e>=240?e-240:e+120,i,r),YC(e,i,r),YC(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new ts(w9(this.h),Gv(this.s),Gv(this.l),j_(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=j_(this.opacity);return`${e===1?"hsl(":"hsla("}${w9(this.h)}, ${Gv(this.s)*100}%, ${Gv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function w9(e){return e=(e||0)%360,e<0?e+360:e}function Gv(e){return Math.max(0,Math.min(1,e||0))}function YC(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 YU=e=>()=>e;function h1e(e,t){return function(n){return e+n*t}}function p1e(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 g1e(e){return(e=+e)==1?ZU:function(t,n){return n-t?p1e(t,n,e):YU(isNaN(t)?n:t)}}function ZU(e,t){var n=t-e;return n?h1e(e,n):YU(isNaN(e)?t:e)}const C9=function e(t){var n=g1e(t);function r(i,o){var a=n((i=VA(i)).r,(o=VA(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),u=ZU(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function Eu(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var GA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ZC=new RegExp(GA.source,"g");function m1e(e){return function(){return e}}function y1e(e){return function(t){return e(t)+""}}function v1e(e,t){var n=GA.lastIndex=ZC.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(r=GA.exec(e))&&(i=ZC.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Eu(r,i)})),n=ZC.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:Eu(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:Eu(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:Eu(u,d)},{i:m-2,x:Eu(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),a(u.rotate,c.rotate,d,f),s(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,m=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--cp}function T9(){Ud=(V_=T0.now())+ux,cp=Og=0;try{k1e()}finally{cp=0,I1e(),Ud=0}}function P1e(){var e=T0.now(),t=e-V_;t>tV&&(ux-=t,V_=e)}function I1e(){for(var e,t=U_,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:U_=n);Mg=e,qA(r)}function qA(e){if(!cp){Og&&(Og=clearTimeout(Og));var t=e-Ud;t>24?(e<1/0&&(Og=setTimeout(T9,e-T0.now()-ux)),og&&(og=clearInterval(og))):(og||(V_=T0.now(),og=setInterval(P1e,tV)),cp=1,nV(T9))}}function k9(e,t,n){var r=new G_;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var R1e=sx("start","end","cancel","interrupt"),O1e=[],iV=0,P9=1,WA=2,eb=3,I9=4,KA=5,tb=6;function cx(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;M1e(e,n,{name:t,index:r,group:i,on:R1e,tween:O1e,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:iV})}function Sk(e,t){var n=vs(e,t);if(n.state>iV)throw new Error("too late; already scheduled");return n}function ll(e,t){var n=vs(e,t);if(n.state>eb)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 M1e(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=rV(o,0,n.time);function o(u){n.state=P9,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var c,d,f,h;if(n.state!==P9)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===eb)return k9(a);h.state===I9?(h.state=tb,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cWA&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function ube(e,t,n){var r,i,o=lbe(t)?Sk:ll;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function cbe(e,t){var n=this._id;return arguments.length<2?vs(this.node(),n).on.on(e):this.each(ube(n,e,t))}function dbe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function fbe(){return this.on("end.remove",dbe(this._id))}function hbe(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yk(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>e;function Fbe(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 Nl(e,t,n){this.k=e,this.x=t,this.y=n}Nl.prototype={constructor:Nl,scale:function(e){return e===1?this:new Nl(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Nl(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 nc=new Nl(1,0,0);Nl.prototype;function JC(e){e.stopImmediatePropagation()}function ag(e){e.preventDefault(),e.stopImmediatePropagation()}function Bbe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function zbe(){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 R9(){return this.__zoom||nc}function jbe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ube(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vbe(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],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Gbe(){var e=Bbe,t=zbe,n=Vbe,r=jbe,i=Ube,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=E1e,u=sx("start","zoom","end"),c,d,f,h=500,p=150,m=0,_=10;function b(A){A.property("__zoom",R9).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",E).filter(i).on("touchstart.zoom",k).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(A,P,D,L){var M=A.selection?A.selection():A;M.property("__zoom",R9),A!==M?S(A,P,D,L):M.interrupt().each(function(){x(this,arguments).event(L).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},b.scaleBy=function(A,P,D,L){b.scaleTo(A,function(){var M=this.__zoom.k,R=typeof P=="function"?P.apply(this,arguments):P;return M*R},D,L)},b.scaleTo=function(A,P,D,L){b.transform(A,function(){var M=t.apply(this,arguments),R=this.__zoom,$=D==null?v(M):typeof D=="function"?D.apply(this,arguments):D,B=R.invert($),U=typeof P=="function"?P.apply(this,arguments):P;return n(g(y(R,U),$,B),M,a)},D,L)},b.translateBy=function(A,P,D,L){b.transform(A,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),a)},null,L)},b.translateTo=function(A,P,D,L,M){b.transform(A,function(){var R=t.apply(this,arguments),$=this.__zoom,B=L==null?v(R):typeof L=="function"?L.apply(this,arguments):L;return n(nc.translate(B[0],B[1]).scale($.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof D=="function"?-D.apply(this,arguments):-D),R,a)},L,M)};function y(A,P){return P=Math.max(o[0],Math.min(o[1],P)),P===A.k?A:new Nl(P,A.x,A.y)}function g(A,P,D){var L=P[0]-D[0]*A.k,M=P[1]-D[1]*A.k;return L===A.x&&M===A.y?A:new Nl(A.k,L,M)}function v(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function S(A,P,D,L){A.on("start.zoom",function(){x(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(L).end()}).tween("zoom",function(){var M=this,R=arguments,$=x(M,R).event(L),B=t.apply(M,R),U=D==null?v(B):typeof D=="function"?D.apply(M,R):D,G=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),Y=M.__zoom,ee=typeof P=="function"?P.apply(M,R):P,J=l(Y.invert(U).concat(G/Y.k),ee.invert(U).concat(G/ee.k));return function(j){if(j===1)j=ee;else{var Q=J(j),ne=G/Q[2];j=new Nl(ne,U[0]-Q[0]*ne,U[1]-Q[1]*ne)}$.zoom(null,j)}})}function x(A,P,D){return!D&&A.__zooming||new w(A,P)}function w(A,P){this.that=A,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,P),this.taps=0}w.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,P){return this.mouse&&A!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var P=es(this.that).datum();u.call(A,this.that,new Fbe(A,{sourceEvent:this.sourceEvent,target:b,type:A,transform:this.that.__zoom,dispatch:u}),P)}};function C(A,...P){if(!e.apply(this,arguments))return;var D=x(this,P).event(A),L=this.__zoom,M=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),R=Ps(A);if(D.wheel)(D.mouse[0][0]!==R[0]||D.mouse[0][1]!==R[1])&&(D.mouse[1]=L.invert(D.mouse[0]=R)),clearTimeout(D.wheel);else{if(L.k===M)return;D.mouse=[R,L.invert(R)],nb(this),D.start()}ag(A),D.wheel=setTimeout($,p),D.zoom("mouse",n(g(y(L,M),D.mouse[0],D.mouse[1]),D.extent,a));function $(){D.wheel=null,D.end()}}function T(A,...P){if(f||!e.apply(this,arguments))return;var D=A.currentTarget,L=x(this,P,!0).event(A),M=es(A.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),R=Ps(A,D),$=A.clientX,B=A.clientY;WU(A.view),JC(A),L.mouse=[R,this.__zoom.invert(R)],nb(this),L.start();function U(Y){if(ag(Y),!L.moved){var ee=Y.clientX-$,J=Y.clientY-B;L.moved=ee*ee+J*J>m}L.event(Y).zoom("mouse",n(g(L.that.__zoom,L.mouse[0]=Ps(Y,D),L.mouse[1]),L.extent,a))}function G(Y){M.on("mousemove.zoom mouseup.zoom",null),KU(Y.view,L.moved),ag(Y),L.event(Y).end()}}function E(A,...P){if(e.apply(this,arguments)){var D=this.__zoom,L=Ps(A.changedTouches?A.changedTouches[0]:A,this),M=D.invert(L),R=D.k*(A.shiftKey?.5:2),$=n(g(y(D,R),L,M),t.apply(this,P),a);ag(A),s>0?es(this).transition().duration(s).call(S,$,L,A):es(this).call(b.transform,$,L,A)}}function k(A,...P){if(e.apply(this,arguments)){var D=A.touches,L=D.length,M=x(this,P,A.changedTouches.length===L).event(A),R,$,B,U;for(JC(A),$=0;$"[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".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},lV=Jl.error001();function _r(e,t){const n=I.useContext(dx);if(n===null)throw new Error(lV);return $U(n,e,t)}const pi=()=>{const e=I.useContext(dx);if(e===null)throw new Error(lV);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},qbe=e=>e.userSelectionActive?"none":"all";function Wbe({position:e,children:t,className:n,style:r,...i}){const o=_r(qbe),a=`${e}`.split("-");return W.jsx("div",{className:Ma(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},...i,children:t})}function Kbe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:W.jsx(Wbe,{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:W.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Qbe=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...c})=>{const d=I.useRef(null),[f,h]=I.useState({x:0,y:0,width:0,height:0}),p=Ma(["react-flow__edge-textwrapper",u]);return I.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:W.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&W.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),W.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var Xbe=I.memo(Qbe);const wk=e=>({width:e.offsetWidth,height:e.offsetHeight}),dp=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ck=(e={x:0,y:0},t)=>({x:dp(e.x,t[0][0],t[1][0]),y:dp(e.y,t[0][1],t[1][1])}),O9=(e,t,n)=>en?-dp(Math.abs(e-n),1,50)/50:0,uV=(e,t)=>{const n=O9(e.x,35,t.width-35)*20,r=O9(e.y,35,t.height-35)*20;return[n,r]},cV=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},dV=(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)}),k0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),fV=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),M9=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),lqe=(e,t)=>fV(dV(k0(e),k0(t))),QA=(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)},Ybe=e=>Ca(e.width)&&Ca(e.height)&&Ca(e.x)&&Ca(e.y),Ca=e=>!isNaN(e)&&isFinite(e),Xr=Symbol.for("internals"),hV=["Enter"," ","Escape"],Zbe=(e,t)=>{},Jbe=e=>"nativeEvent"in e;function XA(e){var i,o;const t=Jbe(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 pV=e=>"clientX"in e,rc=(e,t)=>{var o,a;const n=pV(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},H_=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Dy=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>W.jsxs(W.Fragment,{children:[W.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&W.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Ca(n)&&Ca(r)?W.jsx(Xbe,{x:n,y:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]});Dy.displayName="BaseEdge";function sg(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function gV({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,b,y]=yV({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return W.jsx(Dy,{path:_,labelX:b,labelY:y,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});Ak.displayName="SimpleBezierEdge";const N9={[tt.Left]:{x:-1,y:0},[tt.Right]:{x:1,y:0},[tt.Top]:{x:0,y:-1},[tt.Bottom]:{x:0,y:1}},e_e=({source:e,sourcePosition:t=tt.Bottom,target:n})=>t===tt.Left||t===tt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function t_e({source:e,sourcePosition:t=tt.Bottom,target:n,targetPosition:r=tt.Top,center:i,offset:o}){const a=N9[t],s=N9[r],l={x:e.x+a.x*o,y:e.y+a.y*o},u={x:n.x+s.x*o,y:n.y+s.y*o},c=e_e({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const _={x:0,y:0},b={x:0,y:0},[y,g,v,S]=gV({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){p=i.x||y,m=i.y||g;const w=[{x:p,y:l.y},{x:p,y:u.y}],C=[{x:l.x,y:m},{x:u.x,y:m}];a[d]===f?h=d==="x"?w:C:h=d==="x"?C:w}else{const w=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===f?C:w:h=a.y===f?w:C,t===r){const O=Math.abs(e[d]-n[d]);if(O<=o){const A=Math.min(o-1,o-O);a[d]===f?_[d]=(l[d]>e[d]?-1:1)*A:b[d]=(u[d]>n[d]?-1:1)*A}}if(t!==r){const O=d==="x"?"y":"x",A=a[d]===s[O],P=l[O]>u[O],D=l[O]=N?(p=(T.x+E.x)/2,m=h[0].y):(p=h[0].x,m=(T.y+E.y)/2)}return[[e,{x:l.x+_.x,y:l.y+_.y},...h,{x:u.x+b.x,y:u.y+b.y},n],p,m,v,S]}function n_e(e,t,n,r){const i=Math.min(D9(e,t)/2,D9(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x{let g="";return y>0&&y{const[b,y,g]=YA({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return W.jsx(Dy,{path:b,labelX:y,labelY:g,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});fx.displayName="SmoothStepEdge";const Ek=I.memo(e=>{var t;return W.jsx(fx,{...e,pathOptions:I.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Ek.displayName="StepEdge";function r_e({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=gV({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const Tk=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,_]=r_e({sourceX:e,sourceY:t,targetX:n,targetY:r});return W.jsx(Dy,{path:p,labelX:m,labelY:_,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});Tk.displayName="StraightEdge";function Wv(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function L9({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case tt.Left:return[t-Wv(t-r,o),n];case tt.Right:return[t+Wv(r-t,o),n];case tt.Top:return[t,n-Wv(n-i,o)];case tt.Bottom:return[t,n+Wv(i-n,o)]}}function vV({sourceX:e,sourceY:t,sourcePosition:n=tt.Bottom,targetX:r,targetY:i,targetPosition:o=tt.Top,curvature:a=.25}){const[s,l]=L9({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,c]=L9({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[d,f,h,p]=mV({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${s},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const W_=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=tt.Bottom,targetPosition:o=tt.Top,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:_})=>{const[b,y,g]=vV({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return W.jsx(Dy,{path:b,labelX:y,labelY:g,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});W_.displayName="BezierEdge";const kk=I.createContext(null),i_e=kk.Provider;kk.Consumer;const o_e=()=>I.useContext(kk),a_e=e=>"id"in e&&"source"in e&&"target"in e,bV=e=>"id"in e&&!("source"in e)&&!("target"in e),s_e=(e,t,n)=>{if(!bV(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},l_e=(e,t,n)=>{if(!bV(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},_V=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,ZA=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,u_e=(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)),$g=(e,t)=>{if(!e.source||!e.target)return t;let n;return a_e(e)?n={...e}:n={...e,id:_V(e)},u_e(n,t)?t:t.concat(n)},c_e=(e,t,n,r={shouldReplaceId:!0})=>{const{id:i,...o}=e;if(!t.source||!t.target||!n.find(l=>l.id===i))return n;const s={...o,id:r.shouldReplaceId?_V(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(l=>l.id!==i).concat(s)},SV=({x:e,y:t},[n,r,i],o,[a,s])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:a*Math.round(l.x/a),y:s*Math.round(l.y/s)}:l},d_e=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),Eh=(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}},Pk=(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:a}=Eh(i,t).positionAbsolute;return dV(r,k0({x:o,y:a,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fV(n)},xV=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1,s=[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(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(a&&!h||p)return!1;const{positionAbsolute:m}=Eh(c,s),_={x:m.x,y:m.y,width:d||0,height:f||0},b=QA(l,_),y=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&b>0,v=(d||0)*(f||0);(y||g||b>=v||c.dragging)&&u.push(c)}),u},Ik=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},wV=(e,t,n,r,i,o=.1)=>{const a=t/(e.width*(1+o)),s=n/(e.height*(1+o)),l=Math.min(a,s),u=dp(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},Kc=(e,t=0)=>e.transition().duration(t);function F9(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var a,s;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((a=e.positionAbsolute)==null?void 0:a.x)??0)+o.x+o.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+o.y+o.height/2}),i},[])}function f_e(e,t,n,r,i,o){const{x:a,y:s}=rc(e),u=t.elementsFromPoint(a,s).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=Rk(void 0,u),_=u.getAttribute("data-handleid"),b=o({nodeId:p,id:_,type:m});if(b)return{handle:{id:_,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:b}}}let c=[],d=1/0;if(i.forEach(p=>{const m=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(m<=r){const _=o(p);m<=d&&(mp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:m})=>h?p.type==="target":f?m.isValid:!0)||c[0]}const h_e={source:null,target:null,sourceHandle:null,targetHandle:null},CV=()=>({handleDomNode:null,isValid:!1,connection:h_e,endHandle:null});function AV(e,t,n,r,i,o,a){const s=i==="target",l=a.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={...CV(),handleDomNode:l};if(l){const c=Rk(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),m={source:s?d:n,sourceHandle:s?f:r,target:s?n:d,targetHandle:s?r:f};u.connection=m,h&&p&&(t===Vd.Strict?s&&c==="source"||!s&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function p_e({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Xr]){const{handleBounds:a}=o[Xr];let s=[],l=[];a&&(s=F9(o,a,"source",`${t}-${n}-${r}`),l=F9(o,a,"target",`${t}-${n}-${r}`)),i.push(...s,...l)}return i},[])}function Rk(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function e5(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function g_e(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function EV({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:a,isValidConnection:s,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=cV(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:_,getNodes:b,cancelConnection:y}=o();let g=0,v;const{x:S,y:x}=rc(e),w=c==null?void 0:c.elementFromPoint(S,x),C=Rk(l,w),T=f==null?void 0:f.getBoundingClientRect();if(!T||!C)return;let E,k=rc(e,T),N=!1,O=null,A=!1,P=null;const D=p_e({nodes:b(),nodeId:n,handleId:t,handleType:C}),L=()=>{if(!h)return;const[$,B]=uV(k,T);_({x:$,y:B}),g=requestAnimationFrame(L)};a({connectionPosition:k,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:C});function M($){const{transform:B}=o();k=rc($,T);const{handle:U,validHandleResult:G}=f_e($,c,SV(k,B,!1,[1,1]),p,D,Y=>AV(Y,d,n,t,i?"target":"source",s,c));if(v=U,N||(L(),N=!0),P=G.handleDomNode,O=G.connection,A=G.isValid,a({connectionPosition:v&&A?d_e({x:v.x,y:v.y},B):k,connectionStatus:g_e(!!v,A),connectionEndHandle:G.endHandle}),!v&&!A&&!P)return e5(E);O.source!==O.target&&P&&(e5(E),E=P,P.classList.add("connecting","react-flow__handle-connecting"),P.classList.toggle("valid",A),P.classList.toggle("react-flow__handle-valid",A))}function R($){var B,U;(v||P)&&O&&A&&(r==null||r(O)),(U=(B=o()).onConnectEnd)==null||U.call(B,$),l&&(u==null||u($)),e5(E),y(),cancelAnimationFrame(g),N=!1,A=!1,O=null,P=null,c.removeEventListener("mousemove",M),c.removeEventListener("mouseup",R),c.removeEventListener("touchmove",M),c.removeEventListener("touchend",R)}c.addEventListener("mousemove",M),c.addEventListener("mouseup",R),c.addEventListener("touchmove",M),c.addEventListener("touchend",R)}const B9=()=>!0,m_e=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),y_e=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:a}=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:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n}},TV=I.forwardRef(({type:e="source",position:t=tt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var T,E;const p=a||null,m=e==="target",_=pi(),b=o_e(),{connectOnClick:y,noPanClassName:g}=_r(m_e,No),{connecting:v,clickConnecting:S}=_r(y_e(b,p,e),No);b||(E=(T=_.getState()).onError)==null||E.call(T,"010",Jl.error010());const x=k=>{const{defaultEdgeOptions:N,onConnect:O,hasDefaultEdges:A}=_.getState(),P={...N,...k};if(A){const{edges:D,setEdges:L}=_.getState();L($g(P,D))}O==null||O(P),s==null||s(P)},w=k=>{if(!b)return;const N=pV(k);i&&(N&&k.button===0||!N)&&EV({event:k,handleId:p,nodeId:b,onConnect:x,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||B9}),N?c==null||c(k):d==null||d(k)},C=k=>{const{onClickConnectStart:N,onClickConnectEnd:O,connectionClickStartHandle:A,connectionMode:P,isValidConnection:D}=_.getState();if(!b||!A&&!i)return;if(!A){N==null||N(k,{nodeId:b,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:b,type:e,handleId:p}});return}const L=cV(k.target),M=n||D||B9,{connection:R,isValid:$}=AV({nodeId:b,id:p,type:e},P,A.nodeId,A.handleId||null,A.type,M,L);$&&x(R),O==null||O(k),_.setState({connectionClickStartHandle:null})};return W.jsx("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":t,"data-id":`${b}-${p}-${e}`,className:Ma(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!v||o&&v)}]),onMouseDown:w,onTouchStart:w,onClick:y?C:void 0,ref:h,...f,children:l})});TV.displayName="Handle";var K_=I.memo(TV);const kV=({data:e,isConnectable:t,targetPosition:n=tt.Top,sourcePosition:r=tt.Bottom})=>W.jsxs(W.Fragment,{children:[W.jsx(K_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,W.jsx(K_,{type:"source",position:r,isConnectable:t})]});kV.displayName="DefaultNode";var JA=I.memo(kV);const PV=({data:e,isConnectable:t,sourcePosition:n=tt.Bottom})=>W.jsxs(W.Fragment,{children:[e==null?void 0:e.label,W.jsx(K_,{type:"source",position:n,isConnectable:t})]});PV.displayName="InputNode";var IV=I.memo(PV);const RV=({data:e,isConnectable:t,targetPosition:n=tt.Top})=>W.jsxs(W.Fragment,{children:[W.jsx(K_,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});RV.displayName="OutputNode";var OV=I.memo(RV);const Ok=()=>null;Ok.displayName="GroupNode";const v_e=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),Kv=e=>e.id;function b_e(e,t){return No(e.selectedNodes.map(Kv),t.selectedNodes.map(Kv))&&No(e.selectedEdges.map(Kv),t.selectedEdges.map(Kv))}const MV=I.memo(({onSelectionChange:e})=>{const t=pi(),{selectedNodes:n,selectedEdges:r}=_r(v_e,b_e);return I.useEffect(()=>{var o,a;const i={nodes:n,edges:r};e==null||e(i),(a=(o=t.getState()).onSelectionChange)==null||a.call(o,i)},[n,r,e]),null});MV.displayName="SelectionListener";const __e=e=>!!e.onSelectionChange;function S_e({onSelectionChange:e}){const t=_r(__e);return e||t?W.jsx(MV,{onSelectionChange:e}):null}const x_e=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 bf(e,t){I.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ot(e,t,n){I.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const w_e=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:a,onClickConnectStart:s,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:_,nodeExtent:b,onNodesChange:y,onEdgesChange:g,elementsSelectable:v,connectionMode:S,snapGrid:x,snapToGrid:w,translateExtent:C,connectOnClick:T,defaultEdgeOptions:E,fitView:k,fitViewOptions:N,onNodesDelete:O,onEdgesDelete:A,onNodeDrag:P,onNodeDragStart:D,onNodeDragStop:L,onSelectionDrag:M,onSelectionDragStart:R,onSelectionDragStop:$,noPanClassName:B,nodeOrigin:U,rfId:G,autoPanOnConnect:Y,autoPanOnNodeDrag:ee,onError:J,connectionRadius:j,isValidConnection:Q})=>{const{setNodes:ne,setEdges:se,setDefaultNodesAndEdges:Se,setMinZoom:ce,setMaxZoom:bt,setTranslateExtent:ot,setNodeExtent:ze,reset:mt}=_r(x_e,No),Ie=pi();return I.useEffect(()=>{const en=r==null?void 0:r.map(Ir=>({...Ir,...E}));return Se(n,en),()=>{mt()}},[]),Ot("defaultEdgeOptions",E,Ie.setState),Ot("connectionMode",S,Ie.setState),Ot("onConnect",i,Ie.setState),Ot("onConnectStart",o,Ie.setState),Ot("onConnectEnd",a,Ie.setState),Ot("onClickConnectStart",s,Ie.setState),Ot("onClickConnectEnd",l,Ie.setState),Ot("nodesDraggable",u,Ie.setState),Ot("nodesConnectable",c,Ie.setState),Ot("nodesFocusable",d,Ie.setState),Ot("edgesFocusable",f,Ie.setState),Ot("edgesUpdatable",h,Ie.setState),Ot("elementsSelectable",v,Ie.setState),Ot("elevateNodesOnSelect",p,Ie.setState),Ot("snapToGrid",w,Ie.setState),Ot("snapGrid",x,Ie.setState),Ot("onNodesChange",y,Ie.setState),Ot("onEdgesChange",g,Ie.setState),Ot("connectOnClick",T,Ie.setState),Ot("fitViewOnInit",k,Ie.setState),Ot("fitViewOnInitOptions",N,Ie.setState),Ot("onNodesDelete",O,Ie.setState),Ot("onEdgesDelete",A,Ie.setState),Ot("onNodeDrag",P,Ie.setState),Ot("onNodeDragStart",D,Ie.setState),Ot("onNodeDragStop",L,Ie.setState),Ot("onSelectionDrag",M,Ie.setState),Ot("onSelectionDragStart",R,Ie.setState),Ot("onSelectionDragStop",$,Ie.setState),Ot("noPanClassName",B,Ie.setState),Ot("nodeOrigin",U,Ie.setState),Ot("rfId",G,Ie.setState),Ot("autoPanOnConnect",Y,Ie.setState),Ot("autoPanOnNodeDrag",ee,Ie.setState),Ot("onError",J,Ie.setState),Ot("connectionRadius",j,Ie.setState),Ot("isValidConnection",Q,Ie.setState),bf(e,ne),bf(t,se),bf(m,ce),bf(_,bt),bf(C,ot),bf(b,ze),null},z9={display:"none"},C_e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},$V="react-flow__node-desc",NV="react-flow__edge-desc",A_e="react-flow__aria-live",E_e=e=>e.ariaLiveMessage;function T_e({rfId:e}){const t=_r(E_e);return W.jsx("div",{id:`${A_e}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:C_e,children:t})}function k_e({rfId:e,disableKeyboardA11y:t}){return W.jsxs(W.Fragment,{children:[W.jsxs("div",{id:`${$V}-${e}`,style:z9,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."," "]}),W.jsx("div",{id:`${NV}-${e}`,style:z9,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&W.jsx(T_e,{rfId:e})]})}const P_e=typeof document<"u"?document:null;var P0=(e=null,t={target:P_e})=>{const[n,r]=I.useState(!1),i=I.useRef(!1),o=I.useRef(new Set([])),[a,s]=I.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return I.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&XA(h))return!1;const p=U9(h.code,s);o.current.add(h[p]),j9(a,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&XA(h))return!1;const p=U9(h.code,s);j9(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),h.key==="Meta"&&o.current.clear(),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function j9(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function U9(e,t){return t.includes(e)?"code":"key"}function DV(e,t,n,r){var a,s;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=Eh(i,r);return DV(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((a=i[Xr])==null?void 0:a.z)??0)>(n.z??0)?((s=i[Xr])==null?void 0:s.z)??0:n.z??0},r)}function LV(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:a,z:s}=DV(r,e,{...r.position,z:((i=r[Xr])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:a},r[Xr].z=s,n!=null&&n[r.id]&&(r[Xr].isParent=!0)}})}function t5(e,t,n,r){const i=new Map,o={},a=r?1e3:0;return e.forEach(s=>{var d;const l=(Ca(s.zIndex)?s.zIndex:0)+(s.selected?a:0),u=t.get(s.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...s,positionAbsolute:{x:s.position.x,y:s.position.y}};s.parentNode&&(c.parentNode=s.parentNode,o[s.parentNode]=!0),Object.defineProperty(c,Xr,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Xr])==null?void 0:d.handleBounds,z:l}}),i.set(s.id,c)}),LV(i,n,o),i}function FV(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:a,d3Zoom:s,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(s&&l&&(f||!t.initial)){const p=n().filter(_=>{var y;const b=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(y=t.nodes)!=null&&y.length?b&&t.nodes.some(g=>g.id===_.id):b}),m=p.every(_=>_.width&&_.height);if(p.length>0&&m){const _=Pk(p,d),[b,y,g]=wV(_,r,i,t.minZoom??o,t.maxZoom??a,t.padding??.1),v=nc.translate(b,y).scale(g);return typeof t.duration=="number"&&t.duration>0?s.transform(Kc(l,t.duration),v):s.transform(l,v),!0}}return!1}function I_e(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Xr]:r[Xr],selected:n.selected})}),new Map(t)}function R_e(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function Qv({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:a,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:I_e(e,i)}),a==null||a(e)),t!=null&&t.length&&(u&&r({edges:R_e(t,o)}),s==null||s(t))}const _f=()=>{},O_e={zoomIn:_f,zoomOut:_f,zoomTo:_f,getZoom:()=>1,setViewport:_f,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:_f,fitBounds:_f,project:e=>e,viewportInitialized:!1},M_e=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),$_e=()=>{const e=pi(),{d3Zoom:t,d3Selection:n}=_r(M_e,No);return I.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(Kc(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(Kc(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(Kc(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[a,s,l]=e.getState().transform,u=nc.translate(i.x??a,i.y??s).scale(i.zoom??l);t.transform(Kc(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,a]=e.getState().transform;return{x:i,y:o,zoom:a}},fitView:i=>FV(e.getState,i),setCenter:(i,o,a)=>{const{width:s,height:l,maxZoom:u}=e.getState(),c=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:u,d=s/2-i*c,f=l/2-o*c,h=nc.translate(d,f).scale(c);t.transform(Kc(n,a==null?void 0:a.duration),h)},fitBounds:(i,o)=>{const{width:a,height:s,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=wV(i,a,s,l,u,(o==null?void 0:o.padding)??.1),h=nc.translate(c,d).scale(f);t.transform(Kc(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:a,snapGrid:s}=e.getState();return SV(i,o,a,s)},viewportInitialized:!0}:O_e,[t,n])};function BV(){const e=$_e(),t=pi(),n=I.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=I.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=I.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),o=I.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(b=>b.id===m)},[]),a=I.useCallback(m=>{const{getNodes:_,setNodes:b,hasDefaultNodes:y,onNodesChange:g}=t.getState(),v=_(),S=typeof m=="function"?m(v):m;if(y)b(S);else if(g){const x=S.length===0?v.map(w=>({type:"remove",id:w.id})):S.map(w=>({item:w,type:"reset"}));g(x)}},[]),s=I.useCallback(m=>{const{edges:_=[],setEdges:b,hasDefaultEdges:y,onEdgesChange:g}=t.getState(),v=typeof m=="function"?m(_):m;if(y)b(v);else if(g){const S=v.length===0?_.map(x=>({type:"remove",id:x.id})):v.map(x=>({item:x,type:"reset"}));g(S)}},[]),l=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:b,setNodes:y,hasDefaultNodes:g,onNodesChange:v}=t.getState();if(g){const x=[...b(),..._];y(x)}else if(v){const S=_.map(x=>({item:x,type:"add"}));v(S)}},[]),u=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:b=[],setEdges:y,hasDefaultEdges:g,onEdgesChange:v}=t.getState();if(g)y([...b,..._]);else if(v){const S=_.map(x=>({item:x,type:"add"}));v(S)}},[]),c=I.useCallback(()=>{const{getNodes:m,edges:_=[],transform:b}=t.getState(),[y,g,v]=b;return{nodes:m().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:y,y:g,zoom:v}}},[]),d=I.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:b,getNodes:y,edges:g,hasDefaultNodes:v,hasDefaultEdges:S,onNodesDelete:x,onEdgesDelete:w,onNodesChange:C,onEdgesChange:T}=t.getState(),E=(m||[]).map(P=>P.id),k=(_||[]).map(P=>P.id),N=y().reduce((P,D)=>{const L=!E.includes(D.id)&&D.parentNode&&P.find(R=>R.id===D.parentNode);return(typeof D.deletable=="boolean"?D.deletable:!0)&&(E.includes(D.id)||L)&&P.push(D),P},[]),O=g.filter(P=>typeof P.deletable=="boolean"?P.deletable:!0),A=O.filter(P=>k.includes(P.id));if(N||A){const P=Ik(N,O),D=[...A,...P],L=D.reduce((M,R)=>(M.includes(R.id)||M.push(R.id),M),[]);if((S||v)&&(S&&t.setState({edges:g.filter(M=>!L.includes(M.id))}),v&&(N.forEach(M=>{b.delete(M.id)}),t.setState({nodeInternals:new Map(b)}))),L.length>0&&(w==null||w(D),T&&T(L.map(M=>({id:M,type:"remove"})))),N.length>0&&(x==null||x(N),C)){const M=N.map(R=>({id:R.id,type:"remove"}));C(M)}}},[]),f=I.useCallback(m=>{const _=Ybe(m),b=_?null:t.getState().nodeInternals.get(m.id);return[_?m:M9(b),b,_]},[]),h=I.useCallback((m,_=!0,b)=>{const[y,g,v]=f(m);return y?(b||t.getState().getNodes()).filter(S=>{if(!v&&(S.id===g.id||!S.positionAbsolute))return!1;const x=M9(S),w=QA(x,y);return _&&w>0||w>=m.width*m.height}):[]},[]),p=I.useCallback((m,_,b=!0)=>{const[y]=f(m);if(!y)return!1;const g=QA(y,_);return b&&g>0||g>=m.width*m.height},[]);return I.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:a,setEdges:s,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,a,s,l,u,c,d,h,p])}var N_e=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=pi(),{deleteElements:r}=BV(),i=P0(e),o=P0(t);I.useEffect(()=>{if(i){const{edges:a,getNodes:s}=n.getState(),l=s().filter(c=>c.selected),u=a.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),I.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function D_e(e){const t=pi();I.useEffect(()=>{let n;const r=()=>{var o,a;if(!e.current)return;const i=wk(e.current);(i.height===0||i.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",Jl.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 Mk={position:"absolute",width:"100%",height:"100%",top:0,left:0},L_e=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Xv=e=>({x:e.x,y:e.y,zoom:e.k}),Sf=(e,t)=>e.target.closest(`.${t}`),V9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),G9=e=>{const t=e.ctrlKey&&H_()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},F_e=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),B_e=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:a=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=pd.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:b=!0,children:y,noWheelClassName:g,noPanClassName:v})=>{const S=I.useRef(),x=pi(),w=I.useRef(!1),C=I.useRef(!1),T=I.useRef(null),E=I.useRef({x:0,y:0,zoom:0}),{d3Zoom:k,d3Selection:N,d3ZoomHandler:O,userSelectionActive:A}=_r(F_e,No),P=P0(_),D=I.useRef(0),L=I.useRef(!1),M=I.useRef();return D_e(T),I.useEffect(()=>{if(T.current){const R=T.current.getBoundingClientRect(),$=Gbe().scaleExtent([p,m]).translateExtent(h),B=es(T.current).call($),U=nc.translate(f.x,f.y).scale(dp(f.zoom,p,m)),G=[[0,0],[R.width,R.height]],Y=$.constrain()(U,G,h);$.transform(B,Y),$.wheelDelta(G9),x.setState({d3Zoom:$,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[Y.x,Y.y,Y.k],domNode:T.current.closest(".react-flow")})}},[]),I.useEffect(()=>{N&&k&&(a&&!P&&!A?N.on("wheel.zoom",R=>{if(Sf(R,g))return!1;R.preventDefault(),R.stopImmediatePropagation();const $=N.property("__zoom").k||1,B=H_();if(R.ctrlKey&&o&&B){const ne=Ps(R),se=G9(R),Se=$*Math.pow(2,se);k.scaleTo(N,Se,ne,R);return}const U=R.deltaMode===1?20:1;let G=l===pd.Vertical?0:R.deltaX*U,Y=l===pd.Horizontal?0:R.deltaY*U;!B&&R.shiftKey&&l!==pd.Vertical&&(G=R.deltaY*U,Y=0),k.translateBy(N,-(G/$)*s,-(Y/$)*s,{internal:!0});const ee=Xv(N.property("__zoom")),{onViewportChangeStart:J,onViewportChange:j,onViewportChangeEnd:Q}=x.getState();clearTimeout(M.current),L.current||(L.current=!0,t==null||t(R,ee),J==null||J(ee)),L.current&&(e==null||e(R,ee),j==null||j(ee),M.current=setTimeout(()=>{n==null||n(R,ee),Q==null||Q(ee),L.current=!1},150))},{passive:!1}):typeof O<"u"&&N.on("wheel.zoom",function(R,$){if(!b||Sf(R,g))return null;R.preventDefault(),O.call(this,R,$)},{passive:!1}))},[A,a,l,N,k,O,P,o,b,g,t,e,n]),I.useEffect(()=>{k&&k.on("start",R=>{var U,G;if(!R.sourceEvent||R.sourceEvent.internal)return null;D.current=(U=R.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:$}=x.getState(),B=Xv(R.transform);w.current=!0,E.current=B,((G=R.sourceEvent)==null?void 0:G.type)==="mousedown"&&x.setState({paneDragging:!0}),$==null||$(B),t==null||t(R.sourceEvent,B)})},[k,t]),I.useEffect(()=>{k&&(A&&!w.current?k.on("zoom",null):A||k.on("zoom",R=>{var B;const{onViewportChange:$}=x.getState();if(x.setState({transform:[R.transform.x,R.transform.y,R.transform.k]}),C.current=!!(r&&V9(d,D.current??0)),(e||$)&&!((B=R.sourceEvent)!=null&&B.internal)){const U=Xv(R.transform);$==null||$(U),e==null||e(R.sourceEvent,U)}}))},[A,k,e,d,r]),I.useEffect(()=>{k&&k.on("end",R=>{if(!R.sourceEvent||R.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=x.getState();if(w.current=!1,x.setState({paneDragging:!1}),r&&V9(d,D.current??0)&&!C.current&&r(R.sourceEvent),C.current=!1,(n||$)&&L_e(E.current,R.transform)){const B=Xv(R.transform);E.current=B,clearTimeout(S.current),S.current=setTimeout(()=>{$==null||$(B),n==null||n(R.sourceEvent,B)},a?150:0)}})},[k,a,d,n,r]),I.useEffect(()=>{k&&k.filter(R=>{const $=P||i,B=o&&R.ctrlKey;if(R.button===1&&R.type==="mousedown"&&(Sf(R,"react-flow__node")||Sf(R,"react-flow__edge")))return!0;if(!d&&!$&&!a&&!u&&!o||A||!u&&R.type==="dblclick"||Sf(R,g)&&R.type==="wheel"||Sf(R,v)&&R.type!=="wheel"||!o&&R.ctrlKey&&R.type==="wheel"||!$&&!a&&!B&&R.type==="wheel"||!d&&(R.type==="mousedown"||R.type==="touchstart")||Array.isArray(d)&&!d.includes(R.button)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const U=Array.isArray(d)&&d.includes(R.button)||!R.button||R.button<=1;return(!R.ctrlKey||R.type==="wheel")&&U})},[A,k,i,o,a,u,d,c,P]),W.jsx("div",{className:"react-flow__renderer",ref:T,style:Mk,children:y})},z_e=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function j_e(){const{userSelectionActive:e,userSelectionRect:t}=_r(z_e,No);return e&&t?W.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 H9(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 zV(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(s=>s.id===i.id);if(o.length===0)return r.push(i),r;const a={...i};for(const s of o)if(s)switch(s.type){case"select":{a.selected=s.selected;break}case"position":{typeof s.position<"u"&&(a.position=s.position),typeof s.positionAbsolute<"u"&&(a.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&H9(r,a);break}case"dimensions":{typeof s.dimensions<"u"&&(a.width=s.dimensions.width,a.height=s.dimensions.height),typeof s.updateStyle<"u"&&(a.style={...a.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(a.resizing=s.resizing),a.expandParent&&H9(r,a);break}case"remove":return r}return r.push(a),r},n)}function Qc(e,t){return zV(e,t)}function Bc(e,t){return zV(e,t)}const Tu=(e,t)=>({id:e,type:"select",selected:t});function Qf(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(Tu(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(Tu(r.id,!1))),n},[])}const n5=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},U_e=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),jV=I.memo(({isSelecting:e,selectionMode:t=gc.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:a,onPaneScroll:s,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=I.useRef(null),h=pi(),p=I.useRef(0),m=I.useRef(0),_=I.useRef(),{userSelectionActive:b,elementsSelectable:y,dragging:g}=_r(U_e,No),v=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=O=>{o==null||o(O),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=O=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){O.preventDefault();return}a==null||a(O)},w=s?O=>s(O):void 0,C=O=>{const{resetSelectedElements:A,domNode:P}=h.getState();if(_.current=P==null?void 0:P.getBoundingClientRect(),!y||!e||O.button!==0||O.target!==f.current||!_.current)return;const{x:D,y:L}=rc(O,_.current);A(),h.setState({userSelectionRect:{width:0,height:0,startX:D,startY:L,x:D,y:L}}),r==null||r(O)},T=O=>{const{userSelectionRect:A,nodeInternals:P,edges:D,transform:L,onNodesChange:M,onEdgesChange:R,nodeOrigin:$,getNodes:B}=h.getState();if(!e||!_.current||!A)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=rc(O,_.current),G=A.startX??0,Y=A.startY??0,ee={...A,x:U.xse.id),ne=j.map(se=>se.id);if(p.current!==ne.length){p.current=ne.length;const se=Qf(J,ne);se.length&&(M==null||M(se))}if(m.current!==Q.length){m.current=Q.length;const se=Qf(D,Q);se.length&&(R==null||R(se))}h.setState({userSelectionRect:ee})},E=O=>{if(O.button!==0)return;const{userSelectionRect:A}=h.getState();!b&&A&&O.target===f.current&&(S==null||S(O)),h.setState({nodesSelectionActive:p.current>0}),v(),i==null||i(O)},k=O=>{b&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(O)),v()},N=y&&(e||b);return W.jsxs("div",{className:Ma(["react-flow__pane",{dragging:g,selection:e}]),onClick:N?void 0:n5(S,f),onContextMenu:n5(x,f),onWheel:n5(w,f),onMouseEnter:N?void 0:l,onMouseDown:N?C:void 0,onMouseMove:N?T:u,onMouseUp:N?E:void 0,onMouseLeave:N?k:c,ref:f,style:Mk,children:[d,W.jsx(j_e,{})]})});jV.displayName="Pane";function UV(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:UV(n,t):!1}function q9(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 V_e(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!UV(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,a;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-(((a=i.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function G_e(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function VV(e,t,n,r,i=[0,0],o){const a=G_e(e,e.extent||r);let s=a;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=Eh(c,i).positionAbsolute;s=c&&Ca(d)&&Ca(f)&&Ca(c.width)&&Ca(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:s}else o==null||o("005",Jl.error005()),s=a;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=Eh(c,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=Eh(c,i).positionAbsolute}const u=s&&s!=="parent"?Ck(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function r5({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 W9=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),a=t.getBoundingClientRect(),s={x:a.width*r[0],y:a.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-a.left-s.x)/n,y:(u.top-a.top-s.y)/n,...wk(l)}})};function lg(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function eE({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeInternals:s,onError:l}=t.getState(),u=s.get(e);if(!u){l==null||l("012",Jl.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function H_e(){const e=pi();return I.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),a=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,l={x:(a-r[0])/r[2],y:(s-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 i5(e){return(t,n,r)=>e==null?void 0:e(t,r)}function GV({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:a}){const s=pi(),[l,u]=I.useState(!1),c=I.useRef([]),d=I.useRef({x:null,y:null}),f=I.useRef(0),h=I.useRef(null),p=I.useRef({x:0,y:0}),m=I.useRef(null),_=I.useRef(!1),b=H_e();return I.useEffect(()=>{if(e!=null&&e.current){const y=es(e.current),g=({x:S,y:x})=>{const{nodeInternals:w,onNodeDrag:C,onSelectionDrag:T,updateNodePositions:E,nodeExtent:k,snapGrid:N,snapToGrid:O,nodeOrigin:A,onError:P}=s.getState();d.current={x:S,y:x};let D=!1,L={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&k){const R=Pk(c.current,A);L=k0(R)}if(c.current=c.current.map(R=>{const $={x:S-R.distance.x,y:x-R.distance.y};O&&($.x=N[0]*Math.round($.x/N[0]),$.y=N[1]*Math.round($.y/N[1]));const B=[[k[0][0],k[0][1]],[k[1][0],k[1][1]]];c.current.length>1&&k&&!R.extent&&(B[0][0]=R.positionAbsolute.x-L.x+k[0][0],B[1][0]=R.positionAbsolute.x+(R.width??0)-L.x2+k[1][0],B[0][1]=R.positionAbsolute.y-L.y+k[0][1],B[1][1]=R.positionAbsolute.y+(R.height??0)-L.y2+k[1][1]);const U=VV(R,$,w,B,A,P);return D=D||R.position.x!==U.position.x||R.position.y!==U.position.y,R.position=U.position,R.positionAbsolute=U.positionAbsolute,R}),!D)return;E(c.current,!0,!0),u(!0);const M=i?C:i5(T);if(M&&m.current){const[R,$]=r5({nodeId:i,dragItems:c.current,nodeInternals:w});M(m.current,R,$)}},v=()=>{if(!h.current)return;const[S,x]=uV(p.current,h.current);if(S!==0||x!==0){const{transform:w,panBy:C}=s.getState();d.current.x=(d.current.x??0)-S/w[2],d.current.y=(d.current.y??0)-x/w[2],C({x:S,y:x})&&g(d.current)}f.current=requestAnimationFrame(v)};if(t)y.on(".drag",null);else{const S=e1e().on("start",x=>{var D;const{nodeInternals:w,multiSelectionActive:C,domNode:T,nodesDraggable:E,unselectNodesAndEdges:k,onNodeDragStart:N,onSelectionDragStart:O}=s.getState(),A=i?N:i5(O);!a&&!C&&i&&((D=w.get(i))!=null&&D.selected||k()),i&&o&&a&&eE({id:i,store:s,nodeRef:e});const P=b(x);if(d.current=P,c.current=V_e(w,E,P,i),A&&c.current){const[L,M]=r5({nodeId:i,dragItems:c.current,nodeInternals:w});A(x.sourceEvent,L,M)}h.current=(T==null?void 0:T.getBoundingClientRect())||null,p.current=rc(x.sourceEvent,h.current)}).on("drag",x=>{const w=b(x),{autoPanOnNodeDrag:C}=s.getState();!_.current&&C&&(_.current=!0,v()),(d.current.x!==w.xSnapped||d.current.y!==w.ySnapped)&&c.current&&(m.current=x.sourceEvent,p.current=rc(x.sourceEvent,h.current),g(w))}).on("end",x=>{if(u(!1),_.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:w,nodeInternals:C,onNodeDragStop:T,onSelectionDragStop:E}=s.getState(),k=i?T:i5(E);if(w(c.current,!1,!1),k){const[N,O]=r5({nodeId:i,dragItems:c.current,nodeInternals:C});k(x.sourceEvent,N,O)}}}).filter(x=>{const w=x.target;return!x.button&&(!n||!q9(w,`.${n}`,e))&&(!r||q9(w,r,e))});return y.call(S),()=>{y.on(".drag",null)}}}},[e,t,n,r,o,s,i,a,b]),l}function HV(){const e=pi();return I.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:a,snapToGrid:s,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=a().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),f=s?l[0]:5,h=s?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,_=n.y*h*p,b=d.map(y=>{if(y.positionAbsolute){const g={x:y.positionAbsolute.x+m,y:y.positionAbsolute.y+_};s&&(g.x=l[0]*Math.round(g.x/l[0]),g.y=l[1]*Math.round(g.y/l[1]));const{positionAbsolute:v,position:S}=VV(y,g,r,i,void 0,u);y.position=S,y.positionAbsolute=v}return y});o(b,!0,!1)},[])}const Th={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ug=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:a,xPosOrigin:s,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:_,className:b,isDraggable:y,isSelectable:g,isConnectable:v,isFocusable:S,selectNodesOnDrag:x,sourcePosition:w,targetPosition:C,hidden:T,resizeObserver:E,dragHandle:k,zIndex:N,isParent:O,noDragClassName:A,noPanClassName:P,initialized:D,disableKeyboardA11y:L,ariaLabel:M,rfId:R})=>{const $=pi(),B=I.useRef(null),U=I.useRef(w),G=I.useRef(C),Y=I.useRef(r),ee=g||y||c||d||f||h,J=HV(),j=lg(n,$.getState,d),Q=lg(n,$.getState,f),ne=lg(n,$.getState,h),se=lg(n,$.getState,p),Se=lg(n,$.getState,m),ce=ze=>{if(g&&(!x||!y)&&eE({id:n,store:$,nodeRef:B}),c){const mt=$.getState().nodeInternals.get(n);mt&&c(ze,{...mt})}},bt=ze=>{if(!XA(ze))if(hV.includes(ze.key)&&g){const mt=ze.key==="Escape";eE({id:n,store:$,unselect:mt,nodeRef:B})}else!L&&y&&u&&Object.prototype.hasOwnProperty.call(Th,ze.key)&&($.setState({ariaLiveMessage:`Moved selected node ${ze.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~a}`}),J({x:Th[ze.key].x,y:Th[ze.key].y,isShiftPressed:ze.shiftKey}))};I.useEffect(()=>{if(B.current&&!T){const ze=B.current;return E==null||E.observe(ze),()=>E==null?void 0:E.unobserve(ze)}},[T]),I.useEffect(()=>{const ze=Y.current!==r,mt=U.current!==w,Ie=G.current!==C;B.current&&(ze||mt||Ie)&&(ze&&(Y.current=r),mt&&(U.current=w),Ie&&(G.current=C),$.getState().updateNodeDimensions([{id:n,nodeElement:B.current,forceUpdate:!0}]))},[n,r,w,C]);const ot=GV({nodeRef:B,disabled:T||!y,noDragClassName:A,handleSelector:k,nodeId:n,isSelectable:g,selectNodesOnDrag:x});return T?null:W.jsx("div",{className:Ma(["react-flow__node",`react-flow__node-${r}`,{[P]:y},b,{selected:u,selectable:g,parent:O,dragging:ot}]),ref:B,style:{zIndex:N,transform:`translate(${s}px,${l}px)`,pointerEvents:ee?"all":"none",visibility:D?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:Q,onMouseLeave:ne,onContextMenu:se,onClick:ce,onDoubleClick:Se,onKeyDown:S?bt:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":L?void 0:`${$V}-${R}`,"aria-label":M,children:W.jsx(i_e,{value:n,children:W.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:a,selected:u,isConnectable:v,sourcePosition:w,targetPosition:C,dragging:ot,dragHandle:k,zIndex:N})})})};return t.displayName="NodeWrapper",I.memo(t)};const q_e=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Pk(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function W_e({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=pi(),{width:i,height:o,x:a,y:s,transformString:l,userSelectionActive:u}=_r(q_e,No),c=HV(),d=I.useRef(null);if(I.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),GV({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(_=>_.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Th,p.key)&&c({x:Th[p.key].x,y:Th[p.key].y,isShiftPressed:p.shiftKey})};return W.jsx("div",{className:Ma(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:W.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:s,left:a}})})}var K_e=I.memo(W_e);const Q_e=e=>e.nodesSelectionActive,qV=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,deleteKeyCode:s,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:x,panOnScrollSpeed:w,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:E,defaultViewport:k,translateExtent:N,minZoom:O,maxZoom:A,preventScrolling:P,onSelectionContextMenu:D,noWheelClassName:L,noPanClassName:M,disableKeyboardA11y:R})=>{const $=_r(Q_e),B=P0(d),G=P0(b)||E,Y=B||f&&G!==!0;return N_e({deleteKeyCode:s,multiSelectionKeyCode:_}),W.jsx(B_e,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:x,panOnScrollSpeed:w,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:!B&&G,defaultViewport:k,translateExtent:N,minZoom:O,maxZoom:A,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:L,noPanClassName:M,children:W.jsxs(jV,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:G,isSelecting:!!Y,selectionMode:h,children:[e,$&&W.jsx(K_e,{onSelectionContextMenu:D,noPanClassName:M,disableKeyboardA11y:R})]})})};qV.displayName="FlowRenderer";var X_e=I.memo(qV);function Y_e(e){return _r(I.useCallback(n=>e?xV(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function Z_e(e){const t={input:ug(e.input||IV),default:ug(e.default||JA),output:ug(e.output||OV),group:ug(e.group||Ok)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=ug(e[o]||JA),i),n);return{...t,...r}}const J_e=({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]},eSe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),WV=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:a}=_r(eSe,No),s=Y_e(e.onlyRenderVisibleElements),l=I.useRef(),u=I.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return I.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),W.jsx("div",{className:"react-flow__nodes",style:Mk,children:s.map(c=>{var S,x;let d=c.type||"default";e.nodeTypes[d]||(a==null||a("003",Jl.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),b=e.nodeExtent?Ck(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=(b==null?void 0:b.x)??0,g=(b==null?void 0:b.y)??0,v=J_e({x:y,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return W.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||tt.Bottom,targetPosition:c.targetPosition||tt.Top,hidden:c.hidden,xPos:y,yPos:g,xPosOrigin:v.x,yPosOrigin:v.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Xr])==null?void 0:S.z)??0,isParent:!!((x=c[Xr])!=null&&x.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};WV.displayName="NodeRenderer";var tSe=I.memo(WV);const nSe=(e,t,n)=>n===tt.Left?e-t:n===tt.Right?e+t:e,rSe=(e,t,n)=>n===tt.Top?e-t:n===tt.Bottom?e+t:e,K9="react-flow__edgeupdater",Q9=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s})=>W.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:Ma([K9,`${K9}-${s}`]),cx:nSe(t,r,e),cy:rSe(n,r,e),r,stroke:"transparent",fill:"transparent"}),iSe=()=>!0;var xf=e=>{const t=({id:n,className:r,type:i,data:o,onClick:a,onEdgeDoubleClick:s,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:_,source:b,target:y,sourceX:g,sourceY:v,targetX:S,targetY:x,sourcePosition:w,targetPosition:C,elementsSelectable:T,hidden:E,sourceHandleId:k,targetHandleId:N,onContextMenu:O,onMouseEnter:A,onMouseMove:P,onMouseLeave:D,edgeUpdaterRadius:L,onEdgeUpdate:M,onEdgeUpdateStart:R,onEdgeUpdateEnd:$,markerEnd:B,markerStart:U,rfId:G,ariaLabel:Y,isFocusable:ee,isUpdatable:J,pathOptions:j,interactionWidth:Q})=>{const ne=I.useRef(null),[se,Se]=I.useState(!1),[ce,bt]=I.useState(!1),ot=pi(),ze=I.useMemo(()=>`url(#${ZA(U,G)})`,[U,G]),mt=I.useMemo(()=>`url(#${ZA(B,G)})`,[B,G]);if(E)return null;const Ie=Fn=>{const{edges:_n,addSelectedEdges:Mi}=ot.getState();if(T&&(ot.setState({nodesSelectionActive:!1}),Mi([n])),a){const gi=_n.find(Xi=>Xi.id===n);a(Fn,gi)}},en=sg(n,ot.getState,s),Ir=sg(n,ot.getState,O),Dn=sg(n,ot.getState,A),Tn=sg(n,ot.getState,P),tn=sg(n,ot.getState,D),Ln=(Fn,_n)=>{if(Fn.button!==0)return;const{edges:Mi,isValidConnection:gi}=ot.getState(),Xi=_n?y:b,Ua=(_n?N:k)||null,Or=_n?"target":"source",yo=gi||iSe,dl=_n,Fo=Mi.find(nn=>nn.id===n);bt(!0),R==null||R(Fn,Fo,Or);const fl=nn=>{bt(!1),$==null||$(nn,Fo,Or)};EV({event:Fn,handleId:Ua,nodeId:Xi,onConnect:nn=>M==null?void 0:M(Fo,nn),isTarget:dl,getState:ot.getState,setState:ot.setState,isValidConnection:yo,edgeUpdaterType:Or,onEdgeUpdateEnd:fl})},Rr=Fn=>Ln(Fn,!0),mo=Fn=>Ln(Fn,!1),Jr=()=>Se(!0),pr=()=>Se(!1),zr=!T&&!a,ei=Fn=>{var _n;if(hV.includes(Fn.key)&&T){const{unselectNodesAndEdges:Mi,addSelectedEdges:gi,edges:Xi}=ot.getState();Fn.key==="Escape"?((_n=ne.current)==null||_n.blur(),Mi({edges:[Xi.find(Or=>Or.id===n)]})):gi([n])}};return W.jsxs("g",{className:Ma(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:zr,updating:se}]),onClick:Ie,onDoubleClick:en,onContextMenu:Ir,onMouseEnter:Dn,onMouseMove:Tn,onMouseLeave:tn,onKeyDown:ee?ei:void 0,tabIndex:ee?0:void 0,role:ee?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Y===null?void 0:Y||`Edge from ${b} to ${y}`,"aria-describedby":ee?`${NV}-${G}`:void 0,ref:ne,children:[!ce&&W.jsx(e,{id:n,source:b,target:y,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:_,sourceX:g,sourceY:v,targetX:S,targetY:x,sourcePosition:w,targetPosition:C,sourceHandleId:k,targetHandleId:N,markerStart:ze,markerEnd:mt,pathOptions:j,interactionWidth:Q}),J&&W.jsxs(W.Fragment,{children:[(J==="source"||J===!0)&&W.jsx(Q9,{position:w,centerX:g,centerY:v,radius:L,onMouseDown:Rr,onMouseEnter:Jr,onMouseOut:pr,type:"source"}),(J==="target"||J===!0)&&W.jsx(Q9,{position:C,centerX:S,centerY:x,radius:L,onMouseDown:mo,onMouseEnter:Jr,onMouseOut:pr,type:"target"})]})]})};return t.displayName="EdgeWrapper",I.memo(t)};function oSe(e){const t={default:xf(e.default||W_),straight:xf(e.bezier||Tk),step:xf(e.step||Ek),smoothstep:xf(e.step||fx),simplebezier:xf(e.simplebezier||Ak)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=xf(e[o]||W_),i),n);return{...t,...r}}function X9(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,a=(n==null?void 0:n.height)||t.height;switch(e){case tt.Top:return{x:r+o/2,y:i};case tt.Right:return{x:r+o,y:i+a/2};case tt.Bottom:return{x:r+o/2,y:i+a};case tt.Left:return{x:r,y:i+a/2}}}function Y9(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const aSe=(e,t,n,r,i,o)=>{const a=X9(n,e,t),s=X9(o,r,i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}};function sSe({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:a,height:s,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 c=k0({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:s/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function Z9(e){var r,i,o,a,s;const t=((r=e==null?void 0:e[Xr])==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:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const lSe=[{level:0,isMaxLevel:!0,edges:[]}];function uSe(e,t,n=!1){let r=-1;const i=e.reduce((a,s)=>{var c,d;const l=Ca(s.zIndex);let u=l?s.zIndex:0;if(n){const f=t.get(s.target),h=t.get(s.source),p=s.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[Xr])==null?void 0:c.z)||0,((d=f==null?void 0:f[Xr])==null?void 0:d.z)||0,1e3);u=(l?s.zIndex:0)+(p?m:0)}return a[u]?a[u].push(s):a[u]=[s],r=u>r?u:r,a},{}),o=Object.entries(i).map(([a,s])=>{const l=+a;return{edges:s,level:l,isMaxLevel:l===r}});return o.length===0?lSe:o}function cSe(e,t,n){const r=_r(I.useCallback(i=>e?i.edges.filter(o=>{const a=t.get(o.source),s=t.get(o.target);return(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&sSe({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return uSe(r,t,n)}const dSe=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),fSe=({color:e="none",strokeWidth:t=1})=>W.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),J9={[q_.Arrow]:dSe,[q_.ArrowClosed]:fSe};function hSe(e){const t=pi();return I.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(J9,e)?J9[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",Jl.error009(e)),null)},[e])}const pSe=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const l=hSe(t);return l?W.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0",children:W.jsx(l,{color:n,strokeWidth:a})}):null},gSe=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const s=ZA(a,t);r.includes(s)||(i.push({id:s,color:a.color||e,...a}),r.push(s))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},KV=({defaultColor:e,rfId:t})=>{const n=_r(I.useCallback(gSe({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,a)=>o.id!==i[a].id)));return W.jsx("defs",{children:n.map(r=>W.jsx(pSe,{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))})};KV.displayName="MarkerDefinitions";var mSe=I.memo(KV);const ySe=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}),QV=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:a,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:_})=>{const{edgesFocusable:b,edgesUpdatable:y,elementsSelectable:g,width:v,height:S,connectionMode:x,nodeInternals:w,onError:C}=_r(ySe,No),T=cSe(t,w,n);return v?W.jsxs(W.Fragment,{children:[T.map(({level:E,edges:k,isMaxLevel:N})=>W.jsxs("svg",{style:{zIndex:E},width:v,height:S,className:"react-flow__edges react-flow__container",children:[N&&W.jsx(mSe,{defaultColor:e,rfId:r}),W.jsx("g",{children:k.map(O=>{const[A,P,D]=Z9(w.get(O.source)),[L,M,R]=Z9(w.get(O.target));if(!D||!R)return null;let $=O.type||"default";i[$]||(C==null||C("011",Jl.error011($)),$="default");const B=i[$]||i.default,U=x===Vd.Strict?M.target:(M.target??[]).concat(M.source??[]),G=Y9(P.source,O.sourceHandle),Y=Y9(U,O.targetHandle),ee=(G==null?void 0:G.position)||tt.Bottom,J=(Y==null?void 0:Y.position)||tt.Top,j=!!(O.focusable||b&&typeof O.focusable>"u"),Q=typeof a<"u"&&(O.updatable||y&&typeof O.updatable>"u");if(!G||!Y)return C==null||C("008",Jl.error008(G,O)),null;const{sourceX:ne,sourceY:se,targetX:Se,targetY:ce}=aSe(A,G,ee,L,Y,J);return W.jsx(B,{id:O.id,className:Ma([O.className,o]),type:$,data:O.data,selected:!!O.selected,animated:!!O.animated,hidden:!!O.hidden,label:O.label,labelStyle:O.labelStyle,labelShowBg:O.labelShowBg,labelBgStyle:O.labelBgStyle,labelBgPadding:O.labelBgPadding,labelBgBorderRadius:O.labelBgBorderRadius,style:O.style,source:O.source,target:O.target,sourceHandleId:O.sourceHandle,targetHandleId:O.targetHandle,markerEnd:O.markerEnd,markerStart:O.markerStart,sourceX:ne,sourceY:se,targetX:Se,targetY:ce,sourcePosition:ee,targetPosition:J,elementsSelectable:g,onEdgeUpdate:a,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:O.ariaLabel,isFocusable:j,isUpdatable:Q,pathOptions:"pathOptions"in O?O.pathOptions:void 0,interactionWidth:O.interactionWidth},O.id)})})]},E)),_]}):null};QV.displayName="EdgeRenderer";var vSe=I.memo(QV);const bSe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function _Se({children:e}){const t=_r(bSe);return W.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function SSe(e){const t=BV(),n=I.useRef(!1);I.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const xSe={[tt.Left]:tt.Right,[tt.Right]:tt.Left,[tt.Top]:tt.Bottom,[tt.Bottom]:tt.Top},XV=({nodeId:e,handleType:t,style:n,type:r=$u.Bezier,CustomComponent:i,connectionStatus:o})=>{var x,w,C;const{fromNode:a,handleId:s,toX:l,toY:u,connectionMode:c}=_r(I.useCallback(T=>({fromNode:T.nodeInternals.get(e),handleId:T.connectionHandleId,toX:(T.connectionPosition.x-T.transform[0])/T.transform[2],toY:(T.connectionPosition.y-T.transform[1])/T.transform[2],connectionMode:T.connectionMode}),[e]),No),d=(x=a==null?void 0:a[Xr])==null?void 0:x.handleBounds;let f=d==null?void 0:d[t];if(c===Vd.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!a||!f)return null;const h=s?f.find(T=>T.id===s):f[0],p=h?h.x+h.width/2:(a.width??0)/2,m=h?h.y+h.height/2:a.height??0,_=(((w=a.positionAbsolute)==null?void 0:w.x)??0)+p,b=(((C=a.positionAbsolute)==null?void 0:C.y)??0)+m,y=h==null?void 0:h.position,g=y?xSe[y]:null;if(!y||!g)return null;if(i)return W.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:h,fromX:_,fromY:b,toX:l,toY:u,fromPosition:y,toPosition:g,connectionStatus:o});let v="";const S={sourceX:_,sourceY:b,sourcePosition:y,targetX:l,targetY:u,targetPosition:g};return r===$u.Bezier?[v]=vV(S):r===$u.Step?[v]=YA({...S,borderRadius:0}):r===$u.SmoothStep?[v]=YA(S):r===$u.SimpleBezier?[v]=yV(S):v=`M${_},${b} ${l},${u}`,W.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};XV.displayName="ConnectionLine";const wSe=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function CSe({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:a,width:s,height:l,connectionStatus:u}=_r(wSe,No);return!(i&&o&&s&&a)?null:W.jsx("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:W.jsx("g",{className:Ma(["react-flow__connection",u]),children:W.jsx(XV,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}function eO(e,t){return I.useRef(null),pi(),I.useMemo(()=>t(e),[e])}const YV=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:a,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:_,connectionLineType:b,connectionLineStyle:y,connectionLineComponent:g,connectionLineContainerStyle:v,selectionKeyCode:S,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:E,deleteKeyCode:k,onlyRenderVisibleElements:N,elementsSelectable:O,selectNodesOnDrag:A,defaultViewport:P,translateExtent:D,minZoom:L,maxZoom:M,preventScrolling:R,defaultMarkerColor:$,zoomOnScroll:B,zoomOnPinch:U,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,zoomOnDoubleClick:J,panOnDrag:j,onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:Se,onPaneScroll:ce,onPaneContextMenu:bt,onEdgeUpdate:ot,onEdgeContextMenu:ze,onEdgeMouseEnter:mt,onEdgeMouseMove:Ie,onEdgeMouseLeave:en,edgeUpdaterRadius:Ir,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:Tn,noDragClassName:tn,noWheelClassName:Ln,noPanClassName:Rr,elevateEdgesOnSelect:mo,disableKeyboardA11y:Jr,nodeOrigin:pr,nodeExtent:zr,rfId:ei})=>{const Fn=eO(e,Z_e),_n=eO(t,oSe);return SSe(o),W.jsx(X_e,{onPaneClick:Q,onPaneMouseEnter:ne,onPaneMouseMove:se,onPaneMouseLeave:Se,onPaneContextMenu:bt,onPaneScroll:ce,deleteKeyCode:k,selectionKeyCode:S,selectionOnDrag:x,selectionMode:w,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:E,elementsSelectable:O,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:B,zoomOnPinch:U,zoomOnDoubleClick:J,panOnScroll:G,panOnScrollSpeed:Y,panOnScrollMode:ee,panOnDrag:j,defaultViewport:P,translateExtent:D,minZoom:L,maxZoom:M,onSelectionContextMenu:p,preventScrolling:R,noDragClassName:tn,noWheelClassName:Ln,noPanClassName:Rr,disableKeyboardA11y:Jr,children:W.jsxs(_Se,{children:[W.jsx(vSe,{edgeTypes:_n,onEdgeClick:s,onEdgeDoubleClick:u,onEdgeUpdate:ot,onlyRenderVisibleElements:N,onEdgeContextMenu:ze,onEdgeMouseEnter:mt,onEdgeMouseMove:Ie,onEdgeMouseLeave:en,onEdgeUpdateStart:Dn,onEdgeUpdateEnd:Tn,edgeUpdaterRadius:Ir,defaultMarkerColor:$,noPanClassName:Rr,elevateEdgesOnSelect:!!mo,disableKeyboardA11y:Jr,rfId:ei,children:W.jsx(CSe,{style:y,type:b,component:g,containerStyle:v})}),W.jsx("div",{className:"react-flow__edgelabel-renderer"}),W.jsx(tSe,{nodeTypes:Fn,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:A,onlyRenderVisibleElements:N,noPanClassName:Rr,noDragClassName:tn,disableKeyboardA11y:Jr,nodeOrigin:pr,nodeExtent:zr,rfId:ei})]})})};YV.displayName="GraphView";var ASe=I.memo(YV);const tE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],yu={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:tE,nodeExtent:tE,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Vd.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:Zbe,isValidConnection:void 0},ESe=()=>fye((e,t)=>({...yu,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:t5(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",a=i?t5(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:a,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:a,fitViewOnInitOptions:s,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const b=i.get(_.id);if(b){const y=wk(_.nodeElement);!!(y.width&&y.height&&(b.width!==y.width||b.height!==y.height||_.forceUpdate))&&(i.set(b.id,{...b,[Xr]:{...b[Xr],handleBounds:{source:W9(".source",_.nodeElement,f,u),target:W9(".target",_.nodeElement,f,u)}},...y}),m.push({id:b.id,type:"dimensions",dimensions:y}))}return m},[]);LV(i,u);const p=a||o&&!a&&FV(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),a=n.map(s=>{const l={id:s.id,type:"position",dragging:i};return r&&(l.positionAbsolute=s.positionAbsolute,l.position=s.position),l});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:a,getNodes:s,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=Qc(n,s()),c=t5(u,i,a,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>Tu(l,!0)):(a=Qf(o(),n),s=Qf(i,[])),Qv({changedNodes:a,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>Tu(l,!0)):(a=Qf(i,n),s=Qf(o(),[])),Qv({changedNodes:s,changedEdges:a,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),a=n||o(),s=r||i,l=a.map(c=>(c.selected=!1,Tu(c.id,!1))),u=s.map(c=>Tu(c.id,!1));Qv({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(s=>s.selected).map(s=>Tu(s.id,!1)),a=n.filter(s=>s.selected).map(s=>Tu(s.id,!1));Qv({changedNodes:o,changedEdges:a,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=Ck(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:a,d3Selection:s,translateExtent:l}=t();if(!a||!s||!n.x&&!n.y)return!1;const u=nc.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=a==null?void 0:a.constrain()(u,c,l);return a.transform(s,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:yu.connectionNodeId,connectionHandleId:yu.connectionHandleId,connectionHandleType:yu.connectionHandleType,connectionStatus:yu.connectionStatus,connectionStartHandle:yu.connectionStartHandle,connectionEndHandle:yu.connectionEndHandle}),reset:()=>e({...yu})}),Object.is),ZV=({children:e})=>{const t=I.useRef(null);return t.current||(t.current=ESe()),W.jsx(Hbe,{value:t.current,children:e})};ZV.displayName="ReactFlowProvider";const JV=({children:e})=>I.useContext(dx)?W.jsx(W.Fragment,{children:e}):W.jsx(ZV,{children:e});JV.displayName="ReactFlowWrapper";const TSe={input:IV,default:JA,output:OV,group:Ok},kSe={default:W_,straight:Tk,step:Ek,smoothstep:fx,simplebezier:Ak},PSe=[0,0],ISe=[15,15],RSe={x:0,y:0,zoom:1},OSe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},MSe=I.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=TSe,edgeTypes:a=kSe,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:x,onNodeDragStart:w,onNodeDrag:C,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:k,onSelectionChange:N,onSelectionDragStart:O,onSelectionDrag:A,onSelectionDragStop:P,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,connectionMode:R=Vd.Strict,connectionLineType:$=$u.Bezier,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,deleteKeyCode:Y="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:J=!1,selectionMode:j=gc.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:ne=H_()?"Meta":"Control",zoomActivationKeyCode:se=H_()?"Meta":"Control",snapToGrid:Se=!1,snapGrid:ce=ISe,onlyRenderVisibleElements:bt=!1,selectNodesOnDrag:ot=!0,nodesDraggable:ze,nodesConnectable:mt,nodesFocusable:Ie,nodeOrigin:en=PSe,edgesFocusable:Ir,edgesUpdatable:Dn,elementsSelectable:Tn,defaultViewport:tn=RSe,minZoom:Ln=.5,maxZoom:Rr=2,translateExtent:mo=tE,preventScrolling:Jr=!0,nodeExtent:pr,defaultMarkerColor:zr="#b1b1b7",zoomOnScroll:ei=!0,zoomOnPinch:Fn=!0,panOnScroll:_n=!1,panOnScrollSpeed:Mi=.5,panOnScrollMode:gi=pd.Free,zoomOnDoubleClick:Xi=!0,panOnDrag:Ua=!0,onPaneClick:Or,onPaneMouseEnter:yo,onPaneMouseMove:dl,onPaneMouseLeave:Fo,onPaneScroll:fl,onPaneContextMenu:Bn,children:nn,onEdgeUpdate:jr,onEdgeContextMenu:Mr,onEdgeDoubleClick:$r,onEdgeMouseEnter:ti,onEdgeMouseMove:$i,onEdgeMouseLeave:vo,onEdgeUpdateStart:mi,onEdgeUpdateEnd:Ur,edgeUpdaterRadius:Va=10,onNodesChange:_s,onEdgesChange:yi,noDragClassName:du="nodrag",noWheelClassName:ua="nowheel",noPanClassName:ni="nopan",fitView:hl=!1,fitViewOptions:q,connectOnClick:te=!0,attributionPosition:re,proOptions:de,defaultEdgeOptions:oe,elevateNodesOnSelect:je=!0,elevateEdgesOnSelect:Ge=!1,disableKeyboardA11y:ut=!1,autoPanOnConnect:Le=!0,autoPanOnNodeDrag:He=!0,connectionRadius:Re=20,isValidConnection:ie,onError:we,style:Ye,id:Ze,...ct},ht)=>{const _t=Ze||"1";return W.jsx("div",{...ct,style:{...Ye,...OSe},ref:ht,className:Ma(["react-flow",i]),"data-testid":"rf__wrapper",id:Ze,children:W.jsxs(JV,{children:[W.jsx(ASe,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:x,nodeTypes:o,edgeTypes:a,connectionLineType:$,connectionLineStyle:B,connectionLineComponent:U,connectionLineContainerStyle:G,selectionKeyCode:ee,selectionOnDrag:J,selectionMode:j,deleteKeyCode:Y,multiSelectionKeyCode:ne,panActivationKeyCode:Q,zoomActivationKeyCode:se,onlyRenderVisibleElements:bt,selectNodesOnDrag:ot,defaultViewport:tn,translateExtent:mo,minZoom:Ln,maxZoom:Rr,preventScrolling:Jr,zoomOnScroll:ei,zoomOnPinch:Fn,zoomOnDoubleClick:Xi,panOnScroll:_n,panOnScrollSpeed:Mi,panOnScrollMode:gi,panOnDrag:Ua,onPaneClick:Or,onPaneMouseEnter:yo,onPaneMouseMove:dl,onPaneMouseLeave:Fo,onPaneScroll:fl,onPaneContextMenu:Bn,onSelectionContextMenu:D,onSelectionStart:L,onSelectionEnd:M,onEdgeUpdate:jr,onEdgeContextMenu:Mr,onEdgeDoubleClick:$r,onEdgeMouseEnter:ti,onEdgeMouseMove:$i,onEdgeMouseLeave:vo,onEdgeUpdateStart:mi,onEdgeUpdateEnd:Ur,edgeUpdaterRadius:Va,defaultMarkerColor:zr,noDragClassName:du,noWheelClassName:ua,noPanClassName:ni,elevateEdgesOnSelect:Ge,rfId:_t,disableKeyboardA11y:ut,nodeOrigin:en,nodeExtent:pr}),W.jsx(w_e,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:b,nodesDraggable:ze,nodesConnectable:mt,nodesFocusable:Ie,edgesFocusable:Ir,edgesUpdatable:Dn,elementsSelectable:Tn,elevateNodesOnSelect:je,minZoom:Ln,maxZoom:Rr,nodeExtent:pr,onNodesChange:_s,onEdgesChange:yi,snapToGrid:Se,snapGrid:ce,connectionMode:R,translateExtent:mo,connectOnClick:te,defaultEdgeOptions:oe,fitView:hl,fitViewOptions:q,onNodesDelete:E,onEdgesDelete:k,onNodeDragStart:w,onNodeDrag:C,onNodeDragStop:T,onSelectionDrag:A,onSelectionDragStart:O,onSelectionDragStop:P,noPanClassName:ni,nodeOrigin:en,rfId:_t,autoPanOnConnect:Le,autoPanOnNodeDrag:He,onError:we,connectionRadius:Re,isValidConnection:ie}),W.jsx(S_e,{onSelectionChange:N}),nn,W.jsx(Kbe,{proOptions:de,position:re}),W.jsx(k_e,{rfId:_t,disableKeyboardA11y:ut})]})})});MSe.displayName="ReactFlow";const $Se=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function uqe({children:e}){const t=_r($Se);return t?Wo.createPortal(e,t):null}function cqe(){const e=pi();return I.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((a,s)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return l&&a.push({id:s,nodeElement:l,forceUpdate:!0}),a},[]);requestAnimationFrame(()=>r(o))},[])}function NSe(){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 I0=t_("nodes/receivedOpenAPISchema",async(e,{rejectWithValue:t})=>{try{const n=[window.location.origin,"openapi.json"].join("/"),i=await(await fetch(n)).json();return JSON.parse(JSON.stringify(i,NSe()))}catch(n){return t({error:n})}}),dqe=500,fqe=320,DSe="node-drag-handle",hqe=["ImageField","ImageCollection"],pqe={input:"inputs",output:"outputs"},Yv=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection","T2IAdapterCollection","IPAdapterCollection"],Ng=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic","T2IAdapterPolymorphic","IPAdapterPolymorphic"],gqe=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField","T2IAdapterModelField","IPAdapterModelField"],$k={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection",T2IAdapterField:"T2IAdapterCollection",IPAdapterField:"IPAdapterCollection"},LSe=e=>!!(e&&e in $k),eG={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic",T2IAdapterField:"T2IAdapterPolymorphic",IPAdapterField:"IPAdapterPolymorphic"},FSe={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField",T2IAdapterPolymorphic:"T2IAdapterField",IPAdapterPolymorphic:"IPAdapterField"},mqe=["string","StringPolymorphic","boolean","BooleanPolymorphic","integer","float","FloatPolymorphic","IntegerPolymorphic","enum","ImageField","ImagePolymorphic","MainModelField","SDXLRefinerModelField","VaeModelField","LoRAModelField","ControlNetModelField","ColorField","SDXLMainModelField","Scheduler","IPAdapterModelField","BoardField","T2IAdapterModelField"],BSe=e=>!!(e&&e in eG),yqe={boolean:{color:"green.500",description:Z("nodes.booleanDescription"),title:Z("nodes.boolean")},BooleanCollection:{color:"green.500",description:Z("nodes.booleanCollectionDescription"),title:Z("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:Z("nodes.booleanPolymorphicDescription"),title:Z("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:Z("nodes.clipFieldDescription"),title:Z("nodes.clipField")},Collection:{color:"base.500",description:Z("nodes.collectionDescription"),title:Z("nodes.collection")},CollectionItem:{color:"base.500",description:Z("nodes.collectionItemDescription"),title:Z("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:Z("nodes.colorCollectionDescription"),title:Z("nodes.colorCollection")},ColorField:{color:"pink.300",description:Z("nodes.colorFieldDescription"),title:Z("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:Z("nodes.colorPolymorphicDescription"),title:Z("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:Z("nodes.conditioningCollectionDescription"),title:Z("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:Z("nodes.conditioningFieldDescription"),title:Z("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:Z("nodes.conditioningPolymorphicDescription"),title:Z("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:Z("nodes.controlCollectionDescription"),title:Z("nodes.controlCollection")},ControlField:{color:"teal.500",description:Z("nodes.controlFieldDescription"),title:Z("nodes.controlField")},ControlNetModelField:{color:"teal.500",description:"TODO",title:"ControlNet"},ControlPolymorphic:{color:"teal.500",description:"Control info passed between nodes.",title:"Control Polymorphic"},DenoiseMaskField:{color:"blue.300",description:Z("nodes.denoiseMaskFieldDescription"),title:Z("nodes.denoiseMaskField")},enum:{color:"blue.500",description:Z("nodes.enumDescription"),title:Z("nodes.enum")},float:{color:"orange.500",description:Z("nodes.floatDescription"),title:Z("nodes.float")},FloatCollection:{color:"orange.500",description:Z("nodes.floatCollectionDescription"),title:Z("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:Z("nodes.floatPolymorphicDescription"),title:Z("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:Z("nodes.imageCollectionDescription"),title:Z("nodes.imageCollection")},ImageField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},BoardField:{color:"purple.500",description:Z("nodes.imageFieldDescription"),title:Z("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:Z("nodes.imagePolymorphicDescription"),title:Z("nodes.imagePolymorphic")},integer:{color:"red.500",description:Z("nodes.integerDescription"),title:Z("nodes.integer")},IntegerCollection:{color:"red.500",description:Z("nodes.integerCollectionDescription"),title:Z("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:Z("nodes.integerPolymorphicDescription"),title:Z("nodes.integerPolymorphic")},IPAdapterCollection:{color:"teal.500",description:Z("nodes.ipAdapterCollectionDescription"),title:Z("nodes.ipAdapterCollection")},IPAdapterField:{color:"teal.500",description:Z("nodes.ipAdapterDescription"),title:Z("nodes.ipAdapter")},IPAdapterModelField:{color:"teal.500",description:Z("nodes.ipAdapterModelDescription"),title:Z("nodes.ipAdapterModel")},IPAdapterPolymorphic:{color:"teal.500",description:Z("nodes.ipAdapterPolymorphicDescription"),title:Z("nodes.ipAdapterPolymorphic")},LatentsCollection:{color:"pink.500",description:Z("nodes.latentsCollectionDescription"),title:Z("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:Z("nodes.latentsFieldDescription"),title:Z("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:Z("nodes.latentsPolymorphicDescription"),title:Z("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:Z("nodes.loRAModelFieldDescription"),title:Z("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:Z("nodes.mainModelFieldDescription"),title:Z("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:Z("nodes.oNNXModelFieldDescription"),title:Z("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:Z("nodes.schedulerDescription"),title:Z("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:Z("nodes.sDXLMainModelFieldDescription"),title:Z("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:Z("nodes.sDXLRefinerModelFieldDescription"),title:Z("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:Z("nodes.stringDescription"),title:Z("nodes.string")},StringCollection:{color:"yellow.500",description:Z("nodes.stringCollectionDescription"),title:Z("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:Z("nodes.stringPolymorphicDescription"),title:Z("nodes.stringPolymorphic")},T2IAdapterCollection:{color:"teal.500",description:Z("nodes.t2iAdapterCollectionDescription"),title:Z("nodes.t2iAdapterCollection")},T2IAdapterField:{color:"teal.500",description:Z("nodes.t2iAdapterFieldDescription"),title:Z("nodes.t2iAdapterField")},T2IAdapterModelField:{color:"teal.500",description:"TODO",title:"T2I-Adapter"},T2IAdapterPolymorphic:{color:"teal.500",description:"T2I-Adapter info passed between nodes.",title:"T2I-Adapter Polymorphic"},UNetField:{color:"red.500",description:Z("nodes.uNetFieldDescription"),title:Z("nodes.uNetField")},VaeField:{color:"blue.500",description:Z("nodes.vaeFieldDescription"),title:Z("nodes.vaeField")},VaeModelField:{color:"teal.500",description:Z("nodes.vaeModelFieldDescription"),title:Z("nodes.vaeModelField")}},tO=(e,t,n)=>{let r=t,i=n;for(;e.find(o=>o.position.x===r&&o.position.y===i);)r=r+50,i=i+50;return{x:r,y:i}},zSe=(e,t)=>{if(e==="Collection"&&t==="Collection")return!1;if(e===t)return!0;const n=e==="CollectionItem"&&!Yv.includes(t),r=t==="CollectionItem"&&!Yv.includes(e)&&!Ng.includes(e),i=Ng.includes(t)&&(()=>{if(!Ng.includes(t))return!1;const u=FSe[t],c=$k[u];return e===u||e===c})(),o=e==="Collection"&&(Yv.includes(t)||Ng.includes(t)),a=t==="Collection"&&Yv.includes(e);return n||r||i||o||a||e==="integer"&&t==="float"||(e==="integer"||e==="float")&&t==="string"};var jSe="\0",zc="\0",nO="",So,yd,Vo,J0,Lh,Fh,ya,Rs,Du,Os,Lu,Tl,kl,Bh,zh,Pl,Xa,ey,nE,iN;let USe=(iN=class{constructor(t){Yn(this,ey);Yn(this,So,!0);Yn(this,yd,!1);Yn(this,Vo,!1);Yn(this,J0,void 0);Yn(this,Lh,()=>{});Yn(this,Fh,()=>{});Yn(this,ya,{});Yn(this,Rs,{});Yn(this,Du,{});Yn(this,Os,{});Yn(this,Lu,{});Yn(this,Tl,{});Yn(this,kl,{});Yn(this,Bh,0);Yn(this,zh,0);Yn(this,Pl,void 0);Yn(this,Xa,void 0);t&&(ca(this,So,t.hasOwnProperty("directed")?t.directed:!0),ca(this,yd,t.hasOwnProperty("multigraph")?t.multigraph:!1),ca(this,Vo,t.hasOwnProperty("compound")?t.compound:!1)),ae(this,Vo)&&(ca(this,Pl,{}),ca(this,Xa,{}),ae(this,Xa)[zc]={})}isDirected(){return ae(this,So)}isMultigraph(){return ae(this,yd)}isCompound(){return ae(this,Vo)}setGraph(t){return ca(this,J0,t),this}graph(){return ae(this,J0)}setDefaultNodeLabel(t){return ca(this,Lh,t),typeof t!="function"&&ca(this,Lh,()=>t),this}nodeCount(){return ae(this,Bh)}nodes(){return Object.keys(ae(this,ya))}sources(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Rs)[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(ae(t,Os)[n]).length===0)}setNodes(t,n){var r=arguments,i=this;return t.forEach(function(o){r.length>1?i.setNode(o,n):i.setNode(o)}),this}setNode(t,n){return ae(this,ya).hasOwnProperty(t)?(arguments.length>1&&(ae(this,ya)[t]=n),this):(ae(this,ya)[t]=arguments.length>1?n:ae(this,Lh).call(this,t),ae(this,Vo)&&(ae(this,Pl)[t]=zc,ae(this,Xa)[t]={},ae(this,Xa)[zc][t]=!0),ae(this,Rs)[t]={},ae(this,Du)[t]={},ae(this,Os)[t]={},ae(this,Lu)[t]={},++Vp(this,Bh)._,this)}node(t){return ae(this,ya)[t]}hasNode(t){return ae(this,ya).hasOwnProperty(t)}removeNode(t){var n=this;if(ae(this,ya).hasOwnProperty(t)){var r=i=>n.removeEdge(ae(n,Tl)[i]);delete ae(this,ya)[t],ae(this,Vo)&&(Ss(this,ey,nE).call(this,t),delete ae(this,Pl)[t],this.children(t).forEach(function(i){n.setParent(i)}),delete ae(this,Xa)[t]),Object.keys(ae(this,Rs)[t]).forEach(r),delete ae(this,Rs)[t],delete ae(this,Du)[t],Object.keys(ae(this,Os)[t]).forEach(r),delete ae(this,Os)[t],delete ae(this,Lu)[t],--Vp(this,Bh)._}return this}setParent(t,n){if(!ae(this,Vo))throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=zc;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),Ss(this,ey,nE).call(this,t),ae(this,Pl)[t]=n,ae(this,Xa)[n][t]=!0,this}parent(t){if(ae(this,Vo)){var n=ae(this,Pl)[t];if(n!==zc)return n}}children(t=zc){if(ae(this,Vo)){var n=ae(this,Xa)[t];if(n)return Object.keys(n)}else{if(t===zc)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=ae(this,Du)[t];if(n)return Object.keys(n)}successors(t){var n=ae(this,Lu)[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const i=new Set(n);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:ae(this,So),multigraph:ae(this,yd),compound:ae(this,Vo)});n.setGraph(this.graph());var r=this;Object.entries(ae(this,ya)).forEach(function([a,s]){t(a)&&n.setNode(a,s)}),Object.values(ae(this,Tl)).forEach(function(a){n.hasNode(a.v)&&n.hasNode(a.w)&&n.setEdge(a,r.edge(a))});var i={};function o(a){var s=r.parent(a);return s===void 0||n.hasNode(s)?(i[a]=s,s):s in i?i[s]:o(s)}return ae(this,Vo)&&n.nodes().forEach(a=>n.setParent(a,o(a))),n}setDefaultEdgeLabel(t){return ca(this,Fh,t),typeof t!="function"&&ca(this,Fh,()=>t),this}edgeCount(){return ae(this,zh)}edges(){return Object.values(ae(this,Tl))}setPath(t,n){var r=this,i=arguments;return t.reduce(function(o,a){return i.length>1?r.setEdge(o,a,n):r.setEdge(o,a),a}),this}setEdge(){var t,n,r,i,o=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(t=a.v,n=a.w,r=a.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=a,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var s=Dg(ae(this,So),t,n,r);if(ae(this,kl).hasOwnProperty(s))return o&&(ae(this,kl)[s]=i),this;if(r!==void 0&&!ae(this,yd))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),ae(this,kl)[s]=o?i:ae(this,Fh).call(this,t,n,r);var l=VSe(ae(this,So),t,n,r);return t=l.v,n=l.w,Object.freeze(l),ae(this,Tl)[s]=l,rO(ae(this,Du)[n],t),rO(ae(this,Lu)[t],n),ae(this,Rs)[n][s]=l,ae(this,Os)[t][s]=l,Vp(this,zh)._++,this}edge(t,n,r){var i=arguments.length===1?o5(ae(this,So),arguments[0]):Dg(ae(this,So),t,n,r);return ae(this,kl)[i]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var i=arguments.length===1?o5(ae(this,So),arguments[0]):Dg(ae(this,So),t,n,r);return ae(this,kl).hasOwnProperty(i)}removeEdge(t,n,r){var i=arguments.length===1?o5(ae(this,So),arguments[0]):Dg(ae(this,So),t,n,r),o=ae(this,Tl)[i];return o&&(t=o.v,n=o.w,delete ae(this,kl)[i],delete ae(this,Tl)[i],iO(ae(this,Du)[n],t),iO(ae(this,Lu)[t],n),delete ae(this,Rs)[n][i],delete ae(this,Os)[t][i],Vp(this,zh)._--),this}inEdges(t,n){var r=ae(this,Rs)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.v===n):i}}outEdges(t,n){var r=ae(this,Os)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.w===n):i}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}},So=new WeakMap,yd=new WeakMap,Vo=new WeakMap,J0=new WeakMap,Lh=new WeakMap,Fh=new WeakMap,ya=new WeakMap,Rs=new WeakMap,Du=new WeakMap,Os=new WeakMap,Lu=new WeakMap,Tl=new WeakMap,kl=new WeakMap,Bh=new WeakMap,zh=new WeakMap,Pl=new WeakMap,Xa=new WeakMap,ey=new WeakSet,nE=function(t){delete ae(this,Xa)[ae(this,Pl)[t]][t]},iN);function rO(e,t){e[t]?e[t]++:e[t]=1}function iO(e,t){--e[t]||delete e[t]}function Dg(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}return i+nO+o+nO+(r===void 0?jSe:r)}function VSe(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function o5(e,t){return Dg(e,t.v,t.w,t.name)}var Nk=USe,GSe="2.1.13",HSe={Graph:Nk,version:GSe},qSe=Nk,WSe={write:KSe,read:YSe};function KSe(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:QSe(e),edges:XSe(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function QSe(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function XSe(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function YSe(e){var t=new qSe(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var ZSe=JSe;function JSe(e){var t={},n=[],r;function i(o){t.hasOwnProperty(o)||(t[o]=!0,r.push(o),e.successors(o).forEach(i),e.predecessors(o).forEach(i))}return e.nodes().forEach(function(o){r=[],i(o),r.length&&n.push(r)}),n}var zi,Il,ty,rE,ny,iE,jh,rb,oN;let e2e=(oN=class{constructor(){Yn(this,ty);Yn(this,ny);Yn(this,jh);Yn(this,zi,[]);Yn(this,Il,{})}size(){return ae(this,zi).length}keys(){return ae(this,zi).map(function(t){return t.key})}has(t){return ae(this,Il).hasOwnProperty(t)}priority(t){var n=ae(this,Il)[t];if(n!==void 0)return ae(this,zi)[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return ae(this,zi)[0].key}add(t,n){var r=ae(this,Il);if(t=String(t),!r.hasOwnProperty(t)){var i=ae(this,zi),o=i.length;return r[t]=o,i.push({key:t,priority:n}),Ss(this,ny,iE).call(this,o),!0}return!1}removeMin(){Ss(this,jh,rb).call(this,0,ae(this,zi).length-1);var t=ae(this,zi).pop();return delete ae(this,Il)[t.key],Ss(this,ty,rE).call(this,0),t.key}decrease(t,n){var r=ae(this,Il)[t];if(n>ae(this,zi)[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+ae(this,zi)[r].priority+" New: "+n);ae(this,zi)[r].priority=n,Ss(this,ny,iE).call(this,r)}},zi=new WeakMap,Il=new WeakMap,ty=new WeakSet,rE=function(t){var n=ae(this,zi),r=2*t,i=r+1,o=t;r>1,!(n[i].priority1;function r2e(e,t,n,r){return i2e(e,String(t),n||n2e,r||function(i){return e.outEdges(i)})}function i2e(e,t,n,r){var i={},o=new t2e,a,s,l=function(u){var c=u.v!==a?u.v:u.w,d=i[c],f=n(u),h=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h0&&(a=o.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return i}var o2e=nG,a2e=s2e;function s2e(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=o2e(e,i,t,n),r},{})}var rG=l2e;function l2e(e){var t=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){r.hasOwnProperty(c)?r[c].onStack&&(s.lowlink=Math.min(s.lowlink,r[c].index)):(o(c),s.lowlink=Math.min(s.lowlink,r[c].lowlink))}),s.lowlink===s.index){var l=[],u;do u=n.pop(),r[u].onStack=!1,l.push(u);while(a!==u);i.push(l)}}return e.nodes().forEach(function(a){r.hasOwnProperty(a)||o(a)}),i}var u2e=rG,c2e=d2e;function d2e(e){return u2e(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var f2e=p2e,h2e=()=>1;function p2e(e,t,n){return g2e(e,t||h2e,n||function(r){return e.outEdges(r)})}function g2e(e,t,n){var r={},i=e.nodes();return i.forEach(function(o){r[o]={},r[o][o]={distance:0},i.forEach(function(a){o!==a&&(r[o][a]={distance:Number.POSITIVE_INFINITY})}),n(o).forEach(function(a){var s=a.v===o?a.w:a.v,l=t(a);r[o][s]={distance:l,predecessor:o}})}),i.forEach(function(o){var a=r[o];i.forEach(function(s){var l=r[s];i.forEach(function(u){var c=l[o],d=a[u],f=l[u],h=c.distance+d.distance;he.successors(s):s=>e.neighbors(s),i=n==="post"?b2e:_2e,o=[],a={};return t.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,a,o)}),o}function b2e(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):n.hasOwnProperty(o[0])||(n[o[0]]=!0,i.push([o[0],!0]),sG(t(o[0]),a=>i.push([a,!1])))}}function _2e(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();n.hasOwnProperty(o)||(n[o]=!0,r.push(o),sG(t(o),a=>i.push(a)))}}function sG(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var S2e=aG,x2e=w2e;function w2e(e,t){return S2e(e,t,"post")}var C2e=aG,A2e=E2e;function E2e(e,t){return C2e(e,t,"pre")}var T2e=Nk,k2e=tG,P2e=I2e;function I2e(e,t){var n=new T2e,r={},i=new k2e,o;function a(l){var u=l.v===o?l.w:l.v,c=i.priority(u);if(c!==void 0){var d=t(l);d0;){if(o=i.removeMin(),r.hasOwnProperty(o))n.setEdge(o,r[o]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(o).forEach(a)}return n}var R2e={components:ZSe,dijkstra:nG,dijkstraAll:a2e,findCycles:c2e,floydWarshall:f2e,isAcyclic:m2e,postorder:x2e,preorder:A2e,prim:P2e,tarjan:rG,topsort:oG},aO=HSe,O2e={Graph:aO.Graph,json:WSe,alg:R2e,version:aO.version};const sO=xc(O2e),lO=(e,t,n,r)=>{const i=new sO.Graph;return n.forEach(o=>{i.setNode(o.id)}),r.forEach(o=>{i.setEdge(o.source,o.target)}),i.setEdge(e,t),sO.alg.isAcyclic(i)},uO=(e,t,n,r,i)=>{let o=!0;return t==="source"?e.find(a=>a.target===r.id&&a.targetHandle===i.name)&&(o=!1):e.find(a=>a.source===r.id&&a.sourceHandle===i.name)&&(o=!1),zSe(n,i.type)||(o=!1),o},cO=(e,t,n,r,i,o,a)=>{if(e.id===r)return null;const s=o=="source"?e.data.inputs:e.data.outputs;if(s[i]){const l=s[i],u=o=="source"?r:e.id,c=o=="source"?e.id:r,d=o=="source"?i:l.name,f=o=="source"?l.name:i,h=lO(u,c,t,n),p=uO(n,o,a,e,l);if(h&&p)return{source:u,sourceHandle:d,target:c,targetHandle:f}}for(const l in s){const u=s[l],c=o=="source"?r:e.id,d=o=="source"?e.id:r,f=o=="source"?i:u.name,h=o=="source"?u.name:i,p=lO(c,d,t,n),m=uO(n,o,a,e,u);if(p&&m)return{source:c,sourceHandle:f,target:d,targetHandle:h}}return null},M2e="1.0.0",a5={status:Jc.PENDING,error:null,progress:null,progressImage:null,outputs:[]},aE={meta:{version:M2e},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},lG={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,connectionMade:!1,modifyingEdge:!1,addNewNodePosition:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:aE,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:gc.Partial},Ji=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!Vr(a))return;const s=(u=a.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},uG=nr({name:"nodes",initialState:lG,reducers:{nodesChanged:(e,t)=>{e.nodes=Qc(t.payload,e.nodes)},nodeAdded:(e,t)=>{var i,o;const n=t.payload,r=tO(e.nodes,((i=e.addNewNodePosition)==null?void 0:i.x)??n.position.x,((o=e.addNewNodePosition)==null?void 0:o.y)??n.position.y);if(n.position=r,n.selected=!0,e.nodes=Qc(e.nodes.map(a=>({id:a.id,type:"select",selected:!1})),e.nodes),e.edges=Bc(e.edges.map(a=>({id:a.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),!!Vr(n)){if(e.nodeExecutionStates[n.id]={nodeId:n.id,...a5},e.connectionStartParams){const{nodeId:a,handleId:s,handleType:l}=e.connectionStartParams;if(a&&s&&l&&e.currentConnectionFieldType){const u=cO(n,e.nodes,e.edges,a,s,l,e.currentConnectionFieldType);u&&(e.edges=$g({...u,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}},edgeChangeStarted:e=>{e.modifyingEdge=!0},edgesChanged:(e,t)=>{e.edges=Bc(t.payload,e.edges)},edgeAdded:(e,t)=>{e.edges=$g(t.payload,e.edges)},edgeUpdated:(e,t)=>{const{oldEdge:n,newConnection:r}=t.payload;e.edges=c_e(n,r,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload,e.connectionMade=e.modifyingEdge;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!Vr(a))return;const s=i==="source"?a.data.outputs[r]:a.data.inputs[r];e.currentConnectionFieldType=(s==null?void 0:s.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=$g({...t.payload,type:"default"},e.edges),e.connectionMade=!0)},connectionEnded:(e,t)=>{var n;if(e.connectionMade)e.connectionStartParams=null,e.currentConnectionFieldType=null;else if(e.mouseOverNode){const r=e.nodes.findIndex(o=>o.id===e.mouseOverNode),i=(n=e.nodes)==null?void 0:n[r];if(i&&e.connectionStartParams){const{nodeId:o,handleId:a,handleType:s}=e.connectionStartParams;if(o&&a&&s&&e.currentConnectionFieldType){const l=cO(i,e.nodes,e.edges,o,a,s,e.currentConnectionFieldType);l&&(e.edges=$g({...l,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}else e.addNewNodePosition=t.payload.cursorPosition,e.isAddNodePopoverOpen=!0;e.modifyingEdge=!1},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=yA(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!P4(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(s=>s.id===n);if(!Vr(o))return;const a=o.data.inputs[r];a&&(a.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var a;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];Vr(o)&&(o.data.embedWorkflow=r)},nodeUseCacheChanged:(e,t)=>{var a;const{nodeId:n,useCache:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];Vr(o)&&(o.data.useCache=r)},nodeIsIntermediateChanged:(e,t)=>{var a;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];Vr(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var s;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(s=e.nodes)==null?void 0:s[i];if(!Vr(o)&&!dR(o)||(o.data.isOpen=r,!Vr(o)))return;const a=Ik([o],e.edges);if(r)a.forEach(l=>{delete l.hidden}),a.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=l_e(o,e.nodes,e.edges).filter(d=>Vr(d)&&d.data.isOpen===!1),u=s_e(o,e.nodes,e.edges).filter(d=>Vr(d)&&d.data.isOpen===!1),c=[];a.forEach(d=>{var f,h;if(d.target===n&&l.find(p=>p.id===d.source)){d.hidden=!0;const p=c.find(m=>m.source===d.source&&m.target===d.target);p?p.data={count:(((f=p.data)==null?void 0:f.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}if(d.source===n&&u.find(p=>p.id===d.target)){const p=c.find(m=>m.source===d.source&&m.target===d.target);d.hidden=!0,p?p.data={count:(((h=p.data)==null?void 0:h.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}}),c.length&&(e.edges=Bc(c.map(d=>({type:"add",item:d})),e.edges))}},edgeDeleted:(e,t)=>{e.edges=e.edges.filter(n=>n.id!==t.payload)},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(a=>{a.source===o.source&&a.target===o.target&&i.push({id:a.id,type:"remove"})})}),e.edges=Bc(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),Vr(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var a;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];Vr(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var a;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];Vr(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=Qc(e.nodes.map(r=>({id:r.id,type:"select",selected:r.id===n})),e.nodes)},selectedNodesChanged:(e,t)=>{e.selectedNodes=t.payload},selectedEdgesChanged:(e,t)=>{e.selectedEdges=t.payload},fieldStringValueChanged:(e,t)=>{Ji(e,t)},fieldNumberValueChanged:(e,t)=>{Ji(e,t)},fieldBooleanValueChanged:(e,t)=>{Ji(e,t)},fieldBoardValueChanged:(e,t)=>{Ji(e,t)},fieldImageValueChanged:(e,t)=>{Ji(e,t)},fieldColorValueChanged:(e,t)=>{Ji(e,t)},fieldMainModelValueChanged:(e,t)=>{Ji(e,t)},fieldRefinerModelValueChanged:(e,t)=>{Ji(e,t)},fieldVaeModelValueChanged:(e,t)=>{Ji(e,t)},fieldLoRAModelValueChanged:(e,t)=>{Ji(e,t)},fieldControlNetModelValueChanged:(e,t)=>{Ji(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{Ji(e,t)},fieldT2IAdapterModelValueChanged:(e,t)=>{Ji(e,t)},fieldEnumModelValueChanged:(e,t)=>{Ji(e,t)},fieldSchedulerValueChanged:(e,t)=>{Ji(e,t)},imageCollectionFieldValueChanged:(e,t)=>{var u,c;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n);if(o===-1)return;const a=(u=e.nodes)==null?void 0:u[o];if(!Vr(a))return;const s=(c=a.data)==null?void 0:c.inputs[r];if(!s)return;const l=Ut(s.value);if(!l){s.value=i;return}s.value=yA(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var a;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];dR(o)&&(o.data.notes=r)},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.nodeTemplates=t.payload,e.isReady=!0},nodeEditorReset:e=>{e.nodes=[],e.edges=[],e.workflow=Ut(aE)},shouldValidateGraphChanged:(e,t)=>{e.shouldValidateGraph=t.payload},shouldAnimateEdgesChanged:(e,t)=>{e.shouldAnimateEdges=t.payload},shouldSnapToGridChanged:(e,t)=>{e.shouldSnapToGrid=t.payload},shouldColorEdgesChanged:(e,t)=>{e.shouldColorEdges=t.payload},nodeOpacityChanged:(e,t)=>{e.nodeOpacity=t.payload},workflowNameChanged:(e,t)=>{e.workflow.name=t.payload},workflowDescriptionChanged:(e,t)=>{e.workflow.description=t.payload},workflowTagsChanged:(e,t)=>{e.workflow.tags=t.payload},workflowAuthorChanged:(e,t)=>{e.workflow.author=t.payload},workflowNotesChanged:(e,t)=>{e.workflow.notes=t.payload},workflowVersionChanged:(e,t)=>{e.workflow.version=t.payload},workflowContactChanged:(e,t)=>{e.workflow.contact=t.payload},workflowLoaded:(e,t)=>{const{nodes:n,edges:r,...i}=t.payload;e.workflow=i,e.nodes=Qc(n.map(o=>({item:{...o,dragHandle:`.${DSe}`},type:"add"})),[]),e.edges=Bc(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,a)=>(o[a.id]={nodeId:a.id,...a5},o),{})},workflowReset:e=>{e.workflow=Ut(aE)},viewportChanged:(e,t)=>{e.viewport=t.payload},mouseOverFieldChanged:(e,t)=>{e.mouseOverField=t.payload},mouseOverNodeChanged:(e,t)=>{e.mouseOverNode=t.payload},selectedAll:e=>{e.nodes=Qc(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=Bc(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{if(e.nodesToCopy=e.nodes.filter(t=>t.selected).map(Ut),e.edgesToCopy=e.edges.filter(t=>t.selected).map(Ut),e.nodesToCopy.length>0){const t={x:0,y:0};e.nodesToCopy.forEach(n=>{const r=.15*(n.width??0),i=.5*(n.height??0);t.x+=n.position.x+r,t.y+=n.position.y+i}),t.x/=e.nodesToCopy.length,t.y/=e.nodesToCopy.length,e.nodesToCopy.forEach(n=>{n.position.x-=t.x,n.position.y-=t.y})}},selectionPasted:(e,t)=>{const{cursorPosition:n}=t.payload,r=e.nodesToCopy.map(Ut),i=r.map(c=>c.data.id),o=e.edgesToCopy.filter(c=>i.includes(c.source)&&i.includes(c.target)).map(Ut);o.forEach(c=>c.selected=!0),r.forEach(c=>{const d=nm();o.forEach(h=>{h.source===c.data.id&&(h.source=d,h.id=h.id.replace(c.data.id,d)),h.target===c.data.id&&(h.target=d,h.id=h.id.replace(c.data.id,d))}),c.selected=!0,c.id=d,c.data.id=d;const f=tO(e.nodes,c.position.x+((n==null?void 0:n.x)??0),c.position.y+((n==null?void 0:n.y)??0));c.position=f});const a=r.map(c=>({item:c,type:"add"})),s=e.nodes.map(c=>({id:c.data.id,type:"select",selected:!1})),l=o.map(c=>({item:c,type:"add"})),u=e.edges.map(c=>({id:c.id,type:"select",selected:!1}));e.nodes=Qc(a.concat(s),e.nodes),e.edges=Bc(l.concat(u),e.edges),r.forEach(c=>{e.nodeExecutionStates[c.id]={nodeId:c.id,...a5}})},addNodePopoverOpened:e=>{e.addNewNodePosition=null,e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1,e.connectionStartParams=null,e.currentConnectionFieldType=null},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?gc.Full:gc.Partial}},extraReducers:e=>{e.addCase(I0.pending,t=>{t.isReady=!1}),e.addCase(O4,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Jc.IN_PROGRESS)}),e.addCase($4,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=Jc.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(c2,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Jc.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(N4,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:a}=n.payload.data,s=t.nodeExecutionStates[r];s&&(s.status=Jc.IN_PROGRESS,s.progress=(i+1)/o,s.progressImage=a??null)}),e.addCase(d2,(t,n)=>{["in_progress"].includes(n.payload.data.queue_item.status)&&Xl(t.nodeExecutionStates,r=>{r.status=Jc.PENDING,r.error=null,r.progress=null,r.progressImage=null,r.outputs=[]})})}}),{addNodePopoverClosed:_qe,addNodePopoverOpened:Sqe,addNodePopoverToggled:xqe,connectionEnded:wqe,connectionMade:Cqe,connectionStarted:Aqe,edgeDeleted:Eqe,edgeChangeStarted:Tqe,edgesChanged:kqe,edgesDeleted:Pqe,edgeUpdated:Iqe,fieldBoardValueChanged:Rqe,fieldBooleanValueChanged:Oqe,fieldColorValueChanged:Mqe,fieldControlNetModelValueChanged:$qe,fieldEnumModelValueChanged:Nqe,fieldImageValueChanged:hx,fieldIPAdapterModelValueChanged:Dqe,fieldT2IAdapterModelValueChanged:Lqe,fieldLabelChanged:Fqe,fieldLoRAModelValueChanged:Bqe,fieldMainModelValueChanged:zqe,fieldNumberValueChanged:jqe,fieldRefinerModelValueChanged:Uqe,fieldSchedulerValueChanged:Vqe,fieldStringValueChanged:Gqe,fieldVaeModelValueChanged:Hqe,imageCollectionFieldValueChanged:qqe,mouseOverFieldChanged:Wqe,mouseOverNodeChanged:Kqe,nodeAdded:Qqe,nodeEditorReset:$2e,nodeEmbedWorkflowChanged:Xqe,nodeExclusivelySelected:Yqe,nodeIsIntermediateChanged:Zqe,nodeIsOpenChanged:Jqe,nodeLabelChanged:eWe,nodeNotesChanged:tWe,nodeOpacityChanged:nWe,nodesChanged:rWe,nodesDeleted:iWe,nodeTemplatesBuilt:cG,nodeUseCacheChanged:oWe,notesNodeValueChanged:aWe,selectedAll:sWe,selectedEdgesChanged:lWe,selectedNodesChanged:uWe,selectionCopied:cWe,selectionModeChanged:dWe,selectionPasted:fWe,shouldAnimateEdgesChanged:hWe,shouldColorEdgesChanged:pWe,shouldShowFieldTypeLegendChanged:gWe,shouldShowMinimapPanelChanged:mWe,shouldSnapToGridChanged:yWe,shouldValidateGraphChanged:vWe,viewportChanged:bWe,workflowAuthorChanged:_We,workflowContactChanged:SWe,workflowDescriptionChanged:xWe,workflowExposedFieldAdded:N2e,workflowExposedFieldRemoved:wWe,workflowLoaded:D2e,workflowNameChanged:CWe,workflowNotesChanged:AWe,workflowTagsChanged:EWe,workflowVersionChanged:TWe,edgeAdded:kWe}=uG.actions,L2e=uG.reducer,dG={esrganModelName:"RealESRGAN_x4plus.pth"},fG=nr({name:"postprocessing",initialState:dG,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:PWe}=fG.actions,F2e=fG.reducer,hG={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},pG=nr({name:"sdxl",initialState:hG,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:IWe,setNegativeStylePromptSDXL:RWe,setShouldConcatSDXLStylePrompt:OWe,setShouldUseSDXLRefiner:B2e,setSDXLImg2ImgDenoisingStrength:MWe,refinerModelChanged:dO,setRefinerSteps:$We,setRefinerCFGScale:NWe,setRefinerScheduler:DWe,setRefinerPositiveAestheticScore:LWe,setRefinerNegativeAestheticScore:FWe,setRefinerStart:BWe}=pG.actions,z2e=pG.reducer,j2e=(e,t,n)=>t===0?0:n===2?Math.floor((e+1+1)/2)/Math.floor((t+1)/2):(e+1+1)/(t+1),Gd=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},gG={isInitialized:!1,isConnected:!1,shouldConfirmOnDelete:!0,enableImageDebugging:!1,toastQueue:[],denoiseProgress:null,shouldAntialiasProgressImage:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,language:"en",shouldUseNSFWChecker:!1,shouldUseWatermarker:!1,shouldEnableInformationalPopovers:!1,status:"DISCONNECTED"},mG=nr({name:"system",initialState:gG,reducers:{setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},languageChanged:(e,t)=>{e.language=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload},setShouldEnableInformationalPopovers(e,t){e.shouldEnableInformationalPopovers=t.payload},isInitializedChanged(e,t){e.isInitialized=t.payload}},extraReducers(e){e.addCase(R4,t=>{t.isConnected=!0,t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase($B,t=>{t.isConnected=!1,t.denoiseProgress=null,t.status="DISCONNECTED"}),e.addCase(O4,t=>{t.denoiseProgress=null,t.status="PROCESSING"}),e.addCase(N4,(t,n)=>{const{step:r,total_steps:i,order:o,progress_image:a,graph_execution_state_id:s,queue_batch_id:l}=n.payload.data;t.denoiseProgress={step:r,total_steps:i,order:o,percentage:j2e(r,i,o),progress_image:a,session_id:s,batch_id:l},t.status="PROCESSING"}),e.addCase($4,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(FB,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(jB,t=>{t.status="LOADING_MODEL"}),e.addCase(VB,t=>{t.status="CONNECTED"}),e.addCase(d2,(t,n)=>{["completed","canceled","failed"].includes(n.payload.data.queue_item.status)&&(t.status="CONNECTED",t.denoiseProgress=null)}),e.addMatcher(q2e,(t,n)=>{t.toastQueue.push(Gd({title:Z("toast.serverError"),status:"error",description:Bae(n.payload.data.error_type)}))})}}),{setShouldConfirmOnDelete:zWe,setEnableImageDebugging:jWe,addToast:Ht,clearToastQueue:UWe,consoleLogLevelChanged:VWe,shouldLogToConsoleChanged:GWe,shouldAntialiasProgressImageChanged:HWe,languageChanged:qWe,shouldUseNSFWCheckerChanged:U2e,shouldUseWatermarkerChanged:V2e,setShouldEnableInformationalPopovers:WWe,isInitializedChanged:G2e}=mG.actions,H2e=mG.reducer,q2e=Qi(c2,HB,WB),W2e={listCursor:void 0,listPriority:void 0,selectedQueueItem:void 0,resumeProcessorOnEnqueue:!0},K2e=W2e,yG=nr({name:"queue",initialState:K2e,reducers:{listCursorChanged:(e,t)=>{e.listCursor=t.payload},listPriorityChanged:(e,t)=>{e.listPriority=t.payload},listParamsReset:e=>{e.listCursor=void 0,e.listPriority=void 0},queueItemSelectionToggled:(e,t)=>{e.selectedQueueItem===t.payload?e.selectedQueueItem=void 0:e.selectedQueueItem=t.payload},resumeProcessorOnEnqueueChanged:(e,t)=>{e.resumeProcessorOnEnqueue=t.payload}}}),{listCursorChanged:KWe,listPriorityChanged:QWe,listParamsReset:Q2e,queueItemSelectionToggled:XWe,resumeProcessorOnEnqueueChanged:YWe}=yG.actions,X2e=yG.reducer,Y2e={searchFolder:null,advancedAddScanModel:null},vG=nr({name:"modelmanager",initialState:Y2e,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:ZWe,setAdvancedAddScanModel:JWe}=vG.actions,Z2e=vG.reducer,bG={shift:!1,ctrl:!1,meta:!1},_G=nr({name:"hotkeys",initialState:bG,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:eKe,ctrlKeyPressed:tKe,metaKeyPressed:nKe}=_G.actions,J2e=_G.reducer,SG={activeTab:"txt2img",shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},xG=nr({name:"ui",initialState:SG,reducers:{setActiveTab:(e,t)=>{e.activeTab=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},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldAutoChangeDimensions:(e,t)=>{e.shouldAutoChangeDimensions=t.payload},contextMenusClosed:e=>{e.globalContextMenuCloseTrigger+=1},panelsChanged:(e,t)=>{e.panels[t.payload.name]=t.payload.value}},extraReducers(e){e.addCase(m2,t=>{t.activeTab="img2img"})}}),{setActiveTab:wG,setShouldShowImageDetails:rKe,setShouldUseCanvasBetaLayout:iKe,setShouldShowExistingModelsInSearch:oKe,setShouldUseSliders:aKe,setShouldHidePreview:sKe,setShouldShowProgressInViewer:lKe,favoriteSchedulersChanged:uKe,toggleEmbeddingPicker:cKe,setShouldAutoChangeDimensions:dKe,contextMenusClosed:fKe,panelsChanged:hKe}=xG.actions,exe=xG.reducer,txe=ES(eZ);CG=sE=void 0;var nxe=txe,rxe=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return nxe.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=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,a=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function EG(e,t){if(e){if(typeof e=="string")return hO(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 hO(e,t)}}function hO(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,a=r.persistWholeStore,s=r.serialize;try{var l=a?yxe:vxe;yield l(t,n,{prefix:i,driver:o,serialize:s})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function yO(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){n(u);return}s.done?t(l):Promise.resolve(l).then(r,i)}function vO(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(l){yO(o,r,i,a,s,"next",l)}function s(l){yO(o,r,i,a,s,"throw",l)}a(void 0)})}}var _xe=function(){var e=vO(function*(t,n,r){var i=r.prefix,o=r.driver,a=r.serialize,s=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield fxe(t,n,{prefix:i,driver:o,unserialize:s,persistWholeStore:c});var d={},f=function(){var h=vO(function*(){var p=AG(t.getState(),n);yield bxe(p,d,{prefix:i,driver:o,serialize:a,persistWholeStore:c}),Lk(p,d)||t.dispatch({type:sxe,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(uxe(f,u)):t.subscribe(lxe(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const Sxe=_xe;function R0(e){"@babel/helpers - typeof";return R0=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},R0(e)}function bO(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 u5(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=u5({},r));var o=typeof t=="function"?t:wp(t);switch(i.type){case lE:{var a=u5(u5({},n.state),i.payload||{});return n.state=o(a,{type:lE,payload:a}),n.state}default:return o(r,i)}}},Exe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,a=r.serialize,s=a===void 0?function(_,b){return JSON.stringify(_)}:a,l=r.unserialize,u=l===void 0?function(_,b){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;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 m=function(b){return function(y,g,v){var S=b(y,g,v);return Sxe(S,n,{driver:t,prefix:o,serialize:s,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const pKe=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],Txe="@@invokeai-",kxe=["cursorPosition"],Pxe=["pendingControlImages"],Ixe=["prompts"],Rxe=["selection","selectedBoardId","galleryView"],Oxe=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy","connectionMade","modifyingEdge","addNewNodePosition"],Mxe=[],$xe=[],Nxe=["isInitialized","isConnected","denoiseProgress","status"],Dxe=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],Lxe={canvas:kxe,gallery:Rxe,generation:Mxe,nodes:Oxe,postprocessing:$xe,system:Nxe,ui:Dxe,controlNet:Pxe,dynamicPrompts:Ixe},Fxe=(e,t)=>{const n=_y(e,Lxe[t]??[]);return JSON.stringify(n)},Bxe={canvas:mz,gallery:PU,generation:G4,nodes:lG,postprocessing:dG,system:gG,config:IB,ui:SG,hotkeys:bG,controlAdapters:vA,dynamicPrompts:K4,sdxl:hG},zxe=(e,t)=>Doe(JSON.parse(e),Bxe[t]),jxe=De("nodes/textToImageGraphBuilt"),Uxe=De("nodes/imageToImageGraphBuilt"),kG=De("nodes/canvasGraphBuilt"),Vxe=De("nodes/nodesGraphBuilt"),Gxe=Qi(jxe,Uxe,kG,Vxe),Hxe=De("nodes/workflowLoadRequested"),qxe=e=>{if(Gxe(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return I0.fulfilled.match(e)?{...e,payload:""}:cG.match(e)?{...e,payload:""}:e},Wxe=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],Kxe=e=>e,PG="default",Gr=sl(PG),Qxe=e=>{const t=e?im.stringify(e,{arrayFormat:"none"}):void 0;return t?`queue/${Gr.get()}/list?${t}`:`queue/${Gr.get()}/list`},ed=Ra({selectId:e=>e.item_id,sortComparer:(e,t)=>e.priority>t.priority?-1:e.priorityt.item_id?1:0}),Er=gs.injectEndpoints({endpoints:e=>({enqueueBatch:e.mutation({query:t=>({url:`queue/${Gr.get()}/enqueue_batch`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,cg(r)}catch{}}}),enqueueGraph:e.mutation({query:t=>({url:`queue/${Gr.get()}/enqueue_graph`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,cg(r)}catch{}}}),resumeProcessor:e.mutation({query:()=>({url:`queue/${Gr.get()}/processor/resume`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pauseProcessor:e.mutation({query:()=>({url:`queue/${Gr.get()}/processor/pause`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pruneQueue:e.mutation({query:()=>({url:`queue/${Gr.get()}/prune`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","BatchStatus"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,cg(r)}catch{}}}),clearQueue:e.mutation({query:()=>({url:`queue/${Gr.get()}/clear`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","SessionProcessorStatus","BatchStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,cg(r)}catch{}}}),getCurrentQueueItem:e.query({query:()=>({url:`queue/${Gr.get()}/current`,method:"GET"}),providesTags:t=>{const n=["CurrentSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getNextQueueItem:e.query({query:()=>({url:`queue/${Gr.get()}/next`,method:"GET"}),providesTags:t=>{const n=["NextSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getQueueStatus:e.query({query:()=>({url:`queue/${Gr.get()}/status`,method:"GET"}),providesTags:["SessionQueueStatus"]}),getBatchStatus:e.query({query:({batch_id:t})=>({url:`queue/${Gr.get()}/b/${t}/status`,method:"GET"}),providesTags:t=>t?[{type:"BatchStatus",id:t.batch_id}]:[]}),getQueueItem:e.query({query:t=>({url:`queue/${Gr.get()}/i/${t}`,method:"GET"}),providesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id}]:[]}),cancelQueueItem:e.mutation({query:t=>({url:`queue/${Gr.get()}/i/${t}/cancel`,method:"PUT"}),onQueryStarted:async(t,{dispatch:n,queryFulfilled:r})=>{try{const{data:i}=await r;n(Er.util.updateQueryData("listQueueItems",void 0,o=>{ed.updateOne(o,{id:t,changes:{status:i.status,completed_at:i.completed_at,updated_at:i.updated_at}})}))}catch{}},invalidatesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id},{type:"BatchStatus",id:t.batch_id}]:[]}),cancelByBatchIds:e.mutation({query:t=>({url:`queue/${Gr.get()}/cancel_by_batch_ids`,method:"PUT",body:t}),onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,cg(r)}catch{}},invalidatesTags:["SessionQueueStatus","BatchStatus"]}),listQueueItems:e.query({query:t=>({url:Qxe(t),method:"GET"}),serializeQueryArgs:()=>`queue/${Gr.get()}/list`,transformResponse:t=>ed.addMany(ed.getInitialState({has_more:t.has_more}),t.items),merge:(t,n)=>{ed.addMany(t,ed.getSelectors().selectAll(n)),t.has_more=n.has_more},forceRefetch:({currentArg:t,previousArg:n})=>t!==n,keepUnusedDataFor:60*5})})}),{useCancelByBatchIdsMutation:gKe,useEnqueueGraphMutation:mKe,useEnqueueBatchMutation:yKe,usePauseProcessorMutation:vKe,useResumeProcessorMutation:bKe,useClearQueueMutation:_Ke,usePruneQueueMutation:SKe,useGetCurrentQueueItemQuery:xKe,useGetQueueStatusQuery:wKe,useGetQueueItemQuery:CKe,useGetNextQueueItemQuery:AKe,useListQueueItemsQuery:EKe,useCancelQueueItemMutation:TKe,useGetBatchStatusQuery:kKe}=Er,cg=e=>{e(Er.util.updateQueryData("listQueueItems",void 0,t=>{ed.removeAll(t),t.has_more=!1})),e(Q2e()),e(Er.endpoints.listQueueItems.initiate(void 0))},Xxe=Qi(due,fue),Yxe=()=>{Me({matcher:Xxe,effect:async(e,{dispatch:t,getState:n})=>{const r=be("canvas"),i=n(),{batchIds:o}=i.canvas;try{const a=t(Er.endpoints.cancelByBatchIds.initiate({batch_ids:o},{fixedCacheKey:"cancelByBatchIds"})),{canceled:s}=await a.unwrap();a.reset(),s>0&&(r.debug(`Canceled ${s} canvas batches`),t(Ht({title:Z("queue.cancelBatchSucceeded"),status:"success"}))),t(mue())}catch{r.error("Failed to cancel canvas batches"),t(Ht({title:Z("queue.cancelBatchFailed"),status:"error"}))}}})};De("app/appStarted");const Zxe=()=>{Me({matcher:xe.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==jo({board_id:"none",categories:ii}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Vn.getSelectors().selectAll(i)[0];t(Qs(o??null))}}})},Jxe=Qi(Er.endpoints.enqueueBatch.matchFulfilled,Er.endpoints.enqueueGraph.matchFulfilled),ewe=()=>{Me({matcher:Jxe,effect:async(e,{dispatch:t,getState:n})=>{const{data:r}=Er.endpoints.getQueueStatus.select()(n());!r||r.processor.is_started||t(Er.endpoints.resumeProcessor.initiate(void 0,{fixedCacheKey:"resumeProcessor"}))}})},IG=gs.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}),getInvocationCacheStatus:e.query({query:()=>({url:"app/invocation_cache/status",method:"GET"}),providesTags:["InvocationCacheStatus"]}),clearInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache",method:"DELETE"}),invalidatesTags:["InvocationCacheStatus"]}),enableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/enable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]}),disableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/disable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]})})}),{useGetAppVersionQuery:PKe,useGetAppConfigQuery:IKe,useClearInvocationCacheMutation:RKe,useDisableInvocationCacheMutation:OKe,useEnableInvocationCacheMutation:MKe,useGetInvocationCacheStatusQuery:$Ke}=IG,twe=()=>{Me({matcher:IG.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,a=t().generation.infillMethod;r.includes(a)||n(nue(r[0])),i.includes("nsfw_checker")||n(U2e(!1)),o.includes("invisible_watermark")||n(V2e(!1))}})},nwe=De("app/appStarted"),rwe=()=>{Me({actionCreator:nwe,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},gx={memoizeOptions:{resultEqualityCheck:P4}},RG=(e,t)=>{var d;const{generation:n,canvas:r,nodes:i,controlAdapters:o}=e,a=((d=n.initialImage)==null?void 0:d.imageName)===t,s=r.layerState.objects.some(f=>f.kind==="image"&&f.imageName===t),l=i.nodes.filter(Vr).some(f=>Rf(f.data.inputs,h=>{var p;return h.type==="ImageField"&&((p=h.value)==null?void 0:p.image_name)===t})),u=Pa(o).some(f=>f.controlImage===t||Ho(f)&&f.processedControlImage===t);return{isInitialImage:a,isCanvasImage:s,isNodesImage:l,isControlImage:u}},iwe=Ii([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>RG(e,r.image_name)):[]},gx),owe=()=>{Me({matcher:xe.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,a=!1,s=!1;const l=n();r.forEach(u=>{const c=RG(l,u);c.isInitialImage&&!i&&(t(H4()),i=!0),c.isCanvasImage&&!o&&(t(q4()),o=!0),c.isNodesImage&&!a&&(t($2e()),a=!0),c.isControlImage&&!s&&(t(Nse()),s=!0)})}})},awe=()=>{Me({matcher:Qi(F_,zA),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),a=F_.match(e)?e.payload.boardId:o.gallery.selectedBoardId,l=(zA.match(e)?e.payload:o.gallery.galleryView)==="images"?ii:to,u={board_id:a??"none",categories:l};if(await r(()=>xe.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=xe.endpoints.listImages.select(u)(t());if(d){const f=d0.selectAll(d)[0],h=d0.selectById(d,e.payload.selectedImageName);n(Qs(h||f||null))}else n(Qs(null))}else n(Qs(null))}})},swe=De("canvas/canvasSavedToGallery"),lwe=De("canvas/canvasMaskSavedToGallery"),uwe=De("canvas/canvasCopiedToClipboard"),cwe=De("canvas/canvasDownloadedAsImage"),dwe=De("canvas/canvasMerged"),fwe=De("canvas/stagingAreaImageSaved"),hwe=De("canvas/canvasMaskToControlAdapter"),pwe=De("canvas/canvasImageToControlAdapter");let OG=null,MG=null;const NKe=e=>{OG=e},mx=()=>OG,DKe=e=>{MG=e},gwe=()=>MG,mwe=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),X_=async(e,t)=>await mwe(e.toCanvas(t)),yx=async(e,t=!1)=>{const n=mx();if(!n)throw new Error("Problem getting base layer blob");const{shouldCropToBoundingBoxOnSave:r,boundingBoxCoordinates:i,boundingBoxDimensions:o}=e.canvas,a=n.clone();a.scale({x:1,y:1});const s=a.getAbsolutePosition(),l=r||t?{x:i.x+s.x,y:i.y+s.y,width:o.width,height:o.height}:a.getClientRect();return X_(a,l)},ywe=(e,t="image/png")=>{navigator.clipboard.write([new ClipboardItem({[t]:e})])},vwe=()=>{Me({actionCreator:uwe,effect:async(e,{dispatch:t,getState:n})=>{const r=ax.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n();try{const o=yx(i);ywe(o)}catch(o){r.error(String(o)),t(Ht({title:Z("toast.problemCopyingCanvas"),description:Z("toast.problemCopyingCanvasDesc"),status:"error"}));return}t(Ht({title:Z("toast.canvasCopiedClipboard"),status:"success"}))}})},bwe=(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()},_we=()=>{Me({actionCreator:cwe,effect:async(e,{dispatch:t,getState:n})=>{const r=ax.get().child({namespace:"canvasSavedToGalleryListener"}),i=n();let o;try{o=await yx(i)}catch(a){r.error(String(a)),t(Ht({title:Z("toast.problemDownloadingCanvas"),description:Z("toast.problemDownloadingCanvasDesc"),status:"error"}));return}bwe(o,"canvas.png"),t(Ht({title:Z("toast.canvasDownloaded"),status:"success"}))}})},Swe=()=>{Me({actionCreator:pwe,effect:async(e,{dispatch:t,getState:n})=>{const r=be("canvas"),i=n(),{id:o}=e.payload;let a;try{a=await yx(i,!0)}catch(c){r.error(String(c)),t(Ht({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,l=await t(xe.endpoints.uploadImage.initiate({file:new File([a],"savedCanvas.png",{type:"image/png"}),image_category:"control",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(kc({id:o,controlImage:u}))}})};var Fk={exports:{}},vx={},$G={},Rt={};(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 yt<"u"?yt: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)})(Rt);var fr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Rt;class n{constructor(v=[1,0,0,1,0,0]){this.dirty=!1,this.m=v&&v.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(v){v.m[0]=this.m[0],v.m[1]=this.m[1],v.m[2]=this.m[2],v.m[3]=this.m[3],v.m[4]=this.m[4],v.m[5]=this.m[5]}point(v){var S=this.m;return{x:S[0]*v.x+S[2]*v.y+S[4],y:S[1]*v.x+S[3]*v.y+S[5]}}translate(v,S){return this.m[4]+=this.m[0]*v+this.m[2]*S,this.m[5]+=this.m[1]*v+this.m[3]*S,this}scale(v,S){return this.m[0]*=v,this.m[1]*=v,this.m[2]*=S,this.m[3]*=S,this}rotate(v){var S=Math.cos(v),x=Math.sin(v),w=this.m[0]*S+this.m[2]*x,C=this.m[1]*S+this.m[3]*x,T=this.m[0]*-x+this.m[2]*S,E=this.m[1]*-x+this.m[3]*S;return this.m[0]=w,this.m[1]=C,this.m[2]=T,this.m[3]=E,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(v,S){var x=this.m[0]+this.m[2]*S,w=this.m[1]+this.m[3]*S,C=this.m[2]+this.m[0]*v,T=this.m[3]+this.m[1]*v;return this.m[0]=x,this.m[1]=w,this.m[2]=C,this.m[3]=T,this}multiply(v){var S=this.m[0]*v.m[0]+this.m[2]*v.m[1],x=this.m[1]*v.m[0]+this.m[3]*v.m[1],w=this.m[0]*v.m[2]+this.m[2]*v.m[3],C=this.m[1]*v.m[2]+this.m[3]*v.m[3],T=this.m[0]*v.m[4]+this.m[2]*v.m[5]+this.m[4],E=this.m[1]*v.m[4]+this.m[3]*v.m[5]+this.m[5];return this.m[0]=S,this.m[1]=x,this.m[2]=w,this.m[3]=C,this.m[4]=T,this.m[5]=E,this}invert(){var v=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*v,x=-this.m[1]*v,w=-this.m[2]*v,C=this.m[0]*v,T=v*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),E=v*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=x,this.m[2]=w,this.m[3]=C,this.m[4]=T,this.m[5]=E,this}getMatrix(){return this.m}decompose(){var v=this.m[0],S=this.m[1],x=this.m[2],w=this.m[3],C=this.m[4],T=this.m[5],E=v*w-S*x;let k={x:C,y:T,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(v!=0||S!=0){var N=Math.sqrt(v*v+S*S);k.rotation=S>0?Math.acos(v/N):-Math.acos(v/N),k.scaleX=N,k.scaleY=E/N,k.skewX=(v*x+S*w)/E,k.skewY=0}else if(x!=0||w!=0){var O=Math.sqrt(x*x+w*w);k.rotation=Math.PI/2-(w>0?Math.acos(-x/O):-Math.acos(x/O)),k.scaleX=E/O,k.scaleY=O,k.skewX=0,k.skewY=(v*x+S*w)/E}return k.rotation=e.Util._getRotation(k.rotation),k}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",a="[object Boolean]",s=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={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]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,b=[];const y=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===a},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var v=g[0];return v==="#"||v==="."||v===v.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){b.push(g),b.length===1&&y(function(){const v=b;b=[],v.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,v){var S=e.Util.createImageElement();S.onload=function(){v(S)},S.src=g},_rgbToHex(g,v,S){return((1<<24)+(g<<16)+(v<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var v=parseInt(g,16);return{r:v>>16&255,g:v>>8&255,b:v&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var v;return g in m?(v=m[g],{r:v[0],g:v[1],b:v[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(v=_.exec(g.replace(/ /g,"")),{r:parseInt(v[1],10),g:parseInt(v[2],10),b:parseInt(v[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var v=m[g.toLowerCase()];return v?{r:v[0],g:v[1],b:v[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var v=g.split(/ *, */).map(Number);return{r:v[0],g:v[1],b:v[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var v=g.split(/ *, */).map((S,x)=>S.slice(-1)==="%"?x===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:v[0],g:v[1],b:v[2],a:v[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[v,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),x=Number(S[0])/360,w=Number(S[1])/100,C=Number(S[2])/100;let T,E,k;if(w===0)return k=C*255,{r:Math.round(k),g:Math.round(k),b:Math.round(k),a:1};C<.5?T=C*(1+w):T=C+w-C*w;const N=2*C-T,O=[0,0,0];for(let A=0;A<3;A++)E=x+1/3*-(A-1),E<0&&E++,E>1&&E--,6*E<1?k=N+(T-N)*6*E:2*E<1?k=T:3*E<2?k=N+(T-N)*(2/3-E)*6:k=N,O[A]=k*255;return{r:Math.round(O[0]),g:Math.round(O[1]),b:Math.round(O[2]),a:1}}},haveIntersection(g,v){return!(v.x>g.x+g.width||v.x+v.widthg.y+g.height||v.y+v.height1?(T=S,E=x,k=(S-w)*(S-w)+(x-C)*(x-C)):(T=g+O*(S-g),E=v+O*(x-v),k=(T-w)*(T-w)+(E-C)*(E-C))}return[T,E,k]},_getProjectionToLine(g,v,S){var x=e.Util.cloneObject(g),w=Number.MAX_VALUE;return v.forEach(function(C,T){if(!(!S&&T===v.length-1)){var E=v[(T+1)%v.length],k=e.Util._getProjectionToSegment(C.x,C.y,E.x,E.y,g.x,g.y),N=k[0],O=k[1],A=k[2];Av.length){var T=v;v=g,g=T}for(x=0;x{v.width=0,v.height=0})},drawRoundedRectPath(g,v,S,x){let w=0,C=0,T=0,E=0;typeof x=="number"?w=C=T=E=Math.min(x,v/2,S/2):(w=Math.min(x[0]||0,v/2,S/2),C=Math.min(x[1]||0,v/2,S/2),E=Math.min(x[2]||0,v/2,S/2),T=Math.min(x[3]||0,v/2,S/2)),g.moveTo(w,0),g.lineTo(v-C,0),g.arc(v-C,C,C,Math.PI*3/2,0,!1),g.lineTo(v,S-E),g.arc(v-E,S-E,E,0,Math.PI/2,!1),g.lineTo(T,S),g.arc(T,S-T,T,Math.PI/2,Math.PI,!1),g.lineTo(0,w),g.arc(w,w,w,Math.PI,Math.PI*3/2,!1)}}})(fr);var rr={},kt={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getComponentValidator=Xe.getBooleanValidator=Xe.getNumberArrayValidator=Xe.getFunctionValidator=Xe.getStringOrGradientValidator=Xe.getStringValidator=Xe.getNumberOrAutoValidator=Xe.getNumberOrArrayOfNumbersValidator=Xe.getNumberValidator=Xe.alphaComponent=Xe.RGBComponent=void 0;const au=Rt,br=fr;function su(e){return br.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||br.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function xwe(e){return e>255?255:e<0?0:Math.round(e)}Xe.RGBComponent=xwe;function wwe(e){return e>1?1:e<1e-4?1e-4:e}Xe.alphaComponent=wwe;function Cwe(){if(au.Konva.isUnminified)return function(e,t){return br.Util._isNumber(e)||br.Util.warn(su(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}Xe.getNumberValidator=Cwe;function Awe(e){if(au.Konva.isUnminified)return function(t,n){let r=br.Util._isNumber(t),i=br.Util._isArray(t)&&t.length==e;return!r&&!i&&br.Util.warn(su(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}Xe.getNumberOrArrayOfNumbersValidator=Awe;function Ewe(){if(au.Konva.isUnminified)return function(e,t){var n=br.Util._isNumber(e),r=e==="auto";return n||r||br.Util.warn(su(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}Xe.getNumberOrAutoValidator=Ewe;function Twe(){if(au.Konva.isUnminified)return function(e,t){return br.Util._isString(e)||br.Util.warn(su(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}Xe.getStringValidator=Twe;function kwe(){if(au.Konva.isUnminified)return function(e,t){const n=br.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||br.Util.warn(su(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}Xe.getStringOrGradientValidator=kwe;function Pwe(){if(au.Konva.isUnminified)return function(e,t){return br.Util._isFunction(e)||br.Util.warn(su(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}Xe.getFunctionValidator=Pwe;function Iwe(){if(au.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(br.Util._isArray(e)?e.forEach(function(r){br.Util._isNumber(r)||br.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):br.Util.warn(su(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}Xe.getNumberArrayValidator=Iwe;function Rwe(){if(au.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||br.Util.warn(su(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}Xe.getBooleanValidator=Rwe;function Owe(e){if(au.Konva.isUnminified)return function(t,n){return t==null||br.Util.isObject(t)||br.Util.warn(su(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}Xe.getComponentValidator=Owe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=fr,n=Xe;var r="get",i="set";e.Factory={addGetterSetter(o,a,s,l,u){e.Factory.addGetter(o,a,s),e.Factory.addSetter(o,a,l,u),e.Factory.addOverloadedGetterSetter(o,a)},addGetter(o,a,s){var l=r+t.Util._capitalize(a);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[a];return u===void 0?s:u}},addSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]||e.Factory.overWriteSetter(o,a,s,l)},overWriteSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]=function(c){return s&&c!==void 0&&c!==null&&(c=s.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(o,a,s,l,u){var c=s.length,d=t.Util._capitalize,f=r+d(a),h=i+d(a),p,m;o.prototype[f]=function(){var b={};for(p=0;p{this._setAttr(a+d(v),void 0)}),this._fireChangeEvent(a,y,b),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,a)},addOverloadedGetterSetter(o,a){var s=t.Util._capitalize(a),l=i+s,u=r+s;o.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,a,s,l){t.Util.error("Adding deprecated "+a);var u=r+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?s:d},e.Factory.addSetter(o,a,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,a)},backCompat(o,a){t.Util.each(a,function(s,l){var u=o.prototype[l],c=r+t.Util._capitalize(s),d=i+t.Util._capitalize(s);function f(){u.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[s]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(kt);var ds={},zl={};Object.defineProperty(zl,"__esModule",{value:!0});zl.HitContext=zl.SceneContext=zl.Context=void 0;const NG=fr,Mwe=Rt;function $we(e){var t=[],n=e.length,r=NG.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=Nwe+u.join(_O)+Dwe)):(o+=s.property,t||(o+=jwe+s.val)),o+=Bwe;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=Vwe&&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,a){this._context.arc(t,n,r,i,o,a)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,a){this._context.bezierCurveTo(t,n,r,i,o,a)}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,a){return this._context.createRadialGradient(t,n,r,i,o,a)}drawImage(t,n,r,i,o,a,s,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,a,s,l,u)}ellipse(t,n,r,i,o,a,s,l){this._context.ellipse(t,n,r,i,o,a,s,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,a){this._context.setTransform(t,n,r,i,o,a)}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,a){this._context.transform(t,n,r,i,o,a)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=SO.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=$we(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,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,a)=>{const{node:s}=o,l=s.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=s.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:a}=o,s=a.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(c=>c.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))})(Sx);Object.defineProperty(rr,"__esModule",{value:!0});rr.Node=void 0;const $t=fr,Ly=kt,Jv=ds,jc=Rt,fa=Sx,kr=Xe;var ib="absoluteOpacity",e1="allEventListeners",Sl="absoluteTransform",xO="absoluteScale",Uc="canvas",Ywe="Change",Zwe="children",Jwe="konva",cE="listening",wO="mouseenter",CO="mouseleave",AO="set",EO="Shape",ob=" ",TO="stage",xu="transform",eCe="Stage",dE="visible",tCe=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(ob);let nCe=1;class gt{constructor(t){this._id=nCe++,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===xu||t===Sl)&&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===xu||t===Sl,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(ob);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Uc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===Sl&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Uc)){const{scene:t,filter:n,hit:r}=this._cache.get(Uc);$t.Util.releaseCanvas(t,n,r),this._cache.delete(Uc)}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),a=n.pixelRatio,s=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,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){$t.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,s-=u,l-=u;var f=new Jv.SceneCanvas({pixelRatio:a,width:i,height:o}),h=new Jv.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new Jv.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(Uc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-s,-l),_.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(ib),this._clearSelfAndDescendantCache(xO),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(Uc,{scene:f,filter:h,hit:p,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Uc)}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,a,s,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),{x:i,y:o,width:a-i,height:s-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(),a,s,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==Zwe&&(r=AO+$t.Util._capitalize(n),$t.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(cE,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(dE,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;fa.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!jc.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,a,s;function l(u){for(i=[],o=u.length,a=0;a0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==eCe&&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(xu),this._clearSelfAndDescendantCache(Sl)),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 $t.Transform,a=this.offset();return o.m=i.slice(),o.translate(a.x,a.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(xu);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(xu),this._clearSelfAndDescendantCache(Sl),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,a;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,a=0;a0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return $t.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 $t.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&$t.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(ib,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,a,s;t.attrs={};for(r in n)i=n[r],s=$t.Util.isObject(i)&&!$t.Util._isPlainObject(i)&&!$t.Util._isArray(i),!s&&(o=typeof this[r]=="function"&&this[r],delete n[r],a=o?o.call(this):null,n[r]=i,a!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),$t.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,$t.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():jc.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,a,s;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;fa.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=fa.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&fa.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 $t.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return $t.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=gt.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),jc.Konva[r]||($t.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=jc.Konva[r];if(o=new l(t.attrs),i)for(a=i.length,s=0;s0}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=c5.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=c5.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(),a=this._getCanvasCache(),s=a&&a.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(s){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(),a=this._getCanvasCache(),s=a&&a.hit;if(s){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(),a=this.clipWidth(),s=this.clipHeight(),l=this.clipFunc(),u=a&&s||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,a,s)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,a,s,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,a=_.y,s=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),a=Math.min(a,_.y),s=Math.max(s,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hJ.indexOf("pointer")>=0?"pointer":J.indexOf("touch")>=0?"touch":"mouse",U=J=>{const j=B(J);if(j==="pointer")return i.Konva.pointerEventsEnabled&&$.pointer;if(j==="touch")return $.touch;if(j==="mouse")return $.mouse};function G(J={}){return(J.clipFunc||J.clipWidth||J.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),J}const Y="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 ee extends r.Container{constructor(j){super(G(j)),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",()=>{G(this.attrs)}),this._checkVisibility()}_validateAdd(j){const Q=j.getType()==="Layer",ne=j.getType()==="FastLayer";Q||ne||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const j=this.visible()?"":"none";this.content.style.display=j}setContainer(j){if(typeof j===c){if(j.charAt(0)==="."){var Q=j.slice(1);j=document.getElementsByClassName(Q)[0]}else{var ne;j.charAt(0)!=="#"?ne=j:ne=j.slice(1),j=document.getElementById(ne)}if(!j)throw"Can not find container in document with id "+ne}return this._setAttr("container",j),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),j.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var j=this.children,Q=j.length,ne;for(ne=0;ne-1&&e.stages.splice(Q,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const j=this._pointerPositions[0]||this._changedPointerPositions[0];return j?{x:j.x,y:j.y}:(t.Util.warn(Y),null)}_getPointerById(j){return this._pointerPositions.find(Q=>Q.id===j)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(j){j=j||{},j.x=j.x||0,j.y=j.y||0,j.width=j.width||this.width(),j.height=j.height||this.height();var Q=new o.SceneCanvas({width:j.width,height:j.height,pixelRatio:j.pixelRatio||1}),ne=Q.getContext()._context,se=this.children;return(j.x||j.y)&&ne.translate(-1*j.x,-1*j.y),se.forEach(function(Se){if(Se.isVisible()){var ce=Se._toKonvaCanvas(j);ne.drawImage(ce._canvas,j.x,j.y,ce.getWidth()/ce.getPixelRatio(),ce.getHeight()/ce.getPixelRatio())}}),Q}getIntersection(j){if(!j)return null;var Q=this.children,ne=Q.length,se=ne-1,Se;for(Se=se;Se>=0;Se--){const ce=Q[Se].getIntersection(j);if(ce)return ce}return null}_resizeDOM(){var j=this.width(),Q=this.height();this.content&&(this.content.style.width=j+d,this.content.style.height=Q+d),this.bufferCanvas.setSize(j,Q),this.bufferHitCanvas.setSize(j,Q),this.children.forEach(ne=>{ne.setSize({width:j,height:Q}),ne.draw()})}add(j,...Q){if(arguments.length>1){for(var ne=0;neM&&t.Util.warn("The stage has "+se+" 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."),j.setSize({width:this.width(),height:this.height()}),j.draw(),i.Konva.isBrowser&&this.content.appendChild(j.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(j){return l.hasPointerCapture(j,this)}setPointerCapture(j){l.setPointerCapture(j,this)}releaseCapture(j){l.releaseCapture(j,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&R.forEach(([j,Q])=>{this.content.addEventListener(j,ne=>{this[Q](ne)},{passive:!1})})}_pointerenter(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerenter,{evt:j,target:this,currentTarget:this})}_pointerover(j){this.setPointersPositions(j);const Q=U(j.type);this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this})}_getTargetShape(j){let Q=this[j+"targetShape"];return Q&&!Q.getStage()&&(Q=null),Q}_pointerleave(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=this._getTargetShape(ne),Se=!a.DD.isDragging||i.Konva.hitOnDragEnabled;se&&Se?(se._fireAndBubble(Q.pointerout,{evt:j}),se._fireAndBubble(Q.pointerleave,{evt:j}),this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this[ne+"targetShape"]=null):Se&&(this._fire(Q.pointerleave,{evt:j,target:this,currentTarget:this}),this._fire(Q.pointerout,{evt:j,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(j){const Q=U(j.type),ne=B(j.type);if(Q){this.setPointersPositions(j);var se=!1;this._changedPointerPositions.forEach(Se=>{var ce=this.getIntersection(Se);if(a.DD.justDragged=!1,i.Konva["_"+ne+"ListenClick"]=!0,!(ce&&ce.isListening()))return;i.Konva.capturePointerEventsEnabled&&ce.setPointerCapture(Se.id),this[ne+"ClickStartShape"]=ce,ce._fireAndBubble(Q.pointerdown,{evt:j,pointerId:Se.id}),se=!0;const ot=j.type.indexOf("touch")>=0;ce.preventDefault()&&j.cancelable&&ot&&j.preventDefault()}),se||this._fire(Q.pointerdown,{evt:j,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;a.DD.isDragging&&a.DD.node.preventDefault()&&j.cancelable&&j.preventDefault(),this.setPointersPositions(j);var se=!a.DD.isDragging||i.Konva.hitOnDragEnabled;if(!se)return;var Se={};let ce=!1;var bt=this._getTargetShape(ne);this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot),mt=ot.id,Ie={evt:j,pointerId:mt};var en=bt!==ze;if(en&&bt&&(bt._fireAndBubble(Q.pointerout,Object.assign({},Ie),ze),bt._fireAndBubble(Q.pointerleave,Object.assign({},Ie),ze)),ze){if(Se[ze._id])return;Se[ze._id]=!0}ze&&ze.isListening()?(ce=!0,en&&(ze._fireAndBubble(Q.pointerover,Object.assign({},Ie),bt),ze._fireAndBubble(Q.pointerenter,Object.assign({},Ie),bt),this[ne+"targetShape"]=ze),ze._fireAndBubble(Q.pointermove,Object.assign({},Ie))):bt&&(this._fire(Q.pointerover,{evt:j,target:this,currentTarget:this,pointerId:mt}),this[ne+"targetShape"]=null)}),ce||this._fire(Q.pointermove,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(j){const Q=U(j.type),ne=B(j.type);if(!Q)return;this.setPointersPositions(j);const se=this[ne+"ClickStartShape"],Se=this[ne+"ClickEndShape"];var ce={};let bt=!1;this._changedPointerPositions.forEach(ot=>{const ze=l.getCapturedShape(ot.id)||this.getIntersection(ot);if(ze){if(ze.releaseCapture(ot.id),ce[ze._id])return;ce[ze._id]=!0}const mt=ot.id,Ie={evt:j,pointerId:mt};let en=!1;i.Konva["_"+ne+"InDblClickWindow"]?(en=!0,clearTimeout(this[ne+"DblTimeout"])):a.DD.justDragged||(i.Konva["_"+ne+"InDblClickWindow"]=!0,clearTimeout(this[ne+"DblTimeout"])),this[ne+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ne+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),ze&&ze.isListening()?(bt=!0,this[ne+"ClickEndShape"]=ze,ze._fireAndBubble(Q.pointerup,Object.assign({},Ie)),i.Konva["_"+ne+"ListenClick"]&&se&&se===ze&&(ze._fireAndBubble(Q.pointerclick,Object.assign({},Ie)),en&&Se&&Se===ze&&ze._fireAndBubble(Q.pointerdblclick,Object.assign({},Ie)))):(this[ne+"ClickEndShape"]=null,i.Konva["_"+ne+"ListenClick"]&&this._fire(Q.pointerclick,{evt:j,target:this,currentTarget:this,pointerId:mt}),en&&this._fire(Q.pointerdblclick,{evt:j,target:this,currentTarget:this,pointerId:mt}))}),bt||this._fire(Q.pointerup,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ne+"ListenClick"]=!1,j.cancelable&&ne!=="touch"&&j.preventDefault()}_contextmenu(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(N,{evt:j}):this._fire(N,{evt:j,target:this,currentTarget:this})}_wheel(j){this.setPointersPositions(j);var Q=this.getIntersection(this.getPointerPosition());Q&&Q.isListening()?Q._fireAndBubble(L,{evt:j}):this._fire(L,{evt:j,target:this,currentTarget:this})}_pointercancel(j){this.setPointersPositions(j);const Q=l.getCapturedShape(j.pointerId)||this.getIntersection(this.getPointerPosition());Q&&Q._fireAndBubble(S,l.createEvent(j)),l.releaseCapture(j.pointerId)}_lostpointercapture(j){l.releaseCapture(j.pointerId)}setPointersPositions(j){var Q=this._getContentPosition(),ne=null,se=null;j=j||window.event,j.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(j.touches,Se=>{this._pointerPositions.push({id:Se.identifier,x:(Se.clientX-Q.left)/Q.scaleX,y:(Se.clientY-Q.top)/Q.scaleY})}),Array.prototype.forEach.call(j.changedTouches||j.touches,Se=>{this._changedPointerPositions.push({id:Se.identifier,x:(Se.clientX-Q.left)/Q.scaleX,y:(Se.clientY-Q.top)/Q.scaleY})})):(ne=(j.clientX-Q.left)/Q.scaleX,se=(j.clientY-Q.top)/Q.scaleY,this.pointerPos={x:ne,y:se},this._pointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}],this._changedPointerPositions=[{x:ne,y:se,id:t.Util._getFirstPointerId(j)}])}_setPointerPosition(j){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(j)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var j=this.content.getBoundingClientRect();return{top:j.top,left:j.left,scaleX:j.width/this.content.clientWidth||1,scaleY:j.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 j=this.container();if(!j)throw"Stage has no container. A container is required.";j.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"),j.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(j){j.batchDraw()}),this}}e.Stage=ee,ee.prototype.nodeType=u,(0,s._registerNode)(ee),n.Factory.addGetterSetter(ee,"container")})(FG);var Fy={},Yr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Rt,n=fr,r=kt,i=rr,o=Xe,a=Rt,s=Qo;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(T){const E=this.attrs.fillRule;E?T.fill(E):T.fill()}function _(T){T.stroke()}function b(T){T.fill()}function y(T){T.stroke()}function g(){this._clearCache(l)}function v(){this._clearCache(u)}function S(){this._clearCache(c)}function x(){this._clearCache(d)}function w(){this._clearCache(f)}class C extends i.Node{constructor(E){super(E);let k;for(;k=n.Util.getRandomColor(),!(k&&!(k in e.shapes)););this.colorKey=k,e.shapes[k]=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(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var E=p();const k=E.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(k&&k.setTransform){const N=new n.Transform;N.translate(this.fillPatternX(),this.fillPatternY()),N.rotate(t.Konva.getAngle(this.fillPatternRotation())),N.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),N.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const O=N.getMatrix(),A=typeof DOMMatrix>"u"?{a:O[0],b:O[1],c:O[2],d:O[3],e:O[4],f:O[5]}:new DOMMatrix(O);k.setTransform(A)}return k}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var E=this.fillLinearGradientColorStops();if(E){for(var k=p(),N=this.fillLinearGradientStartPoint(),O=this.fillLinearGradientEndPoint(),A=k.createLinearGradient(N.x,N.y,O.x,O.y),P=0;Pthis.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 E=this.hitStrokeWidth();return E==="auto"?this.hasStroke():this.strokeEnabled()&&!!E}intersects(E){var k=this.getStage(),N=k.bufferHitCanvas,O;return N.getContext().clear(),this.drawHit(N,null,!0),O=N.context.getImageData(Math.round(E.x),Math.round(E.y),1,1).data,O[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(E){var k;if(!this.getStage()||!((k=this.attrs.perfectDrawEnabled)!==null&&k!==void 0?k:!0))return!1;const O=E||this.hasFill(),A=this.hasStroke(),P=this.getAbsoluteOpacity()!==1;if(O&&A&&P)return!0;const D=this.hasShadow(),L=this.shadowForStrokeEnabled();return!!(O&&A&&D&&L)}setStrokeHitEnabled(E){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),E?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var E=this.size();return{x:this._centroid?-E.width/2:0,y:this._centroid?-E.height/2:0,width:E.width,height:E.height}}getClientRect(E={}){const k=E.skipTransform,N=E.relativeTo,O=this.getSelfRect(),P=!E.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,D=O.width+P,L=O.height+P,M=!E.skipShadow&&this.hasShadow(),R=M?this.shadowOffsetX():0,$=M?this.shadowOffsetY():0,B=D+Math.abs(R),U=L+Math.abs($),G=M&&this.shadowBlur()||0,Y=B+G*2,ee=U+G*2,J={width:Y,height:ee,x:-(P/2+G)+Math.min(R,0)+O.x,y:-(P/2+G)+Math.min($,0)+O.y};return k?J:this._transformedRect(J,N)}drawScene(E,k){var N=this.getLayer(),O=E||N.getCanvas(),A=O.getContext(),P=this._getCanvasCache(),D=this.getSceneFunc(),L=this.hasShadow(),M,R,$,B=O.isCache,U=k===this;if(!this.isVisible()&&!U)return this;if(P){A.save();var G=this.getAbsoluteTransform(k).getMatrix();return A.transform(G[0],G[1],G[2],G[3],G[4],G[5]),this._drawCachedSceneCanvas(A),A.restore(),this}if(!D)return this;if(A.save(),this._useBufferCanvas()&&!B){M=this.getStage(),R=M.bufferCanvas,$=R.getContext(),$.clear(),$.save(),$._applyLineJoin(this);var Y=this.getAbsoluteTransform(k).getMatrix();$.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),D.call(this,$,this),$.restore();var ee=R.pixelRatio;L&&A._applyShadow(this),A._applyOpacity(this),A._applyGlobalCompositeOperation(this),A.drawImage(R._canvas,0,0,R.width/ee,R.height/ee)}else{if(A._applyLineJoin(this),!U){var Y=this.getAbsoluteTransform(k).getMatrix();A.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]),A._applyOpacity(this),A._applyGlobalCompositeOperation(this)}L&&A._applyShadow(this),D.call(this,A,this)}return A.restore(),this}drawHit(E,k,N=!1){if(!this.shouldDrawHit(k,N))return this;var O=this.getLayer(),A=E||O.hitCanvas,P=A&&A.getContext(),D=this.hitFunc()||this.sceneFunc(),L=this._getCanvasCache(),M=L&&L.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()"),M){P.save();var R=this.getAbsoluteTransform(k).getMatrix();return P.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(P),P.restore(),this}if(!D)return this;if(P.save(),P._applyLineJoin(this),!(this===k)){var B=this.getAbsoluteTransform(k).getMatrix();P.transform(B[0],B[1],B[2],B[3],B[4],B[5])}return D.call(this,P,this),P.restore(),this}drawHitFromCache(E=0){var k=this._getCanvasCache(),N=this._getCachedSceneCanvas(),O=k.hit,A=O.getContext(),P=O.getWidth(),D=O.getHeight(),L,M,R,$,B,U;A.clear(),A.drawImage(N._canvas,0,0,P,D);try{for(L=A.getImageData(0,0,P,D),M=L.data,R=M.length,$=n.Util._hexToRgb(this.colorKey),B=0;BE?(M[B]=$.r,M[B+1]=$.g,M[B+2]=$.b,M[B+3]=255):M[B+3]=0;A.putImageData(L,0,0)}catch(G){n.Util.error("Unable to draw hit graph from cached scene canvas. "+G.message)}return this}hasPointerCapture(E){return s.hasPointerCapture(E,this)}setPointerCapture(E){s.setPointerCapture(E,this)}releaseCapture(E){s.releaseCapture(E,this)}}e.Shape=C,C.prototype._fillFunc=m,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=b,C.prototype._strokeFuncHit=y,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",v),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",x),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",w),r.Factory.addGetterSetter(C,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"lineJoin"),r.Factory.addGetterSetter(C,"lineCap"),r.Factory.addGetterSetter(C,"sceneFunc"),r.Factory.addGetterSetter(C,"hitFunc"),r.Factory.addGetterSetter(C,"dash"),r.Factory.addGetterSetter(C,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(C,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternImage"),r.Factory.addGetterSetter(C,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(C,"fillEnabled",!0),r.Factory.addGetterSetter(C,"strokeEnabled",!0),r.Factory.addGetterSetter(C,"shadowEnabled",!0),r.Factory.addGetterSetter(C,"dashEnabled",!0),r.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(C,"fillPriority","color"),r.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(C,"fillPatternRotation",0),r.Factory.addGetterSetter(C,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Yr);Object.defineProperty(Fy,"__esModule",{value:!0});Fy.Layer=void 0;const yl=fr,d5=Yd,wf=rr,zk=kt,kO=ds,sCe=Xe,lCe=Yr,uCe=Rt;var cCe="#",dCe="beforeDraw",fCe="draw",jG=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],hCe=jG.length;class Rp extends d5.Container{constructor(t){super(t),this.canvas=new kO.SceneCanvas,this.hitCanvas=new kO.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(dCe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),d5.Container.prototype.drawScene.call(this,i,n),this._fire(fCe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),d5.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){yl.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return yl.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 yl.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Fy.Layer=Rp;Rp.prototype.nodeType="Layer";(0,uCe._registerNode)(Rp);zk.Factory.addGetterSetter(Rp,"imageSmoothingEnabled",!0);zk.Factory.addGetterSetter(Rp,"clearBeforeDraw",!0);zk.Factory.addGetterSetter(Rp,"hitGraphEnabled",!0,(0,sCe.getBooleanValidator)());var wx={};Object.defineProperty(wx,"__esModule",{value:!0});wx.FastLayer=void 0;const pCe=fr,gCe=Fy,mCe=Rt;class jk extends gCe.Layer{constructor(t){super(t),this.listening(!1),pCe.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}wx.FastLayer=jk;jk.prototype.nodeType="FastLayer";(0,mCe._registerNode)(jk);var Op={};Object.defineProperty(Op,"__esModule",{value:!0});Op.Group=void 0;const yCe=fr,vCe=Yd,bCe=Rt;class Uk extends vCe.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&yCe.Util.throw("You may only add groups and shapes to groups.")}}Op.Group=Uk;Uk.prototype.nodeType="Group";(0,bCe._registerNode)(Uk);var Mp={};Object.defineProperty(Mp,"__esModule",{value:!0});Mp.Animation=void 0;const f5=Rt,PO=fr;var h5=function(){return f5.glob.performance&&f5.glob.performance.now?function(){return f5.glob.performance.now()}:function(){return new Date().getTime()}}();class Ls{constructor(t,n){this.id=Ls.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:h5(),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():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=s,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(p){this.pause(),this._time=p,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 p=this.getTimer()-this._startTime;this.state===s?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,b=_._id,y,g=p.easing||e.Easings.Linear,v=!!p.yoyo,S;typeof p.duration>"u"?y=.3:p.duration===0?y=.001:y=p.duration,this.node=_,this._id=u++;var x=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);x||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(){m.tween.onEnterFrame()},x),this.tween=new d(S,function(w){m._tweenFunc(w)},g,0,1,y*1e3,v),this._addListeners(),f.attrs[b]||(f.attrs[b]={}),f.attrs[b][this._id]||(f.attrs[b][this._id]={}),f.tweens[b]||(f.tweens[b]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,b=_._id,y,g,v,S,x,w,C,T;if(v=f.tweens[b][p],v&&delete f.attrs[b][v][p],y=_.getAttr(p),t.Util._isArray(m))if(g=[],x=Math.max(m.length,y.length),p==="points"&&m.length!==y.length&&(m.length>y.length?(C=y,y=t.Util._prepareArrayForTween(y,m,_.closed())):(w=m,m=t.Util._prepareArrayForTween(m,y,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.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(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],b;this.pause();for(b in _)delete f.tweens[p][b];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var b=1.70158;return m*(h/=_)*h*((b+1)*h-b)+p},BackEaseOut(h,p,m,_){var b=1.70158;return m*((h=h/_-1)*h*((b+1)*h+b)+1)+p},BackEaseInOut(h,p,m,_){var b=1.70158;return(h/=_/2)<1?m/2*(h*h*(((b*=1.525)+1)*h-b))+p:m/2*((h-=2)*h*(((b*=1.525)+1)*h+b)+2)+p},ElasticEaseIn(h,p,m,_,b,y){var g=0;return h===0?p:(h/=_)===1?p+m:(y||(y=_*.3),!b||b0?t:n),c=a*n,d=s*(s>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}Cx.Arc=lu;lu.prototype._centroid=!0;lu.prototype.className="Arc";lu.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,SCe._registerNode)(lu);Ax.Factory.addGetterSetter(lu,"innerRadius",0,(0,Ex.getNumberValidator)());Ax.Factory.addGetterSetter(lu,"outerRadius",0,(0,Ex.getNumberValidator)());Ax.Factory.addGetterSetter(lu,"angle",0,(0,Ex.getNumberValidator)());Ax.Factory.addGetterSetter(lu,"clockwise",!1,(0,Ex.getBooleanValidator)());var Tx={},By={};Object.defineProperty(By,"__esModule",{value:!0});By.Line=void 0;const kx=kt,xCe=Yr,VG=Xe,wCe=Rt;function fE(e,t,n,r,i,o,a){var s=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=a*s/(s+l),c=a*l/(s+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function RO(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(s=this.getTensionPoints(),l=s.length,u=o?0:4,o||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(a,s,d);return u*c};e.getCubicArcLength=t;const n=(a,s,l)=>{l===void 0&&(l=1);const u=a[0]-2*a[1]+a[2],c=s[0]-2*s[1]+s[2],d=2*a[1]-2*a[0],f=2*s[1]-2*s[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(s[2]-s[0],2));const _=p/(2*h),b=m/h,y=l+_,g=b-_*_,v=y*y+g>0?Math.sqrt(y*y+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,x=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((y+v)/(_+S))):0;return Math.sqrt(h)/2*(y*v-_*S+x)};e.getQuadraticArcLength=n;function r(a,s,l){const u=i(1,l,a),c=i(1,l,s),d=u*u+c*c;return Math.sqrt(d)}const i=(a,s,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(a===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-s,u-f)*Math.pow(s,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=a/s,d=(a-l(c))/s,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(a-h)/s;if(p500)break}return c};e.t2length=o})(GG);Object.defineProperty($p,"__esModule",{value:!0});$p.Path=void 0;const CCe=kt,ACe=Yr,ECe=Rt,Cf=GG;class Hr extends ACe.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Hr.parsePathData(this.data()),this.pathLength=Hr.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,b=u>c?c/u:1;t.translate(s,l),t.rotate(h),t.scale(_,b),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/b),t.rotate(-h),t.translate(-s,-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 c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=Hr.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[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 a=n[i],s=a.points;switch(a.command){case"L":return Hr.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return Hr.getPointOnCubicBezier((0,Cf.t2length)(t,Hr.getPathLength(n),m=>(0,Cf.getCubicArcLength)([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return Hr.getPointOnQuadraticBezier((0,Cf.t2length)(t,Hr.getPathLength(n),m=>(0,Cf.getQuadraticArcLength)([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var l=s[0],u=s[1],c=s[2],d=s[3],f=s[4],h=s[5],p=s[6];return f+=h*t/a.pathLength,Hr.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,a,s){a===void 0&&(a=n),s===void 0&&(s=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var y=null,g=[],v=l,S=u,x,w,C,T,E,k,N,O,A,P;switch(h){case"l":l+=p.shift(),u+=p.shift(),y="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var D=p.shift(),L=p.shift();if(l+=D,u+=L,y="M",a.length>2&&a[a.length-1].command==="z"){for(var M=a.length-2;M>=0;M--)if(a[M].command==="M"){l=a[M].points[0]+D,u=a[M].points[1]+L;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),y="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),y="L",g.push(l,u);break;case"H":l=p.shift(),y="L",g.push(l,u);break;case"v":u+=p.shift(),y="L",g.push(l,u);break;case"V":u=p.shift(),y="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",g.push(l,u);break;case"S":w=l,C=u,x=a[a.length-1],x.command==="C"&&(w=l+(l-x.points[2]),C=u+(u-x.points[3])),g.push(w,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),y="C",g.push(l,u);break;case"s":w=l,C=u,x=a[a.length-1],x.command==="C"&&(w=l+(l-x.points[2]),C=u+(u-x.points[3])),g.push(w,C,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="Q",g.push(l,u);break;case"T":w=l,C=u,x=a[a.length-1],x.command==="Q"&&(w=l+(l-x.points[0]),C=u+(u-x.points[1])),l=p.shift(),u=p.shift(),y="Q",g.push(w,C,l,u);break;case"t":w=l,C=u,x=a[a.length-1],x.command==="Q"&&(w=l+(l-x.points[0]),C=u+(u-x.points[1])),l+=p.shift(),u+=p.shift(),y="Q",g.push(w,C,l,u);break;case"A":T=p.shift(),E=p.shift(),k=p.shift(),N=p.shift(),O=p.shift(),A=l,P=u,l=p.shift(),u=p.shift(),y="A",g=this.convertEndpointToCenterParameterization(A,P,l,u,N,O,T,E,k);break;case"a":T=p.shift(),E=p.shift(),k=p.shift(),N=p.shift(),O=p.shift(),A=l,P=u,l+=p.shift(),u+=p.shift(),y="A",g=this.convertEndpointToCenterParameterization(A,P,l,u,N,O,T,E,k);break}a.push({command:y||h,points:g,start:{x:v,y:S},pathLength:this.calcLength(v,S,y||h,g)})}(h==="z"||h==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,i){var o,a,s,l,u=Hr;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,Cf.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,Cf.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)s=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(l=c+h;l1&&(s*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((s*s*(l*l)-s*s*(f*f)-l*l*(d*d))/(s*s*(f*f)+l*l*(d*d)));o===a&&(p*=-1),isNaN(p)&&(p=0);var m=p*s*f/l,_=p*-l*d/s,b=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,y=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(E){return Math.sqrt(E[0]*E[0]+E[1]*E[1])},v=function(E,k){return(E[0]*k[0]+E[1]*k[1])/(g(E)*g(k))},S=function(E,k){return(E[0]*k[1]=1&&(T=0),a===0&&T>0&&(T=T-2*Math.PI),a===1&&T<0&&(T=T+2*Math.PI),[b,y,s,l,x,T,c,a]}}$p.Path=Hr;Hr.prototype.className="Path";Hr.prototype._attrsAffectingSize=["data"];(0,ECe._registerNode)(Hr);CCe.Factory.addGetterSetter(Hr,"data");Object.defineProperty(Tx,"__esModule",{value:!0});Tx.Arrow=void 0;const Px=kt,TCe=By,HG=Xe,kCe=Rt,OO=$p;class Jd extends TCe.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 a=this.pointerLength(),s=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],h=OO.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=OO.Path.getPointOnQuadraticBezier(Math.min(1,1-a/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[s-2]-p.x,u=r[s-1]-p.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/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(-a,d/2),t.lineTo(-a,-d/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}}}Tx.Arrow=Jd;Jd.prototype.className="Arrow";(0,kCe._registerNode)(Jd);Px.Factory.addGetterSetter(Jd,"pointerLength",10,(0,HG.getNumberValidator)());Px.Factory.addGetterSetter(Jd,"pointerWidth",10,(0,HG.getNumberValidator)());Px.Factory.addGetterSetter(Jd,"pointerAtBeginning",!1);Px.Factory.addGetterSetter(Jd,"pointerAtEnding",!0);var Ix={};Object.defineProperty(Ix,"__esModule",{value:!0});Ix.Circle=void 0;const PCe=kt,ICe=Yr,RCe=Xe,OCe=Rt;let Np=class extends ICe.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)}};Ix.Circle=Np;Np.prototype._centroid=!0;Np.prototype.className="Circle";Np.prototype._attrsAffectingSize=["radius"];(0,OCe._registerNode)(Np);PCe.Factory.addGetterSetter(Np,"radius",0,(0,RCe.getNumberValidator)());var Rx={};Object.defineProperty(Rx,"__esModule",{value:!0});Rx.Ellipse=void 0;const Vk=kt,MCe=Yr,qG=Xe,$Ce=Rt;class Oc extends MCe.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)}}Rx.Ellipse=Oc;Oc.prototype.className="Ellipse";Oc.prototype._centroid=!0;Oc.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,$Ce._registerNode)(Oc);Vk.Factory.addComponentsGetterSetter(Oc,"radius",["x","y"]);Vk.Factory.addGetterSetter(Oc,"radiusX",0,(0,qG.getNumberValidator)());Vk.Factory.addGetterSetter(Oc,"radiusY",0,(0,qG.getNumberValidator)());var Ox={};Object.defineProperty(Ox,"__esModule",{value:!0});Ox.Image=void 0;const p5=fr,ef=kt,NCe=Yr,DCe=Rt,zy=Xe;let ul=class WG extends NCe.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 a;if(o){const s=this.attrs.cropWidth,l=this.attrs.cropHeight;s&&l?a=[o,this.cropX(),this.cropY(),s,l,0,0,n,r]:a=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?p5.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,a))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?p5.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=p5.Util.createImageElement();i.onload=function(){var o=new WG({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};Ox.Image=ul;ul.prototype.className="Image";(0,DCe._registerNode)(ul);ef.Factory.addGetterSetter(ul,"cornerRadius",0,(0,zy.getNumberOrArrayOfNumbersValidator)(4));ef.Factory.addGetterSetter(ul,"image");ef.Factory.addComponentsGetterSetter(ul,"crop",["x","y","width","height"]);ef.Factory.addGetterSetter(ul,"cropX",0,(0,zy.getNumberValidator)());ef.Factory.addGetterSetter(ul,"cropY",0,(0,zy.getNumberValidator)());ef.Factory.addGetterSetter(ul,"cropWidth",0,(0,zy.getNumberValidator)());ef.Factory.addGetterSetter(ul,"cropHeight",0,(0,zy.getNumberValidator)());var fp={};Object.defineProperty(fp,"__esModule",{value:!0});fp.Tag=fp.Label=void 0;const Mx=kt,LCe=Yr,FCe=Op,Gk=Xe,KG=Rt;var QG=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],BCe="Change.konva",zCe="none",hE="up",pE="right",gE="down",mE="left",jCe=QG.length;class Hk extends FCe.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,a.x),r=Math.max(r,a.x),i=Math.min(i,a.y),o=Math.max(o,a.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)}}Nx.RegularPolygon=nf;nf.prototype.className="RegularPolygon";nf.prototype._centroid=!0;nf.prototype._attrsAffectingSize=["radius"];(0,KCe._registerNode)(nf);XG.Factory.addGetterSetter(nf,"radius",0,(0,YG.getNumberValidator)());XG.Factory.addGetterSetter(nf,"sides",0,(0,YG.getNumberValidator)());var Dx={};Object.defineProperty(Dx,"__esModule",{value:!0});Dx.Ring=void 0;const ZG=kt,QCe=Yr,JG=Xe,XCe=Rt;var MO=Math.PI*2;class rf extends QCe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,MO,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),MO,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)}}Dx.Ring=rf;rf.prototype.className="Ring";rf.prototype._centroid=!0;rf.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,XCe._registerNode)(rf);ZG.Factory.addGetterSetter(rf,"innerRadius",0,(0,JG.getNumberValidator)());ZG.Factory.addGetterSetter(rf,"outerRadius",0,(0,JG.getNumberValidator)());var Lx={};Object.defineProperty(Lx,"__esModule",{value:!0});Lx.Sprite=void 0;const of=kt,YCe=Yr,ZCe=Mp,eH=Xe,JCe=Rt;class cl extends YCe.Shape{constructor(t){super(t),this._updated=!0,this.anim=new ZCe.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],a=this.frameOffsets(),s=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[n],h=r*2;t.drawImage(d,s,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,s,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+2],l=o[i+3];if(t.beginPath(),a){var u=a[n],c=r*2;t.rect(u[c+0],u[c+1],s,l)}else t.rect(0,0,s,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 n1;function m5(){return n1||(n1=yE.Util.createCanvasElement().getContext(a5e),n1)}function y5e(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function v5e(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function b5e(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}let Pr=class extends n5e.Shape{constructor(t){super(b5e(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(b+=a)}}}_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=yE.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(s5e,n),this}getWidth(){var t=this.attrs.width===Af||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Af||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 yE.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=m5(),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()+t1+this.fontVariant()+t1+(this.fontSize()+d5e)+m5e(this.fontFamily())}_addTextLine(t){this.align()===dg&&(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 m5().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,a=this.attrs.height,s=o!==Af&&o!==void 0,l=a!==Af&&a!==void 0,u=this.padding(),c=o-u*2,d=a-u*2,f=0,h=this.wrap(),p=h!==DO,m=h!==p5e&&p,_=this.ellipsis();this.textArr=[],m5().font=this._getContextFont();for(var b=_?this._getTextWidth(g5):0,y=0,g=t.length;yc)for(;v.length>0;){for(var x=0,w=v.length,C="",T=0;x>>1,k=v.slice(0,E+1),N=this._getTextWidth(k)+b;N<=c?(x=E+1,C=k,T=N):w=E}if(C){if(m){var O,A=v[C.length],P=A===t1||A===$O;P&&T<=c?O=C.length:O=Math.max(C.lastIndexOf(t1),C.lastIndexOf($O))+1,O>0&&(x=O,C=C.slice(0,x),T=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,T),f+=i;var D=this._shouldHandleEllipsis(f);if(D){this._tryToAddEllipsisToLastLine();break}if(v=v.slice(x),v=v.trimLeft(),v.length>0&&(S=this._getTextWidth(v),S<=c)){this._addTextLine(v),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(v),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&yd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==Af&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==DO;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Af&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+g5)n?null:fg.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=fg.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 a=0;a=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${uH}`).join(" "),BO="nodesRect",T5e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],k5e={"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 P5e="ontouchstart"in Ka.Konva._global;function I5e(e,t){if(e==="rotater")return"crosshair";t+=Cn.Util.degToRad(k5e[e]||0);var n=(Cn.Util.radToDeg(t)%360+360)%360;return Cn.Util._inRange(n,315+22.5,360)||Cn.Util._inRange(n,0,22.5)?"ns-resize":Cn.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":Cn.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":Cn.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":Cn.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":Cn.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":Cn.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":Cn.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(Cn.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var Z_=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],zO=1e8;function R5e(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 cH(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 O5e(e,t){const n=R5e(e);return cH(e,t,n)}function M5e(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(Cn.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()},a=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(a,o),i.on(T5e.map(s=>s+`.${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,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.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(BO),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(BO,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(Ka.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+s*Math.cos(u)+l*Math.sin(-u),y:a.y+l*Math.cos(u)+s*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return cH(c,-Ka.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-zO,y:-zO,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new Cn.Transform;r.rotate(-Ka.Konva.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:Ka.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(),Z_.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new C5e.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:P5e?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=Ka.Konva.getAngle(this.rotation()),o=I5e(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 w5e.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()*Cn.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 a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.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),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let O=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(O-=Math.PI);var f=Ka.Konva.getAngle(this.rotation());const A=f+O,P=Ka.Konva.getAngle(this.rotationSnapTolerance()),L=M5e(this.rotationSnaps(),A,P)-d.rotation,M=O5e(d,L);this._fitNodesInto(M,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{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(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,b=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{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()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*b,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var y=o.position();this.findOne(".top-left").y(y.y),this.findOne(".bottom-right").x(y.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(p){var m=g?{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(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(Cn.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(Cn.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new Cn.Transform;if(a.rotate(Ka.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:Cn.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new Cn.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new Cn.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new Cn.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(Cn.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(Cn.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.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+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*Cn.Util._sign(i)-s,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 c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(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=""),FO.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return LO.Node.prototype.toObject.call(this)}clone(t){var n=LO.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}zx.Transformer=Jt;function $5e(e){return e instanceof Array||Cn.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Z_.indexOf(t)===-1&&Cn.Util.warn("Unknown anchor name: "+t+". Available names are: "+Z_.join(", "))}),e||[]}Jt.prototype.className="Transformer";(0,A5e._registerNode)(Jt);bn.Factory.addGetterSetter(Jt,"enabledAnchors",Z_,$5e);bn.Factory.addGetterSetter(Jt,"flipEnabled",!0,(0,Nc.getBooleanValidator)());bn.Factory.addGetterSetter(Jt,"resizeEnabled",!0);bn.Factory.addGetterSetter(Jt,"anchorSize",10,(0,Nc.getNumberValidator)());bn.Factory.addGetterSetter(Jt,"rotateEnabled",!0);bn.Factory.addGetterSetter(Jt,"rotationSnaps",[]);bn.Factory.addGetterSetter(Jt,"rotateAnchorOffset",50,(0,Nc.getNumberValidator)());bn.Factory.addGetterSetter(Jt,"rotationSnapTolerance",5,(0,Nc.getNumberValidator)());bn.Factory.addGetterSetter(Jt,"borderEnabled",!0);bn.Factory.addGetterSetter(Jt,"anchorStroke","rgb(0, 161, 255)");bn.Factory.addGetterSetter(Jt,"anchorStrokeWidth",1,(0,Nc.getNumberValidator)());bn.Factory.addGetterSetter(Jt,"anchorFill","white");bn.Factory.addGetterSetter(Jt,"anchorCornerRadius",0,(0,Nc.getNumberValidator)());bn.Factory.addGetterSetter(Jt,"borderStroke","rgb(0, 161, 255)");bn.Factory.addGetterSetter(Jt,"borderStrokeWidth",1,(0,Nc.getNumberValidator)());bn.Factory.addGetterSetter(Jt,"borderDash");bn.Factory.addGetterSetter(Jt,"keepRatio",!0);bn.Factory.addGetterSetter(Jt,"shiftBehavior","default");bn.Factory.addGetterSetter(Jt,"centeredScaling",!1);bn.Factory.addGetterSetter(Jt,"ignoreStroke",!1);bn.Factory.addGetterSetter(Jt,"padding",0,(0,Nc.getNumberValidator)());bn.Factory.addGetterSetter(Jt,"node");bn.Factory.addGetterSetter(Jt,"nodes");bn.Factory.addGetterSetter(Jt,"boundBoxFunc");bn.Factory.addGetterSetter(Jt,"anchorDragBoundFunc");bn.Factory.addGetterSetter(Jt,"anchorStyleFunc");bn.Factory.addGetterSetter(Jt,"shouldOverdrawWholeArea",!1);bn.Factory.addGetterSetter(Jt,"useSingleNodeRotation",!0);bn.Factory.backCompat(Jt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var jx={};Object.defineProperty(jx,"__esModule",{value:!0});jx.Wedge=void 0;const Ux=kt,N5e=Yr,D5e=Rt,dH=Xe,L5e=Rt;class uu extends N5e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,D5e.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)}}jx.Wedge=uu;uu.prototype.className="Wedge";uu.prototype._centroid=!0;uu.prototype._attrsAffectingSize=["radius"];(0,L5e._registerNode)(uu);Ux.Factory.addGetterSetter(uu,"radius",0,(0,dH.getNumberValidator)());Ux.Factory.addGetterSetter(uu,"angle",0,(0,dH.getNumberValidator)());Ux.Factory.addGetterSetter(uu,"clockwise",!1);Ux.Factory.backCompat(uu,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var Vx={};Object.defineProperty(Vx,"__esModule",{value:!0});Vx.Blur=void 0;const jO=kt,F5e=rr,B5e=Xe;function UO(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var z5e=[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],j5e=[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 U5e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,c,d,f,h,p,m,_,b,y,g,v,S,x,w,C,T,E,k,N,O=t+t+1,A=r-1,P=i-1,D=t+1,L=D*(D+1)/2,M=new UO,R=null,$=M,B=null,U=null,G=z5e[t],Y=j5e[t];for(s=1;s>Y,k!==0?(k=255/k,n[c]=(f*G>>Y)*k,n[c+1]=(h*G>>Y)*k,n[c+2]=(p*G>>Y)*k):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=b,p-=y,m-=g,_-=B.r,b-=B.g,y-=B.b,g-=B.a,l=d+((l=o+t+1)>Y,k>0?(k=255/k,n[l]=(f*G>>Y)*k,n[l+1]=(h*G>>Y)*k,n[l+2]=(p*G>>Y)*k):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=b,p-=y,m-=g,_-=B.r,b-=B.g,y-=B.b,g-=B.a,l=o+((l=a+D)0&&U5e(t,n)};Vx.Blur=V5e;jO.Factory.addGetterSetter(F5e.Node,"blurRadius",0,(0,B5e.getNumberValidator)(),jO.Factory.afterSetFilter);var Gx={};Object.defineProperty(Gx,"__esModule",{value:!0});Gx.Brighten=void 0;const VO=kt,G5e=rr,H5e=Xe,q5e=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,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};Hx.Contrast=Q5e;GO.Factory.addGetterSetter(W5e.Node,"contrast",0,(0,K5e.getNumberValidator)(),GO.Factory.afterSetFilter);var qx={};Object.defineProperty(qx,"__esModule",{value:!0});qx.Emboss=void 0;const mc=kt,Wx=rr,X5e=fr,fH=Xe,Y5e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:X5e.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,b=a;m+b<1&&(b=0),m+b>l&&(b=0);var y=p+(m-1+b)*4,g=s[_]-s[y],v=s[_+1]-s[y+1],S=s[_+2]-s[y+2],x=g,w=x>0?x:-x,C=v>0?v:-v,T=S>0?S:-S;if(C>w&&(x=v),T>w&&(x=S),x*=t,i){var E=s[_]+x,k=s[_+1]+x,N=s[_+2]+x;s[_]=E>255?255:E<0?0:E,s[_+1]=k>255?255:k<0?0:k,s[_+2]=N>255?255:N<0?0:N}else{var O=n-x;O<0?O=0:O>255&&(O=255),s[_]=s[_+1]=s[_+2]=O}}while(--m)}while(--d)};qx.Emboss=Y5e;mc.Factory.addGetterSetter(Wx.Node,"embossStrength",.5,(0,fH.getNumberValidator)(),mc.Factory.afterSetFilter);mc.Factory.addGetterSetter(Wx.Node,"embossWhiteLevel",.5,(0,fH.getNumberValidator)(),mc.Factory.afterSetFilter);mc.Factory.addGetterSetter(Wx.Node,"embossDirection","top-left",null,mc.Factory.afterSetFilter);mc.Factory.addGetterSetter(Wx.Node,"embossBlend",!1,null,mc.Factory.afterSetFilter);var Kx={};Object.defineProperty(Kx,"__esModule",{value:!0});Kx.Enhance=void 0;const HO=kt,Z5e=rr,J5e=Xe;function b5(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const e3e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],ls&&(s=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),s===a&&(s=255,a=0),c===u&&(c=255,u=0);var p,m,_,b,y,g,v,S,x;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),y=s+h*(255-s),g=a-h*(a-0),S=c+h*(255-c),x=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),b=(s+a)*.5,y=s+h*(s-b),g=a+h*(a-b),v=(c+u)*.5,S=c+h*(c-v),x=u+h*(u-v)),f=0;fb?_:b;var y=a,g=o,v,S,x=360/g*Math.PI/180,w,C;for(S=0;Sg?y:g;var v=a,S=o,x,w,C=n.polarRotation||0,T,E;for(c=0;ct&&(v=g,S=0,x=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return a}function g3e(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),a=[],s=0;s=0&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,s+=v[a+0],l+=v[a+1],u+=v[a+2],c+=v[a+3],g+=1);for(s=s/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,v[a+0]=s,v[a+1]=l,v[a+2]=u,v[a+3]=c)}};nw.Pixelate=w3e;QO.Factory.addGetterSetter(S3e.Node,"pixelSize",8,(0,x3e.getNumberValidator)(),QO.Factory.afterSetFilter);var rw={};Object.defineProperty(rw,"__esModule",{value:!0});rw.Posterize=void 0;const XO=kt,C3e=rr,A3e=Xe,E3e=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)});eS.Factory.addGetterSetter(Zk.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});eS.Factory.addGetterSetter(Zk.Node,"blue",0,T3e.RGBComponent,eS.Factory.afterSetFilter);var ow={};Object.defineProperty(ow,"__esModule",{value:!0});ow.RGBA=void 0;const M0=kt,aw=rr,P3e=Xe,I3e=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),a=this.alpha(),s,l;for(s=0;s255?255:e<0?0:Math.round(e)});M0.Factory.addGetterSetter(aw.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});M0.Factory.addGetterSetter(aw.Node,"blue",0,P3e.RGBComponent,M0.Factory.afterSetFilter);M0.Factory.addGetterSetter(aw.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var sw={};Object.defineProperty(sw,"__esModule",{value:!0});sw.Sepia=void 0;const R3e=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--s)}while(--o)};lw.Solarize=O3e;var uw={};Object.defineProperty(uw,"__esModule",{value:!0});uw.Threshold=void 0;const YO=kt,M3e=rr,$3e=Xe,N3e=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"),a=new pg.Stage({container:o,width:r,height:i}),s=new pg.Layer,l=new pg.Layer;return s.add(new pg.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new pg.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"}))),a.add(s),a.add(l),o.remove(),a},SAe=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const a=o.getContext("2d"),s=new Image;if(!a){o.remove(),i("Unable to get context");return}s.onload=function(){a.drawImage(s,0,0),o.remove(),r(a.getImageData(0,0,t,n))},s.src=e}),eM=async(e,t)=>{const n=e.toDataURL(t);return await SAe(n,t.width,t.height)},Jk=async(e,t,n,r,i)=>{const o=be("canvas"),a=mx(),s=gwe();if(!a||!s){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=a.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await X_(u,d),h=await eM(u,d),p=await _Ae(r?e.objects.filter(gz):[],l,i),m=await X_(p,l),_=await eM(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},xAe=()=>{Me({actionCreator:lwe,effect:async(e,{dispatch:t,getState:n})=>{const r=be("canvas"),i=n(),o=await Jk(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(Ht({title:Z("toast.problemSavingMask"),description:Z("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(xe.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSavedAssets")}}}))}})},wAe=()=>{Me({actionCreator:hwe,effect:async(e,{dispatch:t,getState:n})=>{const r=be("canvas"),i=n(),{id:o}=e.payload,a=await Jk(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!a)return;const{maskBlob:s}=a;if(!s){r.error("Problem getting mask layer blob"),t(Ht({title:Z("toast.problemImportingMask"),description:Z("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:l}=i.gallery,u=await t(xe.endpoints.uploadImage.initiate({file:new File([s],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:l==="none"?void 0:l,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:c}=u;t(kc({id:o,controlImage:c}))}})},CAe=async()=>{const e=mx();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),X_(t,t.getClientRect())},AAe=()=>{Me({actionCreator:dwe,effect:async(e,{dispatch:t})=>{const n=ax.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await CAe();if(!r){n.error("Problem getting base layer blob"),t(Ht({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=mx();if(!i){n.error("Problem getting canvas base layer"),t(Ht({title:Z("toast.problemMergingCanvas"),description:Z("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),a=await t(xe.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasMerged")}}})).unwrap(),{image_name:s}=a;t(hue({kind:"image",layer:"base",imageName:s,...o}))}})},EAe=()=>{Me({actionCreator:swe,effect:async(e,{dispatch:t,getState:n})=>{const r=be("canvas"),i=n();let o;try{o=await yx(i)}catch(s){r.error(String(s)),t(Ht({title:Z("toast.problemSavingCanvas"),description:Z("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(xe.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:Z("toast.canvasSavedGallery")}}}))}})},TAe=(e,t,n)=>{if(!(Mse.match(e)||kI.match(e)||kc.match(e)||$se.match(e)||PI.match(e)))return!1;const{id:i}=e.payload,o=eo(n.controlAdapters,i),a=eo(t.controlAdapters,i);if(!o||!Ho(o)||!a||!Ho(a)||PI.match(e)&&o.shouldAutoConfig===!0)return!1;const{controlImage:s,processorType:l,shouldAutoConfig:u}=a;return kI.match(e)&&!u?!1:l!=="none"&&!!s},kAe=()=>{Me({predicate:TAe,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=be("session"),{id:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(L4({id:o}))}})},Be="positive_conditioning",Ke="negative_conditioning",ve="denoise_latents",$f="denoise_latents_hrf",qe="latents_to_image",td="latents_to_image_hrf",os="save_image",Ad="nsfw_checker",nd="invisible_watermark",Ne="noise",gg="noise_hrf",cu="main_model_loader",cw="onnx_model_loader",Wa="vae_loader",gH="lora_loader",Zt="clip_skip",Hn="image_to_latents",Fs="resize_image",Ef="rescale_latents",kh="img2img_resize",_e="canvas_output",Wn="inpaint_image",ki="inpaint_image_resize_up",Hi="inpaint_image_resize_down",Kt="inpaint_infill",Vu="inpaint_infill_resize_down",qn="inpaint_create_mask",ft="canvas_coherence_denoise_latents",Vt="canvas_coherence_noise",yc="canvas_coherence_noise_increment",yr="canvas_coherence_mask_edge",zt="canvas_coherence_inpaint_create_mask",Ph="tomask",Ui="mask_blur",Ei="mask_combine",Mn="mask_resize_up",qi="mask_resize_down",i1="control_net_collect",PAe="ip_adapter_collect",o1="t2i_adapter_collect",dt="metadata_accumulator",_5="esrgan",Vi="sdxl_model_loader",ye="sdxl_denoise_latents",Vc="sdxl_refiner_model_loader",a1="sdxl_refiner_positive_conditioning",s1="sdxl_refiner_negative_conditioning",Cs="sdxl_refiner_denoise_latents",ga="refiner_inpaint_create_mask",Kr="seamless",ns="refiner_seamless",mH="text_to_image_graph",vE="image_to_image_graph",yH="canvas_text_to_image_graph",bE="canvas_image_to_image_graph",dw="canvas_inpaint_graph",fw="canvas_outpaint_graph",eP="sdxl_text_to_image_graph",tS="sxdl_image_to_image_graph",hw="sdxl_canvas_text_to_image_graph",$0="sdxl_canvas_image_to_image_graph",vc="sdxl_canvas_inpaint_graph",bc="sdxl_canvas_outpaint_graph",vH=e=>(e==null?void 0:e.type)==="image_output",IAe=()=>{Me({actionCreator:L4,effect:async(e,{dispatch:t,getState:n,take:r})=>{var l;const i=be("session"),{id:o}=e.payload,a=eo(n().controlAdapters,o);if(!(a!=null&&a.controlImage)||!Ho(a)){i.error("Unable to process ControlNet image");return}if(a.processorType==="none"||a.processorNode.type==="none")return;const s={nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,image:{image_name:a.controlImage}},[os]:{id:os,type:"save_image",is_intermediate:!0,use_cache:!1}},edges:[{source:{node_id:a.processorNode.id,field:"image"},destination:{node_id:os,field:"image"}}]};try{const u=t(Er.endpoints.enqueueGraph.initiate({graph:s,prepend:!0},{fixedCacheKey:"enqueueGraph"})),c=await u.unwrap();u.reset(),i.debug({enqueueResult:Xt(c)},Z("queue.graphQueued"));const[d]=await r(f=>M4.match(f)&&f.payload.data.graph_execution_state_id===c.queue_item.session_id&&f.payload.data.source_node_id===os);if(vH(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>xe.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(U4({id:o,processedControlImage:p.image_name}))}}catch(u){if(i.error({graph:Xt(s)},Z("queue.graphFailedToQueue")),u instanceof Object&&"data"in u&&"status"in u&&u.status===403){const c=((l=u.data)==null?void 0:l.detail)||"Unknown Error";t(Ht({title:Z("queue.graphFailedToQueue"),status:"error",description:c,duration:15e3})),t(Dse()),t(kc({id:o,controlImage:null}));return}t(Ht({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},tP=De("app/enqueueRequested");De("app/batchEnqueued");const RAe=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("

")})},tM=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)}),OAe=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}=OAe(e.data),i=MAe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},$a=(e,t,n)=>{const r=Tse(e.controlAdapters).filter(o=>{var a,s;return((a=o.model)==null?void 0:a.base_model)===((s=e.generation.model)==null?void 0:s.base_model)}),i=t.nodes[dt];if(r.length){const o={id:i1,type:"collect",is_intermediate:!0};t.nodes[i1]=o,t.edges.push({source:{node_id:i1,field:"collection"},destination:{node_id:n,field:"control"}}),r.forEach(a=>{if(!a.model)return;const{id:s,controlImage:l,processedControlImage:u,beginStepPct:c,endStepPct:d,controlMode:f,resizeMode:h,model:p,processorType:m,weight:_}=a,b={id:`control_net_${s}`,type:"controlnet",is_intermediate:!0,begin_step_percent:c,end_step_percent:d,control_mode:f,resize_mode:h,control_model:p,control_weight:_};if(u&&m!=="none")b.image={image_name:u};else if(l)b.image={image_name:l};else return;if(t.nodes[b.id]=b,i!=null&&i.controlnets){const y=_y(b,["id","type"]);i.controlnets.push(y)}t.edges.push({source:{node_id:b.id,field:"control"},destination:{node_id:i1,field:"item"}}),ft in t.nodes&&t.edges.push({source:{node_id:b.id,field:"control"},destination:{node_id:ft,field:"control"}})})}},Na=(e,t,n)=>{const r=Pse(e.controlAdapters).filter(o=>{var a,s;return((a=o.model)==null?void 0:a.base_model)===((s=e.generation.model)==null?void 0:s.base_model)}),i=t.nodes[dt];if(r.length){const o={id:PAe,type:"collect",is_intermediate:!0};t.nodes[o.id]=o,t.edges.push({source:{node_id:o.id,field:"collection"},destination:{node_id:n,field:"ip_adapter"}}),r.forEach(a=>{if(!a.model)return;const{id:s,weight:l,model:u,beginStepPct:c,endStepPct:d}=a,f={id:`ip_adapter_${s}`,type:"ip_adapter",is_intermediate:!0,weight:l,ip_adapter_model:u,begin_step_percent:c,end_step_percent:d};if(a.controlImage)f.image={image_name:a.controlImage};else return;if(t.nodes[f.id]=f,i!=null&&i.ipAdapters){const h={image:{image_name:a.controlImage},weight:l,ip_adapter_model:u,begin_step_percent:c,end_step_percent:d};i.ipAdapters.push(h)}t.edges.push({source:{node_id:f.id,field:"ip_adapter"},destination:{node_id:o.id,field:"item"}}),ft in t.nodes&&t.edges.push({source:{node_id:f.id,field:"ip_adapter"},destination:{node_id:ft,field:"ip_adapter"}})})}},Dp=(e,t,n,r=cu)=>{const{loras:i}=e.lora,o=u2(i),a=t.nodes[dt];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===Zt&&["clip"].includes(u.source.field))));let s="",l=0;Xl(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${gH}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};a!=null&&a.loras&&a.loras.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,l===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:Zt,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:s,field:"clip"},destination:{node_id:h,field:"clip"}})),l===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[dw,fw].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:ft,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Ke,field:"clip"}})),s=h,l+=1})},Da=(e,t,n=qe)=>{const r=t.nodes[n];if(!r)return;r.is_intermediate=!0,r.use_cache=!0;const i={id:Ad,type:"img_nsfw",is_intermediate:!0};t.nodes[Ad]=i,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Ad,field:"image"}})},NAe=["txt2img","img2img","unifiedCanvas","nodes","modelManager","queue"],nP=Ii(e=>e,({ui:e})=>k4(e.activeTab)?e.activeTab:"txt2img"),jKe=Ii(e=>e,({ui:e,config:t})=>{const r=NAe.filter(i=>!t.disabledTabs.includes(i)).indexOf(e.activeTab);return r===-1?0:r}),UKe=Ii(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:P4}}),La=(e,t)=>{const r=nP(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,{autoAddBoardId:i}=e.gallery,o={id:os,type:"save_image",is_intermediate:r,use_cache:!1,board:i==="none"?void 0:{board_id:i}};t.nodes[os]=o,t.nodes[dt]&&t.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:os,field:"metadata"}});const s={node_id:os,field:"image"};nd in t.nodes?t.edges.push({source:{node_id:nd,field:"image"},destination:s}):Ad in t.nodes?t.edges.push({source:{node_id:Ad,field:"image"},destination:s}):_e in t.nodes?t.edges.push({source:{node_id:_e,field:"image"},destination:s}):td in t.nodes?t.edges.push({source:{node_id:td,field:"image"},destination:s}):qe in t.nodes&&t.edges.push({source:{node_id:qe,field:"image"},destination:s})},Fa=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[Kr]={id:Kr,type:"seamless",seamless_x:r,seamless_y:i};let o=ve;(t.id===eP||t.id===tS||t.id===hw||t.id===$0||t.id===vc||t.id===bc)&&(o=ye),t.edges=t.edges.filter(a=>!(a.source.node_id===n&&["unet"].includes(a.source.field))&&!(a.source.node_id===n&&["vae"].includes(a.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:Kr,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:Kr,field:"vae"}},{source:{node_id:Kr,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==dw||t.id===fw||t.id===vc||t.id===bc)&&t.edges.push({source:{node_id:Kr,field:"unet"},destination:{node_id:ft,field:"unet"}})},Ba=(e,t,n)=>{const r=Ise(e.controlAdapters).filter(o=>{var a,s;return((a=o.model)==null?void 0:a.base_model)===((s=e.generation.model)==null?void 0:s.base_model)}),i=t.nodes[dt];if(r.length){const o={id:o1,type:"collect",is_intermediate:!0};t.nodes[o1]=o,t.edges.push({source:{node_id:o1,field:"collection"},destination:{node_id:n,field:"t2i_adapter"}}),r.forEach(a=>{if(!a.model)return;const{id:s,controlImage:l,processedControlImage:u,beginStepPct:c,endStepPct:d,resizeMode:f,model:h,processorType:p,weight:m}=a,_={id:`t2i_adapter_${s}`,type:"t2i_adapter",is_intermediate:!0,begin_step_percent:c,end_step_percent:d,resize_mode:f,t2i_adapter_model:h,weight:m};if(u&&p!=="none")_.image={image_name:u};else if(l)_.image={image_name:l};else return;if(t.nodes[_.id]=_,i!=null&&i.ipAdapters){const b=_y(_,["id","type"]);i.t2iAdapters.push(b)}t.edges.push({source:{node_id:_.id,field:"t2i_adapter"},destination:{node_id:o1,field:"item"}}),ft in t.nodes&&t.edges.push({source:{node_id:_.id,field:"t2i_adapter"},destination:{node_id:ft,field:"t2i_adapter"}})})}},za=(e,t,n=cu)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:a}=e.sdxl,s=["auto","manual"].includes(o),l=!r,u=t.nodes[dt];l||(t.nodes[Wa]={type:"vae_loader",id:Wa,is_intermediate:!0,vae_model:r});const c=n==cw;(t.id===mH||t.id===vE||t.id===eP||t.id===tS)&&t.edges.push({source:{node_id:l?n:Wa,field:l&&c?"vae_decoder":"vae"},destination:{node_id:qe,field:"vae"}}),(t.id===yH||t.id===bE||t.id===hw||t.id==$0)&&t.edges.push({source:{node_id:l?n:Wa,field:l&&c?"vae_decoder":"vae"},destination:{node_id:s?qe:_e,field:"vae"}}),(t.id===vE||t.id===tS||t.id===bE||t.id===$0)&&t.edges.push({source:{node_id:l?n:Wa,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Hn,field:"vae"}}),(t.id===dw||t.id===fw||t.id===vc||t.id===bc)&&(t.edges.push({source:{node_id:l?n:Wa,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Wn,field:"vae"}},{source:{node_id:l?n:Wa,field:l&&c?"vae_decoder":"vae"},destination:{node_id:qn,field:"vae"}},{source:{node_id:l?n:Wa,field:l&&c?"vae_decoder":"vae"},destination:{node_id:qe,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:Wa,field:l&&c?"vae_decoder":"vae"},destination:{node_id:zt,field:"vae"}})),a&&(t.id===vc||t.id===bc)&&t.edges.push({source:{node_id:l?n:Wa,field:l&&c?"vae_decoder":"vae"},destination:{node_id:ga,field:"vae"}}),r&&u&&(u.vae=r)},ja=(e,t,n=qe)=>{const i=nP(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],a=t.nodes[Ad],s=t.nodes[dt];if(!o)return;const l={id:nd,type:"img_watermark",is_intermediate:i};t.nodes[nd]=l,o.is_intermediate=!0,o.use_cache=!0,a?(a.is_intermediate=!0,t.edges.push({source:{node_id:Ad,field:"image"},destination:{node_id:nd,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:nd,field:"image"}}),s&&t.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:nd,field:"metadata"}})},DAe=(e,t)=>{const n=be("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,img2imgStrength:c,vaePrecision:d,clipSkip:f,shouldUseCpuNoise:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{width:_,height:b}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:y,boundingBoxScaleMethod:g}=e.canvas,v=d==="fp32",S=!0,x=["auto","manual"].includes(g);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let w=cu;const C=h,T={id:bE,nodes:{[w]:{type:"main_model_loader",id:w,is_intermediate:S,model:o},[Zt]:{type:"clip_skip",id:Zt,is_intermediate:S,skipped_layers:f},[Be]:{type:"compel",id:Be,is_intermediate:S,prompt:r},[Ke]:{type:"compel",id:Ke,is_intermediate:S,prompt:i},[Ne]:{type:"noise",id:Ne,is_intermediate:S,use_cpu:C,seed:l,width:x?y.width:_,height:x?y.height:b},[Hn]:{type:"i2l",id:Hn,is_intermediate:S},[ve]:{type:"denoise_latents",id:ve,is_intermediate:S,cfg_scale:a,scheduler:s,steps:u,denoising_start:1-c,denoising_end:1},[_e]:{type:"l2i",id:_e,is_intermediate:S}},edges:[{source:{node_id:w,field:"unet"},destination:{node_id:ve,field:"unet"}},{source:{node_id:w,field:"clip"},destination:{node_id:Zt,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ve,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ve,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ve,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ve,field:"latents"}}]};return x?(T.nodes[kh]={id:kh,type:"img_resize",is_intermediate:S,image:t,width:y.width,height:y.height},T.nodes[qe]={id:qe,type:"l2i",is_intermediate:S,fp32:v},T.nodes[_e]={id:_e,type:"img_resize",is_intermediate:S,width:_,height:b},T.edges.push({source:{node_id:kh,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:ve,field:"latents"},destination:{node_id:qe,field:"latents"}},{source:{node_id:qe,field:"image"},destination:{node_id:_e,field:"image"}})):(T.nodes[_e]={type:"l2i",id:_e,is_intermediate:S,fp32:v},T.nodes[Hn].image=t,T.edges.push({source:{node_id:ve,field:"latents"},destination:{node_id:_e,field:"latents"}})),T.nodes[dt]={id:dt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:x?y.width:_,height:x?y.height:b,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:C?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],t2iAdapters:[],clip_skip:f,strength:c,init_image:t.image_name},(p||m)&&(Fa(e,T,w),w=Kr),Dp(e,T,ve),za(e,T,w),$a(e,T,ve),Na(e,T,ve),Ba(e,T,ve),e.system.shouldUseNSFWChecker&&Da(e,T,_e),e.system.shouldUseWatermarker&&ja(e,T,_e),La(e,T),T},LAe=(e,t,n)=>{const r=be("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,maskBlurMethod:m,canvasCoherenceMode:_,canvasCoherenceSteps:b,canvasCoherenceStrength:y,clipSkip:g,seamlessXAxis:v,seamlessYAxis:S}=e.generation;if(!a)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:x,height:w}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:C,boundingBoxScaleMethod:T}=e.canvas,E=!0,k=f==="fp32",N=["auto","manual"].includes(T);let O=cu;const A=h,P={id:dw,nodes:{[O]:{type:"main_model_loader",id:O,is_intermediate:E,model:a},[Zt]:{type:"clip_skip",id:Zt,is_intermediate:E,skipped_layers:g},[Be]:{type:"compel",id:Be,is_intermediate:E,prompt:i},[Ke]:{type:"compel",id:Ke,is_intermediate:E,prompt:o},[Ui]:{type:"img_blur",id:Ui,is_intermediate:E,radius:p,blur_type:m},[Wn]:{type:"i2l",id:Wn,is_intermediate:E,fp32:k},[Ne]:{type:"noise",id:Ne,use_cpu:A,seed:d,is_intermediate:E},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:E,fp32:k},[ve]:{type:"denoise_latents",id:ve,is_intermediate:E,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Vt]:{type:"noise",id:Vt,use_cpu:A,seed:d+1,is_intermediate:E},[yc]:{type:"add",id:yc,b:1,is_intermediate:E},[ft]:{type:"denoise_latents",id:ft,is_intermediate:E,steps:b,cfg_scale:s,scheduler:l,denoising_start:1-y,denoising_end:1},[qe]:{type:"l2i",id:qe,is_intermediate:E,fp32:k},[_e]:{type:"color_correct",id:_e,is_intermediate:E,reference:t}},edges:[{source:{node_id:O,field:"unet"},destination:{node_id:ve,field:"unet"}},{source:{node_id:O,field:"clip"},destination:{node_id:Zt,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ve,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ve,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ve,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ve,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ve,field:"denoise_mask"}},{source:{node_id:O,field:"unet"},destination:{node_id:ft,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ft,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ft,field:"negative_conditioning"}},{source:{node_id:Vt,field:"noise"},destination:{node_id:ft,field:"noise"}},{source:{node_id:ve,field:"latents"},destination:{node_id:ft,field:"latents"}},{source:{node_id:ft,field:"latents"},destination:{node_id:qe,field:"latents"}}]};if(N){const D=C.width,L=C.height;P.nodes[ki]={type:"img_resize",id:ki,is_intermediate:E,width:D,height:L,image:t},P.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:E,width:D,height:L,image:n},P.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:E,width:x,height:w},P.nodes[qi]={type:"img_resize",id:qi,is_intermediate:E,width:x,height:w},P.nodes[Ne].width=D,P.nodes[Ne].height=L,P.nodes[Vt].width=D,P.nodes[Vt].height=L,P.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:qe,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:_e,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:_e,field:"mask"}})}else P.nodes[Ne].width=x,P.nodes[Ne].height=w,P.nodes[Vt].width=x,P.nodes[Vt].height=w,P.nodes[Wn]={...P.nodes[Wn],image:t},P.nodes[Ui]={...P.nodes[Ui],image:n},P.nodes[qn]={...P.nodes[qn],image:t},P.edges.push({source:{node_id:qe,field:"image"},destination:{node_id:_e,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:_e,field:"mask"}});return _!=="unmasked"&&(P.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:E,fp32:k},N?P.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:zt,field:"image"}}):P.nodes[zt]={...P.nodes[zt],image:t},_==="mask"&&(N?P.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):P.nodes[zt]={...P.nodes[zt],mask:n}),_==="edge"&&(P.nodes[yr]={type:"mask_edge",id:yr,is_intermediate:E,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},N?P.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:yr,field:"image"}}):P.nodes[yr]={...P.nodes[yr],image:n},P.edges.push({source:{node_id:yr,field:"image"},destination:{node_id:zt,field:"mask"}})),P.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:ft,field:"denoise_mask"}})),(v||S)&&(Fa(e,P,O),O=Kr),za(e,P,O),Dp(e,P,ve,O),$a(e,P,ve),Na(e,P,ve),Ba(e,P,ve),e.system.shouldUseNSFWChecker&&Da(e,P,_e),e.system.shouldUseWatermarker&&ja(e,P,_e),La(e,P),P},FAe=(e,t,n)=>{const r=be("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,infillTileSize:y,infillPatchmatchDownscaleSize:g,infillMethod:v,clipSkip:S,seamlessXAxis:x,seamlessYAxis:w}=e.generation;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:C,height:T}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:E,boundingBoxScaleMethod:k}=e.canvas,N=f==="fp32",O=!0,A=["auto","manual"].includes(k);let P=cu;const D=h,L={id:fw,nodes:{[P]:{type:"main_model_loader",id:P,is_intermediate:O,model:a},[Zt]:{type:"clip_skip",id:Zt,is_intermediate:O,skipped_layers:S},[Be]:{type:"compel",id:Be,is_intermediate:O,prompt:i},[Ke]:{type:"compel",id:Ke,is_intermediate:O,prompt:o},[Ph]:{type:"tomask",id:Ph,is_intermediate:O,image:t},[Ei]:{type:"mask_combine",id:Ei,is_intermediate:O,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:O,fp32:N},[Ne]:{type:"noise",id:Ne,use_cpu:D,seed:d,is_intermediate:O},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:O,fp32:N},[ve]:{type:"denoise_latents",id:ve,is_intermediate:O,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[Vt]:{type:"noise",id:Vt,use_cpu:D,seed:d+1,is_intermediate:O},[yc]:{type:"add",id:yc,b:1,is_intermediate:O},[ft]:{type:"denoise_latents",id:ft,is_intermediate:O,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[qe]:{type:"l2i",id:qe,is_intermediate:O,fp32:N},[_e]:{type:"color_correct",id:_e,is_intermediate:O}},edges:[{source:{node_id:P,field:"unet"},destination:{node_id:ve,field:"unet"}},{source:{node_id:P,field:"clip"},destination:{node_id:Zt,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:Kt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Ph,field:"image"},destination:{node_id:Ei,field:"mask1"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ve,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ve,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ve,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ve,field:"latents"}},{source:{node_id:A?Mn:Ei,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ve,field:"denoise_mask"}},{source:{node_id:P,field:"unet"},destination:{node_id:ft,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ft,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ft,field:"negative_conditioning"}},{source:{node_id:Vt,field:"noise"},destination:{node_id:ft,field:"noise"}},{source:{node_id:ve,field:"latents"},destination:{node_id:ft,field:"latents"}},{source:{node_id:Kt,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:ft,field:"latents"},destination:{node_id:qe,field:"latents"}}]};if(v==="patchmatch"&&(L.nodes[Kt]={type:"infill_patchmatch",id:Kt,is_intermediate:O,downscale:g}),v==="lama"&&(L.nodes[Kt]={type:"infill_lama",id:Kt,is_intermediate:O}),v==="cv2"&&(L.nodes[Kt]={type:"infill_cv2",id:Kt,is_intermediate:O}),v==="tile"&&(L.nodes[Kt]={type:"infill_tile",id:Kt,is_intermediate:O,tile_size:y}),A){const M=E.width,R=E.height;L.nodes[ki]={type:"img_resize",id:ki,is_intermediate:O,width:M,height:R,image:t},L.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:O,width:M,height:R},L.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:O,width:C,height:T},L.nodes[Vu]={type:"img_resize",id:Vu,is_intermediate:O,width:C,height:T},L.nodes[qi]={type:"img_resize",id:qi,is_intermediate:O,width:C,height:T},L.nodes[Ne].width=M,L.nodes[Ne].height=R,L.nodes[Vt].width=M,L.nodes[Vt].height=R,L.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:Kt,field:"image"}},{source:{node_id:Ei,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:qe,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Kt,field:"image"},destination:{node_id:Vu,field:"image"}},{source:{node_id:Vu,field:"image"},destination:{node_id:_e,field:"reference"}},{source:{node_id:Hi,field:"image"},destination:{node_id:_e,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:_e,field:"mask"}})}else L.nodes[Kt]={...L.nodes[Kt],image:t},L.nodes[Ne].width=C,L.nodes[Ne].height=T,L.nodes[Vt].width=C,L.nodes[Vt].height=T,L.nodes[Wn]={...L.nodes[Wn],image:t},L.edges.push({source:{node_id:Kt,field:"image"},destination:{node_id:_e,field:"reference"}},{source:{node_id:qe,field:"image"},destination:{node_id:_e,field:"image"}},{source:{node_id:Ei,field:"image"},destination:{node_id:_e,field:"mask"}});return m!=="unmasked"&&(L.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:O,fp32:N},L.edges.push({source:{node_id:Kt,field:"image"},destination:{node_id:zt,field:"image"}}),m==="mask"&&(A?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):L.edges.push({source:{node_id:Ei,field:"image"},destination:{node_id:zt,field:"mask"}})),m==="edge"&&(L.nodes[yr]={type:"mask_edge",id:yr,is_intermediate:O,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},A?L.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:yr,field:"image"}}):L.edges.push({source:{node_id:Ei,field:"image"},destination:{node_id:yr,field:"image"}}),L.edges.push({source:{node_id:yr,field:"image"},destination:{node_id:zt,field:"mask"}})),L.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:ft,field:"denoise_mask"}})),(x||w)&&(Fa(e,L,P),P=Kr),za(e,L,P),Dp(e,L,ve,P),$a(e,L,ve),Na(e,L,ve),Ba(e,L,ve),e.system.shouldUseNSFWChecker&&Da(e,L,_e),e.system.shouldUseWatermarker&&ja(e,L,_e),La(e,L),L},Lp=(e,t,n,r=Vi)=>{const{loras:i}=e.lora,o=u2(i),a=t.nodes[dt],s=r;let l=r;[Kr,ga].includes(r)&&(l=Vi),o>0&&(t.edges=t.edges.filter(d=>!(d.source.node_id===s&&["unet"].includes(d.source.field))&&!(d.source.node_id===l&&["clip"].includes(d.source.field))&&!(d.source.node_id===l&&["clip2"].includes(d.source.field))));let u="",c=0;Xl(i,d=>{const{model_name:f,base_model:h,weight:p}=d,m=`${gH}_${f.replace(".","_")}`,_={type:"sdxl_lora_loader",id:m,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};a&&(a.loras||(a.loras=[]),a.loras.push({lora:{model_name:f,base_model:h},weight:p})),t.nodes[m]=_,c===0?(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:l,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:l,field:"clip2"},destination:{node_id:m,field:"clip2"}})):(t.edges.push({source:{node_id:u,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:u,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:u,field:"clip2"},destination:{node_id:m,field:"clip2"}})),c===o-1&&(t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[vc,bc].includes(t.id)&&t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:ft,field:"unet"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Be,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Ke,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Be,field:"clip2"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Ke,field:"clip2"}})),u=m,c+=1})},af=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o,shouldConcatSDXLStylePrompt:a}=e.sdxl,s=a||t?[n,i].join(" "):i,l=a||t?[r,o].join(" "):o;return{joinedPositiveStylePrompt:s,joinedNegativeStylePrompt:l}},Fp=(e,t,n,r,i,o)=>{const{refinerModel:a,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl,{seamlessXAxis:h,seamlessYAxis:p,vaePrecision:m}=e.generation,{boundingBoxScaleMethod:_}=e.canvas,b=m==="fp32",y=["auto","manual"].includes(_);if(!a)return;const g=t.nodes[dt];g&&(g.refiner_model=a,g.refiner_positive_aesthetic_score=s,g.refiner_negative_aesthetic_score=l,g.refiner_cfg_scale=d,g.refiner_scheduler=c,g.refiner_start=f,g.refiner_steps=u);const v=r||Vi,{joinedPositiveStylePrompt:S,joinedNegativeStylePrompt:x}=af(e,!0);t.edges=t.edges.filter(w=>!(w.source.node_id===n&&["latents"].includes(w.source.field))),t.edges=t.edges.filter(w=>!(w.source.node_id===v&&["vae"].includes(w.source.field))),t.nodes[Vc]={type:"sdxl_refiner_model_loader",id:Vc,model:a},t.nodes[a1]={type:"sdxl_refiner_compel_prompt",id:a1,style:S,aesthetic_score:s},t.nodes[s1]={type:"sdxl_refiner_compel_prompt",id:s1,style:x,aesthetic_score:l},t.nodes[Cs]={type:"denoise_latents",id:Cs,cfg_scale:d,steps:u,scheduler:c,denoising_start:f,denoising_end:1},h||p?(t.nodes[ns]={id:ns,type:"seamless",seamless_x:h,seamless_y:p},t.edges.push({source:{node_id:Vc,field:"unet"},destination:{node_id:ns,field:"unet"}},{source:{node_id:Vc,field:"vae"},destination:{node_id:ns,field:"vae"}},{source:{node_id:ns,field:"unet"},destination:{node_id:Cs,field:"unet"}})):t.edges.push({source:{node_id:Vc,field:"unet"},destination:{node_id:Cs,field:"unet"}}),t.edges.push({source:{node_id:Vc,field:"clip2"},destination:{node_id:a1,field:"clip2"}},{source:{node_id:Vc,field:"clip2"},destination:{node_id:s1,field:"clip2"}},{source:{node_id:a1,field:"conditioning"},destination:{node_id:Cs,field:"positive_conditioning"}},{source:{node_id:s1,field:"conditioning"},destination:{node_id:Cs,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:Cs,field:"latents"}}),(t.id===vc||t.id===bc)&&(t.nodes[ga]={type:"create_denoise_mask",id:ga,is_intermediate:!0,fp32:b},y?t.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:ga,field:"image"}}):t.nodes[ga]={...t.nodes[ga],image:i},t.id===vc&&(y?t.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:ga,field:"mask"}}):t.nodes[ga]={...t.nodes[ga],mask:o}),t.id===bc&&t.edges.push({source:{node_id:y?Mn:Ei,field:"image"},destination:{node_id:ga,field:"mask"}}),t.edges.push({source:{node_id:ga,field:"denoise_mask"},destination:{node_id:Cs,field:"denoise_mask"}})),t.id===hw||t.id===$0?t.edges.push({source:{node_id:Cs,field:"latents"},destination:{node_id:y?qe:_e,field:"latents"}}):t.edges.push({source:{node_id:Cs,field:"latents"},destination:{node_id:qe,field:"latents"}})},BAe=(e,t)=>{const n=be("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,vaePrecision:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{shouldUseSDXLRefiner:p,refinerStart:m,sdxlImg2ImgDenoisingStrength:_}=e.sdxl,{width:b,height:y}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:g,boundingBoxScaleMethod:v}=e.canvas,S=c==="fp32",x=!0,w=["auto","manual"].includes(v);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let C=Vi;const T=d,{joinedPositiveStylePrompt:E,joinedNegativeStylePrompt:k}=af(e),N={id:$0,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:o},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:r,style:E},[Ke]:{type:"sdxl_compel_prompt",id:Ke,prompt:i,style:k},[Ne]:{type:"noise",id:Ne,is_intermediate:x,use_cpu:T,seed:l,width:w?g.width:b,height:w?g.height:y},[Hn]:{type:"i2l",id:Hn,is_intermediate:x,fp32:S},[ye]:{type:"denoise_latents",id:ye,is_intermediate:x,cfg_scale:a,scheduler:s,steps:u,denoising_start:p?Math.min(m,1-_):1-_,denoising_end:p?m:1}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ye,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Ke,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ye,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ye,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ye,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ye,field:"latents"}}]};return w?(N.nodes[kh]={id:kh,type:"img_resize",is_intermediate:x,image:t,width:g.width,height:g.height},N.nodes[qe]={id:qe,type:"l2i",is_intermediate:x,fp32:S},N.nodes[_e]={id:_e,type:"img_resize",is_intermediate:x,width:b,height:y},N.edges.push({source:{node_id:kh,field:"image"},destination:{node_id:Hn,field:"image"}},{source:{node_id:ye,field:"latents"},destination:{node_id:qe,field:"latents"}},{source:{node_id:qe,field:"image"},destination:{node_id:_e,field:"image"}})):(N.nodes[_e]={type:"l2i",id:_e,is_intermediate:x,fp32:S},N.nodes[Hn].image=t,N.edges.push({source:{node_id:ye,field:"latents"},destination:{node_id:_e,field:"latents"}})),N.nodes[dt]={id:dt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:a,width:w?g.width:b,height:w?g.height:y,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:T?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],ipAdapters:[],t2iAdapters:[],strength:_,init_image:t.image_name},N.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:_e,field:"metadata"}}),(f||h)&&(Fa(e,N,C),C=Kr),p&&(Fp(e,N,ye,C),(f||h)&&(C=ns)),za(e,N,C),Lp(e,N,ye,C),$a(e,N,ye),Na(e,N,ye),Ba(e,N,ye),e.system.shouldUseNSFWChecker&&Da(e,N,_e),e.system.shouldUseWatermarker&&ja(e,N,_e),La(e,N),N},zAe=(e,t,n)=>{const r=be("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,maskBlurMethod:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:b,seamlessXAxis:y,seamlessYAxis:g}=e.generation,{sdxlImg2ImgDenoisingStrength:v,shouldUseSDXLRefiner:S,refinerStart:x}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:w,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:E}=e.canvas,k=d==="fp32",N=!0,O=["auto","manual"].includes(E);let A=Vi;const P=f,{joinedPositiveStylePrompt:D,joinedNegativeStylePrompt:L}=af(e),M={id:vc,nodes:{[A]:{type:"sdxl_model_loader",id:A,model:a},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:i,style:D},[Ke]:{type:"sdxl_compel_prompt",id:Ke,prompt:o,style:L},[Ui]:{type:"img_blur",id:Ui,is_intermediate:N,radius:h,blur_type:p},[Wn]:{type:"i2l",id:Wn,is_intermediate:N,fp32:k},[Ne]:{type:"noise",id:Ne,use_cpu:P,seed:c,is_intermediate:N},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:N,fp32:k},[ye]:{type:"denoise_latents",id:ye,is_intermediate:N,steps:u,cfg_scale:s,scheduler:l,denoising_start:S?Math.min(x,1-v):1-v,denoising_end:S?x:1},[Vt]:{type:"noise",id:Vt,use_cpu:P,seed:c+1,is_intermediate:N},[yc]:{type:"add",id:yc,b:1,is_intermediate:N},[ft]:{type:"denoise_latents",id:ft,is_intermediate:N,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-b,denoising_end:1},[qe]:{type:"l2i",id:qe,is_intermediate:N,fp32:k},[_e]:{type:"color_correct",id:_e,is_intermediate:N,reference:t}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:ye,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:A,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:A,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:A,field:"clip2"},destination:{node_id:Ke,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ye,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ye,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ye,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ye,field:"latents"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ye,field:"denoise_mask"}},{source:{node_id:A,field:"unet"},destination:{node_id:ft,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ft,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ft,field:"negative_conditioning"}},{source:{node_id:Vt,field:"noise"},destination:{node_id:ft,field:"noise"}},{source:{node_id:ye,field:"latents"},destination:{node_id:ft,field:"latents"}},{source:{node_id:ft,field:"latents"},destination:{node_id:qe,field:"latents"}}]};if(O){const R=T.width,$=T.height;M.nodes[ki]={type:"img_resize",id:ki,is_intermediate:N,width:R,height:$,image:t},M.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:N,width:R,height:$,image:n},M.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:N,width:w,height:C},M.nodes[qi]={type:"img_resize",id:qi,is_intermediate:N,width:w,height:C},M.nodes[Ne].width=R,M.nodes[Ne].height=$,M.nodes[Vt].width=R,M.nodes[Vt].height=$,M.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:Ui,field:"image"}},{source:{node_id:ki,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:qe,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Hi,field:"image"},destination:{node_id:_e,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:_e,field:"mask"}})}else M.nodes[Ne].width=w,M.nodes[Ne].height=C,M.nodes[Vt].width=w,M.nodes[Vt].height=C,M.nodes[Wn]={...M.nodes[Wn],image:t},M.nodes[Ui]={...M.nodes[Ui],image:n},M.nodes[qn]={...M.nodes[qn],image:t},M.edges.push({source:{node_id:qe,field:"image"},destination:{node_id:_e,field:"image"}},{source:{node_id:Ui,field:"image"},destination:{node_id:_e,field:"mask"}});return m!=="unmasked"&&(M.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:N,fp32:k},O?M.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:zt,field:"image"}}):M.nodes[zt]={...M.nodes[zt],image:t},m==="mask"&&(O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):M.nodes[zt]={...M.nodes[zt],mask:n}),m==="edge"&&(M.nodes[yr]={type:"mask_edge",id:yr,is_intermediate:N,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},O?M.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:yr,field:"image"}}):M.nodes[yr]={...M.nodes[yr],image:n},M.edges.push({source:{node_id:yr,field:"image"},destination:{node_id:zt,field:"mask"}})),M.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:ft,field:"denoise_mask"}})),(y||g)&&(Fa(e,M,A),A=Kr),S&&(Fp(e,M,ft,A,t,n),(y||g)&&(A=ns)),za(e,M,A),Lp(e,M,ye,A),$a(e,M,ye),Na(e,M,ye),Ba(e,M,ye),e.system.shouldUseNSFWChecker&&Da(e,M,_e),e.system.shouldUseWatermarker&&ja(e,M,_e),La(e,M),M},jAe=(e,t,n)=>{const r=be("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,canvasCoherenceMode:p,canvasCoherenceSteps:m,canvasCoherenceStrength:_,infillTileSize:b,infillPatchmatchDownscaleSize:y,infillMethod:g,seamlessXAxis:v,seamlessYAxis:S}=e.generation,{sdxlImg2ImgDenoisingStrength:x,shouldUseSDXLRefiner:w,refinerStart:C}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:T,height:E}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:k,boundingBoxScaleMethod:N}=e.canvas,O=d==="fp32",A=!0,P=["auto","manual"].includes(N);let D=Vi;const L=f,{joinedPositiveStylePrompt:M,joinedNegativeStylePrompt:R}=af(e),$={id:bc,nodes:{[Vi]:{type:"sdxl_model_loader",id:Vi,model:a},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:i,style:M},[Ke]:{type:"sdxl_compel_prompt",id:Ke,prompt:o,style:R},[Ph]:{type:"tomask",id:Ph,is_intermediate:A,image:t},[Ei]:{type:"mask_combine",id:Ei,is_intermediate:A,mask2:n},[Wn]:{type:"i2l",id:Wn,is_intermediate:A,fp32:O},[Ne]:{type:"noise",id:Ne,use_cpu:L,seed:c,is_intermediate:A},[qn]:{type:"create_denoise_mask",id:qn,is_intermediate:A,fp32:O},[ye]:{type:"denoise_latents",id:ye,is_intermediate:A,steps:u,cfg_scale:s,scheduler:l,denoising_start:w?Math.min(C,1-x):1-x,denoising_end:w?C:1},[Vt]:{type:"noise",id:Vt,use_cpu:L,seed:c+1,is_intermediate:A},[yc]:{type:"add",id:yc,b:1,is_intermediate:A},[ft]:{type:"denoise_latents",id:ft,is_intermediate:A,steps:m,cfg_scale:s,scheduler:l,denoising_start:1-_,denoising_end:1},[qe]:{type:"l2i",id:qe,is_intermediate:A,fp32:O},[_e]:{type:"color_correct",id:_e,is_intermediate:A}},edges:[{source:{node_id:Vi,field:"unet"},destination:{node_id:ye,field:"unet"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:Vi,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:Vi,field:"clip2"},destination:{node_id:Ke,field:"clip2"}},{source:{node_id:Kt,field:"image"},destination:{node_id:Wn,field:"image"}},{source:{node_id:Ph,field:"image"},destination:{node_id:Ei,field:"mask1"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ye,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ye,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ye,field:"noise"}},{source:{node_id:Wn,field:"latents"},destination:{node_id:ye,field:"latents"}},{source:{node_id:P?Mn:Ei,field:"image"},destination:{node_id:qn,field:"mask"}},{source:{node_id:qn,field:"denoise_mask"},destination:{node_id:ye,field:"denoise_mask"}},{source:{node_id:D,field:"unet"},destination:{node_id:ft,field:"unet"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ft,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ft,field:"negative_conditioning"}},{source:{node_id:Vt,field:"noise"},destination:{node_id:ft,field:"noise"}},{source:{node_id:ye,field:"latents"},destination:{node_id:ft,field:"latents"}},{source:{node_id:Kt,field:"image"},destination:{node_id:qn,field:"image"}},{source:{node_id:ft,field:"latents"},destination:{node_id:qe,field:"latents"}}]};if(g==="patchmatch"&&($.nodes[Kt]={type:"infill_patchmatch",id:Kt,is_intermediate:A,downscale:y}),g==="lama"&&($.nodes[Kt]={type:"infill_lama",id:Kt,is_intermediate:A}),g==="cv2"&&($.nodes[Kt]={type:"infill_cv2",id:Kt,is_intermediate:A}),g==="tile"&&($.nodes[Kt]={type:"infill_tile",id:Kt,is_intermediate:A,tile_size:b}),P){const B=k.width,U=k.height;$.nodes[ki]={type:"img_resize",id:ki,is_intermediate:A,width:B,height:U,image:t},$.nodes[Mn]={type:"img_resize",id:Mn,is_intermediate:A,width:B,height:U},$.nodes[Hi]={type:"img_resize",id:Hi,is_intermediate:A,width:T,height:E},$.nodes[Vu]={type:"img_resize",id:Vu,is_intermediate:A,width:T,height:E},$.nodes[qi]={type:"img_resize",id:qi,is_intermediate:A,width:T,height:E},$.nodes[Ne].width=B,$.nodes[Ne].height=U,$.nodes[Vt].width=B,$.nodes[Vt].height=U,$.edges.push({source:{node_id:ki,field:"image"},destination:{node_id:Kt,field:"image"}},{source:{node_id:Ei,field:"image"},destination:{node_id:Mn,field:"image"}},{source:{node_id:qe,field:"image"},destination:{node_id:Hi,field:"image"}},{source:{node_id:Mn,field:"image"},destination:{node_id:qi,field:"image"}},{source:{node_id:Kt,field:"image"},destination:{node_id:Vu,field:"image"}},{source:{node_id:Vu,field:"image"},destination:{node_id:_e,field:"reference"}},{source:{node_id:Hi,field:"image"},destination:{node_id:_e,field:"image"}},{source:{node_id:qi,field:"image"},destination:{node_id:_e,field:"mask"}})}else $.nodes[Kt]={...$.nodes[Kt],image:t},$.nodes[Ne].width=T,$.nodes[Ne].height=E,$.nodes[Vt].width=T,$.nodes[Vt].height=E,$.nodes[Wn]={...$.nodes[Wn],image:t},$.edges.push({source:{node_id:Kt,field:"image"},destination:{node_id:_e,field:"reference"}},{source:{node_id:qe,field:"image"},destination:{node_id:_e,field:"image"}},{source:{node_id:Ei,field:"image"},destination:{node_id:_e,field:"mask"}});return p!=="unmasked"&&($.nodes[zt]={type:"create_denoise_mask",id:zt,is_intermediate:A,fp32:O},$.edges.push({source:{node_id:Kt,field:"image"},destination:{node_id:zt,field:"image"}}),p==="mask"&&(P?$.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:zt,field:"mask"}}):$.edges.push({source:{node_id:Ei,field:"image"},destination:{node_id:zt,field:"mask"}})),p==="edge"&&($.nodes[yr]={type:"mask_edge",id:yr,is_intermediate:A,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},P?$.edges.push({source:{node_id:Mn,field:"image"},destination:{node_id:yr,field:"image"}}):$.edges.push({source:{node_id:Ei,field:"image"},destination:{node_id:yr,field:"image"}}),$.edges.push({source:{node_id:yr,field:"image"},destination:{node_id:zt,field:"mask"}})),$.edges.push({source:{node_id:zt,field:"denoise_mask"},destination:{node_id:ft,field:"denoise_mask"}})),(v||S)&&(Fa(e,$,D),D=Kr),w&&(Fp(e,$,ft,D,t),(v||S)&&(D=ns)),za(e,$,D),Lp(e,$,ye,D),$a(e,$,ye),Na(e,$,ye),Ba(e,$,ye),e.system.shouldUseNSFWChecker&&Da(e,$,_e),e.system.shouldUseWatermarker&&ja(e,$,_e),La(e,$),$},UAe=e=>{const t=be("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,shouldUseCpuNoise:c,seamlessXAxis:d,seamlessYAxis:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:m,boundingBoxScaleMethod:_}=e.canvas,b=u==="fp32",y=!0,g=["auto","manual"].includes(_),{shouldUseSDXLRefiner:v,refinerStart:S}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const x=c,w=i.model_type==="onnx";let C=w?cw:Vi;const T=w?"onnx_model_loader":"sdxl_model_loader",E=w?{type:"t2l_onnx",id:ye,is_intermediate:y,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:ye,is_intermediate:y,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:v?S:1},{joinedPositiveStylePrompt:k,joinedNegativeStylePrompt:N}=af(e),O={id:hw,nodes:{[C]:{type:T,id:C,is_intermediate:y,model:i},[Be]:{type:w?"prompt_onnx":"sdxl_compel_prompt",id:Be,is_intermediate:y,prompt:n,style:k},[Ke]:{type:w?"prompt_onnx":"sdxl_compel_prompt",id:Ke,is_intermediate:y,prompt:r,style:N},[Ne]:{type:"noise",id:Ne,is_intermediate:y,seed:s,width:g?m.width:h,height:g?m.height:p,use_cpu:x},[E.id]:E},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ye,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Ke,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ye,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ye,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ye,field:"noise"}}]};return g?(O.nodes[qe]={id:qe,type:w?"l2i_onnx":"l2i",is_intermediate:y,fp32:b},O.nodes[_e]={id:_e,type:"img_resize",is_intermediate:y,width:h,height:p},O.edges.push({source:{node_id:ye,field:"latents"},destination:{node_id:qe,field:"latents"}},{source:{node_id:qe,field:"image"},destination:{node_id:_e,field:"image"}})):(O.nodes[_e]={type:w?"l2i_onnx":"l2i",id:_e,is_intermediate:y,fp32:b},O.edges.push({source:{node_id:ye,field:"latents"},destination:{node_id:_e,field:"latents"}})),O.nodes[dt]={id:dt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:g?m.width:h,height:g?m.height:p,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:x?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],t2iAdapters:[]},O.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:_e,field:"metadata"}}),(d||f)&&(Fa(e,O,C),C=Kr),v&&(Fp(e,O,ye,C),(d||f)&&(C=ns)),Lp(e,O,ye,C),za(e,O,C),$a(e,O,ye),Na(e,O,ye),Ba(e,O,ye),e.system.shouldUseNSFWChecker&&Da(e,O,_e),e.system.shouldUseWatermarker&&ja(e,O,_e),La(e,O),O},VAe=e=>{const t=be("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:_,boundingBoxScaleMethod:b}=e.canvas,y=u==="fp32",g=!0,v=["auto","manual"].includes(b);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d,x=i.model_type==="onnx";let w=x?cw:cu;const C=x?"onnx_model_loader":"main_model_loader",T=x?{type:"t2l_onnx",id:ve,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:ve,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:1},E={id:yH,nodes:{[w]:{type:C,id:w,is_intermediate:g,model:i},[Zt]:{type:"clip_skip",id:Zt,is_intermediate:g,skipped_layers:c},[Be]:{type:x?"prompt_onnx":"compel",id:Be,is_intermediate:g,prompt:n},[Ke]:{type:x?"prompt_onnx":"compel",id:Ke,is_intermediate:g,prompt:r},[Ne]:{type:"noise",id:Ne,is_intermediate:g,seed:s,width:v?_.width:p,height:v?_.height:m,use_cpu:S},[T.id]:T},edges:[{source:{node_id:w,field:"unet"},destination:{node_id:ve,field:"unet"}},{source:{node_id:w,field:"clip"},destination:{node_id:Zt,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ve,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ve,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ve,field:"noise"}}]};return v?(E.nodes[qe]={id:qe,type:x?"l2i_onnx":"l2i",is_intermediate:g,fp32:y},E.nodes[_e]={id:_e,type:"img_resize",is_intermediate:g,width:p,height:m},E.edges.push({source:{node_id:ve,field:"latents"},destination:{node_id:qe,field:"latents"}},{source:{node_id:qe,field:"image"},destination:{node_id:_e,field:"image"}})):(E.nodes[_e]={type:x?"l2i_onnx":"l2i",id:_e,is_intermediate:g,fp32:y},E.edges.push({source:{node_id:ve,field:"latents"},destination:{node_id:_e,field:"latents"}})),E.nodes[dt]={id:dt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:v?_.width:p,height:v?_.height:m,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],t2iAdapters:[],clip_skip:c},E.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:_e,field:"metadata"}}),(f||h)&&(Fa(e,E,w),w=Kr),za(e,E,w),Dp(e,E,ve,w),$a(e,E,ve),Na(e,E,ve),Ba(e,E,ve),e.system.shouldUseNSFWChecker&&Da(e,E,_e),e.system.shouldUseWatermarker&&ja(e,E,_e),La(e,E),E},GAe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=UAe(e):i=VAe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=BAe(e,n):i=DAe(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=zAe(e,n,r):i=LAe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=jAe(e,n,r):i=FAe(e,n,r)}return i},S5=({count:e,start:t,min:n=zse,max:r=rm})=>{const i=t??Tae(n,r),o=[];for(let a=i;a{const{iterations:r,model:i,shouldRandomizeSeed:o,seed:a}=e.generation,{shouldConcatSDXLStylePrompt:s,positiveStylePrompt:l}=e.sdxl,{prompts:u,seedBehaviour:c}=e.dynamicPrompts,d=[];if(u.length===1){mI(t.nodes[dt],"seed");const h=S5({count:r,start:o?void 0:a}),p=[];t.nodes[Ne]&&p.push({node_path:Ne,field_name:"seed",items:h}),t.nodes[dt]&&p.push({node_path:dt,field_name:"seed",items:h}),t.nodes[Vt]&&p.push({node_path:Vt,field_name:"seed",items:h.map(m=>(m+1)%rm)}),d.push(p)}else{const h=[],p=[];if(c==="PER_PROMPT"){const _=S5({count:u.length*r,start:o?void 0:a});t.nodes[Ne]&&h.push({node_path:Ne,field_name:"seed",items:_}),t.nodes[dt]&&h.push({node_path:dt,field_name:"seed",items:_}),t.nodes[Vt]&&h.push({node_path:Vt,field_name:"seed",items:_.map(b=>(b+1)%rm)})}else{const _=S5({count:r,start:o?void 0:a});t.nodes[Ne]&&p.push({node_path:Ne,field_name:"seed",items:_}),t.nodes[dt]&&p.push({node_path:dt,field_name:"seed",items:_}),t.nodes[Vt]&&p.push({node_path:Vt,field_name:"seed",items:_.map(b=>(b+1)%rm)}),d.push(p)}const m=c==="PER_PROMPT"?Mae(r).flatMap(()=>u):u;if(t.nodes[Be]&&h.push({node_path:Be,field_name:"prompt",items:m}),t.nodes[dt]&&h.push({node_path:dt,field_name:"positive_prompt",items:m}),s&&(i==null?void 0:i.base_model)==="sdxl"){mI(t.nodes[dt],"positive_style_prompt");const _=m.map(b=>[b,l].join(" "));t.nodes[Be]&&h.push({node_path:Be,field_name:"style",items:_}),t.nodes[dt]&&h.push({node_path:dt,field_name:"positive_style_prompt",items:_})}d.push(h)}return{prepend:n,batch:{graph:t,runs:1,data:d}}},HAe=()=>{Me({predicate:e=>tP.match(e)&&e.payload.tabName==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n})=>{const r=be("queue"),{prepend:i}=e.payload,o=t(),{layerState:a,boundingBoxCoordinates:s,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await Jk(a,s,l,u,c);if(!d){r.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=$Ae(h,m);if(o.system.enableImageDebugging){const S=await tM(f),x=await tM(p);RAe([{base64:x,caption:"mask b64"},{base64:S,caption:"image b64"}])}r.debug(`Generation mode: ${_}`);let b,y;["img2img","inpaint","outpaint"].includes(_)&&(b=await n(xe.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(y=await n(xe.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=GAe(o,_,b,y);r.debug({graph:Xt(g)},"Canvas graph built"),n(kG(g));const v=bH(o,g,i);try{const S=n(Er.endpoints.enqueueBatch.initiate(v,{fixedCacheKey:"enqueueBatch"})),x=await S.unwrap();S.reset();const w=x.batch.batch_id;o.canvas.layerState.stagingArea.boundingBox||n(pue({boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(gue(w))}catch{}}})},qAe=e=>{const t=be("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,img2imgStrength:c,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:p,shouldUseCpuNoise:m,vaePrecision:_,seamlessXAxis:b,seamlessYAxis:y}=e.generation;if(!u)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 g=_==="fp32",v=!0;let S=cu;const x=m,w={id:vE,nodes:{[S]:{type:"main_model_loader",id:S,model:i,is_intermediate:v},[Zt]:{type:"clip_skip",id:Zt,skipped_layers:p,is_intermediate:v},[Be]:{type:"compel",id:Be,prompt:n,is_intermediate:v},[Ke]:{type:"compel",id:Ke,prompt:r,is_intermediate:v},[Ne]:{type:"noise",id:Ne,use_cpu:x,seed:s,is_intermediate:v},[qe]:{type:"l2i",id:qe,fp32:g,is_intermediate:v},[ve]:{type:"denoise_latents",id:ve,cfg_scale:o,scheduler:a,steps:l,denoising_start:1-c,denoising_end:1,is_intermediate:v},[Hn]:{type:"i2l",id:Hn,fp32:g,is_intermediate:v}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:ve,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:Zt,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ve,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ve,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ve,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ve,field:"latents"}},{source:{node_id:ve,field:"latents"},destination:{node_id:qe,field:"latents"}}]};if(d&&(u.width!==f||u.height!==h)){const C={id:Fs,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:f,height:h};w.nodes[Fs]=C,w.edges.push({source:{node_id:Fs,field:"image"},destination:{node_id:Hn,field:"image"}}),w.edges.push({source:{node_id:Fs,field:"width"},destination:{node_id:Ne,field:"width"}}),w.edges.push({source:{node_id:Fs,field:"height"},destination:{node_id:Ne,field:"height"}})}else w.nodes[Hn].image={image_name:u.imageName},w.edges.push({source:{node_id:Hn,field:"width"},destination:{node_id:Ne,field:"width"}}),w.edges.push({source:{node_id:Hn,field:"height"},destination:{node_id:Ne,field:"height"}});return w.nodes[dt]={id:dt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:x?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],t2iAdapters:[],clip_skip:p,strength:c,init_image:u.imageName},w.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:qe,field:"metadata"}}),(b||y)&&(Fa(e,w,S),S=Kr),za(e,w,S),Dp(e,w,ve,S),$a(e,w,ve),Na(e,w,ve),Ba(e,w,ve),e.system.shouldUseNSFWChecker&&Da(e,w),e.system.shouldUseWatermarker&&ja(e,w),La(e,w),w},WAe=e=>{const t=be("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,shouldFitToWidthHeight:c,width:d,height:f,shouldUseCpuNoise:h,vaePrecision:p,seamlessXAxis:m,seamlessYAxis:_}=e.generation,{positiveStylePrompt:b,negativeStylePrompt:y,shouldUseSDXLRefiner:g,refinerStart:v,sdxlImg2ImgDenoisingStrength:S}=e.sdxl;if(!u)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 x=p==="fp32",w=!0;let C=Vi;const T=h,{joinedPositiveStylePrompt:E,joinedNegativeStylePrompt:k}=af(e),N={id:tS,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:w},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:E,is_intermediate:w},[Ke]:{type:"sdxl_compel_prompt",id:Ke,prompt:r,style:k,is_intermediate:w},[Ne]:{type:"noise",id:Ne,use_cpu:T,seed:s,is_intermediate:w},[qe]:{type:"l2i",id:qe,fp32:x,is_intermediate:w},[ye]:{type:"denoise_latents",id:ye,cfg_scale:o,scheduler:a,steps:l,denoising_start:g?Math.min(v,1-S):1-S,denoising_end:g?v:1,is_intermediate:w},[Hn]:{type:"i2l",id:Hn,fp32:x,is_intermediate:w}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ye,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Ke,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ye,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ye,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ye,field:"noise"}},{source:{node_id:Hn,field:"latents"},destination:{node_id:ye,field:"latents"}},{source:{node_id:ye,field:"latents"},destination:{node_id:qe,field:"latents"}}]};if(c&&(u.width!==d||u.height!==f)){const O={id:Fs,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:d,height:f};N.nodes[Fs]=O,N.edges.push({source:{node_id:Fs,field:"image"},destination:{node_id:Hn,field:"image"}}),N.edges.push({source:{node_id:Fs,field:"width"},destination:{node_id:Ne,field:"width"}}),N.edges.push({source:{node_id:Fs,field:"height"},destination:{node_id:Ne,field:"height"}})}else N.nodes[Hn].image={image_name:u.imageName},N.edges.push({source:{node_id:Hn,field:"width"},destination:{node_id:Ne,field:"width"}}),N.edges.push({source:{node_id:Hn,field:"height"},destination:{node_id:Ne,field:"height"}});return N.nodes[dt]={id:dt,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:T?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],t2iAdapters:[],strength:S,init_image:u.imageName,positive_style_prompt:b,negative_style_prompt:y},N.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:qe,field:"metadata"}}),(m||_)&&(Fa(e,N,C),C=Kr),g&&(Fp(e,N,ye),(m||_)&&(C=ns)),za(e,N,C),Lp(e,N,ye,C),$a(e,N,ye),Na(e,N,ye),Ba(e,N,ye),e.system.shouldUseNSFWChecker&&Da(e,N),e.system.shouldUseWatermarker&&ja(e,N),La(e,N),N},KAe=e=>{const t=be("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,width:u,height:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{positiveStylePrompt:m,negativeStylePrompt:_,shouldUseSDXLRefiner:b,refinerStart:y}=e.sdxl,g=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const v=f==="fp32",S=!0,{joinedPositiveStylePrompt:x,joinedNegativeStylePrompt:w}=af(e);let C=Vi;const T={id:eP,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:S},[Be]:{type:"sdxl_compel_prompt",id:Be,prompt:n,style:x,is_intermediate:S},[Ke]:{type:"sdxl_compel_prompt",id:Ke,prompt:r,style:w,is_intermediate:S},[Ne]:{type:"noise",id:Ne,seed:s,width:u,height:c,use_cpu:g,is_intermediate:S},[ye]:{type:"denoise_latents",id:ye,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:b?y:1,is_intermediate:S},[qe]:{type:"l2i",id:qe,fp32:v,is_intermediate:S}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ye,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Be,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Ke,field:"clip2"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ye,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ye,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ye,field:"noise"}},{source:{node_id:ye,field:"latents"},destination:{node_id:qe,field:"latents"}}]};return T.nodes[dt]={id:dt,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:c,width:u,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:g?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],t2iAdapters:[],positive_style_prompt:m,negative_style_prompt:_},T.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:qe,field:"metadata"}}),(h||p)&&(Fa(e,T,C),C=Kr),b&&(Fp(e,T,ye),(h||p)&&(C=ns)),za(e,T,C),Lp(e,T,ye,C),$a(e,T,ye),Na(e,T,ye),Ba(e,T,ye),e.system.shouldUseNSFWChecker&&Da(e,T),e.system.shouldUseWatermarker&&ja(e,T),La(e,T),T};function QAe(e){const t=["vae","control","ip_adapter","metadata","unet","positive_conditioning","negative_conditioning"],n=[];e.edges.forEach(r=>{r.destination.node_id===ve&&t.includes(r.destination.field)&&n.push({source:{node_id:r.source.node_id,field:r.source.field},destination:{node_id:$f,field:r.destination.field}})}),e.edges=e.edges.concat(n)}const XAe=(e,t)=>{var p;if(!e.generation.hrfEnabled||e.config.disabledSDFeatures.includes("hrf")||((p=e.generation.model)==null?void 0:p.model_type)==="onnx")return;const n=be("txt2img"),{vae:r}=e.generation,i=!r,o=e.generation.hrfWidth,a=e.generation.hrfHeight,s=t.nodes[ve],l=t.nodes[Ne],u=t.nodes[qe];if(!s){n.error("originalDenoiseLatentsNode is undefined");return}if(!l){n.error("originalNoiseNode is undefined");return}if(!u){n.error("originalLatentsToImageNode is undefined");return}l&&(l.width=o,l.height=a);const c={type:"denoise_latents",id:$f,is_intermediate:s==null?void 0:s.is_intermediate,cfg_scale:s==null?void 0:s.cfg_scale,scheduler:s==null?void 0:s.scheduler,steps:s==null?void 0:s.steps,denoising_start:1-e.generation.hrfStrength,denoising_end:1},d={type:"noise",id:gg,seed:l==null?void 0:l.seed,use_cpu:l==null?void 0:l.use_cpu,is_intermediate:l==null?void 0:l.is_intermediate},f={id:Ef,type:"lresize",width:e.generation.width,height:e.generation.height},h=u?{type:"l2i",id:td,fp32:u==null?void 0:u.fp32,is_intermediate:u==null?void 0:u.is_intermediate}:void 0;t.nodes[td]=h,t.nodes[$f]=c,t.nodes[gg]=d,t.nodes[Ef]=f,t.edges.push({source:{node_id:ve,field:"latents"},destination:{node_id:Ef,field:"latents"}},{source:{node_id:Ef,field:"height"},destination:{node_id:gg,field:"height"}},{source:{node_id:Ef,field:"width"},destination:{node_id:gg,field:"width"}},{source:{node_id:Ef,field:"latents"},destination:{node_id:$f,field:"latents"}},{source:{node_id:gg,field:"noise"},destination:{node_id:$f,field:"noise"}},{source:{node_id:$f,field:"latents"},destination:{node_id:td,field:"latents"}},{source:{node_id:dt,field:"metadata"},destination:{node_id:td,field:"metadata"}},{source:{node_id:i?cu:Wa,field:"vae"},destination:{node_id:td,field:"vae"}}),QAe(t)},YAe=e=>{const t=be("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,steps:s,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p,seed:m,hrfWidth:_,hrfHeight:b,hrfStrength:y,hrfEnabled:g}=e.generation,v=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=f==="fp32",x=!0,w=i.model_type==="onnx";let C=w?cw:cu;const T=w?"onnx_model_loader":"main_model_loader",E=w?{type:"t2l_onnx",id:ve,is_intermediate:x,cfg_scale:o,scheduler:a,steps:s}:{type:"denoise_latents",id:ve,is_intermediate:x,cfg_scale:o,scheduler:a,steps:s,denoising_start:0,denoising_end:1},k={id:mH,nodes:{[C]:{type:T,id:C,is_intermediate:x,model:i},[Zt]:{type:"clip_skip",id:Zt,skipped_layers:c,is_intermediate:x},[Be]:{type:w?"prompt_onnx":"compel",id:Be,prompt:n,is_intermediate:x},[Ke]:{type:w?"prompt_onnx":"compel",id:Ke,prompt:r,is_intermediate:x},[Ne]:{type:"noise",id:Ne,seed:m,width:l,height:u,use_cpu:v,is_intermediate:x},[E.id]:E,[qe]:{type:w?"l2i_onnx":"l2i",id:qe,fp32:S,is_intermediate:x}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ve,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Zt,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Be,field:"clip"}},{source:{node_id:Zt,field:"clip"},destination:{node_id:Ke,field:"clip"}},{source:{node_id:Be,field:"conditioning"},destination:{node_id:ve,field:"positive_conditioning"}},{source:{node_id:Ke,field:"conditioning"},destination:{node_id:ve,field:"negative_conditioning"}},{source:{node_id:Ne,field:"noise"},destination:{node_id:ve,field:"noise"}},{source:{node_id:ve,field:"latents"},destination:{node_id:qe,field:"latents"}}]};return k.nodes[dt]={id:dt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:n,negative_prompt:r,model:i,seed:m,steps:s,rand_device:v?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],ipAdapters:[],t2iAdapters:[],clip_skip:c,hrf_width:g?_:void 0,hrf_height:g?b:void 0,hrf_strength:g?y:void 0},k.edges.push({source:{node_id:dt,field:"metadata"},destination:{node_id:qe,field:"metadata"}}),(h||p)&&(Fa(e,k,C),C=Kr),za(e,k,C),Dp(e,k,ve,C),$a(e,k,ve),Na(e,k,ve),Ba(e,k,ve),e.generation.hrfEnabled&&!w&&XAe(e,k),e.system.shouldUseNSFWChecker&&Da(e,k),e.system.shouldUseWatermarker&&ja(e,k),La(e,k),k},ZAe=()=>{Me({predicate:e=>tP.match(e)&&(e.payload.tabName==="txt2img"||e.payload.tabName==="img2img"),effect:async(e,{getState:t,dispatch:n})=>{const r=t(),i=r.generation.model,{prepend:o}=e.payload;let a;i&&i.base_model==="sdxl"?e.payload.tabName==="txt2img"?a=KAe(r):a=WAe(r):e.payload.tabName==="txt2img"?a=YAe(r):a=qAe(r);const s=bH(r,a,o);n(Er.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})).reset()}})},JAe=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function eEe(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+tEe(n)+'"]';if(!JAe.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function tEe(e){return e.replace(/"/g,'\\"')}function nEe(e){return e.length!==0}const rEe=99,_H="; ",SH=", or ",rP="Validation error",xH=": ";class wH extends Error{constructor(n,r=[]){super(n);Lw(this,"details");Lw(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function iP(e,t,n){if(e.code==="invalid_union")return e.unionErrors.reduce((r,i)=>{const o=i.issues.map(a=>iP(a,t,n)).join(t);return r.includes(o)||r.push(o),r},[]).join(n);if(nEe(e.path)){if(e.path.length===1){const r=e.path[0];if(typeof r=="number")return`${e.message} at index ${r}`}return`${e.message} at "${eEe(e.path)}"`}return e.message}function CH(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:rP}function VKe(e,t={}){const{issueSeparator:n=_H,unionSeparator:r=SH,prefixSeparator:i=xH,prefix:o=rP}=t,a=iP(e,n,r),s=CH(a,o,i);return new wH(s,[e])}function nM(e,t={}){const{maxIssuesInMessage:n=rEe,issueSeparator:r=_H,unionSeparator:i=SH,prefixSeparator:o=xH,prefix:a=rP}=t,s=e.errors.slice(0,n).map(u=>iP(u,r,i)).join(r),l=CH(s,a,o);return new wH(l,e.errors)}const iEe=e=>{const{workflow:t,nodes:n,edges:r}=e,i={...t,nodes:[],edges:[]};return n.filter(o=>["invocation","notes"].includes(o.type??"__UNKNOWN_NODE_TYPE__")).forEach(o=>{const a=pj.safeParse(o);if(!a.success){const{message:s}=nM(a.error,{prefix:me.t("nodes.unableToParseNode")});be("nodes").warn({node:Xt(o)},s);return}i.nodes.push(a.data)}),r.forEach(o=>{const a=gj.safeParse(o);if(!a.success){const{message:s}=nM(a.error,{prefix:me.t("nodes.unableToParseEdge")});be("nodes").warn({edge:Xt(o)},s);return}i.edges.push(a.data)}),i},oEe=e=>{if(e.type==="ColorField"&&e.value){const t=Ut(e.value),{r:n,g:r,b:i,a:o}=e.value,a=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a}),t}return e.value},aEe=e=>{const{nodes:t,edges:n}=e,r=t.filter(Vr),i=JSON.stringify(iEe(e)),o=r.reduce((u,c)=>{const{id:d,data:f}=c,{type:h,inputs:p,isIntermediate:m,embedWorkflow:_}=f,b=mA(p,(g,v,S)=>{const x=oEe(v);return g[S]=x,g},{});b.use_cache=c.data.useCache;const y={type:h,id:d,...b,is_intermediate:m};return _&&Object.assign(y,{workflow:i}),Object.assign(u,{[d]:y}),u},{}),s=n.filter(u=>u.type!=="collapsed").reduce((u,c)=>{const{source:d,target:f,sourceHandle:h,targetHandle:p}=c;return u.push({source:{node_id:d,field:h},destination:{node_id:f,field:p}}),u},[]);return s.forEach(u=>{const c=o[u.destination.node_id],d=u.destination.field;o[u.destination.node_id]=_y(c,d)}),{id:nm(),nodes:o,edges:s}},sEe=()=>{Me({predicate:e=>tP.match(e)&&e.payload.tabName==="nodes",effect:async(e,{getState:t,dispatch:n})=>{const r=t(),o={batch:{graph:aEe(r.nodes),runs:r.generation.iterations},prepend:e.payload.prepend};n(Er.endpoints.enqueueBatch.initiate(o,{fixedCacheKey:"enqueueBatch"})).reset()}})},lEe=()=>{Me({matcher:xe.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=be("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},uEe=()=>{Me({matcher:xe.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=be("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},oP=De("deleteImageModal/imageDeletionConfirmed"),GKe=Ii(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],gx),AH=Ii([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?ii:to,offset:0,limit:Iue,is_intermediate:!1}},gx),cEe=()=>{Me({actionCreator:oP,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var f;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const a=i[0],s=o[0];if(!a||!s)return;t(W4(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(a&&(a==null?void 0:a.image_name)===u){const{image_name:h}=a,p=AH(l),{data:m}=xe.endpoints.listImages.select(p)(l),_=m?Vn.getSelectors().selectAll(m):[],b=_.findIndex(S=>S.image_name===h),y=_.filter(S=>S.image_name!==h),g=zu(b,0,y.length-1),v=y[g];t(Qs(v||null))}s.isCanvasImage&&t(q4()),i.forEach(h=>{var p;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(H4()),Xl(Pa(n().controlAdapters),m=>{(m.controlImage===h.image_name||Ho(m)&&m.processedControlImage===h.image_name)&&(t(kc({id:m.id,controlImage:null})),t(U4({id:m.id,processedControlImage:null})))}),n().nodes.nodes.forEach(m=>{Vr(m)&&Xl(m.data.inputs,_=>{var b;_.type==="ImageField"&&((b=_.value)==null?void 0:b.image_name)===h.image_name&&t(hx({nodeId:m.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(xe.endpoints.deleteImage.initiate(a));await r(h=>xe.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(gs.util.invalidateTags([{type:"Board",id:a.board_id}]))}})},dEe=()=>{Me({actionCreator:oP,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(xe.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),a=AH(o),{data:s}=xe.endpoints.listImages.select(a)(o),l=s?Vn.getSelectors().selectAll(s)[0]:void 0;t(Qs(l||null)),t(W4(!1)),i.some(u=>u.isCanvasImage)&&t(q4()),r.forEach(u=>{var c;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(H4()),Xl(Pa(n().controlAdapters),d=>{(d.controlImage===u.image_name||Ho(d)&&d.processedControlImage===u.image_name)&&(t(kc({id:d.id,controlImage:null})),t(U4({id:d.id,processedControlImage:null})))}),n().nodes.nodes.forEach(d=>{Vr(d)&&Xl(d.data.inputs,f=>{var h;f.type==="ImageField"&&((h=f.value)==null?void 0:h.image_name)===u.image_name&&t(hx({nodeId:d.data.id,fieldName:f.name,value:void 0}))})})})}catch{}}})},fEe=()=>{Me({matcher:xe.endpoints.deleteImage.matchPending,effect:()=>{}})},hEe=()=>{Me({matcher:xe.endpoints.deleteImage.matchFulfilled,effect:e=>{be("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},pEe=()=>{Me({matcher:xe.endpoints.deleteImage.matchRejected,effect:e=>{be("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},EH=De("dnd/dndDropped"),gEe=()=>{Me({actionCreator:EH,effect:async(e,{dispatch:t})=>{const n=be("dnd"),{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`):r.payloadType==="NODE_FIELD"?n.debug({activeData:Xt(r),overData:Xt(i)},"Node field dropped"):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="ADD_FIELD_TO_LINEAR"&&r.payloadType==="NODE_FIELD"){const{nodeId:o,field:a}=r.payload;t(N2e({nodeId:o,fieldName:a.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Qs(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(m2(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROL_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{id:o}=i.context;t(kc({id:o,controlImage:r.payload.imageDTO.image_name})),t(Sy({id:o,isEnabled:!0}));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(vz(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:a}=i.context;t(hx({nodeId:a,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:a}=i.context;t(xe.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(xe.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:a}=i.context;t(xe.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(xe.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},mEe=()=>{Me({matcher:xe.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=be("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},yEe=()=>{Me({matcher:xe.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=be("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},vEe=()=>{Me({actionCreator:Sue,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,a=iwe(n()),s=a.some(l=>l.isCanvasImage)||a.some(l=>l.isInitialImage)||a.some(l=>l.isControlImage)||a.some(l=>l.isNodesImage);if(o||s){t(W4(!0));return}t(oP({imageDTOs:r,imagesUsage:a}))}})},bEe=()=>{Me({matcher:xe.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=be("images"),i=e.payload,o=n(),{autoAddBoardId:a}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:s}=e.meta.arg.originalArgs;if(e.payload.is_intermediate&&!s)return;const l={title:Z("toast.imageUploaded"),status:"success"};if((s==null?void 0:s.type)==="TOAST"){const{toastOptions:u}=s;if(!a||a==="none")t(Ht({...l,...u}));else{t(xe.endpoints.addImageToBoard.initiate({board_id:a,imageDTO:i}));const{data:c}=Lt.endpoints.listAllBoards.select()(o),d=c==null?void 0:c.find(h=>h.board_id===a),f=d?`${Z("toast.addedToBoard")} ${d.board_name}`:`${Z("toast.addedToBoard")} ${a}`;t(Ht({...l,description:f}))}return}if((s==null?void 0:s.type)==="SET_CANVAS_INITIAL_IMAGE"){t(vz(i)),t(Ht({...l,description:Z("toast.setCanvasInitialImage")}));return}if((s==null?void 0:s.type)==="SET_CONTROL_ADAPTER_IMAGE"){const{id:u}=s;t(Sy({id:u,isEnabled:!0})),t(kc({id:u,controlImage:i.image_name})),t(Ht({...l,description:Z("toast.setControlImage")}));return}if((s==null?void 0:s.type)==="SET_INITIAL_IMAGE"){t(m2(i)),t(Ht({...l,description:Z("toast.setInitialImage")}));return}if((s==null?void 0:s.type)==="SET_NODES_IMAGE"){const{nodeId:u,fieldName:c}=s;t(hx({nodeId:u,fieldName:c,value:i})),t(Ht({...l,description:`${Z("toast.setNodeField")} ${c}`}));return}}})},_Ee=()=>{Me({matcher:xe.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=be("images"),r={arg:{..._y(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Ht({title:Z("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},SEe=()=>{Me({matcher:xe.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!0}):a.push(s)}),t(RU(a))}})},xEe=()=>{Me({matcher:xe.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!1}):a.push(s)}),t(RU(a))}})},wEe=De("generation/initialImageSelected"),CEe=De("generation/modelSelected"),AEe=()=>{Me({actionCreator:wEe,effect:(e,{dispatch:t})=>{if(!e.payload){t(Ht(Gd({title:Z("toast.imageNotLoadedDesc"),status:"error"})));return}t(m2(e.payload)),t(Ht(Gd(Z("toast.sentToImageToImage"))))}})},EEe=()=>{Me({actionCreator:CEe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=be("models"),i=t(),o=wy.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const a=o.data,{base_model:s}=a;if(((l=i.generation.model)==null?void 0:l.base_model)!==s){let c=0;Xl(i.lora.loras,(f,h)=>{f.base_model!==s&&(n(MU(h)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==s&&(n(pz(null)),c+=1),Pa(i.controlAdapters).forEach(f=>{var h;((h=f.model)==null?void 0:h.base_model)!==s&&(n(Sy({id:f.id,isEnabled:!1})),c+=1)}),c>0&&n(Ht(Gd({title:Z("toast.baseModelChangedCleared",{count:c}),status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==a.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(a.base_model)?(n(OI(1024)),n(MI(1024)),n($I({width:1024,height:1024}))):(n(OI(512)),n(MI(512)),n($I({width:512,height:512})))),n(ju(a))}})},N0=Ra({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),rM=Ra({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),iM=Ra({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),oM=Ra({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),aM=Ra({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),sM=Ra({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),lM=Ra({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),_E=Ra({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),TEe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,vu=e=>{const t=[];return e.forEach(n=>{const r={...Ut(n),id:TEe(n)};t.push(r)}),t},Ts=gs.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${im.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:no},"Model"];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=vu(t.models);return rM.setAll(rM.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${im.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:no},"Model"];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=vu(t.models);return N0.setAll(N0.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:["Model"]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:["Model"]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:["Model"]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:["Model"]}),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:["Model"]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:["Model"]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:["Model"]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:no},"Model"];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=vu(t.models);return iM.setAll(iM.getInitialState(),n)}}),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:no}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:no}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:no},"Model"];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=vu(t.models);return oM.setAll(oM.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:no},"Model"];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=vu(t.models);return aM.setAll(aM.getInitialState(),n)}}),getT2IAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"t2i_adapter"}}),providesTags:t=>{const n=[{type:"T2IAdapterModel",id:no},"Model"];return t&&n.push(...t.ids.map(r=>({type:"T2IAdapterModel",id:r}))),n},transformResponse:t=>{const n=vu(t.models);return sM.setAll(sM.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:no},"Model"];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=vu(t.models);return _E.setAll(_E.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:no},"Model"];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=vu(t.models);return lM.setAll(lM.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${im.stringify(t,{})}`})}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:HKe,useGetOnnxModelsQuery:qKe,useGetControlNetModelsQuery:WKe,useGetIPAdapterModelsQuery:KKe,useGetT2IAdapterModelsQuery:QKe,useGetLoRAModelsQuery:XKe,useGetTextualInversionModelsQuery:YKe,useGetVaeModelsQuery:ZKe,useUpdateMainModelsMutation:JKe,useDeleteMainModelsMutation:eQe,useImportMainModelsMutation:tQe,useAddMainModelsMutation:nQe,useConvertMainModelsMutation:rQe,useMergeMainModelsMutation:iQe,useDeleteLoRAModelsMutation:oQe,useUpdateLoRAModelsMutation:aQe,useSyncModelsMutation:sQe,useGetModelsInFolderQuery:lQe,useGetCheckpointConfigsQuery:uQe}=Ts,kEe=()=>{Me({predicate:e=>Ts.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=be("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=N0.getSelectors().selectAll(e.payload);if(o.length===0){n(ju(null));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=wy.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse main model");return}n(ju(s.data))}}),Me({predicate:e=>Ts.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=be("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=N0.getSelectors().selectAll(e.payload);if(o.length===0){n(dO(null)),n(B2e(!1));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=V4.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse SDXL Refiner Model");return}n(dO(s.data))}}),Me({matcher:Ts.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=be("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Rf(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 a=_E.getSelectors().selectAll(e.payload)[0];if(!a){n(ju(null));return}const s=qle.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse VAE model");return}n(pz(s.data))}}),Me({matcher:Ts.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{be("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;Xl(i,(o,a)=>{Rf(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(MU(a))})}}),Me({matcher:Ts.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{be("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`),ZB(t().controlAdapters).forEach(i=>{Rf(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(xC({id:i.id}))})}}),Me({matcher:Ts.endpoints.getT2IAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{be("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`),JB(t().controlAdapters).forEach(i=>{Rf(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(xC({id:i.id}))})}}),Me({matcher:Ts.endpoints.getIPAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{be("models").info({models:e.payload.entities},`IP Adapter models loaded (${e.payload.ids.length})`),kse(t().controlAdapters).forEach(i=>{Rf(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(xC({id:i.id}))})}}),Me({matcher:Ts.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{be("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},PEe=gs.injectEndpoints({endpoints:e=>({dynamicPrompts:e.query({query:t=>({url:"utilities/dynamicprompts",body:t,method:"POST"}),keepUnusedDataFor:86400})})}),IEe=Qi(rue,Eue,Cue,Aue,R4),REe=()=>{Me({matcher:IEe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{r(),await i(1e3);const o=n();if(o.config.disabledFeatures.includes("dynamicPrompting"))return;const{positivePrompt:a}=o.generation,{maxPrompts:s}=o.dynamicPrompts;t(wC(!0));try{const l=t(PEe.endpoints.dynamicPrompts.initiate({prompt:a,max_prompts:s})),u=await l.unwrap();l.unsubscribe(),t(Tue(u.prompts)),t(kue(u.error)),t(NI(!1)),t(wC(!1))}catch{t(NI(!0)),t(wC(!1))}}})},Tf=e=>e.$ref.split("/").slice(-1)[0],OEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",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},MEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"IntegerPolymorphic",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},$Ee=({schemaObject:e,baseField:t})=>{const n=_B(e.item_default)&&Koe(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},NEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",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},DEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"FloatPolymorphic",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},LEe=({schemaObject:e,baseField:t})=>{const n=_B(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},FEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",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},BEe=({schemaObject:e,baseField:t})=>{const n={...t,type:"StringPolymorphic",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},zEe=({schemaObject:e,baseField:t})=>{const n=k4(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},jEe=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),UEe=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),VEe=({schemaObject:e,baseField:t})=>{const n=e.item_default&&Woe(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},GEe=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),HEe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),qEe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),WEe=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),KEe=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),QEe=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),XEe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),YEe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterModelField",default:e.default??void 0}),ZEe=({schemaObject:e,baseField:t})=>({...t,type:"BoardField",default:e.default??void 0}),JEe=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),eTe=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),tTe=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),nTe=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),rTe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),iTe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),oTe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),aTe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),sTe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),lTe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),uTe=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),cTe=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),dTe=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),fTe=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),hTe=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),pTe=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),gTe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),mTe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterPolymorphic",default:e.default??void 0}),yTe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),vTe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterField",default:e.default??void 0}),bTe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterPolymorphic",default:e.default??void 0}),_Te=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),STe=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",options:n,ui_choice_labels:e.ui_choice_labels,default:e.default??n[0]}},xTe=({baseField:e})=>({...e,type:"Collection",default:[]}),wTe=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),CTe=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),ATe=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),ETe=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),TTe=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),uM=e=>{if(e!=null&&e.ui_type)return e.ui_type;if(e.type){if(e.enum)return"enum";if(e.type){if(e.type==="number")return"float";if(e.type==="array"){const t=ehe(e.items)?e.items.type:Tf(e.items);return LSe(t)?$k[t]:void 0}else return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&rg(t[0]))return Tf(t[0])}else if(e.anyOf){const t=e.anyOf;let n,r;if(lR(t[0])){const i=t[0].items,o=t[1];rg(i)&&rg(o)?(n=Tf(i),r=Tf(o)):Dv(i)&&Dv(o)&&(n=i.type,r=o.type)}else if(lR(t[1])){const i=t[0],o=t[1].items;rg(i)&&rg(o)?(n=Tf(i),r=Tf(o)):Dv(i)&&Dv(o)&&(n=i.type,r=o.type)}if(n===r&&BSe(n))return eG[n]}},TH={BoardField:ZEe,boolean:jEe,BooleanCollection:VEe,BooleanPolymorphic:UEe,ClipField:cTe,Collection:xTe,CollectionItem:wTe,ColorCollection:ETe,ColorField:CTe,ColorPolymorphic:ATe,ConditioningCollection:lTe,ConditioningField:aTe,ConditioningPolymorphic:sTe,ControlCollection:pTe,ControlField:fTe,ControlNetModelField:QEe,ControlPolymorphic:hTe,DenoiseMaskField:nTe,enum:STe,float:NEe,FloatCollection:LEe,FloatPolymorphic:DEe,ImageCollection:tTe,ImageField:JEe,ImagePolymorphic:eTe,integer:OEe,IntegerCollection:$Ee,IntegerPolymorphic:MEe,IPAdapterCollection:yTe,IPAdapterField:gTe,IPAdapterModelField:XEe,IPAdapterPolymorphic:mTe,LatentsCollection:oTe,LatentsField:rTe,LatentsPolymorphic:iTe,LoRAModelField:KEe,MainModelField:GEe,Scheduler:TTe,SDXLMainModelField:HEe,SDXLRefinerModelField:qEe,string:FEe,StringCollection:zEe,StringPolymorphic:BEe,T2IAdapterCollection:_Te,T2IAdapterField:vTe,T2IAdapterModelField:YEe,T2IAdapterPolymorphic:bTe,UNetField:uTe,VaeField:dTe,VaeModelField:WEe},kTe=e=>!!(e&&e in TH),PTe=(e,t,n,r)=>{var f;const{input:i,ui_hidden:o,ui_component:a,ui_type:s,ui_order:l}=t,u={input:Ng.includes(r)?"connection":i,ui_hidden:o,ui_component:a,ui_type:s,required:((f=e.required)==null?void 0:f.includes(n))??!1,ui_order:l},c={name:n,title:t.title??"",description:t.description??"",fieldKind:"input",...u};if(!kTe(r))return;const d=TH[r];if(d)return d({schemaObject:t,baseField:c})},ITe=["id","type","metadata","use_cache"],RTe=["type"],OTe=["WorkflowField","MetadataField","IsIntermediate"],MTe=["graph","metadata_accumulator"],$Te=(e,t)=>!!(ITe.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),NTe=e=>!!OTe.includes(e),DTe=(e,t)=>!RTe.includes(t),LTe=e=>!MTe.includes(e.properties.type.default),FTe=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(the).filter(LTe).filter(a=>t?t.includes(a.properties.type.default):!0).filter(a=>n?!n.includes(a.properties.type.default):!0).reduce((a,s)=>{var v,S;const l=s.properties.type.default,u=s.title.replace("Invocation",""),c=s.tags??[],d=s.description??"",f=s.version,h=mA(s.properties,(x,w,C)=>{if($Te(l,C))return be("nodes").trace({node:l,fieldName:C,field:Xt(w)},"Skipped reserved input field"),x;if(!uR(w))return be("nodes").warn({node:l,propertyName:C,property:Xt(w)},"Unhandled input property"),x;const T=uM(w);if(!sR(T))return be("nodes").warn({node:l,fieldName:C,fieldType:T,field:Xt(w)},"Skipping unknown input field type"),x;if(NTe(T))return be("nodes").trace({node:l,fieldName:C,fieldType:T,field:Xt(w)},"Skipping reserved field type"),x;const E=PTe(s,w,C,T);return E?(x[C]=E,x):(be("nodes").debug({node:l,fieldName:C,fieldType:T,field:Xt(w)},"Skipping input field with no template"),x)},{}),p=s.output.$ref.split("/").pop();if(!p)return be("nodes").warn({outputRefObject:Xt(s.output)},"No output schema name found in ref object"),a;const m=(S=(v=e.components)==null?void 0:v.schemas)==null?void 0:S[p];if(!m)return be("nodes").warn({outputSchemaName:p},"Output schema not found"),a;if(!nhe(m))return be("nodes").error({outputSchema:Xt(m)},"Invalid output schema"),a;const _=m.properties.type.default,b=mA(m.properties,(x,w,C)=>{if(!DTe(l,C))return be("nodes").trace({type:l,propertyName:C,property:Xt(w)},"Skipped reserved output field"),x;if(!uR(w))return be("nodes").warn({type:l,propertyName:C,property:Xt(w)},"Unhandled output property"),x;const T=uM(w);return sR(T)?(x[C]={fieldKind:"output",name:C,title:w.title??"",description:w.description??"",type:T,ui_hidden:w.ui_hidden??!1,ui_type:w.ui_type,ui_order:w.ui_order},x):(be("nodes").warn({fieldName:C,fieldType:T,field:Xt(w)},"Skipping unknown output field type"),x)},{}),y=s.properties.use_cache.default,g={title:u,type:l,version:f,tags:c,description:d,outputType:_,inputs:h,outputs:b,useCache:y};return Object.assign(a,{[l]:g}),a},{})},BTe=()=>{Me({actionCreator:I0.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=be("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:a}=n().config,s=FTe(i,o,a);r.debug({nodeTemplates:Xt(s)},`Built ${u2(s)} node templates`),t(cG(s))}}),Me({actionCreator:I0.rejected,effect:e=>{be("system").error({error:Xt(e.error)},"Problem retrieving OpenAPI Schema")}})},zTe=()=>{Me({actionCreator:OB,effect:(e,{dispatch:t,getState:n})=>{be("socketio").debug("Connected");const{nodes:i,config:o,system:a}=n(),{disabledTabs:s}=o;!u2(i.nodeTemplates)&&!s.includes("nodes")&&t(I0()),a.isInitialized?t(gs.util.resetApiState()):t(G2e(!0)),t(R4(e.payload))}})},jTe=()=>{Me({actionCreator:MB,effect:(e,{dispatch:t})=>{be("socketio").debug("Disconnected"),t($B(e.payload))}})},UTe=()=>{Me({actionCreator:BB,effect:(e,{dispatch:t})=>{be("socketio").trace(e.payload,"Generator progress"),t(N4(e.payload))}})},VTe=()=>{Me({actionCreator:LB,effect:(e,{dispatch:t})=>{be("socketio").debug(e.payload,"Session complete"),t(FB(e.payload))}})},GTe=["load_image","image"],HTe=()=>{Me({actionCreator:M4,effect:async(e,{dispatch:t,getState:n})=>{const r=be("socketio"),{data:i}=e.payload;r.debug({data:Xt(i)},`Invocation complete (${e.payload.data.node.type})`);const{result:o,node:a,queue_batch_id:s}=i;if(vH(o)&&!GTe.includes(a.type)){const{image_name:l}=o.image,{canvas:u,gallery:c}=n(),d=await t(xe.endpoints.getImageDTO.initiate(l)).unwrap();if(u.batchIds.includes(s)&&[_e].includes(i.source_node_id)&&t(cue(d)),!d.is_intermediate){t(xe.util.updateQueryData("listImages",{board_id:d.board_id??"none",categories:ii},h=>{Vn.addOne(h,d)})),t(Lt.util.updateQueryData("getBoardImagesTotal",d.board_id??"none",h=>{h.total+=1})),t(xe.util.invalidateTags([{type:"Board",id:d.board_id??"none"}]));const{shouldAutoSwitch:f}=c;f&&(c.galleryView!=="images"&&t(zA("images")),d.board_id&&d.board_id!==c.selectedBoardId&&t(F_({boardId:d.board_id,selectedImageName:d.image_name})),!d.board_id&&c.selectedBoardId!=="none"&&t(F_({boardId:"none",selectedImageName:d.image_name})),t(Qs(d)))}}t($4(e.payload))}})},qTe=()=>{Me({actionCreator:DB,effect:(e,{dispatch:t})=>{be("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(c2(e.payload))}})},WTe=()=>{Me({actionCreator:qB,effect:(e,{dispatch:t})=>{be("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(WB(e.payload))}})},KTe=()=>{Me({actionCreator:NB,effect:(e,{dispatch:t})=>{be("socketio").debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(O4(e.payload))}})},QTe=()=>{Me({actionCreator:zB,effect:(e,{dispatch:t})=>{const n=be("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load started: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(jB(e.payload))}}),Me({actionCreator:UB,effect:(e,{dispatch:t})=>{const n=be("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load complete: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(VB(e.payload))}})},XTe=()=>{Me({actionCreator:KB,effect:async(e,{dispatch:t})=>{const n=be("socketio"),{queue_item:r,batch_status:i,queue_status:o}=e.payload.data;n.debug(e.payload,`Queue item ${r.item_id} status updated: ${r.status}`),t(Er.util.updateQueryData("listQueueItems",void 0,a=>{ed.updateOne(a,{id:r.item_id,changes:r})})),t(Er.util.updateQueryData("getQueueStatus",void 0,a=>{a&&Object.assign(a.queue,o)})),t(Er.util.updateQueryData("getBatchStatus",{batch_id:i.batch_id},()=>i)),t(Er.util.updateQueryData("getQueueItem",r.item_id,a=>{a&&Object.assign(a,r)})),t(Er.util.invalidateTags(["CurrentSessionQueueItem","NextSessionQueueItem","InvocationCacheStatus"])),t(d2(e.payload))}})},YTe=()=>{Me({actionCreator:GB,effect:(e,{dispatch:t})=>{be("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(HB(e.payload))}})},ZTe=()=>{Me({actionCreator:Xae,effect:(e,{dispatch:t})=>{be("socketio").debug(e.payload,"Subscribed"),t(Yae(e.payload))}})},JTe=()=>{Me({actionCreator:Zae,effect:(e,{dispatch:t})=>{be("socketio").debug(e.payload,"Unsubscribed"),t(Jae(e.payload))}})},e4e=()=>{Me({actionCreator:fwe,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(xe.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(xe.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Ht({title:Z("toast.imageSaved"),status:"success"}))}catch(i){t(Ht({title:Z("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},cQe=["sd-1","sd-2","sdxl","sdxl-refiner"],t4e=["sd-1","sd-2","sdxl"],dQe=["sdxl"],fQe=["sd-1","sd-2"],hQe=["sdxl-refiner"],n4e=()=>{Me({actionCreator:wG,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 a=n(Ts.endpoints.getMainModels.initiate(t4e)),s=await a.unwrap();if(a.unsubscribe(),!s.ids.length){n(ju(null));return}const u=N0.getSelectors().selectAll(s).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(ju(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(ju({base_model:c,model_name:d,model_type:f}))}catch{n(ju(null))}}}})},r4e=({image_name:e,esrganModelName:t,autoAddBoardId:n})=>{const r={id:_5,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!0},i={id:os,type:"save_image",use_cache:!1,is_intermediate:!1,board:n==="none"?void 0:{board_id:n}};return{id:"adhoc-esrgan-graph",nodes:{[_5]:r,[os]:i},edges:[{source:{node_id:_5,field:"image"},destination:{node_id:os,field:"image"}}]}},i4e=()=>Wz(),kH=Bz;function o4e(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function dM(e,t,n){e.loadNamespaces(t,PH(e,n))}function fM(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,PH(e,r))}function a4e(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=t.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}function s4e(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(SE("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):a4e(e,t,n)}const l4e=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,u4e={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},c4e=e=>u4e[e],d4e=e=>e.replace(l4e,c4e);let xE={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:d4e};function f4e(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xE={...xE,...e}}function h4e(){return xE}let IH;function p4e(e){IH=e}function g4e(){return IH}const m4e={type:"3rdParty",init(e){f4e(e.options.react),p4e(e)}},y4e=I.createContext();class v4e{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const b4e=(e,t)=>{const n=I.useRef();return I.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function _4e(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=I.useContext(y4e)||{},o=n||r||g4e();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new v4e),!o){SE("You will need to pass in an i18next instance by using initReactI18next");const g=(S,x)=>typeof x=="string"?x:x&&typeof x=="object"&&typeof x.defaultValue=="string"?x.defaultValue:Array.isArray(S)?S[S.length-1]:S,v=[g,{},!1];return v.t=g,v.i18n={},v.ready=!1,v}o.options.react&&o.options.react.wait!==void 0&&SE("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...h4e(),...o.options.react,...t},{useSuspense:s,keyPrefix:l}=a;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(g=>s4e(g,o,a));function d(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],l)}const[f,h]=I.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const m=b4e(p),_=I.useRef(!0);I.useEffect(()=>{const{bindI18n:g,bindI18nStore:v}=a;_.current=!0,!c&&!s&&(t.lng?fM(o,t.lng,u,()=>{_.current&&h(d)}):dM(o,u,()=>{_.current&&h(d)})),c&&m&&m!==p&&_.current&&h(d);function S(){_.current&&h(d)}return g&&o&&o.on(g,S),v&&o&&o.store.on(v,S),()=>{_.current=!1,g&&o&&g.split(" ").forEach(x=>o.off(x,S)),v&&o&&v.split(" ").forEach(x=>o.store.off(x,S))}},[o,p]);const b=I.useRef(!0);I.useEffect(()=>{_.current&&!b.current&&h(d),b.current=!1},[o,l]);const y=[f,o,c];if(y.t=f,y.i18n=o,y.ready=c,c||!c&&!s)return y;throw new Promise(g=>{t.lng?fM(o,t.lng,u,()=>g()):dM(o,u,()=>g())})}const S4e=(e,t)=>{if(!e||!t)return;const{width:n,height:r}=e,i=r*4*n*4,o=r*2*n*2;return{x4:i,x2:o}},x4e=(e,t)=>{if(!e||!t)return{x4:!0,x2:!0};const n={x4:!1,x2:!1};return e.x4<=t&&(n.x4=!0),e.x2<=t&&(n.x2=!0),n},w4e=(e,t)=>{if(!(!e||!t)&&!(e.x4&&e.x2)){if(!e.x2&&!e.x4)return"parameters.isAllowedToUpscale.tooLarge";if(!e.x4&&e.x2&&t===4)return"parameters.isAllowedToUpscale.useX2Model"}},RH=e=>Ii(EK,({postprocessing:t,config:n})=>{const{esrganModelName:r}=t,{maxUpscalePixels:i}=n,o=S4e(e,i),a=x4e(o,i),s=r.includes("x2")?2:4,l=w4e(a,s);return{isAllowedToUpscale:s===2?a.x2:a.x4,detailTKey:l}},gx),pQe=e=>{const{t}=_4e(),n=I.useMemo(()=>RH(e),[e]),{isAllowedToUpscale:r,detailTKey:i}=kH(n);return{isAllowedToUpscale:r,detail:i?t(i):void 0}},C4e=De("upscale/upscaleRequested"),A4e=()=>{Me({actionCreator:C4e,effect:async(e,{dispatch:t,getState:n})=>{var f;const r=be("session"),{imageDTO:i}=e.payload,{image_name:o}=i,a=n(),{isAllowedToUpscale:s,detailTKey:l}=RH(i)(a);if(!s){r.error({imageDTO:i},Z(l??"parameters.isAllowedToUpscale.tooLarge")),t(Ht({title:Z(l??"parameters.isAllowedToUpscale.tooLarge"),status:"error"}));return}const{esrganModelName:u}=a.postprocessing,{autoAddBoardId:c}=a.gallery,d=r4e({image_name:o,esrganModelName:u,autoAddBoardId:c});try{const h=t(Er.endpoints.enqueueGraph.initiate({graph:d,prepend:!0},{fixedCacheKey:"enqueueGraph"})),p=await h.unwrap();h.reset(),r.debug({enqueueResult:Xt(p)},Z("queue.graphQueued"))}catch(h){if(r.error({graph:Xt(d)},Z("queue.graphFailedToQueue")),h instanceof Object&&"data"in h&&"status"in h&&h.status===403){const p=((f=h.data)==null?void 0:f.detail)||"Unknown Error";t(Ht({title:Z("queue.graphFailedToQueue"),status:"error",description:p,duration:15e3}));return}t(Ht({title:Z("queue.graphFailedToQueue"),status:"error"}))}}})},E4e=sl(null),T4e=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,hM=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(T4e);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},pM=e=>e==="*"||e==="x"||e==="X",gM=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},k4e=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],P4e=(e,t)=>{if(pM(e)||pM(t))return 0;const[n,r]=k4e(gM(e),gM(t));return n>r?1:n{for(let n=0;n{const n=hM(e),r=hM(t),i=n.pop(),o=r.pop(),a=mM(n,r);return a!==0?a:i&&o?mM(i.split("."),o.split(".")):i||o?i?-1:1:0},R4e=(e,t)=>{const n=Ut(e),{nodes:r,edges:i}=n,o=[],a=r.filter(TA),s=I4(a,"id");return r.forEach(l=>{if(!TA(l))return;const u=t[l.data.type];if(!u){o.push({message:`${me.t("nodes.node")} "${l.data.type}" ${me.t("nodes.skipped")}`,issues:[`${me.t("nodes.nodeType")}"${l.data.type}" ${me.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&I4e(u.version,l.data.version)!==0){o.push({message:`${me.t("nodes.node")} "${l.data.type}" ${me.t("nodes.mismatchedVersion")}`,issues:[`${me.t("nodes.node")} "${l.data.type}" v${l.data.version} ${me.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:Xt(u)}});return}}),i.forEach((l,u)=>{const c=s[l.source],d=s[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${me.t("nodes.outputNode")} "${l.source}.${l.sourceHandle}" ${me.t("nodes.doesNotExist")}`):f.push(`${me.t("nodes.outputNode")} ${l.source} ${me.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${me.t("nodes.inputField")} "${l.target}.${l.targetHandle}" ${me.t("nodes.doesNotExist")}`):f.push(`${me.t("nodes.inputNode")} ${l.target} ${me.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${me.t("nodes.sourceNode")} "${l.source}" ${me.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${me.t("nodes.sourceNode")}"${l.target}" ${me.t("nodes.missingTemplate")} "${d==null?void 0:d.data.type}"`),f.length){delete i[u];const h=l.type==="default"?l.sourceHandle:l.source,p=l.type==="default"?l.targetHandle:l.target;o.push({message:`Edge "${h} -> ${p}" skipped`,issues:f,data:l})}}),{workflow:n,errors:o}},O4e=()=>{Me({actionCreator:Hxe,effect:(e,{dispatch:t,getState:n})=>{const r=be("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:a,errors:s}=R4e(i,o);t(D2e(a)),s.length?(t(Ht(Gd({title:Z("toast.loadedWithWarnings"),status:"warning"}))),s.forEach(({message:l,...u})=>{r.warn(u,l)})):t(Ht(Gd({title:Z("toast.workflowLoaded"),status:"success"}))),t(wG("nodes")),requestAnimationFrame(()=>{var l;(l=E4e.get())==null||l.fitView()})}})};function M4e(e){if(e.sheet)return e.sheet;for(var t=0;t0?Ti(Bp,--Do):0,gp--,Lr===10&&(gp=1,gw--),Lr}function Jo(){return Lr=Do2||L0(Lr)>3?"":" "}function q4e(e,t){for(;--t&&Jo()&&!(Lr<48||Lr>102||Lr>57&&Lr<65||Lr>70&&Lr<97););return Uy(e,ab()+(t<6&&Ys()==32&&Jo()==32))}function CE(e){for(;Jo();)switch(Lr){case e:return Do;case 34:case 39:e!==34&&e!==39&&CE(Lr);break;case 40:e===41&&CE(e);break;case 92:Jo();break}return Do}function W4e(e,t){for(;Jo()&&e+Lr!==47+10;)if(e+Lr===42+42&&Ys()===47)break;return"/*"+Uy(t,Do-1)+"*"+pw(e===47?e:Jo())}function K4e(e){for(;!L0(Ys());)Jo();return Uy(e,Do)}function Q4e(e){return LH(lb("",null,null,null,[""],e=DH(e),0,[0],e))}function lb(e,t,n,r,i,o,a,s,l){for(var u=0,c=0,d=a,f=0,h=0,p=0,m=1,_=1,b=1,y=0,g="",v=i,S=o,x=r,w=g;_;)switch(p=y,y=Jo()){case 40:if(p!=108&&Ti(w,d-1)==58){wE(w+=un(sb(y),"&","&\f"),"&\f")!=-1&&(b=-1);break}case 34:case 39:case 91:w+=sb(y);break;case 9:case 10:case 13:case 32:w+=H4e(p);break;case 92:w+=q4e(ab()-1,7);continue;case 47:switch(Ys()){case 42:case 47:l1(X4e(W4e(Jo(),ab()),t,n),l);break;default:w+="/"}break;case 123*m:s[u++]=Ms(w)*b;case 125*m:case 59:case 0:switch(y){case 0:case 125:_=0;case 59+c:b==-1&&(w=un(w,/\f/g,"")),h>0&&Ms(w)-d&&l1(h>32?vM(w+";",r,n,d-1):vM(un(w," ","")+";",r,n,d-2),l);break;case 59:w+=";";default:if(l1(x=yM(w,t,n,u,c,i,s,g,v=[],S=[],d),o),y===123)if(c===0)lb(w,t,x,x,v,o,d,s,S);else switch(f===99&&Ti(w,3)===110?100:f){case 100:case 108:case 109:case 115:lb(e,x,x,r&&l1(yM(e,x,x,0,0,i,s,g,i,v=[],d),S),i,S,d,s,r?v:S);break;default:lb(w,x,x,x,[""],S,0,s,S)}}u=c=h=0,m=b=1,g=w="",d=a;break;case 58:d=1+Ms(w),h=p;default:if(m<1){if(y==123)--m;else if(y==125&&m++==0&&G4e()==125)continue}switch(w+=pw(y),y*m){case 38:b=c>0?1:(w+="\f",-1);break;case 44:s[u++]=(Ms(w)-1)*b,b=1;break;case 64:Ys()===45&&(w+=sb(Jo())),f=Ys(),c=d=Ms(g=w+=K4e(ab())),y++;break;case 45:p===45&&Ms(w)==2&&(m=0)}}return o}function yM(e,t,n,r,i,o,a,s,l,u,c){for(var d=i-1,f=i===0?o:[""],h=lP(f),p=0,m=0,_=0;p0?f[b]+" "+y:un(y,/&\f/g,f[b])))&&(l[_++]=g);return mw(e,t,n,i===0?aP:s,l,u,c)}function X4e(e,t,n){return mw(e,t,n,OH,pw(V4e()),D0(e,2,-2),0)}function vM(e,t,n,r){return mw(e,t,n,sP,D0(e,0,r),D0(e,r+1,-1),r)}function Ih(e,t){for(var n="",r=lP(e),i=0;i6)switch(Ti(e,t+1)){case 109:if(Ti(e,t+4)!==45)break;case 102:return un(e,/(.+:)(.+)-([^]+)/,"$1"+ln+"$2-$3$1"+nS+(Ti(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~wE(e,"stretch")?BH(un(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ti(e,t+1)!==115)break;case 6444:switch(Ti(e,Ms(e)-3-(~wE(e,"!important")&&10))){case 107:return un(e,":",":"+ln)+e;case 101:return un(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ln+(Ti(e,14)===45?"inline-":"")+"box$3$1"+ln+"$2$3$1"+Bi+"$2box$3")+e}break;case 5936:switch(Ti(e,t+11)){case 114:return ln+e+Bi+un(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ln+e+Bi+un(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ln+e+Bi+un(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ln+e+Bi+e+e}return e}var oke=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case sP:t.return=BH(t.value,t.length);break;case MH:return Ih([mg(t,{value:un(t.value,"@","@"+ln)})],i);case aP:if(t.length)return U4e(t.props,function(o){switch(j4e(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Ih([mg(t,{props:[un(o,/:(read-\w+)/,":"+nS+"$1")]})],i);case"::placeholder":return Ih([mg(t,{props:[un(o,/:(plac\w+)/,":"+ln+"input-$1")]}),mg(t,{props:[un(o,/:(plac\w+)/,":"+nS+"$1")]}),mg(t,{props:[un(o,/:(plac\w+)/,Bi+"input-$1")]})],i)}return""})}},ake=[oke],ske=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(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||ake,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),b=1;b<_.length;b++)o[_[b]]=!0;s.push(m)});var l,u=[rke,ike];{var c,d=[Y4e,J4e(function(m){c.insert(m)})],f=Z4e(u.concat(i,d)),h=function(_){return Ih(Q4e(_),f)};l=function(_,b,y,g){c=y,h(_?_+"{"+b.styles+"}":b.styles),g&&(p.inserted[b.name]=!0)}}var p={key:n,sheet:new N4e({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(s),p},lke=!0;function uke(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var zH=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||lke===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},jH=function(t,n,r){zH(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function cke(e){for(var t=0,n,r=0,i=e.length;i>=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 dke={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},fke=/[A-Z]|^ms/g,hke=/_EMO_([^_]+?)_([^]*?)_EMO_/g,UH=function(t){return t.charCodeAt(1)===45},SM=function(t){return t!=null&&typeof t!="boolean"},x5=FH(function(e){return UH(e)?e:e.replace(fke,"-$&").toLowerCase()}),xM=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(hke,function(r,i,o){return $s={name:i,styles:o,next:$s},i})}return dke[t]!==1&&!UH(t)&&typeof n=="number"&&n!==0?n+"px":n};function F0(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 $s={name:n.name,styles:n.styles,next:$s},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)$s={name:r.name,styles:r.styles,next:$s},r=r.next;var i=n.styles+";";return i}return pke(e,t,n)}case"function":{if(e!==void 0){var o=$s,a=n(e);return $s=o,F0(e,t,a)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function pke(e,t,n){var r="";if(Array.isArray(n))for(var i=0;iW.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),Pke=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=I.useState(null),o=I.useRef(null),[,a]=I.useState({});I.useEffect(()=>a({}),[]);const s=Eke(),l=Cke();rS(()=>{if(!r)return;const c=r.ownerDocument,d=t?s??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=cP,d.appendChild(o.current),a({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?W.jsx(kke,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?Wo.createPortal(W.jsx(WH,{value:o.current,children:u}),o.current):W.jsx("span",{ref:c=>{c&&i(c)}})},Ike=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),a=I.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=cP),l},[i]),[,s]=I.useState({});return rS(()=>s({}),[]),rS(()=>{if(!(!a||!o))return o.appendChild(a),()=>{o.removeChild(a)}},[a,o]),o&&a?Wo.createPortal(W.jsx(WH,{value:r?a:null,children:t}),a):null};function yw(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?W.jsx(Ike,{containerRef:n,...r}):W.jsx(Pke,{...r})}yw.className=cP;yw.selector=Tke;yw.displayName="Portal";function KH(){const e=I.useContext(B0);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var dP=I.createContext({});dP.displayName="ColorModeContext";function vw(){const e=I.useContext(dP);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function gQe(e,t){const{colorMode:n}=vw();return n==="dark"?t:e}function Rke(){const e=vw(),t=KH();return{...e,theme:t}}function Oke(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function Mke(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function mQe(e,t,n){const r=KH();return $ke(e,t,n)(r)}function $ke(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const a=i.filter(Boolean),s=r.map((l,u)=>{var c,d;if(e==="breakpoints")return Oke(o,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return Mke(o,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Dc=(...e)=>e.filter(Boolean).join(" ");function Nke(){return!1}function Zs(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var yQe=e=>{const{condition:t,message:n}=e;t&&Nke()&&console.warn(n)};function Us(e,...t){return Dke(e)?e(...t):e}var Dke=e=>typeof e=="function",vQe=e=>e?"":void 0,bQe=e=>e?!0:void 0;function _Qe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function SQe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var iS={exports:{}};iS.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",b="[object Null]",y="[object Object]",g="[object Proxy]",v="[object RegExp]",S="[object Set]",x="[object String]",w="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",E="[object DataView]",k="[object Float32Array]",N="[object Float64Array]",O="[object Int8Array]",A="[object Int16Array]",P="[object Int32Array]",D="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",R="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,B=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,G={};G[k]=G[N]=G[O]=G[A]=G[P]=G[D]=G[L]=G[M]=G[R]=!0,G[s]=G[l]=G[T]=G[c]=G[E]=G[d]=G[f]=G[h]=G[m]=G[_]=G[y]=G[v]=G[S]=G[x]=G[C]=!1;var Y=typeof yt=="object"&&yt&&yt.Object===Object&&yt,ee=typeof self=="object"&&self&&self.Object===Object&&self,J=Y||ee||Function("return this")(),j=t&&!t.nodeType&&t,Q=j&&!0&&e&&!e.nodeType&&e,ne=Q&&Q.exports===j,se=ne&&Y.process,Se=function(){try{var F=Q&&Q.require&&Q.require("util").types;return F||se&&se.binding&&se.binding("util")}catch{}}(),ce=Se&&Se.isTypedArray;function bt(F,V,X){switch(X.length){case 0:return F.call(V);case 1:return F.call(V,X[0]);case 2:return F.call(V,X[0],X[1]);case 3:return F.call(V,X[0],X[1],X[2])}return F.apply(V,X)}function ot(F,V){for(var X=-1,pe=Array(F);++X-1}function ua(F,V){var X=this.__data__,pe=Ye(X,F);return pe<0?(++this.size,X.push([F,V])):X[pe][1]=V,this}Ur.prototype.clear=Va,Ur.prototype.delete=_s,Ur.prototype.get=yi,Ur.prototype.has=du,Ur.prototype.set=ua;function ni(F){var V=-1,X=F==null?0:F.length;for(this.clear();++V1?X[Ct-1]:void 0,Pn=Ct>2?X[2]:void 0;for(pn=F.length>3&&typeof pn=="function"?(Ct--,pn):void 0,Pn&&Mt(X[0],X[1],Pn)&&(pn=Ct<3?void 0:pn,Ct=1),V=Object(V);++pe-1&&F%1==0&&F0){if(++V>=i)return arguments[0]}else V=0;return F.apply(void 0,arguments)}}function pt(F){if(F!=null){try{return tn.call(F)}catch{}try{return F+""}catch{}}return""}function Ve(F,V){return F===V||F!==F&&V!==V}var Ae=_t(function(){return arguments}())?_t:function(F){return Pe(F)&&Ln.call(F,"callee")&&!Xi.call(F,"callee")},ue=Array.isArray;function Te(F){return F!=null&&et(F.length)&&!Ee(F)}function fe(F){return Pe(F)&&Te(F)}var ge=dl||Yi;function Ee(F){if(!Qe(F))return!1;var V=ht(F);return V==h||V==p||V==u||V==g}function et(F){return typeof F=="number"&&F>-1&&F%1==0&&F<=a}function Qe(F){var V=typeof F;return F!=null&&(V=="object"||V=="function")}function Pe(F){return F!=null&&typeof F=="object"}function Tt(F){if(!Pe(F)||ht(F)!=y)return!1;var V=Mi(F);if(V===null)return!0;var X=Ln.call(V,"constructor")&&V.constructor;return typeof X=="function"&&X instanceof X&&tn.call(X)==Jr}var jt=ce?ze(ce):Et;function Gt(F){return Ga(F,or(F))}function or(F){return Te(F)?Re(F,!0):dn(F)}var gr=it(function(F,V,X,pe){fn(F,V,X,pe)});function zn(F){return function(){return F}}function kn(F){return F}function Yi(){return!1}e.exports=gr})(iS,iS.exports);var Lke=iS.exports;const Vs=xc(Lke);var Fke=e=>/!(important)?$/.test(e),AM=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,Bke=(e,t)=>n=>{const r=String(t),i=Fke(r),o=AM(r),a=e?`${e}.${o}`:o;let s=Zs(n.__cssMap)&&a in n.__cssMap?n.__cssMap[a].varRef:t;return s=AM(s),i?`${s} !important`:s};function fP(e){const{scale:t,transform:n,compose:r}=e;return(o,a)=>{var s;const l=Bke(t,o)(a);let u=(s=n==null?void 0:n(l,a))!=null?s:l;return r&&(u=r(u,a)),u}}var u1=(...e)=>t=>e.reduce((n,r)=>r(n),t);function ha(e,t){return n=>{const r={property:n,scale:e};return r.transform=fP({scale:e,transform:t}),r}}var zke=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function jke(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:zke(t),transform:n?fP({scale:n,compose:r}):r}}var QH=["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 Uke(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...QH].join(" ")}function Vke(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...QH].join(" ")}var Gke={"--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(" ")},Hke={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 qke(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 Wke={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},AE={"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"},Kke=new Set(Object.values(AE)),EE=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Qke=e=>e.trim();function Xke(e,t){if(e==null||EE.has(e))return e;if(!(TE(e)||EE.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],a=i==null?void 0:i[2];if(!o||!a)return e;const s=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=a.split(",").map(Qke).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in AE?AE[l]:l;u.unshift(c);const d=u.map(f=>{if(Kke.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=TE(m)?m:m&&m.split(" "),b=`colors.${p}`,y=b in t.__cssMap?t.__cssMap[b].varRef:p;return _?[y,...Array.isArray(_)?_:[_]].join(" "):y});return`${s}(${d.join(", ")})`}var TE=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),Yke=(e,t)=>Xke(e,t??{});function Zke(e){return/^var\(--.+\)$/.test(e)}var Jke=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},As=e=>t=>`${e}(${t})`,Qt={filter(e){return e!=="auto"?e:Gke},backdropFilter(e){return e!=="auto"?e:Hke},ring(e){return qke(Qt.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?Uke():e==="auto-gpu"?Vke():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=Jke(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(Zke(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:Yke,blur:As("blur"),opacity:As("opacity"),brightness:As("brightness"),contrast:As("contrast"),dropShadow:As("drop-shadow"),grayscale:As("grayscale"),hueRotate:As("hue-rotate"),invert:As("invert"),saturate:As("saturate"),sepia:As("sepia"),bgImage(e){return e==null||TE(e)||EE.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=Wke[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},H={borderWidths:ha("borderWidths"),borderStyles:ha("borderStyles"),colors:ha("colors"),borders:ha("borders"),gradients:ha("gradients",Qt.gradient),radii:ha("radii",Qt.px),space:ha("space",u1(Qt.vh,Qt.px)),spaceT:ha("space",u1(Qt.vh,Qt.px)),degreeT(e){return{property:e,transform:Qt.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:fP({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:ha("sizes",u1(Qt.vh,Qt.px)),sizesT:ha("sizes",u1(Qt.vh,Qt.fraction)),shadows:ha("shadows"),logical:jke,blur:ha("blur",Qt.blur)},ub={background:H.colors("background"),backgroundColor:H.colors("backgroundColor"),backgroundImage:H.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Qt.bgClip},bgSize:H.prop("backgroundSize"),bgPosition:H.prop("backgroundPosition"),bg:H.colors("background"),bgColor:H.colors("backgroundColor"),bgPos:H.prop("backgroundPosition"),bgRepeat:H.prop("backgroundRepeat"),bgAttachment:H.prop("backgroundAttachment"),bgGradient:H.gradients("backgroundImage"),bgClip:{transform:Qt.bgClip}};Object.assign(ub,{bgImage:ub.backgroundImage,bgImg:ub.backgroundImage});var sn={border:H.borders("border"),borderWidth:H.borderWidths("borderWidth"),borderStyle:H.borderStyles("borderStyle"),borderColor:H.colors("borderColor"),borderRadius:H.radii("borderRadius"),borderTop:H.borders("borderTop"),borderBlockStart:H.borders("borderBlockStart"),borderTopLeftRadius:H.radii("borderTopLeftRadius"),borderStartStartRadius:H.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:H.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:H.radii("borderTopRightRadius"),borderStartEndRadius:H.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:H.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:H.borders("borderRight"),borderInlineEnd:H.borders("borderInlineEnd"),borderBottom:H.borders("borderBottom"),borderBlockEnd:H.borders("borderBlockEnd"),borderBottomLeftRadius:H.radii("borderBottomLeftRadius"),borderBottomRightRadius:H.radii("borderBottomRightRadius"),borderLeft:H.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:H.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:H.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:H.borders(["borderLeft","borderRight"]),borderInline:H.borders("borderInline"),borderY:H.borders(["borderTop","borderBottom"]),borderBlock:H.borders("borderBlock"),borderTopWidth:H.borderWidths("borderTopWidth"),borderBlockStartWidth:H.borderWidths("borderBlockStartWidth"),borderTopColor:H.colors("borderTopColor"),borderBlockStartColor:H.colors("borderBlockStartColor"),borderTopStyle:H.borderStyles("borderTopStyle"),borderBlockStartStyle:H.borderStyles("borderBlockStartStyle"),borderBottomWidth:H.borderWidths("borderBottomWidth"),borderBlockEndWidth:H.borderWidths("borderBlockEndWidth"),borderBottomColor:H.colors("borderBottomColor"),borderBlockEndColor:H.colors("borderBlockEndColor"),borderBottomStyle:H.borderStyles("borderBottomStyle"),borderBlockEndStyle:H.borderStyles("borderBlockEndStyle"),borderLeftWidth:H.borderWidths("borderLeftWidth"),borderInlineStartWidth:H.borderWidths("borderInlineStartWidth"),borderLeftColor:H.colors("borderLeftColor"),borderInlineStartColor:H.colors("borderInlineStartColor"),borderLeftStyle:H.borderStyles("borderLeftStyle"),borderInlineStartStyle:H.borderStyles("borderInlineStartStyle"),borderRightWidth:H.borderWidths("borderRightWidth"),borderInlineEndWidth:H.borderWidths("borderInlineEndWidth"),borderRightColor:H.colors("borderRightColor"),borderInlineEndColor:H.colors("borderInlineEndColor"),borderRightStyle:H.borderStyles("borderRightStyle"),borderInlineEndStyle:H.borderStyles("borderInlineEndStyle"),borderTopRadius:H.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:H.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:H.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:H.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(sn,{rounded:sn.borderRadius,roundedTop:sn.borderTopRadius,roundedTopLeft:sn.borderTopLeftRadius,roundedTopRight:sn.borderTopRightRadius,roundedTopStart:sn.borderStartStartRadius,roundedTopEnd:sn.borderStartEndRadius,roundedBottom:sn.borderBottomRadius,roundedBottomLeft:sn.borderBottomLeftRadius,roundedBottomRight:sn.borderBottomRightRadius,roundedBottomStart:sn.borderEndStartRadius,roundedBottomEnd:sn.borderEndEndRadius,roundedLeft:sn.borderLeftRadius,roundedRight:sn.borderRightRadius,roundedStart:sn.borderInlineStartRadius,roundedEnd:sn.borderInlineEndRadius,borderStart:sn.borderInlineStart,borderEnd:sn.borderInlineEnd,borderTopStartRadius:sn.borderStartStartRadius,borderTopEndRadius:sn.borderStartEndRadius,borderBottomStartRadius:sn.borderEndStartRadius,borderBottomEndRadius:sn.borderEndEndRadius,borderStartRadius:sn.borderInlineStartRadius,borderEndRadius:sn.borderInlineEndRadius,borderStartWidth:sn.borderInlineStartWidth,borderEndWidth:sn.borderInlineEndWidth,borderStartColor:sn.borderInlineStartColor,borderEndColor:sn.borderInlineEndColor,borderStartStyle:sn.borderInlineStartStyle,borderEndStyle:sn.borderInlineEndStyle});var ePe={color:H.colors("color"),textColor:H.colors("color"),fill:H.colors("fill"),stroke:H.colors("stroke")},kE={boxShadow:H.shadows("boxShadow"),mixBlendMode:!0,blendMode:H.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:H.prop("backgroundBlendMode"),opacity:!0};Object.assign(kE,{shadow:kE.boxShadow});var tPe={filter:{transform:Qt.filter},blur:H.blur("--chakra-blur"),brightness:H.propT("--chakra-brightness",Qt.brightness),contrast:H.propT("--chakra-contrast",Qt.contrast),hueRotate:H.degreeT("--chakra-hue-rotate"),invert:H.propT("--chakra-invert",Qt.invert),saturate:H.propT("--chakra-saturate",Qt.saturate),dropShadow:H.propT("--chakra-drop-shadow",Qt.dropShadow),backdropFilter:{transform:Qt.backdropFilter},backdropBlur:H.blur("--chakra-backdrop-blur"),backdropBrightness:H.propT("--chakra-backdrop-brightness",Qt.brightness),backdropContrast:H.propT("--chakra-backdrop-contrast",Qt.contrast),backdropHueRotate:H.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:H.propT("--chakra-backdrop-invert",Qt.invert),backdropSaturate:H.propT("--chakra-backdrop-saturate",Qt.saturate)},oS={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Qt.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:H.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:H.space("gap"),rowGap:H.space("rowGap"),columnGap:H.space("columnGap")};Object.assign(oS,{flexDir:oS.flexDirection});var XH={gridGap:H.space("gridGap"),gridColumnGap:H.space("gridColumnGap"),gridRowGap:H.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},nPe={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Qt.outline},outlineOffset:!0,outlineColor:H.colors("outlineColor")},ma={width:H.sizesT("width"),inlineSize:H.sizesT("inlineSize"),height:H.sizes("height"),blockSize:H.sizes("blockSize"),boxSize:H.sizes(["width","height"]),minWidth:H.sizes("minWidth"),minInlineSize:H.sizes("minInlineSize"),minHeight:H.sizes("minHeight"),minBlockSize:H.sizes("minBlockSize"),maxWidth:H.sizes("maxWidth"),maxInlineSize:H.sizes("maxInlineSize"),maxHeight:H.sizes("maxHeight"),maxBlockSize:H.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:H.propT("float",Qt.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(ma,{w:ma.width,h:ma.height,minW:ma.minWidth,maxW:ma.maxWidth,minH:ma.minHeight,maxH:ma.maxHeight,overscroll:ma.overscrollBehavior,overscrollX:ma.overscrollBehaviorX,overscrollY:ma.overscrollBehaviorY});var rPe={listStyleType:!0,listStylePosition:!0,listStylePos:H.prop("listStylePosition"),listStyleImage:!0,listStyleImg:H.prop("listStyleImage")};function iPe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},aPe=oPe(iPe),sPe={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},lPe={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},w5=(e,t,n)=>{const r={},i=aPe(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},uPe={srOnly:{transform(e){return e===!0?sPe:e==="focusable"?lPe:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>w5(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>w5(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>w5(t,e,n)}},lm={position:!0,pos:H.prop("position"),zIndex:H.prop("zIndex","zIndices"),inset:H.spaceT("inset"),insetX:H.spaceT(["left","right"]),insetInline:H.spaceT("insetInline"),insetY:H.spaceT(["top","bottom"]),insetBlock:H.spaceT("insetBlock"),top:H.spaceT("top"),insetBlockStart:H.spaceT("insetBlockStart"),bottom:H.spaceT("bottom"),insetBlockEnd:H.spaceT("insetBlockEnd"),left:H.spaceT("left"),insetInlineStart:H.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:H.spaceT("right"),insetInlineEnd:H.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(lm,{insetStart:lm.insetInlineStart,insetEnd:lm.insetInlineEnd});var cPe={ring:{transform:Qt.ring},ringColor:H.colors("--chakra-ring-color"),ringOffset:H.prop("--chakra-ring-offset-width"),ringOffsetColor:H.colors("--chakra-ring-offset-color"),ringInset:H.prop("--chakra-ring-inset")},Un={margin:H.spaceT("margin"),marginTop:H.spaceT("marginTop"),marginBlockStart:H.spaceT("marginBlockStart"),marginRight:H.spaceT("marginRight"),marginInlineEnd:H.spaceT("marginInlineEnd"),marginBottom:H.spaceT("marginBottom"),marginBlockEnd:H.spaceT("marginBlockEnd"),marginLeft:H.spaceT("marginLeft"),marginInlineStart:H.spaceT("marginInlineStart"),marginX:H.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:H.spaceT("marginInline"),marginY:H.spaceT(["marginTop","marginBottom"]),marginBlock:H.spaceT("marginBlock"),padding:H.space("padding"),paddingTop:H.space("paddingTop"),paddingBlockStart:H.space("paddingBlockStart"),paddingRight:H.space("paddingRight"),paddingBottom:H.space("paddingBottom"),paddingBlockEnd:H.space("paddingBlockEnd"),paddingLeft:H.space("paddingLeft"),paddingInlineStart:H.space("paddingInlineStart"),paddingInlineEnd:H.space("paddingInlineEnd"),paddingX:H.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:H.space("paddingInline"),paddingY:H.space(["paddingTop","paddingBottom"]),paddingBlock:H.space("paddingBlock")};Object.assign(Un,{m:Un.margin,mt:Un.marginTop,mr:Un.marginRight,me:Un.marginInlineEnd,marginEnd:Un.marginInlineEnd,mb:Un.marginBottom,ml:Un.marginLeft,ms:Un.marginInlineStart,marginStart:Un.marginInlineStart,mx:Un.marginX,my:Un.marginY,p:Un.padding,pt:Un.paddingTop,py:Un.paddingY,px:Un.paddingX,pb:Un.paddingBottom,pl:Un.paddingLeft,ps:Un.paddingInlineStart,paddingStart:Un.paddingInlineStart,pr:Un.paddingRight,pe:Un.paddingInlineEnd,paddingEnd:Un.paddingInlineEnd});var dPe={textDecorationColor:H.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:H.shadows("textShadow")},fPe={clipPath:!0,transform:H.propT("transform",Qt.transform),transformOrigin:!0,translateX:H.spaceT("--chakra-translate-x"),translateY:H.spaceT("--chakra-translate-y"),skewX:H.degreeT("--chakra-skew-x"),skewY:H.degreeT("--chakra-skew-y"),scaleX:H.prop("--chakra-scale-x"),scaleY:H.prop("--chakra-scale-y"),scale:H.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:H.degreeT("--chakra-rotate")},hPe={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:H.prop("transitionDuration","transition.duration"),transitionProperty:H.prop("transitionProperty","transition.property"),transitionTimingFunction:H.prop("transitionTimingFunction","transition.easing")},pPe={fontFamily:H.prop("fontFamily","fonts"),fontSize:H.prop("fontSize","fontSizes",Qt.px),fontWeight:H.prop("fontWeight","fontWeights"),lineHeight:H.prop("lineHeight","lineHeights"),letterSpacing:H.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"}},gPe={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:H.spaceT("scrollMargin"),scrollMarginTop:H.spaceT("scrollMarginTop"),scrollMarginBottom:H.spaceT("scrollMarginBottom"),scrollMarginLeft:H.spaceT("scrollMarginLeft"),scrollMarginRight:H.spaceT("scrollMarginRight"),scrollMarginX:H.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:H.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:H.spaceT("scrollPadding"),scrollPaddingTop:H.spaceT("scrollPaddingTop"),scrollPaddingBottom:H.spaceT("scrollPaddingBottom"),scrollPaddingLeft:H.spaceT("scrollPaddingLeft"),scrollPaddingRight:H.spaceT("scrollPaddingRight"),scrollPaddingX:H.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:H.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function YH(e){return Zs(e)&&e.reference?e.reference:String(e)}var bw=(e,...t)=>t.map(YH).join(` ${e} `).replace(/calc/g,""),EM=(...e)=>`calc(${bw("+",...e)})`,TM=(...e)=>`calc(${bw("-",...e)})`,PE=(...e)=>`calc(${bw("*",...e)})`,kM=(...e)=>`calc(${bw("/",...e)})`,PM=e=>{const t=YH(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:PE(t,-1)},rd=Object.assign(e=>({add:(...t)=>rd(EM(e,...t)),subtract:(...t)=>rd(TM(e,...t)),multiply:(...t)=>rd(PE(e,...t)),divide:(...t)=>rd(kM(e,...t)),negate:()=>rd(PM(e)),toString:()=>e.toString()}),{add:EM,subtract:TM,multiply:PE,divide:kM,negate:PM});function mPe(e,t="-"){return e.replace(/\s+/g,t)}function yPe(e){const t=mPe(e.toString());return bPe(vPe(t))}function vPe(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function bPe(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function _Pe(e,t=""){return[t,e].filter(Boolean).join("-")}function SPe(e,t){return`var(${e}${t?`, ${t}`:""})`}function xPe(e,t=""){return yPe(`--${_Pe(e,t)}`)}function nt(e,t,n){const r=xPe(e,n);return{variable:r,reference:SPe(r,t)}}function wPe(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=nt(`${e}-${i}`,o);continue}n[r]=nt(`${e}-${r}`)}return n}function CPe(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function APe(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function IE(e){if(e==null)return e;const{unitless:t}=APe(e);return t||typeof e=="number"?`${e}px`:e}var ZH=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,hP=e=>Object.fromEntries(Object.entries(e).sort(ZH));function IM(e){const t=hP(e);return Object.assign(Object.values(t),t)}function EPe(e){const t=Object.keys(hP(e));return new Set(t)}function RM(e){var t;if(!e)return e;e=(t=IE(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function Lg(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${IE(e)})`),t&&n.push("and",`(max-width: ${IE(t)})`),n.join(" ")}function TPe(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=IM(e),r=Object.entries(e).sort(ZH).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?RM(d):void 0,{_minW:RM(s),breakpoint:a,minW:s,maxW:d,maxWQuery:Lg(null,d),minWQuery:Lg(s),minMaxQuery:Lg(s,d)}}),i=EPe(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>i.has(l))},asObject:hP(e),asArray:IM(e),details:r,get(a){return r.find(s=>s.breakpoint===a)},media:[null,...n.map(a=>Lg(a)).slice(1)],toArrayValue(a){if(!Zs(a))throw new Error("toArrayValue: value must be an object");const s=o.map(l=>{var u;return(u=a[l])!=null?u:null});for(;CPe(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=o[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var Si={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}`},bu=e=>JH(t=>e(t,"&"),"[role=group]","[data-group]",".group"),vl=e=>JH(t=>e(t,"~ &"),"[data-peer]",".peer"),JH=(e,...t)=>t.map(e).join(", "),_w={_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:bu(Si.hover),_peerHover:vl(Si.hover),_groupFocus:bu(Si.focus),_peerFocus:vl(Si.focus),_groupFocusVisible:bu(Si.focusVisible),_peerFocusVisible:vl(Si.focusVisible),_groupActive:bu(Si.active),_peerActive:vl(Si.active),_groupDisabled:bu(Si.disabled),_peerDisabled:vl(Si.disabled),_groupInvalid:bu(Si.invalid),_peerInvalid:vl(Si.invalid),_groupChecked:bu(Si.checked),_peerChecked:vl(Si.checked),_groupFocusWithin:bu(Si.focusWithin),_peerFocusWithin:vl(Si.focusWithin),_peerPlaceholderShown:vl(Si.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]"},eq=Object.keys(_w);function OM(e,t){return nt(String(e).replace(/\./g,"-"),void 0,t)}function kPe(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:a,value:s}=o,{variable:l,reference:u}=OM(i,t==null?void 0:t.cssVarPrefix);if(!a){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=rd.negate(s),b=rd.negate(u);r[m]={value:_,var:l,varRef:b}}n[l]=s,r[i]={value:s,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=OM(p,t==null?void 0:t.cssVarPrefix);return _},d=Zs(s)?s:{default:s};n=Vs(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const b=c(`${p}`);if(h==="default")return f[l]=b,f;const y=(_=(m=_w)==null?void 0:m[h])!=null?_:h;return f[y]={[l]:b},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function PPe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function IPe(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function RPe(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function MM(e,t,n={}){const{stop:r,getKey:i}=n;function o(a,s=[]){var l;if(RPe(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...s,f];if(r!=null&&r(a,h))return t(a,s);u[f]=o(d,h)}return u}return t(a,s)}return o(e)}var OPe=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function MPe(e){return IPe(e,OPe)}function $Pe(e){return e.semanticTokens}function NPe(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var DPe=e=>eq.includes(e)||e==="default";function LPe({tokens:e,semanticTokens:t}){const n={};return MM(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),MM(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(DPe)}),n}function FPe(e){var t;const n=NPe(e),r=MPe(n),i=$Pe(n),o=LPe({tokens:r,semanticTokens:i}),a=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=kPe(o,{cssVarPrefix:a});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:s,__breakpoints:TPe(n.breakpoints)}),n}var pP=Vs({},ub,sn,ePe,oS,ma,tPe,cPe,nPe,XH,uPe,lm,kE,Un,gPe,pPe,dPe,fPe,rPe,hPe),BPe=Object.assign({},Un,ma,oS,XH,lm),xQe=Object.keys(BPe),zPe=[...Object.keys(pP),...eq],jPe={...pP,..._w},UPe=e=>e in jPe,VPe=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const a in e){let s=Us(e[a],t);if(s==null)continue;if(s=Zs(s)&&n(s)?r(s):s,!Array.isArray(s)){o[a]=s;continue}const l=s.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!HPe(t),WPe=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[a,s]=GPe(t);return t=(r=(n=i(a))!=null?n:o(s))!=null?r:o(t),t};function KPe(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,a=!1)=>{var s,l,u;const c=Us(o,r),d=VPe(c)(r);let f={};for(let h in d){const p=d[h];let m=Us(p,r);h in n&&(h=n[h]),qPe(h,m)&&(m=WPe(r,m));let _=t[h];if(_===!0&&(_={property:h}),Zs(m)){f[h]=(s=f[h])!=null?s:{},f[h]=Vs({},f[h],i(m,!0));continue}let b=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;b=_!=null&&_.processResult?i(b,!0):b;const y=Us(_==null?void 0:_.property,r);if(!a&&(_!=null&&_.static)){const g=Us(_.static,r);f=Vs({},f,g)}if(y&&Array.isArray(y)){for(const g of y)f[g]=b;continue}if(y){y==="&"&&Zs(b)?f=Vs({},f,b):f[y]=b;continue}if(Zs(b)){f=Vs({},f,b);continue}f[h]=b}return f};return i}var tq=e=>t=>KPe({theme:t,pseudos:_w,configs:pP})(e);function Pt(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function QPe(e,t){if(Array.isArray(e))return e;if(Zs(e))return t(e);if(e!=null)return[e]}function XPe(e,t){for(let n=t+1;n{Vs(u,{[g]:f?y[g]:{[b]:y[g]}})});continue}if(!h){f?Vs(u,y):u[b]=y;continue}u[b]=y}}return u}}function ZPe(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,a=YPe(o);return Vs({},Us((n=e.baseStyle)!=null?n:{},t),a(e,"sizes",i,t),a(e,"variants",r,t))}}function wQe(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 Gy(e){return PPe(e,["styleConfig","size","variant","colorScheme"])}var JPe={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},e6e={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},t6e={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},n6e={property:JPe,easing:e6e,duration:t6e},r6e=n6e,i6e={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},o6e=i6e,a6e={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},s6e=a6e,l6e={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},u6e=l6e,c6e={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},d6e=c6e,f6e={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},h6e=f6e,p6e={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},g6e=p6e,m6e={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},y6e=m6e,v6e={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},nq=v6e,rq={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},b6e={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},_6e={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},S6e={...rq,...b6e,container:_6e},iq=S6e,x6e={breakpoints:u6e,zIndices:o6e,radii:h6e,blur:y6e,colors:d6e,...nq,sizes:iq,shadows:g6e,space:rq,borders:s6e,transition:r6e},{defineMultiStyleConfig:w6e,definePartsStyle:Fg}=Pt(["stepper","step","title","description","indicator","separator","icon","number"]),Rl=nt("stepper-indicator-size"),Xf=nt("stepper-icon-size"),Yf=nt("stepper-title-font-size"),Bg=nt("stepper-description-font-size"),yg=nt("stepper-accent-color"),C6e=Fg(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[yg.variable]:`colors.${e}.500`,_dark:{[yg.variable]:`colors.${e}.200`}},title:{fontSize:Yf.reference,fontWeight:"medium"},description:{fontSize:Bg.reference,color:"chakra-subtle-text"},number:{fontSize:Yf.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:Xf.reference,height:Xf.reference},indicator:{flexShrink:0,borderRadius:"full",width:Rl.reference,height:Rl.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:yg.reference},"&[data-status=complete]":{bg:yg.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:yg.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${Rl.reference} - 8px)`,top:`calc(${Rl.reference} + 4px)`,insetStart:`calc(${Rl.reference} / 2 - 1px)`}}})),A6e=w6e({baseStyle:C6e,sizes:{xs:Fg({stepper:{[Rl.variable]:"sizes.4",[Xf.variable]:"sizes.3",[Yf.variable]:"fontSizes.xs",[Bg.variable]:"fontSizes.xs"}}),sm:Fg({stepper:{[Rl.variable]:"sizes.6",[Xf.variable]:"sizes.4",[Yf.variable]:"fontSizes.sm",[Bg.variable]:"fontSizes.xs"}}),md:Fg({stepper:{[Rl.variable]:"sizes.8",[Xf.variable]:"sizes.5",[Yf.variable]:"fontSizes.md",[Bg.variable]:"fontSizes.sm"}}),lg:Fg({stepper:{[Rl.variable]:"sizes.10",[Xf.variable]:"sizes.6",[Yf.variable]:"fontSizes.lg",[Bg.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function gn(e,t={}){let n=!1;function r(){if(!n){n=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...c){r();for(const d of c)t[d]=l(d);return gn(e,t)}function o(...c){for(const d of c)d in t||(t[d]=l(d));return gn(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const h=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:h,selector:`.${h}`,toString:()=>c}}return{parts:i,toPart:l,extend:o,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var oq=gn("accordion").parts("root","container","button","panel").extend("icon"),E6e=gn("alert").parts("title","description","container").extend("icon","spinner"),T6e=gn("avatar").parts("label","badge","container").extend("excessLabel","group"),k6e=gn("breadcrumb").parts("link","item","container").extend("separator");gn("button").parts();var aq=gn("checkbox").parts("control","icon","container").extend("label");gn("progress").parts("track","filledTrack").extend("label");var P6e=gn("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),sq=gn("editable").parts("preview","input","textarea"),I6e=gn("form").parts("container","requiredIndicator","helperText"),R6e=gn("formError").parts("text","icon"),lq=gn("input").parts("addon","field","element","group"),O6e=gn("list").parts("container","item","icon"),uq=gn("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),cq=gn("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),dq=gn("numberinput").parts("root","field","stepperGroup","stepper");gn("pininput").parts("field");var fq=gn("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),hq=gn("progress").parts("label","filledTrack","track"),M6e=gn("radio").parts("container","control","label"),pq=gn("select").parts("field","icon"),gq=gn("slider").parts("container","track","thumb","filledTrack","mark"),$6e=gn("stat").parts("container","label","helpText","number","icon"),mq=gn("switch").parts("container","track","thumb"),N6e=gn("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),yq=gn("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),D6e=gn("tag").parts("container","label","closeButton"),L6e=gn("card").parts("container","header","body","footer");function gd(e,t,n){return Math.min(Math.max(e,n),t)}class F6e extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var zg=F6e;function gP(e){if(typeof e!="string")throw new zg(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=q6e.test(e)?j6e(e):e;const n=U6e.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(z0(s,2),16)),parseInt(z0(a[3]||"f",2),16)/255]}const r=V6e.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const i=G6e.exec(t);if(i){const a=Array.from(i).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const o=H6e.exec(t);if(o){const[a,s,l,u]=Array.from(o).slice(1).map(parseFloat);if(gd(0,100,s)!==s)throw new zg(e);if(gd(0,100,l)!==l)throw new zg(e);return[...W6e(a,s,l),Number.isNaN(u)?1:u]}throw new zg(e)}function B6e(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const $M=e=>parseInt(e.replace(/_/g,""),36),z6e="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=$M(t.substring(0,3)),r=$M(t.substring(3)).toString(16);let i="";for(let o=0;o<6-r.length;o++)i+="0";return e[n]=`${i}${r}`,e},{});function j6e(e){const t=e.toLowerCase().trim(),n=z6e[B6e(t)];if(!n)throw new zg(e);return`#${n}`}const z0=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),U6e=new RegExp(`^#${z0("([a-f0-9])",3)}([a-f0-9])?$`,"i"),V6e=new RegExp(`^#${z0("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),G6e=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${z0(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),H6e=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,q6e=/^[a-z]+$/i,NM=e=>Math.round(e*255),W6e=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(NM);const i=(e%360+360)%360/60,o=(1-Math.abs(2*r-1))*(t/100),a=o*(1-Math.abs(i%2-1));let s=0,l=0,u=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);const c=r-o/2,d=s+c,f=l+c,h=u+c;return[d,f,h].map(NM)};function K6e(e,t,n,r){return`rgba(${gd(0,255,e).toFixed()}, ${gd(0,255,t).toFixed()}, ${gd(0,255,n).toFixed()}, ${parseFloat(gd(0,1,r).toFixed(3))})`}function Q6e(e,t){const[n,r,i,o]=gP(e);return K6e(n,r,i,o-t)}function X6e(e){const[t,n,r,i]=gP(e);let o=a=>{const s=gd(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${o(t)}${o(n)}${o(r)}${i<1?o(Math.round(i*255)):""}`}function Y6e(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rObject.keys(e).length===0,ao=(e,t,n)=>{const r=Y6e(e,`colors.${t}`,t);try{return X6e(r),r}catch{return n??"#000000"}},J6e=e=>{const[t,n,r]=gP(e);return(t*299+n*587+r*114)/1e3},e8e=e=>t=>{const n=ao(t,e);return J6e(n)<128?"dark":"light"},t8e=e=>t=>e8e(e)(t)==="dark",mp=(e,t)=>n=>{const r=ao(n,e);return Q6e(r,1-t)};function DM(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( 45deg, ${t} 25%, transparent 25%, transparent 50%, ${t} 50%, ${t} 75%, transparent 75%, transparent )`,backgroundSize:`${e} ${e}`}}var n8e=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function r8e(e){const t=n8e();return!e||Z6e(e)?t:e.string&&e.colors?o8e(e.string,e.colors):e.string&&!e.colors?i8e(e.string):e.colors&&!e.string?a8e(e.colors):t}function i8e(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r>r*8&255;n+=`00${i.toString(16)}`.substr(-2)}return n}function o8e(e,t){let n=0;if(e.length===0)return t[0];for(let r=0;rn.colorMode==="dark"?t:e}function mP(e){const{orientation:t,vertical:n,horizontal:r}=e;return t?t==="vertical"?n:r:{}}function vq(e){return Zs(e)&&e.reference?e.reference:String(e)}var Sw=(e,...t)=>t.map(vq).join(` ${e} `).replace(/calc/g,""),LM=(...e)=>`calc(${Sw("+",...e)})`,FM=(...e)=>`calc(${Sw("-",...e)})`,RE=(...e)=>`calc(${Sw("*",...e)})`,BM=(...e)=>`calc(${Sw("/",...e)})`,zM=e=>{const t=vq(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:RE(t,-1)},Ol=Object.assign(e=>({add:(...t)=>Ol(LM(e,...t)),subtract:(...t)=>Ol(FM(e,...t)),multiply:(...t)=>Ol(RE(e,...t)),divide:(...t)=>Ol(BM(e,...t)),negate:()=>Ol(zM(e)),toString:()=>e.toString()}),{add:LM,subtract:FM,multiply:RE,divide:BM,negate:zM});function s8e(e){return!Number.isInteger(parseFloat(e.toString()))}function l8e(e,t="-"){return e.replace(/\s+/g,t)}function bq(e){const t=l8e(e.toString());return t.includes("\\.")?e:s8e(e)?t.replace(".","\\."):e}function u8e(e,t=""){return[t,bq(e)].filter(Boolean).join("-")}function c8e(e,t){return`var(${bq(e)}${t?`, ${t}`:""})`}function d8e(e,t=""){return`--${u8e(e,t)}`}function hr(e,t){const n=d8e(e,t==null?void 0:t.prefix);return{variable:n,reference:c8e(n,f8e(t==null?void 0:t.fallback))}}function f8e(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:h8e,definePartsStyle:cb}=Pt(mq.keys),um=hr("switch-track-width"),Ed=hr("switch-track-height"),C5=hr("switch-track-diff"),p8e=Ol.subtract(um,Ed),OE=hr("switch-thumb-x"),vg=hr("switch-bg"),g8e=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[um.reference],height:[Ed.reference],transitionProperty:"common",transitionDuration:"fast",[vg.variable]:"colors.gray.300",_dark:{[vg.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[vg.variable]:`colors.${t}.500`,_dark:{[vg.variable]:`colors.${t}.200`}},bg:vg.reference}},m8e={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[Ed.reference],height:[Ed.reference],_checked:{transform:`translateX(${OE.reference})`}},y8e=cb(e=>({container:{[C5.variable]:p8e,[OE.variable]:C5.reference,_rtl:{[OE.variable]:Ol(C5).negate().toString()}},track:g8e(e),thumb:m8e})),v8e={sm:cb({container:{[um.variable]:"1.375rem",[Ed.variable]:"sizes.3"}}),md:cb({container:{[um.variable]:"1.875rem",[Ed.variable]:"sizes.4"}}),lg:cb({container:{[um.variable]:"2.875rem",[Ed.variable]:"sizes.6"}})},b8e=h8e({baseStyle:y8e,sizes:v8e,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:_8e,definePartsStyle:Rh}=Pt(N6e.keys),S8e=Rh({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),aS={"&[data-is-numeric=true]":{textAlign:"end"}},x8e=Rh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...aS},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...aS},caption:{color:K("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),w8e=Rh(e=>{const{colorScheme:t}=e;return{th:{color:K("gray.600","gray.400")(e),borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...aS},td:{borderBottom:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e),...aS},caption:{color:K("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:K(`${t}.100`,`${t}.700`)(e)},td:{background:K(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),C8e={simple:x8e,striped:w8e,unstyled:{}},A8e={sm:Rh({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:Rh({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:Rh({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},E8e=_8e({baseStyle:S8e,variants:C8e,sizes:A8e,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),Co=nt("tabs-color"),rs=nt("tabs-bg"),c1=nt("tabs-border-color"),{defineMultiStyleConfig:T8e,definePartsStyle:Js}=Pt(yq.keys),k8e=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},P8e=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},I8e=e=>{const{align:t="start",orientation:n}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:n==="vertical"?"column":"row"}},R8e={p:4},O8e=Js(e=>({root:k8e(e),tab:P8e(e),tablist:I8e(e),tabpanel:R8e})),M8e={sm:Js({tab:{py:1,px:4,fontSize:"sm"}}),md:Js({tab:{fontSize:"md",py:2,px:4}}),lg:Js({tab:{fontSize:"lg",py:3,px:4}})},$8e=Js(e=>{const{colorScheme:t,orientation:n}=e,r=n==="vertical",i=r?"borderStart":"borderBottom",o=r?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[o]:"-2px",_selected:{[Co.variable]:`colors.${t}.600`,_dark:{[Co.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[rs.variable]:"colors.gray.200",_dark:{[rs.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:Co.reference,bg:rs.reference}}}),N8e=Js(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[c1.variable]:"transparent",_selected:{[Co.variable]:`colors.${t}.600`,[c1.variable]:"colors.white",_dark:{[Co.variable]:`colors.${t}.300`,[c1.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:c1.reference},color:Co.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),D8e=Js(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[rs.variable]:"colors.gray.50",_dark:{[rs.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[rs.variable]:"colors.white",[Co.variable]:`colors.${t}.600`,_dark:{[rs.variable]:"colors.gray.800",[Co.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:Co.reference,bg:rs.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),L8e=Js(e=>{const{colorScheme:t,theme:n}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:ao(n,`${t}.700`),bg:ao(n,`${t}.100`)}}}}),F8e=Js(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[Co.variable]:"colors.gray.600",_dark:{[Co.variable]:"inherit"},_selected:{[Co.variable]:"colors.white",[rs.variable]:`colors.${t}.600`,_dark:{[Co.variable]:"colors.gray.800",[rs.variable]:`colors.${t}.300`}},color:Co.reference,bg:rs.reference}}}),B8e=Js({}),z8e={line:$8e,enclosed:N8e,"enclosed-colored":D8e,"soft-rounded":L8e,"solid-rounded":F8e,unstyled:B8e},j8e=T8e({baseStyle:O8e,sizes:M8e,variants:z8e,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),Tr=wPe("badge",["bg","color","shadow"]),U8e={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:Tr.bg.reference,color:Tr.color.reference,boxShadow:Tr.shadow.reference},V8e=e=>{const{colorScheme:t,theme:n}=e,r=mp(`${t}.500`,.6)(n);return{[Tr.bg.variable]:`colors.${t}.500`,[Tr.color.variable]:"colors.white",_dark:{[Tr.bg.variable]:r,[Tr.color.variable]:"colors.whiteAlpha.800"}}},G8e=e=>{const{colorScheme:t,theme:n}=e,r=mp(`${t}.200`,.16)(n);return{[Tr.bg.variable]:`colors.${t}.100`,[Tr.color.variable]:`colors.${t}.800`,_dark:{[Tr.bg.variable]:r,[Tr.color.variable]:`colors.${t}.200`}}},H8e=e=>{const{colorScheme:t,theme:n}=e,r=mp(`${t}.200`,.8)(n);return{[Tr.color.variable]:`colors.${t}.500`,_dark:{[Tr.color.variable]:r},[Tr.shadow.variable]:`inset 0 0 0px 1px ${Tr.color.reference}`}},q8e={solid:V8e,subtle:G8e,outline:H8e},cm={baseStyle:U8e,variants:q8e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:W8e,definePartsStyle:Td}=Pt(D6e.keys),jM=nt("tag-bg"),UM=nt("tag-color"),A5=nt("tag-shadow"),db=nt("tag-min-height"),fb=nt("tag-min-width"),hb=nt("tag-font-size"),pb=nt("tag-padding-inline"),K8e={fontWeight:"medium",lineHeight:1.2,outline:0,[UM.variable]:Tr.color.reference,[jM.variable]:Tr.bg.reference,[A5.variable]:Tr.shadow.reference,color:UM.reference,bg:jM.reference,boxShadow:A5.reference,borderRadius:"md",minH:db.reference,minW:fb.reference,fontSize:hb.reference,px:pb.reference,_focusVisible:{[A5.variable]:"shadows.outline"}},Q8e={lineHeight:1.2,overflow:"visible"},X8e={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},Y8e=Td({container:K8e,label:Q8e,closeButton:X8e}),Z8e={sm:Td({container:{[db.variable]:"sizes.5",[fb.variable]:"sizes.5",[hb.variable]:"fontSizes.xs",[pb.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:Td({container:{[db.variable]:"sizes.6",[fb.variable]:"sizes.6",[hb.variable]:"fontSizes.sm",[pb.variable]:"space.2"}}),lg:Td({container:{[db.variable]:"sizes.8",[fb.variable]:"sizes.8",[hb.variable]:"fontSizes.md",[pb.variable]:"space.3"}})},J8e={subtle:Td(e=>{var t;return{container:(t=cm.variants)==null?void 0:t.subtle(e)}}),solid:Td(e=>{var t;return{container:(t=cm.variants)==null?void 0:t.solid(e)}}),outline:Td(e=>{var t;return{container:(t=cm.variants)==null?void 0:t.outline(e)}})},eIe=W8e({variants:J8e,baseStyle:Y8e,sizes:Z8e,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Dl,defineMultiStyleConfig:tIe}=Pt(lq.keys),Zf=nt("input-height"),Jf=nt("input-font-size"),eh=nt("input-padding"),th=nt("input-border-radius"),nIe=Dl({addon:{height:Zf.reference,fontSize:Jf.reference,px:eh.reference,borderRadius:th.reference},field:{width:"100%",height:Zf.reference,fontSize:Jf.reference,px:eh.reference,borderRadius:th.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),_u={lg:{[Jf.variable]:"fontSizes.lg",[eh.variable]:"space.4",[th.variable]:"radii.md",[Zf.variable]:"sizes.12"},md:{[Jf.variable]:"fontSizes.md",[eh.variable]:"space.4",[th.variable]:"radii.md",[Zf.variable]:"sizes.10"},sm:{[Jf.variable]:"fontSizes.sm",[eh.variable]:"space.3",[th.variable]:"radii.sm",[Zf.variable]:"sizes.8"},xs:{[Jf.variable]:"fontSizes.xs",[eh.variable]:"space.2",[th.variable]:"radii.sm",[Zf.variable]:"sizes.6"}},rIe={lg:Dl({field:_u.lg,group:_u.lg}),md:Dl({field:_u.md,group:_u.md}),sm:Dl({field:_u.sm,group:_u.sm}),xs:Dl({field:_u.xs,group:_u.xs})};function yP(e){const{focusBorderColor:t,errorBorderColor:n}=e;return{focusBorderColor:t||K("blue.500","blue.300")(e),errorBorderColor:n||K("red.500","red.300")(e)}}var iIe=Dl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=yP(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:K("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:ao(t,r),boxShadow:`0 0 0 1px ${ao(t,r)}`},_focusVisible:{zIndex:1,borderColor:ao(t,n),boxShadow:`0 0 0 1px ${ao(t,n)}`}},addon:{border:"1px solid",borderColor:K("inherit","whiteAlpha.50")(e),bg:K("gray.100","whiteAlpha.300")(e)}}}),oIe=Dl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=yP(e);return{field:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e),_hover:{bg:K("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:ao(t,r)},_focusVisible:{bg:"transparent",borderColor:ao(t,n)}},addon:{border:"2px solid",borderColor:"transparent",bg:K("gray.100","whiteAlpha.50")(e)}}}),aIe=Dl(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=yP(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:ao(t,r),boxShadow:`0px 1px 0px 0px ${ao(t,r)}`},_focusVisible:{borderColor:ao(t,n),boxShadow:`0px 1px 0px 0px ${ao(t,n)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),sIe=Dl({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),lIe={outline:iIe,filled:oIe,flushed:aIe,unstyled:sIe},cn=tIe({baseStyle:nIe,sizes:rIe,variants:lIe,defaultProps:{size:"md",variant:"outline"}}),VM,uIe={...(VM=cn.baseStyle)==null?void 0:VM.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},GM,HM,cIe={outline:e=>{var t,n;return(n=(t=cn.variants)==null?void 0:t.outline(e).field)!=null?n:{}},flushed:e=>{var t,n;return(n=(t=cn.variants)==null?void 0:t.flushed(e).field)!=null?n:{}},filled:e=>{var t,n;return(n=(t=cn.variants)==null?void 0:t.filled(e).field)!=null?n:{}},unstyled:(HM=(GM=cn.variants)==null?void 0:GM.unstyled.field)!=null?HM:{}},qM,WM,KM,QM,XM,YM,ZM,JM,dIe={xs:(WM=(qM=cn.sizes)==null?void 0:qM.xs.field)!=null?WM:{},sm:(QM=(KM=cn.sizes)==null?void 0:KM.sm.field)!=null?QM:{},md:(YM=(XM=cn.sizes)==null?void 0:XM.md.field)!=null?YM:{},lg:(JM=(ZM=cn.sizes)==null?void 0:ZM.lg.field)!=null?JM:{}},fIe={baseStyle:uIe,sizes:dIe,variants:cIe,defaultProps:{size:"md",variant:"outline"}},d1=hr("tooltip-bg"),E5=hr("tooltip-fg"),hIe=hr("popper-arrow-bg"),pIe={bg:d1.reference,color:E5.reference,[d1.variable]:"colors.gray.700",[E5.variable]:"colors.whiteAlpha.900",_dark:{[d1.variable]:"colors.gray.300",[E5.variable]:"colors.gray.900"},[hIe.variable]:d1.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},gIe={baseStyle:pIe},{defineMultiStyleConfig:mIe,definePartsStyle:jg}=Pt(hq.keys),yIe=e=>{const{colorScheme:t,theme:n,isIndeterminate:r,hasStripe:i}=e,o=K(DM(),DM("1rem","rgba(0,0,0,0.1)"))(e),a=K(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( to right, transparent 0%, ${ao(n,a)} 50%, transparent 100% )`;return{...!r&&i&&o,...r?{bgImage:s}:{bgColor:a}}},vIe={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},bIe=e=>({bg:K("gray.100","whiteAlpha.300")(e)}),_Ie=e=>({transitionProperty:"common",transitionDuration:"slow",...yIe(e)}),SIe=jg(e=>({label:vIe,filledTrack:_Ie(e),track:bIe(e)})),xIe={xs:jg({track:{h:"1"}}),sm:jg({track:{h:"2"}}),md:jg({track:{h:"3"}}),lg:jg({track:{h:"4"}})},wIe=mIe({sizes:xIe,baseStyle:SIe,defaultProps:{size:"md",colorScheme:"blue"}}),CIe=e=>typeof e=="function";function lo(e,...t){return CIe(e)?e(...t):e}var{definePartsStyle:gb,defineMultiStyleConfig:AIe}=Pt(aq.keys),dm=nt("checkbox-size"),EIe=e=>{const{colorScheme:t}=e;return{w:dm.reference,h:dm.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e),_hover:{bg:K(`${t}.600`,`${t}.300`)(e),borderColor:K(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:K("gray.200","transparent")(e),bg:K("gray.200","whiteAlpha.300")(e),color:K("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:K(`${t}.500`,`${t}.200`)(e),borderColor:K(`${t}.500`,`${t}.200`)(e),color:K("white","gray.900")(e)},_disabled:{bg:K("gray.100","whiteAlpha.100")(e),borderColor:K("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:K("red.500","red.300")(e)}}},TIe={_disabled:{cursor:"not-allowed"}},kIe={userSelect:"none",_disabled:{opacity:.4}},PIe={transitionProperty:"transform",transitionDuration:"normal"},IIe=gb(e=>({icon:PIe,container:TIe,control:lo(EIe,e),label:kIe})),RIe={sm:gb({control:{[dm.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:gb({control:{[dm.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:gb({control:{[dm.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},sS=AIe({baseStyle:IIe,sizes:RIe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:OIe,definePartsStyle:mb}=Pt(M6e.keys),MIe=e=>{var t;const n=(t=lo(sS.baseStyle,e))==null?void 0:t.control;return{...n,borderRadius:"full",_checked:{...n==null?void 0:n._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},$Ie=mb(e=>{var t,n,r,i;return{label:(n=(t=sS).baseStyle)==null?void 0:n.call(t,e).label,container:(i=(r=sS).baseStyle)==null?void 0:i.call(r,e).container,control:MIe(e)}}),NIe={md:mb({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:mb({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:mb({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},DIe=OIe({baseStyle:$Ie,sizes:NIe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:LIe,definePartsStyle:FIe}=Pt(pq.keys),f1=nt("select-bg"),e7,BIe={...(e7=cn.baseStyle)==null?void 0:e7.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:f1.reference,[f1.variable]:"colors.white",_dark:{[f1.variable]:"colors.gray.700"},"> option, > optgroup":{bg:f1.reference}},zIe={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},jIe=FIe({field:BIe,icon:zIe}),h1={paddingInlineEnd:"8"},t7,n7,r7,i7,o7,a7,s7,l7,UIe={lg:{...(t7=cn.sizes)==null?void 0:t7.lg,field:{...(n7=cn.sizes)==null?void 0:n7.lg.field,...h1}},md:{...(r7=cn.sizes)==null?void 0:r7.md,field:{...(i7=cn.sizes)==null?void 0:i7.md.field,...h1}},sm:{...(o7=cn.sizes)==null?void 0:o7.sm,field:{...(a7=cn.sizes)==null?void 0:a7.sm.field,...h1}},xs:{...(s7=cn.sizes)==null?void 0:s7.xs,field:{...(l7=cn.sizes)==null?void 0:l7.xs.field,...h1},icon:{insetEnd:"1"}}},VIe=LIe({baseStyle:jIe,sizes:UIe,variants:cn.variants,defaultProps:cn.defaultProps}),T5=nt("skeleton-start-color"),k5=nt("skeleton-end-color"),GIe={[T5.variable]:"colors.gray.100",[k5.variable]:"colors.gray.400",_dark:{[T5.variable]:"colors.gray.800",[k5.variable]:"colors.gray.600"},background:T5.reference,borderColor:k5.reference,opacity:.7,borderRadius:"sm"},HIe={baseStyle:GIe},P5=nt("skip-link-bg"),qIe={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[P5.variable]:"colors.white",_dark:{[P5.variable]:"colors.gray.700"},bg:P5.reference}},WIe={baseStyle:qIe},{defineMultiStyleConfig:KIe,definePartsStyle:xw}=Pt(gq.keys),j0=nt("slider-thumb-size"),U0=nt("slider-track-size"),Nu=nt("slider-bg"),QIe=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...mP({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},XIe=e=>({...mP({orientation:e.orientation,horizontal:{h:U0.reference},vertical:{w:U0.reference}}),overflow:"hidden",borderRadius:"sm",[Nu.variable]:"colors.gray.200",_dark:{[Nu.variable]:"colors.whiteAlpha.200"},_disabled:{[Nu.variable]:"colors.gray.300",_dark:{[Nu.variable]:"colors.whiteAlpha.300"}},bg:Nu.reference}),YIe=e=>{const{orientation:t}=e;return{...mP({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:j0.reference,h:j0.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},ZIe=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[Nu.variable]:`colors.${t}.500`,_dark:{[Nu.variable]:`colors.${t}.200`},bg:Nu.reference}},JIe=xw(e=>({container:QIe(e),track:XIe(e),thumb:YIe(e),filledTrack:ZIe(e)})),eRe=xw({container:{[j0.variable]:"sizes.4",[U0.variable]:"sizes.1"}}),tRe=xw({container:{[j0.variable]:"sizes.3.5",[U0.variable]:"sizes.1"}}),nRe=xw({container:{[j0.variable]:"sizes.2.5",[U0.variable]:"sizes.0.5"}}),rRe={lg:eRe,md:tRe,sm:nRe},iRe=KIe({baseStyle:JIe,sizes:rRe,defaultProps:{size:"md",colorScheme:"blue"}}),id=hr("spinner-size"),oRe={width:[id.reference],height:[id.reference]},aRe={xs:{[id.variable]:"sizes.3"},sm:{[id.variable]:"sizes.4"},md:{[id.variable]:"sizes.6"},lg:{[id.variable]:"sizes.8"},xl:{[id.variable]:"sizes.12"}},sRe={baseStyle:oRe,sizes:aRe,defaultProps:{size:"md"}},{defineMultiStyleConfig:lRe,definePartsStyle:_q}=Pt($6e.keys),uRe={fontWeight:"medium"},cRe={opacity:.8,marginBottom:"2"},dRe={verticalAlign:"baseline",fontWeight:"semibold"},fRe={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},hRe=_q({container:{},label:uRe,helpText:cRe,number:dRe,icon:fRe}),pRe={md:_q({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},gRe=lRe({baseStyle:hRe,sizes:pRe,defaultProps:{size:"md"}}),I5=nt("kbd-bg"),mRe={[I5.variable]:"colors.gray.100",_dark:{[I5.variable]:"colors.whiteAlpha.100"},bg:I5.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},yRe={baseStyle:mRe},vRe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},bRe={baseStyle:vRe},{defineMultiStyleConfig:_Re,definePartsStyle:SRe}=Pt(O6e.keys),xRe={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},wRe=SRe({icon:xRe}),CRe=_Re({baseStyle:wRe}),{defineMultiStyleConfig:ARe,definePartsStyle:ERe}=Pt(uq.keys),Is=nt("menu-bg"),R5=nt("menu-shadow"),TRe={[Is.variable]:"#fff",[R5.variable]:"shadows.sm",_dark:{[Is.variable]:"colors.gray.700",[R5.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:Is.reference,boxShadow:R5.reference},kRe={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[Is.variable]:"colors.gray.100",_dark:{[Is.variable]:"colors.whiteAlpha.100"}},_active:{[Is.variable]:"colors.gray.200",_dark:{[Is.variable]:"colors.whiteAlpha.200"}},_expanded:{[Is.variable]:"colors.gray.100",_dark:{[Is.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:Is.reference},PRe={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},IRe={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},RRe={opacity:.6},ORe={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},MRe={transitionProperty:"common",transitionDuration:"normal"},$Re=ERe({button:MRe,list:TRe,item:kRe,groupTitle:PRe,icon:IRe,command:RRe,divider:ORe}),NRe=ARe({baseStyle:$Re}),{defineMultiStyleConfig:DRe,definePartsStyle:ME}=Pt(cq.keys),O5=nt("modal-bg"),M5=nt("modal-shadow"),LRe={bg:"blackAlpha.600",zIndex:"modal"},FRe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:n==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},BRe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:n==="inside"?"calc(100% - 7.5rem)":void 0,[O5.variable]:"colors.white",[M5.variable]:"shadows.lg",_dark:{[O5.variable]:"colors.gray.700",[M5.variable]:"shadows.dark-lg"},bg:O5.reference,boxShadow:M5.reference}},zRe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},jRe={position:"absolute",top:"2",insetEnd:"3"},URe=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},VRe={px:"6",py:"4"},GRe=ME(e=>({overlay:LRe,dialogContainer:lo(FRe,e),dialog:lo(BRe,e),header:zRe,closeButton:jRe,body:lo(URe,e),footer:VRe}));function qa(e){return ME(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var HRe={xs:qa("xs"),sm:qa("sm"),md:qa("md"),lg:qa("lg"),xl:qa("xl"),"2xl":qa("2xl"),"3xl":qa("3xl"),"4xl":qa("4xl"),"5xl":qa("5xl"),"6xl":qa("6xl"),full:qa("full")},qRe=DRe({baseStyle:GRe,sizes:HRe,defaultProps:{size:"md"}}),{defineMultiStyleConfig:WRe,definePartsStyle:Sq}=Pt(dq.keys),vP=hr("number-input-stepper-width"),xq=hr("number-input-input-padding"),KRe=Ol(vP).add("0.5rem").toString(),$5=hr("number-input-bg"),N5=hr("number-input-color"),D5=hr("number-input-border-color"),QRe={[vP.variable]:"sizes.6",[xq.variable]:KRe},XRe=e=>{var t,n;return(n=(t=lo(cn.baseStyle,e))==null?void 0:t.field)!=null?n:{}},YRe={width:vP.reference},ZRe={borderStart:"1px solid",borderStartColor:D5.reference,color:N5.reference,bg:$5.reference,[N5.variable]:"colors.chakra-body-text",[D5.variable]:"colors.chakra-border-color",_dark:{[N5.variable]:"colors.whiteAlpha.800",[D5.variable]:"colors.whiteAlpha.300"},_active:{[$5.variable]:"colors.gray.200",_dark:{[$5.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},JRe=Sq(e=>{var t;return{root:QRe,field:(t=lo(XRe,e))!=null?t:{},stepperGroup:YRe,stepper:ZRe}});function p1(e){var t,n,r;const i=(t=cn.sizes)==null?void 0:t[e],o={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(r=(n=i.field)==null?void 0:n.fontSize)!=null?r:"md",s=nq.fontSizes[a];return Sq({field:{...i.field,paddingInlineEnd:xq.reference,verticalAlign:"top"},stepper:{fontSize:Ol(s).multiply(.75).toString(),_first:{borderTopEndRadius:o[e]},_last:{borderBottomEndRadius:o[e],mt:"-1px",borderTopWidth:1}}})}var e9e={xs:p1("xs"),sm:p1("sm"),md:p1("md"),lg:p1("lg")},t9e=WRe({baseStyle:JRe,sizes:e9e,variants:cn.variants,defaultProps:cn.defaultProps}),u7,n9e={...(u7=cn.baseStyle)==null?void 0:u7.field,textAlign:"center"},r9e={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},c7,d7,i9e={outline:e=>{var t,n,r;return(r=(n=lo((t=cn.variants)==null?void 0:t.outline,e))==null?void 0:n.field)!=null?r:{}},flushed:e=>{var t,n,r;return(r=(n=lo((t=cn.variants)==null?void 0:t.flushed,e))==null?void 0:n.field)!=null?r:{}},filled:e=>{var t,n,r;return(r=(n=lo((t=cn.variants)==null?void 0:t.filled,e))==null?void 0:n.field)!=null?r:{}},unstyled:(d7=(c7=cn.variants)==null?void 0:c7.unstyled.field)!=null?d7:{}},o9e={baseStyle:n9e,sizes:r9e,variants:i9e,defaultProps:cn.defaultProps},{defineMultiStyleConfig:a9e,definePartsStyle:s9e}=Pt(fq.keys),g1=hr("popper-bg"),l9e=hr("popper-arrow-bg"),f7=hr("popper-arrow-shadow-color"),u9e={zIndex:10},c9e={[g1.variable]:"colors.white",bg:g1.reference,[l9e.variable]:g1.reference,[f7.variable]:"colors.gray.200",_dark:{[g1.variable]:"colors.gray.700",[f7.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},d9e={px:3,py:2,borderBottomWidth:"1px"},f9e={px:3,py:2},h9e={px:3,py:2,borderTopWidth:"1px"},p9e={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},g9e=s9e({popper:u9e,content:c9e,header:d9e,body:f9e,footer:h9e,closeButton:p9e}),m9e=a9e({baseStyle:g9e}),{definePartsStyle:$E,defineMultiStyleConfig:y9e}=Pt(P6e.keys),L5=nt("drawer-bg"),F5=nt("drawer-box-shadow");function kf(e){return $E(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var v9e={bg:"blackAlpha.600",zIndex:"overlay"},b9e={display:"flex",zIndex:"modal",justifyContent:"center"},_9e=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[L5.variable]:"colors.white",[F5.variable]:"shadows.lg",_dark:{[L5.variable]:"colors.gray.700",[F5.variable]:"shadows.dark-lg"},bg:L5.reference,boxShadow:F5.reference}},S9e={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},x9e={position:"absolute",top:"2",insetEnd:"3"},w9e={px:"6",py:"2",flex:"1",overflow:"auto"},C9e={px:"6",py:"4"},A9e=$E(e=>({overlay:v9e,dialogContainer:b9e,dialog:lo(_9e,e),header:S9e,closeButton:x9e,body:w9e,footer:C9e})),E9e={xs:kf("xs"),sm:kf("md"),md:kf("lg"),lg:kf("2xl"),xl:kf("4xl"),full:kf("full")},T9e=y9e({baseStyle:A9e,sizes:E9e,defaultProps:{size:"xs"}}),{definePartsStyle:k9e,defineMultiStyleConfig:P9e}=Pt(sq.keys),I9e={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},R9e={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},O9e={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},M9e=k9e({preview:I9e,input:R9e,textarea:O9e}),$9e=P9e({baseStyle:M9e}),{definePartsStyle:N9e,defineMultiStyleConfig:D9e}=Pt(I6e.keys),Oh=nt("form-control-color"),L9e={marginStart:"1",[Oh.variable]:"colors.red.500",_dark:{[Oh.variable]:"colors.red.300"},color:Oh.reference},F9e={mt:"2",[Oh.variable]:"colors.gray.600",_dark:{[Oh.variable]:"colors.whiteAlpha.600"},color:Oh.reference,lineHeight:"normal",fontSize:"sm"},B9e=N9e({container:{width:"100%",position:"relative"},requiredIndicator:L9e,helperText:F9e}),z9e=D9e({baseStyle:B9e}),{definePartsStyle:j9e,defineMultiStyleConfig:U9e}=Pt(R6e.keys),Mh=nt("form-error-color"),V9e={[Mh.variable]:"colors.red.500",_dark:{[Mh.variable]:"colors.red.300"},color:Mh.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},G9e={marginEnd:"0.5em",[Mh.variable]:"colors.red.500",_dark:{[Mh.variable]:"colors.red.300"},color:Mh.reference},H9e=j9e({text:V9e,icon:G9e}),q9e=U9e({baseStyle:H9e}),W9e={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},K9e={baseStyle:W9e},Q9e={fontFamily:"heading",fontWeight:"bold"},X9e={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},Y9e={baseStyle:Q9e,sizes:X9e,defaultProps:{size:"xl"}},{defineMultiStyleConfig:Z9e,definePartsStyle:J9e}=Pt(k6e.keys),B5=nt("breadcrumb-link-decor"),eOe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:B5.reference,[B5.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[B5.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},tOe=J9e({link:eOe}),nOe=Z9e({baseStyle:tOe}),rOe={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},wq=e=>{const{colorScheme:t,theme:n}=e;if(t==="gray")return{color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.100","whiteAlpha.200")(e)},_active:{bg:K("gray.200","whiteAlpha.300")(e)}};const r=mp(`${t}.200`,.12)(n),i=mp(`${t}.200`,.24)(n);return{color:K(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:K(`${t}.50`,r)(e)},_active:{bg:K(`${t}.100`,i)(e)}}},iOe=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...lo(wq,e)}},oOe={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},aOe=e=>{var t;const{colorScheme:n}=e;if(n==="gray"){const l=K("gray.100","whiteAlpha.200")(e);return{bg:l,color:K("gray.800","whiteAlpha.900")(e),_hover:{bg:K("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:K("gray.300","whiteAlpha.400")(e)}}}const{bg:r=`${n}.500`,color:i="white",hoverBg:o=`${n}.600`,activeBg:a=`${n}.700`}=(t=oOe[n])!=null?t:{},s=K(r,`${n}.200`)(e);return{bg:s,color:K(i,"gray.800")(e),_hover:{bg:K(o,`${n}.300`)(e),_disabled:{bg:s}},_active:{bg:K(a,`${n}.400`)(e)}}},sOe=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:K(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:K(`${t}.700`,`${t}.500`)(e)}}},lOe={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},uOe={ghost:wq,outline:iOe,solid:aOe,link:sOe,unstyled:lOe},cOe={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},dOe={baseStyle:rOe,variants:uOe,sizes:cOe,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:kd,defineMultiStyleConfig:fOe}=Pt(L6e.keys),lS=nt("card-bg"),jl=nt("card-padding"),Cq=nt("card-shadow"),yb=nt("card-radius"),Aq=nt("card-border-width","0"),Eq=nt("card-border-color"),hOe=kd({container:{[lS.variable]:"colors.chakra-body-bg",backgroundColor:lS.reference,boxShadow:Cq.reference,borderRadius:yb.reference,color:"chakra-body-text",borderWidth:Aq.reference,borderColor:Eq.reference},body:{padding:jl.reference,flex:"1 1 0%"},header:{padding:jl.reference},footer:{padding:jl.reference}}),pOe={sm:kd({container:{[yb.variable]:"radii.base",[jl.variable]:"space.3"}}),md:kd({container:{[yb.variable]:"radii.md",[jl.variable]:"space.5"}}),lg:kd({container:{[yb.variable]:"radii.xl",[jl.variable]:"space.7"}})},gOe={elevated:kd({container:{[Cq.variable]:"shadows.base",_dark:{[lS.variable]:"colors.gray.700"}}}),outline:kd({container:{[Aq.variable]:"1px",[Eq.variable]:"colors.chakra-border-color"}}),filled:kd({container:{[lS.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[jl.variable]:0},header:{[jl.variable]:0},footer:{[jl.variable]:0}}},mOe=fOe({baseStyle:hOe,variants:gOe,sizes:pOe,defaultProps:{variant:"elevated",size:"md"}}),fm=hr("close-button-size"),bg=hr("close-button-bg"),yOe={w:[fm.reference],h:[fm.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[bg.variable]:"colors.blackAlpha.100",_dark:{[bg.variable]:"colors.whiteAlpha.100"}},_active:{[bg.variable]:"colors.blackAlpha.200",_dark:{[bg.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:bg.reference},vOe={lg:{[fm.variable]:"sizes.10",fontSize:"md"},md:{[fm.variable]:"sizes.8",fontSize:"xs"},sm:{[fm.variable]:"sizes.6",fontSize:"2xs"}},bOe={baseStyle:yOe,sizes:vOe,defaultProps:{size:"md"}},{variants:_Oe,defaultProps:SOe}=cm,xOe={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:Tr.bg.reference,color:Tr.color.reference,boxShadow:Tr.shadow.reference},wOe={baseStyle:xOe,variants:_Oe,defaultProps:SOe},COe={w:"100%",mx:"auto",maxW:"prose",px:"4"},AOe={baseStyle:COe},EOe={opacity:.6,borderColor:"inherit"},TOe={borderStyle:"solid"},kOe={borderStyle:"dashed"},POe={solid:TOe,dashed:kOe},IOe={baseStyle:EOe,variants:POe,defaultProps:{variant:"solid"}},{definePartsStyle:ROe,defineMultiStyleConfig:OOe}=Pt(oq.keys),MOe={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},$Oe={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},NOe={pt:"2",px:"4",pb:"5"},DOe={fontSize:"1.25em"},LOe=ROe({container:MOe,button:$Oe,panel:NOe,icon:DOe}),FOe=OOe({baseStyle:LOe}),{definePartsStyle:Hy,defineMultiStyleConfig:BOe}=Pt(E6e.keys),ea=nt("alert-fg"),eu=nt("alert-bg"),zOe=Hy({container:{bg:eu.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:ea.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:ea.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function bP(e){const{theme:t,colorScheme:n}=e,r=mp(`${n}.200`,.16)(t);return{light:`colors.${n}.100`,dark:r}}var jOe=Hy(e=>{const{colorScheme:t}=e,n=bP(e);return{container:{[ea.variable]:`colors.${t}.500`,[eu.variable]:n.light,_dark:{[ea.variable]:`colors.${t}.200`,[eu.variable]:n.dark}}}}),UOe=Hy(e=>{const{colorScheme:t}=e,n=bP(e);return{container:{[ea.variable]:`colors.${t}.500`,[eu.variable]:n.light,_dark:{[ea.variable]:`colors.${t}.200`,[eu.variable]:n.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:ea.reference}}}),VOe=Hy(e=>{const{colorScheme:t}=e,n=bP(e);return{container:{[ea.variable]:`colors.${t}.500`,[eu.variable]:n.light,_dark:{[ea.variable]:`colors.${t}.200`,[eu.variable]:n.dark},pt:"2",borderTopWidth:"4px",borderTopColor:ea.reference}}}),GOe=Hy(e=>{const{colorScheme:t}=e;return{container:{[ea.variable]:"colors.white",[eu.variable]:`colors.${t}.500`,_dark:{[ea.variable]:"colors.gray.900",[eu.variable]:`colors.${t}.200`},color:ea.reference}}}),HOe={subtle:jOe,"left-accent":UOe,"top-accent":VOe,solid:GOe},qOe=BOe({baseStyle:zOe,variants:HOe,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:Tq,defineMultiStyleConfig:WOe}=Pt(T6e.keys),$h=nt("avatar-border-color"),hm=nt("avatar-bg"),V0=nt("avatar-font-size"),yp=nt("avatar-size"),KOe={borderRadius:"full",border:"0.2em solid",borderColor:$h.reference,[$h.variable]:"white",_dark:{[$h.variable]:"colors.gray.800"}},QOe={bg:hm.reference,fontSize:V0.reference,width:yp.reference,height:yp.reference,lineHeight:"1",[hm.variable]:"colors.gray.200",_dark:{[hm.variable]:"colors.whiteAlpha.400"}},XOe=e=>{const{name:t,theme:n}=e,r=t?r8e({string:t}):"colors.gray.400",i=t8e(r)(n);let o="white";return i||(o="gray.800"),{bg:hm.reference,fontSize:V0.reference,color:o,borderColor:$h.reference,verticalAlign:"top",width:yp.reference,height:yp.reference,"&:not([data-loaded])":{[hm.variable]:r},[$h.variable]:"colors.white",_dark:{[$h.variable]:"colors.gray.800"}}},YOe={fontSize:V0.reference,lineHeight:"1"},ZOe=Tq(e=>({badge:lo(KOe,e),excessLabel:lo(QOe,e),container:lo(XOe,e),label:YOe}));function Su(e){const t=e!=="100%"?iq[e]:void 0;return Tq({container:{[yp.variable]:t??e,[V0.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[yp.variable]:t??e,[V0.variable]:`calc(${t??e} / 2.5)`}})}var JOe={"2xs":Su(4),xs:Su(6),sm:Su(8),md:Su(12),lg:Su(16),xl:Su(24),"2xl":Su(32),full:Su("100%")},eMe=WOe({baseStyle:ZOe,sizes:JOe,defaultProps:{size:"md"}}),tMe={Accordion:FOe,Alert:qOe,Avatar:eMe,Badge:cm,Breadcrumb:nOe,Button:dOe,Checkbox:sS,CloseButton:bOe,Code:wOe,Container:AOe,Divider:IOe,Drawer:T9e,Editable:$9e,Form:z9e,FormError:q9e,FormLabel:K9e,Heading:Y9e,Input:cn,Kbd:yRe,Link:bRe,List:CRe,Menu:NRe,Modal:qRe,NumberInput:t9e,PinInput:o9e,Popover:m9e,Progress:wIe,Radio:DIe,Select:VIe,Skeleton:HIe,SkipLink:WIe,Slider:iRe,Spinner:sRe,Stat:gRe,Switch:b8e,Table:E8e,Tabs:j8e,Tag:eIe,Textarea:fIe,Tooltip:gIe,Card:mOe,Stepper:A6e},nMe={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},rMe={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},iMe="ltr",oMe={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},aMe={semanticTokens:nMe,direction:iMe,...x6e,components:tMe,styles:rMe,config:oMe},sMe=aMe;function lMe(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function uMe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},kq=cMe(uMe);function Pq(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var Iq=e=>Pq(e,t=>t!=null);function dMe(e){return typeof e=="function"}function Rq(e,...t){return dMe(e)?e(...t):e}function CQe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var fMe=typeof Element<"u",hMe=typeof Map=="function",pMe=typeof Set=="function",gMe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function vb(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(!vb(e[r],t[r]))return!1;return!0}var o;if(hMe&&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(!vb(r.value[1],t.get(r.value[0])))return!1;return!0}if(pMe&&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(gMe&&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(fMe&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!vb(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var mMe=function(t,n){try{return vb(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 yMe=xc(mMe);function Oq(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:a}=Rke(),s=e?kq(o,`components.${e}`):void 0,l=r||s,u=Vs({theme:o,colorMode:a},(n=l==null?void 0:l.defaultProps)!=null?n:{},Iq(lMe(i,["children"]))),c=I.useRef({});if(l){const f=ZPe(l)(u);yMe(c.current,f)||(c.current=f)}return c.current}function qy(e,t={}){return Oq(e,t)}function vMe(e,t={}){return Oq(e,t)}var bMe=new Set([...zPe,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),_Me=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function SMe(e){return _Me.has(e)||!bMe.has(e)}function xMe(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}function wMe(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var CMe=/^((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)-.*))$/,AMe=FH(function(e){return CMe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),EMe=AMe,TMe=function(t){return t!=="theme"},h7=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?EMe:TMe},p7=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(a){return t.__emotion_forwardProp(a)&&o(a)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},kMe=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return zH(n,r,i),mke(function(){return jH(n,r,i)}),null},PMe=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,a;n!==void 0&&(o=n.label,a=n.target);var s=p7(t,n,r),l=s||h7(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...a}=t,s=Pq(a,(d,f)=>UPe(f)),l=Rq(e,t),u=xMe({},i,l,Iq(s),o),c=tq(u)(t.theme);return r?[c,r]:c};function z5(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=SMe);const i=OMe({baseStyle:n}),o=RMe(e,r)(i);return An.forwardRef(function(l,u){const{colorMode:c,forced:d}=vw();return An.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function MMe(){const e=new Map;return new Proxy(z5,{apply(t,n,r){return z5(...r)},get(t,n){return e.has(n)||e.set(n,z5(n)),e.get(n)}})}var Oi=MMe();function la(e){return I.forwardRef(e)}function $Me(e={}){const{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,i=I.createContext(void 0);i.displayName=r;function o(){var a;const s=I.useContext(i);if(!s&&t){const l=new Error(n);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,o),l}return s}return[i.Provider,o,i]}function NMe(e){const{cssVarsRoot:t,theme:n,children:r}=e,i=I.useMemo(()=>FPe(n),[n]);return W.jsxs(bke,{theme:i,children:[W.jsx(DMe,{root:t}),r]})}function DMe({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return W.jsx(qH,{styles:n=>({[t]:n.__cssVars})})}$Me({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function AQe(){const{colorMode:e}=vw();return W.jsx(qH,{styles:t=>{const n=kq(t,"styles.global"),r=Rq(n,{theme:t,colorMode:e});return r?tq(r)(t):void 0}})}var LMe=(e,t)=>e.find(n=>n.id===t);function m7(e,t){const n=Mq(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function Mq(e,t){for(const[n,r]of Object.entries(e))if(LMe(r,t))return n}function FMe(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function BMe(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:a}}function zMe(e,t=[]){const n=I.useRef(e);return I.useEffect(()=>{n.current=e}),I.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function jMe(e,t){const n=zMe(e);I.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function y7(e,t){const n=I.useRef(!1),r=I.useRef(!1);I.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),I.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const $q=I.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),ww=I.createContext({}),Wy=I.createContext(null),Cw=typeof document<"u",_P=Cw?I.useLayoutEffect:I.useEffect,Nq=I.createContext({strict:!1});function UMe(e,t,n,r){const{visualElement:i}=I.useContext(ww),o=I.useContext(Nq),a=I.useContext(Wy),s=I.useContext($q).reducedMotion,l=I.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;I.useInsertionEffect(()=>{u&&u.update(n,a)});const c=I.useRef(!!window.HandoffAppearAnimations);return _P(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),I.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function nh(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function VMe(e,t,n){return I.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):nh(n)&&(n.current=r))},[t])}function G0(e){return typeof e=="string"||Array.isArray(e)}function Aw(e){return typeof e=="object"&&typeof e.start=="function"}const SP=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],xP=["initial",...SP];function Ew(e){return Aw(e.animate)||xP.some(t=>G0(e[t]))}function Dq(e){return!!(Ew(e)||e.variants)}function GMe(e,t){if(Ew(e)){const{initial:n,animate:r}=e;return{initial:n===!1||G0(n)?n:void 0,animate:G0(r)?r:void 0}}return e.inherit!==!1?t:{}}function HMe(e){const{initial:t,animate:n}=GMe(e,I.useContext(ww));return I.useMemo(()=>({initial:t,animate:n}),[v7(t),v7(n)])}function v7(e){return Array.isArray(e)?e.join(" "):e}const b7={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"]},H0={};for(const e in b7)H0[e]={isEnabled:t=>b7[e].some(n=>!!t[n])};function qMe(e){for(const t in e)H0[t]={...H0[t],...e[t]}}const wP=I.createContext({}),Lq=I.createContext({}),WMe=Symbol.for("motionComponentSymbol");function KMe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&qMe(e);function o(s,l){let u;const c={...I.useContext($q),...s,layoutId:QMe(s)},{isStatic:d}=c,f=HMe(s),h=r(s,d);if(!d&&Cw){f.visualElement=UMe(i,h,c,t);const p=I.useContext(Lq),m=I.useContext(Nq).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return I.createElement(ww.Provider,{value:f},u&&f.visualElement?I.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,s,VMe(h,f.visualElement,l),h,d,f.visualElement))}const a=I.forwardRef(o);return a[WMe]=i,a}function QMe({layoutId:e}){const t=I.useContext(wP).id;return t&&e!==void 0?t+"-"+e:e}function XMe(e){function t(r,i={}){return KMe(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 YMe=["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 CP(e){return typeof e!="string"||e.includes("-")?!1:!!(YMe.indexOf(e)>-1||/[A-Z]/.test(e))}const cS={};function ZMe(e){Object.assign(cS,e)}const Ky=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],sf=new Set(Ky);function Fq(e,{layout:t,layoutId:n}){return sf.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!cS[e]||e==="opacity")}const Lo=e=>!!(e&&e.getVelocity),JMe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},e7e=Ky.length;function t7e(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),zq=Bq("--"),NE=Bq("var(--"),n7e=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,r7e=(e,t)=>t&&typeof e=="number"?t.transform(e):e,_c=(e,t,n)=>Math.min(Math.max(n,e),t),lf={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},pm={...lf,transform:e=>_c(0,1,e)},m1={...lf,default:1},gm=e=>Math.round(e*1e5)/1e5,Tw=/(-)?([\d]*\.?[\d])+/g,jq=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,i7e=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Qy(e){return typeof e=="string"}const Xy=e=>({test:t=>Qy(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),wu=Xy("deg"),el=Xy("%"),st=Xy("px"),o7e=Xy("vh"),a7e=Xy("vw"),_7={...el,parse:e=>el.parse(e)/100,transform:e=>el.transform(e*100)},S7={...lf,transform:Math.round},Uq={borderWidth:st,borderTopWidth:st,borderRightWidth:st,borderBottomWidth:st,borderLeftWidth:st,borderRadius:st,radius:st,borderTopLeftRadius:st,borderTopRightRadius:st,borderBottomRightRadius:st,borderBottomLeftRadius:st,width:st,maxWidth:st,height:st,maxHeight:st,size:st,top:st,right:st,bottom:st,left:st,padding:st,paddingTop:st,paddingRight:st,paddingBottom:st,paddingLeft:st,margin:st,marginTop:st,marginRight:st,marginBottom:st,marginLeft:st,rotate:wu,rotateX:wu,rotateY:wu,rotateZ:wu,scale:m1,scaleX:m1,scaleY:m1,scaleZ:m1,skew:wu,skewX:wu,skewY:wu,distance:st,translateX:st,translateY:st,translateZ:st,x:st,y:st,z:st,perspective:st,transformPerspective:st,opacity:pm,originX:_7,originY:_7,originZ:st,zIndex:S7,fillOpacity:pm,strokeOpacity:pm,numOctaves:S7};function AP(e,t,n,r){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(zq(d)){o[d]=f;continue}const h=Uq[d],p=r7e(f,h);if(sf.has(d)){if(l=!0,a[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=t7e(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=s;i.transformOrigin=`${d} ${f} ${h}`}}const EP=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Vq(e,t,n){for(const r in t)!Lo(t[r])&&!Fq(r,n)&&(e[r]=t[r])}function s7e({transformTemplate:e},t,n){return I.useMemo(()=>{const r=EP();return AP(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function l7e(e,t,n){const r=e.style||{},i={};return Vq(i,r,e),Object.assign(i,s7e(e,t,n)),e.transformValues?e.transformValues(i):i}function u7e(e,t,n){const r={},i=l7e(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 c7e=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 dS(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||c7e.has(e)}let Gq=e=>!dS(e);function d7e(e){e&&(Gq=t=>t.startsWith("on")?!dS(t):e(t))}try{d7e(require("@emotion/is-prop-valid").default)}catch{}function f7e(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(Gq(i)||n===!0&&dS(i)||!t&&!dS(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function x7(e,t,n){return typeof e=="string"?e:st.transform(t+n*e)}function h7e(e,t,n){const r=x7(t,e.x,e.width),i=x7(n,e.y,e.height);return`${r} ${i}`}const p7e={offset:"stroke-dashoffset",array:"stroke-dasharray"},g7e={offset:"strokeDashoffset",array:"strokeDasharray"};function m7e(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?p7e:g7e;e[o.offset]=st.transform(-r);const a=st.transform(t),s=st.transform(n);e[o.array]=`${a} ${s}`}function TP(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(AP(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=h7e(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&m7e(h,a,s,l,!1)}const Hq=()=>({...EP(),attrs:{}}),kP=e=>typeof e=="string"&&e.toLowerCase()==="svg";function y7e(e,t,n,r){const i=I.useMemo(()=>{const o=Hq();return TP(o,t,{enableHardwareAcceleration:!1},kP(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};Vq(o,e.style,e),i.style={...o,...i.style}}return i}function v7e(e=!1){return(n,r,i,{latestValues:o},a)=>{const l=(CP(n)?y7e:u7e)(r,o,a,n),c={...f7e(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=I.useMemo(()=>Lo(d)?d.get():d,[d]);return I.createElement(n,{...c,children:f})}}const PP=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function qq(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 Wq=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 Kq(e,t,n,r){qq(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(Wq.has(i)?i:PP(i),t.attrs[i])}function IP(e,t){const{style:n}=e,r={};for(const i in n)(Lo(n[i])||t.style&&Lo(t.style[i])||Fq(i,e))&&(r[i]=n[i]);return r}function Qq(e,t){const n=IP(e,t);for(const r in e)if(Lo(e[r])||Lo(t[r])){const i=Ky.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function RP(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 Xq(e){const t=I.useRef(null);return t.current===null&&(t.current=e()),t.current}const fS=e=>Array.isArray(e),b7e=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),_7e=e=>fS(e)?e[e.length-1]||0:e;function bb(e){const t=Lo(e)?e.get():e;return b7e(t)?t.toValue():t}function S7e({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const a={latestValues:x7e(r,i,o,e),renderState:t()};return n&&(a.mount=s=>n(r,s,a)),a}const Yq=e=>(t,n)=>{const r=I.useContext(ww),i=I.useContext(Wy),o=()=>S7e(e,t,r,i);return n?o():Xq(o)};function x7e(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=bb(o[f]);let{initial:a,animate:s}=e;const l=Ew(e),u=Dq(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!Aw(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=RP(e,h);if(!p)return;const{transitionEnd:m,transition:_,...b}=p;for(const y in b){let g=b[y];if(Array.isArray(g)){const v=c?g.length-1:0;g=g[v]}g!==null&&(i[y]=g)}for(const y in m)i[y]=m[y]}),i}const vr=e=>e;function w7e(e){let t=[],n=[],r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&a.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),a.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(d[f]=w7e(()=>n=!0),d),{}),a=d=>o[d].process(i),s=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,C7e),1),i.timestamp=d,i.isProcessing=!0,y1.forEach(a),i.isProcessing=!1,n&&t&&(r=!1,e(s))},l=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:y1.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>y1.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:Nn,cancel:tu,state:ji,steps:j5}=A7e(typeof requestAnimationFrame<"u"?requestAnimationFrame:vr,!0),E7e={useVisualState:Yq({scrapeMotionValuesFromProps:Qq,createRenderState:Hq,onMount:(e,t,{renderState:n,latestValues:r})=>{Nn.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),Nn.render(()=>{TP(n,r,{enableHardwareAcceleration:!1},kP(t.tagName),e.transformTemplate),Kq(t,n)})}})},T7e={useVisualState:Yq({scrapeMotionValuesFromProps:IP,createRenderState:EP})};function k7e(e,{forwardMotionProps:t=!1},n,r){return{...CP(e)?E7e:T7e,preloadedFeatures:n,useRender:v7e(t),createVisualElement:r,Component:e}}function Ll(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const Zq=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function kw(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const P7e=e=>t=>Zq(t)&&e(t,kw(t));function Ul(e,t,n,r){return Ll(e,t,P7e(n),r)}const I7e=(e,t)=>n=>t(e(n)),ic=(...e)=>e.reduce(I7e);function Jq(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const w7=Jq("dragHorizontal"),C7=Jq("dragVertical");function eW(e){let t=!1;if(e==="y")t=C7();else if(e==="x")t=w7();else{const n=w7(),r=C7();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function tW(){const e=eW(!0);return e?(e(),!1):!0}class Lc{constructor(t){this.isMounted=!1,this.node=t}update(){}}function A7(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,a)=>{if(o.type==="touch"||tW())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[r]&&Nn.update(()=>s[r](o,a))};return Ul(e.current,n,i,{passive:!e.getProps()[r]})}class R7e extends Lc{mount(){this.unmount=ic(A7(this.node,!0),A7(this.node,!1))}unmount(){}}class O7e extends Lc{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=ic(Ll(this.node.current,"focus",()=>this.onFocus()),Ll(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const nW=(e,t)=>t?e===t?!0:nW(e,t.parentElement):!1;function U5(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,kw(n))}class M7e extends Lc{constructor(){super(...arguments),this.removeStartListeners=vr,this.removeEndListeners=vr,this.removeAccessibleListeners=vr,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Ul(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();Nn.update(()=>{nW(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(r.onTap||r.onPointerUp)}),a=Ul(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=ic(o,a),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||U5("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&Nn.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Ll(this.node.current,"keyup",a),U5("down",(s,l)=>{this.startPress(s,l)})},n=Ll(this.node.current,"keydown",t),r=()=>{this.isPressing&&U5("cancel",(o,a)=>this.cancelPress(o,a))},i=Ll(this.node.current,"blur",r);this.removeAccessibleListeners=ic(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&&Nn.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!tW()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Nn.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Ul(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Ll(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=ic(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const DE=new WeakMap,V5=new WeakMap,$7e=e=>{const t=DE.get(e.target);t&&t(e)},N7e=e=>{e.forEach($7e)};function D7e({root:e,...t}){const n=e||document;V5.has(n)||V5.set(n,{});const r=V5.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(N7e,{root:e,...t})),r[i]}function L7e(e,t,n){const r=D7e(t);return DE.set(e,n),r.observe(e),()=>{DE.delete(e),r.unobserve(e)}}const F7e={some:0,all:1};class B7e extends Lc{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,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:F7e[i]},s=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:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return L7e(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(z7e(t,n))&&this.startObserver()}unmount(){}}function z7e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const j7e={inView:{Feature:B7e},tap:{Feature:M7e},focus:{Feature:O7e},hover:{Feature:R7e}};function rW(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 V7e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function Pw(e,t,n){const r=e.getProps();return RP(r,t,n!==void 0?n:r.custom,U7e(e),V7e(e))}const G7e="framerAppearId",H7e="data-"+PP(G7e);let q7e=vr,OP=vr;const oc=e=>e*1e3,Vl=e=>e/1e3,W7e={current:!1},iW=e=>Array.isArray(e)&&typeof e[0]=="number";function oW(e){return!!(!e||typeof e=="string"&&aW[e]||iW(e)||Array.isArray(e)&&e.every(oW))}const Ug=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,aW={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ug([0,.65,.55,1]),circOut:Ug([.55,0,1,.45]),backIn:Ug([.31,.01,.66,-.59]),backOut:Ug([.33,1.53,.69,.99])};function sW(e){if(e)return iW(e)?Ug(e):Array.isArray(e)?e.map(sW):aW[e]}function K7e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=sW(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function Q7e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const lW=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,X7e=1e-7,Y7e=12;function Z7e(e,t,n,r,i){let o,a,s=0;do a=t+(n-t)/2,o=lW(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>X7e&&++sZ7e(o,0,1,e,n);return o=>o===0||o===1?o:lW(i(o),t,r)}const J7e=Yy(.42,0,1,1),e$e=Yy(0,0,.58,1),uW=Yy(.42,0,.58,1),t$e=e=>Array.isArray(e)&&typeof e[0]!="number",cW=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,dW=e=>t=>1-e(1-t),fW=e=>1-Math.sin(Math.acos(e)),MP=dW(fW),n$e=cW(MP),hW=Yy(.33,1.53,.69,.99),$P=dW(hW),r$e=cW($P),i$e=e=>(e*=2)<1?.5*$P(e):.5*(2-Math.pow(2,-10*(e-1))),o$e={linear:vr,easeIn:J7e,easeInOut:uW,easeOut:e$e,circIn:fW,circInOut:n$e,circOut:MP,backIn:$P,backInOut:r$e,backOut:hW,anticipate:i$e},E7=e=>{if(Array.isArray(e)){OP(e.length===4);const[t,n,r,i]=e;return Yy(t,n,r,i)}else if(typeof e=="string")return o$e[e];return e},NP=(e,t)=>n=>!!(Qy(n)&&i7e.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),pW=(e,t,n)=>r=>{if(!Qy(r))return r;const[i,o,a,s]=r.match(Tw);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},a$e=e=>_c(0,255,e),G5={...lf,transform:e=>Math.round(a$e(e))},md={test:NP("rgb","red"),parse:pW("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+G5.transform(e)+", "+G5.transform(t)+", "+G5.transform(n)+", "+gm(pm.transform(r))+")"};function s$e(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 LE={test:NP("#"),parse:s$e,transform:md.transform},rh={test:NP("hsl","hue"),parse:pW("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+el.transform(gm(t))+", "+el.transform(gm(n))+", "+gm(pm.transform(r))+")"},ro={test:e=>md.test(e)||LE.test(e)||rh.test(e),parse:e=>md.test(e)?md.parse(e):rh.test(e)?rh.parse(e):LE.parse(e),transform:e=>Qy(e)?e:e.hasOwnProperty("red")?md.transform(e):rh.transform(e)},ur=(e,t,n)=>-n*e+n*t+e;function H5(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 l$e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;i=H5(l,s,e+1/3),o=H5(l,s,e),a=H5(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}const q5=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},u$e=[LE,md,rh],c$e=e=>u$e.find(t=>t.test(e));function T7(e){const t=c$e(e);let n=t.parse(e);return t===rh&&(n=l$e(n)),n}const gW=(e,t)=>{const n=T7(e),r=T7(t),i={...n};return o=>(i.red=q5(n.red,r.red,o),i.green=q5(n.green,r.green,o),i.blue=q5(n.blue,r.blue,o),i.alpha=ur(n.alpha,r.alpha,o),md.transform(i))};function d$e(e){var t,n;return isNaN(e)&&Qy(e)&&(((t=e.match(Tw))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(jq))===null||n===void 0?void 0:n.length)||0)>0}const mW={regex:n7e,countKey:"Vars",token:"${v}",parse:vr},yW={regex:jq,countKey:"Colors",token:"${c}",parse:ro.parse},vW={regex:Tw,countKey:"Numbers",token:"${n}",parse:lf.parse};function W5(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 hS(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&W5(n,mW),W5(n,yW),W5(n,vW),n}function bW(e){return hS(e).values}function _W(e){const{values:t,numColors:n,numVars:r,tokenised:i}=hS(e),o=t.length;return a=>{let s=i;for(let l=0;ltypeof e=="number"?0:e;function h$e(e){const t=bW(e);return _W(e)(t.map(f$e))}const Sc={test:d$e,parse:bW,createTransformer:_W,getAnimatableNone:h$e},SW=(e,t)=>n=>`${n>0?t:e}`;function xW(e,t){return typeof e=="number"?n=>ur(e,t,n):ro.test(e)?gW(e,t):e.startsWith("var(")?SW(e,t):CW(e,t)}const wW=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,a)=>xW(o,t[a]));return o=>{for(let a=0;a{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=xW(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},CW=(e,t)=>{const n=Sc.createTransformer(t),r=hS(e),i=hS(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?ic(wW(r.values,i.values),n):SW(e,t)},q0=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},k7=(e,t)=>n=>ur(e,t,n);function g$e(e){return typeof e=="number"?k7:typeof e=="string"?ro.test(e)?gW:CW:Array.isArray(e)?wW:typeof e=="object"?p$e:k7}function m$e(e,t,n){const r=[],i=n||g$e(e[0]),o=e.length-1;for(let a=0;at[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=m$e(t,r,i),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(_c(e[0],e[o-1],u)):l}function y$e(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=q0(0,t,r);e.push(ur(n,1,i))}}function v$e(e){const t=[0];return y$e(t,e.length-1),t}function b$e(e,t){return e.map(n=>n*t)}function _$e(e,t){return e.map(()=>t||uW).splice(0,e.length-1)}function pS({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=t$e(r)?r.map(E7):E7(r),o={done:!1,value:t[0]},a=b$e(n&&n.length===t.length?n:v$e(t),e),s=AW(a,t,{ease:Array.isArray(i)?i:_$e(t,i)});return{calculatedDuration:e,next:l=>(o.value=s(l),o.done=l>=e,o)}}function EW(e,t){return t?e*(1e3/t):0}const S$e=5;function TW(e,t,n){const r=Math.max(t-S$e,0);return EW(n-e(r),t-r)}const K5=.001,x$e=.01,P7=10,w$e=.05,C$e=1;function A$e({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;q7e(e<=oc(P7));let a=1-t;a=_c(w$e,C$e,a),e=_c(x$e,P7,Vl(e)),a<1?(i=u=>{const c=u*a,d=c*e,f=c-n,h=FE(u,a),p=Math.exp(-d);return K5-f/h*p},o=u=>{const d=u*a*e,f=d*n+n,h=Math.pow(a,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=FE(Math.pow(u,2),a);return(-i(u)+K5>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-K5+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const s=5/e,l=T$e(i,o,s);if(e=oc(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const E$e=12;function T$e(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function I$e(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!I7(e,P$e)&&I7(e,k$e)){const n=A$e(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function kW({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=I$e(r),h=c?-Vl(c):0,p=l/(2*Math.sqrt(s*u)),m=o-i,_=Vl(Math.sqrt(s/u)),b=Math.abs(m)<5;n||(n=b?.01:2),t||(t=b?.005:.5);let y;if(p<1){const g=FE(_,p);y=v=>{const S=Math.exp(-p*_*v);return o-S*((h+p*_*m)/g*Math.sin(g*v)+m*Math.cos(g*v))}}else if(p===1)y=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);y=v=>{const S=Math.exp(-p*_*v),x=Math.min(g*v,300);return o-S*((h+p*_*m)*Math.sinh(x)+g*m*Math.cosh(x))/g}}return{calculatedDuration:f&&d||null,next:g=>{const v=y(g);if(f)a.done=g>=d;else{let S=h;g!==0&&(p<1?S=TW(y,g,v):S=0);const x=Math.abs(S)<=n,w=Math.abs(o-v)<=t;a.done=x&&w}return a.value=a.done?o:v,a}}}function R7({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>s!==void 0&&Cl,p=C=>s===void 0?l:l===void 0||Math.abs(s-C)-m*Math.exp(-C/r),g=C=>b+y(C),v=C=>{const T=y(C),E=g(C);f.done=Math.abs(T)<=u,f.value=f.done?b:E};let S,x;const w=C=>{h(f.value)&&(S=C,x=kW({keyframes:[f.value,p(f.value)],velocity:TW(g,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return w(0),{calculatedDuration:null,next:C=>{let T=!1;return!x&&S===void 0&&(T=!0,v(C),w(C)),S!==void 0&&C>S?x.next(C-S):(!T&&v(C),f)}}}const R$e=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Nn.update(t,!0),stop:()=>tu(t),now:()=>ji.isProcessing?ji.timestamp:performance.now()}},O7=2e4;function M7(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=O7?1/0:t}const O$e={decay:R7,inertia:R7,tween:pS,keyframes:pS,spring:kW};function gS({autoplay:e=!0,delay:t=0,driver:n=R$e,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const b=()=>{_=new Promise(B=>{m=B})};b();let y;const g=O$e[i]||pS;let v;g!==pS&&typeof r[0]!="number"&&(v=AW([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let x;s==="mirror"&&(x=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let w="idle",C=null,T=null,E=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=M7(S));const{calculatedDuration:k}=S;let N=1/0,O=1/0;k!==null&&(N=k+a,O=N*(o+1)-a);let A=0;const P=B=>{if(T===null)return;h>0&&(T=Math.min(T,B)),h<0&&(T=Math.min(B-O/h,T)),C!==null?A=C:A=Math.round(B-T)*h;const U=A-t*(h>=0?1:-1),G=h>=0?U<0:U>O;A=Math.max(U,0),w==="finished"&&C===null&&(A=O);let Y=A,ee=S;if(o){const ne=A/N;let se=Math.floor(ne),Se=ne%1;!Se&&ne>=1&&(Se=1),Se===1&&se--,se=Math.min(se,o+1);const ce=!!(se%2);ce&&(s==="reverse"?(Se=1-Se,a&&(Se-=a/N)):s==="mirror"&&(ee=x));let bt=_c(0,1,Se);A>O&&(bt=s==="reverse"&&ce?1:0),Y=bt*N}const J=G?{done:!1,value:r[0]}:ee.next(Y);v&&(J.value=v(J.value));let{done:j}=J;!G&&k!==null&&(j=h>=0?A>=O:A<=0);const Q=C===null&&(w==="finished"||w==="running"&&j);return d&&d(J.value),Q&&M(),J},D=()=>{y&&y.stop(),y=void 0},L=()=>{w="idle",D(),m(),b(),T=E=null},M=()=>{w="finished",c&&c(),D(),m()},R=()=>{if(p)return;y||(y=n(P));const B=y.now();l&&l(),C!==null?T=B-C:(!T||w==="finished")&&(T=B),w==="finished"&&b(),E=T,C=null,w="running",y.start()};e&&R();const $={then(B,U){return _.then(B,U)},get time(){return Vl(A)},set time(B){B=oc(B),A=B,C!==null||!y||h===0?C=B:T=y.now()-B/h},get duration(){const B=S.calculatedDuration===null?M7(S):S.calculatedDuration;return Vl(B)},get speed(){return h},set speed(B){B===h||!y||(h=B,$.time=Vl(A))},get state(){return w},play:R,pause:()=>{w="paused",C=A},stop:()=>{p=!0,w!=="idle"&&(w="idle",u&&u(),L())},cancel:()=>{E!==null&&P(E),L()},complete:()=>{w="finished"},sample:B=>(T=0,P(B))};return $}function M$e(e){let t;return()=>(t===void 0&&(t=e()),t)}const $$e=M$e(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),N$e=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),v1=10,D$e=2e4,L$e=(e,t)=>t.type==="spring"||e==="backgroundColor"||!oW(t.ease);function F$e(e,t,{onUpdate:n,onComplete:r,...i}){if(!($$e()&&N$e.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(y=>{s=y})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(L$e(t,i)){const y=gS({...i,repeat:0,delay:0});let g={done:!1,value:c[0]};const v=[];let S=0;for(;!g.done&&Sp.cancel(),_=()=>{Nn.update(m),s(),u()};return p.onfinish=()=>{e.set(Q7e(c,i)),r&&r(),_()},{then(y,g){return l.then(y,g)},attachTimeline(y){return p.timeline=y,p.onfinish=null,vr},get time(){return Vl(p.currentTime||0)},set time(y){p.currentTime=oc(y)},get speed(){return p.playbackRate},set speed(y){p.playbackRate=y},get duration(){return Vl(d)},play:()=>{a||(p.play(),tu(m))},pause:()=>p.pause(),stop:()=>{if(a=!0,p.playState==="idle")return;const{currentTime:y}=p;if(y){const g=gS({...i,autoplay:!1});e.setWithVelocity(g.sample(y-v1).value,g.sample(y).value,v1)}_()},complete:()=>p.finish(),cancel:_}}function B$e({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:vr,pause:vr,stop:vr,then:o=>(o(),Promise.resolve()),cancel:vr,complete:vr});return t?gS({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const z$e={type:"spring",stiffness:500,damping:25,restSpeed:10},j$e=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),U$e={type:"keyframes",duration:.8},V$e={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},G$e=(e,{keyframes:t})=>t.length>2?U$e:sf.has(e)?e.startsWith("scale")?j$e(t[1]):z$e:V$e,BE=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Sc.test(t)||t==="0")&&!t.startsWith("url(")),H$e=new Set(["brightness","contrast","saturate","opacity"]);function q$e(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Tw)||[];if(!r)return e;const i=n.replace(r,"");let o=H$e.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const W$e=/([a-z-]*)\(.*?\)/g,zE={...Sc,getAnimatableNone:e=>{const t=e.match(W$e);return t?t.map(q$e).join(" "):e}},K$e={...Uq,color:ro,backgroundColor:ro,outlineColor:ro,fill:ro,stroke:ro,borderColor:ro,borderTopColor:ro,borderRightColor:ro,borderBottomColor:ro,borderLeftColor:ro,filter:zE,WebkitFilter:zE},DP=e=>K$e[e];function PW(e,t){let n=DP(e);return n!==zE&&(n=Sc),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const IW=e=>/^0[^.\s]+$/.test(e);function Q$e(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||IW(e)}function X$e(e,t,n,r){const i=BE(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const a=r.from!==void 0?r.from:e.get();let s;const l=[];for(let u=0;ui=>{const o=RW(r,e)||{},a=o.delay||r.delay||0;let{elapsed:s=0}=r;s=s-oc(a);const l=X$e(t,e,n,o),u=l[0],c=l[l.length-1],d=BE(e,u),f=BE(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(Y$e(o)||(h={...h,...G$e(e,h)}),h.duration&&(h.duration=oc(h.duration)),h.repeatDelay&&(h.repeatDelay=oc(h.repeatDelay)),!d||!f||W7e.current||o.type===!1)return B$e(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=F$e(t,e,h);if(p)return p}return gS(h)};function mS(e){return!!(Lo(e)&&e.add)}const OW=e=>/^\-?\d*\.?\d+$/.test(e);function FP(e,t){e.indexOf(t)===-1&&e.push(t)}function BP(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class zP{constructor(){this.subscriptions=[]}add(t){return FP(this.subscriptions,t),()=>BP(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 J$e{constructor(t,n={}){this.version="10.16.1",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:a}=ji;this.lastUpdated!==a&&(this.timeDelta=o,this.lastUpdated=a,Nn.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=()=>Nn.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=Z$e(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new zP);const r=this.events[t].add(n);return t==="change"?()=>{r(),Nn.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?EW(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 vp(e,t){return new J$e(e,t)}const MW=e=>t=>t.test(e),eNe={test:e=>e==="auto",parse:e=>e},$W=[lf,st,el,wu,a7e,o7e,eNe],_g=e=>$W.find(MW(e)),tNe=[...$W,ro,Sc],nNe=e=>tNe.find(MW(e));function rNe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,vp(n))}function iNe(e,t){const n=Pw(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o){const s=_7e(o[a]);rNe(e,a,s)}}function oNe(e,t,n){var r,i;const o=Object.keys(t).filter(s=>!e.hasValue(s)),a=o.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&iNe(e,a)}),u}function jE(e,t,n={}){const r=Pw(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(NW(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return uNe(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[l,u]=s==="beforeChildren"?[o,a]:[a,o];return l().then(()=>u())}else return Promise.all([o(),a(n.delay)])}function uNe(e,t,n=0,r=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>s-u*r;return Array.from(e.variantChildren).sort(cNe).forEach((u,c)=>{u.notify("AnimationStart",t),a.push(jE(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function cNe(e,t){return e.sortNodePosition(t)}function dNe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>jE(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=jE(e,t,n);else{const i=typeof t=="function"?Pw(e,t,n.custom):t;r=Promise.all(NW(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const fNe=[...SP].reverse(),hNe=SP.length;function pNe(e){return t=>Promise.all(t.map(({animation:n,options:r})=>dNe(e,n,r)))}function gNe(e){let t=pNe(e);const n=yNe();let r=!0;const i=(l,u)=>{const c=Pw(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let b=0;bm&&S;const E=Array.isArray(v)?v:[v];let k=E.reduce(i,{});x===!1&&(k={});const{prevResolvedValues:N={}}=g,O={...N,...k},A=P=>{T=!0,h.delete(P),g.needsAnimating[P]=!0};for(const P in O){const D=k[P],L=N[P];p.hasOwnProperty(P)||(D!==L?fS(D)&&fS(L)?!rW(D,L)||C?A(P):g.protectedKeys[P]=!0:D!==void 0?A(P):h.add(P):D!==void 0&&h.has(P)?A(P):g.protectedKeys[P]=!0)}g.prevProp=v,g.prevResolvedValues=k,g.isActive&&(p={...p,...k}),r&&e.blockInitialAnimation&&(T=!1),T&&!w&&f.push(...E.map(P=>({animation:P,options:{type:y,...l}})))}if(h.size){const b={};h.forEach(y=>{const g=e.getBaseTarget(y);g!==void 0&&(b[y]=g)}),f.push({animation:b})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function s(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:o,getState:()=>n}}function mNe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!rW(t,e):!1}function Gc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function yNe(){return{animate:Gc(!0),whileInView:Gc(),whileHover:Gc(),whileTap:Gc(),whileDrag:Gc(),whileFocus:Gc(),exit:Gc()}}class vNe extends Lc{constructor(t){super(t),t.animationState||(t.animationState=gNe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),Aw(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 bNe=0;class _Ne extends Lc{constructor(){super(...arguments),this.id=bNe++}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 SNe={animation:{Feature:vNe},exit:{Feature:_Ne}},$7=(e,t)=>Math.abs(e-t);function xNe(e,t){const n=$7(e.x,t.x),r=$7(e.y,t.y);return Math.sqrt(n**2+r**2)}class DW{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=X5(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=xNe(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=ji;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=Q5(c,this.transformPagePoint),Nn.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=X5(u.type==="pointercancel"?this.lastMoveEventInfo:Q5(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!Zq(t))return;this.handlers=n,this.transformPagePoint=r;const i=kw(t),o=Q5(i,this.transformPagePoint),{point:a}=o,{timestamp:s}=ji;this.history=[{...a,timestamp:s}];const{onSessionStart:l}=n;l&&l(t,X5(o,this.history)),this.removeListeners=ic(Ul(window,"pointermove",this.handlePointerMove),Ul(window,"pointerup",this.handlePointerUp),Ul(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),tu(this.updatePoint)}}function Q5(e,t){return t?{point:t(e.point)}:e}function N7(e,t){return{x:e.x-t.x,y:e.y-t.y}}function X5({point:e},t){return{point:e,delta:N7(e,LW(t)),offset:N7(e,wNe(t)),velocity:CNe(t,.1)}}function wNe(e){return e[0]}function LW(e){return e[e.length-1]}function CNe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=LW(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>oc(t)));)n--;if(!r)return{x:0,y:0};const o=Vl(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function ia(e){return e.max-e.min}function UE(e,t=0,n=.01){return Math.abs(e-t)<=n}function D7(e,t,n,r=.5){e.origin=r,e.originPoint=ur(t.min,t.max,e.origin),e.scale=ia(n)/ia(t),(UE(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=ur(n.min,n.max,e.origin)-e.originPoint,(UE(e.translate)||isNaN(e.translate))&&(e.translate=0)}function mm(e,t,n,r){D7(e.x,t.x,n.x,r?r.originX:void 0),D7(e.y,t.y,n.y,r?r.originY:void 0)}function L7(e,t,n){e.min=n.min+t.min,e.max=e.min+ia(t)}function ANe(e,t,n){L7(e.x,t.x,n.x),L7(e.y,t.y,n.y)}function F7(e,t,n){e.min=t.min-n.min,e.max=e.min+ia(t)}function ym(e,t,n){F7(e.x,t.x,n.x),F7(e.y,t.y,n.y)}function ENe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?ur(n,e,r.max):Math.min(e,n)),e}function B7(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 TNe(e,{top:t,left:n,bottom:r,right:i}){return{x:B7(e.x,n,i),y:B7(e.y,t,r)}}function z7(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=q0(t.min,t.max-r,e.min):r>i&&(n=q0(e.min,e.max-i,t.min)),_c(0,1,n)}function INe(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 VE=.35;function RNe(e=VE){return e===!1?e=0:e===!0&&(e=VE),{x:j7(e,"left","right"),y:j7(e,"top","bottom")}}function j7(e,t,n){return{min:U7(e,t),max:U7(e,n)}}function U7(e,t){return typeof e=="number"?e:e[t]||0}const V7=()=>({translate:0,scale:1,origin:0,originPoint:0}),ih=()=>({x:V7(),y:V7()}),G7=()=>({min:0,max:0}),Dr=()=>({x:G7(),y:G7()});function ks(e){return[e("x"),e("y")]}function FW({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function ONe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function MNe(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 Y5(e){return e===void 0||e===1}function GE({scale:e,scaleX:t,scaleY:n}){return!Y5(e)||!Y5(t)||!Y5(n)}function Xc(e){return GE(e)||BW(e)||e.z||e.rotate||e.rotateX||e.rotateY}function BW(e){return H7(e.x)||H7(e.y)}function H7(e){return e&&e!=="0%"}function yS(e,t,n){const r=e-n,i=t*r;return n+i}function q7(e,t,n,r,i){return i!==void 0&&(e=yS(e,i,r)),yS(e,n,r)+t}function HE(e,t=0,n=1,r,i){e.min=q7(e.min,t,n,r,i),e.max=q7(e.max,t,n,r,i)}function zW(e,{x:t,y:n}){HE(e.x,t.translate,t.scale,t.originPoint),HE(e.y,n.translate,n.scale,n.originPoint)}function $Ne(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function ku(e,t){e.min=e.min+t,e.max=e.max+t}function K7(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,a=ur(e.min,e.max,o);HE(e,t[n],t[r],a,t.scale)}const NNe=["x","scaleX","originX"],DNe=["y","scaleY","originY"];function oh(e,t){K7(e.x,t,NNe),K7(e.y,t,DNe)}function jW(e,t){return FW(MNe(e.getBoundingClientRect(),t))}function LNe(e,t,n){const r=jW(e,n),{scroll:i}=t;return i&&(ku(r.x,i.offset.x),ku(r.y,i.offset.y)),r}const FNe=new WeakMap;class BNe{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=Dr(),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(kw(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=eW(c),!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),ks(p=>{let m=this.getAxisMotionValue(p).get()||0;if(el.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const b=_.layout.layoutBox[p];b&&(m=ia(b)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&Nn.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=zNe(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new DW(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:s},{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&&Nn.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||!b1(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=ENe(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&nh(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=TNe(r.layoutBox,t):this.constraints=!1,this.elastic=RNe(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ks(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=INe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!nh(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=LNe(r,i.root,this.visualElement.getTransformPagePoint());let a=kNe(i.layout.layoutBox,o);if(n){const s=n(ONe(a));this.hasMutatedConstraints=!!s,s&&(a=FW(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=ks(c=>{if(!b1(c,n,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(LP(t,r,0,n))}stopAnimation(){ks(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){ks(n=>{const{drag:r}=this.getProps();if(!b1(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:s}=i.layout.layoutBox[n];o.set(t[n]-ur(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!nh(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};ks(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();i[a]=PNe({min:l,max:l},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ks(a=>{if(!b1(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(ur(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;FNe.set(this.visualElement,this);const t=this.visualElement.current,n=Ul(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();nh(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 a=Ll(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(ks(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=VE,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function b1(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function zNe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class jNe extends Lc{constructor(t){super(t),this.removeGroupControls=vr,this.removeListeners=vr,this.controls=new BNe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||vr}unmount(){this.removeGroupControls(),this.removeListeners()}}const Q7=e=>(t,n)=>{e&&Nn.update(()=>e(t,n))};class UNe extends Lc{constructor(){super(...arguments),this.removePointerDownListener=vr}onPointerDown(t){this.session=new DW(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Q7(t),onStart:Q7(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&Nn.update(()=>i(o,a))}}}mount(){this.removePointerDownListener=Ul(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 VNe(){const e=I.useContext(Wy);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=I.useId();return I.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function GNe(){return HNe(I.useContext(Wy))}function HNe(e){return e===null?!0:e.isPresent}const _b={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function X7(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Sg={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(st.test(e))e=parseFloat(e);else return e;const n=X7(e,t.target.x),r=X7(e,t.target.y);return`${n}% ${r}%`}},qNe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Sc.parse(e);if(i.length>5)return r;const o=Sc.createTransformer(e),a=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=s,i[1+a]/=l;const u=ur(s,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class WNe extends An.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;ZMe(KNe),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()})),_b.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||Nn.postRender(()=>{const s=a.getStack();(!s||!s.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 UW(e){const[t,n]=VNe(),r=I.useContext(wP);return An.createElement(WNe,{...e,layoutGroup:r,switchLayoutGroup:I.useContext(Lq),isPresent:t,safeToRemove:n})}const KNe={borderRadius:{...Sg,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Sg,borderTopRightRadius:Sg,borderBottomLeftRadius:Sg,borderBottomRightRadius:Sg,boxShadow:qNe},VW=["TopLeft","TopRight","BottomLeft","BottomRight"],QNe=VW.length,Y7=e=>typeof e=="string"?parseFloat(e):e,Z7=e=>typeof e=="number"||st.test(e);function XNe(e,t,n,r,i,o){i?(e.opacity=ur(0,n.opacity!==void 0?n.opacity:1,YNe(r)),e.opacityExit=ur(t.opacity!==void 0?t.opacity:1,0,ZNe(r))):o&&(e.opacity=ur(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(q0(e,t,r))}function e$(e,t){e.min=t.min,e.max=t.max}function pa(e,t){e$(e.x,t.x),e$(e.y,t.y)}function t$(e,t,n,r,i){return e-=t,e=yS(e,1/n,r),i!==void 0&&(e=yS(e,1/i,r)),e}function JNe(e,t=0,n=1,r=.5,i,o=e,a=e){if(el.test(t)&&(t=parseFloat(t),t=ur(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=ur(o.min,o.max,r);e===o&&(s-=t),e.min=t$(e.min,t,n,s,i),e.max=t$(e.max,t,n,s,i)}function n$(e,t,[n,r,i],o,a){JNe(e,t[n],t[r],t[i],t.scale,o,a)}const eDe=["x","scaleX","originX"],tDe=["y","scaleY","originY"];function r$(e,t,n,r){n$(e.x,t,eDe,n?n.x:void 0,r?r.x:void 0),n$(e.y,t,tDe,n?n.y:void 0,r?r.y:void 0)}function i$(e){return e.translate===0&&e.scale===1}function HW(e){return i$(e.x)&&i$(e.y)}function nDe(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 qW(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function o$(e){return ia(e.x)/ia(e.y)}class rDe{constructor(){this.members=[]}add(t){FP(this.members,t),t.scheduleRender()}remove(t){if(BP(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 a$(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:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(r+=`scale(${a}, ${s})`),r||"none"}const iDe=(e,t)=>e.depth-t.depth;class oDe{constructor(){this.children=[],this.isDirty=!1}add(t){FP(this.children,t),this.isDirty=!0}remove(t){BP(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(iDe),this.isDirty=!1,this.children.forEach(t)}}function aDe(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(tu(r),e(o-t))};return Nn.read(r,!0),()=>tu(r)}function sDe(e){window.MotionDebug&&window.MotionDebug.record(e)}function lDe(e){return e instanceof SVGElement&&e.tagName!=="svg"}function uDe(e,t,n){const r=Lo(e)?e:vp(e);return r.start(LP("",r,t,n)),r.animation}const s$=["","X","Y","Z"],l$=1e3;let cDe=0;const Yc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function WW({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},s=t==null?void 0:t()){this.id=cDe++,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=()=>{Yc.totalNodes=Yc.resolvedTargetDeltas=Yc.recalculatedProjection=0,this.nodes.forEach(hDe),this.nodes.forEach(vDe),this.nodes.forEach(bDe),this.nodes.forEach(pDe),sDe(Yc)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=aDe(f,250),_b.hasAnimatedSinceResize&&(_b.hasAnimatedSinceResize=!1,this.nodes.forEach(c$))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||CDe,{onLayoutAnimationStart:_,onLayoutAnimationComplete:b}=c.getProps(),y=!this.targetLayout||!qW(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const v={...RW(m,"layout"),onPlay:_,onComplete:b};(c.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else f||c$(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,tu(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(_De),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!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 c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(gDe),this.sharedNodes.forEach(SDe)}scheduleUpdateProjection(){Nn.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){Nn.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 S=v/1e3;d$(d.x,a.x,S),d$(d.y,a.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ym(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),xDe(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&nDe(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Dr()),pa(g,this.relativeTarget)),m&&(this.animationValues=c,XNe(c,u,this.latestValues,S,y,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(tu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nn.update(()=>{_b.hasAnimatedSinceResize=!0,this.currentAnimation=uDe(0,l$,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.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 a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(l$),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&KW(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Dr();const d=ia(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=ia(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}pa(s,l),oh(s,c),mm(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new rDe),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(u$),this.root.sharedNodes.clear()}}}function dDe(e){e.updateLayout()}function fDe(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,a=n.source!==e.layout.source;o==="size"?ks(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=ia(f);f.min=r[d].min,f.max=f.min+h}):KW(o,n.layoutBox,r)&&ks(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=ia(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const s=ih();mm(s,r,n.layoutBox);const l=ih();a?mm(l,e.applyTransform(i,!0),n.measuredBox):mm(l,r,n.layoutBox);const u=!HW(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=Dr();ym(p,n.layoutBox,f.layoutBox);const m=Dr();ym(m,r,h.layoutBox),qW(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function hDe(e){Yc.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 pDe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function gDe(e){e.clearSnapshot()}function u$(e){e.clearMeasurements()}function mDe(e){e.isLayoutDirty=!1}function yDe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function c$(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function vDe(e){e.resolveTargetDelta()}function bDe(e){e.calcProjection()}function _De(e){e.resetRotation()}function SDe(e){e.removeLeadSnapshot()}function d$(e,t,n){e.translate=ur(t.translate,0,n),e.scale=ur(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function f$(e,t,n,r){e.min=ur(t.min,n.min,r),e.max=ur(t.max,n.max,r)}function xDe(e,t,n,r){f$(e.x,t.x,n.x,r),f$(e.y,t.y,n.y,r)}function wDe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const CDe={duration:.45,ease:[.4,0,.1,1]},h$=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),p$=h$("applewebkit/")&&!h$("chrome/")?Math.round:vr;function g$(e){e.min=p$(e.min),e.max=p$(e.max)}function ADe(e){g$(e.x),g$(e.y)}function KW(e,t,n){return e==="position"||e==="preserve-aspect"&&!UE(o$(t),o$(n),.2)}const EDe=WW({attachResizeListener:(e,t)=>Ll(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Z5={current:void 0},QW=WW({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Z5.current){const e=new EDe({});e.mount(window),e.setOptions({layoutScroll:!0}),Z5.current=e}return Z5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),TDe={pan:{Feature:UNe},drag:{Feature:jNe,ProjectionNode:QW,MeasureLayout:UW}},kDe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function PDe(e){const t=kDe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function qE(e,t,n=1){const[r,i]=PDe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return OW(a)?parseFloat(a):a}else return NE(i)?qE(i,t,n+1):i}function IDe(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(!NE(o))return;const a=qE(o,r);a&&i.set(a)});for(const i in t){const o=t[i];if(!NE(o))continue;const a=qE(o,r);a&&(t[i]=a,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const RDe=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),XW=e=>RDe.has(e),ODe=e=>Object.keys(e).some(XW),m$=e=>e===lf||e===st,y$=(e,t)=>parseFloat(e.split(", ")[t]),v$=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return y$(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?y$(o[1],e):0}},MDe=new Set(["x","y","z"]),$De=Ky.filter(e=>!MDe.has(e));function NDe(e){const t=[];return $De.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 bp={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:v$(4,13),y:v$(5,14)};bp.translateX=bp.x;bp.translateY=bp.y;const DDe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{s[u]=bp[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=bp[u](l,o)}),e},LDe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(XW);let o=[],a=!1;const s=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=_g(c);const f=t[l];let h;if(fS(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=_g(c);for(let _=m;_=0?window.pageYOffset:null,u=DDe(t,e,s);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),Cw&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function FDe(e,t,n,r){return ODe(t)?LDe(e,t,n,r):{target:t,transitionEnd:r}}const BDe=(e,t,n,r)=>{const i=IDe(e,t,r);return t=i.target,r=i.transitionEnd,FDe(e,t,n,r)},WE={current:null},YW={current:!1};function zDe(){if(YW.current=!0,!!Cw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>WE.current=e.matches;e.addListener(t),t()}else WE.current=!1}function jDe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],a=n[i];if(Lo(o))e.addValue(i,o),mS(r)&&r.add(i);else if(Lo(a))e.addValue(i,vp(o,{owner:e})),mS(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const s=e.getValue(i);!s.hasAnimated&&s.set(o)}else{const s=e.getStaticValue(i);e.addValue(i,vp(s!==void 0?s:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const b$=new WeakMap,ZW=Object.keys(H0),UDe=ZW.length,_$=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],VDe=xP.length;class GDe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},a={}){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=()=>Nn.render(this.render,!1,!0);const{latestValues:s,renderState:l}=o;this.latestValues=s,this.baseTarget={...s},this.initialValues=n.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.isControllingVariants=Ew(n),this.isVariantNode=Dq(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];s[d]!==void 0&&Lo(f)&&(f.set(s[d],!1),mS(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,b$.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)),YW.current||zDe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:WE.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){b$.delete(this.current),this.projection&&this.projection.unmount(),tu(this.notifyUpdate),tu(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=sf.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Nn.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 a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return s}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):Dr()}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;r<_$.length;r++){const i=_$[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const o=t["on"+i];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=jDe(this,this.scrapeMotionValuesFromProps(t,this.prevProps),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const r=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(r.initial=this.props.initial),r}const 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=vp(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=RP(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&&!Lo(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 zP),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class JW extends GDe{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 a=sNe(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){oNe(this,r,a);const s=BDe(this,r,a,n);n=s.transitionEnd,r=s.target}return{transition:t,transitionEnd:n,...r}}}function HDe(e){return window.getComputedStyle(e)}class qDe extends JW{readValueFromInstance(t,n){if(sf.has(n)){const r=DP(n);return r&&r.default||0}else{const r=HDe(t),i=(zq(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return jW(t,n)}build(t,n,r,i){AP(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return IP(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Lo(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){qq(t,n,r,i)}}class WDe extends JW{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(sf.has(n)){const r=DP(n);return r&&r.default||0}return n=Wq.has(n)?n:PP(n),t.getAttribute(n)}measureInstanceViewportBox(){return Dr()}scrapeMotionValuesFromProps(t,n){return Qq(t,n)}build(t,n,r,i){TP(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){Kq(t,n,r,i)}mount(t){this.isSVGTag=kP(t.tagName),super.mount(t)}}const KDe=(e,t)=>CP(e)?new WDe(t,{enableHardwareAcceleration:!1}):new qDe(t,{enableHardwareAcceleration:!0}),QDe={layout:{ProjectionNode:QW,MeasureLayout:UW}},XDe={...SNe,...j7e,...TDe,...QDe},eK=XMe((e,t)=>k7e(e,t,XDe,KDe));function tK(){const e=I.useRef(!1);return _P(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function YDe(){const e=tK(),[t,n]=I.useState(0),r=I.useCallback(()=>{e.current&&n(t+1)},[t]);return[I.useCallback(()=>Nn.postRender(r),[r]),t]}class ZDe extends I.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 JDe({children:e,isPresent:t}){const n=I.useId(),r=I.useRef(null),i=I.useRef({width:0,height:0,top:0,left:0});return I.useInsertionEffect(()=>{const{width:o,height:a,top:s,left:l}=i.current;if(t||!r.current||!o||!a)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: ${a}px !important; top: ${s}px !important; left: ${l}px !important; } `),()=>{document.head.removeChild(u)}},[t]),I.createElement(ZDe,{isPresent:t,childRef:r,sizeRef:i},I.cloneElement(e,{ref:r}))}const J5=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a})=>{const s=Xq(eLe),l=I.useId(),u=I.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;r&&r()},register:c=>(s.set(c,!1),()=>s.delete(c))}),o?void 0:[n]);return I.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[n]),I.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),a==="popLayout"&&(e=I.createElement(JDe,{isPresent:n},e)),I.createElement(Wy.Provider,{value:u},e)};function eLe(){return new Map}function tLe(e){return I.useEffect(()=>()=>e(),[])}const Nf=e=>e.key||"";function nLe(e,t){e.forEach(n=>{const r=Nf(n);t.set(r,n)})}function rLe(e){const t=[];return I.Children.forEach(e,n=>{I.isValidElement(n)&&t.push(n)}),t}const nK=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const s=I.useContext(wP).forceRender||YDe()[0],l=tK(),u=rLe(e);let c=u;const d=I.useRef(new Map).current,f=I.useRef(c),h=I.useRef(new Map).current,p=I.useRef(!0);if(_P(()=>{p.current=!1,nLe(u,h),f.current=c}),tLe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return I.createElement(I.Fragment,null,c.map(y=>I.createElement(J5,{key:Nf(y),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:a},y)));c=[...c];const m=f.current.map(Nf),_=u.map(Nf),b=m.length;for(let y=0;y{if(_.indexOf(g)!==-1)return;const v=h.get(g);if(!v)return;const S=m.indexOf(g);let x=y;if(!x){const w=()=>{h.delete(g),d.delete(g);const C=f.current.findIndex(T=>T.key===g);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;s(),r&&r()}};x=I.createElement(J5,{key:Nf(v),isPresent:!1,onExitComplete:w,custom:t,presenceAffectsLayout:o,mode:a},v),d.set(g,x)}c.splice(S,0,x)}),c=c.map(y=>{const g=y.key;return d.has(g)?y:I.createElement(J5,{key:Nf(y),isPresent:!0,presenceAffectsLayout:o,mode:a},y)}),I.createElement(I.Fragment,null,d.size?c:c.map(y=>I.cloneElement(y)))};var iLe={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},rK=I.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=iLe,toastSpacing:c="0.5rem"}=e,[d,f]=I.useState(s),h=GNe();y7(()=>{h||r==null||r()},[h]),y7(()=>{f(s)},[s]);const p=()=>f(null),m=()=>f(s),_=()=>{h&&i()};I.useEffect(()=>{h&&o&&i()},[h,o,i]),jMe(_,d);const b=I.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),y=I.useMemo(()=>FMe(a),[a]);return W.jsx(eK.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:m,custom:{position:a},style:y,children:W.jsx(Oi.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:b,children:Us(n,{id:t,onClose:_})})})});rK.displayName="ToastComponent";function oLe(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var S$={path:W.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[W.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),W.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),W.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Zy=la((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:a,className:s,__css:l,...u}=e,c=Dc("chakra-icon",s),d=qy("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??S$.viewBox;if(n&&typeof n!="string")return W.jsx(Oi.svg,{as:n,...h,...u});const m=a??S$.path;return W.jsx(Oi.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:m})});Zy.displayName="Icon";function aLe(e){return W.jsx(Zy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function sLe(e){return W.jsx(Zy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function x$(e){return W.jsx(Zy,{viewBox:"0 0 24 24",...e,children:W.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var lLe=Ske({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),jP=la((e,t)=>{const n=qy("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:a="transparent",className:s,...l}=Gy(e),u=Dc("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:a,borderLeftColor:a,animation:`${lLe} ${o} linear infinite`,...n};return W.jsx(Oi.div,{ref:t,__css:c,className:u,...l,children:r&&W.jsx(Oi.span,{srOnly:!0,children:r})})});jP.displayName="Spinner";var[uLe,UP]=Vy({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[cLe,VP]=Vy({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),iK={info:{icon:sLe,colorScheme:"blue"},warning:{icon:x$,colorScheme:"orange"},success:{icon:aLe,colorScheme:"green"},error:{icon:x$,colorScheme:"red"},loading:{icon:jP,colorScheme:"blue"}};function dLe(e){return iK[e].colorScheme}function fLe(e){return iK[e].icon}var oK=la(function(t,n){const r=VP(),{status:i}=UP(),o={display:"inline",...r.description};return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Dc("chakra-alert__desc",t.className),__css:o})});oK.displayName="AlertDescription";function aK(e){const{status:t}=UP(),n=fLe(t),r=VP(),i=t==="loading"?r.spinner:r.icon;return W.jsx(Oi.span,{display:"inherit","data-status":t,...e,className:Dc("chakra-alert__icon",e.className),__css:i,children:e.children||W.jsx(n,{h:"100%",w:"100%"})})}aK.displayName="AlertIcon";var sK=la(function(t,n){const r=VP(),{status:i}=UP();return W.jsx(Oi.div,{ref:n,"data-status":i,...t,className:Dc("chakra-alert__title",t.className),__css:r.title})});sK.displayName="AlertTitle";var lK=la(function(t,n){var r;const{status:i="info",addRole:o=!0,...a}=Gy(t),s=(r=t.colorScheme)!=null?r:dLe(i),l=vMe("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return W.jsx(uLe,{value:{status:i},children:W.jsx(cLe,{value:l,children:W.jsx(Oi.div,{"data-status":i,role:o?"alert":void 0,ref:n,...a,className:Dc("chakra-alert",t.className),__css:u})})})});lK.displayName="Alert";function hLe(e){return W.jsx(Zy,{focusable:"false","aria-hidden":!0,...e,children:W.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var uK=la(function(t,n){const r=qy("CloseButton",t),{children:i,isDisabled:o,__css:a,...s}=Gy(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return W.jsx(Oi.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...a},...s,children:i||W.jsx(hLe,{width:"1em",height:"1em"})})});uK.displayName="CloseButton";var pLe={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},Bs=gLe(pLe);function gLe(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(a=>({...a,[o]:a[o].filter(s=>s.id!=i)}))},notify:(i,o)=>{const a=mLe(i,o),{position:s,id:l}=a;return r(u=>{var c,d;const h=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:h}}),l},update:(i,o)=>{i&&r(a=>{const s={...a},{position:l,index:u}=m7(s,i);return l&&u!==-1&&(s[l][u]={...s[l][u],...o,message:cK(o)}),s})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const a=Mq(o,i);return a?{...o,[a]:o[a].map(s=>s.id==i?{...s,requestClose:!0}:s)}:o})},isActive:i=>!!m7(Bs.getState(),i).position}}var w$=0;function mLe(e,t={}){var n,r;w$+=1;const i=(n=t.id)!=null?n:w$,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>Bs.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var yLe=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:a,description:s,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return W.jsxs(lK,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[W.jsx(aK,{children:u}),W.jsxs(Oi.div,{flex:"1",maxWidth:"100%",children:[i&&W.jsx(sK,{id:c==null?void 0:c.title,children:i}),s&&W.jsx(oK,{id:c==null?void 0:c.description,display:"block",children:s})]}),o&&W.jsx(uK,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function cK(e={}){const{render:t,toastComponent:n=yLe}=e;return i=>typeof t=="function"?t({...i,...e}):W.jsx(n,{...i,...e})}function vLe(e,t){const n=i=>{var o;return{...t,...i,position:oLe((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),a=cK(o);return Bs.notify(a,o)};return r.update=(i,o)=>{Bs.update(i,n(o))},r.promise=(i,o)=>{const a=r({...o.loading,status:"loading",duration:null});i.then(s=>r.update(a,{status:"success",duration:5e3,...Us(o.success,s)})).catch(s=>r.update(a,{status:"error",duration:5e3,...Us(o.error,s)}))},r.closeAll=Bs.closeAll,r.close=Bs.close,r.isActive=Bs.isActive,r}var[TQe,kQe]=Vy({name:"ToastOptionsContext",strict:!1}),bLe=e=>{const t=I.useSyncExternalStore(Bs.subscribe,Bs.getState,Bs.getState),{motionVariants:n,component:r=rK,portalProps:i}=e,a=Object.keys(t).map(s=>{const l=t[s];return W.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${s}`,style:BMe(s),children:W.jsx(nK,{initial:!1,children:l.map(u=>W.jsx(r,{motionVariants:n,...u},u.id))})},s)});return W.jsx(yw,{...i,children:a})},_Le={duration:5e3,variant:"solid"},Pf={theme:sMe,colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{},defaultOptions:_Le,forced:!1};function SLe({theme:e=Pf.theme,colorMode:t=Pf.colorMode,toggleColorMode:n=Pf.toggleColorMode,setColorMode:r=Pf.setColorMode,defaultOptions:i=Pf.defaultOptions,motionVariants:o,toastSpacing:a,component:s,forced:l}=Pf){const u={colorMode:t,setColorMode:r,toggleColorMode:n,forced:l};return{ToastContainer:()=>W.jsx(NMe,{theme:e,children:W.jsx(dP.Provider,{value:u,children:W.jsx(bLe,{defaultOptions:i,motionVariants:o,toastSpacing:a,component:s})})}),toast:vLe(e.direction,i)}}var KE=la(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...a}=t;return W.jsx("img",{width:r,height:i,ref:n,alt:o,...a})});KE.displayName="NativeImage";function xLe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:a,sizes:s,ignoreFallback:l}=e,[u,c]=I.useState("pending");I.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=I.useRef(),f=I.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,a&&(p.crossOrigin=a),r&&(p.srcset=r),s&&(p.sizes=s),t&&(p.loading=t),p.onload=m=>{h(),c("loaded"),i==null||i(m)},p.onerror=m=>{h(),c("failed"),o==null||o(m)},d.current=p},[n,a,r,s,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return rS(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var wLe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function CLe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var GP=la(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:a,align:s,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,_=u!=null||c||!m,b=xLe({...t,crossOrigin:d,ignoreFallback:_}),y=wLe(b,f),g={ref:n,objectFit:l,objectPosition:s,..._?p:CLe(p,["onError","onLoad"])};return y?i||W.jsx(Oi.img,{as:KE,className:"chakra-image__placeholder",src:r,...g}):W.jsx(Oi.img,{as:KE,src:o,srcSet:a,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});GP.displayName="Image";var dK=la(function(t,n){const r=qy("Text",t),{className:i,align:o,decoration:a,casing:s,...l}=Gy(t),u=wMe({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return W.jsx(Oi.p,{ref:n,className:Dc("chakra-text",t.className),...u,...l,__css:r})});dK.displayName="Text";var QE=la(function(t,n){const r=qy("Heading",t),{className:i,...o}=Gy(t);return W.jsx(Oi.h2,{ref:n,className:Dc("chakra-heading",t.className),...o,__css:r})});QE.displayName="Heading";var vS=Oi("div");vS.displayName="Box";var fK=la(function(t,n){const{size:r,centerContent:i=!0,...o}=t,a=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return W.jsx(vS,{ref:n,boxSize:r,__css:{...a,flexShrink:0,flexGrow:0},...o})});fK.displayName="Square";var ALe=la(function(t,n){const{size:r,...i}=t;return W.jsx(fK,{size:r,ref:n,borderRadius:"9999px",...i})});ALe.displayName="Circle";var HP=la(function(t,n){const{direction:r,align:i,justify:o,wrap:a,basis:s,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:a,flexBasis:s,flexGrow:l,flexShrink:u};return W.jsx(Oi.div,{ref:n,__css:d,...c})});HP.displayName="Flex";const ELe=z.object({status:z.literal(422),data:z.object({detail:z.array(z.object({loc:z.array(z.string()),msg:z.string(),type:z.string()}))})});function _o(e,t,n=!1){e=String(e),t=String(t);const r=Array.from({length:21},(a,s)=>s*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return r.reduce((a,s,l)=>{const u=n?i[l]/100:1,c=n?50:i[r.length-1-l];return a[s]=`hsl(${e} ${t}% ${c}% / ${u})`,a},{})}const _1={H:220,S:16},S1={H:250,S:42},x1={H:47,S:42},w1={H:40,S:70},C1={H:28,S:42},A1={H:113,S:42},E1={H:0,S:42},TLe={base:_o(_1.H,_1.S),baseAlpha:_o(_1.H,_1.S,!0),accent:_o(S1.H,S1.S),accentAlpha:_o(S1.H,S1.S,!0),working:_o(x1.H,x1.S),workingAlpha:_o(x1.H,x1.S,!0),gold:_o(w1.H,w1.S),goldAlpha:_o(w1.H,w1.S,!0),warning:_o(C1.H,C1.S),warningAlpha:_o(C1.H,C1.S,!0),ok:_o(A1.H,A1.S),okAlpha:_o(A1.H,A1.S,!0),error:_o(E1.H,E1.S),errorAlpha:_o(E1.H,E1.S,!0)},{definePartsStyle:kLe,defineMultiStyleConfig:PLe}=Pt(oq.keys),ILe={border:"none"},RLe=e=>{const{colorScheme:t}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:K(`${t}.200`,`${t}.700`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.250`,`${t}.650`)(e)},_expanded:{bg:K(`${t}.250`,`${t}.650`)(e),borderBottomRadius:"none",_hover:{bg:K(`${t}.300`,`${t}.600`)(e)}}}},OLe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.100`,`${t}.800`)(e),borderRadius:"base",borderTopRadius:"none"}},MLe={},$Le=kLe(e=>({container:ILe,button:RLe(e),panel:OLe(e),icon:MLe})),NLe=PLe({variants:{invokeAI:$Le},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),DLe=e=>{const{colorScheme:t}=e;if(t==="base"){const r={bg:K("base.150","base.700")(e),color:K("base.300","base.500")(e),svg:{fill:K("base.300","base.500")(e)},opacity:1},i={bg:"none",color:K("base.300","base.500")(e),svg:{fill:K("base.500","base.500")(e)},opacity:1};return{bg:K("base.250","base.600")(e),color:K("base.850","base.100")(e),borderRadius:"base",svg:{fill:K("base.850","base.100")(e)},_hover:{bg:K("base.300","base.500")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.900","base.50")(e)},_disabled:r},_disabled:r,'&[data-progress="true"]':{...i,_hover:i}}}const n={bg:K(`${t}.400`,`${t}.700`)(e),color:K(`${t}.600`,`${t}.500`)(e),svg:{fill:K(`${t}.600`,`${t}.500`)(e),filter:"unset"},opacity:.7,filter:"saturate(65%)"};return{bg:K(`${t}.400`,`${t}.600`)(e),color:K("base.50","base.100")(e),borderRadius:"base",svg:{fill:K("base.50","base.100")(e)},_disabled:n,_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)},_disabled:n}}},LLe=e=>{const{colorScheme:t}=e,n=K("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",_hover:{bg:K(`${t}.500`,`${t}.500`)(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}},".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}},FLe={variants:{invokeAI:DLe,invokeAIOutline:LLe},defaultProps:{variant:"invokeAI",colorScheme:"base"}},{definePartsStyle:BLe,defineMultiStyleConfig:zLe}=Pt(aq.keys),jLe=e=>{const{colorScheme:t}=e;return{bg:K("base.200","base.700")(e),borderColor:K("base.300","base.600")(e),color:K("base.900","base.100")(e),_checked:{bg:K(`${t}.300`,`${t}.500`)(e),borderColor:K(`${t}.300`,`${t}.500`)(e),color:K(`${t}.900`,`${t}.100`)(e),_hover:{bg:K(`${t}.400`,`${t}.500`)(e),borderColor:K(`${t}.400`,`${t}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:K(`${t}.300`,`${t}.600`)(e),borderColor:K(`${t}.300`,`${t}.600`)(e),color:K(`${t}.900`,`${t}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"none",outline:"none"},_invalid:{borderColor:K("error.600","error.300")(e)}}},ULe=BLe(e=>({control:jLe(e)})),VLe=zLe({variants:{invokeAI:ULe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:GLe,defineMultiStyleConfig:HLe}=Pt(sq.keys),qLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},WLe=e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:K("accent.900","accent.50")(e),bg:K("accent.200","accent.400")(e)}}),KLe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},QLe=GLe(e=>({preview:qLe,input:WLe(e),textarea:KLe})),XLe=HLe({variants:{invokeAI:QLe},defaultProps:{size:"sm",variant:"invokeAI"}}),YLe=e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:K("base.700","base.300")(e),_invalid:{color:K("error.500","error.300")(e)}}),ZLe={variants:{invokeAI:YLe},defaultProps:{variant:"invokeAI"}},Iw=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:K("base.200","base.800")(e),bg:K("base.50","base.900")(e),borderRadius:"base",color:K("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:K("base.300","base.600")(e)},_focus:{borderColor:K("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:K("accent.300","accent.500")(e)}},_invalid:{borderColor:K("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:K("error.400","error.500")(e)}},_disabled:{borderColor:K("base.300","base.700")(e),bg:K("base.300","base.700")(e),color:K("base.600","base.400")(e),_hover:{borderColor:K("base.300","base.700")(e)}},_placeholder:{color:K("base.700","base.400")(e)},"::selection":{bg:K("accent.200","accent.400")(e)}}),{definePartsStyle:JLe,defineMultiStyleConfig:eFe}=Pt(lq.keys),tFe=JLe(e=>({field:Iw(e)})),nFe=eFe({variants:{invokeAI:tFe},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:rFe,defineMultiStyleConfig:iFe}=Pt(uq.keys),oFe=rFe(e=>({button:{fontWeight:500,bg:K("base.300","base.500")(e),color:K("base.900","base.100")(e),_hover:{bg:K("base.400","base.600")(e),color:K("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:K("base.900","base.150")(e),bg:K("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:K("base.200","base.800")(e),_hover:{bg:K("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:K("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),aFe=iFe({variants:{invokeAI:oFe},defaultProps:{variant:"invokeAI"}}),PQe={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},{defineMultiStyleConfig:sFe,definePartsStyle:lFe}=Pt(cq.keys),uFe=e=>({bg:K("blackAlpha.700","blackAlpha.700")(e)}),cFe={},dFe=()=>({layerStyle:"first",maxH:"80vh"}),fFe=()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"}),hFe={},pFe={overflowY:"scroll"},gFe={},mFe=lFe(e=>({overlay:uFe(e),dialogContainer:cFe,dialog:dFe(),header:fFe(),closeButton:hFe,body:pFe,footer:gFe})),yFe=sFe({variants:{invokeAI:mFe},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:vFe,definePartsStyle:bFe}=Pt(dq.keys),_Fe=e=>({height:8}),SFe=e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...Iw(e)}),xFe=e=>({display:"flex"}),wFe=e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:K("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:K("base.900","base.100")(e)}}}),CFe=bFe(e=>({root:_Fe(e),field:SFe(e),stepperGroup:xFe(e),stepper:wFe(e)})),AFe=vFe({variants:{invokeAI:CFe},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:EFe,definePartsStyle:hK}=Pt(fq.keys),pK=hr("popper-bg"),gK=hr("popper-arrow-bg"),mK=hr("popper-arrow-shadow-color"),TFe=e=>({[gK.variable]:K("colors.base.100","colors.base.800")(e),[pK.variable]:K("colors.base.100","colors.base.800")(e),[mK.variable]:K("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:K("base.100","base.800")(e),border:"none",shadow:"dark-lg"}),kFe=e=>({[gK.variable]:K("colors.base.100","colors.base.700")(e),[pK.variable]:K("colors.base.100","colors.base.700")(e),[mK.variable]:K("colors.base.400","colors.base.400")(e),p:4,bg:K("base.100","base.700")(e),border:"none",shadow:"dark-lg"}),PFe=hK(e=>({content:TFe(e),body:{padding:0}})),IFe=hK(e=>({content:kFe(e),body:{padding:0}})),RFe=EFe({variants:{invokeAI:PFe,informational:IFe},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:OFe,definePartsStyle:MFe}=Pt(hq.keys),$Fe=e=>({bg:"accentAlpha.700"}),NFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.200`,`${t}.700`)(e)}},DFe=MFe(e=>({filledTrack:$Fe(e),track:NFe(e)})),LFe=OFe({variants:{invokeAI:DFe},defaultProps:{variant:"invokeAI"}}),FFe={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:BFe,defineMultiStyleConfig:zFe}=Pt(pq.keys),jFe=e=>({color:K("base.200","base.300")(e)}),UFe=e=>({fontWeight:"600",...Iw(e)}),VFe=BFe(e=>({field:UFe(e),icon:jFe(e)})),GFe=zFe({variants:{invokeAI:VFe},defaultProps:{size:"sm",variant:"invokeAI"}}),C$=nt("skeleton-start-color"),A$=nt("skeleton-end-color"),HFe={borderRadius:"base",maxW:"full",maxH:"full",_light:{[C$.variable]:"colors.base.250",[A$.variable]:"colors.base.450"},_dark:{[C$.variable]:"colors.base.700",[A$.variable]:"colors.base.500"}},qFe={variants:{invokeAI:HFe},defaultProps:{variant:"invokeAI"}},{definePartsStyle:WFe,defineMultiStyleConfig:KFe}=Pt(gq.keys),QFe=e=>({bg:K("base.400","base.600")(e),h:1.5}),XFe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.400`,`${t}.600`)(e),h:1.5}},YFe=e=>({w:e.orientation==="horizontal"?2:4,h:e.orientation==="horizontal"?4:2,bg:K("base.50","base.100")(e)}),ZFe=e=>({fontSize:"2xs",fontWeight:"500",color:K("base.700","base.400")(e),mt:2,insetInlineStart:"unset"}),JFe=WFe(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:QFe(e),filledTrack:XFe(e),thumb:YFe(e),mark:ZFe(e)})),eBe=KFe({variants:{invokeAI:JFe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:tBe,definePartsStyle:nBe}=Pt(mq.keys),rBe=e=>{const{colorScheme:t}=e;return{bg:K("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:K(`${t}.400`,`${t}.500`)(e)}}},iBe=e=>{const{colorScheme:t}=e;return{bg:K(`${t}.50`,`${t}.50`)(e)}},oBe=nBe(e=>({container:{},track:rBe(e),thumb:iBe(e)})),aBe=tBe({variants:{invokeAI:oBe},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:sBe,definePartsStyle:yK}=Pt(yq.keys),lBe=e=>({display:"flex",columnGap:4}),uBe=e=>({}),cBe=e=>{const{colorScheme:t}=e;return{display:"flex",flexDirection:"column",gap:1,color:K("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:K("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:K("base.700","base.300")(e)},_selected:{bg:K("accent.400","accent.600")(e),color:K("base.50","base.100")(e),svg:{fill:K("base.50","base.100")(e),filter:K(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-800))`)(e)},_hover:{bg:K("accent.500","accent.500")(e),color:K("white","base.50")(e),svg:{fill:K("white","base.50")(e)}}},_hover:{bg:K("base.100","base.800")(e),color:K("base.900","base.50")(e),svg:{fill:K("base.800","base.100")(e)}}}}},dBe=e=>({padding:0,height:"100%"}),fBe=yK(e=>({root:lBe(e),tab:uBe(e),tablist:cBe(e),tabpanel:dBe(e)})),hBe=yK(e=>({tab:{borderTopRadius:"base",px:4,py:1,fontSize:"sm",color:K("base.600","base.400")(e),fontWeight:500,_selected:{color:K("accent.600","accent.400")(e)}},tabpanel:{p:0,pt:4,w:"full",h:"full"},tabpanels:{w:"full",h:"full"}})),pBe=sBe({variants:{line:hBe,appTabs:fBe},defaultProps:{variant:"appTabs",colorScheme:"accent"}}),gBe=e=>({color:K("error.500","error.400")(e)}),mBe=e=>({color:K("base.500","base.400")(e)}),yBe={variants:{subtext:mBe,error:gBe}},vBe=e=>({...Iw(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, var(--invokeai-colors-base-50) 0%, var(--invokeai-colors-base-50) 70%, var(--invokeai-colors-base-200) 70%, var(--invokeai-colors-base-200) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, var(--invokeai-colors-base-50) 0%, var(--invokeai-colors-base-50) 70%, var(--invokeai-colors-base-200) 70%, var(--invokeai-colors-base-200) 100%)`}},_dark:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, var(--invokeai-colors-base-900) 0%, var(--invokeai-colors-base-900) 70%, var(--invokeai-colors-base-800) 70%, var(--invokeai-colors-base-800) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, var(--invokeai-colors-base-900) 0%, var(--invokeai-colors-base-900) 70%, var(--invokeai-colors-base-800) 70%, var(--invokeai-colors-base-800) 100%)`}}},p:2}),bBe={variants:{invokeAI:vBe},defaultProps:{size:"md",variant:"invokeAI"}},_Be=hr("popper-arrow-bg"),SBe=e=>({borderRadius:"base",shadow:"dark-lg",bg:K("base.700","base.200")(e),[_Be.variable]:K("colors.base.700","colors.base.200")(e),pb:1.5}),xBe={baseStyle:SBe},E$={backgroundColor:"accentAlpha.150 !important",borderColor:"accentAlpha.700 !important",borderRadius:"base !important",borderStyle:"dashed !important",_dark:{borderColor:"accent.400 !important"}},wBe={".react-flow__nodesselection-rect":{...E$,padding:"1rem !important",boxSizing:"content-box !important",transform:"translate(-1rem, -1rem) !important"},".react-flow__selection":E$},CBe={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},third:{bg:"base.300",color:"base.900",".chakra-ui-dark &":{bg:"base.750",color:"base.100"}},nodeBody:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},nodeHeader:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}},nodeFooter:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...FFe},...wBe})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif",heading:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-400)",dark:"0 0 0 3px var(--invokeai-colors-accent-500)"},nodeHovered:{light:"0 0 0 2px var(--invokeai-colors-accent-500)",dark:"0 0 0 2px var(--invokeai-colors-accent-400)"},nodeHoveredSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-500)",dark:"0 0 0 3px var(--invokeai-colors-accent-400)"},nodeInProgress:{light:"0 0 0 2px var(--invokeai-colors-accent-500), 0 0 10px 2px var(--invokeai-colors-accent-600)",dark:"0 0 0 2px var(--invokeai-colors-yellow-400), 0 0 20px 2px var(--invokeai-colors-orange-700)"}},colors:TLe,components:{Button:FLe,Input:nFe,Editable:XLe,Textarea:bBe,Tabs:pBe,Progress:LFe,Accordion:NLe,FormLabel:ZLe,Switch:aBe,NumberInput:AFe,Select:GFe,Skeleton:qFe,Slider:eBe,Popover:RFe,Modal:yFe,Checkbox:VLe,Menu:aFe,Text:yBe,Tooltip:xBe}},ABe={defaultOptions:{isClosable:!0}},{toast:xg}=SLe({theme:CBe,defaultOptions:ABe.defaultOptions}),EBe=()=>{Me({matcher:Er.endpoints.enqueueBatch.matchFulfilled,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;be("queue").debug({enqueueResult:Xt(t)},"Batch enqueued"),xg.isActive("batch-queued")||xg({id:"batch-queued",title:Z("queue.batchQueued"),description:Z("queue.batchQueuedDesc",{count:t.enqueued,direction:n.prepend?Z("queue.front"):Z("queue.back")}),duration:1e3,status:"success"})}}),Me({matcher:Er.endpoints.enqueueBatch.matchRejected,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;if(!t){xg({title:Z("queue.batchFailedToQueue"),status:"error",description:"Unknown Error"}),be("queue").error({batchConfig:Xt(n),error:Xt(t)},Z("queue.batchFailedToQueue"));return}const r=ELe.safeParse(t);if(r.success)r.data.data.detail.map(i=>{xg({id:"batch-failed-to-queue",title:gI(BF(i.msg),{length:128}),status:"error",description:gI(`Path: ${i.loc.join(".")}`,{length:128})})});else{let i="Unknown Error",o;t.status===403&&"body"in t?i=vh(t,"body.detail","Unknown Error"):t.status===403&&"error"in t?i=vh(t,"error.detail","Unknown Error"):t.status===403&&"data"in t&&(i=vh(t,"data.detail","Unknown Error"),o=15e3),xg({title:Z("queue.batchFailedToQueue"),status:"error",description:i,...o?{duration:o}:{}})}be("queue").error({batchConfig:Xt(n),error:Xt(t)},Z("queue.batchFailedToQueue"))}})};function XE(e){"@babel/helpers - typeof";return XE=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},XE(e)}var vK=[],TBe=vK.forEach,kBe=vK.slice;function YE(e){return TBe.call(kBe.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function bK(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":XE(XMLHttpRequest))==="object"}function PBe(e){return!!e&&typeof e.then=="function"}function IBe(e){return PBe(e)?e:Promise.resolve(e)}function RBe(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 ZE={exports:{}},T1={exports:{}},T$;function OBe(){return T$||(T$=1,function(e,t){var n=typeof self<"u"?self:yt,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var s={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(s.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(A){return A&&u.indexOf(Object.prototype.toString.call(A))>-1};function d(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 f(A){return typeof A!="string"&&(A=String(A)),A}function h(A){var P={next:function(){var D=A.shift();return{done:D===void 0,value:D}}};return s.iterable&&(P[Symbol.iterator]=function(){return P}),P}function p(A){this.map={},A instanceof p?A.forEach(function(P,D){this.append(D,P)},this):Array.isArray(A)?A.forEach(function(P){this.append(P[0],P[1])},this):A&&Object.getOwnPropertyNames(A).forEach(function(P){this.append(P,A[P])},this)}p.prototype.append=function(A,P){A=d(A),P=f(P);var D=this.map[A];this.map[A]=D?D+", "+P:P},p.prototype.delete=function(A){delete this.map[d(A)]},p.prototype.get=function(A){return A=d(A),this.has(A)?this.map[A]:null},p.prototype.has=function(A){return this.map.hasOwnProperty(d(A))},p.prototype.set=function(A,P){this.map[d(A)]=f(P)},p.prototype.forEach=function(A,P){for(var D in this.map)this.map.hasOwnProperty(D)&&A.call(P,this.map[D],D,this)},p.prototype.keys=function(){var A=[];return this.forEach(function(P,D){A.push(D)}),h(A)},p.prototype.values=function(){var A=[];return this.forEach(function(P){A.push(P)}),h(A)},p.prototype.entries=function(){var A=[];return this.forEach(function(P,D){A.push([D,P])}),h(A)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(A){if(A.bodyUsed)return Promise.reject(new TypeError("Already read"));A.bodyUsed=!0}function _(A){return new Promise(function(P,D){A.onload=function(){P(A.result)},A.onerror=function(){D(A.error)}})}function b(A){var P=new FileReader,D=_(P);return P.readAsArrayBuffer(A),D}function y(A){var P=new FileReader,D=_(P);return P.readAsText(A),D}function g(A){for(var P=new Uint8Array(A),D=new Array(P.length),L=0;L-1?P:A}function C(A,P){P=P||{};var D=P.body;if(A instanceof C){if(A.bodyUsed)throw new TypeError("Already read");this.url=A.url,this.credentials=A.credentials,P.headers||(this.headers=new p(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=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new p(P.headers)),this.method=w(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.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)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function T(A){var P=new FormData;return A.trim().split("&").forEach(function(D){if(D){var L=D.split("="),M=L.shift().replace(/\+/g," "),R=L.join("=").replace(/\+/g," ");P.append(decodeURIComponent(M),decodeURIComponent(R))}}),P}function E(A){var P=new p,D=A.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(L){var M=L.split(":"),R=M.shift().trim();if(R){var $=M.join(":").trim();P.append(R,$)}}),P}S.call(C.prototype);function k(A,P){P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in P?P.statusText:"OK",this.headers=new p(P.headers),this.url=P.url||"",this._initBody(A)}S.call(k.prototype),k.prototype.clone=function(){return new k(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},k.error=function(){var A=new k(null,{status:0,statusText:""});return A.type="error",A};var N=[301,302,303,307,308];k.redirect=function(A,P){if(N.indexOf(P)===-1)throw new RangeError("Invalid status code");return new k(null,{status:P,headers:{location:A}})},a.DOMException=o.DOMException;try{new a.DOMException}catch{a.DOMException=function(P,D){this.message=P,this.name=D;var L=Error(P);this.stack=L.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function O(A,P){return new Promise(function(D,L){var M=new C(A,P);if(M.signal&&M.signal.aborted)return L(new a.DOMException("Aborted","AbortError"));var R=new XMLHttpRequest;function $(){R.abort()}R.onload=function(){var B={status:R.status,statusText:R.statusText,headers:E(R.getAllResponseHeaders()||"")};B.url="responseURL"in R?R.responseURL:B.headers.get("X-Request-URL");var U="response"in R?R.response:R.responseText;D(new k(U,B))},R.onerror=function(){L(new TypeError("Network request failed"))},R.ontimeout=function(){L(new TypeError("Network request failed"))},R.onabort=function(){L(new a.DOMException("Aborted","AbortError"))},R.open(M.method,M.url,!0),M.credentials==="include"?R.withCredentials=!0:M.credentials==="omit"&&(R.withCredentials=!1),"responseType"in R&&s.blob&&(R.responseType="blob"),M.headers.forEach(function(B,U){R.setRequestHeader(U,B)}),M.signal&&(M.signal.addEventListener("abort",$),R.onreadystatechange=function(){R.readyState===4&&M.signal.removeEventListener("abort",$)}),R.send(typeof M._bodyInit>"u"?null:M._bodyInit)})}return O.polyfill=!0,o.fetch||(o.fetch=O,o.Headers=p,o.Request=C,o.Response=k),a.Headers=p,a.Request=C,a.Response=k,a.fetch=O,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(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}(T1,T1.exports)),T1.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof yt<"u"&&yt.fetch?n=yt.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof RBe<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||OBe();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(ZE,ZE.exports);var _K=ZE.exports;const SK=xc(_K),k$=aN({__proto__:null,default:SK},[_K]);function bS(e){"@babel/helpers - typeof";return bS=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},bS(e)}var Gl;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Gl=global.fetch:typeof window<"u"&&window.fetch?Gl=window.fetch:Gl=fetch);var W0;bK()&&(typeof global<"u"&&global.XMLHttpRequest?W0=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(W0=window.XMLHttpRequest));var _S;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?_S=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(_S=window.ActiveXObject));!Gl&&k$&&!W0&&!_S&&(Gl=SK||k$);typeof Gl!="function"&&(Gl=void 0);var JE=function(t,n){if(n&&bS(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},P$=function(t,n,r){Gl(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)},I$=!1,MBe=function(t,n,r,i){t.queryStringParams&&(n=JE(n,t.queryStringParams));var o=YE({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=YE({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},I$?{}:a);try{P$(n,s,i)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(a).forEach(function(u){delete s[u]}),P$(n,s,i),I$=!0}catch(u){i(u)}}},$Be=function(t,n,r,i){r&&bS(r)==="object"&&(r=JE("",r).slice(1)),t.queryStringParams&&(n=JE(n,t.queryStringParams));try{var o;W0?o=new W0:o=new _S("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 a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)o.setRequestHeader(s,a[s]);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)}},NBe=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Gl&&n.indexOf("file:")!==0)return MBe(t,n,r,i);if(bK()||typeof ActiveXObject=="function")return $Be(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function K0(e){"@babel/helpers - typeof";return K0=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},K0(e)}function DBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R$(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};DBe(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return LBe(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=YE(i,this.options||{},zBe()),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,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=IBe(l),l.then(function(u){if(!u)return a(null,{});var c=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(c,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this,s=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=a.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,o,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,c=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var p=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,p,l,function(m,_){u+=1,c.push(m),d.push(_),u===n.length&&typeof a=="function"&&a(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,a=r.logger,s=i.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();wK.type="backend";me.use(wK).use(m4e).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const jBe=Qi(B4,j4,z4,Sy),UBe=()=>{Me({matcher:jBe,effect:async(e,{dispatch:t,getOriginalState:n})=>{var s;const r=n().controlAdapters,i=Pa(r).some(l=>l.isEnabled&&l.type==="controlnet"),o=Pa(r).some(l=>l.isEnabled&&l.type==="t2i_adapter");let a=null;if(B4.match(e)&&(a=e.payload.type),j4.match(e)&&(a=e.payload.type),z4.match(e)&&(a=e.payload.type),Sy.match(e)){const l=(s=eo(r,e.payload.id))==null?void 0:s.type;if(!l)return;a=l}if(a==="controlnet"&&o||a==="t2i_adapter"&&i){const l=a==="controlnet"?me.t("controlnet.controlNetEnabledT2IDisabled"):me.t("controlnet.t2iEnabledControlNetDisabled"),u=me.t("controlnet.controlNetT2IMutexDesc");t(Ht({title:l,description:u,status:"warning"}))}}})},CK=aF(),Me=CK.startListening;bEe();_Ee();AEe();cEe();dEe();fEe();hEe();pEe();owe();vEe();SEe();xEe();HAe();sEe();ZAe();ewe();EBe();EAe();xAe();Swe();wAe();_we();vwe();AAe();e4e();Yxe();UTe();VTe();HTe();qTe();KTe();zTe();jTe();ZTe();JTe();QTe();YTe();WTe();XTe();IAe();kAe();lEe();uEe();mEe();yEe();awe();BTe();O4e();gEe();EEe();rwe();kEe();twe();Zxe();A4e();n4e();REe();UBe();const VBe={canvas:yue,gallery:aye,generation:oue,nodes:L2e,postprocessing:F2e,system:H2e,config:Qae,ui:exe,hotkeys:J2e,controlAdapters:Lse,dynamicPrompts:Pue,deleteImageModal:xue,changeBoardModal:bue,lora:uye,modelmanager:Z2e,sdxl:z2e,queue:X2e,[gs.reducerPath]:gs.reducer},GBe=wp(VBe),HBe=Axe(GBe),qBe=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlAdapters","dynamicPrompts","lora","modelmanager"],AK=zL({reducer:HBe,enhancers:e=>e.concat(Exe(window.localStorage,qBe,{persistDebounce:300,serialize:Fxe,unserialize:zxe,prefix:Txe})).concat(lF()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(gs.middleware).concat(ixe).prepend(CK.middleware),devTools:{actionSanitizer:qxe,stateSanitizer:Kxe,trace:!0,predicate:(e,t)=>!Wxe.includes(t.type)}}),EK=e=>e;oj.set(AK);const WBe=e=>{const{socket:t,storeApi:n}=e,{dispatch:r}=n;t.on("connect",()=>{be("socketio").debug("Connected"),r(OB());const o=Gr.get();t.emit("subscribe_queue",{queue_id:o})}),t.on("connect_error",i=>{i&&i.message&&i.data==="ERR_UNAUTHENTICATED"&&r(Ht(Gd({title:i.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(MB())}),t.on("invocation_started",i=>{r(NB({data:i}))}),t.on("generator_progress",i=>{r(BB({data:i}))}),t.on("invocation_error",i=>{r(DB({data:i}))}),t.on("invocation_complete",i=>{r(M4({data:i}))}),t.on("graph_execution_state_complete",i=>{r(LB({data:i}))}),t.on("model_load_started",i=>{r(zB({data:i}))}),t.on("model_load_completed",i=>{r(UB({data:i}))}),t.on("session_retrieval_error",i=>{r(GB({data:i}))}),t.on("invocation_retrieval_error",i=>{r(qB({data:i}))}),t.on("queue_item_status_changed",i=>{r(KB({data:i}))})},il=Object.create(null);il.open="0";il.close="1";il.ping="2";il.pong="3";il.message="4";il.upgrade="5";il.noop="6";const Sb=Object.create(null);Object.keys(il).forEach(e=>{Sb[il[e]]=e});const eT={type:"error",data:"parser error"},TK=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",kK=typeof ArrayBuffer=="function",PK=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,qP=({type:e,data:t},n,r)=>TK&&t instanceof Blob?n?r(t):O$(t,r):kK&&(t instanceof ArrayBuffer||PK(t))?n?r(t):O$(new Blob([t]),r):r(il[e]+(t||"")),O$=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function M$(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let e3;function KBe(e,t){if(TK&&e.data instanceof Blob)return e.data.arrayBuffer().then(M$).then(t);if(kK&&(e.data instanceof ArrayBuffer||PK(e.data)))return t(M$(e.data));qP(e,!1,n=>{e3||(e3=new TextEncoder),t(e3.encode(n))})}const $$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<$$.length;e++)Vg[$$.charCodeAt(e)]=e;const QBe=e=>{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(a&15)<<4|s>>2,c[i++]=(s&3)<<6|l&63;return u},XBe=typeof ArrayBuffer=="function",WP=(e,t)=>{if(typeof e!="string")return{type:"message",data:IK(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:YBe(e.substring(1),t)}:Sb[n]?e.length>1?{type:Sb[n],data:e.substring(1)}:{type:Sb[n]}:eT},YBe=(e,t)=>{if(XBe){const n=QBe(e);return IK(n,t)}else return{base64:!0,data:e}},IK=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},RK=String.fromCharCode(30),ZBe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{qP(o,!1,s=>{r[a]=s,++i===n&&t(r.join(RK))})})},JBe=(e,t)=>{const n=e.split(RK),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let t3;function k1(e){return e.reduce((t,n)=>t+n.length,0)}function P1(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(eT);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(k1(n)e){s.enqueue(eT);break}}}})}const OK=4;function Br(e){if(e)return nze(e)}function nze(e){for(var t in Br.prototype)e[t]=Br.prototype[t];return e}Br.prototype.on=Br.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Br.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Br.prototype.off=Br.prototype.removeListener=Br.prototype.removeAllListeners=Br.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 MK(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const rze=Sa.setTimeout,ize=Sa.clearTimeout;function Rw(e,t){t.useNativeTimers?(e.setTimeoutFn=rze.bind(Sa),e.clearTimeoutFn=ize.bind(Sa)):(e.setTimeoutFn=Sa.setTimeout.bind(Sa),e.clearTimeoutFn=Sa.clearTimeout.bind(Sa))}const oze=1.33;function aze(e){return typeof e=="string"?sze(e):Math.ceil((e.byteLength||e.size)*oze)}function sze(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function lze(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function uze(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function NK(){const e=L$(+new Date);return e!==D$?(N$=0,D$=e):e+"."+L$(N$++)}for(;I1{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)};JBe(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,ZBe(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]=NK()),!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 Nh(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 Nh=class xb extends Br{constructor(t,n){super(),Rw(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=MK(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new LK(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=xb.requestsCount++,xb.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=hze,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete xb.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()}};Nh.requestsCount=0;Nh.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",F$);else if(typeof addEventListener=="function"){const e="onpagehide"in Sa?"pagehide":"unload";addEventListener(e,F$,!1)}}function F$(){for(let e in Nh.requests)Nh.requests.hasOwnProperty(e)&&Nh.requests[e].abort()}const QP=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),R1=Sa.WebSocket||Sa.MozWebSocket,B$=!0,mze="arraybuffer",z$=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class yze extends KP{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=z$?{}:MK(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=B$&&!z$?n?new R1(t,n):new R1(t):new R1(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{B$&&this.ws.send(o)}catch{}i&&QP(()=>{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]=NK()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!R1}}class vze extends KP{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=tze(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=eze();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&QP(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const bze={websocket:yze,webtransport:vze,polling:gze},_ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Sze=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function nT(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=_ze.exec(e||""),o={},a=14;for(;a--;)o[Sze[a]]=i[a]||"";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=xze(o,o.path),o.queryKey=wze(o,o.query),o}function xze(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 wze(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let FK=class Df extends Br{constructor(t,n={}){super(),this.binaryType=mze,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=nT(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=nT(n.host).host),Rw(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=uze(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=OK,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 bze[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Df.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;Df.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Df.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function s(){a("transport closed")}function l(){a("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),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",Df.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){Df.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,BK=Object.prototype.toString,Tze=typeof Blob=="function"||typeof Blob<"u"&&BK.call(Blob)==="[object BlobConstructor]",kze=typeof File=="function"||typeof File<"u"&&BK.call(File)==="[object FileConstructor]";function XP(e){return Aze&&(e instanceof ArrayBuffer||Eze(e))||Tze&&e instanceof Blob||kze&&e instanceof File}function wb(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 a=0;a{this.io.clearTimeoutFn(o),n.apply(this,[null,...a])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((a,s)=>r?a?o(a):i(s):i(a)),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:Ft.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 Ft.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 Ft.EVENT:case Ft.BINARY_EVENT:this.onevent(t);break;case Ft.ACK:case Ft.BINARY_ACK:this.onack(t);break;case Ft.DISCONNECT:this.ondisconnect();break;case Ft.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:Ft.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:Ft.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}zp.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};zp.prototype.reset=function(){this.attempts=0};zp.prototype.setMin=function(e){this.ms=e};zp.prototype.setMax=function(e){this.max=e};zp.prototype.setJitter=function(e){this.jitter=e};class oT extends Br{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,Rw(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 zp({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||Nze;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 FK(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Za(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},a=Za(n,"error",o);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Za(t,"ping",this.onping.bind(this)),Za(t,"data",this.ondata.bind(this)),Za(t,"error",this.onerror.bind(this)),Za(t,"close",this.onclose.bind(this)),Za(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){QP(()=>{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 zK(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 wg={};function Cb(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=Cze(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=wg[i]&&o in wg[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new oT(r,t):(wg[i]||(wg[i]=new oT(r,t)),l=wg[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(Cb,{Manager:oT,Socket:zK,io:Cb,connect:Cb});const U$=()=>{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 a=u0.get();a&&(n=a.replace(/^https?\:\/\//i,""));const s=rp.get();s&&(r.auth={token:s}),r.transports=["websocket","polling"]}const i=Cb(n,r);return a=>s=>l=>{e||(WBe({storeApi:a,socket:i}),e=!0,i.connect()),s(l)}},Lze=""+new URL("logo-13003d72.png",import.meta.url).href,Fze=()=>W.jsxs(HP,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[W.jsx(GP,{src:Lze,w:"8rem",h:"8rem"}),W.jsx(jP,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),Bze=I.memo(Fze),Ow=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function jp(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ZP(e){return"nodeType"in e}function go(e){var t,n;return e?jp(e)?e:ZP(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function JP(e){const{Document:t}=go(e);return e instanceof t}function Jy(e){return jp(e)?!1:e instanceof go(e).HTMLElement}function zze(e){return e instanceof go(e).SVGElement}function Up(e){return e?jp(e)?e.document:ZP(e)?JP(e)?e:Jy(e)?e.ownerDocument:document:document:document}const ol=Ow?I.useLayoutEffect:I.useEffect;function Mw(e){const t=I.useRef(e);return ol(()=>{t.current=e}),I.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=I.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Q0(e,t){t===void 0&&(t=[e]);const n=I.useRef(e);return ol(()=>{n.current!==e&&(n.current=e)},t),n}function ev(e,t){const n=I.useRef();return I.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function SS(e){const t=Mw(e),n=I.useRef(null),r=I.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function xS(e){const t=I.useRef();return I.useEffect(()=>{t.current=e},[e]),t.current}let n3={};function $w(e,t){return I.useMemo(()=>{if(t)return t;const n=n3[e]==null?0:n3[e]+1;return n3[e]=n,e+"-"+n},[e,t])}function jK(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const s=Object.entries(a);for(const[l,u]of s){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const Dh=jK(1),wS=jK(-1);function Uze(e){return"clientX"in e&&"clientY"in e}function e6(e){if(!e)return!1;const{KeyboardEvent:t}=go(e.target);return t&&e instanceof t}function Vze(e){if(!e)return!1;const{TouchEvent:t}=go(e.target);return t&&e instanceof t}function X0(e){if(Vze(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 Uze(e)?{x:e.clientX,y:e.clientY}:null}const Y0=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[Y0.Translate.toString(e),Y0.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),V$="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Gze(e){return e.matches(V$)?e:e.querySelector(V$)}const Hze={display:"none"};function qze(e){let{id:t,value:n}=e;return An.createElement("div",{id:t,style:Hze},n)}const Wze={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 Kze(e){let{id:t,announcement:n}=e;return An.createElement("div",{id:t,style:Wze,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function Qze(){const[e,t]=I.useState("");return{announce:I.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const UK=I.createContext(null);function Xze(e){const t=I.useContext(UK);I.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Yze(){const[e]=I.useState(()=>new Set),t=I.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[I.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var s;return(s=a[i])==null?void 0:s.call(a,o)})},[e]),t]}const Zze={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. `},Jze={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 eje(e){let{announcements:t=Jze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Zze}=e;const{announce:o,announcement:a}=Qze(),s=$w("DndLiveRegion"),[l,u]=I.useState(!1);if(I.useEffect(()=>{u(!0)},[]),Xze(I.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=An.createElement(An.Fragment,null,An.createElement(qze,{id:r,value:i.draggable}),An.createElement(Kze,{id:s,announcement:a}));return n?Wo.createPortal(c,n):c}var Wr;(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"})(Wr||(Wr={}));function CS(){}function G$(e,t){return I.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function tje(){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 nje(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rje(e,t){const n=X0(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 ije(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function oje(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function aje(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 sje(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function lje(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),a=i-r,s=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,s=n.get(a);if(s){const l=lje(s,t);l>0&&i.push({id:a,data:{droppableContainer:o,value:l}})}}return i.sort(oje)};function cje(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 dje=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:a}=o,s=n.get(a);if(s&&cje(r,s)){const u=aje(s).reduce((d,f)=>d+nje(r,f),0),c=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:c}})}}return i.sort(ije)};function fje(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function VK(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ms}function hje(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const pje=hje(1);function GK(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 gje(e,t,n){const r=GK(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=e.left-a-(1-i)*parseFloat(n),u=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const mje={ignoreTransform:!1};function tv(e,t){t===void 0&&(t=mje);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=go(e).getComputedStyle(e);u&&(n=gje(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function H$(e){return tv(e,{ignoreTransform:!0})}function yje(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function vje(e,t){return t===void 0&&(t=go(e).getComputedStyle(e)),t.position==="fixed"}function bje(e,t){t===void 0&&(t=go(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 t6(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(JP(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Jy(i)||zze(i)||n.includes(i))return n;const o=go(e).getComputedStyle(i);return i!==e&&bje(i,o)&&n.push(i),vje(i,o)?n:r(i.parentNode)}return e?r(e):n}function HK(e){const[t]=t6(e,1);return t??null}function r3(e){return!Ow||!e?null:jp(e)?e:ZP(e)?JP(e)||e===Up(e).scrollingElement?window:Jy(e)?e:null:null}function qK(e){return jp(e)?e.scrollX:e.scrollLeft}function WK(e){return jp(e)?e.scrollY:e.scrollTop}function aT(e){return{x:qK(e),y:WK(e)}}var ui;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ui||(ui={}));function KK(e){return!Ow||!e?!1:e===document.scrollingElement}function QK(e){const t={x:0,y:0},n=KK(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,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const _je={x:.2,y:.2};function Sje(e,t,n,r,i){let{top:o,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=_je);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=QK(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=ui.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=ui.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&s>=t.right-m.width?(h.x=ui.Forward,p.x=r*Math.abs((t.right-m.width-s)/m.width)):!d&&a<=t.left+m.width&&(h.x=ui.Backward,p.x=r*Math.abs((t.left+m.width-a)/m.width)),{direction:h,speed:p}}function xje(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}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 XK(e){return e.reduce((t,n)=>Dh(t,aT(n)),ms)}function wje(e){return e.reduce((t,n)=>t+qK(n),0)}function Cje(e){return e.reduce((t,n)=>t+WK(n),0)}function YK(e,t){if(t===void 0&&(t=tv),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);HK(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Aje=[["x",["left","right"],wje],["y",["top","bottom"],Cje]];class n6{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=t6(n),i=XK(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,s]of Aje)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vm{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 Eje(e){const{EventTarget:t}=go(e);return e instanceof t?e:Up(e)}function i3(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 va;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(va||(va={}));function q$(e){e.preventDefault()}function Tje(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 ZK={start:[On.Space,On.Enter],cancel:[On.Esc],end:[On.Space,On.Enter]},kje=(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 JK{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 vm(Up(n)),this.windowListeners=new vm(go(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(va.Resize,this.handleCancel),this.windowListeners.add(va.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(va.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&YK(r),n(ms)}handleKeyDown(t){if(e6(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=ZK,coordinateGetter:a=kje,scrollBehavior:s="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,c=u?{x:u.left,y:u.top}:ms;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=wS(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:b,isRight:y,isLeft:g,isBottom:v,maxScroll:S,minScroll:x}=QK(m),w=xje(m),C={x:Math.min(_===On.Right?w.right-w.width/2:w.right,Math.max(_===On.Right?w.left:w.left+w.width/2,d.x)),y:Math.min(_===On.Down?w.bottom-w.height/2:w.bottom,Math.max(_===On.Down?w.top:w.top+w.height/2,d.y))},T=_===On.Right&&!y||_===On.Left&&!g,E=_===On.Down&&!v||_===On.Up&&!b;if(T&&C.x!==d.x){const k=m.scrollLeft+f.x,N=_===On.Right&&k<=S.x||_===On.Left&&k>=x.x;if(N&&!f.y){m.scrollTo({left:k,behavior:s});return}N?h.x=m.scrollLeft-k:h.x=_===On.Right?m.scrollLeft-S.x:m.scrollLeft-x.x,h.x&&m.scrollBy({left:-h.x,behavior:s});break}else if(E&&C.y!==d.y){const k=m.scrollTop+f.y,N=_===On.Down&&k<=S.y||_===On.Up&&k>=x.y;if(N&&!f.x){m.scrollTo({top:k,behavior:s});return}N?h.y=m.scrollTop-k:h.y=_===On.Down?m.scrollTop-S.y:m.scrollTop-x.y,h.y&&m.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,Dh(wS(d,this.referenceCoordinates),h))}}}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()}}JK.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ZK,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function W$(e){return!!(e&&"distance"in e)}function K$(e){return!!(e&&"delay"in e)}class r6{constructor(t,n,r){var i;r===void 0&&(r=Eje(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:a}=o;this.props=t,this.events=n,this.document=Up(a),this.documentListeners=new vm(this.document),this.listeners=new vm(r),this.windowListeners=new vm(go(a)),this.initialCoordinates=(i=X0(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(va.Resize,this.handleCancel),this.windowListeners.add(va.DragStart,q$),this.windowListeners.add(va.VisibilityChange,this.handleCancel),this.windowListeners.add(va.ContextMenu,q$),this.documentListeners.add(va.Keydown,this.handleKeydown),n){if(W$(n))return;if(K$(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(va.Click,Tje,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(va.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:s}}=o;if(!i)return;const l=(n=X0(t))!=null?n:ms,u=wS(i,l);if(!r&&s){if(K$(s))return i3(u,s.tolerance)?this.handleCancel():void 0;if(W$(s))return s.tolerance!=null&&i3(u,s.tolerance)?this.handleCancel():i3(u,s.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),a(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 Pje={move:{name:"pointermove"},end:{name:"pointerup"}};class eQ extends r6{constructor(t){const{event:n}=t,r=Up(n.target);super(t,Pje,r)}}eQ.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 Ije={move:{name:"mousemove"},end:{name:"mouseup"}};var sT;(function(e){e[e.RightClick=2]="RightClick"})(sT||(sT={}));class tQ extends r6{constructor(t){super(t,Ije,Up(t.event.target))}}tQ.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===sT.RightClick?!1:(r==null||r({event:n}),!0)}}];const o3={move:{name:"touchmove"},end:{name:"touchend"}};class nQ extends r6{constructor(t){super(t,o3)}static setup(){return window.addEventListener(o3.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(o3.move.name,t)};function t(){}}}nQ.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 bm;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(bm||(bm={}));var AS;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(AS||(AS={}));function Rje(e){let{acceleration:t,activator:n=bm.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:s=AS.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=Mje({delta:d,disabled:!o}),[p,m]=jze(),_=I.useRef({x:0,y:0}),b=I.useRef({x:0,y:0}),y=I.useMemo(()=>{switch(n){case bm.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case bm.DraggableRect:return i}},[n,i,l]),g=I.useRef(null),v=I.useCallback(()=>{const x=g.current;if(!x)return;const w=_.current.x*b.current.x,C=_.current.y*b.current.y;x.scrollBy(w,C)},[]),S=I.useMemo(()=>s===AS.TreeOrder?[...u].reverse():u,[s,u]);I.useEffect(()=>{if(!o||!u.length||!y){m();return}for(const x of S){if((r==null?void 0:r(x))===!1)continue;const w=u.indexOf(x),C=c[w];if(!C)continue;const{direction:T,speed:E}=Sje(x,C,y,t,f);for(const k of["x","y"])h[k][T[k]]||(E[k]=0,T[k]=0);if(E.x>0||E.y>0){m(),g.current=x,p(v,a),_.current=E,b.current=T;return}}_.current={x:0,y:0},b.current={x:0,y:0},m()},[t,v,r,m,o,a,JSON.stringify(y),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const Oje={x:{[ui.Backward]:!1,[ui.Forward]:!1},y:{[ui.Backward]:!1,[ui.Forward]:!1}};function Mje(e){let{delta:t,disabled:n}=e;const r=xS(t);return ev(i=>{if(n||!r||!i)return Oje;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ui.Backward]:i.x[ui.Backward]||o.x===-1,[ui.Forward]:i.x[ui.Forward]||o.x===1},y:{[ui.Backward]:i.y[ui.Backward]||o.y===-1,[ui.Forward]:i.y[ui.Forward]||o.y===1}}},[n,t,r])}function $je(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return ev(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function Nje(e,t){return I.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var Z0;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Z0||(Z0={}));var lT;(function(e){e.Optimized="optimized"})(lT||(lT={}));const Q$=new Map;function Dje(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=I.useState(null),{frequency:s,measure:l,strategy:u}=i,c=I.useRef(e),d=_(),f=Q0(d),h=I.useCallback(function(b){b===void 0&&(b=[]),!f.current&&a(y=>y===null?b:y.concat(b.filter(g=>!y.includes(g))))},[f]),p=I.useRef(null),m=ev(b=>{if(d&&!n)return Q$;if(!b||b===Q$||c.current!==e||o!=null){const y=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){y.set(g.id,g.rect.current);continue}const v=g.node.current,S=v?new n6(l(v),v):null;g.rect.current=S,S&&y.set(g.id,S)}return y}return b},[e,o,n,d,l]);return I.useEffect(()=>{c.current=e},[e]),I.useEffect(()=>{d||h()},[n,d]),I.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),I.useEffect(()=>{d||typeof s!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case Z0.Always:return!1;case Z0.BeforeDragging:return n;default:return!n}}}function i6(e,t){return ev(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Lje(e,t){return i6(e,t)}function Fje(e){let{callback:t,disabled:n}=e;const r=Mw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Nw(e){let{callback:t,disabled:n}=e;const r=Mw(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Bje(e){return new n6(tv(e),e)}function X$(e,t,n){t===void 0&&(t=Bje);const[r,i]=I.useReducer(s,null),o=Fje({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=Nw({callback:i});return ol(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function zje(e){const t=i6(e);return VK(e,t)}const Y$=[];function jje(e){const t=I.useRef(e),n=ev(r=>e?r&&r!==Y$&&e&&t.current&&e.parentNode===t.current.parentNode?r:t6(e):Y$,[e]);return I.useEffect(()=>{t.current=e},[e]),n}function Uje(e){const[t,n]=I.useState(null),r=I.useRef(e),i=I.useCallback(o=>{const a=r3(o.target);a&&n(s=>s?(s.set(a,aT(a)),new Map(s)):null)},[]);return I.useEffect(()=>{const o=r.current;if(e!==o){a(o);const s=e.map(l=>{const u=r3(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,aT(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(o)};function a(s){s.forEach(l=>{const u=r3(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),I.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>Dh(o,a),ms):XK(e):ms,[e,t])}function Z$(e,t){t===void 0&&(t=[]);const n=I.useRef(null);return I.useEffect(()=>{n.current=null},t),I.useEffect(()=>{const r=e!==ms;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?wS(e,n.current):ms}function Vje(e){I.useEffect(()=>{if(!Ow)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 Gje(e,t){return I.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function rQ(e){return I.useMemo(()=>e?yje(e):null,[e])}const a3=[];function Hje(e,t){t===void 0&&(t=tv);const[n]=e,r=rQ(n?go(n):null),[i,o]=I.useReducer(s,a3),a=Nw({callback:o});return e.length>0&&i===a3&&o(),ol(()=>{e.length?e.forEach(l=>a==null?void 0:a.observe(l)):(a==null||a.disconnect(),o())},[e]),i;function s(){return e.length?e.map(l=>KK(l)?r:new n6(t(l),l)):a3}}function iQ(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Jy(t)?t:e}function qje(e){let{measure:t}=e;const[n,r]=I.useState(null),i=I.useCallback(u=>{for(const{target:c}of u)if(Jy(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=Nw({callback:i}),a=I.useCallback(u=>{const c=iQ(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[s,l]=SS(a);return I.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const Wje=[{sensor:eQ,options:{}},{sensor:JK,options:{}}],Kje={current:{}},Ab={draggable:{measure:H$},droppable:{measure:H$,strategy:Z0.WhileDragging,frequency:lT.Optimized},dragOverlay:{measure:tv}};class _m 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 Qje={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _m,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:CS},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ab,measureDroppableContainers:CS,windowRect:null,measuringScheduled:!1},oQ={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:CS,draggableNodes:new Map,over:null,measureDroppableContainers:CS},nv=I.createContext(oQ),aQ=I.createContext(Qje);function Xje(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _m}}}function Yje(e,t){switch(t.type){case Wr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Wr.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 Wr.DragEnd:case Wr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Wr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new _m(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Wr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new _m(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case Wr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new _m(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Zje(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=I.useContext(nv),o=xS(r),a=xS(n==null?void 0:n.id);return I.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!e6(o)||document.activeElement===o.target)return;const s=i.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=Gze(c);if(d){d.focus();break}}})}},[r,t,i,a,o]),null}function sQ(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function Jje(e){return I.useMemo(()=>({draggable:{...Ab.draggable,...e==null?void 0:e.draggable},droppable:{...Ab.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ab.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 eUe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=I.useRef(!1),{x:a,y:s}=typeof i=="boolean"?{x:i,y:i}:i;ol(()=>{if(!a&&!s||!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 c=n(u),d=VK(c,r);if(a||(d.x=0),s||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=HK(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const Dw=I.createContext({...ms,scaleX:1,scaleY:1});var Pu;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Pu||(Pu={}));const tUe=I.memo(function(t){var n,r,i,o;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:c=Wje,collisionDetection:d=uje,measuring:f,modifiers:h,...p}=t;const m=I.useReducer(Yje,void 0,Xje),[_,b]=m,[y,g]=Yze(),[v,S]=I.useState(Pu.Uninitialized),x=v===Pu.Initialized,{draggable:{active:w,nodes:C,translate:T},droppable:{containers:E}}=_,k=w?C.get(w):null,N=I.useRef({initial:null,translated:null}),O=I.useMemo(()=>{var Bn;return w!=null?{id:w,data:(Bn=k==null?void 0:k.data)!=null?Bn:Kje,rect:N}:null},[w,k]),A=I.useRef(null),[P,D]=I.useState(null),[L,M]=I.useState(null),R=Q0(p,Object.values(p)),$=$w("DndDescribedBy",a),B=I.useMemo(()=>E.getEnabled(),[E]),U=Jje(f),{droppableRects:G,measureDroppableContainers:Y,measuringScheduled:ee}=Dje(B,{dragging:x,dependencies:[T.x,T.y],config:U.droppable}),J=$je(C,w),j=I.useMemo(()=>L?X0(L):null,[L]),Q=fl(),ne=Lje(J,U.draggable.measure);eUe({activeNode:w?C.get(w):null,config:Q.layoutShiftCompensation,initialRect:ne,measure:U.draggable.measure});const se=X$(J,U.draggable.measure,ne),Se=X$(J?J.parentElement:null),ce=I.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:E,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),bt=E.getNodeFor((n=ce.current.over)==null?void 0:n.id),ot=qje({measure:U.dragOverlay.measure}),ze=(r=ot.nodeRef.current)!=null?r:J,mt=x?(i=ot.rect)!=null?i:se:null,Ie=!!(ot.nodeRef.current&&ot.rect),en=zje(Ie?null:se),Ir=rQ(ze?go(ze):null),Dn=jje(x?bt??J:null),Tn=Hje(Dn),tn=sQ(h,{transform:{x:T.x-en.x,y:T.y-en.y,scaleX:1,scaleY:1},activatorEvent:L,active:O,activeNodeRect:se,containerNodeRect:Se,draggingNodeRect:mt,over:ce.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Dn,scrollableAncestorRects:Tn,windowRect:Ir}),Ln=j?Dh(j,T):null,Rr=Uje(Dn),mo=Z$(Rr),Jr=Z$(Rr,[se]),pr=Dh(tn,mo),zr=mt?pje(mt,tn):null,ei=O&&zr?d({active:O,collisionRect:zr,droppableRects:G,droppableContainers:B,pointerCoordinates:Ln}):null,Fn=sje(ei,"id"),[_n,Mi]=I.useState(null),gi=Ie?tn:Dh(tn,Jr),Xi=fje(gi,(o=_n==null?void 0:_n.rect)!=null?o:null,se),Ua=I.useCallback((Bn,nn)=>{let{sensor:jr,options:Mr}=nn;if(A.current==null)return;const $r=C.get(A.current);if(!$r)return;const ti=Bn.nativeEvent,$i=new jr({active:A.current,activeNode:$r,event:ti,options:Mr,context:ce,onStart(mi){const Ur=A.current;if(Ur==null)return;const Va=C.get(Ur);if(!Va)return;const{onDragStart:_s}=R.current,yi={active:{id:Ur,data:Va.data,rect:N}};Wo.unstable_batchedUpdates(()=>{_s==null||_s(yi),S(Pu.Initializing),b({type:Wr.DragStart,initialCoordinates:mi,active:Ur}),y({type:"onDragStart",event:yi})})},onMove(mi){b({type:Wr.DragMove,coordinates:mi})},onEnd:vo(Wr.DragEnd),onCancel:vo(Wr.DragCancel)});Wo.unstable_batchedUpdates(()=>{D($i),M(Bn.nativeEvent)});function vo(mi){return async function(){const{active:Va,collisions:_s,over:yi,scrollAdjustedTranslate:du}=ce.current;let ua=null;if(Va&&du){const{cancelDrop:ni}=R.current;ua={activatorEvent:ti,active:Va,collisions:_s,delta:du,over:yi},mi===Wr.DragEnd&&typeof ni=="function"&&await Promise.resolve(ni(ua))&&(mi=Wr.DragCancel)}A.current=null,Wo.unstable_batchedUpdates(()=>{b({type:mi}),S(Pu.Uninitialized),Mi(null),D(null),M(null);const ni=mi===Wr.DragEnd?"onDragEnd":"onDragCancel";if(ua){const hl=R.current[ni];hl==null||hl(ua),y({type:ni,event:ua})}})}}},[C]),Or=I.useCallback((Bn,nn)=>(jr,Mr)=>{const $r=jr.nativeEvent,ti=C.get(Mr);if(A.current!==null||!ti||$r.dndKit||$r.defaultPrevented)return;const $i={active:ti};Bn(jr,nn.options,$i)===!0&&($r.dndKit={capturedBy:nn.sensor},A.current=Mr,Ua(jr,nn))},[C,Ua]),yo=Nje(c,Or);Vje(c),ol(()=>{se&&v===Pu.Initializing&&S(Pu.Initialized)},[se,v]),I.useEffect(()=>{const{onDragMove:Bn}=R.current,{active:nn,activatorEvent:jr,collisions:Mr,over:$r}=ce.current;if(!nn||!jr)return;const ti={active:nn,activatorEvent:jr,collisions:Mr,delta:{x:pr.x,y:pr.y},over:$r};Wo.unstable_batchedUpdates(()=>{Bn==null||Bn(ti),y({type:"onDragMove",event:ti})})},[pr.x,pr.y]),I.useEffect(()=>{const{active:Bn,activatorEvent:nn,collisions:jr,droppableContainers:Mr,scrollAdjustedTranslate:$r}=ce.current;if(!Bn||A.current==null||!nn||!$r)return;const{onDragOver:ti}=R.current,$i=Mr.get(Fn),vo=$i&&$i.rect.current?{id:$i.id,rect:$i.rect.current,data:$i.data,disabled:$i.disabled}:null,mi={active:Bn,activatorEvent:nn,collisions:jr,delta:{x:$r.x,y:$r.y},over:vo};Wo.unstable_batchedUpdates(()=>{Mi(vo),ti==null||ti(mi),y({type:"onDragOver",event:mi})})},[Fn]),ol(()=>{ce.current={activatorEvent:L,active:O,activeNode:J,collisionRect:zr,collisions:ei,droppableRects:G,draggableNodes:C,draggingNode:ze,draggingNodeRect:mt,droppableContainers:E,over:_n,scrollableAncestors:Dn,scrollAdjustedTranslate:pr},N.current={initial:mt,translated:zr}},[O,J,ei,zr,C,ze,mt,G,E,_n,Dn,pr]),Rje({...Q,delta:T,draggingRect:zr,pointerCoordinates:Ln,scrollableAncestors:Dn,scrollableAncestorRects:Tn});const dl=I.useMemo(()=>({active:O,activeNode:J,activeNodeRect:se,activatorEvent:L,collisions:ei,containerNodeRect:Se,dragOverlay:ot,draggableNodes:C,droppableContainers:E,droppableRects:G,over:_n,measureDroppableContainers:Y,scrollableAncestors:Dn,scrollableAncestorRects:Tn,measuringConfiguration:U,measuringScheduled:ee,windowRect:Ir}),[O,J,se,L,ei,Se,ot,C,E,G,_n,Y,Dn,Tn,U,ee,Ir]),Fo=I.useMemo(()=>({activatorEvent:L,activators:yo,active:O,activeNodeRect:se,ariaDescribedById:{draggable:$},dispatch:b,draggableNodes:C,over:_n,measureDroppableContainers:Y}),[L,yo,O,se,b,$,C,_n,Y]);return An.createElement(UK.Provider,{value:g},An.createElement(nv.Provider,{value:Fo},An.createElement(aQ.Provider,{value:dl},An.createElement(Dw.Provider,{value:Xi},u)),An.createElement(Zje,{disabled:(s==null?void 0:s.restoreFocus)===!1})),An.createElement(eje,{...s,hiddenTextDescribedById:$}));function fl(){const Bn=(P==null?void 0:P.autoScrollEnabled)===!1,nn=typeof l=="object"?l.enabled===!1:l===!1,jr=x&&!Bn&&!nn;return typeof l=="object"?{...l,enabled:jr}:{enabled:jr}}}),nUe=I.createContext(null),J$="button",rUe="Droppable";function IQe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=$w(rUe),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=I.useContext(nv),{role:h=J$,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,b=I.useContext(_?Dw:nUe),[y,g]=SS(),[v,S]=SS(),x=Gje(a,t),w=Q0(n);ol(()=>(d.set(t,{id:t,key:o,node:y,activatorNode:v,data:w}),()=>{const T=d.get(t);T&&T.key===o&&d.delete(t)}),[d,t]);const C=I.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===J$?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:C,isDragging:_,listeners:r?void 0:x,node:y,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:b}}function iUe(){return I.useContext(aQ)}const oUe="Droppable",aUe={timeout:25};function RQe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=$w(oUe),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=I.useContext(nv),c=I.useRef({disabled:n}),d=I.useRef(!1),f=I.useRef(null),h=I.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...aUe,...i},b=Q0(m??r),y=I.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),h.current=null},_)},[_]),g=Nw({callback:y,disabled:p||!a}),v=I.useCallback((C,T)=>{g&&(T&&(g.unobserve(T),d.current=!1),C&&g.observe(C))},[g]),[S,x]=SS(v),w=Q0(t);return I.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),ol(()=>(s({type:Wr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:w}}),()=>s({type:Wr.UnregisterDroppable,key:o,id:r})),[r]),I.useEffect(()=>{n!==c.current.disabled&&(s({type:Wr.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:x}}function sUe(e){let{animation:t,children:n}=e;const[r,i]=I.useState(null),[o,a]=I.useState(null),s=xS(n);return!n&&!r&&s&&i(s),ol(()=>{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]),An.createElement(An.Fragment,null,n,r?I.cloneElement(r,{ref:a}):null)}const lUe={x:0,y:0,scaleX:1,scaleY:1};function uUe(e){let{children:t}=e;return An.createElement(nv.Provider,{value:oQ},An.createElement(Dw.Provider,{value:lUe},t))}const cUe={position:"fixed",touchAction:"none"},dUe=e=>e6(e)?"transform 250ms ease":void 0,fUe=I.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:s,style:l,transform:u,transition:c=dUe}=e;if(!s)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...cUe,width:s.width,height:s.height,top:s.top,left:s.left,transform:Y0.Transform.toString(d),transformOrigin:i&&r?rje(r,s):void 0,transition:typeof c=="function"?c(r):c,...l};return An.createElement(n,{className:a,style:f,ref:t},o)}),hUe=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[s,l]of Object.entries(o.active))l!==void 0&&(i[s]=n.node.style.getPropertyValue(s),n.node.style.setProperty(s,l));if(o!=null&&o.dragOverlay)for(const[s,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(s,l);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);a!=null&&a.active&&n.node.classList.remove(a.active)}},pUe=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Y0.Transform.toString(t)},{transform:Y0.Transform.toString(n)}]},gUe={duration:250,easing:"ease",keyframes:pUe,sideEffects:hUe({styles:{active:{opacity:"0"}}})};function mUe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Mw((o,a)=>{if(t===null)return;const s=n.get(o);if(!s)return;const l=s.node.current;if(!l)return;const u=iQ(a);if(!u)return;const{transform:c}=go(a).getComputedStyle(a),d=GK(c);if(!d)return;const f=typeof t=="function"?t:yUe(t);return YK(l,i.draggable.measure),f({active:{id:o,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function yUe(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...gUe,...e};return o=>{let{active:a,dragOverlay:s,transform:l,...u}=o;if(!t)return;const c={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:a,dragOverlay:s,...u}),b=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{b.onfinish=()=>{_==null||_(),y()}})}}let eN=0;function vUe(e){return I.useMemo(()=>{if(e!=null)return eN++,eN},[e])}const bUe=An.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:b,measuringConfiguration:y,scrollableAncestors:g,scrollableAncestorRects:v,windowRect:S}=iUe(),x=I.useContext(Dw),w=vUe(d==null?void 0:d.id),C=sQ(a,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:b,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:v,transform:x,windowRect:S}),T=i6(f),E=mUe({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:y}),k=T?_.setRef:void 0;return An.createElement(uUe,null,An.createElement(sUe,{animation:E},d&&w?An.createElement(fUe,{key:w,id:d.id,ref:k,as:s,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:T,style:{zIndex:u,...i},transform:C},n):null))}),_Ue=Ii([EK,nP],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),SUe=()=>{const e=kH(_Ue);return I.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=X0(n);if(!o)return i;const a=o.x-r.left,s=o.y-r.top,l=i.x+a-r.width/2,u=i.y+s-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])},xUe=e=>{if(!e.pointerCoordinates)return[];const t=document.elementsFromPoint(e.pointerCoordinates.x,e.pointerCoordinates.y),n=e.droppableContainers.filter(r=>r.node.current?t.includes(r.node.current):!1);return dje({...e,droppableContainers:n})};function wUe(e){return W.jsx(tUe,{...e})}const O1=28,tN={w:O1,h:O1,maxW:O1,maxH:O1,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},CUe=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return W.jsx(vS,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:W.jsx(dK,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return W.jsx(vS,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:W.jsx(GP,{sx:{...tN},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?W.jsxs(HP,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...tN},children:[W.jsx(QE,{children:e.dragData.payload.imageDTOs.length}),W.jsx(QE,{size:"sm",children:"Images"})]}):null},AUe=I.memo(CUe),EUe=e=>{const[t,n]=I.useState(null),r=be("images"),i=i4e(),o=I.useCallback(d=>{r.trace({dragData:Xt(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),a=I.useCallback(d=>{var h;r.trace({dragData:Xt(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(EH({overData:f,activeData:t})),n(null))},[t,i,r]),s=G$(tQ,{activationConstraint:{distance:10}}),l=G$(nQ,{activationConstraint:{distance:10}}),u=tje(s,l),c=SUe();return W.jsxs(wUe,{onDragStart:o,onDragEnd:a,sensors:u,collisionDetection:xUe,autoScroll:!1,children:[e.children,W.jsx(bUe,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"grabbing",userSelect:"none",padding:"10rem"},children:W.jsx(nK,{children:t&&W.jsx(eK.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:W.jsx(AUe,{dragData:t})},"overlay-drag-image")})})]})},TUe=I.memo(EUe),nN=sl(void 0),rN=sl(void 0),kUe=I.lazy(()=>_L(()=>import("./App-d1a94d82.js"),["./App-d1a94d82.js","./MantineProvider-5a15f390.js","./App-6125620a.css"],import.meta.url)),PUe=I.lazy(()=>_L(()=>import("./ThemeLocaleProvider-9bab47dd.js"),["./ThemeLocaleProvider-9bab47dd.js","./MantineProvider-5a15f390.js","./ThemeLocaleProvider-90f0fcd3.css"],import.meta.url)),IUe=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,queueId:a,selectedImage:s,customStarUi:l})=>(I.useEffect(()=>(t&&rp.set(t),e&&u0.set(e),o&&c0.set(o),a&&Gr.set(a),CG(),i&&i.length>0?sE(U$(),...i):sE(U$()),()=>{u0.set(void 0),rp.set(void 0),c0.set(void 0),Gr.set(PG)}),[e,t,i,o,a]),I.useEffect(()=>(l&&nN.set(l),()=>{nN.set(void 0)}),[l]),I.useEffect(()=>(r&&rN.set(r),()=>{rN.set(void 0)}),[r]),W.jsx(An.StrictMode,{children:W.jsx(Yce,{store:AK,children:W.jsx(An.Suspense,{fallback:W.jsx(Bze,{}),children:W.jsx(PUe,{children:W.jsx(TUe,{children:W.jsx(kUe,{config:n,selectedImage:s})})})})})})),RUe=I.memo(IUe);s3.createRoot(document.getElementById("root")).render(W.jsx(RUe,{}));export{qy as $,pi as A,es as B,Gbe as C,No as D,nc as E,Ps as F,lqe as G,Pk as H,I4e as I,la as J,Zy as K,Rke as L,kQe as M,vLe as N,Vy as O,Wbe as P,Oi as Q,Dc as R,Wm as S,zMe as T,_Qe as U,yQe as V,nK as W,eK as X,vMe as Y,Gy as Z,jP as _,dF as a,W4 as a$,vQe as a0,bQe as a1,rS as a2,y7 as a3,Ske as a4,SQe as a5,Us as a6,xc as a7,A_ as a8,YY as a9,Gd as aA,vS as aB,HP as aC,QE as aD,nP as aE,gx as aF,_4e as aG,FHe as aH,ske as aI,uP as aJ,jH as aK,uke as aL,Wo as aM,l6 as aN,vw as aO,eKe as aP,yHe as aQ,zHe as aR,jHe as aS,hHe as aT,dHe as aU,dK as aV,Rf as aW,iwe as aX,RG as aY,zWe as aZ,pHe as a_,An as aa,Rq as ab,CQe as ac,wMe as ad,Zs as ae,KH as af,yw as ag,VNe as ah,uK as ai,xQe as aj,nt as ak,mQe as al,wQe as am,Ii as an,EK as ao,P4 as ap,kH as aq,IHe as ar,Oy as as,nU as at,kU as au,ax as av,be as aw,i4e as ax,UWe as ay,Ht as az,e2 as b,iVe as b$,oP as b0,PKe as b1,GP as b2,Lze as b3,me as b4,RHe as b5,BHe as b6,Nse as b7,q4 as b8,eVe as b9,nm as bA,Z as bB,YHe as bC,tqe as bD,vHe as bE,bHe as bF,$He as bG,F_ as bH,SHe as bI,zu as bJ,Sv as bK,eqe as bL,ZHe as bM,JHe as bN,MUe as bO,WUe as bP,KUe as bQ,QUe as bR,XUe as bS,rue as bT,xVe as bU,IWe as bV,RWe as bW,tVe as bX,PVe as bY,ZUe as bZ,yVe as b_,uKe as ba,GWe as bb,IKe as bc,pKe as bd,Txe as be,VWe as bf,qWe as bg,U2e as bh,V2e as bi,aKe as bj,lKe as bk,HWe as bl,dKe as bm,WWe as bn,PHe as bo,jWe as bp,wKe as bq,PQe as br,xHe as bs,jde as bt,WHe as bu,qHe as bv,_He as bw,nqe as bx,RQe as by,IQe as bz,XJ as c,QWe as c$,CEe as c0,JUe as c1,wVe as c2,YUe as c3,$Ve as c4,nVe as c5,OI as c6,rVe as c7,MI as c8,cVe as c9,fVe as cA,FWe as cB,hVe as cC,BWe as cD,aqe as cE,ywe as cF,De as cG,nN as cH,XHe as cI,KHe as cJ,QHe as cK,Sue as cL,Hxe as cM,wG as cN,vz as cO,fHe as cP,AH as cQ,OHe as cR,d0 as cS,RU as cT,gQe as cU,MHe as cV,Pv as cW,zA as cX,TKe as cY,_Ke as cZ,KWe as c_,bVe as ca,XKe as cb,aVe as cc,iM as cd,sqe as ce,WKe as cf,sVe as cg,oM as ch,Zc as ci,Cse as cj,z4 as ck,QKe as cl,sM as cm,Ase as cn,KKe as co,uVe as cp,aM as cq,Ese as cr,wEe as cs,oVe as ct,dO as cu,$We as cv,NWe as cw,DWe as cx,dVe as cy,LWe as cz,Loe as d,Aue as d$,vKe as d0,Vr as d1,Ik as d2,Xl as d3,Pa as d4,Ho as d5,yKe as d6,pVe as d7,tP as d8,bKe as d9,Wle as dA,Bqe as dB,wy as dC,sQe as dD,qKe as dE,fQe as dF,HKe as dG,zqe as dH,jqe as dI,hQe as dJ,Uqe as dK,dQe as dL,Vqe as dM,Gqe as dN,qle as dO,ZKe as dP,Hqe as dQ,Qle as dR,Dqe as dS,Xle as dT,Lqe as dU,Rqe as dV,wWe as dW,_h as dX,_y as dY,_Ve as dZ,Cue as d_,hKe as da,k4 as db,CWe as dc,_We as dd,SWe as de,TWe as df,xWe as dg,EWe as dh,AWe as di,iEe as dj,Kqe as dk,pqe as dl,CHe as dm,wHe as dn,yqe as dp,Bae as dq,Fqe as dr,dqe as ds,Oqe as dt,Mqe as du,Kle as dv,$qe as dw,GUe as dx,Nqe as dy,hx as dz,fB as e,LVe as e$,gHe as e0,iqe as e1,oqe as e2,MU as e3,rqe as e4,u2 as e5,QVe as e6,UVe as e7,VVe as e8,GVe as e9,Tse as eA,JB as eB,Ise as eC,NUe as eD,YKe as eE,OWe as eF,V4 as eG,B2e as eH,t4e as eI,pz as eJ,UKe as eK,YVe as eL,iue as eM,XVe as eN,qo as eO,vVe as eP,RVe as eQ,zse as eR,rm as eS,MVe as eT,MWe as eU,EVe as eV,TVe as eW,kVe as eX,CVe as eY,AVe as eZ,nue as e_,Bse as ea,eo as eb,kI as ec,BUe as ed,GHe as ee,UHe as ef,VHe as eg,kc as eh,$I as ei,Mse as ej,PI as ek,pwe as el,hwe as em,zUe as en,jUe as eo,h2 as ep,UUe as eq,$se as er,VUe as es,FUe as et,LUe as eu,Sy as ev,B4 as ew,kse as ex,Pse as ey,ZB as ez,bF as f,Jqe as f$,DVe as f0,iGe as f1,CGe as f2,sHe as f3,AGe as f4,zVe as f5,jVe as f6,BVe as f7,WVe as f8,KVe as f9,qUe as fA,eQe as fB,oQe as fC,HUe as fD,BV as fE,fqe as fF,mA as fG,DSe as fH,Qqe as fI,_qe as fJ,Sqe as fK,zSe as fL,lO as fM,vV as fN,Dy as fO,uqe as fP,Jc as fQ,Yqe as fR,fKe as fS,Bz as fT,Ng as fU,mqe as fV,hqe as fW,Xqe as fX,Zqe as fY,oWe as fZ,cqe as f_,qVe as fa,HVe as fb,H4 as fc,mKe as fd,SKe as fe,PWe as ff,pQe as fg,C4e as fh,rKe as fi,xe as fj,Lt as fk,Vn as fl,Qs as fm,lVe as fn,GKe as fo,uQe as fp,nQe as fq,JWe as fr,tQe as fs,cQe as ft,lQe as fu,ZWe as fv,iQe as fw,rQe as fx,JKe as fy,aQe as fz,TF as g,pg as g$,eWe as g0,AHe as g1,K_ as g2,tt as g3,tWe as g4,N2e as g5,Yv as g6,gqe as g7,aWe as g8,rWe as g9,yWe as gA,pWe as gB,dWe as gC,nWe as gD,mWe as gE,ZV as gF,$Ke as gG,RKe as gH,OKe as gI,MKe as gJ,kKe as gK,gKe as gL,CKe as gM,EKe as gN,ed as gO,$G as gP,RQ as gQ,Rt as gR,DGe as gS,tHe as gT,eHe as gU,_Ge as gV,HGe as gW,rHe as gX,gwe as gY,hGe as gZ,RGe as g_,kqe as ga,Aqe as gb,Cqe as gc,wqe as gd,Pqe as ge,iWe as gf,uWe as gg,lWe as gh,bWe as gi,E4e as gj,Eqe as gk,Tqe as gl,kWe as gm,cWe as gn,sWe as go,fWe as gp,MSe as gq,VKe as gr,mj as gs,nM as gt,Xt as gu,$2e as gv,I0 as gw,gc as gx,vWe as gy,hWe as gz,s2 as h,jKe as h$,kGe as h0,pGe as h1,mx as h2,IGe as h3,cGe as h4,PGe as h5,dGe as h6,mGe as h7,eGe as h8,JVe as h9,DKe as hA,NKe as hB,GGe as hC,BGe as hD,FGe as hE,lwe as hF,bGe as hG,fGe as hH,YGe as hI,XGe as hJ,UGe as hK,zGe as hL,jGe as hM,lHe as hN,KGe as hO,uHe as hP,TGe as hQ,EGe as hR,uGe as hS,lGe as hT,aHe as hU,rGe as hV,SGe as hW,dwe as hX,swe as hY,uwe as hZ,cwe as h_,ZVe as ha,nHe as hb,Mae as hc,_B as hd,gz as he,rp as hf,lue as hg,oGe as hh,aGe as hi,sGe as hj,JGe as hk,vGe as hl,yGe as hm,due as hn,ZGe as ho,fwe as hp,fue as hq,Jk as hr,$Ae as hs,xGe as ht,LGe as hu,NGe as hv,OGe as hw,tGe as hx,nGe as hy,cHe as hz,Ioe as i,tKe as i0,nKe as i1,NHe as i2,Kae as i3,nwe as i4,rN as i5,qH as i6,dP as i7,Vs as i8,aMe as i9,NMe as ia,AQe as ib,Ake as ic,TQe as id,bLe as ie,CBe as ig,ABe as ih,bke as ii,fi as j,cre as k,a2 as l,Ap as m,yy as n,$o as o,r2 as p,m4 as q,yF as r,x4 as s,by as t,oB as u,I as v,W as w,Ma as x,_r as y,Eh as z};