var DV=Object.defineProperty;var LV=(e,t,n)=>t in e?DV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var e2=(e,t,n)=>(LV(e,typeof t!="symbol"?t+"":t,n),n);function NO(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Uc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Y1(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 DO={exports:{}},Z1={},LO={exports:{}},Mt={};/** * @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 om=Symbol.for("react.element"),$V=Symbol.for("react.portal"),FV=Symbol.for("react.fragment"),BV=Symbol.for("react.strict_mode"),zV=Symbol.for("react.profiler"),UV=Symbol.for("react.provider"),jV=Symbol.for("react.context"),VV=Symbol.for("react.forward_ref"),GV=Symbol.for("react.suspense"),HV=Symbol.for("react.memo"),qV=Symbol.for("react.lazy"),D4=Symbol.iterator;function WV(e){return e===null||typeof e!="object"?null:(e=D4&&e[D4]||e["@@iterator"],typeof e=="function"?e:null)}var $O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},FO=Object.assign,BO={};function eh(e,t,n){this.props=e,this.context=t,this.refs=BO,this.updater=n||$O}eh.prototype.isReactComponent={};eh.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")};eh.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function zO(){}zO.prototype=eh.prototype;function Z3(e,t,n){this.props=e,this.context=t,this.refs=BO,this.updater=n||$O}var J3=Z3.prototype=new zO;J3.constructor=Z3;FO(J3,eh.prototype);J3.isPureReactComponent=!0;var L4=Array.isArray,UO=Object.prototype.hasOwnProperty,eE={current:null},jO={key:!0,ref:!0,__self:!0,__source:!0};function VO(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)UO.call(t,r)&&!jO.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,U=R[F];if(0>>1;Fi(Y,O))Qi(j,Y)?(R[F]=j,R[Q]=O,F=Q):(R[F]=Y,R[H]=O,F=H);else if(Qi(j,O))R[F]=j,R[Q]=O,F=Q;else break e}}return I}function i(R,I){var O=R.sortIndex-I.sortIndex;return O!==0?O:R.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,_=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(R){for(var I=n(u);I!==null;){if(I.callback===null)r(u);else if(I.startTime<=R)r(u),I.sortIndex=I.expirationTime,t(l,I);else break;I=n(u)}}function v(R){if(m=!1,g(R),!p)if(n(l)!==null)p=!0,D(S);else{var I=n(u);I!==null&&B(v,I.startTime-R)}}function S(R,I){p=!1,m&&(m=!1,_(C),C=-1),h=!0;var O=f;try{for(g(I),d=n(l);d!==null&&(!(d.expirationTime>I)||R&&!k());){var F=d.callback;if(typeof F=="function"){d.callback=null,f=d.priorityLevel;var U=F(d.expirationTime<=I);I=e.unstable_now(),typeof U=="function"?d.callback=U:d===n(l)&&r(l),g(I)}else r(l);d=n(l)}if(d!==null)var V=!0;else{var H=n(u);H!==null&&B(v,H.startTime-I),V=!1}return V}finally{d=null,f=O,h=!1}}var w=!1,x=null,C=-1,A=5,T=-1;function k(){return!(e.unstable_now()-TR||125F?(R.sortIndex=O,t(u,R),n(l)===null&&R===n(u)&&(m?(_(C),C=-1):m=!0,B(v,O-F))):(R.sortIndex=U,t(l,R),p||h||(p=!0,D(S))),R},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(R){var I=f;return function(){var O=f;f=I;try{return R.apply(this,arguments)}finally{f=O}}}})(WO);qO.exports=WO;var iG=qO.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 KO=M,Mo=iG;function se(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"),ox=Object.prototype.hasOwnProperty,oG=/^[: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]*$/,B4={},z4={};function sG(e){return ox.call(z4,e)?!0:ox.call(B4,e)?!1:oG.test(e)?z4[e]=!0:(B4[e]=!0,!1)}function aG(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 lG(e,t,n,r){if(t===null||typeof t>"u"||aG(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 Zi(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var wi={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){wi[e]=new Zi(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];wi[t]=new Zi(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){wi[e]=new Zi(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){wi[e]=new Zi(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){wi[e]=new Zi(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){wi[e]=new Zi(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){wi[e]=new Zi(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){wi[e]=new Zi(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){wi[e]=new Zi(e,5,!1,e.toLowerCase(),null,!1,!1)});var nE=/[\-:]([a-z])/g;function rE(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(nE,rE);wi[t]=new Zi(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(nE,rE);wi[t]=new Zi(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(nE,rE);wi[t]=new Zi(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){wi[e]=new Zi(e,1,!1,e.toLowerCase(),null,!1,!1)});wi.xlinkHref=new Zi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){wi[e]=new Zi(e,1,!1,e.toLowerCase(),null,!0,!0)});function iE(e,t,n,r){var i=wi.hasOwnProperty(t)?wi[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` `+i[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{r2=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Zh(e):""}function uG(e){switch(e.tag){case 5:return Zh(e.type);case 16:return Zh("Lazy");case 13:return Zh("Suspense");case 19:return Zh("SuspenseList");case 0:case 2:case 15:return e=i2(e.type,!1),e;case 11:return e=i2(e.type.render,!1),e;case 1:return e=i2(e.type,!0),e;default:return""}}function ux(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Dd:return"Fragment";case Nd:return"Portal";case sx:return"Profiler";case oE:return"StrictMode";case ax:return"Suspense";case lx:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case YO:return(e.displayName||"Context")+".Consumer";case QO:return(e._context.displayName||"Context")+".Provider";case sE:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case aE:return t=e.displayName||null,t!==null?t:ux(e.type)||"Memo";case Pl:t=e._payload,e=e._init;try{return ux(e(t))}catch{}}return null}function cG(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 ux(t);case 8:return t===oE?"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 uu(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function JO(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dG(e){var t=JO(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ny(e){e._valueTracker||(e._valueTracker=dG(e))}function e9(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=JO(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ev(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 cx(e,t){var n=t.checked;return or({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function j4(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=uu(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 t9(e,t){t=t.checked,t!=null&&iE(e,"checked",t,!1)}function dx(e,t){t9(e,t);var n=uu(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")?fx(e,t.type,n):t.hasOwnProperty("defaultValue")&&fx(e,t.type,uu(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function V4(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 fx(e,t,n){(t!=="number"||ev(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Jh=Array.isArray;function Zd(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=ry.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Dp(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var cp={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},fG=["Webkit","ms","Moz","O"];Object.keys(cp).forEach(function(e){fG.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),cp[t]=cp[e]})});function o9(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||cp.hasOwnProperty(e)&&cp[e]?(""+t).trim():t+"px"}function s9(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=o9(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var hG=or({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 gx(e,t){if(t){if(hG[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(se(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(se(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(se(61))}if(t.style!=null&&typeof t.style!="object")throw Error(se(62))}}function mx(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 yx=null;function lE(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vx=null,Jd=null,ef=null;function q4(e){if(e=lm(e)){if(typeof vx!="function")throw Error(se(280));var t=e.stateNode;t&&(t=r_(t),vx(e.stateNode,e.type,t))}}function a9(e){Jd?ef?ef.push(e):ef=[e]:Jd=e}function l9(){if(Jd){var e=Jd,t=ef;if(ef=Jd=null,q4(e),t)for(e=0;e>>=0,e===0?32:31-(CG(e)/EG|0)|0}var iy=64,oy=4194304;function ep(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 iv(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=ep(a):(o&=s,o!==0&&(r=ep(o)))}else s=n&~i,s!==0?r=ep(s):o!==0&&(r=ep(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 sm(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ps(t),e[t]=n}function PG(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=fp),tA=String.fromCharCode(32),nA=!1;function k9(e,t){switch(e){case"keyup":return rH.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function P9(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ld=!1;function oH(e,t){switch(e){case"compositionend":return P9(t);case"keypress":return t.which!==32?null:(nA=!0,tA);case"textInput":return e=t.data,e===tA&&nA?null:e;default:return null}}function sH(e,t){if(Ld)return e==="compositionend"||!mE&&k9(e,t)?(e=T9(),v0=hE=zl=null,Ld=!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=sA(n)}}function M9(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?M9(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function N9(){for(var e=window,t=ev();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ev(e.document)}return t}function yE(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 gH(e){var t=N9(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&M9(n.ownerDocument.documentElement,n)){if(r!==null&&yE(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=aA(n,o);var s=aA(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,$d=null,Cx=null,pp=null,Ex=!1;function lA(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ex||$d==null||$d!==ev(r)||(r=$d,"selectionStart"in r&&yE(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}),pp&&Up(pp,r)||(pp=r,r=av(Cx,"onSelect"),0zd||(e.current=Ix[zd],Ix[zd]=null,zd--)}function An(e,t){zd++,Ix[zd]=e.current,e.current=t}var cu={},Bi=Tu(cu),fo=Tu(!1),xc=cu;function Cf(e,t){var n=e.type.contextTypes;if(!n)return cu;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 ho(e){return e=e.childContextTypes,e!=null}function uv(){jn(fo),jn(Bi)}function gA(e,t,n){if(Bi.current!==cu)throw Error(se(168));An(Bi,t),An(fo,n)}function V9(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(se(108,cG(e)||"Unknown",i));return or({},n,r)}function cv(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cu,xc=Bi.current,An(Bi,e),An(fo,fo.current),!0}function mA(e,t,n){var r=e.stateNode;if(!r)throw Error(se(169));n?(e=V9(e,t,xc),r.__reactInternalMemoizedMergedChildContext=e,jn(fo),jn(Bi),An(Bi,e)):jn(fo),An(fo,n)}var za=null,i_=!1,v2=!1;function G9(e){za===null?za=[e]:za.push(e)}function AH(e){i_=!0,G9(e)}function Au(){if(!v2&&za!==null){v2=!0;var e=0,t=ln;try{var n=za;for(ln=1;e>=s,i-=s,Ha=1<<32-Ps(t)+i|n<C?(A=x,x=null):A=x.sibling;var T=f(_,x,g[C],v);if(T===null){x===null&&(x=A);break}e&&x&&T.alternate===null&&t(_,x),y=o(T,y,C),w===null?S=T:w.sibling=T,w=T,x=A}if(C===g.length)return n(_,x),Kn&&Qu(_,C),S;if(x===null){for(;CC?(A=x,x=null):A=x.sibling;var k=f(_,x,T.value,v);if(k===null){x===null&&(x=A);break}e&&x&&k.alternate===null&&t(_,x),y=o(k,y,C),w===null?S=k:w.sibling=k,w=k,x=A}if(T.done)return n(_,x),Kn&&Qu(_,C),S;if(x===null){for(;!T.done;C++,T=g.next())T=d(_,T.value,v),T!==null&&(y=o(T,y,C),w===null?S=T:w.sibling=T,w=T);return Kn&&Qu(_,C),S}for(x=r(_,x);!T.done;C++,T=g.next())T=h(x,_,C,T.value,v),T!==null&&(e&&T.alternate!==null&&x.delete(T.key===null?C:T.key),y=o(T,y,C),w===null?S=T:w.sibling=T,w=T);return e&&x.forEach(function(L){return t(_,L)}),Kn&&Qu(_,C),S}function b(_,y,g,v){if(typeof g=="object"&&g!==null&&g.type===Dd&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case ty:e:{for(var S=g.key,w=y;w!==null;){if(w.key===S){if(S=g.type,S===Dd){if(w.tag===7){n(_,w.sibling),y=i(w,g.props.children),y.return=_,_=y;break e}}else if(w.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Pl&&xA(S)===w.type){n(_,w.sibling),y=i(w,g.props),y.ref=Ph(_,w,g),y.return=_,_=y;break e}n(_,w);break}else t(_,w);w=w.sibling}g.type===Dd?(y=yc(g.props.children,_.mode,v,g.key),y.return=_,_=y):(v=T0(g.type,g.key,g.props,null,_.mode,v),v.ref=Ph(_,y,g),v.return=_,_=v)}return s(_);case Nd:e:{for(w=g.key;y!==null;){if(y.key===w)if(y.tag===4&&y.stateNode.containerInfo===g.containerInfo&&y.stateNode.implementation===g.implementation){n(_,y.sibling),y=i(y,g.children||[]),y.return=_,_=y;break e}else{n(_,y);break}else t(_,y);y=y.sibling}y=T2(g,_.mode,v),y.return=_,_=y}return s(_);case Pl:return w=g._init,b(_,y,w(g._payload),v)}if(Jh(g))return p(_,y,g,v);if(Ch(g))return m(_,y,g,v);fy(_,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,y!==null&&y.tag===6?(n(_,y.sibling),y=i(y,g),y.return=_,_=y):(n(_,y),y=E2(g,_.mode,v),y.return=_,_=y),s(_)):n(_,y)}return b}var Tf=Z9(!0),J9=Z9(!1),um={},ua=Tu(um),Hp=Tu(um),qp=Tu(um);function sc(e){if(e===um)throw Error(se(174));return e}function TE(e,t){switch(An(qp,t),An(Hp,e),An(ua,um),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:px(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=px(t,e)}jn(ua),An(ua,t)}function Af(){jn(ua),jn(Hp),jn(qp)}function eM(e){sc(qp.current);var t=sc(ua.current),n=px(t,e.type);t!==n&&(An(Hp,e),An(ua,n))}function AE(e){Hp.current===e&&(jn(ua),jn(Hp))}var tr=Tu(0);function mv(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 _2=[];function kE(){for(var e=0;e<_2.length;e++)_2[e]._workInProgressVersionPrimary=null;_2.length=0}var S0=dl.ReactCurrentDispatcher,b2=dl.ReactCurrentBatchConfig,Ec=0,ir=null,Lr=null,ei=null,yv=!1,gp=!1,Wp=0,PH=0;function ki(){throw Error(se(321))}function PE(e,t){if(t===null)return!1;for(var n=0;nn?n:4,e(!0);var r=b2.transition;b2.transition={};try{e(!1),t()}finally{ln=n,b2.transition=r}}function mM(){return ts().memoizedState}function IH(e,t,n){var r=Jl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},yM(e))vM(t,n);else if(n=K9(e,t,n,r),n!==null){var i=Ki();Rs(n,e,r,i),_M(n,t,r)}}function OH(e,t,n){var r=Jl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(yM(e))vM(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,Ds(a,s)){var l=t.interleaved;l===null?(i.next=i,CE(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=K9(e,t,i,r),n!==null&&(i=Ki(),Rs(n,e,r,i),_M(n,t,r))}}function yM(e){var t=e.alternate;return e===ir||t!==null&&t===ir}function vM(e,t){gp=yv=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _M(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cE(e,n)}}var vv={readContext:es,useCallback:ki,useContext:ki,useEffect:ki,useImperativeHandle:ki,useInsertionEffect:ki,useLayoutEffect:ki,useMemo:ki,useReducer:ki,useRef:ki,useState:ki,useDebugValue:ki,useDeferredValue:ki,useTransition:ki,useMutableSource:ki,useSyncExternalStore:ki,useId:ki,unstable_isNewReconciler:!1},MH={readContext:es,useCallback:function(e,t){return Xs().memoizedState=[e,t===void 0?null:t],e},useContext:es,useEffect:EA,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,w0(4194308,4,dM.bind(null,t,e),n)},useLayoutEffect:function(e,t){return w0(4194308,4,e,t)},useInsertionEffect:function(e,t){return w0(4,2,e,t)},useMemo:function(e,t){var n=Xs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Xs();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=IH.bind(null,ir,e),[r.memoizedState,e]},useRef:function(e){var t=Xs();return e={current:e},t.memoizedState=e},useState:CA,useDebugValue:ME,useDeferredValue:function(e){return Xs().memoizedState=e},useTransition:function(){var e=CA(!1),t=e[0];return e=RH.bind(null,e[1]),Xs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ir,i=Xs();if(Kn){if(n===void 0)throw Error(se(407));n=n()}else{if(n=t(),ri===null)throw Error(se(349));Ec&30||rM(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,EA(oM.bind(null,r,o,e),[e]),r.flags|=2048,Xp(9,iM.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Xs(),t=ri.identifierPrefix;if(Kn){var n=qa,r=Ha;n=(r&~(1<<32-Ps(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Wp++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[ea]=t,e[Gp]=r,kM(e,t,!1,!1),t.stateNode=e;e:{switch(s=mx(n,r),n){case"dialog":Nn("cancel",e),Nn("close",e),i=r;break;case"iframe":case"object":case"embed":Nn("load",e),i=r;break;case"video":case"audio":for(i=0;iPf&&(t.flags|=128,r=!0,Rh(o,!1),t.lanes=4194304)}else{if(!r)if(e=mv(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rh(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Kn)return Pi(t),null}else 2*vr()-o.renderingStartTime>Pf&&n!==1073741824&&(t.flags|=128,r=!0,Rh(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=vr(),t.sibling=null,n=tr.current,An(tr,r?n&1|2:n&1),t):(Pi(t),null);case 22:case 23:return BE(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?To&1073741824&&(Pi(t),t.subtreeFlags&6&&(t.flags|=8192)):Pi(t),null;case 24:return null;case 25:return null}throw Error(se(156,t.tag))}function UH(e,t){switch(_E(t),t.tag){case 1:return ho(t.type)&&uv(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Af(),jn(fo),jn(Bi),kE(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return AE(t),null;case 13:if(jn(tr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(se(340));Ef()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return jn(tr),null;case 4:return Af(),null;case 10:return xE(t.type._context),null;case 22:case 23:return BE(),null;case 24:return null;default:return null}}var py=!1,Ni=!1,jH=typeof WeakSet=="function"?WeakSet:Set,De=null;function Gd(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ur(e,t,r)}else n.current=null}function Vx(e,t,n){try{n()}catch(r){ur(e,t,r)}}var NA=!1;function VH(e,t){if(Tx=ov,e=N9(),yE(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(a=s+i),d!==o||r!==0&&d.nodeType!==3||(l=s+r),d.nodeType===3&&(s+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(a=s),f===o&&++c===r&&(l=s),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ax={focusedElem:e,selectionRange:n},ov=!1,De=t;De!==null;)if(t=De,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,De=e;else for(;De!==null;){t=De;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,b=p.memoizedState,_=t.stateNode,y=_.getSnapshotBeforeUpdate(t.elementType===t.type?m:_s(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(se(163))}}catch(v){ur(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,De=e;break}De=t.return}return p=NA,NA=!1,p}function mp(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&&Vx(t,n,o)}i=i.next}while(i!==r)}}function a_(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 Gx(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 IM(e){var t=e.alternate;t!==null&&(e.alternate=null,IM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ea],delete t[Gp],delete t[Rx],delete t[EH],delete t[TH])),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 OM(e){return e.tag===5||e.tag===3||e.tag===4}function DA(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||OM(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 Hx(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=lv));else if(r!==4&&(e=e.child,e!==null))for(Hx(e,t,n),e=e.sibling;e!==null;)Hx(e,t,n),e=e.sibling}function qx(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(qx(e,t,n),e=e.sibling;e!==null;)qx(e,t,n),e=e.sibling}var gi=null,bs=!1;function wl(e,t,n){for(n=n.child;n!==null;)MM(e,t,n),n=n.sibling}function MM(e,t,n){if(la&&typeof la.onCommitFiberUnmount=="function")try{la.onCommitFiberUnmount(J1,n)}catch{}switch(n.tag){case 5:Ni||Gd(n,t);case 6:var r=gi,i=bs;gi=null,wl(e,t,n),gi=r,bs=i,gi!==null&&(bs?(e=gi,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):gi.removeChild(n.stateNode));break;case 18:gi!==null&&(bs?(e=gi,n=n.stateNode,e.nodeType===8?y2(e.parentNode,n):e.nodeType===1&&y2(e,n),Bp(e)):y2(gi,n.stateNode));break;case 4:r=gi,i=bs,gi=n.stateNode.containerInfo,bs=!0,wl(e,t,n),gi=r,bs=i;break;case 0:case 11:case 14:case 15:if(!Ni&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Vx(n,t,s),i=i.next}while(i!==r)}wl(e,t,n);break;case 1:if(!Ni&&(Gd(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ur(n,t,a)}wl(e,t,n);break;case 21:wl(e,t,n);break;case 22:n.mode&1?(Ni=(r=Ni)||n.memoizedState!==null,wl(e,t,n),Ni=r):wl(e,t,n);break;default:wl(e,t,n)}}function LA(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new jH),t.forEach(function(r){var i=ZH.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function ys(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=vr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*HH(r/1960))-r,10e?16:e,Ul===null)var r=!1;else{if(e=Ul,Ul=null,Sv=0,Bt&6)throw Error(se(331));var i=Bt;for(Bt|=4,De=e.current;De!==null;){var o=De,s=o.child;if(De.flags&16){var a=o.deletions;if(a!==null){for(var l=0;lvr()-$E?mc(e,0):LE|=n),po(e,t)}function UM(e,t){t===0&&(e.mode&1?(t=oy,oy<<=1,!(oy&130023424)&&(oy=4194304)):t=1);var n=Ki();e=il(e,t),e!==null&&(sm(e,t,n),po(e,n))}function YH(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),UM(e,n)}function ZH(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(se(314))}r!==null&&r.delete(t),UM(e,n)}var jM;jM=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||fo.current)ao=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ao=!1,BH(e,t,n);ao=!!(e.flags&131072)}else ao=!1,Kn&&t.flags&1048576&&H9(t,fv,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;x0(e,t),e=t.pendingProps;var i=Cf(t,Bi.current);nf(t,n),i=RE(null,t,r,e,i,n);var o=IE();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,ho(r)?(o=!0,cv(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,EE(t),i.updater=o_,t.stateNode=i,i._reactInternals=t,Lx(t,r,e,n),t=Bx(null,t,r,!0,o,n)):(t.tag=0,Kn&&o&&vE(t),qi(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(x0(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=eq(r),e=_s(r,e),i){case 0:t=Fx(null,t,r,e,n);break e;case 1:t=IA(null,t,r,e,n);break e;case 11:t=PA(null,t,r,e,n);break e;case 14:t=RA(null,t,r,_s(r.type,e),n);break e}throw Error(se(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:_s(r,i),Fx(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:_s(r,i),IA(e,t,r,i,n);case 3:e:{if(EM(t),e===null)throw Error(se(387));r=t.pendingProps,o=t.memoizedState,i=o.element,X9(e,t),gv(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=kf(Error(se(423)),t),t=OA(e,t,r,n,i);break e}else if(r!==i){i=kf(Error(se(424)),t),t=OA(e,t,r,n,i);break e}else for(Po=Ql(t.stateNode.containerInfo.firstChild),Io=t,Kn=!0,ws=null,n=J9(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ef(),r===i){t=ol(e,t,n);break e}qi(e,t,r,n)}t=t.child}return t;case 5:return eM(t),e===null&&Mx(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,kx(r,i)?s=null:o!==null&&kx(r,o)&&(t.flags|=32),CM(e,t),qi(e,t,s,n),t.child;case 6:return e===null&&Mx(t),null;case 13:return TM(e,t,n);case 4:return TE(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Tf(t,null,r,n):qi(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:_s(r,i),PA(e,t,r,i,n);case 7:return qi(e,t,t.pendingProps,n),t.child;case 8:return qi(e,t,t.pendingProps.children,n),t.child;case 12:return qi(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,An(hv,r._currentValue),r._currentValue=s,o!==null)if(Ds(o.value,s)){if(o.children===i.children&&!fo.current){t=ol(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Xa(-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),Nx(o.return,n,t),a.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(se(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Nx(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qi(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,nf(t,n),i=es(i),r=r(i),t.flags|=1,qi(e,t,r,n),t.child;case 14:return r=t.type,i=_s(r,t.pendingProps),i=_s(r.type,i),RA(e,t,r,i,n);case 15:return wM(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:_s(r,i),x0(e,t),t.tag=1,ho(r)?(e=!0,cv(t)):e=!1,nf(t,n),Y9(t,r,i),Lx(t,r,i,n),Bx(null,t,r,!0,e,n);case 19:return AM(e,t,n);case 22:return xM(e,t,n)}throw Error(se(156,t.tag))};function VM(e,t){return g9(e,t)}function JH(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 Yo(e,t,n,r){return new JH(e,t,n,r)}function UE(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eq(e){if(typeof e=="function")return UE(e)?1:0;if(e!=null){if(e=e.$$typeof,e===sE)return 11;if(e===aE)return 14}return 2}function eu(e,t){var n=e.alternate;return n===null?(n=Yo(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 T0(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")UE(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Dd:return yc(n.children,i,o,t);case oE:s=8,i|=8;break;case sx:return e=Yo(12,n,t,i|2),e.elementType=sx,e.lanes=o,e;case ax:return e=Yo(13,n,t,i),e.elementType=ax,e.lanes=o,e;case lx:return e=Yo(19,n,t,i),e.elementType=lx,e.lanes=o,e;case ZO:return u_(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case QO:s=10;break e;case YO:s=9;break e;case sE:s=11;break e;case aE:s=14;break e;case Pl:s=16,r=null;break e}throw Error(se(130,e==null?e:typeof e,""))}return t=Yo(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function yc(e,t,n,r){return e=Yo(7,e,r,t),e.lanes=n,e}function u_(e,t,n,r){return e=Yo(22,e,r,t),e.elementType=ZO,e.lanes=n,e.stateNode={isHidden:!1},e}function E2(e,t,n){return e=Yo(6,e,null,t),e.lanes=n,e}function T2(e,t,n){return t=Yo(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tq(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=s2(0),this.expirationTimes=s2(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=s2(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function jE(e,t,n,r,i,o,s,a,l){return e=new tq(e,t,n,a,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Yo(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},EE(o),e}function nq(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(WM)}catch(e){console.error(e)}}WM(),HO.exports=$o;var Cs=HO.exports;const y6e=Uc(Cs);var GA=Cs;ix.createRoot=GA.createRoot,ix.hydrateRoot=GA.hydrateRoot;const aq="modulepreload",lq=function(e,t){return new URL(e,t).href},HA={},KM=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=lq(o,r),o in HA)return;HA[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":aq,s||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),s)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 s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})};function ni(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:p_(e)?2:g_(e)?3:0}function tu(e,t){return du(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function A0(e,t){return du(e)===2?e.get(t):e[t]}function XM(e,t,n){var r=du(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function QM(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function p_(e){return pq&&e instanceof Map}function g_(e){return gq&&e instanceof Set}function Xr(e){return e.o||e.t}function WE(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ZM(e);delete t[yt];for(var n=sf(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=uq),Object.freeze(e),t&&sl(e,function(n,r){return cm(r,!0)},!0)),e}function uq(){ni(2)}function KE(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function ca(e){var t=Zx[e];return t||ni(18,e),t}function XE(e,t){Zx[e]||(Zx[e]=t)}function Yp(){return Jp}function A2(e,t){t&&(ca("Patches"),e.u=[],e.s=[],e.v=t)}function Cv(e){Yx(e),e.p.forEach(cq),e.p=null}function Yx(e){e===Jp&&(Jp=e.l)}function qA(e){return Jp={p:[],l:Jp,h:e,m:!0,_:0}}function cq(e){var t=e[yt];t.i===0||t.i===1?t.j():t.g=!0}function k2(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||ca("ES5").S(t,e,r),r?(n[yt].P&&(Cv(t),ni(4)),go(e)&&(e=Ev(t,e),t.l||Tv(t,e)),t.u&&ca("Patches").M(n[yt].t,e,t.u,t.s)):e=Ev(t,n,[]),Cv(t),t.u&&t.v(t.u,t.s),e!==y_?e:void 0}function Ev(e,t,n){if(KE(t))return t;var r=t[yt];if(!r)return sl(t,function(a,l){return WA(e,r,t,a,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Tv(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=WE(r.k):r.o,o=i,s=!1;r.i===3&&(o=new Set(i),i.clear(),s=!0),sl(o,function(a,l){return WA(e,r,i,a,l,n,s)}),Tv(e,i,!1),n&&e.u&&ca("Patches").N(r,n,e.u,e.s)}return r.o}function WA(e,t,n,r,i,o,s){if(Xi(i)){var a=Ev(e,i,o&&t&&t.i!==3&&!tu(t.R,r)?o.concat(r):void 0);if(XM(n,r,a),!Xi(a))return;e.m=!1}else s&&n.add(i);if(go(i)&&!KE(i)){if(!e.h.D&&e._<1)return;Ev(e,i),t&&t.A.l||Tv(e,i)}}function Tv(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&cm(t,n)}function P2(e,t){var n=e[yt];return(n?Xr(n):e)[t]}function KA(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 so(e){e.P||(e.P=!0,e.l&&so(e.l))}function R2(e){e.o||(e.o=WE(e.t))}function Zp(e,t,n){var r=p_(t)?ca("MapSet").F(t,n):g_(t)?ca("MapSet").T(t,n):e.O?function(i,o){var s=Array.isArray(i),a={i:s?1:0,A:o?o.A:Yp(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=a,u=eg;s&&(l=[a],u=np);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return a.k=f,a.j=d,f}(t,n):ca("ES5").J(t,n);return(n?n.A:Yp()).p.push(r),r}function m_(e){return Xi(e)||ni(22,e),function t(n){if(!go(n))return n;var r,i=n[yt],o=du(n);if(i){if(!i.P&&(i.i<4||!ca("ES5").K(i)))return i.t;i.I=!0,r=XA(n,o),i.I=!1}else r=XA(n,o);return sl(r,function(s,a){i&&A0(i.t,s)===a||XM(r,s,t(a))}),o===3?new Set(r):r}(e)}function XA(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return WE(e)}function QE(){function e(o,s){var a=i[o];return a?a.enumerable=s:i[o]=a={configurable:!0,enumerable:s,get:function(){var l=this[yt];return eg.get(l,o)},set:function(l){var u=this[yt];eg.set(u,o,l)}},a}function t(o){for(var s=o.length-1;s>=0;s--){var a=o[s][yt];if(!a.P)switch(a.i){case 5:r(a)&&so(a);break;case 4:n(a)&&so(a)}}}function n(o){for(var s=o.t,a=o.k,l=sf(a),u=l.length-1;u>=0;u--){var c=l[u];if(c!==yt){var d=s[c];if(d===void 0&&!tu(s,c))return!0;var f=a[c],h=f&&f[yt];if(h?h.t!==d:!QM(f,d))return!0}}var p=!!s[yt];return l.length!==sf(s).length+(p?0:1)}function r(o){var s=o.k;if(s.length!==o.t.length)return!0;var a=Object.getOwnPropertyDescriptor(s,s.length-1);if(a&&!a.get)return!0;for(var l=0;l1?_-1:0),g=1;g<_;g++)y[g-1]=arguments[g];return l.produce(m,function(v){var S;return(S=o).call.apply(S,[b,v].concat(y))})}}var u;if(typeof o!="function"&&ni(6),s!==void 0&&typeof s!="function"&&ni(7),go(i)){var c=qA(r),d=Zp(r,i,void 0),f=!0;try{u=o(d),f=!1}finally{f?Cv(c):Yx(c)}return typeof Promise<"u"&&u instanceof Promise?u.then(function(m){return A2(c,s),k2(m,c)},function(m){throw Cv(c),m}):(A2(c,s),k2(u,c))}if(!i||typeof i!="object"){if((u=o(i))===void 0&&(u=i),u===y_&&(u=void 0),r.D&&cm(u,!0),s){var h=[],p=[];ca("Patches").M(i,u,h,p),s(h,p)}return u}ni(21,i)},this.produceWithPatches=function(i,o){if(typeof i=="function")return function(u){for(var c=arguments.length,d=Array(c>1?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 s=ca("Patches").$;return Xi(n)?s(n,r):this.produce(n,function(a){return s(a,r)})},e}(),No=new JM,eN=No.produce,JE=No.produceWithPatches.bind(No),yq=No.setAutoFreeze.bind(No),vq=No.setUseProxies.bind(No),Jx=No.applyPatches.bind(No),_q=No.createDraft.bind(No),bq=No.finishDraft.bind(No);const ku=eN,Sq=Object.freeze(Object.defineProperty({__proto__:null,Immer:JM,applyPatches:Jx,castDraft:fq,castImmutable:hq,createDraft:_q,current:m_,default:ku,enableAllPlugins:dq,enableES5:QE,enableMapSet:YM,enablePatches:YE,finishDraft:bq,freeze:cm,immerable:of,isDraft:Xi,isDraftable:go,nothing:y_,original:qE,produce:eN,produceWithPatches:JE,setAutoFreeze:yq,setUseProxies:vq},Symbol.toStringTag,{value:"Module"}));function tg(e){"@babel/helpers - typeof";return tg=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},tg(e)}function wq(e,t){if(tg(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(tg(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xq(e){var t=wq(e,"string");return tg(t)==="symbol"?t:String(t)}function Cq(e,t,n){return t=xq(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZA(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 JA(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(mi(1));return n(dm)(e,t)}if(typeof e!="function")throw new Error(mi(2));var i=e,o=t,s=[],a=s,l=!1;function u(){a===s&&(a=s.slice())}function c(){if(l)throw new Error(mi(3));return o}function d(m){if(typeof m!="function")throw new Error(mi(4));if(l)throw new Error(mi(5));var b=!0;return u(),a.push(m),function(){if(b){if(l)throw new Error(mi(6));b=!1,u();var y=a.indexOf(m);a.splice(y,1),s=null}}}function f(m){if(!Eq(m))throw new Error(mi(7));if(typeof m.type>"u")throw new Error(mi(8));if(l)throw new Error(mi(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var b=s=a,_=0;_"u")throw new Error(mi(12));if(typeof n(void 0,{type:Rf.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(mi(13))})}function rh(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(mi(14));d[h]=b,c=c||b!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function tk(e,t){return function(){return t(e.apply(this,arguments))}}function nN(e,t){if(typeof e=="function")return tk(e,t);if(typeof e!="object"||e===null)throw new Error(mi(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=tk(i,t))}return n}function If(){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 Av}function i(a,l){r(a)===Av&&(n.unshift({key:a,value:l}),n.length>e&&n.pop())}function o(){return n}function s(){n=[]}return{get:r,put:i,getEntries:o,clear:s}}var rN=function(t,n){return t===n};function Rq(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var a=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(b,_){var y=t?t+"."+b:b;if(l){var g=i.some(function(v){return v instanceof RegExp?v.test(y):y===v});if(g)return"continue"}if(!n(_))return{value:{keyPath:y,value:_}};if(typeof _=="object"&&(s=dN(_,y,n,r,i,o),s))return{value:s}},c=0,d=a;c-1}function Wq(e){return""+e}function mN(e){var t={},n=[],r,i={addCase:function(o,s){var a=typeof o=="string"?o:o.type;if(a in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[a]=s,i},addMatcher:function(o,s){return n.push({matcher:o,reducer:s}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function Kq(e){return typeof e=="function"}function yN(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?mN(t):[t,n,r],o=i[0],s=i[1],a=i[2],l;if(Kq(e))l=function(){return eC(e())};else{var u=eC(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=fu([o[f.type]],s.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=[a]),h.reduce(function(p,m){if(m)if(Xi(p)){var b=p,_=m(b,f);return _===void 0?p:_}else{if(go(p))return ku(p,function(y){return m(y,f)});var _=m(p,f);if(_===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return _}return p},d)}return c.getInitialState=l,c}function Xq(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:eC(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},s={},a={};i.forEach(function(c){var d=r[c],f=Xq(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,s[f]=h,a[c]=p?Le(f,p):Le(f)});function l(){var c=typeof e.extraReducers=="function"?mN(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],b=m===void 0?void 0:m,_=lo(lo({},f),s);return yN(n,function(y){for(var g in _)y.addCase(g,_[g]);for(var v=0,S=p;v0;if(y){var g=p.filter(function(v){return u(b,v,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var b=vN(p,e,m),_=b[0],y=b[1];d(y,m),n(_,m)}return{removeAll:Jq(l),addOne:mr(t),addMany:mr(n),setOne:mr(r),setMany:mr(i),setAll:mr(o),updateOne:mr(c),updateMany:mr(d),upsertOne:mr(f),upsertMany:mr(h),removeOne:mr(s),removeMany:mr(a)}}function eW(e,t){var n=_N(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function s(y,g){return a([y],g)}function a(y,g){y=vc(y);var v=y.filter(function(S){return!(_p(S,e)in g.entities)});v.length!==0&&b(v,g)}function l(y,g){return u([y],g)}function u(y,g){y=vc(y),y.length!==0&&b(y,g)}function c(y,g){y=vc(y),g.entities={},g.ids=[],a(y,g)}function d(y,g){return f([y],g)}function f(y,g){for(var v=!1,S=0,w=y;S-1;return n&&r}function pm(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function b_(){for(var e=[],t=0;t0)for(var g=h.getState(),v=Array.from(n.values()),S=0,w=v;SMath.floor(e/t)*t,xs=(e,t)=>Math.round(e/t)*t;var _W=typeof global=="object"&&global&&global.Object===Object&&global;const $N=_W;var bW=typeof self=="object"&&self&&self.Object===Object&&self,SW=$N||bW||Function("return this")();const wa=SW;var wW=wa.Symbol;const ns=wW;var FN=Object.prototype,xW=FN.hasOwnProperty,CW=FN.toString,Oh=ns?ns.toStringTag:void 0;function EW(e){var t=xW.call(e,Oh),n=e[Oh];try{e[Oh]=void 0;var r=!0}catch{}var i=CW.call(e);return r&&(t?e[Oh]=n:delete e[Oh]),i}var TW=Object.prototype,AW=TW.toString;function kW(e){return AW.call(e)}var PW="[object Null]",RW="[object Undefined]",uk=ns?ns.toStringTag:void 0;function Bs(e){return e==null?e===void 0?RW:PW:uk&&uk in Object(e)?EW(e):kW(e)}function mo(e){return e!=null&&typeof e=="object"}var IW="[object Symbol]";function S_(e){return typeof e=="symbol"||mo(e)&&Bs(e)==IW}function i5(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=dK)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function gK(e){return function(){return e}}var mK=function(){try{var e=Hc(Object,"defineProperty");return e({},"",{}),e}catch{}}();const Ov=mK;var yK=Ov?function(e,t){return Ov(e,"toString",{configurable:!0,enumerable:!1,value:gK(t),writable:!0})}:w_;const vK=yK;var _K=pK(vK);const jN=_K;function VN(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var EK=9007199254740991,TK=/^(?:0|[1-9]\d*)$/;function s5(e,t){var n=typeof e;return t=t??EK,!!t&&(n=="number"||n!="symbol"&&TK.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=PK}function qc(e){return e!=null&&a5(e.length)&&!o5(e)}function WN(e,t,n){if(!zi(n))return!1;var r=typeof t;return(r=="number"?qc(n)&&s5(t,n.length):r=="string"&&t in n)?vm(n[t],e):!1}function KN(e){return qN(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,s&&WN(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function GX(e,t){var n=this.__data__,r=E_(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function hl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(a)?t>1?t7(a,t-1,n,r,i):h5(i,a):r||(i[i.length]=a)}return i}function aQ(e){var t=e==null?0:e.length;return t?t7(e,1):[]}function lQ(e){return jN(HN(e,void 0,aQ),e+"")}var uQ=JN(Object.getPrototypeOf,Object);const p5=uQ;var cQ="[object Object]",dQ=Function.prototype,fQ=Object.prototype,n7=dQ.toString,hQ=fQ.hasOwnProperty,pQ=n7.call(Object);function r7(e){if(!mo(e)||Bs(e)!=cQ)return!1;var t=p5(e);if(t===null)return!0;var n=hQ.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&n7.call(n)==pQ}function i7(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:i7(e,t,n)}var gQ="\\ud800-\\udfff",mQ="\\u0300-\\u036f",yQ="\\ufe20-\\ufe2f",vQ="\\u20d0-\\u20ff",_Q=mQ+yQ+vQ,bQ="\\ufe0e\\ufe0f",SQ="\\u200d",wQ=RegExp("["+SQ+gQ+_Q+bQ+"]");function k_(e){return wQ.test(e)}function xQ(e){return e.split("")}var s7="\\ud800-\\udfff",CQ="\\u0300-\\u036f",EQ="\\ufe20-\\ufe2f",TQ="\\u20d0-\\u20ff",AQ=CQ+EQ+TQ,kQ="\\ufe0e\\ufe0f",PQ="["+s7+"]",iC="["+AQ+"]",oC="\\ud83c[\\udffb-\\udfff]",RQ="(?:"+iC+"|"+oC+")",a7="[^"+s7+"]",l7="(?:\\ud83c[\\udde6-\\uddff]){2}",u7="[\\ud800-\\udbff][\\udc00-\\udfff]",IQ="\\u200d",c7=RQ+"?",d7="["+kQ+"]?",OQ="(?:"+IQ+"(?:"+[a7,l7,u7].join("|")+")"+d7+c7+")*",MQ=d7+c7+OQ,NQ="(?:"+[a7+iC+"?",iC,l7,u7,PQ].join("|")+")",DQ=RegExp(oC+"(?="+oC+")|"+NQ+MQ,"g");function LQ(e){return e.match(DQ)||[]}function f7(e){return k_(e)?LQ(e):xQ(e)}function $Q(e){return function(t){t=Mf(t);var n=k_(t)?f7(t):void 0,r=n?n[0]:t.charAt(0),i=n?o7(n,1).join(""):t.slice(1);return r[e]()+i}}var FQ=$Q("toUpperCase");const h7=FQ;function p7(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 jl(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=P0(n),n=n===n?n:0),t!==void 0&&(t=P0(t),t=t===t?t:0),kY(P0(e),t,n)}function PY(){this.__data__=new hl,this.size=0}function RY(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function IY(e){return this.__data__.get(e)}function OY(e){return this.__data__.has(e)}var MY=200;function NY(e,t){var n=this.__data__;if(n instanceof hl){var r=n.__data__;if(!og||r.lengtha))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&pJ?new sg:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),ih(e,N7(e),n),r&&(n=Sp(n,Oee|Mee|Nee,Iee));for(var i=t.length;i--;)Q7(n,t[i]);return n});const I_=Dee;var Lee=H7("length");const $ee=Lee;var Y7="\\ud800-\\udfff",Fee="\\u0300-\\u036f",Bee="\\ufe20-\\ufe2f",zee="\\u20d0-\\u20ff",Uee=Fee+Bee+zee,jee="\\ufe0e\\ufe0f",Vee="["+Y7+"]",dC="["+Uee+"]",fC="\\ud83c[\\udffb-\\udfff]",Gee="(?:"+dC+"|"+fC+")",Z7="[^"+Y7+"]",J7="(?:\\ud83c[\\udde6-\\uddff]){2}",eD="[\\ud800-\\udbff][\\udc00-\\udfff]",Hee="\\u200d",tD=Gee+"?",nD="["+jee+"]?",qee="(?:"+Hee+"(?:"+[Z7,J7,eD].join("|")+")"+nD+tD+")*",Wee=nD+tD+qee,Kee="(?:"+[Z7+dC+"?",dC,J7,eD,Vee].join("|")+")",Gk=RegExp(fC+"(?="+fC+")|"+Kee+Wee,"g");function Xee(e){for(var t=Gk.lastIndex=0;Gk.test(e);)++t;return t}function rD(e){return k_(e)?Xee(e):$ee(e)}function Qee(e,t,n,r,i){return i(e,function(o,s,a){n=r?(r=!1,o):t(n,o,s,a)}),n}function hC(e,t,n){var r=Ir(e)?p7:Qee,i=arguments.length<3;return r(e,oh(t),n,i,sh)}var Yee="[object Map]",Zee="[object Set]";function O_(e){if(e==null)return 0;if(qc(e))return K7(e)?rD(e):e.length;var t=Nf(e);return t==Yee||t==Zee?e.size:e7(e).length}function Jee(e,t){var n;return sh(e,function(r,i,o){return n=t(r,i,o),!n}),!!n}function wp(e,t,n){var r=Ir(e)?z7:Jee;return n&&WN(e,t,n)&&(t=void 0),r(e,oh(t))}var ete=AY(function(e,t,n){return e+(n?" ":"")+h7(t)});const tte=ete;var nte=30,rte="...",ite=/\w*$/;function $2(e,t){var n=nte,r=rte;if(zi(t)){var i="separator"in t?t.separator:i;n="length"in t?BN(t.length):n,r="omission"in t?Iv(t.omission):r}e=Mf(e);var o=e.length;if(k_(e)){var s=f7(e);o=s.length}if(n>=o)return e;var a=n-rD(r);if(a<1)return r;var l=s?o7(s,0,a).join(""):e.slice(0,a);if(i===void 0)return l+r;if(s&&(a+=l.length-a),Aee(i)){if(e.slice(a).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,Mf(ite.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?a:d)}}else if(e.indexOf(Iv(i),a)!=a){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var ote=1/0,ste=cf&&1/y5(new cf([,-0]))[1]==ote?function(e){return new cf(e)}:cK;const ate=ste;var lte=200;function ute(e,t,n){var r=-1,i=CK,o=e.length,s=!0,a=[],l=a;if(n)s=!1,i=dee;else if(o>=lte){var u=t?null:ate(e);if(u)return y5(u);s=!1,i=U7,l=new sg}else l=t?[]:a;e:for(;++r{Ree(e,t.payload)}}}),{configChanged:dte}=oD.actions,fte=oD.reducer,v6e={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},_6e={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},hte={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]}},b6e={lycoris:"LyCORIS",diffusers:"Diffusers"},S6e=0,pte=4294967295;var Vt;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(const a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(const s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Vt||(Vt={}));var pC;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(pC||(pC={}));const Ie=Vt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$l=e=>{switch(typeof e){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return isNaN(e)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(e)?Ie.array:e===null?Ie.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ie.promise:typeof Map<"u"&&e instanceof Map?Ie.map:typeof Set<"u"&&e instanceof Set?Ie.set:typeof Date<"u"&&e instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},de=Vt.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"]),gte=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Os extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Os.create=e=>new Os(e);const ag=(e,t)=>{let n;switch(e.code){case de.invalid_type:e.received===Ie.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case de.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Vt.jsonStringifyReplacer)}`;break;case de.unrecognized_keys:n=`Unrecognized key(s) in object: ${Vt.joinValues(e.keys,", ")}`;break;case de.invalid_union:n="Invalid input";break;case de.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Vt.joinValues(e.options)}`;break;case de.invalid_enum_value:n=`Invalid enum value. Expected ${Vt.joinValues(e.options)}, received '${e.received}'`;break;case de.invalid_arguments:n="Invalid function arguments";break;case de.invalid_return_type:n="Invalid function return type";break;case de.invalid_date:n="Invalid date";break;case de.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}"`:Vt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case de.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 de.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 de.custom:n="Invalid input";break;case de.invalid_intersection_types:n="Intersection results could not be merged";break;case de.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case de.not_finite:n="Number must be finite";break;default:n=t.defaultError,Vt.assertNever(e)}return{message:n}};let sD=ag;function mte(e){sD=e}function Dv(){return sD}const Lv=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],s={...i,path:o};let a="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:i.message||a}},yte=[];function Me(e,t){const n=Lv({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Dv(),ag].filter(r=>!!r)});e.common.issues.push(n)}class Ui{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 ft;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 Ui.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ft;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:t.value,value:r}}}const ft=Object.freeze({status:"aborted"}),aD=e=>({status:"dirty",value:e}),Qi=e=>({status:"valid",value:e}),gC=e=>e.status==="aborted",mC=e=>e.status==="dirty",lg=e=>e.status==="valid",$v=e=>typeof Promise<"u"&&e instanceof Promise;var et;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(et||(et={}));class ya{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 qk=(e,t)=>{if(lg(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 Os(e.common.issues);return this._error=n,this._error}}};function vt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>s.code!=="invalid_type"?{message:a.defaultError}:typeof a.data>"u"?{message:r??a.defaultError}:{message:n??a.defaultError},description:i}}class wt{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 $l(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:$l(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ui,ctx:{common:t.parent.common,data:t.data,parsedType:$l(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if($v(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:$l(t)},o=this._parseSync({data:t,path:i.path,parent:i});return qk(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:$l(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await($v(i)?i:Promise.resolve(i));return qk(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=t(i),a=()=>o.addIssue({code:de.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new $s({schema:this,typeName:it.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Qa.create(this,this._def)}nullable(){return Ic.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ms.create(this,this._def)}promise(){return Lf.create(this,this._def)}or(t){return fg.create([this,t],this._def)}and(t){return hg.create(this,t,this._def)}transform(t){return new $s({...vt(this._def),schema:this,typeName:it.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new vg({...vt(this._def),innerType:this,defaultValue:n,typeName:it.ZodDefault})}brand(){return new uD({typeName:it.ZodBranded,type:this,...vt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Uv({...vt(this._def),innerType:this,catchValue:n,typeName:it.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return xm.create(this,t)}readonly(){return Vv.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vte=/^c[^\s-]{8,}$/i,_te=/^[a-z][a-z0-9]*$/,bte=/[0-9A-HJKMNP-TV-Z]{26}/,Ste=/^[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,wte=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xte=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Cte=/^(((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}))$/,Ete=/^(([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})))$/,Tte=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 Ate(e,t){return!!((t==="v4"||!t)&&Cte.test(e)||(t==="v6"||!t)&&Ete.test(e))}class ks extends wt{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:de.invalid_string,...et.errToObj(r)}),this.nonempty=t=>this.min(1,et.errToObj(t)),this.trim=()=>new ks({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new ks({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new ks({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ie.string){const o=this._getOrReturnCtx(t);return Me(o,{code:de.invalid_type,expected:Ie.string,received:o.parsedType}),ft}const r=new Ui;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:de.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=t.data.length>o.value,a=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...et.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...et.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...et.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...et.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...et.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...et.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...et.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...et.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 ks({checks:[],typeName:it.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...vt(e)})};function kte(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),s=parseInt(t.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class gu extends wt{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)!==Ie.number){const o=this._getOrReturnCtx(t);return Me(o,{code:de.invalid_type,expected:Ie.number,received:o.parsedType}),ft}let r;const i=new Ui;for(const o of this._def.checks)o.kind==="int"?Vt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:de.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),Me(r,{code:de.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?kte(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),Me(r,{code:de.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Me(r,{code:de.not_finite,message:o.message}),i.dirty()):Vt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,et.toString(n))}gt(t,n){return this.setLimit("min",t,!1,et.toString(n))}lte(t,n){return this.setLimit("max",t,!0,et.toString(n))}lt(t,n){return this.setLimit("max",t,!1,et.toString(n))}setLimit(t,n,r,i){return new gu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:et.toString(i)}]})}_addCheck(t){return new gu({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:et.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:et.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:et.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.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"&&Vt.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 gu({checks:[],typeName:it.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...vt(e)});class mu extends wt{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)!==Ie.bigint){const o=this._getOrReturnCtx(t);return Me(o,{code:de.invalid_type,expected:Ie.bigint,received:o.parsedType}),ft}let r;const i=new Ui;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),Me(r,{code:de.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),Me(r,{code:de.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Vt.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,et.toString(n))}gt(t,n){return this.setLimit("min",t,!1,et.toString(n))}lte(t,n){return this.setLimit("max",t,!0,et.toString(n))}lt(t,n){return this.setLimit("max",t,!1,et.toString(n))}setLimit(t,n,r,i){return new mu({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:et.toString(i)}]})}_addCheck(t){return new mu({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:et.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 mu({checks:[],typeName:it.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...vt(e)})};class ug extends wt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ie.boolean){const r=this._getOrReturnCtx(t);return Me(r,{code:de.invalid_type,expected:Ie.boolean,received:r.parsedType}),ft}return Qi(t.data)}}ug.create=e=>new ug({typeName:it.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...vt(e)});class Pc extends wt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ie.date){const o=this._getOrReturnCtx(t);return Me(o,{code:de.invalid_type,expected:Ie.date,received:o.parsedType}),ft}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return Me(o,{code:de.invalid_date}),ft}const r=new Ui;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),Me(i,{code:de.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):Vt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Pc({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:et.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:et.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 Pc({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:it.ZodDate,...vt(e)});class Fv extends wt{_parse(t){if(this._getType(t)!==Ie.symbol){const r=this._getOrReturnCtx(t);return Me(r,{code:de.invalid_type,expected:Ie.symbol,received:r.parsedType}),ft}return Qi(t.data)}}Fv.create=e=>new Fv({typeName:it.ZodSymbol,...vt(e)});class cg extends wt{_parse(t){if(this._getType(t)!==Ie.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:de.invalid_type,expected:Ie.undefined,received:r.parsedType}),ft}return Qi(t.data)}}cg.create=e=>new cg({typeName:it.ZodUndefined,...vt(e)});class dg extends wt{_parse(t){if(this._getType(t)!==Ie.null){const r=this._getOrReturnCtx(t);return Me(r,{code:de.invalid_type,expected:Ie.null,received:r.parsedType}),ft}return Qi(t.data)}}dg.create=e=>new dg({typeName:it.ZodNull,...vt(e)});class Df extends wt{constructor(){super(...arguments),this._any=!0}_parse(t){return Qi(t.data)}}Df.create=e=>new Df({typeName:it.ZodAny,...vt(e)});class _c extends wt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Qi(t.data)}}_c.create=e=>new _c({typeName:it.ZodUnknown,...vt(e)});class al extends wt{_parse(t){const n=this._getOrReturnCtx(t);return Me(n,{code:de.invalid_type,expected:Ie.never,received:n.parsedType}),ft}}al.create=e=>new al({typeName:it.ZodNever,...vt(e)});class Bv extends wt{_parse(t){if(this._getType(t)!==Ie.undefined){const r=this._getOrReturnCtx(t);return Me(r,{code:de.invalid_type,expected:Ie.void,received:r.parsedType}),ft}return Qi(t.data)}}Bv.create=e=>new Bv({typeName:it.ZodVoid,...vt(e)});class Ms extends wt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ie.array)return Me(n,{code:de.invalid_type,expected:Ie.array,received:n.parsedType}),ft;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,a=n.data.lengthi.maxLength.value&&(Me(n,{code:de.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new ya(n,s,n.path,a)))).then(s=>Ui.mergeArray(r,s));const o=[...n.data].map((s,a)=>i.type._parseSync(new ya(n,s,n.path,a)));return Ui.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Ms({...this._def,minLength:{value:t,message:et.toString(n)}})}max(t,n){return new Ms({...this._def,maxLength:{value:t,message:et.toString(n)}})}length(t,n){return new Ms({...this._def,exactLength:{value:t,message:et.toString(n)}})}nonempty(t){return this.min(1,t)}}Ms.create=(e,t)=>new Ms({type:e,minLength:null,maxLength:null,exactLength:null,typeName:it.ZodArray,...vt(t)});function kd(e){if(e instanceof er){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Qa.create(kd(r))}return new er({...e._def,shape:()=>t})}else return e instanceof Ms?new Ms({...e._def,type:kd(e.element)}):e instanceof Qa?Qa.create(kd(e.unwrap())):e instanceof Ic?Ic.create(kd(e.unwrap())):e instanceof va?va.create(e.items.map(t=>kd(t))):e}class er extends wt{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=Vt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Ie.object){const u=this._getOrReturnCtx(t);return Me(u,{code:de.invalid_type,expected:Ie.object,received:u.parsedType}),ft}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof al&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||a.push(u);const l=[];for(const u of s){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new ya(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof al){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of a)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")a.length>0&&(Me(i,{code:de.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of a){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new ya(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=>Ui.mergeObjectSync(r,u)):Ui.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return et.errToObj,new er({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,s,a;const l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=et.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new er({...this._def,unknownKeys:"strip"})}passthrough(){return new er({...this._def,unknownKeys:"passthrough"})}extend(t){return new er({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new er({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:it.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new er({...this._def,catchall:t})}pick(t){const n={};return Vt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new er({...this._def,shape:()=>n})}omit(t){const n={};return Vt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new er({...this._def,shape:()=>n})}deepPartial(){return kd(this)}partial(t){const n={};return Vt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new er({...this._def,shape:()=>n})}required(t){const n={};return Vt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Qa;)o=o._def.innerType;n[r]=o}}),new er({...this._def,shape:()=>n})}keyof(){return lD(Vt.objectKeys(this.shape))}}er.create=(e,t)=>new er({shape:()=>e,unknownKeys:"strip",catchall:al.create(),typeName:it.ZodObject,...vt(t)});er.strictCreate=(e,t)=>new er({shape:()=>e,unknownKeys:"strict",catchall:al.create(),typeName:it.ZodObject,...vt(t)});er.lazycreate=(e,t)=>new er({shape:e,unknownKeys:"strip",catchall:al.create(),typeName:it.ZodObject,...vt(t)});class fg extends wt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(a=>new Os(a.ctx.common.issues));return Me(n,{code:de.invalid_union,unionErrors:s}),ft}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},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&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(l=>new Os(l));return Me(n,{code:de.invalid_union,unionErrors:a}),ft}}get options(){return this._def.options}}fg.create=(e,t)=>new fg({options:e,typeName:it.ZodUnion,...vt(t)});const R0=e=>e instanceof gg?R0(e.schema):e instanceof $s?R0(e.innerType()):e instanceof mg?[e.value]:e instanceof yu?e.options:e instanceof yg?Object.keys(e.enum):e instanceof vg?R0(e._def.innerType):e instanceof cg?[void 0]:e instanceof dg?[null]:null;class M_ extends wt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ie.object)return Me(n,{code:de.invalid_type,expected:Ie.object,received:n.parsedType}),ft;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}):(Me(n,{code:de.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ft)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const s=R0(o.shape[t]);if(!s)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new M_({typeName:it.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...vt(r)})}}function yC(e,t){const n=$l(e),r=$l(t);if(e===t)return{valid:!0,data:e};if(n===Ie.object&&r===Ie.object){const i=Vt.objectKeys(t),o=Vt.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(const a of o){const l=yC(e[a],t[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===Ie.array&&r===Ie.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(gC(o)||gC(s))return ft;const a=yC(o.value,s.value);return a.valid?((mC(o)||mC(s))&&n.dirty(),{status:n.value,value:a.data}):(Me(r,{code:de.invalid_intersection_types}),ft)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}hg.create=(e,t,n)=>new hg({left:e,right:t,typeName:it.ZodIntersection,...vt(n)});class va extends wt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.array)return Me(r,{code:de.invalid_type,expected:Ie.array,received:r.parsedType}),ft;if(r.data.lengththis._def.items.length&&(Me(r,{code:de.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new ya(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Ui.mergeArray(n,s)):Ui.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new va({...this._def,rest:t})}}va.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new va({items:e,typeName:it.ZodTuple,rest:null,...vt(t)})};class pg extends wt{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!==Ie.object)return Me(r,{code:de.invalid_type,expected:Ie.object,received:r.parsedType}),ft;const i=[],o=this._def.keyType,s=this._def.valueType;for(const a in r.data)i.push({key:o._parse(new ya(r,a,r.path,a)),value:s._parse(new ya(r,r.data[a],r.path,a))});return r.common.async?Ui.mergeObjectAsync(n,i):Ui.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof wt?new pg({keyType:t,valueType:n,typeName:it.ZodRecord,...vt(r)}):new pg({keyType:ks.create(),valueType:t,typeName:it.ZodRecord,...vt(n)})}}class zv extends wt{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!==Ie.map)return Me(r,{code:de.invalid_type,expected:Ie.map,received:r.parsedType}),ft;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,l],u)=>({key:i._parse(new ya(r,a,r.path,[u,"key"])),value:o._parse(new ya(r,l,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of s){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return ft;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of s){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return ft;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),a.set(u.value,c.value)}return{status:n.value,value:a}}}}zv.create=(e,t,n)=>new zv({valueType:t,keyType:e,typeName:it.ZodMap,...vt(n)});class Rc extends wt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.set)return Me(r,{code:de.invalid_type,expected:Ie.set,received:r.parsedType}),ft;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Me(r,{code:de.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(l){const u=new Set;for(const c of l){if(c.status==="aborted")return ft;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((l,u)=>o._parse(new ya(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(t,n){return new Rc({...this._def,minSize:{value:t,message:et.toString(n)}})}max(t,n){return new Rc({...this._def,maxSize:{value:t,message:et.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Rc.create=(e,t)=>new Rc({valueType:e,minSize:null,maxSize:null,typeName:it.ZodSet,...vt(t)});class df extends wt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ie.function)return Me(n,{code:de.invalid_type,expected:Ie.function,received:n.parsedType}),ft;function r(a,l){return Lv({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dv(),ag].filter(u=>!!u),issueData:{code:de.invalid_arguments,argumentsError:l}})}function i(a,l){return Lv({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dv(),ag].filter(u=>!!u),issueData:{code:de.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Lf){const a=this;return Qi(async function(...l){const u=new Os([]),c=await a._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(s,this,c);return await a._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const a=this;return Qi(function(...l){const u=a._def.args.safeParse(l,o);if(!u.success)throw new Os([r(l,u.error)]);const c=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(c,o);if(!d.success)throw new Os([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new df({...this._def,args:va.create(t).rest(_c.create())})}returns(t){return new df({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new df({args:t||va.create([]).rest(_c.create()),returns:n||_c.create(),typeName:it.ZodFunction,...vt(r)})}}class gg extends wt{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})}}gg.create=(e,t)=>new gg({getter:e,typeName:it.ZodLazy,...vt(t)});class mg extends wt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Me(n,{received:n.data,code:de.invalid_literal,expected:this._def.value}),ft}return{status:"valid",value:t.data}}get value(){return this._def.value}}mg.create=(e,t)=>new mg({value:e,typeName:it.ZodLiteral,...vt(t)});function lD(e,t){return new yu({values:e,typeName:it.ZodEnum,...vt(t)})}class yu extends wt{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{expected:Vt.joinValues(r),received:n.parsedType,code:de.invalid_type}),ft}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return Me(n,{received:n.data,code:de.invalid_enum_value,options:r}),ft}return Qi(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 yu.create(t)}exclude(t){return yu.create(this.options.filter(n=>!t.includes(n)))}}yu.create=lD;class yg extends wt{_parse(t){const n=Vt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ie.string&&r.parsedType!==Ie.number){const i=Vt.objectValues(n);return Me(r,{expected:Vt.joinValues(i),received:r.parsedType,code:de.invalid_type}),ft}if(n.indexOf(t.data)===-1){const i=Vt.objectValues(n);return Me(r,{received:r.data,code:de.invalid_enum_value,options:i}),ft}return Qi(t.data)}get enum(){return this._def.values}}yg.create=(e,t)=>new yg({values:e,typeName:it.ZodNativeEnum,...vt(t)});class Lf extends wt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ie.promise&&n.common.async===!1)return Me(n,{code:de.invalid_type,expected:Ie.promise,received:n.parsedType}),ft;const r=n.parsedType===Ie.promise?n.data:Promise.resolve(n.data);return Qi(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Lf.create=(e,t)=>new Lf({type:e,typeName:it.ZodPromise,...vt(t)});class $s extends wt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===it.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:s=>{Me(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const s=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(s).then(a=>this._def.schema._parseAsync({data:a,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}if(i.type==="refinement"){const s=a=>{const l=i.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ft:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?ft:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!lg(s))return s;const a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>lg(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:n.value,value:a})):s);Vt.assertNever(i)}}$s.create=(e,t,n)=>new $s({schema:e,typeName:it.ZodEffects,effect:t,...vt(n)});$s.createWithPreprocess=(e,t,n)=>new $s({schema:t,effect:{type:"preprocess",transform:e},typeName:it.ZodEffects,...vt(n)});class Qa extends wt{_parse(t){return this._getType(t)===Ie.undefined?Qi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Qa.create=(e,t)=>new Qa({innerType:e,typeName:it.ZodOptional,...vt(t)});class Ic extends wt{_parse(t){return this._getType(t)===Ie.null?Qi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ic.create=(e,t)=>new Ic({innerType:e,typeName:it.ZodNullable,...vt(t)});class vg extends wt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ie.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}vg.create=(e,t)=>new vg({innerType:e,typeName:it.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...vt(t)});class Uv extends wt{_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 $v(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Os(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Os(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Uv.create=(e,t)=>new Uv({innerType:e,typeName:it.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...vt(t)});class jv extends wt{_parse(t){if(this._getType(t)!==Ie.nan){const r=this._getOrReturnCtx(t);return Me(r,{code:de.invalid_type,expected:Ie.nan,received:r.parsedType}),ft}return{status:"valid",value:t.data}}}jv.create=e=>new jv({typeName:it.ZodNaN,...vt(e)});const Pte=Symbol("zod_brand");class uD extends wt{_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 xm extends wt{_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"?ft:o.status==="dirty"?(n.dirty(),aD(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"?ft: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 xm({in:t,out:n,typeName:it.ZodPipeline})}}class Vv extends wt{_parse(t){const n=this._def.innerType._parse(t);return lg(n)&&(n.value=Object.freeze(n.value)),n}}Vv.create=(e,t)=>new Vv({innerType:e,typeName:it.ZodReadonly,...vt(t)});const cD=(e,t={},n)=>e?Df.create().superRefine((r,i)=>{var o,s;if(!e(r)){const a=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(s=(o=a.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...u,fatal:l})}}):Df.create(),Rte={object:er.lazycreate};var it;(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"})(it||(it={}));const Ite=(e,t={message:`Input not instance of ${e.name}`})=>cD(n=>n instanceof e,t),dD=ks.create,fD=gu.create,Ote=jv.create,Mte=mu.create,hD=ug.create,Nte=Pc.create,Dte=Fv.create,Lte=cg.create,$te=dg.create,Fte=Df.create,Bte=_c.create,zte=al.create,Ute=Bv.create,jte=Ms.create,Vte=er.create,Gte=er.strictCreate,Hte=fg.create,qte=M_.create,Wte=hg.create,Kte=va.create,Xte=pg.create,Qte=zv.create,Yte=Rc.create,Zte=df.create,Jte=gg.create,ene=mg.create,tne=yu.create,nne=yg.create,rne=Lf.create,Wk=$s.create,ine=Qa.create,one=Ic.create,sne=$s.createWithPreprocess,ane=xm.create,lne=()=>dD().optional(),une=()=>fD().optional(),cne=()=>hD().optional(),dne={string:e=>ks.create({...e,coerce:!0}),number:e=>gu.create({...e,coerce:!0}),boolean:e=>ug.create({...e,coerce:!0}),bigint:e=>mu.create({...e,coerce:!0}),date:e=>Pc.create({...e,coerce:!0})},fne=ft;var z=Object.freeze({__proto__:null,defaultErrorMap:ag,setErrorMap:mte,getErrorMap:Dv,makeIssue:Lv,EMPTY_PATH:yte,addIssueToContext:Me,ParseStatus:Ui,INVALID:ft,DIRTY:aD,OK:Qi,isAborted:gC,isDirty:mC,isValid:lg,isAsync:$v,get util(){return Vt},get objectUtil(){return pC},ZodParsedType:Ie,getParsedType:$l,ZodType:wt,ZodString:ks,ZodNumber:gu,ZodBigInt:mu,ZodBoolean:ug,ZodDate:Pc,ZodSymbol:Fv,ZodUndefined:cg,ZodNull:dg,ZodAny:Df,ZodUnknown:_c,ZodNever:al,ZodVoid:Bv,ZodArray:Ms,ZodObject:er,ZodUnion:fg,ZodDiscriminatedUnion:M_,ZodIntersection:hg,ZodTuple:va,ZodRecord:pg,ZodMap:zv,ZodSet:Rc,ZodFunction:df,ZodLazy:gg,ZodLiteral:mg,ZodEnum:yu,ZodNativeEnum:yg,ZodPromise:Lf,ZodEffects:$s,ZodTransformer:$s,ZodOptional:Qa,ZodNullable:Ic,ZodDefault:vg,ZodCatch:Uv,ZodNaN:jv,BRAND:Pte,ZodBranded:uD,ZodPipeline:xm,ZodReadonly:Vv,custom:cD,Schema:wt,ZodSchema:wt,late:Rte,get ZodFirstPartyTypeKind(){return it},coerce:dne,any:Fte,array:jte,bigint:Mte,boolean:hD,date:Nte,discriminatedUnion:qte,effect:Wk,enum:tne,function:Zte,instanceof:Ite,intersection:Wte,lazy:Jte,literal:ene,map:Qte,nan:Ote,nativeEnum:nne,never:zte,null:$te,nullable:one,number:fD,object:Vte,oboolean:cne,onumber:une,optional:ine,ostring:lne,pipeline:ane,preprocess:sne,promise:rne,record:Xte,set:Yte,strictObject:Gte,string:dD,symbol:Dte,transformer:Wk,tuple:Kte,undefined:Lte,union:Hte,unknown:Bte,void:Ute,NEVER:fne,ZodIssueCode:de,quotelessJson:gte,ZodError:Os});const hne=z.string(),w6e=e=>hne.safeParse(e).success,pne=z.string(),x6e=e=>pne.safeParse(e).success,gne=z.string(),C6e=e=>gne.safeParse(e).success,mne=z.string(),E6e=e=>mne.safeParse(e).success,yne=z.number().int().min(1),T6e=e=>yne.safeParse(e).success,vne=z.number().min(1),A6e=e=>vne.safeParse(e).success,pD=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"]),k6e=e=>pD.safeParse(e).success,P6e={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"},_ne=z.number().int().min(0).max(pte),R6e=e=>_ne.safeParse(e).success,bne=z.number().multipleOf(8).min(64),I6e=e=>bne.safeParse(e).success,Sne=z.number().multipleOf(8).min(64),O6e=e=>Sne.safeParse(e).success,Wc=z.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),N_=z.object({model_name:z.string().min(1),base_model:Wc,model_type:z.literal("main")}),M6e=e=>N_.safeParse(e).success,_5=z.object({model_name:z.string().min(1),base_model:z.literal("sdxl-refiner"),model_type:z.literal("main")}),N6e=e=>_5.safeParse(e).success,gD=z.object({model_name:z.string().min(1),base_model:Wc,model_type:z.literal("onnx")}),Cm=z.union([N_,gD]),wne=z.object({model_name:z.string().min(1),base_model:Wc}),xne=z.object({model_name:z.string().min(1),base_model:Wc}),D6e=e=>xne.safeParse(e).success,L6e=z.object({model_name:z.string().min(1),base_model:Wc}),$6e=z.object({model_name:z.string().min(1),base_model:Wc}),Cne=z.number().min(0).max(1),F6e=e=>Cne.safeParse(e).success;z.enum(["fp16","fp32"]);const Ene=z.number().min(1).max(10),B6e=e=>Ene.safeParse(e).success,Tne=z.number().min(1).max(10),z6e=e=>Tne.safeParse(e).success,Ane=z.number().min(0).max(1),U6e=e=>Ane.safeParse(e).success;z.enum(["box","gaussian"]);z.enum(["unmasked","mask","edge"]);const zs={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,shouldUseNoiseSettings:!1,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},kne=zs,mD=nr({name:"generation",initialState:kne,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=jl(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=jl(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,...zs}),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},setShouldUseNoiseSettings:(e,t)=>{e.shouldUseNoiseSettings=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=hte[e.model.base_model];e.clipSkip=jl(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setShouldShowAdvancedOptions:(e,t)=>{e.shouldShowAdvancedOptions=t.payload,t.payload||(e.clipSkip=0)},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=xs(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(dte,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,s,a]=r.split("/"),l=N_.safeParse({model_name:a,base_model:o,model_type:s});l.success&&(t.model=l.data)}}),e.addCase(Rne,(t,n)=>{n.payload||(t.clipSkip=0)})}}),{clampSymmetrySteps:j6e,clearInitialImage:b5,resetParametersState:V6e,resetSeed:G6e,setCfgScale:H6e,setWidth:Kk,setHeight:Xk,toggleSize:q6e,setImg2imgStrength:W6e,setInfillMethod:Pne,setIterations:K6e,setPerlin:X6e,setPositivePrompt:Q6e,setNegativePrompt:Y6e,setScheduler:Z6e,setMaskBlur:J6e,setMaskBlurMethod:e8e,setCanvasCoherenceMode:t8e,setCanvasCoherenceSteps:n8e,setCanvasCoherenceStrength:r8e,setSeed:i8e,setSeedWeights:o8e,setShouldFitToWidthHeight:s8e,setShouldGenerateVariations:a8e,setShouldRandomizeSeed:l8e,setSteps:u8e,setThreshold:c8e,setInfillTileSize:d8e,setInfillPatchmatchDownscaleSize:f8e,setVariationAmount:h8e,setShouldUseSymmetry:p8e,setHorizontalSymmetrySteps:g8e,setVerticalSymmetrySteps:m8e,initialImageChanged:D_,modelChanged:Vl,vaeSelected:yD,setShouldUseNoiseSettings:y8e,setSeamlessXAxis:v8e,setSeamlessYAxis:_8e,setClipSkip:b8e,shouldUseCpuNoiseChanged:S8e,setShouldShowAdvancedOptions:Rne,setAspectRatio:Ine,setShouldLockAspectRatio:w8e,vaePrecisionChanged:x8e}=mD.actions,One=mD.reducer;let Gi=[],Ru=(e,t)=>{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let s=n.indexOf(i);~s&&(n.splice(s,2),r.lc--,r.lc||r.off())}},notify(i){let o=!Gi.length;for(let s=0;s(e.events=e.events||{},e.events[n+Sy]||(e.events[n+Sy]=r(i=>{e.events[n].reduceRight((o,s)=>(s(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+Sy](),delete e.events[n+Sy])}),Dne=1e3,Lne=(e,t)=>Nne(e,r=>{let i=t(r);i&&e.events[by].push(i)},Mne,r=>{let i=e.listen;e.listen=(...s)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...s));let o=e.off;return e.events[by]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let s of e.events[by])s();e.events[by]=[]}},Dne)},()=>{e.listen=i,e.off=o}}),$ne=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(s=>s.get());(n===void 0||o.some((s,a)=>s!==n[a]))&&(n=o,i.set(t(...o)))},i=Ru(void 0,Math.max(...e.map(o=>o.l))+1);return Lne(i,()=>{let o=e.map(s=>s.listen(r,i.l));return r(),()=>{for(let s of o)s()}}),i};const Fne={"Content-Type":"application/json"},Bne=/\/*$/;function zne(e={}){const{fetch:t=globalThis.fetch,querySerializer:n,bodySerializer:r,...i}=e;async function o(s,a){const{headers:l,body:u,params:c={},parseAs:d="json",querySerializer:f=n??Une,bodySerializer:h=r??jne,...p}=a||{},m=Vne(s,{baseUrl:i.baseUrl,params:c,querySerializer:f}),b=Gne(Fne,e==null?void 0:e.headers,l,c.header),_={redirect:"follow",...i,...p,headers:b};u&&(_.body=h(u)),_.body instanceof FormData&&b.delete("Content-Type");const y=await t(m,_);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(s,a){return o(s,{...a,method:"GET"})},async PUT(s,a){return o(s,{...a,method:"PUT"})},async POST(s,a){return o(s,{...a,method:"POST"})},async DELETE(s,a){return o(s,{...a,method:"DELETE"})},async OPTIONS(s,a){return o(s,{...a,method:"OPTIONS"})},async HEAD(s,a){return o(s,{...a,method:"HEAD"})},async PATCH(s,a){return o(s,{...a,method:"PATCH"})},async TRACE(s,a){return o(s,{...a,method:"TRACE"})}}}function Une(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 jne(e){return JSON.stringify(e)}function Vne(e,t){let n=`${t.baseUrl?t.baseUrl.replace(Bne,""):""}${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 Gne(...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 $f=Ru(),_g=Ru(),bg=Ru(),L_=$ne([$f,_g,bg],(e,t,n)=>zne({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`})),xi=hu("api/sessionCreated",async(e,{rejectWithValue:t})=>{const{graph:n}=e,{POST:r}=L_.get(),{data:i,error:o,response:s}=await r("/api/v1/sessions/",{body:n});return o?t({arg:e,status:s.status,error:o}):i}),Hne=e=>zi(e)&&"status"in e,qne=e=>zi(e)&&"detail"in e,ah=hu("api/sessionInvoked",async(e,{rejectWithValue:t})=>{const{session_id:n}=e,{PUT:r}=L_.get(),{error:i,response:o}=await r("/api/v1/sessions/{session_id}/invoke",{params:{query:{all:!0},path:{session_id:n}}});if(i){if(Hne(i)&&i.status===403)return t({arg:e,status:o.status,error:i.body.detail});if(qne(i)&&o.status===403)return t({arg:e,status:o.status,error:i.detail});if(i)return t({arg:e,status:o.status,error:i})}}),Iu=hu("api/sessionCanceled",async(e,{rejectWithValue:t})=>{const{session_id:n}=e,{DELETE:r}=L_.get(),{data:i,error:o}=await r("/api/v1/sessions/{session_id}/invoke",{params:{path:{session_id:n}}});return o?t({arg:e,error:o}):i});hu("api/listSessions",async(e,{rejectWithValue:t})=>{const{params:n}=e,{GET:r}=L_.get(),{data:i,error:o}=await r("/api/v1/sessions/",{params:n});return o?t({arg:e,error:o}):i});const vD=os(xi.rejected,ah.rejected),wy=(e,t,n,r,i,o,s)=>{const a=Math.floor(e/2-(n+i/2)*s),l=Math.floor(t/2-(r+o/2)*s);return{x:a,y:l}},xy=(e,t,n,r,i=.95)=>{const o=e*i/n,s=t*i/r,a=Math.min(1,Math.min(o,s));return a||1},C8e=.999,E8e=.1,T8e=20,Cy=.95,A8e=30,k8e=10,Wne=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),hd=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let s=t*n,a=448;for(;s1?(r.width=a,r.height=xs(a/o,64)):o<1&&(r.height=a,r.width=xs(a*o,64)),s=r.width*r.height;return r},Kne=e=>({width:xs(e.width,64),height:xs(e.height,64)}),P8e=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],R8e=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],_D=e=>e.kind==="line"&&e.layer==="mask",I8e=e=>e.kind==="line"&&e.layer==="base",Xne=e=>e.kind==="image"&&e.layer==="base",O8e=e=>e.kind==="fillRect"&&e.layer==="base",M8e=e=>e.kind==="eraseRect"&&e.layer==="base",Qne=e=>e.kind==="line",Pd={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},bD={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:Pd,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"},SD=nr({name:"canvas",initialState:bD,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(Jn(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!_D(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,s={width:vy(jl(r,64,512),64),height:vy(jl(i,64,512),64)},a={x:xs(r/2-s.width/2,64),y:xs(i/2-s.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=hd(s);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=s,e.boundingBoxCoordinates=a,e.pastLayerStates.push(Jn(e.layerState)),e.layerState={...Pd,objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[];const l=xy(o.width,o.height,r,i,Cy),u=wy(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=Kne(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=hd(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=Wne(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},canvasSessionIdChanged:(e,t)=>{e.layerState.stagingArea.sessionId=t.payload},stagingAreaInitialized:(e,t)=>{const{sessionId:n,boundingBox:r}=t.payload;e.layerState.stagingArea={boundingBox:r,sessionId:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(Jn(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(Jn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea={...Pd.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingOutline=!0},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(Jn(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(Jn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:s}=e;if(n==="move"||n==="colorPicker")return;const a=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(Jn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:a,points:t.payload,...l};s&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(Qne);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(Jn(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(Jn(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(Jn(e.layerState)),e.layerState=Pd,e.futureLayerStates=[]},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(Xne)){const o=xy(i.width,i.height,512,512,Cy),s=wy(i.width,i.height,0,0,512,512,o),a={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=s,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=a,e.boundingBoxScaleMethod==="auto"){const l=hd(a);e.scaledBoundingBoxDimensions=l}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:s,y:a,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:xy(i,o,l,u,Cy),d=wy(i,o,s,a,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=xy(i,o,512,512,Cy),d=wy(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=hd(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex,n=e.layerState.stagingArea.images.length;e.layerState.stagingArea.selectedImageIndex=Math.min(t+1,n-1)},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex;e.layerState.stagingArea.selectedImageIndex=Math.max(t-1,0)},commitStagingAreaImage:(e,t)=>{if(!e.layerState.stagingArea.images.length)return;const{images:n,selectedImageIndex:r}=e.layerState.stagingArea;e.pastLayerStates.push(Jn(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const i=n[r];i&&e.layerState.objects.push({...i}),e.layerState.stagingArea={...Pd.stagingArea},e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,s=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>s){const a={width:vy(jl(o,64,512),64),height:vy(jl(s,64,512),64)},l={x:xs(o/2-a.width/2,64),y:xs(s/2-a.height/2,64)};if(e.boundingBoxDimensions=a,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=hd(a);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=hd(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(Jn(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(Iu.pending,t=>{t.layerState.stagingArea.images.length||(t.layerState.stagingArea=Pd.stagingArea)}),e.addCase(Ine,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=xs(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=xs(t.scaledBoundingBoxDimensions.width/r,64))})}}),{addEraseRect:N8e,addFillRect:D8e,addImageToStagingArea:Yne,addLine:L8e,addPointToCurrentLine:$8e,clearCanvasHistory:F8e,clearMask:B8e,commitColorPickerColor:z8e,commitStagingAreaImage:Zne,discardStagedImages:U8e,fitBoundingBoxToStage:j8e,mouseLeftCanvas:V8e,nextStagingAreaImage:G8e,prevStagingAreaImage:H8e,redo:q8e,resetCanvas:S5,resetCanvasInteractionState:W8e,resetCanvasView:K8e,setBoundingBoxCoordinates:X8e,setBoundingBoxDimensions:Qk,setBoundingBoxPreviewFill:Q8e,setBoundingBoxScaleMethod:Y8e,flipBoundingBoxAxes:Z8e,setBrushColor:J8e,setBrushSize:eRe,setColorPickerColor:tRe,setCursorPosition:nRe,setInitialCanvasImage:wD,setIsDrawing:rRe,setIsMaskEnabled:iRe,setIsMouseOverBoundingBox:oRe,setIsMoveBoundingBoxKeyHeld:sRe,setIsMoveStageKeyHeld:aRe,setIsMovingBoundingBox:lRe,setIsMovingStage:uRe,setIsTransformingBoundingBox:cRe,setLayer:dRe,setMaskColor:fRe,setMergedCanvas:Jne,setShouldAutoSave:hRe,setShouldCropToBoundingBoxOnSave:pRe,setShouldDarkenOutsideBoundingBox:gRe,setShouldLockBoundingBox:mRe,setShouldPreserveMaskedArea:yRe,setShouldShowBoundingBox:vRe,setShouldShowBrush:_Re,setShouldShowBrushPreview:bRe,setShouldShowCanvasDebugInfo:SRe,setShouldShowCheckboardTransparency:wRe,setShouldShowGrid:xRe,setShouldShowIntermediates:CRe,setShouldShowStagingImage:ERe,setShouldShowStagingOutline:TRe,setShouldSnapToGrid:ARe,setStageCoordinates:kRe,setStageScale:PRe,setTool:RRe,toggleShouldLockBoundingBox:IRe,toggleTool:ORe,undo:MRe,setScaledBoundingBoxDimensions:NRe,setShouldRestrictStrokesToBox:DRe,stagingAreaInitialized:ere,canvasSessionIdChanged:tre,setShouldAntialias:LRe,canvasResized:$Re}=SD.actions,nre=SD.reducer,rre={isModalOpen:!1,imagesToChange:[]},xD=nr({name:"changeBoardModal",initialState:rre,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:FRe,imagesToChangeSelected:BRe,changeBoardReset:zRe}=xD.actions,ire=xD.reducer;var CD={exports:{}},ED={};const wo=Y1(vW),Mh=Y1(Sq),ore=Y1(Mq);(function(e){var t,n,r=dt&&dt.__generator||function(W,ee){var ne,ue,ie,Fe,je={label:0,sent:function(){if(1&ie[0])throw ie[1];return ie[1]},trys:[],ops:[]};return Fe={next:ot(0),throw:ot(1),return:ot(2)},typeof Symbol=="function"&&(Fe[Symbol.iterator]=function(){return this}),Fe;function ot(Ne){return function(Ve){return function(Re){if(ne)throw new TypeError("Generator is already executing.");for(;je;)try{if(ne=1,ue&&(ie=2&Re[0]?ue.return:Re[0]?ue.throw||((ie=ue.return)&&ie.call(ue),0):ue.next)&&!(ie=ie.call(ue,Re[1])).done)return ie;switch(ue=0,ie&&(Re=[2&Re[0],ie.value]),Re[0]){case 0:case 1:ie=Re;break;case 4:return je.label++,{value:Re[1],done:!1};case 5:je.label++,ue=Re[1],Re=[0];continue;case 7:Re=je.ops.pop(),je.trys.pop();continue;default:if(!((ie=(ie=je.trys).length>0&&ie[ie.length-1])||Re[0]!==6&&Re[0]!==2)){je=0;continue}if(Re[0]===3&&(!ie||Re[1]>ie[0]&&Re[1]=200&&W.status<=299},L=function(W){return/ion\/(vnd\.api\+)?json/.test(W.get("content-type")||"")};function N(W){if(!(0,A.isPlainObject)(W))return W;for(var ee=b({},W),ne=0,ue=Object.entries(ee);ne"u"&&je===T&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(bt,xt){return S(ee,null,function(){var tn,nn,Ti,So,Ai,pr,ui,Vn,io,ms,tt,rn,Xt,Yn,gr,ci,fn,Rt,zt,hn,Qt,an,_e,Ye,Be,Ae,Ge,lt,ze,be,ae,xe,ce,he,Se,Ze;return r(this,function(qe){switch(qe.label){case 0:return tn=xt.signal,nn=xt.getState,Ti=xt.extra,So=xt.endpoint,Ai=xt.forced,pr=xt.type,io=(Vn=typeof bt=="string"?{url:bt}:bt).url,tt=(ms=Vn.headers)===void 0?new Headers(at.headers):ms,Xt=(rn=Vn.params)===void 0?void 0:rn,gr=(Yn=Vn.responseHandler)===void 0?Qe??"json":Yn,fn=(ci=Vn.validateStatus)===void 0?st??k:ci,zt=(Rt=Vn.timeout)===void 0?Xe:Rt,hn=g(Vn,["url","headers","params","responseHandler","validateStatus","timeout"]),Qt=b(_(b({},at),{signal:tn}),hn),tt=new Headers(N(tt)),an=Qt,[4,ie(tt,{getState:nn,extra:Ti,endpoint:So,forced:Ai,type:pr})];case 1:an.headers=qe.sent()||tt,_e=function(ke){return typeof ke=="object"&&((0,A.isPlainObject)(ke)||Array.isArray(ke)||typeof ke.toJSON=="function")},!Qt.headers.has("content-type")&&_e(Qt.body)&&Qt.headers.set("content-type",re),_e(Qt.body)&&Ve(Qt.headers)&&(Qt.body=JSON.stringify(Qt.body,ve)),Xt&&(Ye=~io.indexOf("?")?"&":"?",Be=ot?ot(Xt):new URLSearchParams(N(Xt)),io+=Ye+Be),io=function(ke,Ct){if(!ke)return Ct;if(!Ct)return ke;if(function(Ft){return new RegExp("(^|:)//").test(Ft)}(Ct))return Ct;var $t=ke.endsWith("/")||!Ct.startsWith("?")?"/":"";return ke=function(Ft){return Ft.replace(/\/$/,"")}(ke),""+ke+$t+function(Ft){return Ft.replace(/^\//,"")}(Ct)}(ne,io),Ae=new Request(io,Qt),Ge=Ae.clone(),ui={request:Ge},ze=!1,be=zt&&setTimeout(function(){ze=!0,xt.abort()},zt),qe.label=2;case 2:return qe.trys.push([2,4,5,6]),[4,je(Ae)];case 3:return lt=qe.sent(),[3,6];case 4:return ae=qe.sent(),[2,{error:{status:ze?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(ae)},meta:ui}];case 5:return be&&clearTimeout(be),[7];case 6:xe=lt.clone(),ui.response=xe,he="",qe.label=7;case 7:return qe.trys.push([7,9,,10]),[4,Promise.all([mt(lt,gr).then(function(ke){return ce=ke},function(ke){return Se=ke}),xe.text().then(function(ke){return he=ke},function(){})])];case 8:if(qe.sent(),Se)throw Se;return[3,10];case 9:return Ze=qe.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:lt.status,data:he,error:String(Ze)},meta:ui}];case 10:return[2,fn(lt,ce)?{data:ce,meta:ui}:{error:{status:lt.status,data:ce},meta:ui}]}})})};function mt(bt,xt){return S(this,null,function(){var tn;return r(this,function(nn){switch(nn.label){case 0:return typeof xt=="function"?[2,xt(bt)]:(xt==="content-type"&&(xt=Ve(bt.headers)?"json":"text"),xt!=="json"?[3,2]:[4,bt.text()]);case 1:return[2,(tn=nn.sent()).length?JSON.parse(tn):null];case 2:return[2,bt.text()]}})})}}var P=function(W,ee){ee===void 0&&(ee=void 0),this.value=W,this.meta=ee};function D(W,ee){return W===void 0&&(W=0),ee===void 0&&(ee=5),S(this,null,function(){var ne,ue;return r(this,function(ie){switch(ie.label){case 0:return ne=Math.min(W,ee),ue=~~((Math.random()+.4)*(300<=xe)}var hn=(0,qt.createAsyncThunk)(Xt+"/executeQuery",Rt,{getPendingMeta:function(){var _e;return(_e={startedTimeStamp:Date.now()})[qt.SHOULD_AUTOBATCH]=!0,_e},condition:function(_e,Ye){var Be,Ae,Ge,lt=(0,Ye.getState)(),ze=(Ae=(Be=lt[Xt])==null?void 0:Be.queries)==null?void 0:Ae[_e.queryCacheKey],be=ze==null?void 0:ze.fulfilledTimeStamp,ae=_e.originalArgs,xe=ze==null?void 0:ze.originalArgs,ce=gr[_e.endpointName];return!(!$e(_e)&&((ze==null?void 0:ze.status)==="pending"||!zt(_e,lt)&&(!te(ce)||!((Ge=ce==null?void 0:ce.forceRefetch)!=null&&Ge.call(ce,{currentArg:ae,previousArg:xe,endpointState:ze,state:lt})))&&be))},dispatchConditionRejection:!0}),Qt=(0,qt.createAsyncThunk)(Xt+"/executeMutation",Rt,{getPendingMeta:function(){var _e;return(_e={startedTimeStamp:Date.now()})[qt.SHOULD_AUTOBATCH]=!0,_e}});function an(_e){return function(Ye){var Be,Ae;return((Ae=(Be=Ye==null?void 0:Ye.meta)==null?void 0:Be.arg)==null?void 0:Ae.endpointName)===_e}}return{queryThunk:hn,mutationThunk:Qt,prefetch:function(_e,Ye,Be){return function(Ae,Ge){var lt=function(ce){return"force"in ce}(Be)&&Be.force,ze=function(ce){return"ifOlderThan"in ce}(Be)&&Be.ifOlderThan,be=function(ce){return ce===void 0&&(ce=!0),fn.endpoints[_e].initiate(Ye,{forceRefetch:ce})},ae=fn.endpoints[_e].select(Ye)(Ge());if(lt)Ae(be());else if(ze){var xe=ae==null?void 0:ae.fulfilledTimeStamp;if(!xe)return void Ae(be());(Number(new Date)-Number(new Date(xe)))/1e3>=ze&&Ae(be())}else Ae(be(!1))}},updateQueryData:function(_e,Ye,Be){return function(Ae,Ge){var lt,ze,be=fn.endpoints[_e].select(Ye)(Ge()),ae={patches:[],inversePatches:[],undo:function(){return Ae(fn.util.patchQueryData(_e,Ye,ae.inversePatches))}};if(be.status===t.uninitialized)return ae;if("data"in be)if((0,Pe.isDraftable)(be.data)){var xe=(0,Pe.produceWithPatches)(be.data,Be),ce=xe[2];(lt=ae.patches).push.apply(lt,xe[1]),(ze=ae.inversePatches).push.apply(ze,ce)}else{var he=Be(be.data);ae.patches.push({op:"replace",path:[],value:he}),ae.inversePatches.push({op:"replace",path:[],value:be.data})}return Ae(fn.util.patchQueryData(_e,Ye,ae.patches)),ae}},upsertQueryData:function(_e,Ye,Be){return function(Ae){var Ge;return Ae(fn.endpoints[_e].initiate(Ye,((Ge={subscribe:!1,forceRefetch:!0})[nt]=function(){return{data:Be}},Ge)))}},patchQueryData:function(_e,Ye,Be){return function(Ae){Ae(fn.internalActions.queryResultPatched({queryCacheKey:ci({queryArgs:Ye,endpointDefinition:gr[_e],endpointName:_e}),patches:Be}))}},buildMatchThunkActions:function(_e,Ye){return{matchPending:(0,ct.isAllOf)((0,ct.isPending)(_e),an(Ye)),matchFulfilled:(0,ct.isAllOf)((0,ct.isFulfilled)(_e),an(Ye)),matchRejected:(0,ct.isAllOf)((0,ct.isRejected)(_e),an(Ye))}}}}({baseQuery:ue,reducerPath:ie,context:ne,api:W,serializeQueryArgs:Fe}),ve=re.queryThunk,Xe=re.mutationThunk,Qe=re.patchQueryData,st=re.updateQueryData,at=re.upsertQueryData,mt=re.prefetch,bt=re.buildMatchThunkActions,xt=function(tt){var rn=tt.reducerPath,Xt=tt.queryThunk,Yn=tt.mutationThunk,gr=tt.context,ci=gr.endpointDefinitions,fn=gr.apiUid,Rt=gr.extractRehydrationInfo,zt=gr.hasRehydrationInfo,hn=tt.assertTagType,Qt=tt.config,an=(0,le.createAction)(rn+"/resetApiState"),_e=(0,le.createSlice)({name:rn+"/queries",initialState:Gr,reducers:{removeQueryResult:{reducer:function(be,ae){delete be[ae.payload.queryCacheKey]},prepare:(0,le.prepareAutoBatched)()},queryResultPatched:function(be,ae){var xe=ae.payload,ce=xe.patches;Rn(be,xe.queryCacheKey,function(he){he.data=(0,Wt.applyPatches)(he.data,ce.concat())})}},extraReducers:function(be){be.addCase(Xt.pending,function(ae,xe){var ce,he=xe.meta,Se=xe.meta.arg,Ze=$e(Se);(Se.subscribe||Ze)&&(ae[ce=Se.queryCacheKey]!=null||(ae[ce]={status:t.uninitialized,endpointName:Se.endpointName})),Rn(ae,Se.queryCacheKey,function(qe){qe.status=t.pending,qe.requestId=Ze&&qe.requestId?qe.requestId:he.requestId,Se.originalArgs!==void 0&&(qe.originalArgs=Se.originalArgs),qe.startedTimeStamp=he.startedTimeStamp})}).addCase(Xt.fulfilled,function(ae,xe){var ce=xe.meta,he=xe.payload;Rn(ae,ce.arg.queryCacheKey,function(Se){var Ze;if(Se.requestId===ce.requestId||$e(ce.arg)){var qe=ci[ce.arg.endpointName].merge;if(Se.status=t.fulfilled,qe)if(Se.data!==void 0){var ke=ce.fulfilledTimeStamp,Ct=ce.arg,$t=ce.baseQueryMeta,Ft=ce.requestId,Zn=(0,le.createNextState)(Se.data,function(lr){return qe(lr,he,{arg:Ct.originalArgs,baseQueryMeta:$t,fulfilledTimeStamp:ke,requestId:Ft})});Se.data=Zn}else Se.data=he;else Se.data=(Ze=ci[ce.arg.endpointName].structuralSharing)==null||Ze?C((0,bn.isDraft)(Se.data)?(0,Wt.original)(Se.data):Se.data,he):he;delete Se.error,Se.fulfilledTimeStamp=ce.fulfilledTimeStamp}})}).addCase(Xt.rejected,function(ae,xe){var ce=xe.meta,he=ce.condition,Se=ce.requestId,Ze=xe.error,qe=xe.payload;Rn(ae,ce.arg.queryCacheKey,function(ke){if(!he){if(ke.requestId!==Se)return;ke.status=t.rejected,ke.error=qe??Ze}})}).addMatcher(zt,function(ae,xe){for(var ce=Rt(xe).queries,he=0,Se=Object.entries(ce);he"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},Qt),reducers:{middlewareRegistered:function(be,ae){be.middlewareRegistered=be.middlewareRegistered!=="conflict"&&fn===ae.payload||"conflict"}},extraReducers:function(be){be.addCase(U,function(ae){ae.online=!0}).addCase(V,function(ae){ae.online=!1}).addCase(O,function(ae){ae.focused=!0}).addCase(F,function(ae){ae.focused=!1}).addMatcher(zt,function(ae){return b({},ae)})}}),ze=(0,le.combineReducers)({queries:_e.reducer,mutations:Ye.reducer,provided:Be.reducer,subscriptions:Ge.reducer,config:lt.reducer});return{reducer:function(be,ae){return ze(an.match(ae)?void 0:be,ae)},actions:_(b(b(b(b(b({},lt.actions),_e.actions),Ae.actions),Ge.actions),Ye.actions),{unsubscribeMutationResult:Ye.actions.removeMutationResult,resetApiState:an})}}({context:ne,queryThunk:ve,mutationThunk:Xe,reducerPath:ie,assertTagType:Re,config:{refetchOnFocus:Ne,refetchOnReconnect:Ve,refetchOnMountOrArgChange:ot,keepUnusedDataFor:je,reducerPath:ie}}),tn=xt.reducer,nn=xt.actions;li(W.util,{patchQueryData:Qe,updateQueryData:st,upsertQueryData:at,prefetch:mt,resetApiState:nn.resetApiState}),li(W.internalActions,nn);var Ti=function(tt){var rn=tt.reducerPath,Xt=tt.queryThunk,Yn=tt.api,gr=tt.context,ci=gr.apiUid,fn={invalidateTags:(0,Aa.createAction)(rn+"/invalidateTags")},Rt=[Nr,On,Mr,Cr,Ei,ai];return{middleware:function(hn){var Qt=!1,an=_(b({},tt),{internalState:{currentSubscriptions:{}},refetchQuery:zt}),_e=Rt.map(function(Ae){return Ae(an)}),Ye=function(Ae){var Ge=Ae.api,lt=Ae.queryThunk,ze=Ae.internalState,be=Ge.reducerPath+"/subscriptions",ae=null,xe=!1,ce=Ge.internalActions,he=ce.updateSubscriptionOptions,Se=ce.unsubscribeQueryResult;return function(Ze,qe){var ke,Ct;if(ae||(ae=JSON.parse(JSON.stringify(ze.currentSubscriptions))),Ge.util.resetApiState.match(Ze))return ae=ze.currentSubscriptions={},[!0,!1];if(Ge.internalActions.internal_probeSubscription.match(Ze)){var $t=Ze.payload;return[!1,!!((ke=ze.currentSubscriptions[$t.queryCacheKey])!=null&&ke[$t.requestId])]}var Ft=function(Mn,Sn){var Vi,$,G,X,fe,St,on,wn,Tt;if(he.match(Sn)){var pn=Sn.payload,di=pn.queryCacheKey,Gn=pn.requestId;return(Vi=Mn==null?void 0:Mn[di])!=null&&Vi[Gn]&&(Mn[di][Gn]=pn.options),!0}if(Se.match(Sn)){var bl=Sn.payload;return Gn=bl.requestId,Mn[di=bl.queryCacheKey]&&delete Mn[di][Gn],!0}if(Ge.internalActions.removeQueryResult.match(Sn))return delete Mn[Sn.payload.queryCacheKey],!0;if(lt.pending.match(Sn)){var ud=Sn.meta;if(Gn=ud.requestId,(dd=ud.arg).subscribe)return(Sl=(G=Mn[$=dd.queryCacheKey])!=null?G:Mn[$]={})[Gn]=(fe=(X=dd.subscriptionOptions)!=null?X:Sl[Gn])!=null?fe:{},!0}if(lt.rejected.match(Sn)){var Sl,cd=Sn.meta,dd=cd.arg;if(Gn=cd.requestId,cd.condition&&dd.subscribe)return(Sl=(on=Mn[St=dd.queryCacheKey])!=null?on:Mn[St]={})[Gn]=(Tt=(wn=dd.subscriptionOptions)!=null?wn:Sl[Gn])!=null?Tt:{},!0}return!1}(ze.currentSubscriptions,Ze);if(Ft){xe||(Vs(function(){var Mn=JSON.parse(JSON.stringify(ze.currentSubscriptions)),Sn=(0,gs.produceWithPatches)(ae,function(){return Mn});qe.next(Ge.internalActions.subscriptionsUpdated(Sn[1])),ae=Mn,xe=!1}),xe=!0);var Zn=!!((Ct=Ze.type)!=null&&Ct.startsWith(be)),lr=lt.rejected.match(Ze)&&Ze.meta.condition&&!!Ze.meta.arg.subscribe;return[!Zn&&!lr,!1]}return[!0,!1]}}(an),Be=function(Ae){var Ge=Ae.reducerPath,lt=Ae.context,ze=Ae.refetchQuery,be=Ae.internalState,ae=Ae.api.internalActions.removeQueryResult;function xe(ce,he){var Se=ce.getState()[Ge],Ze=Se.queries,qe=be.currentSubscriptions;lt.batch(function(){for(var ke=0,Ct=Object.keys(qe);ke1&&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||lre,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{s(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(s=>{s.apply(s,[t,...r])})}}function Nh(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function Yk(e){return e==null?"":""+e}function ure(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function w5(e,t,n){function r(s){return s&&s.indexOf("###")>-1?s.replace(/###/g,"."):s}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const s=r(o.shift());!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function Zk(e,t,n){const{obj:r,k:i}=w5(e,t,Object);r[i]=n}function cre(e,t,n,r){const{obj:i,k:o}=w5(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function Hv(e,t){const{obj:n,k:r}=w5(e,t);if(n)return n[r]}function dre(e,t,n){const r=Hv(e,n);return r!==void 0?r:Hv(t,n)}function TD(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]):TD(e[r],t[r],n):e[r]=t[r]);return e}function pd(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var fre={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function hre(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>fre[t]):e}const pre=[" ",",","?","!",";"];function gre(e,t,n){t=t||"",n=n||"";const r=pre.filter(s=>t.indexOf(s)<0&&n.indexOf(s)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let o=!i.test(e);if(!o){const s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}function qv(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+s;)s++,a=r.slice(o,o+s).join(n),l=i[a];if(l===void 0)return;if(l===null)return null;if(t.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}const u=r.slice(o+s).join(n);return u?qv(l,u,n):void 0}i=i[r[o]]}return i}function Wv(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class Jk extends $_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a=[t,n];r&&typeof r!="string"&&(a=a.concat(r)),r&&typeof r=="string"&&(a=a.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(a=t.split("."));const l=Hv(this.data,a);return l||!s||typeof r!="string"?l:qv(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[t,n];r&&(a=a.concat(s?r.split(s):r)),t.indexOf(".")>-1&&(a=t.split("."),i=n,n=a[1]),this.addNamespaces(n),Zk(this.data,a,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},a=[t,n];t.indexOf(".")>-1&&(a=t.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=Hv(this.data,a)||{};i?TD(l,r,o):l={...l,...r},Zk(this.data,a,l),s.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var AD={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 eP={};class Kv extends $_{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ure(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ia.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const s=r&&t.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!gre(t,r,i);if(s&&!a){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(t[t.length-1],n),l=a[a.length-1],u=n.lng||this.language,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}${s}`,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:`${l}${v}${s}`}return i?{res:s,usedKey:s,exactUsedKey:s,usedLng:u,usedNS:l}:s}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||s,p=d&&d.exactUsedKey||s,m=Object.prototype.toString.apply(f),b=["[object Number]","[object Function]","[object RegExp]"],_=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")&&b.indexOf(m)<0&&!(typeof _=="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:a}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(d.res=v,d):v}if(o){const v=m==="[object Array]",S=v?[]:{},w=v?p:h;for(const x in f)if(Object.prototype.hasOwnProperty.call(f,x)){const C=`${w}${o}${x}`;S[x]=this.translate(C,{...n,joinArrays:!1,ns:a}),S[x]===C&&(S[x]=f[x])}f=S}}else if(y&&typeof _=="string"&&m==="[object Array]")f=f.join(_),f&&(f=this.extendTranslation(f,t,n,r));else{let v=!1,S=!1;const w=n.count!==void 0&&typeof n.count!="string",x=Kv.hasDefaultValue(n),C=w?this.pluralResolver.getSuffix(u,n.count,n):"",A=n.ordinal&&w?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",T=n[`defaultValue${C}`]||n[`defaultValue${A}`]||n.defaultValue;!this.isValidLookup(f)&&x&&(v=!0,f=T),this.isValidLookup(f)||(S=!0,f=s);const L=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,N=x&&T!==f&&this.options.updateMissing;if(S||v||N){if(this.logger.log(N?"updateKey":"missingKey",u,l,s,N?T:f),o){const B=this.resolve(s,{...n,keySeparator:!1});B&&B.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 E=[];const P=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&P&&P[0])for(let B=0;B{const O=x&&I!==f?I:L;this.options.missingKeyHandler?this.options.missingKeyHandler(B,l,R,O,N,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(B,l,R,O,N,n),this.emit("missingKey",B,l,R,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?E.forEach(B=>{this.pluralResolver.getSuffixes(B,n).forEach(R=>{D([B],s+R,n[`defaultValue${R}`]||T)})}):D(E,s,T))}f=this.extendTranslation(f,t,n,d,r),S&&f===s&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${s}`),(S||v)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${s}`:s,v?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let 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,s,a;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(b=>{this.isValidLookup(r)||(a=b,!eP[`${m[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(eP[`${m[0]}-${b}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(_=>{if(this.isValidLookup(r))return;s=_;const y=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,c,_,b,n);else{let v;f&&(v=this.pluralResolver.getSuffix(_,n.count,n));const S=`${this.options.pluralSeparator}zero`,w=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(y.push(c+v),n.ordinal&&v.indexOf(w)===0&&y.push(c+v.replace(w,this.options.pluralSeparator)),h&&y.push(c+S)),p){const x=`${c}${this.options.contextSeparator}${n.context}`;y.push(x),f&&(y.push(x+v),n.ordinal&&v.indexOf(w)===0&&y.push(x+v.replace(w,this.options.pluralSeparator)),h&&y.push(x+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:s,usedNS:a}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function F2(e){return e.charAt(0).toUpperCase()+e.slice(1)}class tP{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ia.create("languageUtils")}getScriptPartFromCode(t){if(t=Wv(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=Wv(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]=F2(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]=F2(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=F2(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(s=>{i.indexOf(s)<0&&o(this.formatLanguageCode(s))}),i}}let mre=[{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}],yre={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 vre=["v1","v2","v3"],_re=["v4"],nP={zero:0,one:1,two:2,few:3,many:4,other:5};function bre(){const e={};return mre.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:yre[t.fc]}})}),e}class Sre{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=ia.create("pluralResolver"),(!this.options.compatibilityJSON||_re.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=bre()}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(Wv(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)=>nP[i]-nP[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!vre.includes(this.options.compatibilityJSON)}}function rP(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=dre(e,t,n);return!o&&i&&typeof n=="string"&&(o=qv(e,n,r),o===void 0&&(o=qv(t,n,r))),o}class wre{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ia.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:hre,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?pd(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?pd(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?pd(n.nestingPrefix):n.nestingPrefixEscaped||pd("$t("),this.nestingSuffix=n.nestingSuffix?pd(n.nestingSuffix):n.nestingSuffixEscaped||pd(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,s,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const y=rP(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),b=m.shift().trim(),_=m.join(this.formatSeparator).trim();return this.format(rP(n,l,b,this.options.keySeparator,this.options.ignoreJSONStructure),_,r,{...i,...n,interpolationkey:b})};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(a=0;o=p.regex.exec(t);){const m=o[1].trim();if(s=c(m),s===void 0)if(typeof d=="function"){const _=d(t,o,i);s=typeof _=="string"?_:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))s="";else if(f){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),s="";else typeof s!="string"&&!this.useRawValueToEscape&&(s=Yk(s));const b=p.safeValue(s);if(t=t.replace(o[0],b),f?(p.regex.lastIndex+=s.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,s;function a(l,u){const 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,s);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{s=JSON.parse(f),u&&(s={...u,...s})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete s.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];s={...r},s=s.replace&&typeof s.replace!="string"?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(a.call(this,i[1].trim(),s),s),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=Yk(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 xre(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(s=>{if(!s)return;const[a,...l]=s.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[a.trim()]||(n[a.trim()]=u),u==="false"&&(n[a.trim()]=!1),u==="true"&&(n[a.trim()]=!0),isNaN(u)||(n[a.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function gd(e){const t={};return function(r,i,o){const s=i+JSON.stringify(o);let a=t[s];return a||(a=e(Wv(i),o),t[s]=a),a(r)}}class Cre{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ia.create("formatter"),this.options=t,this.formats={number:gd((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:gd((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:gd((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:gd((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:gd((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()]=gd(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((a,l)=>{const{formatName:u,formatOptions:c}=xre(l);if(this.formats[u]){let d=a;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](a,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},t)}}function Ere(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class Tre extends $_{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=ia.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},s={},a={},l={};return t.forEach(u=>{let 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?s[f]===void 0&&(s[f]=!0):(this.state[f]=1,c=!1,s[f]===void 0&&(s[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(a[u]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],s=i[1];n&&this.emit("failedLoading",o,s,n),r&&this.store.addResourceBundle(o,s,r),this.state[t]=n?-1:2;const a={};this.queue.forEach(l=>{cre(l.loaded,[o],s),Ere(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{a[u][d]===void 0&&(a[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!t.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:s});return}this.readingCalls++;const a=(u,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,s)},o);return}s(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=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(t,n,a)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,s),!s&&a&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,a),this.loaded(t,s,a)})}saveMissing(t,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...s,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let 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=>a(null,d)).catch(a):a(null,c)}catch(c){a(c)}else u(t,n,r,i,a,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function iP(){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 oP(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 Ty(){}function Are(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Sg extends $_{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=oP(t),this.services={},this.logger=ia,this.modules={external:[]},Are(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=iP();this.options={...i,...this.options,...oP(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?ia.init(o(this.modules.logger),this.options):ia.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Cre);const d=new tP(this.options);this.store=new Jk(this.options.resources,this.options);const f=this.services;f.logger=ia,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Sre(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 wre(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Tre(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),b=1;b1?p-1:0),b=1;b{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Ty),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=Nh(),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]:Ty;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],s=a=>{if(!a)return;this.services.languageUtils.toResolveHierarchy(a).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload&&this.options.preload.forEach(a=>s(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(t,n,r){const i=Nh();return t||(t=this.languages),n||(n=this.options.ns),r||(r=Ty),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"&&AD.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=Nh();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},s=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{s(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(t),i}getFixedT(t,n,r){var i=this;const o=function(s,a){let l;if(typeof a!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${s}`:s,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 s=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===2};if(n.precheck){const a=n.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,t)&&(!i||s(o,t)))}loadNamespaces(t,n){const r=Nh();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=Nh();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(s=>i.indexOf(s)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new tP(iP());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 Sg(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ty;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Sg(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new Jk(this.store.data,i),o.services.resourceStore=o.store),o.translator=new Kv(o.services,i),o.translator.on("*",function(a){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;ckD.safeParse(e).success||kre.safeParse(e).success;z.enum(["connection","direct","any"]);const PD=z.object({id:z.string().trim().min(1),name:z.string().trim().min(1),type:kD}),Pre=PD.extend({fieldKind:z.literal("output")}),gt=PD.extend({fieldKind:z.literal("input"),label:z.string()}),Kc=z.object({model_name:z.string().trim().min(1),base_model:Wc}),Ff=z.object({image_name:z.string().trim().min(1)}),Xv=z.object({latents_name:z.string().trim().min(1),seed:z.number().int().optional()}),Qv=z.object({conditioning_name:z.string().trim().min(1)}),Rre=z.object({mask_name:z.string().trim().min(1),masked_latents_name:z.string().trim().min(1).optional()}),Ire=gt.extend({type:z.literal("integer"),value:z.number().int().optional()}),Ore=gt.extend({type:z.literal("IntegerCollection"),value:z.array(z.number().int()).optional()}),Mre=gt.extend({type:z.literal("IntegerPolymorphic"),value:z.union([z.number().int(),z.array(z.number().int())]).optional()}),Nre=gt.extend({type:z.literal("float"),value:z.number().optional()}),Dre=gt.extend({type:z.literal("FloatCollection"),value:z.array(z.number()).optional()}),Lre=gt.extend({type:z.literal("FloatPolymorphic"),value:z.union([z.number(),z.array(z.number())]).optional()}),$re=gt.extend({type:z.literal("string"),value:z.string().optional()}),Fre=gt.extend({type:z.literal("StringCollection"),value:z.array(z.string()).optional()}),Bre=gt.extend({type:z.literal("StringPolymorphic"),value:z.union([z.string(),z.array(z.string())]).optional()}),zre=gt.extend({type:z.literal("boolean"),value:z.boolean().optional()}),Ure=gt.extend({type:z.literal("BooleanCollection"),value:z.array(z.boolean()).optional()}),jre=gt.extend({type:z.literal("BooleanPolymorphic"),value:z.union([z.boolean(),z.array(z.boolean())]).optional()}),Vre=gt.extend({type:z.literal("enum"),value:z.string().optional()}),Gre=gt.extend({type:z.literal("LatentsField"),value:Xv.optional()}),Hre=gt.extend({type:z.literal("LatentsCollection"),value:z.array(Xv).optional()}),qre=gt.extend({type:z.literal("LatentsPolymorphic"),value:z.union([Xv,z.array(Xv)]).optional()}),Wre=gt.extend({type:z.literal("DenoiseMaskField"),value:Rre.optional()}),Kre=gt.extend({type:z.literal("ConditioningField"),value:Qv.optional()}),Xre=gt.extend({type:z.literal("ConditioningCollection"),value:z.array(Qv).optional()}),Qre=gt.extend({type:z.literal("ConditioningPolymorphic"),value:z.union([Qv,z.array(Qv)]).optional()}),Yre=Kc,wg=z.object({image:Ff,control_model:Yre,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()}),Zre=gt.extend({type:z.literal("ControlField"),value:wg.optional()}),Jre=gt.extend({type:z.literal("ControlPolymorphic"),value:z.union([wg,z.array(wg)]).optional()}),eie=gt.extend({type:z.literal("ControlCollection"),value:z.array(wg).optional()}),tie=Kc,nie=z.object({image:Ff,ip_adapter_model:tie,image_encoder_model:z.string().trim().min(1),weight:z.number()}),rie=gt.extend({type:z.literal("IPAdapterField"),value:nie.optional()}),iie=z.enum(["onnx","main","vae","lora","controlnet","embedding"]),oie=z.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),Bf=Kc.extend({model_type:iie,submodel:oie.optional()}),RD=Bf.extend({weight:z.number().optional()}),sie=z.object({unet:Bf,scheduler:Bf,loras:z.array(RD)}),aie=gt.extend({type:z.literal("UNetField"),value:sie.optional()}),lie=z.object({tokenizer:Bf,text_encoder:Bf,skipped_layers:z.number(),loras:z.array(RD)}),uie=gt.extend({type:z.literal("ClipField"),value:lie.optional()}),cie=z.object({vae:Bf}),die=gt.extend({type:z.literal("VaeField"),value:cie.optional()}),fie=gt.extend({type:z.literal("ImageField"),value:Ff.optional()}),hie=gt.extend({type:z.literal("ImagePolymorphic"),value:z.union([Ff,z.array(Ff)]).optional()}),pie=gt.extend({type:z.literal("ImageCollection"),value:z.array(Ff).optional()}),gie=gt.extend({type:z.literal("MainModelField"),value:Cm.optional()}),mie=gt.extend({type:z.literal("SDXLMainModelField"),value:Cm.optional()}),yie=gt.extend({type:z.literal("SDXLRefinerModelField"),value:Cm.optional()}),ID=Kc,vie=gt.extend({type:z.literal("VaeModelField"),value:ID.optional()}),OD=Kc,_ie=gt.extend({type:z.literal("LoRAModelField"),value:OD.optional()}),bie=Kc,Sie=gt.extend({type:z.literal("ControlNetModelField"),value:bie.optional()}),wie=Kc,xie=gt.extend({type:z.literal("IPAdapterModelField"),value:wie.optional()}),Cie=gt.extend({type:z.literal("Collection"),value:z.array(z.any()).optional()}),Eie=gt.extend({type:z.literal("CollectionItem"),value:z.any().optional()}),Yv=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)}),Tie=gt.extend({type:z.literal("ColorField"),value:Yv.optional()}),Aie=gt.extend({type:z.literal("ColorCollection"),value:z.array(Yv).optional()}),kie=gt.extend({type:z.literal("ColorPolymorphic"),value:z.union([Yv,z.array(Yv)]).optional()}),Pie=gt.extend({type:z.literal("Scheduler"),value:pD.optional()}),Rie=z.discriminatedUnion("type",[Ure,zre,jre,uie,Cie,Eie,Tie,Aie,kie,Kre,Xre,Qre,Zre,Sie,eie,Jre,Wre,Vre,Dre,Nre,Lre,pie,hie,fie,Ore,Mre,Ire,rie,xie,Gre,Hre,qre,_ie,gie,Pie,mie,yie,Fre,Bre,$re,aie,die,vie]),URe=e=>!!(e&&e.fieldKind==="input"),jRe=e=>!!(e&&e.fieldKind==="input"),Iie=e=>!!(e&&!("$ref"in e)),aP=e=>!!(e&&!("$ref"in e)&&e.type==="array"),Ay=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),Dh=e=>!!(e&&"$ref"in e),Oie=e=>"class"in e&&e.class==="invocation",Mie=e=>"class"in e&&e.class==="output",lP=e=>!("$ref"in e),Nie=z.object({lora:OD.deepPartial(),weight:z.number()}),MD=z.object({app_version:z.string().nullish(),generation_mode:z.string().nullish(),created_by:z.string().nullish(),positive_prompt:z.string().nullish(),negative_prompt:z.string().nullish(),width:z.number().int().nullish(),height:z.number().int().nullish(),seed:z.number().int().nullish(),rand_device:z.string().nullish(),cfg_scale:z.number().nullish(),steps:z.number().int().nullish(),scheduler:z.string().nullish(),clip_skip:z.number().int().nullish(),model:z.union([N_.deepPartial(),gD.deepPartial()]).nullish(),controlnets:z.array(wg.deepPartial()).nullish(),loras:z.array(Nie).nullish(),vae:ID.nullish(),strength:z.number().nullish(),init_image:z.string().nullish(),positive_style_prompt:z.string().nullish(),negative_style_prompt:z.string().nullish(),refiner_model:_5.deepPartial().nullish(),refiner_cfg_scale:z.number().nullish(),refiner_steps:z.number().int().nullish(),refiner_scheduler:z.string().nullish(),refiner_positive_aesthetic_score:z.number().nullish(),refiner_negative_aesthetic_score:z.number().nullish(),refiner_start:z.number().nullish()}).passthrough(),x5=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))});x5.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}});const Die=z.object({id:z.string().trim().min(1),type:z.string().trim().min(1),inputs:z.record(Rie),outputs:z.record(Pre),label:z.string(),isOpen:z.boolean(),notes:z.string(),embedWorkflow:z.boolean(),isIntermediate:z.boolean(),version:x5.optional()}),Lie=z.object({id:z.string().trim().min(1),type:z.literal("notes"),label:z.string(),isOpen:z.boolean(),notes:z.string()}),ND=z.object({x:z.number(),y:z.number()}).default({x:0,y:0}),Zv=z.number().gt(0).nullish(),DD=z.object({id:z.string().trim().min(1),type:z.literal("invocation"),data:Die,width:Zv,height:Zv,position:ND}),vC=e=>DD.safeParse(e).success,$ie=z.object({id:z.string().trim().min(1),type:z.literal("notes"),data:Lie,width:Zv,height:Zv,position:ND}),LD=z.discriminatedUnion("type",[DD,$ie]),Fie=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")}),Bie=z.object({source:z.string().trim().min(1),target:z.string().trim().min(1),id:z.string().trim().min(1),type:z.literal("collapsed")}),$D=z.union([Fie,Bie]),zie=z.object({nodeId:z.string().trim().min(1),fieldName:z.string().trim().min(1)}),FD=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(LD).default([]),edges:z.array($D).default([]),exposedFields:z.array(zie).default([]),meta:z.object({version:x5}).default({version:"1.0.0"})});FD.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(vC),o=v5(i,"id");return n.forEach((s,a)=>{const l=o[s.source],u=o[s.target],c=[];if(l?s.type==="default"&&!(s.sourceHandle in l.data.outputs)&&c.push(`${we.t("nodes.outputField")}"${s.source}.${s.sourceHandle}" ${we.t("nodes.doesNotExist")}`):c.push(`${we.t("nodes.outputNode")} ${s.source} ${we.t("nodes.doesNotExist")}`),u?s.type==="default"&&!(s.targetHandle in u.data.inputs)&&c.push(`${we.t("nodes.inputField")} "${s.target}.${s.targetHandle}" ${we.t("nodes.doesNotExist")}`):c.push(`${we.t("nodes.inputNode")} ${s.target} ${we.t("nodes.doesNotExist")}`),c.length){delete n[a];const d=s.type==="default"?s.sourceHandle:s.source,f=s.type==="default"?s.targetHandle:s.target;r.push({message:`${we.t("nodes.edge")} "${d} -> ${f}" ${we.t("nodes.skipped")}`,issues:c,data:s})}}),{workflow:e,warnings:r}});const Kr=e=>!!(e&&e.type==="invocation"),VRe=e=>!!(e&&!["notes","current_image"].includes(e.type)),uP=e=>!!(e&&e.type==="notes");var Fa=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(Fa||{});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Uie=4,cP=0,dP=1,jie=2;function lh(e){let t=e.length;for(;--t>=0;)e[t]=0}const Vie=0,BD=1,Gie=2,Hie=3,qie=258,C5=29,Em=256,xg=Em+1+C5,ff=30,E5=19,zD=2*xg+1,lc=15,B2=16,Wie=7,T5=256,UD=16,jD=17,VD=18,_C=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]),I0=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]),Kie=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),GD=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xie=512,Ua=new Array((xg+2)*2);lh(Ua);const xp=new Array(ff*2);lh(xp);const Cg=new Array(Xie);lh(Cg);const Eg=new Array(qie-Hie+1);lh(Eg);const A5=new Array(C5);lh(A5);const Jv=new Array(ff);lh(Jv);function z2(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 HD,qD,WD;function U2(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const KD=e=>e<256?Cg[e]:Cg[256+(e>>>7)],Tg=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},uo=(e,t,n)=>{e.bi_valid>B2-n?(e.bi_buf|=t<>B2-e.bi_valid,e.bi_valid+=n-B2):(e.bi_buf|=t<{uo(e,n[t*2],n[t*2+1])},XD=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},Qie=e=>{e.bi_valid===16?(Tg(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)},Yie=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,f,h,p,m=0;for(f=0;f<=lc;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>=a&&(h=s[c-a]),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--)}},QD=(e,t,n)=>{const r=new Array(lc+1);let i=0,o,s;for(o=1;o<=lc;o++)i=i+n[o-1]<<1,r[o]=i;for(s=0;s<=t;s++){let a=e[s*2+1];a!==0&&(e[s*2]=XD(r[a]++,a))}},Zie=()=>{let e,t,n,r,i;const o=new Array(lc+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Tg(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},fP=(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,s,a;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?ta(e,i,t):(s=Eg[i],ta(e,s+Em+1,t),a=_C[s],a!==0&&(i-=A5[s],uo(e,i,a)),r--,s=KD(r),ta(e,s,n),a=I0[s],a!==0&&(r-=Jv[s],uo(e,r,a)));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 s,a,l=-1,u;for(e.heap_len=0,e.heap_max=zD,s=0;s>1;s>=1;s--)j2(e,n,s);u=o;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],j2(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=a,n[u*2]=n[s*2]+n[a*2],e.depth[u]=(e.depth[s]>=e.depth[a]?e.depth[s]:e.depth[a])+1,n[s*2+1]=n[a*2+1]=u,e.heap[1]=u++,j2(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Yie(e,t),QD(n,l,e.bl_count)},pP=(e,t,n)=>{let r,i=-1,o,s=t[0*2+1],a=0,l=7,u=4;for(s===0&&(l=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=s,s=t[(r+1)*2+1],!(++a{let r,i=-1,o,s=t[0*2+1],a=0,l=7,u=4;for(s===0&&(l=138,u=3),r=0;r<=n;r++)if(o=s,s=t[(r+1)*2+1],!(++a{let t;for(pP(e,e.dyn_ltree,e.l_desc.max_code),pP(e,e.dyn_dtree,e.d_desc.max_code),bC(e,e.bl_desc),t=E5-1;t>=3&&e.bl_tree[GD[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},eoe=(e,t,n,r)=>{let i;for(uo(e,t-257,5),uo(e,n-1,5),uo(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 cP;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return dP;for(n=32;n{mP||(Zie(),mP=!0),e.l_desc=new U2(e.dyn_ltree,HD),e.d_desc=new U2(e.dyn_dtree,qD),e.bl_desc=new U2(e.bl_tree,WD),e.bi_buf=0,e.bi_valid=0,YD(e)},JD=(e,t,n,r)=>{uo(e,(Vie<<1)+(r?1:0),3),ZD(e),Tg(e,n),Tg(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},roe=e=>{uo(e,BD<<1,3),ta(e,T5,Ua),Qie(e)},ioe=(e,t,n,r)=>{let i,o,s=0;e.level>0?(e.strm.data_type===jie&&(e.strm.data_type=toe(e)),bC(e,e.l_desc),bC(e,e.d_desc),s=Jie(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?JD(e,t,n,r):e.strategy===Uie||o===i?(uo(e,(BD<<1)+(r?1:0),3),hP(e,Ua,xp)):(uo(e,(Gie<<1)+(r?1:0),3),eoe(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),hP(e,e.dyn_ltree,e.dyn_dtree)),YD(e),r&&ZD(e)},ooe=(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[(Eg[n]+Em+1)*2]++,e.dyn_dtree[KD(t)*2]++),e.sym_next===e.sym_end);var soe=noe,aoe=JD,loe=ioe,uoe=ooe,coe=roe,doe={_tr_init:soe,_tr_stored_block:aoe,_tr_flush_block:loe,_tr_tally:uoe,_tr_align:coe};const foe=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+t[r++]|0,o=o+i|0;while(--s);i%=65521,o%=65521}return i|o<<16|0};var Ag=foe;const hoe=()=>{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},poe=new Uint32Array(hoe()),goe=(e,t,n,r)=>{const i=poe,o=r+n;e^=-1;for(let s=r;s>>8^i[(e^t[s])&255];return e^-1};var Zr=goe,zf={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"},Tm={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:moe,_tr_stored_block:SC,_tr_flush_block:yoe,_tr_tally:nu,_tr_align:voe}=doe,{Z_NO_FLUSH:ru,Z_PARTIAL_FLUSH:_oe,Z_FULL_FLUSH:boe,Z_FINISH:Qo,Z_BLOCK:yP,Z_OK:yi,Z_STREAM_END:vP,Z_STREAM_ERROR:da,Z_DATA_ERROR:Soe,Z_BUF_ERROR:V2,Z_DEFAULT_COMPRESSION:woe,Z_FILTERED:xoe,Z_HUFFMAN_ONLY:ky,Z_RLE:Coe,Z_FIXED:Eoe,Z_DEFAULT_STRATEGY:Toe,Z_UNKNOWN:Aoe,Z_DEFLATED:F_}=Tm,koe=9,Poe=15,Roe=8,Ioe=29,Ooe=256,wC=Ooe+1+Ioe,Moe=30,Noe=19,Doe=2*wC+1,Loe=15,Dt=3,Hl=258,fa=Hl+Dt+1,$oe=32,Uf=42,k5=57,xC=69,CC=73,EC=91,TC=103,uc=113,rp=666,Wi=1,uh=2,Oc=3,ch=4,Foe=3,cc=(e,t)=>(e.msg=zf[t],t),_P=e=>e*2-(e>4?9:0),Fl=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Boe=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 zoe=(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))},Ro=(e,t)=>{yoe(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Co(e.strm)},Yt=(e,t)=>{e.pending_buf[e.pending++]=t},Lh=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},AC=(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=Ag(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Zr(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},eL=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,s=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-fa?e.strstart-(e.w_size-fa):0,u=e.window,c=e.w_mask,d=e.prev,f=e.strstart+Hl;let h=u[r+s-1],p=u[r+s];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do if(i=t,!(u[i+s]!==p||u[i+s-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]&&rs){if(e.match_start=t,s=o,o>=a)break;h=u[r+s-1],p=u[r+s]}}while((t=d[t&c])>l&&--n!==0);return s<=e.lookahead?s:e.lookahead},jf=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-fa)&&(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),Boe(e),r+=t),e.strm.avail_in===0)break;if(n=AC(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Dt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=iu(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=iu(e,e.ins_h,e.window[i+Dt-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,s=0,a=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,Co(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&&(AC(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(s===0);return a-=e.strm.avail_in,a&&(a>=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<=a&&(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-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),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&&(AC(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===Qo)&&t!==ru&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,s=t===Qo&&e.strm.avail_in===0&&r===i?1:0,SC(e,e.block_start,r,s),e.block_start+=r,Co(e.strm)),s?Oc:Wi)},G2=(e,t)=>{let n,r;for(;;){if(e.lookahead=Dt&&(e.ins_h=iu(e,e.ins_h,e.window[e.strstart+Dt-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-fa&&(e.match_length=eL(e,n)),e.match_length>=Dt)if(r=nu(e,e.strstart-e.match_start,e.match_length-Dt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Dt){e.match_length--;do e.strstart++,e.ins_h=iu(e,e.ins_h,e.window[e.strstart+Dt-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=iu(e,e.ins_h,e.window[e.strstart+1]);else r=nu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Ro(e,!1),e.strm.avail_out===0))return Wi}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=Dt&&(e.ins_h=iu(e,e.ins_h,e.window[e.strstart+Dt-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=Dt-1,n!==0&&e.prev_length4096)&&(e.match_length=Dt-1)),e.prev_length>=Dt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Dt,r=nu(e,e.strstart-1-e.prev_match,e.prev_length-Dt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=iu(e,e.ins_h,e.window[e.strstart+Dt-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=Dt-1,e.strstart++,r&&(Ro(e,!1),e.strm.avail_out===0))return Wi}else if(e.match_available){if(r=nu(e,0,e.window[e.strstart-1]),r&&Ro(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Wi}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=nu(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,o;const s=e.window;for(;;){if(e.lookahead<=Hl){if(jf(e),e.lookahead<=Hl&&t===ru)return Wi;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Dt&&e.strstart>0&&(i=e.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){o=e.strstart+Hl;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Dt?(n=nu(e,1,e.match_length-Dt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=nu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Ro(e,!1),e.strm.avail_out===0))return Wi}return e.insert=0,t===Qo?(Ro(e,!0),e.strm.avail_out===0?Oc:ch):e.sym_next&&(Ro(e,!1),e.strm.avail_out===0)?Wi:uh},joe=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(jf(e),e.lookahead===0)){if(t===ru)return Wi;break}if(e.match_length=0,n=nu(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Ro(e,!1),e.strm.avail_out===0))return Wi}return e.insert=0,t===Qo?(Ro(e,!0),e.strm.avail_out===0?Oc:ch):e.sym_next&&(Ro(e,!1),e.strm.avail_out===0)?Wi:uh};function Hs(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 ip=[new Hs(0,0,0,0,tL),new Hs(4,4,8,4,G2),new Hs(4,5,16,8,G2),new Hs(4,6,32,32,G2),new Hs(4,4,16,16,md),new Hs(8,16,32,32,md),new Hs(8,16,128,128,md),new Hs(8,32,128,256,md),new Hs(32,128,258,1024,md),new Hs(32,258,258,4096,md)],Voe=e=>{e.window_size=2*e.w_size,Fl(e.head),e.max_lazy_match=ip[e.level].max_lazy,e.good_match=ip[e.level].good_length,e.nice_match=ip[e.level].nice_length,e.max_chain_length=ip[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Dt-1,e.match_available=0,e.ins_h=0};function Goe(){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=F_,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(Doe*2),this.dyn_dtree=new Uint16Array((2*Moe+1)*2),this.bl_tree=new Uint16Array((2*Noe+1)*2),Fl(this.dyn_ltree),Fl(this.dyn_dtree),Fl(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Loe+1),this.heap=new Uint16Array(2*wC+1),Fl(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*wC+1),Fl(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 Am=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Uf&&t.status!==k5&&t.status!==xC&&t.status!==CC&&t.status!==EC&&t.status!==TC&&t.status!==uc&&t.status!==rp?1:0},nL=e=>{if(Am(e))return cc(e,da);e.total_in=e.total_out=0,e.data_type=Aoe;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?k5:t.wrap?Uf:uc,e.adler=t.wrap===2?0:1,t.last_flush=-2,moe(t),yi},rL=e=>{const t=nL(e);return t===yi&&Voe(e.state),t},Hoe=(e,t)=>Am(e)||e.state.wrap!==2?da:(e.state.gzhead=t,yi),iL=(e,t,n,r,i,o)=>{if(!e)return da;let s=1;if(t===woe&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>koe||n!==F_||r<8||r>15||t<0||t>9||o<0||o>Eoe||r===8&&s!==1)return cc(e,da);r===8&&(r=9);const a=new Goe;return e.state=a,a.strm=e,a.status=Uf,a.wrap=s,a.gzhead=null,a.w_bits=r,a.w_size=1<iL(e,t,F_,Poe,Roe,Toe),Woe=(e,t)=>{if(Am(e)||t>yP||t<0)return e?cc(e,da):da;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===rp&&t!==Qo)return cc(e,e.avail_out===0?V2:da);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Co(e),e.avail_out===0)return n.last_flush=-1,yi}else if(e.avail_in===0&&_P(t)<=_P(r)&&t!==Qo)return cc(e,V2);if(n.status===rp&&e.avail_in!==0)return cc(e,V2);if(n.status===Uf&&n.wrap===0&&(n.status=uc),n.status===Uf){let i=F_+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=ky||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=$oe),i+=31-i%31,Lh(n,i),n.strstart!==0&&(Lh(n,e.adler>>>16),Lh(n,e.adler&65535)),e.adler=1,n.status=uc,Co(e),n.pending!==0)return n.last_flush=-1,yi}if(n.status===k5){if(e.adler=0,Yt(n,31),Yt(n,139),Yt(n,8),n.gzhead)Yt(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)),Yt(n,n.gzhead.time&255),Yt(n,n.gzhead.time>>8&255),Yt(n,n.gzhead.time>>16&255),Yt(n,n.gzhead.time>>24&255),Yt(n,n.level===9?2:n.strategy>=ky||n.level<2?4:0),Yt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Yt(n,n.gzhead.extra.length&255),Yt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Zr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=xC;else if(Yt(n,0),Yt(n,0),Yt(n,0),Yt(n,0),Yt(n,0),Yt(n,n.level===9?2:n.strategy>=ky||n.level<2?4:0),Yt(n,Foe),n.status=uc,Co(e),n.pending!==0)return n.last_flush=-1,yi}if(n.status===xC){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 a=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+a),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Zr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=a,Co(e),n.pending!==0)return n.last_flush=-1,yi;i=0,o-=a}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=Zr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=CC}if(n.status===CC){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=Zr(e.adler,n.pending_buf,n.pending-i,i)),Co(e),n.pending!==0)return n.last_flush=-1,yi;i=0}n.gzindexi&&(e.adler=Zr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=EC}if(n.status===EC){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=Zr(e.adler,n.pending_buf,n.pending-i,i)),Co(e),n.pending!==0)return n.last_flush=-1,yi;i=0}n.gzindexi&&(e.adler=Zr(e.adler,n.pending_buf,n.pending-i,i))}n.status=TC}if(n.status===TC){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Co(e),n.pending!==0))return n.last_flush=-1,yi;Yt(n,e.adler&255),Yt(n,e.adler>>8&255),e.adler=0}if(n.status=uc,Co(e),n.pending!==0)return n.last_flush=-1,yi}if(e.avail_in!==0||n.lookahead!==0||t!==ru&&n.status!==rp){let i=n.level===0?tL(n,t):n.strategy===ky?joe(n,t):n.strategy===Coe?Uoe(n,t):ip[n.level].func(n,t);if((i===Oc||i===ch)&&(n.status=rp),i===Wi||i===Oc)return e.avail_out===0&&(n.last_flush=-1),yi;if(i===uh&&(t===_oe?voe(n):t!==yP&&(SC(n,0,0,!1),t===boe&&(Fl(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Co(e),e.avail_out===0))return n.last_flush=-1,yi}return t!==Qo?yi:n.wrap<=0?vP:(n.wrap===2?(Yt(n,e.adler&255),Yt(n,e.adler>>8&255),Yt(n,e.adler>>16&255),Yt(n,e.adler>>24&255),Yt(n,e.total_in&255),Yt(n,e.total_in>>8&255),Yt(n,e.total_in>>16&255),Yt(n,e.total_in>>24&255)):(Lh(n,e.adler>>>16),Lh(n,e.adler&65535)),Co(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?yi:vP)},Koe=e=>{if(Am(e))return da;const t=e.state.status;return e.state=null,t===uc?cc(e,Soe):yi},Xoe=(e,t)=>{let n=t.length;if(Am(e))return da;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Uf||r.lookahead)return da;if(i===1&&(e.adler=Ag(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(Fl(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,s=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,jf(r);r.lookahead>=Dt;){let l=r.strstart,u=r.lookahead-(Dt-1);do r.ins_h=iu(r,r.ins_h,r.window[l+Dt-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=Dt-1,jf(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Dt-1,r.match_available=0,e.next_in=s,e.input=a,e.avail_in=o,r.wrap=i,yi};var Qoe=qoe,Yoe=iL,Zoe=rL,Joe=nL,ese=Hoe,tse=Woe,nse=Koe,rse=Xoe,ise="pako deflate (from Nodeca project)",Cp={deflateInit:Qoe,deflateInit2:Yoe,deflateReset:Zoe,deflateResetKeep:Joe,deflateSetHeader:ese,deflate:tse,deflateEnd:nse,deflateSetDictionary:rse,deflateInfo:ise};const ose=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var sse=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)ose(n,r)&&(e[r]=n[r])}}return e},ase=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;kg[254]=kg[254]=1;var lse=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,s=e.length,a=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 use=(e,t)=>{if(t<65534&&e.subarray&&oL)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+=a-1;continue}for(s&=a===2?31:a===3?15:7;a>1&&r1){o[i++]=65533;continue}s<65536?o[i++]=s:(s-=65536,o[i++]=55296|s>>10&1023,o[i++]=56320|s&1023)}return use(o,i)},dse=(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+kg[e[n]]>t?n:t},Pg={string2buf:lse,buf2string:cse,utf8border:dse};function fse(){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 sL=fse;const aL=Object.prototype.toString,{Z_NO_FLUSH:hse,Z_SYNC_FLUSH:pse,Z_FULL_FLUSH:gse,Z_FINISH:mse,Z_OK:e1,Z_STREAM_END:yse,Z_DEFAULT_COMPRESSION:vse,Z_DEFAULT_STRATEGY:_se,Z_DEFLATED:bse}=Tm;function P5(e){this.options=B_.assign({level:vse,method:bse,chunkSize:16384,windowBits:15,memLevel:8,strategy:_se},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 sL,this.strm.avail_out=0;let n=Cp.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==e1)throw new Error(zf[n]);if(t.header&&Cp.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Pg.string2buf(t.dictionary):aL.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=Cp.deflateSetDictionary(this.strm,r),n!==e1)throw new Error(zf[n]);this._dict_set=!0}}P5.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?mse:hse,typeof e=="string"?n.input=Pg.string2buf(e):aL.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===pse||o===gse)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=Cp.deflate(n,o),i===yse)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=Cp.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===e1;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};P5.prototype.onData=function(e){this.chunks.push(e)};P5.prototype.onEnd=function(e){e===e1&&(this.result=B_.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const Py=16209,Sse=16191;var wse=function(t,n){let r,i,o,s,a,l,u,c,d,f,h,p,m,b,_,y,g,v,S,w,x,C,A,T;const k=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),o=t.next_out,T=t.output,s=o-(n-t.avail_out),a=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,b=k.distcode,_=(1<>>24,h>>>=v,p-=v,v=g>>>16&255,v===0)T[o++]=g&65535;else if(v&16){S=g&65535,v&=15,v&&(p>>=v,p-=v),p<15&&(h+=A[r++]<>>24,h>>>=v,p-=v,v=g>>>16&255,v&16){if(w=g&65535,v&=15,pl){t.msg="invalid distance too far back",k.mode=Py;break e}if(h>>>=v,p-=v,v=o-s,w>v){if(v=w-v,v>c&&k.sane){t.msg="invalid distance too far back",k.mode=Py;break e}if(x=0,C=f,d===0){if(x+=u-v,v2;)T[o++]=C[x++],T[o++]=C[x++],T[o++]=C[x++],S-=3;S&&(T[o++]=C[x++],S>1&&(T[o++]=C[x++]))}else{x=o-w;do T[o++]=T[x++],T[o++]=T[x++],T[o++]=T[x++],S-=3;while(S>2);S&&(T[o++]=T[x++],S>1&&(T[o++]=T[x++]))}}else if(v&64){t.msg="invalid distance code",k.mode=Py;break e}else{g=b[(g&65535)+(h&(1<>3,r-=S,p-=S<<3,h&=(1<{const l=a.bits;let u=0,c=0,d=0,f=0,h=0,p=0,m=0,b=0,_=0,y=0,g,v,S,w,x,C=null,A;const T=new Uint16Array(yd+1),k=new Uint16Array(yd+1);let L=null,N,E,P;for(u=0;u<=yd;u++)T[u]=0;for(c=0;c=1&&T[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,a.bits=1,0;for(d=1;d0&&(e===wP||f!==1))return-1;for(k[1]=0,u=1;ubP||e===xP&&_>SP)return 1;for(;;){N=u-m,s[c]+1=A?(E=L[s[c]-A],P=C[s[c]-A]):(E=32+64,P=0),g=1<>m)+v]=N<<24|E<<16|P|0;while(v!==0);for(g=1<>=1;if(g!==0?(y&=g-1,y+=g):y=0,c++,--T[u]===0){if(u===f)break;u=t[n+s[c]]}if(u>h&&(y&w)!==S){for(m===0&&(m=h),x+=d,p=u-m,b=1<bP||e===xP&&_>SP)return 1;S=y&w,i[S]=h<<24|p<<16|x-o|0}}return y!==0&&(i[x+y]=u-m<<24|64<<16|0),a.bits=h,0};var Ep=Ase;const kse=0,lL=1,uL=2,{Z_FINISH:CP,Z_BLOCK:Pse,Z_TREES:Ry,Z_OK:Mc,Z_STREAM_END:Rse,Z_NEED_DICT:Ise,Z_STREAM_ERROR:is,Z_DATA_ERROR:cL,Z_MEM_ERROR:dL,Z_BUF_ERROR:Ose,Z_DEFLATED:EP}=Tm,z_=16180,TP=16181,AP=16182,kP=16183,PP=16184,RP=16185,IP=16186,OP=16187,MP=16188,NP=16189,t1=16190,Pa=16191,q2=16192,DP=16193,W2=16194,LP=16195,$P=16196,FP=16197,BP=16198,Iy=16199,Oy=16200,zP=16201,UP=16202,jP=16203,VP=16204,GP=16205,K2=16206,HP=16207,qP=16208,Hn=16209,fL=16210,hL=16211,Mse=852,Nse=592,Dse=15,Lse=Dse,WP=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function $se(){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 Xc=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modehL?1:0},pL=e=>{if(Xc(e))return is;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=z_,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(Mse),t.distcode=t.distdyn=new Int32Array(Nse),t.sane=1,t.back=-1,Mc},gL=e=>{if(Xc(e))return is;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,pL(e)},mL=(e,t)=>{let n;if(Xc(e))return is;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?is:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,gL(e))},yL=(e,t)=>{if(!e)return is;const n=new $se;e.state=n,n.strm=e,n.window=null,n.mode=z_;const r=mL(e,t);return r!==Mc&&(e.state=null),r},Fse=e=>yL(e,Lse);let KP=!0,X2,Q2;const Bse=e=>{if(KP){X2=new Int32Array(512),Q2=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(Ep(lL,e.lens,0,288,X2,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ep(uL,e.lens,0,32,Q2,0,e.work,{bits:5}),KP=!1}e.lencode=X2,e.lenbits=9,e.distcode=Q2,e.distbits=5},vL=(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,s,a,l,u,c,d,f,h,p,m,b=0,_,y,g,v,S,w,x,C;const A=new Uint8Array(4);let T,k;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Xc(e)||!e.output||!e.input&&e.avail_in!==0)return is;n=e.state,n.mode===Pa&&(n.mode=q2),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,u=n.hold,c=n.bits,d=a,f=l,C=Mc;e:for(;;)switch(n.mode){case z_:if(n.wrap===0){n.mode=q2;break}for(;c<16;){if(a===0)break e;a--,u+=r[o++]<>>8&255,n.check=Zr(n.check,A,2,0),u=0,c=0,n.mode=TP;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Hn;break}if((u&15)!==EP){e.msg="unknown compression method",n.mode=Hn;break}if(u>>>=4,c-=4,x=(u&15)+8,n.wbits===0&&(n.wbits=x),x>15||x>n.wbits){e.msg="invalid window size",n.mode=Hn;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Zr(n.check,A,2,0)),u=0,c=0,n.mode=AP;case AP:for(;c<32;){if(a===0)break e;a--,u+=r[o++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Zr(n.check,A,4,0)),u=0,c=0,n.mode=kP;case kP:for(;c<16;){if(a===0)break e;a--,u+=r[o++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Zr(n.check,A,2,0)),u=0,c=0,n.mode=PP;case PP:if(n.flags&1024){for(;c<16;){if(a===0)break e;a--,u+=r[o++]<>>8&255,n.check=Zr(n.check,A,2,0)),u=0,c=0}else n.head&&(n.head.extra=null);n.mode=RP;case RP:if(n.flags&1024&&(h=n.length,h>a&&(h=a),h&&(n.head&&(x=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),x)),n.flags&512&&n.wrap&4&&(n.check=Zr(n.check,r,h,o)),a-=h,o+=h,n.length-=h),n.length))break e;n.length=0,n.mode=IP;case IP:if(n.flags&2048){if(a===0)break e;h=0;do x=r[o+h++],n.head&&x&&n.length<65536&&(n.head.name+=String.fromCharCode(x));while(x&&h>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Pa;break;case NP:for(;c<32;){if(a===0)break e;a--,u+=r[o++]<>>=c&7,c-=c&7,n.mode=K2;break}for(;c<3;){if(a===0)break e;a--,u+=r[o++]<>>=1,c-=1,u&3){case 0:n.mode=DP;break;case 1:if(Bse(n),n.mode=Iy,t===Ry){u>>>=2,c-=2;break e}break;case 2:n.mode=$P;break;case 3:e.msg="invalid block type",n.mode=Hn}u>>>=2,c-=2;break;case DP:for(u>>>=c&7,c-=c&7;c<32;){if(a===0)break e;a--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Hn;break}if(n.length=u&65535,u=0,c=0,n.mode=W2,t===Ry)break e;case W2:n.mode=LP;case LP:if(h=n.length,h){if(h>a&&(h=a),h>l&&(h=l),h===0)break e;i.set(r.subarray(o,o+h),s),a-=h,o+=h,l-=h,s+=h,n.length-=h;break}n.mode=Pa;break;case $P:for(;c<14;){if(a===0)break e;a--,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=Hn;break}n.have=0,n.mode=FP;case FP:for(;n.have>>=3,c-=3}for(;n.have<19;)n.lens[L[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,T={bits:n.lenbits},C=Ep(kse,n.lens,0,19,n.lencode,0,n.work,T),n.lenbits=T.bits,C){e.msg="invalid code lengths set",n.mode=Hn;break}n.have=0,n.mode=BP;case BP:for(;n.have>>24,y=b>>>16&255,g=b&65535,!(_<=c);){if(a===0)break e;a--,u+=r[o++]<>>=_,c-=_,n.lens[n.have++]=g;else{if(g===16){for(k=_+2;c>>=_,c-=_,n.have===0){e.msg="invalid bit length repeat",n.mode=Hn;break}x=n.lens[n.have-1],h=3+(u&3),u>>>=2,c-=2}else if(g===17){for(k=_+3;c>>=_,c-=_,x=0,h=3+(u&7),u>>>=3,c-=3}else{for(k=_+7;c>>=_,c-=_,x=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=Hn;break}for(;h--;)n.lens[n.have++]=x}}if(n.mode===Hn)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Hn;break}if(n.lenbits=9,T={bits:n.lenbits},C=Ep(lL,n.lens,0,n.nlen,n.lencode,0,n.work,T),n.lenbits=T.bits,C){e.msg="invalid literal/lengths set",n.mode=Hn;break}if(n.distbits=6,n.distcode=n.distdyn,T={bits:n.distbits},C=Ep(uL,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,T),n.distbits=T.bits,C){e.msg="invalid distances set",n.mode=Hn;break}if(n.mode=Iy,t===Ry)break e;case Iy:n.mode=Oy;case Oy:if(a>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=o,e.avail_in=a,n.hold=u,n.bits=c,wse(e,f),s=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,a=e.avail_in,u=n.hold,c=n.bits,n.mode===Pa&&(n.back=-1);break}for(n.back=0;b=n.lencode[u&(1<>>24,y=b>>>16&255,g=b&65535,!(_<=c);){if(a===0)break e;a--,u+=r[o++]<>v)],_=b>>>24,y=b>>>16&255,g=b&65535,!(v+_<=c);){if(a===0)break e;a--,u+=r[o++]<>>=v,c-=v,n.back+=v}if(u>>>=_,c-=_,n.back+=_,n.length=g,y===0){n.mode=GP;break}if(y&32){n.back=-1,n.mode=Pa;break}if(y&64){e.msg="invalid literal/length code",n.mode=Hn;break}n.extra=y&15,n.mode=zP;case zP:if(n.extra){for(k=n.extra;c>>=n.extra,c-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=UP;case UP:for(;b=n.distcode[u&(1<>>24,y=b>>>16&255,g=b&65535,!(_<=c);){if(a===0)break e;a--,u+=r[o++]<>v)],_=b>>>24,y=b>>>16&255,g=b&65535,!(v+_<=c);){if(a===0)break e;a--,u+=r[o++]<>>=v,c-=v,n.back+=v}if(u>>>=_,c-=_,n.back+=_,y&64){e.msg="invalid distance code",n.mode=Hn;break}n.offset=g,n.extra=y&15,n.mode=jP;case jP: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=Hn;break}n.mode=VP;case VP: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=Hn;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=s-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[s++]=m[p++];while(--h);n.length===0&&(n.mode=Oy);break;case GP:if(l===0)break e;i[s++]=n.length,l--,n.mode=Oy;break;case K2:if(n.wrap){for(;c<32;){if(a===0)break e;a--,u|=r[o++]<{if(Xc(e))return is;let t=e.state;return t.window&&(t.window=null),e.state=null,Mc},jse=(e,t)=>{if(Xc(e))return is;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Mc):is},Vse=(e,t)=>{const n=t.length;let r,i,o;return Xc(e)||(r=e.state,r.wrap!==0&&r.mode!==t1)?is:r.mode===t1&&(i=1,i=Ag(i,t,n,0),i!==r.check)?cL:(o=vL(e,t,n,n),o?(r.mode=fL,dL):(r.havedict=1,Mc))};var Gse=gL,Hse=mL,qse=pL,Wse=Fse,Kse=yL,Xse=zse,Qse=Use,Yse=jse,Zse=Vse,Jse="pako inflate (from Nodeca project)",ja={inflateReset:Gse,inflateReset2:Hse,inflateResetKeep:qse,inflateInit:Wse,inflateInit2:Kse,inflate:Xse,inflateEnd:Qse,inflateGetHeader:Yse,inflateSetDictionary:Zse,inflateInfo:Jse};function eae(){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 tae=eae;const _L=Object.prototype.toString,{Z_NO_FLUSH:nae,Z_FINISH:rae,Z_OK:Rg,Z_STREAM_END:Y2,Z_NEED_DICT:Z2,Z_STREAM_ERROR:iae,Z_DATA_ERROR:XP,Z_MEM_ERROR:oae}=Tm;function km(e){this.options=B_.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 sL,this.strm.avail_out=0;let n=ja.inflateInit2(this.strm,t.windowBits);if(n!==Rg)throw new Error(zf[n]);if(this.header=new tae,ja.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Pg.string2buf(t.dictionary):_L.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=ja.inflateSetDictionary(this.strm,t.dictionary),n!==Rg)))throw new Error(zf[n])}km.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?rae:nae,_L.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=ja.inflate(n,s),o===Z2&&i&&(o=ja.inflateSetDictionary(n,i),o===Rg?o=ja.inflate(n,s):o===XP&&(o=Z2));n.avail_in>0&&o===Y2&&n.state.wrap>0&&e[n.next_in]!==0;)ja.inflateReset(n),o=ja.inflate(n,s);switch(o){case iae:case XP:case Z2:case oae:return this.onEnd(o),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(n.avail_out===0||o===Y2))if(this.options.to==="string"){let l=Pg.utf8border(n.output,n.next_out),u=n.next_out-l,c=Pg.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===Rg&&a===0)){if(o===Y2)return o=ja.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};km.prototype.onData=function(e){this.chunks.push(e)};km.prototype.onEnd=function(e){e===Rg&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=B_.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function R5(e,t){const n=new km(t);if(n.push(e),n.err)throw n.msg||zf[n.err];return n.result}function sae(e,t){return t=t||{},t.raw=!0,R5(e,t)}var aae=km,lae=R5,uae=sae,cae=R5,dae=Tm,fae={Inflate:aae,inflate:lae,inflateRaw:uae,ungzip:cae,constants:dae};const{Inflate:GRe,inflate:hae,inflateRaw:HRe,ungzip:qRe}=fae;var bL=hae;const SL=[];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;SL[e]=t}function pae(e){let t=-1;for(let n=0;n>>8;return t^-1}var qn;(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"})(qn||(qn={}));const gae={[qn.GRAYSCALE]:1,[qn.TRUE_COLOR]:3,[qn.PALETTE]:1,[qn.GRAYSCALE_WITH_ALPHA]:2,[qn.TRUE_COLOR_WITH_ALPHA]:4},mae=1;var Ao;(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"})(Ao||(Ao={}));const yae={[Ao.NONE](e){return e},[Ao.SUB](e,t){const n=new Uint8Array(e.length);for(let r=0;r>1;r[i]=e[i]+a}return r},[Ao.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 xL=[{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 _ae(e,t,n){if(!e)return[{passWidth:t,passHeight:n,passIndex:0}];const r=[];return xL.forEach(function({x:i,y:o},s){const a=t%8,l=n%8,u=t-a>>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 b=0;b>3)+mae,w=u[p];if(!(w in Ao))throw new Error("Unsupported filter type: "+w);const x=yae[w],C=x(u.slice(p+1,p+S),h,m);m=C;let A=0;const T=vae(C,o);for(let L=0;L<_;L++){const N=k();a&&N[0]===a[0]&&N[1]===a[1]&&N[2]===a[2]&&(N[3]=0);const E=bae(t,r,g,L,v);for(let P=0;P127)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 xae(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}const xl=1e5;function Cae(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 s(){return t[i++]<<8|t[i++]}function a(){return t[i++]}function l(){const R=[];let I=0;for(;(I=t[i++])!==0;)R.push(I);return new Uint8Array(R)}function u(R){const I=i+R;let O="";for(;i=0&&QP.call(t.callee)==="[object Function]"),r},tw,YP;function kae(){if(YP)return tw;YP=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=EL,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),s=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(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]",b=r(h),_=p&&n.call(h)==="[object String]",y=[];if(!p&&!m&&!b)throw new TypeError("Object.keys called on a non-object");var g=s&&m;if(_&&h.length>0&&!t.call(h,0))for(var v=0;v0)for(var S=0;S"u"||!Yr?Ot:Yr(Uint8Array),Sc={"%AggregateError%":typeof AggregateError>"u"?Ot:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ot:ArrayBuffer,"%ArrayIteratorPrototype%":vd&&Yr?Yr([][Symbol.iterator]()):Ot,"%AsyncFromSyncIteratorPrototype%":Ot,"%AsyncFunction%":Rd,"%AsyncGenerator%":Rd,"%AsyncGeneratorFunction%":Rd,"%AsyncIteratorPrototype%":Rd,"%Atomics%":typeof Atomics>"u"?Ot:Atomics,"%BigInt%":typeof BigInt>"u"?Ot:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ot:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ot:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ot:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Ot:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ot:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ot:FinalizationRegistry,"%Function%":AL,"%GeneratorFunction%":Rd,"%Int8Array%":typeof Int8Array>"u"?Ot:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ot:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ot:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vd&&Yr?Yr(Yr([][Symbol.iterator]())):Ot,"%JSON%":typeof JSON=="object"?JSON:Ot,"%Map%":typeof Map>"u"?Ot:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vd||!Yr?Ot:Yr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ot:Promise,"%Proxy%":typeof Proxy>"u"?Ot:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Ot:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ot:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vd||!Yr?Ot:Yr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ot:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vd&&Yr?Yr(""[Symbol.iterator]()):Ot,"%Symbol%":vd?Symbol:Ot,"%SyntaxError%":Vf,"%ThrowTypeError%":Gae,"%TypedArray%":qae,"%TypeError%":hf,"%Uint8Array%":typeof Uint8Array>"u"?Ot:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ot:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ot:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ot:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Ot:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ot:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ot:WeakSet};if(Yr)try{null.error}catch(e){var Wae=Yr(Yr(e));Sc["%Error.prototype%"]=Wae}var Kae=function e(t){var n;if(t==="%AsyncFunction%")n=rw("async function () {}");else if(t==="%GeneratorFunction%")n=rw("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=rw("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Yr&&(n=Yr(i.prototype))}return Sc[t]=n,n},n6={"%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"]},Pm=TL,n1=Vae,Xae=Pm.call(Function.call,Array.prototype.concat),Qae=Pm.call(Function.apply,Array.prototype.splice),r6=Pm.call(Function.call,String.prototype.replace),r1=Pm.call(Function.call,String.prototype.slice),Yae=Pm.call(Function.call,RegExp.prototype.exec),Zae=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Jae=/\\(\\)?/g,ele=function(t){var n=r1(t,0,1),r=r1(t,-1);if(n==="%"&&r!=="%")throw new Vf("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Vf("invalid intrinsic syntax, expected opening `%`");var i=[];return r6(t,Zae,function(o,s,a,l){i[i.length]=a?r6(l,Jae,"$1"):s||o}),i},tle=function(t,n){var r=t,i;if(n1(n6,r)&&(i=n6[r],r="%"+i[0]+"%"),n1(Sc,r)){var o=Sc[r];if(o===Rd&&(o=Kae(r)),typeof o>"u"&&!n)throw new hf("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new Vf("intrinsic "+t+" does not exist!")},nle=function(t,n){if(typeof t!="string"||t.length===0)throw new hf("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new hf('"allowMissing" argument must be a boolean');if(Yae(/^%?[^%]*%?$/,t)===null)throw new Vf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=ele(t),i=r.length>0?r[0]:"",o=tle("%"+i+"%",n),s=o.name,a=o.value,l=!1,u=o.alias;u&&(i=u[0],Qae(r,Xae([0,1],u)));for(var c=1,d=!0;c=r.length){var m=bc(a,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[f]}else d=n1(a,f),a=a[f];d&&!l&&(Sc[s]=a)}}return a},rle=nle,kC=rle("%Object.defineProperty%",!0),PC=function(){if(kC)try{return kC({},"a",{value:1}),!0}catch{return!1}return!1};PC.hasArrayLengthDefineBug=function(){if(!PC())return null;try{return kC([],"length",{value:1}).length!==1}catch{return!0}};var ile=PC,ole=Iae,sle=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",ale=Object.prototype.toString,lle=Array.prototype.concat,kL=Object.defineProperty,ule=function(e){return typeof e=="function"&&ale.call(e)==="[object Function]"},cle=ile(),PL=kL&&cle,dle=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!ule(r)||!r())return}PL?kL(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},RL=function(e,t){var n=arguments.length>2?arguments[2]:{},r=ole(t);sle&&(r=lle.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))}};K_.testComparisonRange=Ole;var X_={};Object.defineProperty(X_,"__esModule",{value:!0});X_.testRange=void 0;var Mle=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};X_.testRange=Mle;(function(e){var t=dt&&dt.__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,Lle.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};Q_.highlight=Fle;var Y_={},$L={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(dt,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,s.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}},s.prototype.getSymbolDisplay=function(u){return a(u)},s.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)},s.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},s.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()},s.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},s.prototype.finish=function(){var u=[],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!==s.fail&&u.push(f)}),u.map(function(f){return f.data})};function a(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:s,Grammar:i,Rule:t}})})($L);var Ble=$L.exports,Nc={},FL={},Ou={};Ou.__esModule=void 0;Ou.__esModule=!0;var zle=typeof Object.setPrototypeOf=="function",Ule=typeof Object.getPrototypeOf=="function",jle=typeof Object.defineProperty=="function",Vle=typeof Object.create=="function",Gle=typeof Object.prototype.hasOwnProperty=="function",Hle=function(t,n){zle?Object.setPrototypeOf(t,n):t.__proto__=n};Ou.setPrototypeOf=Hle;var qle=function(t){return Ule?Object.getPrototypeOf(t):t.__proto__||t.prototype};Ou.getPrototypeOf=qle;var i6=!1,Wle=function e(t,n,r){if(jle&&!i6)try{Object.defineProperty(t,n,r)}catch{i6=!0,e(t,n,r)}else t[n]=r.value};Ou.defineProperty=Wle;var BL=function(t,n){return Gle?t.hasOwnProperty(t,n):t[n]===void 0};Ou.hasOwnProperty=BL;var Kle=function(t,n){if(Vle)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)BL(n,o)&&(i[o]=n[o].value);return i};Ou.objectCreate=Kle;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=Ou,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,s=new Error().toString()==="[object Error]",a="";function l(u){var c=this.constructor,d=c.name||function(){var b=c.toString().match(/^function\s*([^\s(]+)/);return b===null?a||"Error":b[1]}(),f=d==="Error",h=f?a: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 s&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}a=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(FL);var zL=dt&&dt.__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(Nc,"__esModule",{value:!0});Nc.SyntaxError=Nc.LiqeError=void 0;var Xle=FL,UL=function(e){zL(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Xle.ExtendableError);Nc.LiqeError=UL;var Qle=function(e){zL(t,e);function t(n,r,i,o){var s=e.call(this,n)||this;return s.message=n,s.offset=r,s.line=i,s.column=o,s}return t}(UL);Nc.SyntaxError=Qle;var N5={},i1=dt&&dt.__assign||function(){return i1=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:Ra},{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"};N5.default=Yle;var jL={},Z_={},Om={};Object.defineProperty(Om,"__esModule",{value:!0});Om.isSafePath=void 0;var Zle=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,Jle=function(e){return Zle.test(e)};Om.isSafePath=Jle;Object.defineProperty(Z_,"__esModule",{value:!0});Z_.createGetValueFunctionBody=void 0;var eue=Om,tue=function(e){if(!(0,eue.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};Z_.createGetValueFunctionBody=tue;(function(e){var t=dt&&dt.__assign||function(){return t=Object.assign||function(o){for(var s,a=1,l=arguments.length;a\d+) col (?\d+)/,aue=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new GL.default.Parser(oue),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(sue);throw r?new nue.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,iue.hydrateAst)(n[0]);return i};Y_.parse=aue;var J_={};Object.defineProperty(J_,"__esModule",{value:!0});J_.test=void 0;var lue=Rm,uue=function(e,t){return(0,lue.filter)(e,[t]).length===1};J_.test=uue;var HL={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,s){return s==="double"?'"'.concat(o,'"'):s==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var s=o.range,a=s.min,l=s.max,u=s.minInclusive,c=s.maxInclusive;return"".concat(u?"[":"{").concat(a," 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 s=o.field,a=o.expression,l=o.operator;if(s.type==="ImplicitField")return n(a);var u=s.quoted?t(s.name,s.quotes):s.name,c=" ".repeat(a.location.start-l.location.end);return u+l.operator+c+n(a)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var s=" ".repeat(o.expression.location.start-(o.location.start+1)),a=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(s).concat((0,e.serialize)(o.expression)).concat(a,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(HL);var eb={};Object.defineProperty(eb,"__esModule",{value:!0});eb.isSafeUnquotedExpression=void 0;var cue=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};eb.isSafeUnquotedExpression=cue;(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=Rm;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=Q_;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=Y_;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=J_;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=Nc;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var s=HL;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return s.serialize}});var a=eb;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return a.isSafeUnquotedExpression}})})(LL);var Mm={},qL={},Dc={};Object.defineProperty(Dc,"__esModule",{value:!0});Dc.ROARR_LOG_FORMAT_VERSION=Dc.ROARR_VERSION=void 0;Dc.ROARR_VERSION="5.0.0";Dc.ROARR_LOG_FORMAT_VERSION="2.0.0";var Nm={};Object.defineProperty(Nm,"__esModule",{value:!0});Nm.logLevels=void 0;Nm.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var WL={},tb={};Object.defineProperty(tb,"__esModule",{value:!0});tb.hasOwnProperty=void 0;const due=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);tb.hasOwnProperty=due;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=tb;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(WL);var KL={},nb={},rb={};Object.defineProperty(rb,"__esModule",{value:!0});rb.tokenize=void 0;const fue=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,hue=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=fue.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const s=t[0];i=t.index+s.length,s==="\\%"||s==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:s,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};rb.tokenize=hue;Object.defineProperty(nb,"__esModule",{value:!0});nb.createPrintf=void 0;const o6=I5,pue=rb,gue=(e,t)=>t.placeholder,mue=e=>{var t;const n=(o,s,a)=>a==="-"?o.padEnd(s," "):a==="-+"?((Number(o)>=0?"+":"")+o).padEnd(s," "):a==="+"?((Number(o)>=0?"+":"")+o).padStart(s," "):a==="0"?o.padStart(s,"0"):o.padStart(s," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:gue,i={};return(o,...s)=>{let a=i[o];a||(a=i[o]=pue.tokenize(o));let l="";for(const u of a)if(u.type==="literal")l+=u.literal;else{let c=s[u.position];if(c===void 0)l+=r(o,u,s);else if(u.conversion==="b")l+=o6.boolean(c)?"true":"false";else if(u.conversion==="B")l+=o6.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}};nb.createPrintf=mue;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=nb;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(KL);var RC={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=b();r.configure=b,r.stringify=r,r.default=r,t.stringify=r,t.configure=b,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(_){return _.length<5e3&&!i.test(_)?`"${_}"`:JSON.stringify(_)}function s(_){if(_.length>200)return _.sort();for(let y=1;y<_.length;y++){const g=_[y];let v=y;for(;v!==0&&_[v-1]>g;)_[v]=_[v-1],v--;_[v]=g}return _}const a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(_){return a.call(_)!==void 0&&_.length!==0}function u(_,y,g){_.length= 1`)}return g===void 0?1/0:g}function h(_){return _===1?"1 item":`${_} items`}function p(_){const y=new Set;for(const g of _)(typeof g=="string"||typeof g=="number")&&y.add(String(g));return y}function m(_){if(n.call(_,"strict")){const y=_.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(_){_={..._};const y=m(_);y&&(_.bigint===void 0&&(_.bigint=!1),"circularValue"in _||(_.circularValue=Error));const g=c(_),v=d(_,"bigint"),S=d(_,"deterministic"),w=f(_,"maximumDepth"),x=f(_,"maximumBreadth");function C(N,E,P,D,B,R){let I=E[N];switch(typeof I=="object"&&I!==null&&typeof I.toJSON=="function"&&(I=I.toJSON(N)),I=D.call(E,N,I),typeof I){case"string":return o(I);case"object":{if(I===null)return"null";if(P.indexOf(I)!==-1)return g;let O="",F=",";const U=R;if(Array.isArray(I)){if(I.length===0)return"[]";if(wx){const me=I.length-x-1;O+=`${F}"... ${h(me)} not stringified"`}return B!==""&&(O+=` ${U}`),P.pop(),`[${O}]`}let V=Object.keys(I);const H=V.length;if(H===0)return"{}";if(wx){const K=H-x;O+=`${Q}"...":${Y}"${h(K)} not stringified"`,Q=F}return B!==""&&Q.length>1&&(O=` ${R}${O} ${U}`),P.pop(),`{${O}}`}case"number":return isFinite(I)?String(I):y?y(I):"null";case"boolean":return I===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(I);default:return y?y(I):void 0}}function A(N,E,P,D,B,R){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(N)),typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(P.indexOf(E)!==-1)return g;const I=R;let O="",F=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const j=E.length-x-1;O+=`${F}"... ${h(j)} not stringified"`}return B!==""&&(O+=` ${I}`),P.pop(),`[${O}]`}P.push(E);let U="";B!==""&&(R+=B,F=`, ${R}`,U=" ");let V="";for(const H of D){const Y=A(H,E[H],P,D,B,R);Y!==void 0&&(O+=`${V}${o(H)}:${U}${Y}`,V=F)}return B!==""&&V.length>1&&(O=` ${R}${O} ${I}`),P.pop(),`{${O}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(E);default:return y?y(E):void 0}}function T(N,E,P,D,B){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(N),typeof E!="object")return T(N,E,P,D,B);if(E===null)return"null"}if(P.indexOf(E)!==-1)return g;const R=B;if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const oe=E.length-x-1;Y+=`${Q}"... ${h(oe)} not stringified"`}return Y+=` ${R}`,P.pop(),`[${Y}]`}let I=Object.keys(E);const O=I.length;if(O===0)return"{}";if(wx){const Y=O-x;U+=`${V}"...": "${h(Y)} not stringified"`,V=F}return V!==""&&(U=` ${B}${U} ${R}`),P.pop(),`{${U}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(E);default:return y?y(E):void 0}}function k(N,E,P){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(N),typeof E!="object")return k(N,E,P);if(E===null)return"null"}if(P.indexOf(E)!==-1)return g;let D="";if(Array.isArray(E)){if(E.length===0)return"[]";if(wx){const H=E.length-x-1;D+=`,"... ${h(H)} not stringified"`}return P.pop(),`[${D}]`}let B=Object.keys(E);const R=B.length;if(R===0)return"{}";if(wx){const F=R-x;D+=`${I}"...":"${h(F)} not stringified"`}return P.pop(),`{${D}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(v)return String(E);default:return y?y(E):void 0}}function L(N,E,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)),E!=null){if(typeof E=="function")return C("",{"":N},[],E,D,"");if(Array.isArray(E))return A("",N,[],p(E),D,"")}if(D.length!==0)return T("",N,[],D,"")}return k("",N,[])}return L}})(RC,RC.exports);var yue=RC.exports;(function(e){var t=dt&&dt.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=Dc,r=Nm,i=WL,o=KL,s=t(O5),a=t(yue);let l=!1;const u=(0,s.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,w,x,C,A,T,k,L,N,E)=>{g.child({logLevel:v})(S,w,x,C,A,T,k,L,N,E)},b=1e3,_=(g,v)=>(S,w,x,C,A,T,k,L,N,E)=>{const P=(0,a.default)({a:S,b:w,c:x,d:C,e:A,f:T,g:k,h:L,i:N,j:E,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>b&&D.clear(),g.child({logLevel:v})(S,w,x,C,A,T,k,L,N,E))},y=(g,v={},S=[])=>{const w=(x,C,A,T,k,L,N,E,P,D)=>{const B=Date.now(),R=p();let I;h()?I=f():I=d();let O,F;if(typeof x=="string"?O={...I.messageContext,...v}:O={...I.messageContext,...v,...x},typeof x=="string"&&C===void 0)F=x;else if(typeof x=="string"){if(!x.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.");F=(0,o.printf)(x,C,A,T,k,L,N,E,P,D)}else{let V=C;if(typeof C!="string")if(C===void 0)V="";else throw new TypeError("Message must be a string. Received "+typeof C+".");F=(0,o.printf)(V,A,T,k,L,N,E,P,D)}let U={context:O,message:F,sequence:R,time:B,version:n.ROARR_LOG_FORMAT_VERSION};for(const V of[...I.transforms,...S])if(U=V(U),typeof U!="object"||U===null)throw new Error("Message transform function must return a message object.");g(U)};return w.child=x=>{let C;return h()?C=f():C=d(),typeof x=="function"?(0,e.createLogger)(g,{...C.messageContext,...v,...x},[x,...S]):(0,e.createLogger)(g,{...C.messageContext,...v,...x},S)},w.getContext=()=>{let x;return h()?x=f():x=d(),{...x.messageContext,...v}},w.adopt=async(x,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})),x();const A=f();let T;(0,i.hasOwnProperty)(A,"sequenceRoot")&&(0,i.hasOwnProperty)(A,"sequence")&&typeof A.sequence=="number"?T=A.sequenceRoot+"."+String(A.sequence++):T=String(c().sequence++);let k={...A.messageContext};const L=[...A.transforms];typeof C=="function"?L.push(C):k={...k,...C};const N=c().asyncLocalStorage;if(!N)throw new Error("Async local context unavailable.");return N.run({messageContext:k,sequence:0,sequenceRoot:T,transforms:L},()=>x())},w.debug=m(w,r.logLevels.debug),w.debugOnce=_(w,r.logLevels.debug),w.error=m(w,r.logLevels.error),w.errorOnce=_(w,r.logLevels.error),w.fatal=m(w,r.logLevels.fatal),w.fatalOnce=_(w,r.logLevels.fatal),w.info=m(w,r.logLevels.info),w.infoOnce=_(w,r.logLevels.info),w.trace=m(w,r.logLevels.trace),w.traceOnce=_(w,r.logLevels.trace),w.warn=m(w,r.logLevels.warn),w.warnOnce=_(w,r.logLevels.warn),w};e.createLogger=y})(qL);var ib={},vue=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var s=Number(r[o]),a=Number(i[o]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!isNaN(a))return-1}return 0},_ue=dt&&dt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ib,"__esModule",{value:!0});ib.createRoarrInitialGlobalStateBrowser=void 0;const s6=Dc,a6=_ue(vue),bue=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(a6.default),t.includes(s6.ROARR_VERSION)||t.push(s6.ROARR_VERSION),t.sort(a6.default),{sequence:0,...e,versions:t}};ib.createRoarrInitialGlobalStateBrowser=bue;var ob={};Object.defineProperty(ob,"__esModule",{value:!0});ob.getLogLevelName=void 0;const Sue=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";ob.getLogLevelName=Sue;(function(e){var t=dt&&dt.__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=qL,r=ib,o=(0,t(O5).default)(),s=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=s,o.ROARR=s;const a=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;s.write&&s.write(((f=s.serializeMessage)!==null&&f!==void 0?f:a)(d))});e.Roarr=l;var u=Nm;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=ob;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(Mm);var wue=dt&&dt.__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(a.message," %O"),m,b,_,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(a.message),m,b,_)}}};U_.createLogWriter=Iue;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=U_;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(CL);Mm.ROARR.write=CL.createLogWriter();const QL={};Mm.Roarr.child(QL);const sb=Ru(Mm.Roarr.child(QL)),ge=e=>sb.get().child({namespace:e}),WRe=["trace","debug","info","warn","error","fatal"],KRe={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},mn=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},Oue=async e=>{const t={},n=await e.arrayBuffer(),r=Cae(n).text,i=Mv(r,"invokeai_metadata");if(i){const s=MD.safeParse(JSON.parse(i));s.success?t.metadata=s.data:ge("system").error({error:mn(s.error)},"Problem reading metadata from image")}const o=Mv(r,"invokeai_workflow");if(o){const s=FD.safeParse(JSON.parse(o));s.success?t.workflow=s.data:ge("system").error({error:mn(s.error)},"Problem reading workflow from image")}return t};var o1=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(u){return function(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 jue(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var f6=Ls;function JL(e,t){if(e===t||!(f6(e)&&f6(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},s=0,a=n;s=200&&e.status<=299},Gue=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function p6(e){if(!Ls(e))return e;for(var t=yr({},e),n=0,r=Object.entries(t);n"u"&&a===h6&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,v){return l1(t,null,function(){var S,w,x,C,A,T,k,L,N,E,P,D,B,R,I,O,F,U,V,H,Y,Q,j,K,te,oe,me,le,ht,nt,$e,ct,Pe,qt,Sr,Pn;return o1(this,function(bn){switch(bn.label){case 0:return S=v.signal,w=v.getState,x=v.extra,C=v.endpoint,A=v.forced,T=v.type,L=typeof g=="string"?{url:g}:g,N=L.url,E=L.headers,P=E===void 0?new Headers(_.headers):E,D=L.params,B=D===void 0?void 0:D,R=L.responseHandler,I=R===void 0?m??"json":R,O=L.validateStatus,F=O===void 0?b??Vue:O,U=L.timeout,V=U===void 0?p:U,H=c6(L,["url","headers","params","responseHandler","validateStatus","timeout"]),Y=yr(oa(yr({},_),{signal:S}),H),P=new Headers(p6(P)),Q=Y,[4,o(P,{getState:w,extra:x,endpoint:C,forced:A,type:T})];case 1:Q.headers=bn.sent()||P,j=function(Wt){return typeof Wt=="object"&&(Ls(Wt)||Array.isArray(Wt)||typeof Wt.toJSON=="function")},!Y.headers.has("content-type")&&j(Y.body)&&Y.headers.set("content-type",f),j(Y.body)&&c(Y.headers)&&(Y.body=JSON.stringify(Y.body,h)),B&&(K=~N.indexOf("?")?"&":"?",te=l?l(B):new URLSearchParams(p6(B)),N+=K+te),N=zue(r,N),oe=new Request(N,Y),me=oe.clone(),k={request:me},ht=!1,nt=V&&setTimeout(function(){ht=!0,v.abort()},V),bn.label=2;case 2:return bn.trys.push([2,4,5,6]),[4,a(oe)];case 3:return le=bn.sent(),[3,6];case 4:return $e=bn.sent(),[2,{error:{status:ht?"TIMEOUT_ERROR":"FETCH_ERROR",error:String($e)},meta:k}];case 5:return nt&&clearTimeout(nt),[7];case 6:ct=le.clone(),k.response=ct,qt="",bn.label=7;case 7:return bn.trys.push([7,9,,10]),[4,Promise.all([y(le,I).then(function(Wt){return Pe=Wt},function(Wt){return Sr=Wt}),ct.text().then(function(Wt){return qt=Wt},function(){})])];case 8:if(bn.sent(),Sr)throw Sr;return[3,10];case 9:return Pn=bn.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:le.status,data:qt,error:String(Pn)},meta:k}];case 10:return[2,F(le,Pe)?{data:Pe,meta:k}:{error:{status:le.status,data:Pe},meta:k}]}})})};function y(g,v){return l1(this,null,function(){var S;return o1(this,function(w){switch(w.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=w.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var g6=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),D5=Le("__rtkq/focused"),e$=Le("__rtkq/unfocused"),L5=Le("__rtkq/online"),t$=Le("__rtkq/offline"),_a;(function(e){e.query="query",e.mutation="mutation"})(_a||(_a={}));function n$(e){return e.type===_a.query}function que(e){return e.type===_a.mutation}function r$(e,t,n,r,i,o){return Wue(e)?e(t,n,r,i).map(IC).map(o):Array.isArray(e)?e.map(IC).map(o):[]}function Wue(e){return typeof e=="function"}function IC(e){return typeof e=="string"?{type:e}:e}function sw(e){return e!=null}var Ig=Symbol("forceQueryFn"),OC=function(e){return typeof e[Ig]=="function"};function Kue(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,s=new Map,a=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:y,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:b,getRunningMutationsThunk:_,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(w){return w?Object.values(w):[]})};return s1(s1([],v(s)),v(a)).filter(sw)}function p(v,S){return function(w){var x,C=o.endpointDefinitions[v],A=t({queryArgs:S,endpointDefinition:C,endpointName:v});return(x=s.get(w))==null?void 0:x[A]}}function m(v,S){return function(w){var x;return(x=a.get(w))==null?void 0:x[S]}}function b(){return function(v){return Object.values(s.get(v)||{}).filter(sw)}}function _(){return function(v){return Object.values(a.get(v)||{}).filter(sw)}}function y(v,S){var w=function(x,C){var A=C===void 0?{}:C,T=A.subscribe,k=T===void 0?!0:T,L=A.forceRefetch,N=A.subscriptionOptions,E=Ig,P=A[E];return function(D,B){var R,I,O=t({queryArgs:x,endpointDefinition:S,endpointName:v}),F=n((R={type:"query",subscribe:k,forceRefetch:L,subscriptionOptions:N,endpointName:v,originalArgs:x,queryCacheKey:O},R[Ig]=P,R)),U=i.endpoints[v].select(x),V=D(F),H=U(B()),Y=V.requestId,Q=V.abort,j=H.requestId!==Y,K=(I=s.get(D))==null?void 0:I[O],te=function(){return U(B())},oe=Object.assign(P?V.then(te):j&&!K?Promise.resolve(H):Promise.all([K,V]).then(te),{arg:x,requestId:Y,subscriptionOptions:N,queryCacheKey:O,abort:Q,unwrap:function(){return l1(this,null,function(){var le;return o1(this,function(ht){switch(ht.label){case 0:return[4,oe];case 1:if(le=ht.sent(),le.isError)throw le.error;return[2,le.data]}})})},refetch:function(){return D(w(x,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){k&&D(u({queryCacheKey:O,requestId:Y}))},updateSubscriptionOptions:function(le){oe.subscriptionOptions=le,D(d({endpointName:v,requestId:Y,queryCacheKey:O,options:le}))}});if(!K&&!j&&!P){var me=s.get(D)||{};me[O]=oe,s.set(D,me),oe.then(function(){delete me[O],Object.keys(me).length||s.delete(D)})}return oe}};return w}function g(v){return function(S,w){var x=w===void 0?{}:w,C=x.track,A=C===void 0?!0:C,T=x.fixedCacheKey;return function(k,L){var N=r({type:"mutation",endpointName:v,originalArgs:S,track:A,fixedCacheKey:T}),E=k(N),P=E.requestId,D=E.abort,B=E.unwrap,R=E.unwrap().then(function(U){return{data:U}}).catch(function(U){return{error:U}}),I=function(){k(c({requestId:P,fixedCacheKey:T}))},O=Object.assign(R,{arg:E.arg,requestId:P,abort:D,unwrap:B,unsubscribe:I,reset:I}),F=a.get(k)||{};return a.set(k,F),F[P]=O,O.then(function(){delete F[P],Object.keys(F).length||a.delete(k)}),T&&(F[T]=O,O.then(function(){F[T]===O&&(delete F[T],Object.keys(F).length||a.delete(k))})),O}}}}function m6(e){return e}function Xue(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,s=e.api,a=function(g,v,S){return function(w){var x=i[g];w(s.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:v,endpointDefinition:x,endpointName:g}),patches:S}))}},l=function(g,v,S){return function(w,x){var C,A,T=s.endpoints[g].select(v)(x()),k={patches:[],inversePatches:[],undo:function(){return w(s.util.patchQueryData(g,v,k.inversePatches))}};if(T.status===Wn.uninitialized)return k;if("data"in T)if(go(T.data)){var L=JE(T.data,S),N=L[1],E=L[2];(C=k.patches).push.apply(C,N),(A=k.inversePatches).push.apply(A,E)}else{var P=S(T.data);k.patches.push({op:"replace",path:[],value:P}),k.inversePatches.push({op:"replace",path:[],value:T.data})}return w(s.util.patchQueryData(g,v,k.patches)),k}},u=function(g,v,S){return function(w){var x;return w(s.endpoints[g].initiate(v,(x={subscribe:!1,forceRefetch:!0},x[Ig]=function(){return{data:S}},x)))}},c=function(g,v){return l1(t,[g,v],function(S,w){var x,C,A,T,k,L,N,E,P,D,B,R,I,O,F,U,V,H,Y=w.signal,Q=w.abort,j=w.rejectWithValue,K=w.fulfillWithValue,te=w.dispatch,oe=w.getState,me=w.extra;return o1(this,function(le){switch(le.label){case 0:x=i[S.endpointName],le.label=1;case 1:return le.trys.push([1,8,,13]),C=m6,A=void 0,T={signal:Y,abort:Q,dispatch:te,getState:oe,extra:me,endpoint:S.endpointName,type:S.type,forced:S.type==="query"?d(S,oe()):void 0},k=S.type==="query"?S[Ig]:void 0,k?(A=k(),[3,6]):[3,2];case 2:return x.query?[4,r(x.query(S.originalArgs),T,x.extraOptions)]:[3,4];case 3:return A=le.sent(),x.transformResponse&&(C=x.transformResponse),[3,6];case 4:return[4,x.queryFn(S.originalArgs,T,x.extraOptions,function(ht){return r(ht,T,x.extraOptions)})];case 5:A=le.sent(),le.label=6;case 6:if(typeof process<"u",A.error)throw new g6(A.error,A.meta);return B=K,[4,C(A.data,A.meta,S.originalArgs)];case 7:return[2,B.apply(void 0,[le.sent(),(V={fulfilledTimeStamp:Date.now(),baseQueryMeta:A.meta},V[ac]=!0,V)])];case 8:if(R=le.sent(),I=R,!(I instanceof g6))return[3,12];O=m6,x.query&&x.transformErrorResponse&&(O=x.transformErrorResponse),le.label=9;case 9:return le.trys.push([9,11,,12]),F=j,[4,O(I.value,I.meta,S.originalArgs)];case 10:return[2,F.apply(void 0,[le.sent(),(H={baseQueryMeta:I.meta},H[ac]=!0,H)])];case 11:return U=le.sent(),I=U,[3,12];case 12:throw typeof process<"u",console.error(I),I;case 13:return[2]}})})};function d(g,v){var S,w,x,C,A=(w=(S=v[n])==null?void 0:S.queries)==null?void 0:w[g.queryCacheKey],T=(x=v[n])==null?void 0:x.config.refetchOnMountOrArgChange,k=A==null?void 0:A.fulfilledTimeStamp,L=(C=g.forceRefetch)!=null?C:g.subscribe&&T;return L?L===!0||(Number(new Date)-Number(k))/1e3>=L:!1}var f=hu(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[ac]=!0,g},condition:function(g,v){var S=v.getState,w,x,C,A=S(),T=(x=(w=A[n])==null?void 0:w.queries)==null?void 0:x[g.queryCacheKey],k=T==null?void 0:T.fulfilledTimeStamp,L=g.originalArgs,N=T==null?void 0:T.originalArgs,E=i[g.endpointName];return OC(g)?!0:(T==null?void 0:T.status)==="pending"?!1:d(g,A)||n$(E)&&((C=E==null?void 0:E.forceRefetch)!=null&&C.call(E,{currentArg:L,previousArg:N,endpointState:T,state:A}))?!0:!k},dispatchConditionRejection:!0}),h=hu(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[ac]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},b=function(g,v,S){return function(w,x){var C=p(S)&&S.force,A=m(S)&&S.ifOlderThan,T=function(E){return E===void 0&&(E=!0),s.endpoints[g].initiate(v,{forceRefetch:E})},k=s.endpoints[g].select(v)(x());if(C)w(T());else if(A){var L=k==null?void 0:k.fulfilledTimeStamp;if(!L){w(T());return}var N=(Number(new Date)-Number(new Date(L)))/1e3>=A;N&&w(T())}else w(T(!1))}};function _(g){return function(v){var S,w;return((w=(S=v==null?void 0:v.meta)==null?void 0:S.arg)==null?void 0:w.endpointName)===g}}function y(g,v){return{matchPending:af(b_(g),_(v)),matchFulfilled:af(Pu(g),_(v)),matchRejected:af(Of(g),_(v))}}return{queryThunk:f,mutationThunk:h,prefetch:b,updateQueryData:l,upsertQueryData:u,patchQueryData:a,buildMatchThunkActions:y}}function i$(e,t,n,r){return r$(n[e.meta.arg.endpointName][t],Pu(e)?e.payload:void 0,gm(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function My(e,t,n){var r=e[t];r&&n(r)}function Og(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function y6(e,t,n){var r=e[Og(t)];r&&n(r)}var $h={};function Que(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,s=i.apiUid,a=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=Le(t+"/resetApiState"),f=nr({name:t+"/queries",initialState:$h,reducers:{removeQueryResult:{reducer:function(S,w){var x=w.payload.queryCacheKey;delete S[x]},prepare:k0()},queryResultPatched:function(S,w){var x=w.payload,C=x.queryCacheKey,A=x.patches;My(S,C,function(T){T.data=Jx(T.data,A.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(w,x){var C=x.meta,A=x.meta.arg,T,k,L=OC(A);(A.subscribe||L)&&((k=w[T=A.queryCacheKey])!=null||(w[T]={status:Wn.uninitialized,endpointName:A.endpointName})),My(w,A.queryCacheKey,function(N){N.status=Wn.pending,N.requestId=L&&N.requestId?N.requestId:C.requestId,A.originalArgs!==void 0&&(N.originalArgs=A.originalArgs),N.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(w,x){var C=x.meta,A=x.payload;My(w,C.arg.queryCacheKey,function(T){var k;if(!(T.requestId!==C.requestId&&!OC(C.arg))){var L=o[C.arg.endpointName].merge;if(T.status=Wn.fulfilled,L)if(T.data!==void 0){var N=C.fulfilledTimeStamp,E=C.arg,P=C.baseQueryMeta,D=C.requestId,B=ku(T.data,function(R){return L(R,A,{arg:E.originalArgs,baseQueryMeta:P,fulfilledTimeStamp:N,requestId:D})});T.data=B}else T.data=A;else T.data=(k=o[C.arg.endpointName].structuralSharing)==null||k?JL(Xi(T.data)?qE(T.data):T.data,A):A;delete T.error,T.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(w,x){var C=x.meta,A=C.condition,T=C.arg,k=C.requestId,L=x.error,N=x.payload;My(w,T.queryCacheKey,function(E){if(!A){if(E.requestId!==k)return;E.status=Wn.rejected,E.error=N??L}})}).addMatcher(l,function(w,x){for(var C=a(x).queries,A=0,T=Object.entries(C);A"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?_ce:vce;a$.useSyncExternalStore=Gf.useSyncExternalStore!==void 0?Gf.useSyncExternalStore:bce;s$.exports=a$;var Sce=s$.exports,l$={exports:{}},u$={};/** * @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 ab=M,wce=Sce;function xce(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Cce=typeof Object.is=="function"?Object.is:xce,Ece=wce.useSyncExternalStore,Tce=ab.useRef,Ace=ab.useEffect,kce=ab.useMemo,Pce=ab.useDebugValue;u$.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Tce(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=kce(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&s.hasValue){var p=s.value;if(i(p,h))return d=p}return d=h}if(p=d,Cce(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 a=Ece(e,o[0],o[1]);return Ace(function(){s.hasValue=!0,s.value=a},[a]),Pce(a),a};l$.exports=u$;var c$=l$.exports;const Rce=Uc(c$);function Ice(e){e()}let d$=Ice;const Oce=e=>d$=e,Mce=()=>d$,C6=Symbol.for("react-redux-context"),E6=typeof globalThis<"u"?globalThis:{};function Nce(){var e;if(!M.createContext)return{};const t=(e=E6[C6])!=null?e:E6[C6]=new Map;let n=t.get(M.createContext);return n||(n=M.createContext(null),t.set(M.createContext,n)),n}const vu=Nce();function $5(e=vu){return function(){return M.useContext(e)}}const f$=$5(),Dce=()=>{throw new Error("uSES not initialized!")};let h$=Dce;const Lce=e=>{h$=e},$ce=(e,t)=>e===t;function Fce(e=vu){const t=e===vu?f$:$5(e);return function(r,i={}){const{equalityFn:o=$ce,stabilityCheck:s=void 0,noopCheck:a=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();M.useRef(!0);const h=M.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,s]),p=h$(u.addNestedSub,l.getState,c||l.getState,h,o);return M.useDebugValue(p),p}}const p$=Fce();function u1(){return u1=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const T6={notify(){},get:()=>[]};function Qce(e,t){let n,r=T6;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function s(){c.onStateChange&&c.onStateChange()}function a(){return!!n}function l(){n||(n=t?t.addNestedSub(s):e.subscribe(s),r=Xce())}function u(){n&&(n(),n=void 0,r.clear(),r=T6)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:s,isSubscribed:a,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const Yce=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Zce=Yce?M.useLayoutEffect:M.useEffect;function A6(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function c1(e,t){if(A6(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=Qce(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),a=M.useMemo(()=>e.getState(),[e]);Zce(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,a]);const l=t||vu;return M.createElement(l.Provider,{value:s},n)}function b$(e=vu){const t=e===vu?f$:$5(e);return function(){const{store:r}=t();return r}}const S$=b$();function ede(e=vu){const t=e===vu?S$:b$(e);return function(){return t().dispatch}}const w$=ede();Lce(c$.useSyncExternalStoreWithSelector);Oce(Cs.unstable_batchedUpdates);var tde=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n{const r=_g.get(),i=$f.get(),o=bg.get();return Hue({baseUrl:`${r??""}/api/v1`,prepareHeaders:a=>(i&&a.set("Authorization",`Bearer ${i}`),o&&a.set("project-id",o),a)})(e,t,n)},_u=mde({baseQuery:vde,reducerPath:"api",tagTypes:yde,endpoints:()=>({})}),_de=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:ne==null,Ede=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),NC=Symbol("encodeFragmentIdentifier");function Tde(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,[Tr(t,e),"[",i,"]"].join("")]:[...n,[Tr(t,e),"[",Tr(i,e),"]=",Tr(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[Tr(t,e),"[]"].join("")]:[...n,[Tr(t,e),"[]=",Tr(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,[Tr(t,e),":list="].join("")]:[...n,[Tr(t,e),":list=",Tr(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?[[Tr(n,e),t,Tr(i,e)].join("")]:[[r,Tr(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,Tr(t,e)]:[...n,[Tr(t,e),"=",Tr(r,e)].join("")]}}function Ade(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),s=typeof r=="string"&&!o&&Va(r,e).includes(e.arrayFormatSeparator);r=s?Va(r,e):r;const a=o||s?r.split(e.arrayFormatSeparator).map(l=>Va(l,e)):r===null?r:Va(r,e);i[n]=a};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Va(r,e);return}const s=r===null?[]:r.split(e.arrayFormatSeparator).map(a=>Va(a,e));if(i[n]===void 0){i[n]=s;return}i[n]=[...i[n],...s]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function E$(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Tr(e,t){return t.encode?t.strict?Ede(e):encodeURIComponent(e):e}function Va(e,t){return t.decode?wde(e):e}function T$(e){return Array.isArray(e)?e.sort():typeof e=="object"?T$(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function A$(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function kde(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function M6(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 V5(e){e=A$(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function G5(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},E$(t.arrayFormatSeparator);const n=Ade(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[s,a]=C$(o,"=");s===void 0&&(s=o),a=a===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:Va(a,t),n(Va(s,t),a,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[s,a]of Object.entries(o))o[s]=M6(a,t);else r[i]=M6(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const s=r[o];return s&&typeof s=="object"&&!Array.isArray(s)?i[o]=T$(s):i[o]=s,i},Object.create(null))}function k$(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},E$(t.arrayFormatSeparator);const n=s=>t.skipNull&&Cde(e[s])||t.skipEmptyString&&e[s]==="",r=Tde(t),i={};for(const[s,a]of Object.entries(e))n(s)||(i[s]=a);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(s=>{const a=e[s];return a===void 0?"":a===null?Tr(s,t):Array.isArray(a)?a.length===0&&t.arrayFormat==="bracket-separator"?Tr(s,t)+"[]":a.reduce(r(s),[]).join("&"):Tr(s,t)+"="+Tr(a,t)}).filter(s=>s.length>0).join("&")}function P$(e,t){var i;t={decode:!0,...t};let[n,r]=C$(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:G5(V5(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Va(r,t)}:{}}}function R$(e,t){t={encode:!0,strict:!0,[NC]:!0,...t};const n=A$(e.url).split("?")[0]||"",r=V5(e.url),i={...G5(r,{sort:!1}),...e.query};let o=k$(i,t);o&&(o=`?${o}`);let s=kde(e.url);if(e.fragmentIdentifier){const a=new URL(n);a.hash=e.fragmentIdentifier,s=t[NC]?a.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${s}`}function I$(e,t,n){n={parseFragmentIdentifier:!0,[NC]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=P$(e,n);return R$({url:r,query:xde(i,t),fragmentIdentifier:o},n)}function Pde(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return I$(e,r,n)}const D0=Object.freeze(Object.defineProperty({__proto__:null,exclude:Pde,extract:V5,parse:G5,parseUrl:P$,pick:I$,stringify:k$,stringifyUrl:R$},Symbol.toStringTag,{value:"Module"})),ju=(e,t)=>{if(!e)return!1;const n=f1.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=a}else{const o=i[i.length-1];if(!o)return!1;const s=new Date(t.created_at),a=new Date(o.created_at);return s>=a}},Uo=e=>Qr.includes(e.image_category)?Qr:Gl,Ln=fl({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:_de(t.created_at,e.created_at)}),f1=Ln.getSelectors(),Eo=e=>`images/?${D0.stringify(e,{arrayFormat:"none"})}`,pi=_u.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:pt}];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:pt}];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:Eo({board_id:t??"none",categories:Qr,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>t.total}),getBoardAssetsTotal:e.query({query:t=>({url:Eo({board_id:t??"none",categories:Gl,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>t.total}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:pt}]}),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:XRe,useListAllBoardsQuery:QRe,useGetBoardImagesTotalQuery:YRe,useGetBoardAssetsTotalQuery:ZRe,useCreateBoardMutation:JRe,useUpdateBoardMutation:eIe,useListAllImageNamesForBoardQuery:tIe}=pi,pe=_u.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Eo(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Eo({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Eo({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return Ln.addMany(Ln.getInitialState(),n)},merge:(t,n)=>{Ln.addMany(t,f1.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;f1.selectAll(i).forEach(o=>{n(pe.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:Eo({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 s;const a=await i(`images/i/${t.image.image_name}/metadata`);if(a.data){const l=MD.safeParse((o=a.data)==null?void 0:o.metadata);l.success&&(s=l.data)}return{data:{metadata:s}}}else{const s=$f.get(),a=bg.get(),u=await sre.fetchBaseQuery({baseUrl:"",prepareHeaders:d=>(s&&d.set("Authorization",`Bearer ${s}`),a&&d.set("project-id",a),d),responseHandler:async d=>await d.blob()})(t.image.image_url,n,r);return{data:await Oue(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"}),invalidatesTags:(t,n,{board_id:r})=>[{type:"BoardImagesTotal",id:r??"none"},{type:"BoardAssetsTotal",id:r??"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,s={board_id:o??"none",categories:Uo(t)},a=n(pe.util.updateQueryData("listImages",s,l=>{Ln.removeOne(l,i)}));try{await r}catch{a.undo()}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{var o;const i=(o=r[0])==null?void 0:o.board_id;return[{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"}]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=v5(t,"image_name");i.deleted_images.forEach(s=>{const a=o[s];if(a){const l={board_id:a.board_id??"none",categories:Uo(a)};n(pe.util.updateQueryData("listImages",l,u=>{Ln.removeOne(u,s)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[];s.push(r(pe.util.updateQueryData("getImageDTO",t.image_name,l=>{Object.assign(l,{is_intermediate:n})})));const a=Uo(t);if(n)s.push(r(pe.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:a},l=>{Ln.removeOne(l,t.image_name)})));else{const l={board_id:t.board_id??"none",categories:a},u=pe.endpoints.listImages.select(l)(o()),{data:c}=Qr.includes(t.image_category)?pi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):pi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=ju(u.data,t);(d||f)&&s.push(r(pe.util.updateQueryData("listImages",l,h=>{Ln.upsertOne(h,t)})))}try{await i}catch{s.forEach(l=>l.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),invalidatesTags:(t,n,{imageDTO:r})=>[{type:"BoardImagesTotal",id:r.board_id??"none"},{type:"BoardAssetsTotal",id:r.board_id??"none"}],async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(pe.util.updateQueryData("getImageDTO",t.image_name,s=>{Object.assign(s,{session_id:n})})));try{await i}catch{o.forEach(s=>s.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=Uo(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Eo({board_id:o,categories:i})}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,s=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!s[0])return;const a=Uo(s[0]),l=s[0].board_id;s.forEach(u=>{const{image_name:c}=u;n(pe.util.updateQueryData("getImageDTO",c,b=>{b.starred=!0}));const d={board_id:l??"none",categories:a},f=pe.endpoints.listImages.select(d)(i()),{data:h}=Qr.includes(u.image_category)?pi.endpoints.getBoardImagesTotal.select(l??"none")(i()):pi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=Ey?ju(f.data,u):!0;(p||m)&&n(pe.util.updateQueryData("listImages",d,b=>{Ln.upsertOne(b,{...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=Uo(r[0]),o=r[0].board_id;return[{type:"ImageList",id:Eo({board_id:o,categories:i})}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,s=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!s[0])return;const a=Uo(s[0]),l=s[0].board_id;s.forEach(u=>{const{image_name:c}=u;n(pe.util.updateQueryData("getImageDTO",c,b=>{b.starred=!1}));const d={board_id:l??"none",categories:a},f=pe.endpoints.listImages.select(d)(i()),{data:h}=Qr.includes(u.image_category)?pi.endpoints.getBoardImagesTotal.select(l??"none")(i()):pi.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=(h??0),m=(h||0)>=Ey?ju(f.data,u):!0;(p||m)&&n(pe.util.updateQueryData("listImages",d,b=>{Ln.upsertOne(b,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:s})=>{const a=new FormData;return a.append("file",t),{url:"images/upload",method:"POST",body:a,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:s}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(pe.util.upsertQueryData("getImageDTO",i.image_name,i));const o=Uo(i);n(pe.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},s=>{Ln.addOne(s,i)})),n(pe.util.invalidateTags([{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}]))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:pt},{type:"ImageList",id:Eo({board_id:"none",categories:Qr})},{type:"ImageList",id:Eo({board_id:"none",categories:Gl})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(pe.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))});const s=[{categories:Qr},{categories:Gl}],a=o.map(l=>({id:l,changes:{board_id:void 0}}));s.forEach(l=>{n(pe.util.updateQueryData("listImages",l,u=>{Ln.updateMany(u,a)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:pt},{type:"ImageList",id:Eo({board_id:"none",categories:Qr})},{type:"ImageList",id:Eo({board_id:"none",categories:Gl})},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:Qr},{categories:Gl}].forEach(a=>{n(pe.util.updateQueryData("listImages",a,l=>{Ln.removeMany(l,o)}))})}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r,imageDTO:i})=>[{type:"Board",id:r},{type:"BoardImagesTotal",id:r},{type:"BoardAssetsTotal",id:r},{type:"BoardImagesTotal",id:i.board_id??"none"},{type:"BoardAssetsTotal",id:i.board_id??"none"}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const s=[],a=Uo(n);if(s.push(r(pe.util.updateQueryData("getImageDTO",n.image_name,l=>{l.board_id=t}))),!n.is_intermediate){s.push(r(pe.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:a},h=>{Ln.removeOne(h,n.image_name)})));const l={board_id:t??"none",categories:a},u=pe.endpoints.listImages.select(l)(o()),{data:c}=Qr.includes(n.image_category)?pi.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):pi.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),d=u.data&&u.data.ids.length>=(c??0),f=ju(u.data,n);(d||f)&&s.push(r(pe.util.updateQueryData("listImages",l,h=>{Ln.addOne(h,n)})))}try{await i}catch{s.forEach(l=>l.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=Uo(t),s=[];s.push(n(pe.util.updateQueryData("getImageDTO",t.image_name,f=>{f.board_id=void 0}))),s.push(n(pe.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},f=>{Ln.removeOne(f,t.image_name)})));const a={board_id:"none",categories:o},l=pe.endpoints.listImages.select(a)(i()),{data:u}=Qr.includes(t.image_category)?pi.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):pi.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),c=l.data&&l.data.ids.length>=(u??0),d=ju(l.data,t);(c||d)&&s.push(n(pe.util.updateQueryData("listImages",a,f=>{Ln.upsertOne(f,t)})));try{await r}catch{s.forEach(f=>f.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{imageDTOs:r,board_id:i})=>{var s;const o=(s=r[0])==null?void 0:s.board_id;return[{type:"Board",id:i??"none"},{type:"BoardImagesTotal",id:i??"none"},{type:"BoardAssetsTotal",id:i??"none"},{type:"BoardImagesTotal",id:o??"none"},{type:"BoardAssetsTotal",id:o??"none"},{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}]},async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:s}=await i,{added_image_names:a}=s;a.forEach(l=>{r(pe.util.updateQueryData("getImageDTO",l,_=>{_.board_id=t}));const u=n.find(_=>_.image_name===l);if(!u)return;const c=Uo(u),d=u.board_id;r(pe.util.updateQueryData("listImages",{board_id:d??"none",categories:c},_=>{Ln.removeOne(_,u.image_name)}));const f={board_id:t,categories:c},h=pe.endpoints.listImages.select(f)(o()),{data:p}=Qr.includes(u.image_category)?pi.endpoints.getBoardImagesTotal.select(t??"none")(o()):pi.endpoints.getBoardAssetsTotal.select(t??"none")(o()),m=h.data&&h.data.ids.length>=(p??0),b=(p||0)>=Ey?ju(h.data,u):!0;(m||b)&&r(pe.util.updateQueryData("listImages",f,_=>{Ln.upsertOne(_,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[{type:"BoardImagesTotal",id:"none"},{type:"BoardAssetsTotal",id:"none"}];return t==null||t.removed_image_names.forEach(s=>{var l;const a=(l=r.find(u=>u.image_name===s))==null?void 0:l.board_id;!a||i.includes(a)||(o.push({type:"Board",id:a}),o.push({type:"BoardImagesTotal",id:a}),o.push({type:"BoardAssetsTotal",id:a}))}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:s}=o;s.forEach(a=>{n(pe.util.updateQueryData("getImageDTO",a,m=>{m.board_id=void 0}));const l=t.find(m=>m.image_name===a);if(!l)return;const u=Uo(l);n(pe.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},m=>{Ln.removeOne(m,l.image_name)}));const c={board_id:"none",categories:u},d=pe.endpoints.listImages.select(c)(i()),{data:f}=Qr.includes(l.image_category)?pi.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):pi.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),h=d.data&&d.data.ids.length>=(f??0),p=(f||0)>=Ey?ju(d.data,l):!0;(h||p)&&n(pe.util.updateQueryData("listImages",c,m=>{Ln.upsertOne(m,{...l,board_id:"none"})}))})}catch{}}})})}),{useGetIntermediatesCountQuery:nIe,useListImagesQuery:rIe,useLazyListImagesQuery:iIe,useGetImageDTOQuery:oIe,useGetImageMetadataQuery:sIe,useDeleteImageMutation:aIe,useDeleteImagesMutation:lIe,useUploadImageMutation:uIe,useClearIntermediatesMutation:cIe,useAddImagesToBoardMutation:dIe,useRemoveImagesFromBoardMutation:fIe,useAddImageToBoardMutation:hIe,useRemoveImageFromBoardMutation:pIe,useChangeImageIsIntermediateMutation:gIe,useChangeImageSessionIdMutation:mIe,useDeleteBoardAndImagesMutation:yIe,useDeleteBoardMutation:vIe,useStarImagesMutation:_Ie,useUnstarImagesMutation:bIe,useGetImageMetadataFromFileQuery:SIe}=pe,O$=Le("socket/socketConnected"),M$=Le("socket/appSocketConnected"),N$=Le("socket/socketDisconnected"),D$=Le("socket/appSocketDisconnected"),H5=Le("socket/socketSubscribed"),L$=Le("socket/appSocketSubscribed"),$$=Le("socket/socketUnsubscribed"),F$=Le("socket/appSocketUnsubscribed"),B$=Le("socket/socketInvocationStarted"),q5=Le("socket/appSocketInvocationStarted"),W5=Le("socket/socketInvocationComplete"),K5=Le("socket/appSocketInvocationComplete"),z$=Le("socket/socketInvocationError"),kb=Le("socket/appSocketInvocationError"),U$=Le("socket/socketGraphExecutionStateComplete"),j$=Le("socket/appSocketGraphExecutionStateComplete"),V$=Le("socket/socketGeneratorProgress"),X5=Le("socket/appSocketGeneratorProgress"),G$=Le("socket/socketModelLoadStarted"),Rde=Le("socket/appSocketModelLoadStarted"),H$=Le("socket/socketModelLoadCompleted"),Ide=Le("socket/appSocketModelLoadCompleted"),q$=Le("socket/socketSessionRetrievalError"),W$=Le("socket/appSocketSessionRetrievalError"),K$=Le("socket/socketInvocationRetrievalError"),X$=Le("socket/appSocketInvocationRetrievalError"),Q5=Le("controlNet/imageProcessed"),Id={none:{type:"none",get label(){return we.t("controlnet.none")},get description(){return we.t("controlnet.noneDescription")},default:{type:"none"}},canny_image_processor:{type:"canny_image_processor",get label(){return we.t("controlnet.canny")},get description(){return we.t("controlnet.cannyDescription")},default:{id:"canny_image_processor",type:"canny_image_processor",low_threshold:100,high_threshold:200}},content_shuffle_image_processor:{type:"content_shuffle_image_processor",get label(){return we.t("controlnet.contentShuffle")},get description(){return we.t("controlnet.contentShuffleDescription")},default:{id:"content_shuffle_image_processor",type:"content_shuffle_image_processor",detect_resolution:512,image_resolution:512,h:512,w:512,f:256}},hed_image_processor:{type:"hed_image_processor",get label(){return we.t("controlnet.hed")},get description(){return we.t("controlnet.hedDescription")},default:{id:"hed_image_processor",type:"hed_image_processor",detect_resolution:512,image_resolution:512,scribble:!1}},lineart_anime_image_processor:{type:"lineart_anime_image_processor",get label(){return we.t("controlnet.lineartAnime")},get description(){return we.t("controlnet.lineartAnimeDescription")},default:{id:"lineart_anime_image_processor",type:"lineart_anime_image_processor",detect_resolution:512,image_resolution:512}},lineart_image_processor:{type:"lineart_image_processor",get label(){return we.t("controlnet.lineart")},get description(){return we.t("controlnet.lineartDescription")},default:{id:"lineart_image_processor",type:"lineart_image_processor",detect_resolution:512,image_resolution:512,coarse:!1}},mediapipe_face_processor:{type:"mediapipe_face_processor",get label(){return we.t("controlnet.mediapipeFace")},get description(){return we.t("controlnet.mediapipeFaceDescription")},default:{id:"mediapipe_face_processor",type:"mediapipe_face_processor",max_faces:1,min_confidence:.5}},midas_depth_image_processor:{type:"midas_depth_image_processor",get label(){return we.t("controlnet.depthMidas")},get description(){return we.t("controlnet.depthMidasDescription")},default:{id:"midas_depth_image_processor",type:"midas_depth_image_processor",a_mult:2,bg_th:.1}},mlsd_image_processor:{type:"mlsd_image_processor",get label(){return we.t("controlnet.mlsd")},get description(){return we.t("controlnet.mlsdDescription")},default:{id:"mlsd_image_processor",type:"mlsd_image_processor",detect_resolution:512,image_resolution:512,thr_d:.1,thr_v:.1}},normalbae_image_processor:{type:"normalbae_image_processor",get label(){return we.t("controlnet.normalBae")},get description(){return we.t("controlnet.normalBaeDescription")},default:{id:"normalbae_image_processor",type:"normalbae_image_processor",detect_resolution:512,image_resolution:512}},openpose_image_processor:{type:"openpose_image_processor",get label(){return we.t("controlnet.openPose")},get description(){return we.t("controlnet.openPoseDescription")},default:{id:"openpose_image_processor",type:"openpose_image_processor",detect_resolution:512,image_resolution:512,hand_and_face:!1}},pidi_image_processor:{type:"pidi_image_processor",get label(){return we.t("controlnet.pidi")},get description(){return we.t("controlnet.pidiDescription")},default:{id:"pidi_image_processor",type:"pidi_image_processor",detect_resolution:512,image_resolution:512,scribble:!1,safe:!1}},zoe_depth_image_processor:{type:"zoe_depth_image_processor",get label(){return we.t("controlnet.depthZoe")},get description(){return we.t("controlnet.depthZoeDescription")},default:{id:"zoe_depth_image_processor",type:"zoe_depth_image_processor"}}},$y={canny:"canny_image_processor",mlsd:"mlsd_image_processor",depth:"midas_depth_image_processor",bae:"normalbae_image_processor",lineart:"lineart_image_processor",lineart_anime:"lineart_anime_image_processor",softedge:"hed_image_processor",shuffle:"content_shuffle_image_processor",openpose:"openpose_image_processor",mediapipe:"mediapipe_face_processor",pidi:"pidi_image_processor",zoe:"zoe_depth_image_processor"},N6={isEnabled:!0,model:null,weight:1,beginStepPct:0,endStepPct:1,controlMode:"balanced",resizeMode:"just_resize",controlImage:null,processedControlImage:null,processorType:"canny_image_processor",processorNode:Id.canny_image_processor.default,shouldAutoConfig:!0},Q$={adapterImage:null,model:null,weight:1,beginStepPct:0,endStepPct:1},DC={controlNets:{},isEnabled:!1,pendingControlImages:[],isIPAdapterEnabled:!1,ipAdapterInfo:{...Q$}},Y$=nr({name:"controlNet",initialState:DC,reducers:{isControlNetEnabledToggled:e=>{e.isEnabled=!e.isEnabled},controlNetAdded:(e,t)=>{const{controlNetId:n,controlNet:r}=t.payload;e.controlNets[n]={...r??N6,controlNetId:n}},controlNetDuplicated:(e,t)=>{const{sourceControlNetId:n,newControlNetId:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=Jn(i);o.controlNetId=r,e.controlNets[r]=o},controlNetAddedFromImage:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload;e.controlNets[n]={...N6,controlNetId:n,controlImage:r}},controlNetRemoved:(e,t)=>{const{controlNetId:n}=t.payload;delete e.controlNets[n]},controlNetToggled:(e,t)=>{const{controlNetId:n}=t.payload,r=e.controlNets[n];r&&(r.isEnabled=!r.isEnabled)},controlNetImageChanged:(e,t)=>{const{controlNetId:n,controlImage:r}=t.payload,i=e.controlNets[n];i&&(i.controlImage=r,i.processedControlImage=null,r!==null&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlNetProcessedImageChanged:(e,t)=>{const{controlNetId:n,processedControlImage:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=r,e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlNetModelChanged:(e,t)=>{const{controlNetId:n,model:r}=t.payload,i=e.controlNets[n];if(i&&(i.model=r,i.processedControlImage=null,i.shouldAutoConfig)){let o;for(const s in $y)if(r.model_name.includes(s)){o=$y[s];break}o?(i.processorType=o,i.processorNode=Id[o].default):(i.processorType="none",i.processorNode=Id.none.default)}},controlNetWeightChanged:(e,t)=>{const{controlNetId:n,weight:r}=t.payload,i=e.controlNets[n];i&&(i.weight=r)},controlNetBeginStepPctChanged:(e,t)=>{const{controlNetId:n,beginStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.beginStepPct=r)},controlNetEndStepPctChanged:(e,t)=>{const{controlNetId:n,endStepPct:r}=t.payload,i=e.controlNets[n];i&&(i.endStepPct=r)},controlNetControlModeChanged:(e,t)=>{const{controlNetId:n,controlMode:r}=t.payload,i=e.controlNets[n];i&&(i.controlMode=r)},controlNetResizeModeChanged:(e,t)=>{const{controlNetId:n,resizeMode:r}=t.payload,i=e.controlNets[n];i&&(i.resizeMode=r)},controlNetProcessorParamsChanged:(e,t)=>{const{controlNetId:n,changes:r}=t.payload,i=e.controlNets[n];if(!i)return;const o=i.processorNode;i.processorNode={...o,...r},i.shouldAutoConfig=!1},controlNetProcessorTypeChanged:(e,t)=>{const{controlNetId:n,processorType:r}=t.payload,i=e.controlNets[n];i&&(i.processedControlImage=null,i.processorType=r,i.processorNode=Id[r].default,i.shouldAutoConfig=!1)},controlNetAutoConfigToggled:(e,t)=>{var o;const{controlNetId:n}=t.payload,r=e.controlNets[n];if(!r)return;const i=!r.shouldAutoConfig;if(i){let s;for(const a in $y)if((o=r.model)!=null&&o.model_name.includes(a)){s=$y[a];break}s?(r.processorType=s,r.processorNode=Id[s].default):(r.processorType="none",r.processorNode=Id.none.default)}r.shouldAutoConfig=i},controlNetReset:()=>({...DC}),isIPAdapterEnableToggled:e=>{e.isIPAdapterEnabled=!e.isIPAdapterEnabled},ipAdapterImageChanged:(e,t)=>{e.ipAdapterInfo.adapterImage=t.payload},ipAdapterWeightChanged:(e,t)=>{e.ipAdapterInfo.weight=t.payload},ipAdapterModelChanged:(e,t)=>{e.ipAdapterInfo.model=t.payload},ipAdapterBeginStepPctChanged:(e,t)=>{e.ipAdapterInfo.beginStepPct=t.payload},ipAdapterEndStepPctChanged:(e,t)=>{e.ipAdapterInfo.endStepPct=t.payload},ipAdapterStateReset:e=>{e.isIPAdapterEnabled=!1,e.ipAdapterInfo={...Q$}}},extraReducers:e=>{e.addCase(Q5,(t,n)=>{const r=t.controlNets[n.payload.controlNetId];r&&r.controlImage!==null&&t.pendingControlImages.push(n.payload.controlNetId)}),e.addCase(kb,t=>{t.pendingControlImages=[]}),e.addMatcher(vD,t=>{t.pendingControlImages=[]}),e.addMatcher(pe.endpoints.deleteImage.matchFulfilled,(t,n)=>{const{image_name:r}=n.meta.arg.originalArgs;rs(t.controlNets,i=>{i.controlImage===r&&(i.controlImage=null,i.processedControlImage=null),i.processedControlImage===r&&(i.processedControlImage=null)})})}}),{isControlNetEnabledToggled:wIe,controlNetAdded:xIe,controlNetDuplicated:CIe,controlNetAddedFromImage:EIe,controlNetRemoved:Z$,controlNetImageChanged:Qc,controlNetProcessedImageChanged:Y5,controlNetToggled:TIe,controlNetModelChanged:D6,controlNetWeightChanged:AIe,controlNetBeginStepPctChanged:kIe,controlNetEndStepPctChanged:PIe,controlNetControlModeChanged:RIe,controlNetResizeModeChanged:IIe,controlNetProcessorParamsChanged:Ode,controlNetProcessorTypeChanged:Mde,controlNetReset:Nde,controlNetAutoConfigToggled:L6,isIPAdapterEnableToggled:OIe,ipAdapterImageChanged:Pb,ipAdapterWeightChanged:MIe,ipAdapterModelChanged:NIe,ipAdapterBeginStepPctChanged:DIe,ipAdapterEndStepPctChanged:LIe,ipAdapterStateReset:J$}=Y$.actions,Dde=Y$.reducer,Lde={imagesToDelete:[],isModalOpen:!1},eF=nr({name:"deleteImageModal",initialState:Lde,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:Z5,imagesToDeleteSelected:$de,imageDeletionCanceled:$Ie}=eF.actions,Fde=eF.reducer,tF={isEnabled:!1,maxPrompts:100,combinatorial:!0},Bde=tF,nF=nr({name:"dynamicPrompts",initialState:Bde,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=tF.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},isEnabledToggled:e=>{e.isEnabled=!e.isEnabled}}}),{isEnabledToggled:FIe,maxPromptsChanged:BIe,maxPromptsReset:zIe,combinatorialToggled:UIe}=nF.actions,zde=nF.reducer,rF={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},iF=nr({name:"gallery",initialState:rF,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=t.payload},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(jde,(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(pi.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:ha,shouldAutoSwitchChanged:jIe,autoAssignBoardOnClickChanged:VIe,setGalleryImageMinimumWidth:GIe,boardIdSelected:LC,autoAddBoardIdChanged:HIe,galleryViewChanged:h1,selectionChanged:oF,boardSearchTextChanged:qIe}=iF.actions,Ude=iF.reducer,jde=os(pe.endpoints.deleteBoard.matchFulfilled,pe.endpoints.deleteBoardAndImages.matchFulfilled),$6={weight:.75},Vde={loras:{}},sF=nr({name:"lora",initialState:Vde,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,...$6}},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=$6.weight)}}}),{loraAdded:WIe,loraRemoved:aF,loraWeightChanged:KIe,loraWeightReset:XIe,lorasCleared:QIe,loraRecalled:YIe}=sF.actions,Gde=sF.reducer;function as(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,a={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,a),a},Hde=e=>e?F6(e):F6,{useSyncExternalStoreWithSelector:qde}=Rce;function lF(e,t=e.getState,n){const r=qde(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return M.useDebugValue(r),r}const B6=(e,t)=>{const n=Hde(e),r=(i,o=t)=>lF(n,i,o);return Object.assign(r,n),r},Wde=(e,t)=>e?B6(e,t):B6;function yo(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 Rb(){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}})}L0.prototype=Rb.prototype={constructor:L0,on:function(e,t){var n=this._,r=Xde(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),U6.hasOwnProperty(t)?{space:U6[t],local:e}:e}function Yde(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===$C&&t.documentElement.namespaceURI===$C?t.createElement(e):t.createElementNS(n,e)}}function Zde(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function uF(e){var t=Ib(e);return(t.local?Zde:Yde)(t)}function Jde(){}function J5(e){return e==null?Jde:function(){return this.querySelector(e)}}function efe(e){typeof e!="function"&&(e=J5(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=y+1);!(S=b[g])&&++g=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function Efe(e){e||(e=Tfe);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 Afe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function kfe(){return Array.from(this)}function Pfe(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?zfe:typeof t=="function"?jfe:Ufe)(e,t,n??"")):Hf(this.node(),e)}function Hf(e,t){return e.style.getPropertyValue(t)||pF(e).getComputedStyle(e,null).getPropertyValue(t)}function Gfe(e){return function(){delete this[e]}}function Hfe(e,t){return function(){this[e]=t}}function qfe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Wfe(e,t){return arguments.length>1?this.each((t==null?Gfe:typeof t=="function"?qfe:Hfe)(e,t)):this.node()[e]}function gF(e){return e.trim().split(/^|\s+/)}function eT(e){return e.classList||new mF(e)}function mF(e){this._node=e,this._names=gF(e.getAttribute("class")||"")}mF.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 yF(e,t){for(var n=eT(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function She(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function FC(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:s,y:a,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:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}FC.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ihe(e){return!e.ctrlKey&&!e.button}function Ohe(){return this.parentNode}function Mhe(e,t){return t??{x:e.x,y:e.y}}function Nhe(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dhe(){var e=Ihe,t=Ohe,n=Mhe,r=Nhe,i={},o=Rb("start","drag","end"),s=0,a,l,u,c,d=0;function f(v){v.on("mousedown.drag",h).filter(r).on("touchstart.drag",b).on("touchmove.drag",_,Rhe).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 w=g(this,t.call(this,v,S),v,S,"mouse");w&&(Es(v.view).on("mousemove.drag",p,Mg).on("mouseup.drag",m,Mg),SF(v.view),dw(v),u=!1,a=v.clientX,l=v.clientY,w("start",v))}}function p(v){if(pf(v),!u){var S=v.clientX-a,w=v.clientY-l;u=S*S+w*w>d}i.mouse("drag",v)}function m(v){Es(v.view).on("mousemove.drag mouseup.drag",null),wF(v.view,u),pf(v),i.mouse("end",v)}function b(v,S){if(e.call(this,v,S)){var w=v.changedTouches,x=t.call(this,v,S),C=w.length,A,T;for(A=0;A>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?By(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?By(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=$he.exec(e))?new co(t[1],t[2],t[3],1):(t=Fhe.exec(e))?new co(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Bhe.exec(e))?By(t[1],t[2],t[3],t[4]):(t=zhe.exec(e))?By(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Uhe.exec(e))?K6(t[1],t[2]/100,t[3]/100,1):(t=jhe.exec(e))?K6(t[1],t[2]/100,t[3]/100,t[4]):j6.hasOwnProperty(e)?H6(j6[e]):e==="transparent"?new co(NaN,NaN,NaN,0):null}function H6(e){return new co(e>>16&255,e>>8&255,e&255,1)}function By(e,t,n,r){return r<=0&&(e=t=n=NaN),new co(e,t,n,r)}function Hhe(e){return e instanceof Lm||(e=Lg(e)),e?(e=e.rgb(),new co(e.r,e.g,e.b,e.opacity)):new co}function BC(e,t,n,r){return arguments.length===1?Hhe(e):new co(e,t,n,r??1)}function co(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}tT(co,BC,xF(Lm,{brighter(e){return e=e==null?g1:Math.pow(g1,e),new co(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ng:Math.pow(Ng,e),new co(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new co(wc(this.r),wc(this.g),wc(this.b),m1(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:q6,formatHex:q6,formatHex8:qhe,formatRgb:W6,toString:W6}));function q6(){return`#${fc(this.r)}${fc(this.g)}${fc(this.b)}`}function qhe(){return`#${fc(this.r)}${fc(this.g)}${fc(this.b)}${fc((isNaN(this.opacity)?1:this.opacity)*255)}`}function W6(){const e=m1(this.opacity);return`${e===1?"rgb(":"rgba("}${wc(this.r)}, ${wc(this.g)}, ${wc(this.b)}${e===1?")":`, ${e})`}`}function m1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function fc(e){return e=wc(e),(e<16?"0":"")+e.toString(16)}function K6(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 CF(e){if(e instanceof Ts)return new Ts(e.h,e.s,e.l,e.opacity);if(e instanceof Lm||(e=Lg(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),s=NaN,a=o-i,l=(o+i)/2;return a?(t===o?s=(n-r)/a+(n0&&l<1?0:s,new Ts(s,a,l,e.opacity)}function Whe(e,t,n,r){return arguments.length===1?CF(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}tT(Ts,Whe,xF(Lm,{brighter(e){return e=e==null?g1:Math.pow(g1,e),new Ts(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ng:Math.pow(Ng,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 co(fw(e>=240?e-240:e+120,i,r),fw(e,i,r),fw(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ts(X6(this.h),zy(this.s),zy(this.l),m1(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=m1(this.opacity);return`${e===1?"hsl(":"hsla("}${X6(this.h)}, ${zy(this.s)*100}%, ${zy(this.l)*100}%${e===1?")":`, ${e})`}`}}));function X6(e){return e=(e||0)%360,e<0?e+360:e}function zy(e){return Math.max(0,Math.min(1,e||0))}function fw(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 EF=e=>()=>e;function Khe(e,t){return function(n){return e+n*t}}function Xhe(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 Qhe(e){return(e=+e)==1?TF:function(t,n){return n-t?Xhe(t,n,e):EF(isNaN(t)?n:t)}}function TF(e,t){var n=t-e;return n?Khe(e,n):EF(isNaN(e)?t:e)}const Q6=function e(t){var n=Qhe(t);function r(i,o){var s=n((i=BC(i)).r,(o=BC(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),u=TF(i.opacity,o.opacity);return function(c){return i.r=s(c),i.g=a(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function Il(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var zC=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hw=new RegExp(zC.source,"g");function Yhe(e){return function(){return e}}function Zhe(e){return function(t){return e(t)+""}}function Jhe(e,t){var n=zC.lastIndex=hw.lastIndex=0,r,i,o,s=-1,a=[],l=[];for(e=e+"",t=t+"";(r=zC.exec(e))&&(i=hw.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Il(r,i)})),n=hw.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:Il(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function a(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:Il(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:Il(u,d)},{i:m-2,x:Il(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),s(u.rotate,c.rotate,d,f),a(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,b;++p=0&&e._call.call(void 0,t),e=e._next;--qf}function J6(){Lc=(v1=$g.now())+Ob,qf=op=0;try{upe()}finally{qf=0,dpe(),Lc=0}}function cpe(){var e=$g.now(),t=e-v1;t>PF&&(Ob-=t,v1=e)}function dpe(){for(var e,t=y1,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:y1=n);sp=e,jC(r)}function jC(e){if(!qf){op&&(op=clearTimeout(op));var t=e-Lc;t>24?(e<1/0&&(op=setTimeout(J6,e-$g.now()-Ob)),Fh&&(Fh=clearInterval(Fh))):(Fh||(v1=$g.now(),Fh=setInterval(cpe,PF)),qf=1,RF(J6))}}function e8(e,t,n){var r=new _1;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var fpe=Rb("start","end","cancel","interrupt"),hpe=[],OF=0,t8=1,VC=2,$0=3,n8=4,GC=5,F0=6;function Mb(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ppe(e,n,{name:t,index:r,group:i,on:fpe,tween:hpe,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:OF})}function rT(e,t){var n=Us(e,t);if(n.state>OF)throw new Error("too late; already scheduled");return n}function xa(e,t){var n=Us(e,t);if(n.state>$0)throw new Error("too late; already running");return n}function Us(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ppe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=IF(o,0,n.time);function o(u){n.state=t8,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var c,d,f,h;if(n.state!==t8)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===$0)return e8(s);h.state===n8?(h.state=F0,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cVC&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Gpe(e,t,n){var r,i,o=Vpe(t)?rT:xa;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Hpe(e,t){var n=this._id;return arguments.length<2?Us(this.node(),n).on.on(e):this.each(Gpe(n,e,t))}function qpe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Wpe(){return this.on("end.remove",qpe(this._id))}function Kpe(e){var t=this._name,n=this._id;typeof e!="function"&&(e=J5(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s()=>e;function _ge(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 Wa(e,t,n){this.k=e,this.x=t,this.y=n}Wa.prototype={constructor:Wa,scale:function(e){return e===1?this:new Wa(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Wa(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 ou=new Wa(1,0,0);Wa.prototype;function pw(e){e.stopImmediatePropagation()}function Bh(e){e.preventDefault(),e.stopImmediatePropagation()}function bge(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Sge(){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 r8(){return this.__zoom||ou}function wge(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function xge(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cge(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function Ege(){var e=bge,t=Sge,n=Cge,r=wge,i=xge,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=ape,u=Rb("start","zoom","end"),c,d,f,h=500,p=150,m=0,b=10;function _(E){E.property("__zoom",r8).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",T).filter(i).on("touchstart.zoom",k).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(E,P,D,B){var R=E.selection?E.selection():E;R.property("__zoom",r8),E!==R?S(E,P,D,B):R.interrupt().each(function(){w(this,arguments).event(B).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},_.scaleBy=function(E,P,D,B){_.scaleTo(E,function(){var R=this.__zoom.k,I=typeof P=="function"?P.apply(this,arguments):P;return R*I},D,B)},_.scaleTo=function(E,P,D,B){_.transform(E,function(){var R=t.apply(this,arguments),I=this.__zoom,O=D==null?v(R):typeof D=="function"?D.apply(this,arguments):D,F=I.invert(O),U=typeof P=="function"?P.apply(this,arguments):P;return n(g(y(I,U),O,F),R,s)},D,B)},_.translateBy=function(E,P,D,B){_.transform(E,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),s)},null,B)},_.translateTo=function(E,P,D,B,R){_.transform(E,function(){var I=t.apply(this,arguments),O=this.__zoom,F=B==null?v(I):typeof B=="function"?B.apply(this,arguments):B;return n(ou.translate(F[0],F[1]).scale(O.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof D=="function"?-D.apply(this,arguments):-D),I,s)},B,R)};function y(E,P){return P=Math.max(o[0],Math.min(o[1],P)),P===E.k?E:new Wa(P,E.x,E.y)}function g(E,P,D){var B=P[0]-D[0]*E.k,R=P[1]-D[1]*E.k;return B===E.x&&R===E.y?E:new Wa(E.k,B,R)}function v(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function S(E,P,D,B){E.on("start.zoom",function(){w(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(B).end()}).tween("zoom",function(){var R=this,I=arguments,O=w(R,I).event(B),F=t.apply(R,I),U=D==null?v(F):typeof D=="function"?D.apply(R,I):D,V=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),H=R.__zoom,Y=typeof P=="function"?P.apply(R,I):P,Q=l(H.invert(U).concat(V/H.k),Y.invert(U).concat(V/Y.k));return function(j){if(j===1)j=Y;else{var K=Q(j),te=V/K[2];j=new Wa(te,U[0]-K[0]*te,U[1]-K[1]*te)}O.zoom(null,j)}})}function w(E,P,D){return!D&&E.__zooming||new x(E,P)}function x(E,P){this.that=E,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,P),this.taps=0}x.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,P){return this.mouse&&E!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&E!=="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(E){var P=Es(this.that).datum();u.call(E,this.that,new _ge(E,{sourceEvent:this.sourceEvent,target:_,type:E,transform:this.that.__zoom,dispatch:u}),P)}};function C(E,...P){if(!e.apply(this,arguments))return;var D=w(this,P).event(E),B=this.__zoom,R=Math.max(o[0],Math.min(o[1],B.k*Math.pow(2,r.apply(this,arguments)))),I=Ys(E);if(D.wheel)(D.mouse[0][0]!==I[0]||D.mouse[0][1]!==I[1])&&(D.mouse[1]=B.invert(D.mouse[0]=I)),clearTimeout(D.wheel);else{if(B.k===R)return;D.mouse=[I,B.invert(I)],B0(this),D.start()}Bh(E),D.wheel=setTimeout(O,p),D.zoom("mouse",n(g(y(B,R),D.mouse[0],D.mouse[1]),D.extent,s));function O(){D.wheel=null,D.end()}}function A(E,...P){if(f||!e.apply(this,arguments))return;var D=E.currentTarget,B=w(this,P,!0).event(E),R=Es(E.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",V,!0),I=Ys(E,D),O=E.clientX,F=E.clientY;SF(E.view),pw(E),B.mouse=[I,this.__zoom.invert(I)],B0(this),B.start();function U(H){if(Bh(H),!B.moved){var Y=H.clientX-O,Q=H.clientY-F;B.moved=Y*Y+Q*Q>m}B.event(H).zoom("mouse",n(g(B.that.__zoom,B.mouse[0]=Ys(H,D),B.mouse[1]),B.extent,s))}function V(H){R.on("mousemove.zoom mouseup.zoom",null),wF(H.view,B.moved),Bh(H),B.event(H).end()}}function T(E,...P){if(e.apply(this,arguments)){var D=this.__zoom,B=Ys(E.changedTouches?E.changedTouches[0]:E,this),R=D.invert(B),I=D.k*(E.shiftKey?.5:2),O=n(g(y(D,I),B,R),t.apply(this,P),s);Bh(E),a>0?Es(this).transition().duration(a).call(S,O,B,E):Es(this).call(_.transform,O,B,E)}}function k(E,...P){if(e.apply(this,arguments)){var D=E.touches,B=D.length,R=w(this,P,E.changedTouches.length===B).event(E),I,O,F,U;for(pw(E),O=0;O"[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.`},LF=ul.error001();function hr(e,t){const n=M.useContext(Nb);if(n===null)throw new Error(LF);return lF(n,e,t)}const oi=()=>{const e=M.useContext(Nb);if(e===null)throw new Error(LF);return M.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Age=e=>e.userSelectionActive?"none":"all";function kge({position:e,children:t,className:n,style:r,...i}){const o=hr(Age),s=`${e}`.split("-");return Z.jsx("div",{className:as(["react-flow__panel",n,...s]),style:{...r,pointerEvents:o},...i,children:t})}function Pge({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:Z.jsx(kge,{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:Z.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Rge=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:u,...c})=>{const d=M.useRef(null),[f,h]=M.useState({x:0,y:0,width:0,height:0}),p=as(["react-flow__edge-textwrapper",u]);return M.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:Z.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&Z.jsx("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),Z.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var Ige=M.memo(Rge);const oT=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),sT=(e={x:0,y:0},t)=>({x:Wf(e.x,t[0][0],t[1][0]),y:Wf(e.y,t[0][1],t[1][1])}),i8=(e,t,n)=>en?-Wf(Math.abs(e-n),1,50)/50:0,$F=(e,t)=>{const n=i8(e.x,35,t.width-35)*20,r=i8(e.y,35,t.height-35)*20;return[n,r]},FF=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},BF=(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)}),Fg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),zF=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),o8=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),ZIe=(e,t)=>zF(BF(Fg(e),Fg(t))),HC=(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)},Oge=e=>Zo(e.width)&&Zo(e.height)&&Zo(e.x)&&Zo(e.y),Zo=e=>!isNaN(e)&&isFinite(e),Ur=Symbol.for("internals"),UF=["Enter"," ","Escape"],Mge=(e,t)=>{},Nge=e=>"nativeEvent"in e;function qC(e){var i,o;const t=Nge(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 jF=e=>"clientX"in e,su=(e,t)=>{var o,s;const n=jF(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},b1=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},$m=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>Z.jsxs(Z.Fragment,{children:[Z.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&Z.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Zo(n)&&Zo(r)?Z.jsx(Ige,{x:n,y:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]});$m.displayName="BaseEdge";function zh(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function VF({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[b,_,y]=HF({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return Z.jsx($m,{path:b,labelX:_,labelY:y,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});aT.displayName="SimpleBezierEdge";const a8={[Je.Left]:{x:-1,y:0},[Je.Right]:{x:1,y:0},[Je.Top]:{x:0,y:-1},[Je.Bottom]:{x:0,y:1}},Dge=({source:e,sourcePosition:t=Je.Bottom,target:n})=>t===Je.Left||t===Je.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Lge({source:e,sourcePosition:t=Je.Bottom,target:n,targetPosition:r=Je.Top,center:i,offset:o}){const s=a8[t],a=a8[r],l={x:e.x+s.x*o,y:e.y+s.y*o},u={x:n.x+a.x*o,y:n.y+a.y*o},c=Dge({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const b={x:0,y:0},_={x:0,y:0},[y,g,v,S]=VF({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){p=i.x||y,m=i.y||g;const x=[{x:p,y:l.y},{x:p,y:u.y}],C=[{x:l.x,y:m},{x:u.x,y:m}];s[d]===f?h=d==="x"?x:C:h=d==="x"?C:x}else{const x=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?h=s.x===f?C:x:h=s.y===f?x:C,t===r){const N=Math.abs(e[d]-n[d]);if(N<=o){const E=Math.min(o-1,o-N);s[d]===f?b[d]=(l[d]>e[d]?-1:1)*E:_[d]=(u[d]>n[d]?-1:1)*E}}if(t!==r){const N=d==="x"?"y":"x",E=s[d]===a[N],P=l[N]>u[N],D=l[N]=L?(p=(A.x+T.x)/2,m=h[0].y):(p=h[0].x,m=(A.y+T.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...h,{x:u.x+_.x,y:u.y+_.y},n],p,m,v,S]}function $ge(e,t,n,r){const i=Math.min(l8(e,t)/2,l8(t,n)/2,r),{x:o,y:s}=t;if(e.x===o&&o===n.x||e.y===s&&s===n.y)return`L${o} ${s}`;if(e.y===s){const u=e.x{let g="";return y>0&&y{const[_,y,g]=WC({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 Z.jsx($m,{path:_,labelX:y,labelY:g,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:b})});Db.displayName="SmoothStepEdge";const lT=M.memo(e=>{var t;return Z.jsx(Db,{...e,pathOptions:M.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});lT.displayName="StepEdge";function Fge({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,s,a]=VF({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,s,a]}const uT=M.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,b]=Fge({sourceX:e,sourceY:t,targetX:n,targetY:r});return Z.jsx($m,{path:p,labelX:m,labelY:b,label:i,labelStyle:o,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});uT.displayName="StraightEdge";function Vy(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function u8({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Je.Left:return[t-Vy(t-r,o),n];case Je.Right:return[t+Vy(r-t,o),n];case Je.Top:return[t,n-Vy(n-i,o)];case Je.Bottom:return[t,n+Vy(i-n,o)]}}function qF({sourceX:e,sourceY:t,sourcePosition:n=Je.Bottom,targetX:r,targetY:i,targetPosition:o=Je.Top,curvature:s=.25}){const[a,l]=u8({pos:n,x1:e,y1:t,x2:r,y2:i,c:s}),[u,c]=u8({pos:o,x1:r,y1:i,x2:e,y2:t,c:s}),[d,f,h,p]=GF({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${a},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const w1=M.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=Je.Bottom,targetPosition:o=Je.Top,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:b})=>{const[_,y,g]=qF({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return Z.jsx($m,{path:_,labelX:y,labelY:g,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:b})});w1.displayName="BezierEdge";const cT=M.createContext(null),Bge=cT.Provider;cT.Consumer;const zge=()=>M.useContext(cT),Uge=e=>"id"in e&&"source"in e&&"target"in e,WF=e=>"id"in e&&!("source"in e)&&!("target"in e),jge=(e,t,n)=>{if(!WF(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},Vge=(e,t,n)=>{if(!WF(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},Gge=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,KC=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,Hge=(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)),KF=(e,t)=>{if(!e.source||!e.target)return t;let n;return Uge(e)?n={...e}:n={...e,id:Gge(e)},Hge(n,t)?t:t.concat(n)},XF=({x:e,y:t},[n,r,i],o,[s,a])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:s*Math.round(l.x/s),y:a*Math.round(l.y/a)}:l},qge=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),mf=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},dT=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:s}=mf(i,t).positionAbsolute;return BF(r,Fg({x:o,y:s,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zF(n)},QF=(e,t,[n,r,i]=[0,0,1],o=!1,s=!1,a=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(s&&!h||p)return!1;const{positionAbsolute:m}=mf(c,a),b={x:m.x,y:m.y,width:d||0,height:f||0},_=HC(l,b),y=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&_>0,v=(d||0)*(f||0);(y||g||_>=v||c.dragging)&&u.push(c)}),u},fT=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},YF=(e,t,n,r,i,o=.1)=>{const s=t/(e.width*(1+o)),a=n/(e.height*(1+o)),l=Math.min(s,a),u=Wf(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]},Ju=(e,t=0)=>e.transition().duration(t);function c8(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var s,a;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((s=e.positionAbsolute)==null?void 0:s.x)??0)+o.x+o.width/2,y:(((a=e.positionAbsolute)==null?void 0:a.y)??0)+o.y+o.height/2}),i},[])}function Wge(e,t,n,r,i,o){const{x:s,y:a}=su(e),u=t.elementsFromPoint(s,a).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=hT(void 0,u),b=u.getAttribute("data-handleid"),_=o({nodeId:p,id:b,type:m});if(_)return{handle:{id:b,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:_}}}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 b=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 Kge={source:null,target:null,sourceHandle:null,targetHandle:null},ZF=()=>({handleDomNode:null,isValid:!1,connection:Kge,endHandle:null});function JF(e,t,n,r,i,o,s){const a=i==="target",l=s.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...ZF(),handleDomNode:l};if(l){const c=hT(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:a?d:n,sourceHandle:a?f:r,target:a?n:d,targetHandle:a?r:f};u.connection=m,h&&p&&(t===$c.Strict?a&&c==="source"||!a&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function Xge({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Ur]){const{handleBounds:s}=o[Ur];let a=[],l=[];s&&(a=c8(o,s,"source",`${t}-${n}-${r}`),l=c8(o,s,"target",`${t}-${n}-${r}`)),i.push(...a,...l)}return i},[])}function hT(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function gw(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Qge(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function eB({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:s,isValidConnection:a,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=FF(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:b,getNodes:_,cancelConnection:y}=o();let g=0,v;const{x:S,y:w}=su(e),x=c==null?void 0:c.elementFromPoint(S,w),C=hT(l,x),A=f==null?void 0:f.getBoundingClientRect();if(!A||!C)return;let T,k=su(e,A),L=!1,N=null,E=!1,P=null;const D=Xge({nodes:_(),nodeId:n,handleId:t,handleType:C}),B=()=>{if(!h)return;const[O,F]=$F(k,A);b({x:O,y:F}),g=requestAnimationFrame(B)};s({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 R(O){const{transform:F}=o();k=su(O,A);const{handle:U,validHandleResult:V}=Wge(O,c,XF(k,F,!1,[1,1]),p,D,H=>JF(H,d,n,t,i?"target":"source",a,c));if(v=U,L||(B(),L=!0),P=V.handleDomNode,N=V.connection,E=V.isValid,s({connectionPosition:v&&E?qge({x:v.x,y:v.y},F):k,connectionStatus:Qge(!!v,E),connectionEndHandle:V.endHandle}),!v&&!E&&!P)return gw(T);N.source!==N.target&&P&&(gw(T),T=P,P.classList.add("connecting","react-flow__handle-connecting"),P.classList.toggle("valid",E),P.classList.toggle("react-flow__handle-valid",E))}function I(O){var F,U;(v||P)&&N&&E&&(r==null||r(N)),(U=(F=o()).onConnectEnd)==null||U.call(F,O),l&&(u==null||u(O)),gw(T),y(),cancelAnimationFrame(g),L=!1,E=!1,N=null,P=null,c.removeEventListener("mousemove",R),c.removeEventListener("mouseup",I),c.removeEventListener("touchmove",R),c.removeEventListener("touchend",I)}c.addEventListener("mousemove",R),c.addEventListener("mouseup",I),c.addEventListener("touchmove",R),c.addEventListener("touchend",I)}const d8=()=>!0,Yge=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Zge=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:s}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n}},tB=M.forwardRef(({type:e="source",position:t=Je.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:s,onConnect:a,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var A,T;const p=s||null,m=e==="target",b=oi(),_=zge(),{connectOnClick:y,noPanClassName:g}=hr(Yge,yo),{connecting:v,clickConnecting:S}=hr(Zge(_,p,e),yo);_||(T=(A=b.getState()).onError)==null||T.call(A,"010",ul.error010());const w=k=>{const{defaultEdgeOptions:L,onConnect:N,hasDefaultEdges:E}=b.getState(),P={...L,...k};if(E){const{edges:D,setEdges:B}=b.getState();B(KF(P,D))}N==null||N(P),a==null||a(P)},x=k=>{if(!_)return;const L=jF(k);i&&(L&&k.button===0||!L)&&eB({event:k,handleId:p,nodeId:_,onConnect:w,isTarget:m,getState:b.getState,setState:b.setState,isValidConnection:n||b.getState().isValidConnection||d8}),L?c==null||c(k):d==null||d(k)},C=k=>{const{onClickConnectStart:L,onClickConnectEnd:N,connectionClickStartHandle:E,connectionMode:P,isValidConnection:D}=b.getState();if(!_||!E&&!i)return;if(!E){L==null||L(k,{nodeId:_,handleId:p,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:p}});return}const B=FF(k.target),R=n||D||d8,{connection:I,isValid:O}=JF({nodeId:_,id:p,type:e},P,E.nodeId,E.handleId||null,E.type,R,B);O&&w(I),N==null||N(k),b.setState({connectionClickStartHandle:null})};return Z.jsx("div",{"data-handleid":p,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${p}-${e}`,className:as(["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:x,onTouchStart:x,onClick:y?C:void 0,ref:h,...f,children:l})});tB.displayName="Handle";var x1=M.memo(tB);const nB=({data:e,isConnectable:t,targetPosition:n=Je.Top,sourcePosition:r=Je.Bottom})=>Z.jsxs(Z.Fragment,{children:[Z.jsx(x1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,Z.jsx(x1,{type:"source",position:r,isConnectable:t})]});nB.displayName="DefaultNode";var XC=M.memo(nB);const rB=({data:e,isConnectable:t,sourcePosition:n=Je.Bottom})=>Z.jsxs(Z.Fragment,{children:[e==null?void 0:e.label,Z.jsx(x1,{type:"source",position:n,isConnectable:t})]});rB.displayName="InputNode";var iB=M.memo(rB);const oB=({data:e,isConnectable:t,targetPosition:n=Je.Top})=>Z.jsxs(Z.Fragment,{children:[Z.jsx(x1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});oB.displayName="OutputNode";var sB=M.memo(oB);const pT=()=>null;pT.displayName="GroupNode";const Jge=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),Gy=e=>e.id;function eme(e,t){return yo(e.selectedNodes.map(Gy),t.selectedNodes.map(Gy))&&yo(e.selectedEdges.map(Gy),t.selectedEdges.map(Gy))}const aB=M.memo(({onSelectionChange:e})=>{const t=oi(),{selectedNodes:n,selectedEdges:r}=hr(Jge,eme);return M.useEffect(()=>{var o,s;const i={nodes:n,edges:r};e==null||e(i),(s=(o=t.getState()).onSelectionChange)==null||s.call(o,i)},[n,r,e]),null});aB.displayName="SelectionListener";const tme=e=>!!e.onSelectionChange;function nme({onSelectionChange:e}){const t=hr(tme);return e||t?Z.jsx(aB,{onSelectionChange:e}):null}const rme=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 _d(e,t){M.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function kt(e,t,n){M.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const ime=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:s,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:b,nodeExtent:_,onNodesChange:y,onEdgesChange:g,elementsSelectable:v,connectionMode:S,snapGrid:w,snapToGrid:x,translateExtent:C,connectOnClick:A,defaultEdgeOptions:T,fitView:k,fitViewOptions:L,onNodesDelete:N,onEdgesDelete:E,onNodeDrag:P,onNodeDragStart:D,onNodeDragStop:B,onSelectionDrag:R,onSelectionDragStart:I,onSelectionDragStop:O,noPanClassName:F,nodeOrigin:U,rfId:V,autoPanOnConnect:H,autoPanOnNodeDrag:Y,onError:Q,connectionRadius:j,isValidConnection:K})=>{const{setNodes:te,setEdges:oe,setDefaultNodesAndEdges:me,setMinZoom:le,setMaxZoom:ht,setTranslateExtent:nt,setNodeExtent:$e,reset:ct}=hr(rme,yo),Pe=oi();return M.useEffect(()=>{const qt=r==null?void 0:r.map(Sr=>({...Sr,...T}));return me(n,qt),()=>{ct()}},[]),kt("defaultEdgeOptions",T,Pe.setState),kt("connectionMode",S,Pe.setState),kt("onConnect",i,Pe.setState),kt("onConnectStart",o,Pe.setState),kt("onConnectEnd",s,Pe.setState),kt("onClickConnectStart",a,Pe.setState),kt("onClickConnectEnd",l,Pe.setState),kt("nodesDraggable",u,Pe.setState),kt("nodesConnectable",c,Pe.setState),kt("nodesFocusable",d,Pe.setState),kt("edgesFocusable",f,Pe.setState),kt("edgesUpdatable",h,Pe.setState),kt("elementsSelectable",v,Pe.setState),kt("elevateNodesOnSelect",p,Pe.setState),kt("snapToGrid",x,Pe.setState),kt("snapGrid",w,Pe.setState),kt("onNodesChange",y,Pe.setState),kt("onEdgesChange",g,Pe.setState),kt("connectOnClick",A,Pe.setState),kt("fitViewOnInit",k,Pe.setState),kt("fitViewOnInitOptions",L,Pe.setState),kt("onNodesDelete",N,Pe.setState),kt("onEdgesDelete",E,Pe.setState),kt("onNodeDrag",P,Pe.setState),kt("onNodeDragStart",D,Pe.setState),kt("onNodeDragStop",B,Pe.setState),kt("onSelectionDrag",R,Pe.setState),kt("onSelectionDragStart",I,Pe.setState),kt("onSelectionDragStop",O,Pe.setState),kt("noPanClassName",F,Pe.setState),kt("nodeOrigin",U,Pe.setState),kt("rfId",V,Pe.setState),kt("autoPanOnConnect",H,Pe.setState),kt("autoPanOnNodeDrag",Y,Pe.setState),kt("onError",Q,Pe.setState),kt("connectionRadius",j,Pe.setState),kt("isValidConnection",K,Pe.setState),_d(e,te),_d(t,oe),_d(m,le),_d(b,ht),_d(C,nt),_d(_,$e),null},f8={display:"none"},ome={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},lB="react-flow__node-desc",uB="react-flow__edge-desc",sme="react-flow__aria-live",ame=e=>e.ariaLiveMessage;function lme({rfId:e}){const t=hr(ame);return Z.jsx("div",{id:`${sme}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ome,children:t})}function ume({rfId:e,disableKeyboardA11y:t}){return Z.jsxs(Z.Fragment,{children:[Z.jsxs("div",{id:`${lB}-${e}`,style:f8,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."," "]}),Z.jsx("div",{id:`${uB}-${e}`,style:f8,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&Z.jsx(lme,{rfId:e})]})}const cme=typeof document<"u"?document:null;var Bg=(e=null,t={target:cme})=>{const[n,r]=M.useState(!1),i=M.useRef(!1),o=M.useRef(new Set([])),[s,a]=M.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 M.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&qC(h))return!1;const p=p8(h.code,a);o.current.add(h[p]),h8(s,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&qC(h))return!1;const p=p8(h.code,a);h8(s,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 h8(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function p8(e,t){return t.includes(e)?"code":"key"}function cB(e,t,n,r){var s,a;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=mf(i,r);return cB(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((s=i[Ur])==null?void 0:s.z)??0)>(n.z??0)?((a=i[Ur])==null?void 0:a.z)??0:n.z??0},r)}function dB(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:s,z:a}=cB(r,e,{...r.position,z:((i=r[Ur])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:s},r[Ur].z=a,n!=null&&n[r.id]&&(r[Ur].isParent=!0)}})}function mw(e,t,n,r){const i=new Map,o={},s=r?1e3:0;return e.forEach(a=>{var d;const l=(Zo(a.zIndex)?a.zIndex:0)+(a.selected?s:0),u=t.get(a.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...a,positionAbsolute:{x:a.position.x,y:a.position.y}};a.parentNode&&(c.parentNode=a.parentNode,o[a.parentNode]=!0),Object.defineProperty(c,Ur,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Ur])==null?void 0:d.handleBounds,z:l}}),i.set(a.id,c)}),dB(i,n,o),i}function fB(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:s,d3Zoom:a,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(a&&l&&(f||!t.initial)){const p=n().filter(b=>{var y;const _=t.includeHiddenNodes?b.width&&b.height:!b.hidden;return(y=t.nodes)!=null&&y.length?_&&t.nodes.some(g=>g.id===b.id):_}),m=p.every(b=>b.width&&b.height);if(p.length>0&&m){const b=dT(p,d),[_,y,g]=YF(b,r,i,t.minZoom??o,t.maxZoom??s,t.padding??.1),v=ou.translate(_,y).scale(g);return typeof t.duration=="number"&&t.duration>0?a.transform(Ju(l,t.duration),v):a.transform(l,v),!0}}return!1}function dme(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Ur]:r[Ur],selected:n.selected})}),new Map(t)}function fme(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function Hy({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:s,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:dme(e,i)}),s==null||s(e)),t!=null&&t.length&&(u&&r({edges:fme(t,o)}),a==null||a(t))}const bd=()=>{},hme={zoomIn:bd,zoomOut:bd,zoomTo:bd,getZoom:()=>1,setViewport:bd,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:bd,fitBounds:bd,project:e=>e,viewportInitialized:!1},pme=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),gme=()=>{const e=oi(),{d3Zoom:t,d3Selection:n}=hr(pme,yo);return M.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(Ju(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(Ju(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(Ju(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[s,a,l]=e.getState().transform,u=ou.translate(i.x??s,i.y??a).scale(i.zoom??l);t.transform(Ju(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,s]=e.getState().transform;return{x:i,y:o,zoom:s}},fitView:i=>fB(e.getState,i),setCenter:(i,o,s)=>{const{width:a,height:l,maxZoom:u}=e.getState(),c=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:u,d=a/2-i*c,f=l/2-o*c,h=ou.translate(d,f).scale(c);t.transform(Ju(n,s==null?void 0:s.duration),h)},fitBounds:(i,o)=>{const{width:s,height:a,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=YF(i,s,a,l,u,(o==null?void 0:o.padding)??.1),h=ou.translate(c,d).scale(f);t.transform(Ju(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:s,snapGrid:a}=e.getState();return XF(i,o,s,a)},viewportInitialized:!0}:hme,[t,n])};function hB(){const e=gme(),t=oi(),n=M.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=M.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=M.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(b=>({...b}))},[]),o=M.useCallback(m=>{const{edges:b=[]}=t.getState();return b.find(_=>_.id===m)},[]),s=M.useCallback(m=>{const{getNodes:b,setNodes:_,hasDefaultNodes:y,onNodesChange:g}=t.getState(),v=b(),S=typeof m=="function"?m(v):m;if(y)_(S);else if(g){const w=S.length===0?v.map(x=>({type:"remove",id:x.id})):S.map(x=>({item:x,type:"reset"}));g(w)}},[]),a=M.useCallback(m=>{const{edges:b=[],setEdges:_,hasDefaultEdges:y,onEdgesChange:g}=t.getState(),v=typeof m=="function"?m(b):m;if(y)_(v);else if(g){const S=v.length===0?b.map(w=>({type:"remove",id:w.id})):v.map(w=>({item:w,type:"reset"}));g(S)}},[]),l=M.useCallback(m=>{const b=Array.isArray(m)?m:[m],{getNodes:_,setNodes:y,hasDefaultNodes:g,onNodesChange:v}=t.getState();if(g){const w=[..._(),...b];y(w)}else if(v){const S=b.map(w=>({item:w,type:"add"}));v(S)}},[]),u=M.useCallback(m=>{const b=Array.isArray(m)?m:[m],{edges:_=[],setEdges:y,hasDefaultEdges:g,onEdgesChange:v}=t.getState();if(g)y([..._,...b]);else if(v){const S=b.map(w=>({item:w,type:"add"}));v(S)}},[]),c=M.useCallback(()=>{const{getNodes:m,edges:b=[],transform:_}=t.getState(),[y,g,v]=_;return{nodes:m().map(S=>({...S})),edges:b.map(S=>({...S})),viewport:{x:y,y:g,zoom:v}}},[]),d=M.useCallback(({nodes:m,edges:b})=>{const{nodeInternals:_,getNodes:y,edges:g,hasDefaultNodes:v,hasDefaultEdges:S,onNodesDelete:w,onEdgesDelete:x,onNodesChange:C,onEdgesChange:A}=t.getState(),T=(m||[]).map(P=>P.id),k=(b||[]).map(P=>P.id),L=y().reduce((P,D)=>{const B=!T.includes(D.id)&&D.parentNode&&P.find(I=>I.id===D.parentNode);return(typeof D.deletable=="boolean"?D.deletable:!0)&&(T.includes(D.id)||B)&&P.push(D),P},[]),N=g.filter(P=>typeof P.deletable=="boolean"?P.deletable:!0),E=N.filter(P=>k.includes(P.id));if(L||E){const P=fT(L,N),D=[...E,...P],B=D.reduce((R,I)=>(R.includes(I.id)||R.push(I.id),R),[]);if((S||v)&&(S&&t.setState({edges:g.filter(R=>!B.includes(R.id))}),v&&(L.forEach(R=>{_.delete(R.id)}),t.setState({nodeInternals:new Map(_)}))),B.length>0&&(x==null||x(D),A&&A(B.map(R=>({id:R,type:"remove"})))),L.length>0&&(w==null||w(L),C)){const R=L.map(I=>({id:I.id,type:"remove"}));C(R)}}},[]),f=M.useCallback(m=>{const b=Oge(m),_=b?null:t.getState().nodeInternals.get(m.id);return[b?m:o8(_),_,b]},[]),h=M.useCallback((m,b=!0,_)=>{const[y,g,v]=f(m);return y?(_||t.getState().getNodes()).filter(S=>{if(!v&&(S.id===g.id||!S.positionAbsolute))return!1;const w=o8(S),x=HC(w,y);return b&&x>0||x>=m.width*m.height}):[]},[]),p=M.useCallback((m,b,_=!0)=>{const[y]=f(m);if(!y)return!1;const g=HC(y,b);return _&&g>0||g>=m.width*m.height},[]);return M.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:s,setEdges:a,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,s,a,l,u,c,d,h,p])}var mme=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=oi(),{deleteElements:r}=hB(),i=Bg(e),o=Bg(t);M.useEffect(()=>{if(i){const{edges:s,getNodes:a}=n.getState(),l=a().filter(c=>c.selected),u=s.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),M.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function yme(e){const t=oi();M.useEffect(()=>{let n;const r=()=>{var o,s;if(!e.current)return;const i=oT(e.current);(i.height===0||i.width===0)&&((s=(o=t.getState()).onError)==null||s.call(o,"004",ul.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 gT={position:"absolute",width:"100%",height:"100%",top:0,left:0},vme=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,qy=e=>({x:e.x,y:e.y,zoom:e.k}),Sd=(e,t)=>e.target.closest(`.${t}`),g8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),m8=e=>{const t=e.ctrlKey&&b1()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},_me=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),bme=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=hc.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:b,preventScrolling:_=!0,children:y,noWheelClassName:g,noPanClassName:v})=>{const S=M.useRef(),w=oi(),x=M.useRef(!1),C=M.useRef(!1),A=M.useRef(null),T=M.useRef({x:0,y:0,zoom:0}),{d3Zoom:k,d3Selection:L,d3ZoomHandler:N,userSelectionActive:E}=hr(_me,yo),P=Bg(b),D=M.useRef(0),B=M.useRef(!1),R=M.useRef();return yme(A),M.useEffect(()=>{if(A.current){const I=A.current.getBoundingClientRect(),O=Ege().scaleExtent([p,m]).translateExtent(h),F=Es(A.current).call(O),U=ou.translate(f.x,f.y).scale(Wf(f.zoom,p,m)),V=[[0,0],[I.width,I.height]],H=O.constrain()(U,V,h);O.transform(F,H),O.wheelDelta(m8),w.setState({d3Zoom:O,d3Selection:F,d3ZoomHandler:F.on("wheel.zoom"),transform:[H.x,H.y,H.k],domNode:A.current.closest(".react-flow")})}},[]),M.useEffect(()=>{L&&k&&(s&&!P&&!E?L.on("wheel.zoom",I=>{if(Sd(I,g))return!1;I.preventDefault(),I.stopImmediatePropagation();const O=L.property("__zoom").k||1,F=b1();if(I.ctrlKey&&o&&F){const te=Ys(I),oe=m8(I),me=O*Math.pow(2,oe);k.scaleTo(L,me,te,I);return}const U=I.deltaMode===1?20:1;let V=l===hc.Vertical?0:I.deltaX*U,H=l===hc.Horizontal?0:I.deltaY*U;!F&&I.shiftKey&&l!==hc.Vertical&&(V=I.deltaY*U,H=0),k.translateBy(L,-(V/O)*a,-(H/O)*a,{internal:!0});const Y=qy(L.property("__zoom")),{onViewportChangeStart:Q,onViewportChange:j,onViewportChangeEnd:K}=w.getState();clearTimeout(R.current),B.current||(B.current=!0,t==null||t(I,Y),Q==null||Q(Y)),B.current&&(e==null||e(I,Y),j==null||j(Y),R.current=setTimeout(()=>{n==null||n(I,Y),K==null||K(Y),B.current=!1},150))},{passive:!1}):typeof N<"u"&&L.on("wheel.zoom",function(I,O){if(!_||Sd(I,g))return null;I.preventDefault(),N.call(this,I,O)},{passive:!1}))},[E,s,l,L,k,N,P,o,_,g,t,e,n]),M.useEffect(()=>{k&&k.on("start",I=>{var U,V;if(!I.sourceEvent||I.sourceEvent.internal)return null;D.current=(U=I.sourceEvent)==null?void 0:U.button;const{onViewportChangeStart:O}=w.getState(),F=qy(I.transform);x.current=!0,T.current=F,((V=I.sourceEvent)==null?void 0:V.type)==="mousedown"&&w.setState({paneDragging:!0}),O==null||O(F),t==null||t(I.sourceEvent,F)})},[k,t]),M.useEffect(()=>{k&&(E&&!x.current?k.on("zoom",null):E||k.on("zoom",I=>{var F;const{onViewportChange:O}=w.getState();if(w.setState({transform:[I.transform.x,I.transform.y,I.transform.k]}),C.current=!!(r&&g8(d,D.current??0)),(e||O)&&!((F=I.sourceEvent)!=null&&F.internal)){const U=qy(I.transform);O==null||O(U),e==null||e(I.sourceEvent,U)}}))},[E,k,e,d,r]),M.useEffect(()=>{k&&k.on("end",I=>{if(!I.sourceEvent||I.sourceEvent.internal)return null;const{onViewportChangeEnd:O}=w.getState();if(x.current=!1,w.setState({paneDragging:!1}),r&&g8(d,D.current??0)&&!C.current&&r(I.sourceEvent),C.current=!1,(n||O)&&vme(T.current,I.transform)){const F=qy(I.transform);T.current=F,clearTimeout(S.current),S.current=setTimeout(()=>{O==null||O(F),n==null||n(I.sourceEvent,F)},s?150:0)}})},[k,s,d,n,r]),M.useEffect(()=>{k&&k.filter(I=>{const O=P||i,F=o&&I.ctrlKey;if(I.button===1&&I.type==="mousedown"&&(Sd(I,"react-flow__node")||Sd(I,"react-flow__edge")))return!0;if(!d&&!O&&!s&&!u&&!o||E||!u&&I.type==="dblclick"||Sd(I,g)&&I.type==="wheel"||Sd(I,v)&&I.type!=="wheel"||!o&&I.ctrlKey&&I.type==="wheel"||!O&&!s&&!F&&I.type==="wheel"||!d&&(I.type==="mousedown"||I.type==="touchstart")||Array.isArray(d)&&!d.includes(I.button)&&(I.type==="mousedown"||I.type==="touchstart"))return!1;const U=Array.isArray(d)&&d.includes(I.button)||!I.button||I.button<=1;return(!I.ctrlKey||I.type==="wheel")&&U})},[E,k,i,o,s,u,d,c,P]),Z.jsx("div",{className:"react-flow__renderer",ref:A,style:gT,children:y})},Sme=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function wme(){const{userSelectionActive:e,userSelectionRect:t}=hr(Sme,yo);return e&&t?Z.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 y8(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 pB(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(a=>a.id===i.id);if(o.length===0)return r.push(i),r;const s={...i};for(const a of o)if(a)switch(a.type){case"select":{s.selected=a.selected;break}case"position":{typeof a.position<"u"&&(s.position=a.position),typeof a.positionAbsolute<"u"&&(s.positionAbsolute=a.positionAbsolute),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&y8(r,s);break}case"dimensions":{typeof a.dimensions<"u"&&(s.width=a.dimensions.width,s.height=a.dimensions.height),typeof a.updateStyle<"u"&&(s.style={...s.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(s.resizing=a.resizing),s.expandParent&&y8(r,s);break}case"remove":return r}return r.push(s),r},n)}function ec(e,t){return pB(e,t)}function Vu(e,t){return pB(e,t)}const Ol=(e,t)=>({id:e,type:"select",selected:t});function qd(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(Ol(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(Ol(r.id,!1))),n},[])}const yw=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},xme=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),gB=M.memo(({isSelecting:e,selectionMode:t=bu.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:s,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=M.useRef(null),h=oi(),p=M.useRef(0),m=M.useRef(0),b=M.useRef(),{userSelectionActive:_,elementsSelectable:y,dragging:g}=hr(xme,yo),v=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=N=>{o==null||o(N),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},w=N=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){N.preventDefault();return}s==null||s(N)},x=a?N=>a(N):void 0,C=N=>{const{resetSelectedElements:E,domNode:P}=h.getState();if(b.current=P==null?void 0:P.getBoundingClientRect(),!y||!e||N.button!==0||N.target!==f.current||!b.current)return;const{x:D,y:B}=su(N,b.current);E(),h.setState({userSelectionRect:{width:0,height:0,startX:D,startY:B,x:D,y:B}}),r==null||r(N)},A=N=>{const{userSelectionRect:E,nodeInternals:P,edges:D,transform:B,onNodesChange:R,onEdgesChange:I,nodeOrigin:O,getNodes:F}=h.getState();if(!e||!b.current||!E)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const U=su(N,b.current),V=E.startX??0,H=E.startY??0,Y={...E,x:U.xoe.id),te=j.map(oe=>oe.id);if(p.current!==te.length){p.current=te.length;const oe=qd(Q,te);oe.length&&(R==null||R(oe))}if(m.current!==K.length){m.current=K.length;const oe=qd(D,K);oe.length&&(I==null||I(oe))}h.setState({userSelectionRect:Y})},T=N=>{if(N.button!==0)return;const{userSelectionRect:E}=h.getState();!_&&E&&N.target===f.current&&(S==null||S(N)),h.setState({nodesSelectionActive:p.current>0}),v(),i==null||i(N)},k=N=>{_&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(N)),v()},L=y&&(e||_);return Z.jsxs("div",{className:as(["react-flow__pane",{dragging:g,selection:e}]),onClick:L?void 0:yw(S,f),onContextMenu:yw(w,f),onWheel:yw(x,f),onMouseEnter:L?void 0:l,onMouseDown:L?C:void 0,onMouseMove:L?A:u,onMouseUp:L?T:void 0,onMouseLeave:L?k:c,ref:f,style:gT,children:[d,Z.jsx(wme,{})]})});gB.displayName="Pane";function mB(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:mB(n,t):!1}function v8(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 Cme(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!mB(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,s;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((s=i.positionAbsolute)==null?void 0:s.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function Eme(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function yB(e,t,n,r,i=[0,0],o){const s=Eme(e,e.extent||r);let a=s;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=mf(c,i).positionAbsolute;a=c&&Zo(d)&&Zo(f)&&Zo(c.width)&&Zo(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]]]:a}else o==null||o("005",ul.error005()),a=s;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=mf(c,i).positionAbsolute;a=[[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=mf(c,i).positionAbsolute}const u=a&&a!=="parent"?sT(t,a):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function vw({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 _8=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),s=t.getBoundingClientRect(),a={x:s.width*r[0],y:s.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-s.left-a.x)/n,y:(u.top-s.top-a.y)/n,...oT(l)}})};function Uh(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function QC({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:s,nodeInternals:a,onError:l}=t.getState(),u=a.get(e);if(!u){l==null||l("012",ul.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&s)&&(o({nodes:[u]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function Tme(){const e=oi();return M.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),s=n.touches?n.touches[0].clientX:n.clientX,a=n.touches?n.touches[0].clientY:n.clientY,l={x:(s-r[0])/r[2],y:(a-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function _w(e){return(t,n,r)=>e==null?void 0:e(t,r)}function vB({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:s}){const a=oi(),[l,u]=M.useState(!1),c=M.useRef([]),d=M.useRef({x:null,y:null}),f=M.useRef(0),h=M.useRef(null),p=M.useRef({x:0,y:0}),m=M.useRef(null),b=M.useRef(!1),_=Tme();return M.useEffect(()=>{if(e!=null&&e.current){const y=Es(e.current),g=({x:S,y:w})=>{const{nodeInternals:x,onNodeDrag:C,onSelectionDrag:A,updateNodePositions:T,nodeExtent:k,snapGrid:L,snapToGrid:N,nodeOrigin:E,onError:P}=a.getState();d.current={x:S,y:w};let D=!1,B={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&k){const I=dT(c.current,E);B=Fg(I)}if(c.current=c.current.map(I=>{const O={x:S-I.distance.x,y:w-I.distance.y};N&&(O.x=L[0]*Math.round(O.x/L[0]),O.y=L[1]*Math.round(O.y/L[1]));const F=[[k[0][0],k[0][1]],[k[1][0],k[1][1]]];c.current.length>1&&k&&!I.extent&&(F[0][0]=I.positionAbsolute.x-B.x+k[0][0],F[1][0]=I.positionAbsolute.x+(I.width??0)-B.x2+k[1][0],F[0][1]=I.positionAbsolute.y-B.y+k[0][1],F[1][1]=I.positionAbsolute.y+(I.height??0)-B.y2+k[1][1]);const U=yB(I,O,x,F,E,P);return D=D||I.position.x!==U.position.x||I.position.y!==U.position.y,I.position=U.position,I.positionAbsolute=U.positionAbsolute,I}),!D)return;T(c.current,!0,!0),u(!0);const R=i?C:_w(A);if(R&&m.current){const[I,O]=vw({nodeId:i,dragItems:c.current,nodeInternals:x});R(m.current,I,O)}},v=()=>{if(!h.current)return;const[S,w]=$F(p.current,h.current);if(S!==0||w!==0){const{transform:x,panBy:C}=a.getState();d.current.x=(d.current.x??0)-S/x[2],d.current.y=(d.current.y??0)-w/x[2],C({x:S,y:w})&&g(d.current)}f.current=requestAnimationFrame(v)};if(t)y.on(".drag",null);else{const S=Dhe().on("start",w=>{var D;const{nodeInternals:x,multiSelectionActive:C,domNode:A,nodesDraggable:T,unselectNodesAndEdges:k,onNodeDragStart:L,onSelectionDragStart:N}=a.getState(),E=i?L:_w(N);!s&&!C&&i&&((D=x.get(i))!=null&&D.selected||k()),i&&o&&s&&QC({id:i,store:a,nodeRef:e});const P=_(w);if(d.current=P,c.current=Cme(x,T,P,i),E&&c.current){const[B,R]=vw({nodeId:i,dragItems:c.current,nodeInternals:x});E(w.sourceEvent,B,R)}h.current=(A==null?void 0:A.getBoundingClientRect())||null,p.current=su(w.sourceEvent,h.current)}).on("drag",w=>{const x=_(w),{autoPanOnNodeDrag:C}=a.getState();!b.current&&C&&(b.current=!0,v()),(d.current.x!==x.xSnapped||d.current.y!==x.ySnapped)&&c.current&&(m.current=w.sourceEvent,p.current=su(w.sourceEvent,h.current),g(x))}).on("end",w=>{if(u(!1),b.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:x,nodeInternals:C,onNodeDragStop:A,onSelectionDragStop:T}=a.getState(),k=i?A:_w(T);if(x(c.current,!1,!1),k){const[L,N]=vw({nodeId:i,dragItems:c.current,nodeInternals:C});k(w.sourceEvent,L,N)}}}).filter(w=>{const x=w.target;return!w.button&&(!n||!v8(x,`.${n}`,e))&&(!r||v8(x,r,e))});return y.call(S),()=>{y.on(".drag",null)}}}},[e,t,n,r,o,a,i,s,_]),l}function _B(){const e=oi();return M.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:s,snapToGrid:a,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=s().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),f=a?l[0]:5,h=a?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,b=n.y*h*p,_=d.map(y=>{if(y.positionAbsolute){const g={x:y.positionAbsolute.x+m,y:y.positionAbsolute.y+b};a&&(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}=yB(y,g,r,i,void 0,u);y.position=S,y.positionAbsolute=v}return y});o(_,!0,!1)},[])}const yf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var jh=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:s,xPosOrigin:a,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:b,className:_,isDraggable:y,isSelectable:g,isConnectable:v,isFocusable:S,selectNodesOnDrag:w,sourcePosition:x,targetPosition:C,hidden:A,resizeObserver:T,dragHandle:k,zIndex:L,isParent:N,noDragClassName:E,noPanClassName:P,initialized:D,disableKeyboardA11y:B,ariaLabel:R,rfId:I})=>{const O=oi(),F=M.useRef(null),U=M.useRef(x),V=M.useRef(C),H=M.useRef(r),Y=g||y||c||d||f||h,Q=_B(),j=Uh(n,O.getState,d),K=Uh(n,O.getState,f),te=Uh(n,O.getState,h),oe=Uh(n,O.getState,p),me=Uh(n,O.getState,m),le=$e=>{if(g&&(!w||!y)&&QC({id:n,store:O,nodeRef:F}),c){const ct=O.getState().nodeInternals.get(n);ct&&c($e,{...ct})}},ht=$e=>{if(!qC($e))if(UF.includes($e.key)&&g){const ct=$e.key==="Escape";QC({id:n,store:O,unselect:ct,nodeRef:F})}else!B&&y&&u&&Object.prototype.hasOwnProperty.call(yf,$e.key)&&(O.setState({ariaLiveMessage:`Moved selected node ${$e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~s}`}),Q({x:yf[$e.key].x,y:yf[$e.key].y,isShiftPressed:$e.shiftKey}))};M.useEffect(()=>{if(F.current&&!A){const $e=F.current;return T==null||T.observe($e),()=>T==null?void 0:T.unobserve($e)}},[A]),M.useEffect(()=>{const $e=H.current!==r,ct=U.current!==x,Pe=V.current!==C;F.current&&($e||ct||Pe)&&($e&&(H.current=r),ct&&(U.current=x),Pe&&(V.current=C),O.getState().updateNodeDimensions([{id:n,nodeElement:F.current,forceUpdate:!0}]))},[n,r,x,C]);const nt=vB({nodeRef:F,disabled:A||!y,noDragClassName:E,handleSelector:k,nodeId:n,isSelectable:g,selectNodesOnDrag:w});return A?null:Z.jsx("div",{className:as(["react-flow__node",`react-flow__node-${r}`,{[P]:y},_,{selected:u,selectable:g,parent:N,dragging:nt}]),ref:F,style:{zIndex:L,transform:`translate(${a}px,${l}px)`,pointerEvents:Y?"all":"none",visibility:D?"visible":"hidden",...b},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:K,onMouseLeave:te,onContextMenu:oe,onClick:le,onDoubleClick:me,onKeyDown:S?ht:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":B?void 0:`${lB}-${I}`,"aria-label":R,children:Z.jsx(Bge,{value:n,children:Z.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:s,selected:u,isConnectable:v,sourcePosition:x,targetPosition:C,dragging:nt,dragHandle:k,zIndex:L})})})};return t.displayName="NodeWrapper",M.memo(t)};const Ame=e=>{const t=e.getNodes().filter(n=>n.selected);return{...dT(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function kme({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=oi(),{width:i,height:o,x:s,y:a,transformString:l,userSelectionActive:u}=hr(Ame,yo),c=_B(),d=M.useRef(null);if(M.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),vB({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(b=>b.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(yf,p.key)&&c({x:yf[p.key].x,y:yf[p.key].y,isShiftPressed:p.shiftKey})};return Z.jsx("div",{className:as(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:Z.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:a,left:s}})})}var Pme=M.memo(kme);const Rme=e=>e.nodesSelectionActive,bB=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,deleteKeyCode:a,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:b,panActivationKeyCode:_,zoomActivationKeyCode:y,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:A,panOnDrag:T,defaultViewport:k,translateExtent:L,minZoom:N,maxZoom:E,preventScrolling:P,onSelectionContextMenu:D,noWheelClassName:B,noPanClassName:R,disableKeyboardA11y:I})=>{const O=hr(Rme),F=Bg(d),V=Bg(_)||T,H=F||f&&V!==!0;return mme({deleteKeyCode:a,multiSelectionKeyCode:b}),Z.jsx(bme,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:S,panOnScroll:w,panOnScrollSpeed:x,panOnScrollMode:C,zoomOnDoubleClick:A,panOnDrag:!F&&V,defaultViewport:k,translateExtent:L,minZoom:N,maxZoom:E,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:B,noPanClassName:R,children:Z.jsxs(gB,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:s,panOnDrag:V,isSelecting:!!H,selectionMode:h,children:[e,O&&Z.jsx(Pme,{onSelectionContextMenu:D,noPanClassName:R,disableKeyboardA11y:I})]})})};bB.displayName="FlowRenderer";var Ime=M.memo(bB);function Ome(e){return hr(M.useCallback(n=>e?QF(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function Mme(e){const t={input:jh(e.input||iB),default:jh(e.default||XC),output:jh(e.output||sB),group:jh(e.group||pT)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=jh(e[o]||XC),i),n);return{...t,...r}}const Nme=({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]},Dme=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),SB=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:s}=hr(Dme,yo),a=Ome(e.onlyRenderVisibleElements),l=M.useRef(),u=M.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 M.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),Z.jsx("div",{className:"react-flow__nodes",style:gT,children:a.map(c=>{var S,w;let d=c.type||"default";e.nodeTypes[d]||(s==null||s("003",ul.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"),b=!!(c.focusable||r&&typeof c.focusable>"u"),_=e.nodeExtent?sT(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=(_==null?void 0:_.x)??0,g=(_==null?void 0:_.y)??0,v=Nme({x:y,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return Z.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||Je.Bottom,targetPosition:c.targetPosition||Je.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:b,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Ur])==null?void 0:S.z)??0,isParent:!!((w=c[Ur])!=null&&w.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};SB.displayName="NodeRenderer";var Lme=M.memo(SB);const $me=(e,t,n)=>n===Je.Left?e-t:n===Je.Right?e+t:e,Fme=(e,t,n)=>n===Je.Top?e-t:n===Je.Bottom?e+t:e,b8="react-flow__edgeupdater",S8=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:s,type:a})=>Z.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:s,className:as([b8,`${b8}-${a}`]),cx:$me(t,r,e),cy:Fme(n,r,e),r,stroke:"transparent",fill:"transparent"}),Bme=()=>!0;var wd=e=>{const t=({id:n,className:r,type:i,data:o,onClick:s,onEdgeDoubleClick:a,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:b,source:_,target:y,sourceX:g,sourceY:v,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,elementsSelectable:A,hidden:T,sourceHandleId:k,targetHandleId:L,onContextMenu:N,onMouseEnter:E,onMouseMove:P,onMouseLeave:D,edgeUpdaterRadius:B,onEdgeUpdate:R,onEdgeUpdateStart:I,onEdgeUpdateEnd:O,markerEnd:F,markerStart:U,rfId:V,ariaLabel:H,isFocusable:Y,isUpdatable:Q,pathOptions:j,interactionWidth:K})=>{const te=M.useRef(null),[oe,me]=M.useState(!1),[le,ht]=M.useState(!1),nt=oi(),$e=M.useMemo(()=>`url(#${KC(U,V)})`,[U,V]),ct=M.useMemo(()=>`url(#${KC(F,V)})`,[F,V]);if(T)return null;const Pe=In=>{const{edges:dn,addSelectedEdges:Ci}=nt.getState();if(A&&(nt.setState({nodesSelectionActive:!1}),Ci([n])),s){const si=dn.find(ji=>ji.id===n);s(In,si)}},qt=zh(n,nt.getState,a),Sr=zh(n,nt.getState,N),Pn=zh(n,nt.getState,E),bn=zh(n,nt.getState,P),Wt=zh(n,nt.getState,D),Rn=(In,dn)=>{if(In.button!==0)return;const{edges:Ci,isValidConnection:si}=nt.getState(),ji=dn?y:_,ps=(dn?L:k)||null,xr=dn?"target":"source",no=si||Bme,Ta=dn,bo=Ci.find(Kt=>Kt.id===n);ht(!0),I==null||I(In,bo,xr);const Aa=Kt=>{ht(!1),O==null||O(Kt,bo,xr)};eB({event:In,handleId:ps,nodeId:ji,onConnect:Kt=>R==null?void 0:R(bo,Kt),isTarget:Ta,getState:nt.getState,setState:nt.setState,isValidConnection:no,edgeUpdaterType:xr,onEdgeUpdateEnd:Aa})},wr=In=>Rn(In,!0),to=In=>Rn(In,!1),Gr=()=>me(!0),ar=()=>me(!1),Or=!A&&!s,Hr=In=>{var dn;if(UF.includes(In.key)&&A){const{unselectNodesAndEdges:Ci,addSelectedEdges:si,edges:ji}=nt.getState();In.key==="Escape"?((dn=te.current)==null||dn.blur(),Ci({edges:[ji.find(xr=>xr.id===n)]})):si([n])}};return Z.jsxs("g",{className:as(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:Or,updating:oe}]),onClick:Pe,onDoubleClick:qt,onContextMenu:Sr,onMouseEnter:Pn,onMouseMove:bn,onMouseLeave:Wt,onKeyDown:Y?Hr:void 0,tabIndex:Y?0:void 0,role:Y?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":H===null?void 0:H||`Edge from ${_} to ${y}`,"aria-describedby":Y?`${uB}-${V}`:void 0,ref:te,children:[!le&&Z.jsx(e,{id:n,source:_,target:y,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:b,sourceX:g,sourceY:v,targetX:S,targetY:w,sourcePosition:x,targetPosition:C,sourceHandleId:k,targetHandleId:L,markerStart:$e,markerEnd:ct,pathOptions:j,interactionWidth:K}),Q&&Z.jsxs(Z.Fragment,{children:[(Q==="source"||Q===!0)&&Z.jsx(S8,{position:x,centerX:g,centerY:v,radius:B,onMouseDown:wr,onMouseEnter:Gr,onMouseOut:ar,type:"source"}),(Q==="target"||Q===!0)&&Z.jsx(S8,{position:C,centerX:S,centerY:w,radius:B,onMouseDown:to,onMouseEnter:Gr,onMouseOut:ar,type:"target"})]})]})};return t.displayName="EdgeWrapper",M.memo(t)};function zme(e){const t={default:wd(e.default||w1),straight:wd(e.bezier||uT),step:wd(e.step||lT),smoothstep:wd(e.step||Db),simplebezier:wd(e.simplebezier||aT)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=wd(e[o]||w1),i),n);return{...t,...r}}function w8(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,s=(n==null?void 0:n.height)||t.height;switch(e){case Je.Top:return{x:r+o/2,y:i};case Je.Right:return{x:r+o,y:i+s/2};case Je.Bottom:return{x:r+o/2,y:i+s};case Je.Left:return{x:r,y:i+s/2}}}function x8(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const Ume=(e,t,n,r,i,o)=>{const s=w8(n,e,t),a=w8(o,r,i);return{sourceX:s.x,sourceY:s.y,targetX:a.x,targetY:a.y}};function jme({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:s,height:a,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=Fg({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:s/l[2],height:a/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 C8(e){var r,i,o,s,a;const t=((r=e==null?void 0:e[Ur])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.x)||0,y:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const Vme=[{level:0,isMaxLevel:!0,edges:[]}];function Gme(e,t,n=!1){let r=-1;const i=e.reduce((s,a)=>{var c,d;const l=Zo(a.zIndex);let u=l?a.zIndex:0;if(n){const f=t.get(a.target),h=t.get(a.source),p=a.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[Ur])==null?void 0:c.z)||0,((d=f==null?void 0:f[Ur])==null?void 0:d.z)||0,1e3);u=(l?a.zIndex:0)+(p?m:0)}return s[u]?s[u].push(a):s[u]=[a],r=u>r?u:r,s},{}),o=Object.entries(i).map(([s,a])=>{const l=+s;return{edges:a,level:l,isMaxLevel:l===r}});return o.length===0?Vme:o}function Hme(e,t,n){const r=hr(M.useCallback(i=>e?i.edges.filter(o=>{const s=t.get(o.source),a=t.get(o.target);return(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&jme({sourcePos:s.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:s.width,sourceHeight:s.height,targetWidth:a.width,targetHeight:a.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return Gme(r,t,n)}const qme=({color:e="none",strokeWidth:t=1})=>Z.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),Wme=({color:e="none",strokeWidth:t=1})=>Z.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),E8={[S1.Arrow]:qme,[S1.ArrowClosed]:Wme};function Kme(e){const t=oi();return M.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(E8,e)?E8[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",ul.error009(e)),null)},[e])}const Xme=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=Kme(t);return l?Z.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0",children:Z.jsx(l,{color:n,strokeWidth:s})}):null},Qme=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(s=>{if(s&&typeof s=="object"){const a=KC(s,t);r.includes(a)||(i.push({id:a,color:s.color||e,...s}),r.push(a))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},wB=({defaultColor:e,rfId:t})=>{const n=hr(M.useCallback(Qme({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,s)=>o.id!==i[s].id)));return Z.jsx("defs",{children:n.map(r=>Z.jsx(Xme,{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))})};wB.displayName="MarkerDefinitions";var Yme=M.memo(wB);const Zme=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}),xB=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:b})=>{const{edgesFocusable:_,edgesUpdatable:y,elementsSelectable:g,width:v,height:S,connectionMode:w,nodeInternals:x,onError:C}=hr(Zme,yo),A=Hme(t,x,n);return v?Z.jsxs(Z.Fragment,{children:[A.map(({level:T,edges:k,isMaxLevel:L})=>Z.jsxs("svg",{style:{zIndex:T},width:v,height:S,className:"react-flow__edges react-flow__container",children:[L&&Z.jsx(Yme,{defaultColor:e,rfId:r}),Z.jsx("g",{children:k.map(N=>{const[E,P,D]=C8(x.get(N.source)),[B,R,I]=C8(x.get(N.target));if(!D||!I)return null;let O=N.type||"default";i[O]||(C==null||C("011",ul.error011(O)),O="default");const F=i[O]||i.default,U=w===$c.Strict?R.target:(R.target??[]).concat(R.source??[]),V=x8(P.source,N.sourceHandle),H=x8(U,N.targetHandle),Y=(V==null?void 0:V.position)||Je.Bottom,Q=(H==null?void 0:H.position)||Je.Top,j=!!(N.focusable||_&&typeof N.focusable>"u"),K=typeof s<"u"&&(N.updatable||y&&typeof N.updatable>"u");if(!V||!H)return C==null||C("008",ul.error008(V,N)),null;const{sourceX:te,sourceY:oe,targetX:me,targetY:le}=Ume(E,V,Y,B,H,Q);return Z.jsx(F,{id:N.id,className:as([N.className,o]),type:O,data:N.data,selected:!!N.selected,animated:!!N.animated,hidden:!!N.hidden,label:N.label,labelStyle:N.labelStyle,labelShowBg:N.labelShowBg,labelBgStyle:N.labelBgStyle,labelBgPadding:N.labelBgPadding,labelBgBorderRadius:N.labelBgBorderRadius,style:N.style,source:N.source,target:N.target,sourceHandleId:N.sourceHandle,targetHandleId:N.targetHandle,markerEnd:N.markerEnd,markerStart:N.markerStart,sourceX:te,sourceY:oe,targetX:me,targetY:le,sourcePosition:Y,targetPosition:Q,elementsSelectable:g,onEdgeUpdate:s,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:N.ariaLabel,isFocusable:j,isUpdatable:K,pathOptions:"pathOptions"in N?N.pathOptions:void 0,interactionWidth:N.interactionWidth},N.id)})})]},T)),b]}):null};xB.displayName="EdgeRenderer";var Jme=M.memo(xB);const eye=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function tye({children:e}){const t=hr(eye);return Z.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function nye(e){const t=hB(),n=M.useRef(!1);M.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const rye={[Je.Left]:Je.Right,[Je.Right]:Je.Left,[Je.Top]:Je.Bottom,[Je.Bottom]:Je.Top},CB=({nodeId:e,handleType:t,style:n,type:r=Bl.Bezier,CustomComponent:i,connectionStatus:o})=>{var w,x,C;const{fromNode:s,handleId:a,toX:l,toY:u,connectionMode:c}=hr(M.useCallback(A=>({fromNode:A.nodeInternals.get(e),handleId:A.connectionHandleId,toX:(A.connectionPosition.x-A.transform[0])/A.transform[2],toY:(A.connectionPosition.y-A.transform[1])/A.transform[2],connectionMode:A.connectionMode}),[e]),yo),d=(w=s==null?void 0:s[Ur])==null?void 0:w.handleBounds;let f=d==null?void 0:d[t];if(c===$c.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!s||!f)return null;const h=a?f.find(A=>A.id===a):f[0],p=h?h.x+h.width/2:(s.width??0)/2,m=h?h.y+h.height/2:s.height??0,b=(((x=s.positionAbsolute)==null?void 0:x.x)??0)+p,_=(((C=s.positionAbsolute)==null?void 0:C.y)??0)+m,y=h==null?void 0:h.position,g=y?rye[y]:null;if(!y||!g)return null;if(i)return Z.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:s,fromHandle:h,fromX:b,fromY:_,toX:l,toY:u,fromPosition:y,toPosition:g,connectionStatus:o});let v="";const S={sourceX:b,sourceY:_,sourcePosition:y,targetX:l,targetY:u,targetPosition:g};return r===Bl.Bezier?[v]=qF(S):r===Bl.Step?[v]=WC({...S,borderRadius:0}):r===Bl.SmoothStep?[v]=WC(S):r===Bl.SimpleBezier?[v]=HF(S):v=`M${b},${_} ${l},${u}`,Z.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:n})};CB.displayName="ConnectionLine";const iye=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function oye({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:s,width:a,height:l,connectionStatus:u}=hr(iye,yo);return!(i&&o&&a&&s)?null:Z.jsx("svg",{style:e,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:Z.jsx("g",{className:as(["react-flow__connection",u]),children:Z.jsx(CB,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}function T8(e,t){return M.useRef(null),oi(),M.useMemo(()=>t(e),[e])}const EB=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:s,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:b,connectionLineType:_,connectionLineStyle:y,connectionLineComponent:g,connectionLineContainerStyle:v,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,multiSelectionKeyCode:C,panActivationKeyCode:A,zoomActivationKeyCode:T,deleteKeyCode:k,onlyRenderVisibleElements:L,elementsSelectable:N,selectNodesOnDrag:E,defaultViewport:P,translateExtent:D,minZoom:B,maxZoom:R,preventScrolling:I,defaultMarkerColor:O,zoomOnScroll:F,zoomOnPinch:U,panOnScroll:V,panOnScrollSpeed:H,panOnScrollMode:Y,zoomOnDoubleClick:Q,panOnDrag:j,onPaneClick:K,onPaneMouseEnter:te,onPaneMouseMove:oe,onPaneMouseLeave:me,onPaneScroll:le,onPaneContextMenu:ht,onEdgeUpdate:nt,onEdgeContextMenu:$e,onEdgeMouseEnter:ct,onEdgeMouseMove:Pe,onEdgeMouseLeave:qt,edgeUpdaterRadius:Sr,onEdgeUpdateStart:Pn,onEdgeUpdateEnd:bn,noDragClassName:Wt,noWheelClassName:Rn,noPanClassName:wr,elevateEdgesOnSelect:to,disableKeyboardA11y:Gr,nodeOrigin:ar,nodeExtent:Or,rfId:Hr})=>{const In=T8(e,Mme),dn=T8(t,zme);return nye(o),Z.jsx(Ime,{onPaneClick:K,onPaneMouseEnter:te,onPaneMouseMove:oe,onPaneMouseLeave:me,onPaneContextMenu:ht,onPaneScroll:le,deleteKeyCode:k,selectionKeyCode:S,selectionOnDrag:w,selectionMode:x,onSelectionStart:m,onSelectionEnd:b,multiSelectionKeyCode:C,panActivationKeyCode:A,zoomActivationKeyCode:T,elementsSelectable:N,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:F,zoomOnPinch:U,zoomOnDoubleClick:Q,panOnScroll:V,panOnScrollSpeed:H,panOnScrollMode:Y,panOnDrag:j,defaultViewport:P,translateExtent:D,minZoom:B,maxZoom:R,onSelectionContextMenu:p,preventScrolling:I,noDragClassName:Wt,noWheelClassName:Rn,noPanClassName:wr,disableKeyboardA11y:Gr,children:Z.jsxs(tye,{children:[Z.jsx(Jme,{edgeTypes:dn,onEdgeClick:a,onEdgeDoubleClick:u,onEdgeUpdate:nt,onlyRenderVisibleElements:L,onEdgeContextMenu:$e,onEdgeMouseEnter:ct,onEdgeMouseMove:Pe,onEdgeMouseLeave:qt,onEdgeUpdateStart:Pn,onEdgeUpdateEnd:bn,edgeUpdaterRadius:Sr,defaultMarkerColor:O,noPanClassName:wr,elevateEdgesOnSelect:!!to,disableKeyboardA11y:Gr,rfId:Hr,children:Z.jsx(oye,{style:y,type:_,component:g,containerStyle:v})}),Z.jsx("div",{className:"react-flow__edgelabel-renderer"}),Z.jsx(Lme,{nodeTypes:In,onNodeClick:s,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:E,onlyRenderVisibleElements:L,noPanClassName:wr,noDragClassName:Wt,disableKeyboardA11y:Gr,nodeOrigin:ar,nodeExtent:Or,rfId:Hr})]})})};EB.displayName="GraphView";var sye=M.memo(EB);const YC=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],El={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:YC,nodeExtent:YC,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:$c.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:Mge,isValidConnection:void 0},aye=()=>Wde((e,t)=>({...El,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:mw(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",s=i?mw(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:s,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:s,fitViewOnInitOptions:a,domNode:l,nodeOrigin:u}=t(),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,b)=>{const _=i.get(b.id);if(_){const y=oT(b.nodeElement);!!(y.width&&y.height&&(_.width!==y.width||_.height!==y.height||b.forceUpdate))&&(i.set(_.id,{..._,[Ur]:{..._[Ur],handleBounds:{source:_8(".source",b.nodeElement,f,u),target:_8(".target",b.nodeElement,f,u)}},...y}),m.push({id:_.id,type:"dimensions",dimensions:y}))}return m},[]);dB(i,u);const p=s||o&&!s&&fB(t,{initial:!0,...a});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(),s=n.map(a=>{const l={id:a.id,type:"position",dragging:i};return r&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});o(s)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:s,getNodes:a,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=ec(n,a()),c=mw(u,i,s,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>Ol(l,!0)):(s=qd(o(),n),a=qd(i,[])),Hy({changedNodes:s,changedEdges:a,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let s,a=null;r?s=n.map(l=>Ol(l,!0)):(s=qd(i,n),a=qd(o(),[])),Hy({changedNodes:a,changedEdges:s,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),s=n||o(),a=r||i,l=s.map(c=>(c.selected=!1,Ol(c.id,!1))),u=a.map(c=>Ol(c.id,!1));Hy({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(a=>a.selected).map(a=>Ol(a.id,!1)),s=n.filter(a=>a.selected).map(a=>Ol(a.id,!1));Hy({changedNodes:o,changedEdges:s,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=sT(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:s,d3Selection:a,translateExtent:l}=t();if(!s||!a||!n.x&&!n.y)return!1;const u=ou.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=s==null?void 0:s.constrain()(u,c,l);return s.transform(a,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:El.connectionNodeId,connectionHandleId:El.connectionHandleId,connectionHandleType:El.connectionHandleType,connectionStatus:El.connectionStatus,connectionStartHandle:El.connectionStartHandle,connectionEndHandle:El.connectionEndHandle}),reset:()=>e({...El})}),Object.is),TB=({children:e})=>{const t=M.useRef(null);return t.current||(t.current=aye()),Z.jsx(Tge,{value:t.current,children:e})};TB.displayName="ReactFlowProvider";const AB=({children:e})=>M.useContext(Nb)?Z.jsx(Z.Fragment,{children:e}):Z.jsx(TB,{children:e});AB.displayName="ReactFlowWrapper";const lye={input:iB,default:XC,output:sB,group:pT},uye={default:w1,straight:uT,step:lT,smoothstep:Db,simplebezier:aT},cye=[0,0],dye=[15,15],fye={x:0,y:0,zoom:1},hye={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},pye=M.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=lye,edgeTypes:s=uye,onNodeClick:a,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:b,onClickConnectEnd:_,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:w,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:A,onNodesDelete:T,onEdgesDelete:k,onSelectionChange:L,onSelectionDragStart:N,onSelectionDrag:E,onSelectionDragStop:P,onSelectionContextMenu:D,onSelectionStart:B,onSelectionEnd:R,connectionMode:I=$c.Strict,connectionLineType:O=Bl.Bezier,connectionLineStyle:F,connectionLineComponent:U,connectionLineContainerStyle:V,deleteKeyCode:H="Backspace",selectionKeyCode:Y="Shift",selectionOnDrag:Q=!1,selectionMode:j=bu.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:te=b1()?"Meta":"Control",zoomActivationKeyCode:oe=b1()?"Meta":"Control",snapToGrid:me=!1,snapGrid:le=dye,onlyRenderVisibleElements:ht=!1,selectNodesOnDrag:nt=!0,nodesDraggable:$e,nodesConnectable:ct,nodesFocusable:Pe,nodeOrigin:qt=cye,edgesFocusable:Sr,edgesUpdatable:Pn,elementsSelectable:bn,defaultViewport:Wt=fye,minZoom:Rn=.5,maxZoom:wr=2,translateExtent:to=YC,preventScrolling:Gr=!0,nodeExtent:ar,defaultMarkerColor:Or="#b1b1b7",zoomOnScroll:Hr=!0,zoomOnPinch:In=!0,panOnScroll:dn=!1,panOnScrollSpeed:Ci=.5,panOnScrollMode:si=hc.Free,zoomOnDoubleClick:ji=!0,panOnDrag:ps=!0,onPaneClick:xr,onPaneMouseEnter:no,onPaneMouseMove:Ta,onPaneMouseLeave:bo,onPaneScroll:Aa,onPaneContextMenu:On,children:Kt,onEdgeUpdate:Mr,onEdgeContextMenu:Cr,onEdgeDoubleClick:Er,onEdgeMouseEnter:qr,onEdgeMouseMove:Ei,onEdgeMouseLeave:ro,onEdgeUpdateStart:ai,onEdgeUpdateEnd:Nr,edgeUpdaterRadius:gs=10,onNodesChange:Vs,onEdgesChange:li,noDragClassName:_l="nodrag",noWheelClassName:zo="nowheel",noPanClassName:Wr="nopan",fitView:ka=!1,fitViewOptions:W,connectOnClick:ee=!0,attributionPosition:ne,proOptions:ue,defaultEdgeOptions:ie,elevateNodesOnSelect:Fe=!0,elevateEdgesOnSelect:je=!1,disableKeyboardA11y:ot=!1,autoPanOnConnect:Ne=!0,autoPanOnNodeDrag:Ve=!0,connectionRadius:Re=20,isValidConnection:re,onError:ve,style:Xe,id:Qe,...st},at)=>{const mt=Qe||"1";return Z.jsx("div",{...st,style:{...Xe,...hye},ref:at,className:as(["react-flow",i]),"data-testid":"rf__wrapper",id:Qe,children:Z.jsxs(AB,{children:[Z.jsx(sye,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:w,nodeTypes:o,edgeTypes:s,connectionLineType:O,connectionLineStyle:F,connectionLineComponent:U,connectionLineContainerStyle:V,selectionKeyCode:Y,selectionOnDrag:Q,selectionMode:j,deleteKeyCode:H,multiSelectionKeyCode:te,panActivationKeyCode:K,zoomActivationKeyCode:oe,onlyRenderVisibleElements:ht,selectNodesOnDrag:nt,defaultViewport:Wt,translateExtent:to,minZoom:Rn,maxZoom:wr,preventScrolling:Gr,zoomOnScroll:Hr,zoomOnPinch:In,zoomOnDoubleClick:ji,panOnScroll:dn,panOnScrollSpeed:Ci,panOnScrollMode:si,panOnDrag:ps,onPaneClick:xr,onPaneMouseEnter:no,onPaneMouseMove:Ta,onPaneMouseLeave:bo,onPaneScroll:Aa,onPaneContextMenu:On,onSelectionContextMenu:D,onSelectionStart:B,onSelectionEnd:R,onEdgeUpdate:Mr,onEdgeContextMenu:Cr,onEdgeDoubleClick:Er,onEdgeMouseEnter:qr,onEdgeMouseMove:Ei,onEdgeMouseLeave:ro,onEdgeUpdateStart:ai,onEdgeUpdateEnd:Nr,edgeUpdaterRadius:gs,defaultMarkerColor:Or,noDragClassName:_l,noWheelClassName:zo,noPanClassName:Wr,elevateEdgesOnSelect:je,rfId:mt,disableKeyboardA11y:ot,nodeOrigin:qt,nodeExtent:ar}),Z.jsx(ime,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:b,onClickConnectEnd:_,nodesDraggable:$e,nodesConnectable:ct,nodesFocusable:Pe,edgesFocusable:Sr,edgesUpdatable:Pn,elementsSelectable:bn,elevateNodesOnSelect:Fe,minZoom:Rn,maxZoom:wr,nodeExtent:ar,onNodesChange:Vs,onEdgesChange:li,snapToGrid:me,snapGrid:le,connectionMode:I,translateExtent:to,connectOnClick:ee,defaultEdgeOptions:ie,fitView:ka,fitViewOptions:W,onNodesDelete:T,onEdgesDelete:k,onNodeDragStart:x,onNodeDrag:C,onNodeDragStop:A,onSelectionDrag:E,onSelectionDragStart:N,onSelectionDragStop:P,noPanClassName:Wr,nodeOrigin:qt,rfId:mt,autoPanOnConnect:Ne,autoPanOnNodeDrag:Ve,onError:ve,connectionRadius:Re,isValidConnection:re}),Z.jsx(nme,{onSelectionChange:L}),Kt,Z.jsx(Pge,{proOptions:ue,position:ne}),Z.jsx(ume,{rfId:mt,disableKeyboardA11y:ot})]})})});pye.displayName="ReactFlow";const gye=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function JIe({children:e}){const t=hr(gye);return t?Cs.createPortal(e,t):null}function eOe(){const e=oi();return M.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((s,a)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${a}"]`);return l&&s.push({id:a,nodeElement:l,forceUpdate:!0}),s},[]);requestAnimationFrame(()=>r(o))},[])}function mye(){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 zg=hu("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,mye()))}catch(n){return t({error:n})}});let Wy;const yye=new Uint8Array(16);function vye(){if(!Wy&&(Wy=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Wy))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Wy(yye)}const hi=[];for(let e=0;e<256;++e)hi.push((e+256).toString(16).slice(1));function _ye(e,t=0){return(hi[e[t+0]]+hi[e[t+1]]+hi[e[t+2]]+hi[e[t+3]]+"-"+hi[e[t+4]]+hi[e[t+5]]+"-"+hi[e[t+6]]+hi[e[t+7]]+"-"+hi[e[t+8]]+hi[e[t+9]]+"-"+hi[e[t+10]]+hi[e[t+11]]+hi[e[t+12]]+hi[e[t+13]]+hi[e[t+14]]+hi[e[t+15]]).toLowerCase()}const bye=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),A8={randomUUID:bye};function kB(e,t,n){if(A8.randomUUID&&!t&&!e)return A8.randomUUID();e=e||{};const r=e.random||(e.rng||vye)();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 _ye(r)}const tOe=500,nOe=320,Sye="node-drag-handle",wye=["ImageField","ImageCollection"],rOe=wye,iOe={input:"inputs",output:"outputs"},oOe=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection"],xye=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic"],sOe=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField"],PB={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection"},Cye=e=>!!(e&&e in PB),RB={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic"},aOe={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField"},Eye=e=>!!(e&&e in RB),lOe={boolean:{color:"green.500",description:J("nodes.booleanDescription"),title:J("nodes.boolean")},BooleanCollection:{color:"green.500",description:J("nodes.booleanCollectionDescription"),title:J("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:J("nodes.booleanPolymorphicDescription"),title:J("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:J("nodes.clipFieldDescription"),title:J("nodes.clipField")},Collection:{color:"base.500",description:J("nodes.collectionDescription"),title:J("nodes.collection")},CollectionItem:{color:"base.500",description:J("nodes.collectionItemDescription"),title:J("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:J("nodes.colorCollectionDescription"),title:J("nodes.colorCollection")},ColorField:{color:"pink.300",description:J("nodes.colorFieldDescription"),title:J("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:J("nodes.colorPolymorphicDescription"),title:J("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:J("nodes.conditioningCollectionDescription"),title:J("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:J("nodes.conditioningFieldDescription"),title:J("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:J("nodes.conditioningPolymorphicDescription"),title:J("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:J("nodes.controlCollectionDescription"),title:J("nodes.controlCollection")},ControlField:{color:"teal.500",description:J("nodes.controlFieldDescription"),title:J("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:J("nodes.denoiseMaskFieldDescription"),title:J("nodes.denoiseMaskField")},enum:{color:"blue.500",description:J("nodes.enumDescription"),title:J("nodes.enum")},float:{color:"orange.500",description:J("nodes.floatDescription"),title:J("nodes.float")},FloatCollection:{color:"orange.500",description:J("nodes.floatCollectionDescription"),title:J("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:J("nodes.floatPolymorphicDescription"),title:J("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:J("nodes.imageCollectionDescription"),title:J("nodes.imageCollection")},ImageField:{color:"purple.500",description:J("nodes.imageFieldDescription"),title:J("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:J("nodes.imagePolymorphicDescription"),title:J("nodes.imagePolymorphic")},integer:{color:"red.500",description:J("nodes.integerDescription"),title:J("nodes.integer")},IntegerCollection:{color:"red.500",description:J("nodes.integerCollectionDescription"),title:J("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:J("nodes.integerPolymorphicDescription"),title:J("nodes.integerPolymorphic")},IPAdapterField:{color:"green.300",description:"IP-Adapter info passed between nodes.",title:"IP-Adapter"},IPAdapterModelField:{color:"teal.500",description:"IP-Adapter model",title:"IP-Adapter Model"},LatentsCollection:{color:"pink.500",description:J("nodes.latentsCollectionDescription"),title:J("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:J("nodes.latentsFieldDescription"),title:J("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:J("nodes.latentsPolymorphicDescription"),title:J("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:J("nodes.loRAModelFieldDescription"),title:J("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:J("nodes.mainModelFieldDescription"),title:J("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:J("nodes.oNNXModelFieldDescription"),title:J("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:J("nodes.schedulerDescription"),title:J("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:J("nodes.sDXLMainModelFieldDescription"),title:J("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:J("nodes.sDXLRefinerModelFieldDescription"),title:J("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:J("nodes.stringDescription"),title:J("nodes.string")},StringCollection:{color:"yellow.500",description:J("nodes.stringCollectionDescription"),title:J("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:J("nodes.stringPolymorphicDescription"),title:J("nodes.stringPolymorphic")},UNetField:{color:"red.500",description:J("nodes.uNetFieldDescription"),title:J("nodes.uNetField")},VaeField:{color:"blue.500",description:J("nodes.vaeFieldDescription"),title:J("nodes.vaeField")},VaeModelField:{color:"teal.500",description:J("nodes.vaeModelFieldDescription"),title:J("nodes.vaeModelField")}},k8=(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}},Tye="1.0.0",bw={status:Fa.PENDING,error:null,progress:null,progressImage:null,outputs:[]},ZC={meta:{version:Tye},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},IB={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:ZC,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:bu.Partial},xo=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),s=(l=e.nodes)==null?void 0:l[o];if(!Kr(s))return;const a=(u=s.data)==null?void 0:u.inputs[r];a&&o>-1&&(a.value=i)},OB=nr({name:"nodes",initialState:IB,reducers:{nodesChanged:(e,t)=>{e.nodes=ec(t.payload,e.nodes)},nodeAdded:(e,t)=>{const n=t.payload,r=k8(e.nodes,n.position.x,n.position.y);n.position=r,n.selected=!0,e.nodes=ec(e.nodes.map(i=>({id:i.id,type:"select",selected:!1})),e.nodes),e.edges=Vu(e.edges.map(i=>({id:i.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),Kr(n)&&(e.nodeExecutionStates[n.id]={nodeId:n.id,...bw})},edgesChanged:(e,t)=>{e.edges=Vu(t.payload,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),s=(l=e.nodes)==null?void 0:l[o];if(!Kr(s))return;const a=i==="source"?s.data.outputs[r]:s.data.inputs[r];e.currentConnectionFieldType=(a==null?void 0:a.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=KF({...t.payload,type:"default"},e.edges))},connectionEnded:e=>{e.connectionStartParams=null,e.currentConnectionFieldType=null},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=Hk(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!wm(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(a=>a.id===n);if(!Kr(o))return;const s=o.data.inputs[r];s&&(s.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var s;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(a=>a.id===n),o=(s=e.nodes)==null?void 0:s[i];Kr(o)&&(o.data.embedWorkflow=r)},nodeIsIntermediateChanged:(e,t)=>{var s;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(a=>a.id===n),o=(s=e.nodes)==null?void 0:s[i];Kr(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var a;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(a=e.nodes)==null?void 0:a[i];if(!Kr(o)&&!uP(o)||(o.data.isOpen=r,!Kr(o)))return;const s=fT([o],e.edges);if(r)s.forEach(l=>{delete l.hidden}),s.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=Vge(o,e.nodes,e.edges).filter(d=>Kr(d)&&d.data.isOpen===!1),u=jge(o,e.nodes,e.edges).filter(d=>Kr(d)&&d.data.isOpen===!1),c=[];s.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}})}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}})}}),c.length&&(e.edges=Vu(c.map(d=>({type:"add",item:d})),e.edges))}},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(s=>{s.source===o.source&&s.target===o.target&&i.push({id:s.id,type:"remove"})})}),e.edges=Vu(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),Kr(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var s;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(a=>a.id===n),o=(s=e.nodes)==null?void 0:s[i];Kr(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var s;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(a=>a.id===n),o=(s=e.nodes)==null?void 0:s[i];Kr(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=ec(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)=>{xo(e,t)},fieldNumberValueChanged:(e,t)=>{xo(e,t)},fieldBooleanValueChanged:(e,t)=>{xo(e,t)},fieldImageValueChanged:(e,t)=>{xo(e,t)},fieldColorValueChanged:(e,t)=>{xo(e,t)},fieldMainModelValueChanged:(e,t)=>{xo(e,t)},fieldRefinerModelValueChanged:(e,t)=>{xo(e,t)},fieldVaeModelValueChanged:(e,t)=>{xo(e,t)},fieldLoRAModelValueChanged:(e,t)=>{xo(e,t)},fieldControlNetModelValueChanged:(e,t)=>{xo(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{xo(e,t)},fieldEnumModelValueChanged:(e,t)=>{xo(e,t)},fieldSchedulerValueChanged:(e,t)=>{xo(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 s=(u=e.nodes)==null?void 0:u[o];if(!Kr(s))return;const a=(c=s.data)==null?void 0:c.inputs[r];if(!a)return;const l=Jn(a.value);if(!l){a.value=i;return}a.value=Hk(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var s;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(a=>a.id===n),o=(s=e.nodes)==null?void 0:s[i];uP(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=Jn(ZC)},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=ec(n.map(o=>({item:{...o,dragHandle:`.${Sye}`},type:"add"})),[]),e.edges=Vu(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,s)=>(o[s.id]={nodeId:s.id,...bw},o),{})},workflowReset:e=>{e.workflow=Jn(ZC)},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=ec(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=Vu(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{e.nodesToCopy=e.nodes.filter(t=>t.selected).map(Jn),e.edgesToCopy=e.edges.filter(t=>t.selected).map(Jn)},selectionPasted:e=>{const t=e.nodesToCopy.map(Jn),n=t.map(l=>l.data.id),r=e.edgesToCopy.filter(l=>n.includes(l.source)&&n.includes(l.target)).map(Jn);r.forEach(l=>l.selected=!0),t.forEach(l=>{const u=kB();r.forEach(d=>{d.source===l.data.id&&(d.source=u,d.id=d.id.replace(l.data.id,u)),d.target===l.data.id&&(d.target=u,d.id=d.id.replace(l.data.id,u))}),l.selected=!0,l.id=u,l.data.id=u;const c=k8(e.nodes,l.position.x,l.position.y);l.position=c});const i=t.map(l=>({item:l,type:"add"})),o=e.nodes.map(l=>({id:l.data.id,type:"select",selected:!1})),s=r.map(l=>({item:l,type:"add"})),a=e.edges.map(l=>({id:l.id,type:"select",selected:!1}));e.nodes=ec(i.concat(o),e.nodes),e.edges=Vu(s.concat(a),e.edges),t.forEach(l=>{e.nodeExecutionStates[l.id]={nodeId:l.id,...bw}})},addNodePopoverOpened:e=>{e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?bu.Full:bu.Partial}},extraReducers:e=>{e.addCase(zg.pending,t=>{t.isReady=!1}),e.addCase(q5,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Fa.IN_PROGRESS)}),e.addCase(K5,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=Fa.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(kb,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=Fa.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(X5,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:s}=n.payload.data,a=t.nodeExecutionStates[r];a&&(a.status=Fa.IN_PROGRESS,a.progress=(i+1)/o,a.progressImage=s??null)}),e.addCase(ah.fulfilled,t=>{rs(t.nodeExecutionStates,n=>{n.status=Fa.PENDING,n.error=null,n.progress=null,n.progressImage=null,n.outputs=[]})}),e.addCase(Iu.fulfilled,t=>{yee(t.nodeExecutionStates,n=>{n.status===Fa.IN_PROGRESS&&(n.status=Fa.PENDING)})})}}),{nodesChanged:uOe,edgesChanged:cOe,nodeAdded:dOe,nodesDeleted:fOe,connectionMade:hOe,connectionStarted:pOe,connectionEnded:gOe,shouldShowFieldTypeLegendChanged:mOe,shouldShowMinimapPanelChanged:yOe,nodeTemplatesBuilt:MB,nodeEditorReset:Aye,imageCollectionFieldValueChanged:vOe,fieldStringValueChanged:_Oe,fieldNumberValueChanged:bOe,fieldBooleanValueChanged:SOe,fieldImageValueChanged:Lb,fieldColorValueChanged:wOe,fieldMainModelValueChanged:xOe,fieldVaeModelValueChanged:COe,fieldLoRAModelValueChanged:EOe,fieldEnumModelValueChanged:TOe,fieldControlNetModelValueChanged:AOe,fieldIPAdapterModelValueChanged:kOe,fieldRefinerModelValueChanged:POe,fieldSchedulerValueChanged:ROe,nodeIsOpenChanged:IOe,nodeLabelChanged:OOe,nodeNotesChanged:MOe,edgesDeleted:NOe,shouldValidateGraphChanged:DOe,shouldAnimateEdgesChanged:LOe,nodeOpacityChanged:$Oe,shouldSnapToGridChanged:FOe,shouldColorEdgesChanged:BOe,selectedNodesChanged:zOe,selectedEdgesChanged:UOe,workflowNameChanged:jOe,workflowDescriptionChanged:VOe,workflowTagsChanged:GOe,workflowAuthorChanged:HOe,workflowNotesChanged:qOe,workflowVersionChanged:WOe,workflowContactChanged:KOe,workflowLoaded:kye,notesNodeValueChanged:XOe,workflowExposedFieldAdded:Pye,workflowExposedFieldRemoved:QOe,fieldLabelChanged:YOe,viewportChanged:ZOe,mouseOverFieldChanged:JOe,selectionCopied:e9e,selectionPasted:t9e,selectedAll:n9e,addNodePopoverOpened:r9e,addNodePopoverClosed:i9e,addNodePopoverToggled:o9e,selectionModeChanged:s9e,nodeEmbedWorkflowChanged:a9e,nodeIsIntermediateChanged:l9e,mouseOverNodeChanged:u9e,nodeExclusivelySelected:c9e}=OB.actions,Rye=OB.reducer,NB={esrganModelName:"RealESRGAN_x4plus.pth"},DB=nr({name:"postprocessing",initialState:NB,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:d9e}=DB.actions,Iye=DB.reducer,Oye={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},LB=nr({name:"sdxl",initialState:Oye,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:f9e,setNegativeStylePromptSDXL:h9e,setShouldConcatSDXLStylePrompt:p9e,setShouldUseSDXLRefiner:Mye,setSDXLImg2ImgDenoisingStrength:g9e,refinerModelChanged:P8,setRefinerSteps:m9e,setRefinerCFGScale:y9e,setRefinerScheduler:v9e,setRefinerPositiveAestheticScore:_9e,setRefinerNegativeAestheticScore:b9e,setRefinerStart:S9e}=LB.actions,Nye=LB.reducer,Fm=Le("app/userInvoked"),sa=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},Dye=z.object({status:z.literal(422),error:z.object({detail:z.array(z.object({loc:z.array(z.string()),msg:z.string(),type:z.string()}))})}),$B={isConnected:!1,isProcessing:!1,isGFPGANAvailable:!0,isESRGANAvailable:!0,shouldConfirmOnDelete:!0,currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatusHasSteps:!1,isCancelable:!0,enableImageDebugging:!1,toastQueue:[],progressImage:null,shouldAntialiasProgressImage:!1,sessionId:null,cancelType:"immediate",isCancelScheduled:!1,subscribedNodeIds:[],wereModelsReceived:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,statusTranslationKey:"common.statusDisconnected",canceledSession:"",isPersisted:!1,language:"en",isUploading:!1,shouldUseNSFWChecker:!1,shouldUseWatermarker:!1},FB=nr({name:"system",initialState:$B,reducers:{setIsProcessing:(e,t)=>{e.isProcessing=t.payload},setCurrentStatus:(e,t)=>{e.statusTranslationKey=t.payload},setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setIsCancelable:(e,t)=>{e.isCancelable=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},cancelScheduled:e=>{e.isCancelScheduled=!0},scheduledCancelAborted:e=>{e.isCancelScheduled=!1},cancelTypeChanged:(e,t)=>{e.cancelType=t.payload},subscribedNodeIdsSet:(e,t)=>{e.subscribedNodeIds=t.payload},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},isPersistedChanged:(e,t)=>{e.isPersisted=t.payload},languageChanged:(e,t)=>{e.language=t.payload},progressImageSet(e,t){e.progressImage=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload}},extraReducers(e){e.addCase(L$,(t,n)=>{t.sessionId=n.payload.sessionId,t.canceledSession=""}),e.addCase(F$,t=>{t.sessionId=null}),e.addCase(M$,t=>{t.isConnected=!0,t.isCancelable=!0,t.isProcessing=!1,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.statusTranslationKey="common.statusConnected"}),e.addCase(D$,t=>{t.isConnected=!1,t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusDisconnected"}),e.addCase(q5,t=>{t.isCancelable=!0,t.isProcessing=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusGenerating"}),e.addCase(X5,(t,n)=>{const{step:r,total_steps:i,progress_image:o}=n.payload.data;t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!0,t.currentStep=r+1,t.totalSteps=i,t.progressImage=o??null,t.statusTranslationKey="common.statusGenerating"}),e.addCase(K5,(t,n)=>{const{data:r}=n.payload;t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusProcessingComplete",t.canceledSession===r.graph_execution_state_id&&(t.isProcessing=!1,t.isCancelable=!0)}),e.addCase(j$,t=>{t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null}),e.addCase(Fm,t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.statusTranslationKey="common.statusPreparing"}),e.addCase(Iu.fulfilled,(t,n)=>{t.canceledSession=n.meta.arg.session_id,t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null,t.toastQueue.push(sa({title:J("toast.canceled"),status:"warning"}))}),e.addMatcher(vD,(t,n)=>{var o,s,a;t.isProcessing=!1,t.isCancelable=!1,t.isCancelScheduled=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusConnected",t.progressImage=null;let r;const i=5e3;if(((o=n.payload)==null?void 0:o.status)===422){const l=Dye.safeParse(n.payload);if(l.success){l.data.error.detail.map(u=>{t.toastQueue.push(sa({title:$2(h7(u.msg),{length:128}),status:"error",description:$2(`Path: ${u.loc.join(".")}`,{length:128}),duration:i}))});return}}else(s=n.payload)!=null&&s.error&&(r=(a=n.payload)==null?void 0:a.error);t.toastQueue.push(sa({title:J("toast.serverError"),status:"error",description:$2(Mv(r,"detail","Unknown Error"),{length:128}),duration:i}))}),e.addMatcher(zye,(t,n)=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStatusHasSteps=!1,t.currentStep=0,t.totalSteps=0,t.statusTranslationKey="common.statusError",t.progressImage=null,t.toastQueue.push(sa({title:J("toast.serverError"),status:"error",description:tte(n.payload.data.error_type)}))})}}),{setIsProcessing:w9e,setShouldConfirmOnDelete:x9e,setCurrentStatus:C9e,setIsCancelable:E9e,setEnableImageDebugging:T9e,addToast:Tn,clearToastQueue:A9e,cancelScheduled:k9e,scheduledCancelAborted:P9e,cancelTypeChanged:R9e,subscribedNodeIdsSet:I9e,consoleLogLevelChanged:O9e,shouldLogToConsoleChanged:M9e,isPersistedChanged:N9e,shouldAntialiasProgressImageChanged:D9e,languageChanged:L9e,progressImageSet:Lye,shouldUseNSFWCheckerChanged:$ye,shouldUseWatermarkerChanged:Fye}=FB.actions,Bye=FB.reducer,zye=os(kb,W$,X$),Uye={searchFolder:null,advancedAddScanModel:null},BB=nr({name:"modelmanager",initialState:Uye,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:$9e,setAdvancedAddScanModel:F9e}=BB.actions,jye=BB.reducer,zB={shift:!1,ctrl:!1,meta:!1},UB=nr({name:"hotkeys",initialState:zB,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:B9e,ctrlKeyPressed:z9e,metaKeyPressed:U9e}=UB.actions,Vye=UB.reducer,jB=["txt2img","img2img","unifiedCanvas","nodes","modelManager","batch"],R8=(e,t)=>{typeof t=="number"?e.activeTab=t:e.activeTab=jB.indexOf(t)},VB={activeTab:0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},GB=nr({name:"ui",initialState:VB,reducers:{setActiveTab:(e,t)=>{R8(e,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(D_,t=>{R8(t,"img2img")})}}),{setActiveTab:HB,setShouldShowImageDetails:j9e,setShouldUseCanvasBetaLayout:V9e,setShouldShowExistingModelsInSearch:G9e,setShouldUseSliders:H9e,setShouldHidePreview:q9e,setShouldShowProgressInViewer:W9e,favoriteSchedulersChanged:K9e,toggleEmbeddingPicker:X9e,setShouldAutoChangeDimensions:Q9e,contextMenusClosed:Y9e,panelsChanged:Z9e}=GB.actions,Gye=GB.reducer,Hye=Y1(Aq);qB=JC=void 0;var qye=Hye,Wye=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return qye.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,s=!1,a;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(s)throw a}}}}function KB(e,t){if(e){if(typeof e=="string")return O8(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 O8(e,t)}}function O8(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,s=r.persistWholeStore,a=r.serialize;try{var l=s?a0e:l0e;yield l(t,n,{prefix:i,driver:o,serialize:a})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function L8(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(u){n(u);return}a.done?t(l):Promise.resolve(l).then(r,i)}function $8(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(l){L8(o,r,i,s,a,"next",l)}function a(l){L8(o,r,i,s,a,"throw",l)}s(void 0)})}}var c0e=function(){var e=$8(function*(t,n,r){var i=r.prefix,o=r.driver,s=r.serialize,a=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield n0e(t,n,{prefix:i,driver:o,unserialize:a,persistWholeStore:c});var d={},f=function(){var h=$8(function*(){var p=WB(t.getState(),n);yield u0e(p,d,{prefix:i,driver:o,serialize:s,persistWholeStore:c}),yT(p,d)||t.dispatch({type:Yye,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(Jye(f,u)):t.subscribe(Zye(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const d0e=c0e;function Ug(e){"@babel/helpers - typeof";return Ug=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},Ug(e)}function F8(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 xw(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=xw({},r));var o=typeof t=="function"?t:rh(t);switch(i.type){case e3:{var s=xw(xw({},n.state),i.payload||{});return n.state=o(s,{type:e3,payload:s}),n.state}default:return o(r,i)}}},m0e=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,s=r.serialize,a=s===void 0?function(b,_){return JSON.stringify(b)}:s,l=r.unserialize,u=l===void 0?function(b,_){return JSON.parse(b)}: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(_){return function(y,g,v){var S=_(y,g,v);return d0e(S,n,{driver:t,prefix:o,serialize:a,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const J9e=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],y0e="@@invokeai-",v0e=["cursorPosition"],_0e=["pendingControlImages"],b0e=["selection","selectedBoardId","galleryView"],S0e=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy"],w0e=[],x0e=[],C0e=["currentIteration","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","totalIterations","totalSteps","isCancelScheduled","progressImage","wereModelsReceived","isPersisted","isUploading"],E0e=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],T0e={canvas:v0e,gallery:b0e,generation:w0e,nodes:S0e,postprocessing:x0e,system:C0e,ui:E0e,controlNet:_0e},A0e=(e,t)=>{const n=I_(e,T0e[t]??[]);return JSON.stringify(n)},k0e={canvas:bD,gallery:rF,generation:zs,nodes:IB,postprocessing:NB,system:$B,config:iD,ui:VB,hotkeys:zB,controlNet:DC},P0e=(e,t)=>cee(JSON.parse(e),k0e[t]),QB=Le("nodes/textToImageGraphBuilt"),YB=Le("nodes/imageToImageGraphBuilt"),ZB=Le("nodes/canvasGraphBuilt"),JB=Le("nodes/nodesGraphBuilt"),R0e=os(QB,YB,ZB,JB),I0e=Le("nodes/workflowLoadRequested"),O0e=e=>{if(R0e(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return zg.fulfilled.match(e)?{...e,payload:""}:MB.match(e)?{...e,payload:""}:e},M0e=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],N0e=e=>e,D0e=()=>{Te({actionCreator:Zne,effect:async(e,{dispatch:t,getState:n})=>{const r=ge("canvas"),i=n(),{sessionId:o,isProcessing:s}=i.system,a=e.payload;if(s){if(!a){r.debug("No canvas session, skipping cancel");return}if(a!==o){r.debug({canvasSessionId:a,session_id:o},"Canvas session does not match global session, skipping cancel");return}t(Iu({session_id:o}))}}})};Le("app/appStarted");const L0e=()=>{Te({matcher:pe.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Eo({board_id:"none",categories:Qr}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=Ln.getSelectors().selectAll(i)[0];t(ha(o??null))}}})},vT=_u.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5})})}),{useGetAppVersionQuery:eMe,useGetAppConfigQuery:tMe}=vT,$0e=()=>{Te({matcher:vT.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,s=t().generation.infillMethod;r.includes(s)||n(Pne(r[0])),i.includes("nsfw_checker")||n($ye(!1)),o.includes("invisible_watermark")||n(Fye(!1))}})},F0e=Le("app/appStarted"),B0e=()=>{Te({actionCreator:F0e,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},_T={memoizeOptions:{resultEqualityCheck:wm}},ez=(e,t)=>{var f,h;const{generation:n,canvas:r,nodes:i,controlNet:o}=e,s=((f=n.initialImage)==null?void 0:f.imageName)===t,a=r.layerState.objects.some(p=>p.kind==="image"&&p.imageName===t),l=i.nodes.filter(Kr).some(p=>wp(p.data.inputs,m=>{var b;return m.type==="ImageField"&&((b=m.value)==null?void 0:b.image_name)===t})),u=wp(o.controlNets,p=>p.controlImage===t||p.processedControlImage===t),c=((h=o.ipAdapterInfo.adapterImage)==null?void 0:h.image_name)===t;return{isInitialImage:s,isCanvasImage:a,isNodesImage:l,isControlNetImage:u,isIPAdapterImage:c}},z0e=Fi([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>ez(e,r.image_name)):[]},_T),U0e=()=>{Te({matcher:pe.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,s=!1,a=!1,l=!1;const u=n();r.forEach(c=>{const d=ez(u,c);d.isInitialImage&&!i&&(t(b5()),i=!0),d.isCanvasImage&&!o&&(t(S5()),o=!0),d.isNodesImage&&!s&&(t(Aye()),s=!0),d.isControlNetImage&&!a&&(t(Nde()),a=!0),d.isIPAdapterImage&&!l&&(t(J$()),l=!0)})}})},j0e=()=>{Te({matcher:os(LC,h1),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),s=LC.match(e)?e.payload:o.gallery.selectedBoardId,l=(h1.match(e)?e.payload:o.gallery.galleryView)==="images"?Qr:Gl,u={board_id:s??"none",categories:l};if(await r(()=>pe.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=pe.endpoints.listImages.select(u)(t());if(d){const f=f1.selectAll(d)[0];n(ha(f??null))}else n(ha(null))}else n(ha(null))}})},V0e=Le("canvas/canvasSavedToGallery"),G0e=Le("canvas/canvasMaskSavedToGallery"),H0e=Le("canvas/canvasCopiedToClipboard"),q0e=Le("canvas/canvasDownloadedAsImage"),W0e=Le("canvas/canvasMerged"),K0e=Le("canvas/stagingAreaImageSaved"),X0e=Le("canvas/canvasMaskToControlNet"),Q0e=Le("canvas/canvasImageToControlNet");let tz=null,nz=null;const nMe=e=>{tz=e},Fb=()=>tz,rMe=e=>{nz=e},Y0e=()=>nz,Z0e=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),E1=async(e,t)=>await Z0e(e.toCanvas(t)),Bb=async e=>{const t=Fb();if(!t)return;const{shouldCropToBoundingBoxOnSave:n,boundingBoxCoordinates:r,boundingBoxDimensions:i}=e.canvas,o=t.clone();o.scale({x:1,y:1});const s=o.getAbsolutePosition(),a=n?{x:r.x+s.x,y:r.y+s.y,width:i.width,height:i.height}:o.getClientRect();return E1(o,a)},J0e=e=>{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])},eve=()=>{Te({actionCreator:H0e,effect:async(e,{dispatch:t,getState:n})=>{const r=sb.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n(),o=await Bb(i);if(!o){r.error("Problem getting base layer blob"),t(Tn({title:J("toast.problemCopyingCanvas"),description:J("toast.problemCopyingCanvasDesc"),status:"error"}));return}J0e(o),t(Tn({title:J("toast.canvasCopiedClipboard"),status:"success"}))}})},tve=(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()},nve=()=>{Te({actionCreator:q0e,effect:async(e,{dispatch:t,getState:n})=>{const r=sb.get().child({namespace:"canvasSavedToGalleryListener"}),i=n(),o=await Bb(i);if(!o){r.error("Problem getting base layer blob"),t(Tn({title:J("toast.problemDownloadingCanvas"),description:J("toast.problemDownloadingCanvasDesc"),status:"error"}));return}tve(o,"canvas.png"),t(Tn({title:J("toast.canvasDownloaded"),status:"success"}))}})},rve=()=>{Te({actionCreator:Q0e,effect:async(e,{dispatch:t,getState:n})=>{const r=ge("canvas"),i=n(),o=await Bb(i);if(!o){r.error("Problem getting base layer blob"),t(Tn({title:J("toast.problemSavingCanvas"),description:J("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,a=await t(pe.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.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:J("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:l}=a;t(Qc({controlNetId:e.payload.controlNet.controlNetId,controlImage:l}))}})};var bT={exports:{}},zb={},rz={},At={};(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 dt<"u"?dt: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)})(At);var sr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=At;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),w=Math.sin(v),x=this.m[0]*S+this.m[2]*w,C=this.m[1]*S+this.m[3]*w,A=this.m[0]*-w+this.m[2]*S,T=this.m[1]*-w+this.m[3]*S;return this.m[0]=x,this.m[1]=C,this.m[2]=A,this.m[3]=T,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(v,S){var w=this.m[0]+this.m[2]*S,x=this.m[1]+this.m[3]*S,C=this.m[2]+this.m[0]*v,A=this.m[3]+this.m[1]*v;return this.m[0]=w,this.m[1]=x,this.m[2]=C,this.m[3]=A,this}multiply(v){var S=this.m[0]*v.m[0]+this.m[2]*v.m[1],w=this.m[1]*v.m[0]+this.m[3]*v.m[1],x=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],A=this.m[0]*v.m[4]+this.m[2]*v.m[5]+this.m[4],T=this.m[1]*v.m[4]+this.m[3]*v.m[5]+this.m[5];return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=A,this.m[5]=T,this}invert(){var v=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*v,w=-this.m[1]*v,x=-this.m[2]*v,C=this.m[0]*v,A=v*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),T=v*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=w,this.m[2]=x,this.m[3]=C,this.m[4]=A,this.m[5]=T,this}getMatrix(){return this.m}decompose(){var v=this.m[0],S=this.m[1],w=this.m[2],x=this.m[3],C=this.m[4],A=this.m[5],T=v*x-S*w;let k={x:C,y:A,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(v!=0||S!=0){var L=Math.sqrt(v*v+S*S);k.rotation=S>0?Math.acos(v/L):-Math.acos(v/L),k.scaleX=L,k.scaleY=T/L,k.skewX=(v*w+S*x)/T,k.skewY=0}else if(w!=0||x!=0){var N=Math.sqrt(w*w+x*x);k.rotation=Math.PI/2-(x>0?Math.acos(-w/N):-Math.acos(w/N)),k.scaleX=T/N,k.scaleY=N,k.skewX=0,k.skewY=(v*w+S*x)/T}return k.rotation=e.Util._getRotation(k.rotation),k}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",s="[object Boolean]",a=Math.PI/180,l=180/Math.PI,u="#",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]},b=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,_=[];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)===s},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){_.push(g),_.length===1&&y(function(){const v=_;_=[],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=b.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,w)=>S.slice(-1)==="%"?w===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),w=Number(S[0])/360,x=Number(S[1])/100,C=Number(S[2])/100;let A,T,k;if(x===0)return k=C*255,{r:Math.round(k),g:Math.round(k),b:Math.round(k),a:1};C<.5?A=C*(1+x):A=C+x-C*x;const L=2*C-A,N=[0,0,0];for(let E=0;E<3;E++)T=w+1/3*-(E-1),T<0&&T++,T>1&&T--,6*T<1?k=L+(A-L)*6*T:2*T<1?k=A:3*T<2?k=L+(A-L)*(2/3-T)*6:k=L,N[E]=k*255;return{r:Math.round(N[0]),g:Math.round(N[1]),b:Math.round(N[2]),a:1}}},haveIntersection(g,v){return!(v.x>g.x+g.width||v.x+v.widthg.y+g.height||v.y+v.height1?(A=S,T=w,k=(S-x)*(S-x)+(w-C)*(w-C)):(A=g+N*(S-g),T=v+N*(w-v),k=(A-x)*(A-x)+(T-C)*(T-C))}return[A,T,k]},_getProjectionToLine(g,v,S){var w=e.Util.cloneObject(g),x=Number.MAX_VALUE;return v.forEach(function(C,A){if(!(!S&&A===v.length-1)){var T=v[(A+1)%v.length],k=e.Util._getProjectionToSegment(C.x,C.y,T.x,T.y,g.x,g.y),L=k[0],N=k[1],E=k[2];Ev.length){var A=v;v=g,g=A}for(w=0;w{v.width=0,v.height=0})},drawRoundedRectPath(g,v,S,w){let x=0,C=0,A=0,T=0;typeof w=="number"?x=C=A=T=Math.min(w,v/2,S/2):(x=Math.min(w[0]||0,v/2,S/2),C=Math.min(w[1]||0,v/2,S/2),T=Math.min(w[2]||0,v/2,S/2),A=Math.min(w[3]||0,v/2,S/2)),g.moveTo(x,0),g.lineTo(v-C,0),g.arc(v-C,C,C,Math.PI*3/2,0,!1),g.lineTo(v,S-T),g.arc(v-T,S-T,T,0,Math.PI/2,!1),g.lineTo(A,S),g.arc(A,S-A,A,Math.PI/2,Math.PI,!1),g.lineTo(0,x),g.arc(x,x,x,Math.PI,Math.PI*3/2,!1)}}})(sr);var Qn={},Et={},We={};Object.defineProperty(We,"__esModule",{value:!0});We.getComponentValidator=We.getBooleanValidator=We.getNumberArrayValidator=We.getFunctionValidator=We.getStringOrGradientValidator=We.getStringValidator=We.getNumberOrAutoValidator=We.getNumberOrArrayOfNumbersValidator=We.getNumberValidator=We.alphaComponent=We.RGBComponent=void 0;const gl=At,fr=sr;function ml(e){return fr.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||fr.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function ive(e){return e>255?255:e<0?0:Math.round(e)}We.RGBComponent=ive;function ove(e){return e>1?1:e<1e-4?1e-4:e}We.alphaComponent=ove;function sve(){if(gl.Konva.isUnminified)return function(e,t){return fr.Util._isNumber(e)||fr.Util.warn(ml(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}We.getNumberValidator=sve;function ave(e){if(gl.Konva.isUnminified)return function(t,n){let r=fr.Util._isNumber(t),i=fr.Util._isArray(t)&&t.length==e;return!r&&!i&&fr.Util.warn(ml(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}We.getNumberOrArrayOfNumbersValidator=ave;function lve(){if(gl.Konva.isUnminified)return function(e,t){var n=fr.Util._isNumber(e),r=e==="auto";return n||r||fr.Util.warn(ml(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}We.getNumberOrAutoValidator=lve;function uve(){if(gl.Konva.isUnminified)return function(e,t){return fr.Util._isString(e)||fr.Util.warn(ml(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}We.getStringValidator=uve;function cve(){if(gl.Konva.isUnminified)return function(e,t){const n=fr.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||fr.Util.warn(ml(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}We.getStringOrGradientValidator=cve;function dve(){if(gl.Konva.isUnminified)return function(e,t){return fr.Util._isFunction(e)||fr.Util.warn(ml(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}We.getFunctionValidator=dve;function fve(){if(gl.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(fr.Util._isArray(e)?e.forEach(function(r){fr.Util._isNumber(r)||fr.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):fr.Util.warn(ml(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}We.getNumberArrayValidator=fve;function hve(){if(gl.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||fr.Util.warn(ml(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}We.getBooleanValidator=hve;function pve(e){if(gl.Konva.isUnminified)return function(t,n){return t==null||fr.Util.isObject(t)||fr.Util.warn(ml(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}We.getComponentValidator=pve;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=sr,n=We;var r="get",i="set";e.Factory={addGetterSetter(o,s,a,l,u){e.Factory.addGetter(o,s,a),e.Factory.addSetter(o,s,l,u),e.Factory.addOverloadedGetterSetter(o,s)},addGetter(o,s,a){var l=r+t.Util._capitalize(s);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[s];return u===void 0?a:u}},addSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]||e.Factory.overWriteSetter(o,s,a,l)},overWriteSetter(o,s,a,l){var u=i+t.Util._capitalize(s);o.prototype[u]=function(c){return a&&c!==void 0&&c!==null&&(c=a.call(this,c,s)),this._setAttr(s,c),l&&l.call(this),this}},addComponentsGetterSetter(o,s,a,l,u){var c=a.length,d=t.Util._capitalize,f=r+d(s),h=i+d(s),p,m;o.prototype[f]=function(){var _={};for(p=0;p{this._setAttr(s+d(v),void 0)}),this._fireChangeEvent(s,y,_),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,s)},addOverloadedGetterSetter(o,s){var a=t.Util._capitalize(s),l=i+a,u=r+a;o.prototype[s]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,s,a,l){t.Util.error("Adding deprecated "+s);var u=r+t.Util._capitalize(s),c=s+" 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[s];return d===void 0?a:d},e.Factory.addSetter(o,s,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,s)},backCompat(o,s){t.Util.each(s,function(a,l){var u=o.prototype[l],c=r+t.Util._capitalize(a),d=i+t.Util._capitalize(a);function f(){u.apply(this,arguments),t.Util.error('"'+a+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[a]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(Et);var Ns={},Ya={};Object.defineProperty(Ya,"__esModule",{value:!0});Ya.HitContext=Ya.SceneContext=Ya.Context=void 0;const iz=sr,gve=At;function mve(e){var t=[],n=e.length,r=iz.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=yve+u.join(B8)+vve)):(o+=a.property,t||(o+=xve+a.val)),o+=Sve;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=Eve&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,s){this._context.arc(t,n,r,i,o,s)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,s){this._context.bezierCurveTo(t,n,r,i,o,s)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,s){return this._context.createRadialGradient(t,n,r,i,o,s)}drawImage(t,n,r,i,o,s,a,l,u){var 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,s,a,l,u)}ellipse(t,n,r,i,o,s,a,l){this._context.ellipse(t,n,r,i,o,s,a,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,s){this._context.setTransform(t,n,r,i,o,s)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,s){this._context.transform(t,n,r,i,o,s)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=z8.length,r=this.setAttr,i,o,s=function(a){var l=t[a],u;t[a]=function(){return o=mve(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:a,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,s)=>{const{node:a}=o,l=a.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=a.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:s}=o,a=s.getStage();if(r&&a.setPointersPositions(r),!a._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))})(Vb);Object.defineProperty(Qn,"__esModule",{value:!0});Qn.Node=void 0;const It=sr,Bm=Et,Xy=Ns,Gu=At,jo=Vb,_r=We;var z0="absoluteOpacity",Qy="allEventListeners",La="absoluteTransform",U8="absoluteScale",Hu="canvas",Mve="Change",Nve="children",Dve="konva",n3="listening",j8="mouseenter",V8="mouseleave",G8="set",H8="Shape",U0=" ",q8="stage",Al="transform",Lve="Stage",r3="visible",$ve=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(U0);let Fve=1;class ut{constructor(t){this._id=Fve++,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===Al||t===La)&&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===Al||t===La,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(U0);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Hu)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===La&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Hu)){const{scene:t,filter:n,hit:r}=this._cache.get(Hu);It.Util.releaseCanvas(t,n,r),this._cache.delete(Hu)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){It.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,a-=u,l-=u;var f=new Xy.SceneCanvas({pixelRatio:s,width:i,height:o}),h=new Xy.SceneCanvas({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),p=new Xy.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),b=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(Hu),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),b.save(),m.translate(-a,-l),b.translate(-a,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(z0),this._clearSelfAndDescendantCache(U8),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),b.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(Hu,{scene:f,filter:h,hit:p,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Hu)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,s,a,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),{x:i,y:o,width:s-i,height:a-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),s,a,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),a=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==Nve&&(r=G8+It.Util._capitalize(n),It.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(n3,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(r3,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;jo.DD._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var o=!n&&!Gu.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,s,a;function l(u){for(i=[],o=u.length,s=0;s0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==Lve&&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(Al),this._clearSelfAndDescendantCache(La)),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 It.Transform,s=this.offset();return o.m=i.slice(),o.translate(s.x,s.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(Al);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(Al),this._clearSelfAndDescendantCache(La),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,s=0;s0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return It.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 It.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&It.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(z0,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,s,a;t.attrs={};for(r in n)i=n[r],a=It.Util.isObject(i)&&!It.Util._isPlainObject(i)&&!It.Util._isArray(i),!a&&(o=typeof this[r]=="function"&&this[r],delete n[r],s=o?o.call(this):null,n[r]=i,s!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),It.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,It.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():Gu.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,s,a;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;jo.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=jo.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&jo.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 It.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return It.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=ut.prototype.getClassName.call(t),i=t.children,o,s,a;n&&(t.attrs.container=n),Gu.Konva[r]||(It.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Gu.Konva[r];if(o=new l(t.attrs),i)for(s=i.length,a=0;a0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=Cw.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=Cw.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(a){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.hit;if(a){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=s&&a||l;const 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 b;if(l)b=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,s,a)}o.clip.apply(o,b),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(b){b[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,s,a,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var b=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});b.width===0&&b.height===0||(o===void 0?(o=b.x,s=b.y,a=b.x+b.width,l=b.y+b.height):(o=Math.min(o,b.x),s=Math.min(s,b.y),a=Math.max(a,b.x+b.width),l=Math.max(l,b.y+b.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hQ.indexOf("pointer")>=0?"pointer":Q.indexOf("touch")>=0?"touch":"mouse",U=Q=>{const j=F(Q);if(j==="pointer")return i.Konva.pointerEventsEnabled&&O.pointer;if(j==="touch")return O.touch;if(j==="mouse")return O.mouse};function V(Q={}){return(Q.clipFunc||Q.clipWidth||Q.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),Q}const H="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 Y extends r.Container{constructor(j){super(V(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",()=>{V(this.attrs)}),this._checkVisibility()}_validateAdd(j){const K=j.getType()==="Layer",te=j.getType()==="FastLayer";K||te||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 K=j.slice(1);j=document.getElementsByClassName(K)[0]}else{var te;j.charAt(0)!=="#"?te=j:te=j.slice(1),j=document.getElementById(te)}if(!j)throw"Can not find container in document with id "+te}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,K=j.length,te;for(te=0;te-1&&e.stages.splice(K,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(H),null)}_getPointerById(j){return this._pointerPositions.find(K=>K.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 K=new o.SceneCanvas({width:j.width,height:j.height,pixelRatio:j.pixelRatio||1}),te=K.getContext()._context,oe=this.children;return(j.x||j.y)&&te.translate(-1*j.x,-1*j.y),oe.forEach(function(me){if(me.isVisible()){var le=me._toKonvaCanvas(j);te.drawImage(le._canvas,j.x,j.y,le.getWidth()/le.getPixelRatio(),le.getHeight()/le.getPixelRatio())}}),K}getIntersection(j){if(!j)return null;var K=this.children,te=K.length,oe=te-1,me;for(me=oe;me>=0;me--){const le=K[me].getIntersection(j);if(le)return le}return null}_resizeDOM(){var j=this.width(),K=this.height();this.content&&(this.content.style.width=j+d,this.content.style.height=K+d),this.bufferCanvas.setSize(j,K),this.bufferHitCanvas.setSize(j,K),this.children.forEach(te=>{te.setSize({width:j,height:K}),te.draw()})}add(j,...K){if(arguments.length>1){for(var te=0;teR&&t.Util.warn("The stage has "+oe+" 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&&I.forEach(([j,K])=>{this.content.addEventListener(j,te=>{this[K](te)},{passive:!1})})}_pointerenter(j){this.setPointersPositions(j);const K=U(j.type);this._fire(K.pointerenter,{evt:j,target:this,currentTarget:this})}_pointerover(j){this.setPointersPositions(j);const K=U(j.type);this._fire(K.pointerover,{evt:j,target:this,currentTarget:this})}_getTargetShape(j){let K=this[j+"targetShape"];return K&&!K.getStage()&&(K=null),K}_pointerleave(j){const K=U(j.type),te=F(j.type);if(K){this.setPointersPositions(j);var oe=this._getTargetShape(te),me=!s.DD.isDragging||i.Konva.hitOnDragEnabled;oe&&me?(oe._fireAndBubble(K.pointerout,{evt:j}),oe._fireAndBubble(K.pointerleave,{evt:j}),this._fire(K.pointerleave,{evt:j,target:this,currentTarget:this}),this[te+"targetShape"]=null):me&&(this._fire(K.pointerleave,{evt:j,target:this,currentTarget:this}),this._fire(K.pointerout,{evt:j,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(j){const K=U(j.type),te=F(j.type);if(K){this.setPointersPositions(j);var oe=!1;this._changedPointerPositions.forEach(me=>{var le=this.getIntersection(me);if(s.DD.justDragged=!1,i.Konva["_"+te+"ListenClick"]=!0,!(le&&le.isListening()))return;i.Konva.capturePointerEventsEnabled&&le.setPointerCapture(me.id),this[te+"ClickStartShape"]=le,le._fireAndBubble(K.pointerdown,{evt:j,pointerId:me.id}),oe=!0;const nt=j.type.indexOf("touch")>=0;le.preventDefault()&&j.cancelable&&nt&&j.preventDefault()}),oe||this._fire(K.pointerdown,{evt:j,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(j){const K=U(j.type),te=F(j.type);if(!K)return;s.DD.isDragging&&s.DD.node.preventDefault()&&j.cancelable&&j.preventDefault(),this.setPointersPositions(j);var oe=!s.DD.isDragging||i.Konva.hitOnDragEnabled;if(!oe)return;var me={};let le=!1;var ht=this._getTargetShape(te);this._changedPointerPositions.forEach(nt=>{const $e=l.getCapturedShape(nt.id)||this.getIntersection(nt),ct=nt.id,Pe={evt:j,pointerId:ct};var qt=ht!==$e;if(qt&&ht&&(ht._fireAndBubble(K.pointerout,Object.assign({},Pe),$e),ht._fireAndBubble(K.pointerleave,Object.assign({},Pe),$e)),$e){if(me[$e._id])return;me[$e._id]=!0}$e&&$e.isListening()?(le=!0,qt&&($e._fireAndBubble(K.pointerover,Object.assign({},Pe),ht),$e._fireAndBubble(K.pointerenter,Object.assign({},Pe),ht),this[te+"targetShape"]=$e),$e._fireAndBubble(K.pointermove,Object.assign({},Pe))):ht&&(this._fire(K.pointerover,{evt:j,target:this,currentTarget:this,pointerId:ct}),this[te+"targetShape"]=null)}),le||this._fire(K.pointermove,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(j){const K=U(j.type),te=F(j.type);if(!K)return;this.setPointersPositions(j);const oe=this[te+"ClickStartShape"],me=this[te+"ClickEndShape"];var le={};let ht=!1;this._changedPointerPositions.forEach(nt=>{const $e=l.getCapturedShape(nt.id)||this.getIntersection(nt);if($e){if($e.releaseCapture(nt.id),le[$e._id])return;le[$e._id]=!0}const ct=nt.id,Pe={evt:j,pointerId:ct};let qt=!1;i.Konva["_"+te+"InDblClickWindow"]?(qt=!0,clearTimeout(this[te+"DblTimeout"])):s.DD.justDragged||(i.Konva["_"+te+"InDblClickWindow"]=!0,clearTimeout(this[te+"DblTimeout"])),this[te+"DblTimeout"]=setTimeout(function(){i.Konva["_"+te+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),$e&&$e.isListening()?(ht=!0,this[te+"ClickEndShape"]=$e,$e._fireAndBubble(K.pointerup,Object.assign({},Pe)),i.Konva["_"+te+"ListenClick"]&&oe&&oe===$e&&($e._fireAndBubble(K.pointerclick,Object.assign({},Pe)),qt&&me&&me===$e&&$e._fireAndBubble(K.pointerdblclick,Object.assign({},Pe)))):(this[te+"ClickEndShape"]=null,i.Konva["_"+te+"ListenClick"]&&this._fire(K.pointerclick,{evt:j,target:this,currentTarget:this,pointerId:ct}),qt&&this._fire(K.pointerdblclick,{evt:j,target:this,currentTarget:this,pointerId:ct}))}),ht||this._fire(K.pointerup,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+te+"ListenClick"]=!1,j.cancelable&&te!=="touch"&&j.preventDefault()}_contextmenu(j){this.setPointersPositions(j);var K=this.getIntersection(this.getPointerPosition());K&&K.isListening()?K._fireAndBubble(L,{evt:j}):this._fire(L,{evt:j,target:this,currentTarget:this})}_wheel(j){this.setPointersPositions(j);var K=this.getIntersection(this.getPointerPosition());K&&K.isListening()?K._fireAndBubble(B,{evt:j}):this._fire(B,{evt:j,target:this,currentTarget:this})}_pointercancel(j){this.setPointersPositions(j);const K=l.getCapturedShape(j.pointerId)||this.getIntersection(this.getPointerPosition());K&&K._fireAndBubble(S,l.createEvent(j)),l.releaseCapture(j.pointerId)}_lostpointercapture(j){l.releaseCapture(j.pointerId)}setPointersPositions(j){var K=this._getContentPosition(),te=null,oe=null;j=j||window.event,j.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(j.touches,me=>{this._pointerPositions.push({id:me.identifier,x:(me.clientX-K.left)/K.scaleX,y:(me.clientY-K.top)/K.scaleY})}),Array.prototype.forEach.call(j.changedTouches||j.touches,me=>{this._changedPointerPositions.push({id:me.identifier,x:(me.clientX-K.left)/K.scaleX,y:(me.clientY-K.top)/K.scaleY})})):(te=(j.clientX-K.left)/K.scaleX,oe=(j.clientY-K.top)/K.scaleY,this.pointerPos={x:te,y:oe},this._pointerPositions=[{x:te,y:oe,id:t.Util._getFirstPointerId(j)}],this._changedPointerPositions=[{x:te,y:oe,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=Y,Y.prototype.nodeType=u,(0,a._registerNode)(Y),n.Factory.addGetterSetter(Y,"container")})(az);var zm={},jr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=At,n=sr,r=Et,i=Qn,o=We,s=At,a=ko;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(A){const T=this.attrs.fillRule;T?A.fill(T):A.fill()}function b(A){A.stroke()}function _(A){A.fill()}function y(A){A.stroke()}function g(){this._clearCache(l)}function v(){this._clearCache(u)}function S(){this._clearCache(c)}function w(){this._clearCache(d)}function x(){this._clearCache(f)}class C extends i.Node{constructor(T){super(T);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 T=p();const k=T.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(k&&k.setTransform){const L=new n.Transform;L.translate(this.fillPatternX(),this.fillPatternY()),L.rotate(t.Konva.getAngle(this.fillPatternRotation())),L.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),L.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const N=L.getMatrix(),E=typeof DOMMatrix>"u"?{a:N[0],b:N[1],c:N[2],d:N[3],e:N[4],f:N[5]}:new DOMMatrix(N);k.setTransform(E)}return k}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var T=this.fillLinearGradientColorStops();if(T){for(var k=p(),L=this.fillLinearGradientStartPoint(),N=this.fillLinearGradientEndPoint(),E=k.createLinearGradient(L.x,L.y,N.x,N.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 T=this.hitStrokeWidth();return T==="auto"?this.hasStroke():this.strokeEnabled()&&!!T}intersects(T){var k=this.getStage(),L=k.bufferHitCanvas,N;return L.getContext().clear(),this.drawHit(L,null,!0),N=L.context.getImageData(Math.round(T.x),Math.round(T.y),1,1).data,N[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(T){var k;if(!this.getStage()||!((k=this.attrs.perfectDrawEnabled)!==null&&k!==void 0?k:!0))return!1;const N=T||this.hasFill(),E=this.hasStroke(),P=this.getAbsoluteOpacity()!==1;if(N&&E&&P)return!0;const D=this.hasShadow(),B=this.shadowForStrokeEnabled();return!!(N&&E&&D&&B)}setStrokeHitEnabled(T){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),T?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var T=this.size();return{x:this._centroid?-T.width/2:0,y:this._centroid?-T.height/2:0,width:T.width,height:T.height}}getClientRect(T={}){const k=T.skipTransform,L=T.relativeTo,N=this.getSelfRect(),P=!T.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,D=N.width+P,B=N.height+P,R=!T.skipShadow&&this.hasShadow(),I=R?this.shadowOffsetX():0,O=R?this.shadowOffsetY():0,F=D+Math.abs(I),U=B+Math.abs(O),V=R&&this.shadowBlur()||0,H=F+V*2,Y=U+V*2,Q={width:H,height:Y,x:-(P/2+V)+Math.min(I,0)+N.x,y:-(P/2+V)+Math.min(O,0)+N.y};return k?Q:this._transformedRect(Q,L)}drawScene(T,k){var L=this.getLayer(),N=T||L.getCanvas(),E=N.getContext(),P=this._getCanvasCache(),D=this.getSceneFunc(),B=this.hasShadow(),R,I,O,F=N.isCache,U=k===this;if(!this.isVisible()&&!U)return this;if(P){E.save();var V=this.getAbsoluteTransform(k).getMatrix();return E.transform(V[0],V[1],V[2],V[3],V[4],V[5]),this._drawCachedSceneCanvas(E),E.restore(),this}if(!D)return this;if(E.save(),this._useBufferCanvas()&&!F){R=this.getStage(),I=R.bufferCanvas,O=I.getContext(),O.clear(),O.save(),O._applyLineJoin(this);var H=this.getAbsoluteTransform(k).getMatrix();O.transform(H[0],H[1],H[2],H[3],H[4],H[5]),D.call(this,O,this),O.restore();var Y=I.pixelRatio;B&&E._applyShadow(this),E._applyOpacity(this),E._applyGlobalCompositeOperation(this),E.drawImage(I._canvas,0,0,I.width/Y,I.height/Y)}else{if(E._applyLineJoin(this),!U){var H=this.getAbsoluteTransform(k).getMatrix();E.transform(H[0],H[1],H[2],H[3],H[4],H[5]),E._applyOpacity(this),E._applyGlobalCompositeOperation(this)}B&&E._applyShadow(this),D.call(this,E,this)}return E.restore(),this}drawHit(T,k,L=!1){if(!this.shouldDrawHit(k,L))return this;var N=this.getLayer(),E=T||N.hitCanvas,P=E&&E.getContext(),D=this.hitFunc()||this.sceneFunc(),B=this._getCanvasCache(),R=B&&B.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()"),R){P.save();var I=this.getAbsoluteTransform(k).getMatrix();return P.transform(I[0],I[1],I[2],I[3],I[4],I[5]),this._drawCachedHitCanvas(P),P.restore(),this}if(!D)return this;if(P.save(),P._applyLineJoin(this),!(this===k)){var F=this.getAbsoluteTransform(k).getMatrix();P.transform(F[0],F[1],F[2],F[3],F[4],F[5])}return D.call(this,P,this),P.restore(),this}drawHitFromCache(T=0){var k=this._getCanvasCache(),L=this._getCachedSceneCanvas(),N=k.hit,E=N.getContext(),P=N.getWidth(),D=N.getHeight(),B,R,I,O,F,U;E.clear(),E.drawImage(L._canvas,0,0,P,D);try{for(B=E.getImageData(0,0,P,D),R=B.data,I=R.length,O=n.Util._hexToRgb(this.colorKey),F=0;FT?(R[F]=O.r,R[F+1]=O.g,R[F+2]=O.b,R[F+3]=255):R[F+3]=0;E.putImageData(B,0,0)}catch(V){n.Util.error("Unable to draw hit graph from cached scene canvas. "+V.message)}return this}hasPointerCapture(T){return a.hasPointerCapture(T,this)}setPointerCapture(T){a.setPointerCapture(T,this)}releaseCapture(T){a.releaseCapture(T,this)}}e.Shape=C,C.prototype._fillFunc=m,C.prototype._strokeFunc=b,C.prototype._fillFuncHit=_,C.prototype._strokeFuncHit=y,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,s._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",w),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",x),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"})})(jr);Object.defineProperty(zm,"__esModule",{value:!0});zm.Layer=void 0;const Oa=sr,Ew=Yc,xd=Qn,wT=Et,W8=Ns,Vve=We,Gve=jr,Hve=At;var qve="#",Wve="beforeDraw",Kve="draw",cz=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Xve=cz.length;class fh extends Ew.Container{constructor(t){super(t),this.canvas=new W8.SceneCanvas,this.hitCanvas=new W8.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(Wve,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Ew.Container.prototype.drawScene.call(this,i,n),this._fire(Kve,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Ew.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){Oa.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return Oa.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 Oa.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}zm.Layer=fh;fh.prototype.nodeType="Layer";(0,Hve._registerNode)(fh);wT.Factory.addGetterSetter(fh,"imageSmoothingEnabled",!0);wT.Factory.addGetterSetter(fh,"clearBeforeDraw",!0);wT.Factory.addGetterSetter(fh,"hitGraphEnabled",!0,(0,Vve.getBooleanValidator)());var Hb={};Object.defineProperty(Hb,"__esModule",{value:!0});Hb.FastLayer=void 0;const Qve=sr,Yve=zm,Zve=At;class xT extends Yve.Layer{constructor(t){super(t),this.listening(!1),Qve.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Hb.FastLayer=xT;xT.prototype.nodeType="FastLayer";(0,Zve._registerNode)(xT);var hh={};Object.defineProperty(hh,"__esModule",{value:!0});hh.Group=void 0;const Jve=sr,e1e=Yc,t1e=At;class CT extends e1e.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&Jve.Util.throw("You may only add groups and shapes to groups.")}}hh.Group=CT;CT.prototype.nodeType="Group";(0,t1e._registerNode)(CT);var ph={};Object.defineProperty(ph,"__esModule",{value:!0});ph.Animation=void 0;const Tw=At,K8=sr;var Aw=function(){return Tw.glob.performance&&Tw.glob.performance.now?function(){return Tw.glob.performance.now()}:function(){return new Date().getTime()}}();class na{constructor(t,n){this.id=na.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Aw(),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=a,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(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===a?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=s,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,b=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=b,this._id=u++;var w=b.getLayer()||(b instanceof i.Konva.Stage?b.getLayers():null);w||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()},w),this.tween=new d(S,function(x){m._tweenFunc(x)},g,0,1,y*1e3,v),this._addListeners(),f.attrs[_]||(f.attrs[_]={}),f.attrs[_][this._id]||(f.attrs[_][this._id]={}),f.tweens[_]||(f.tweens[_]={});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 b=this.node,_=b._id,y,g,v,S,w,x,C,A;if(v=f.tweens[_][p],v&&delete f.attrs[_][v][p],y=b.getAttr(p),t.Util._isArray(m))if(g=[],w=Math.max(m.length,y.length),p==="points"&&m.length!==y.length&&(m.length>y.length?(C=y,y=t.Util._prepareArrayForTween(y,m,b.closed())):(x=m,m=t.Util._prepareArrayForTween(m,y,b.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,b=f.tweens[p],_;this.pause();for(_ in b)delete f.tweens[p][_];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,b){var _=1.70158;return m*(h/=b)*h*((_+1)*h-_)+p},BackEaseOut(h,p,m,b){var _=1.70158;return m*((h=h/b-1)*h*((_+1)*h+_)+1)+p},BackEaseInOut(h,p,m,b){var _=1.70158;return(h/=b/2)<1?m/2*(h*h*(((_*=1.525)+1)*h-_))+p:m/2*((h-=2)*h*(((_*=1.525)+1)*h+_)+2)+p},ElasticEaseIn(h,p,m,b,_,y){var g=0;return h===0?p:(h/=b)===1?p+m:(y||(y=b*.3),!_||_0?t:n),c=s*n,d=a*(a>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}qb.Arc=yl;yl.prototype._centroid=!0;yl.prototype.className="Arc";yl.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,r1e._registerNode)(yl);Wb.Factory.addGetterSetter(yl,"innerRadius",0,(0,Kb.getNumberValidator)());Wb.Factory.addGetterSetter(yl,"outerRadius",0,(0,Kb.getNumberValidator)());Wb.Factory.addGetterSetter(yl,"angle",0,(0,Kb.getNumberValidator)());Wb.Factory.addGetterSetter(yl,"clockwise",!1,(0,Kb.getBooleanValidator)());var Xb={},Um={};Object.defineProperty(Um,"__esModule",{value:!0});Um.Line=void 0;const Qb=Et,i1e=jr,fz=We,o1e=At;function i3(e,t,n,r,i,o,s){var a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=s*a/(a+l),c=s*l/(a+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 Q8(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(a=this.getTensionPoints(),l=a.length,u=o?0:4,o||t.quadraticCurveTo(a[0],a[1],a[2],a[3]);u{let u,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(s,a,d);return u*c};e.getCubicArcLength=t;const n=(s,a,l)=>{l===void 0&&(l=1);const u=s[0]-2*s[1]+s[2],c=a[0]-2*a[1]+a[2],d=2*s[1]-2*s[0],f=2*a[1]-2*a[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(s[2]-s[0],2)+Math.pow(a[2]-a[0],2));const b=p/(2*h),_=m/h,y=l+b,g=_-b*b,v=y*y+g>0?Math.sqrt(y*y+g):0,S=b*b+g>0?Math.sqrt(b*b+g):0,w=b+Math.sqrt(b*b+g)!==0?g*Math.log(Math.abs((y+v)/(b+S))):0;return Math.sqrt(h)/2*(y*v-b*S+w)};e.getQuadraticArcLength=n;function r(s,a,l){const u=i(1,l,s),c=i(1,l,a),d=u*u+c*c;return Math.sqrt(d)}const i=(s,a,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(s===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-a,u-f)*Math.pow(a,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=s/a,d=(s-l(c))/a,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(s-h)/a;if(p500)break}return c};e.t2length=o})(hz);Object.defineProperty(gh,"__esModule",{value:!0});gh.Path=void 0;const s1e=Et,a1e=jr,l1e=At,Cd=hz;class Dr extends a1e.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Dr.parsePathData(this.data()),this.pathLength=Dr.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,b=u>c?1:u/c,_=u>c?c/u:1;t.translate(a,l),t.rotate(h),t.scale(b,_),t.arc(0,0,m,d,d+f,1-p),t.scale(1/b,1/_),t.rotate(-h),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var 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=Dr.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 s=n[i],a=s.points;switch(s.command){case"L":return Dr.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return Dr.getPointOnCubicBezier((0,Cd.t2length)(t,Dr.getPathLength(n),m=>(0,Cd.getCubicArcLength)([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],m)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return Dr.getPointOnQuadraticBezier((0,Cd.t2length)(t,Dr.getPathLength(n),m=>(0,Cd.getQuadraticArcLength)([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],m)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":var l=a[0],u=a[1],c=a[2],d=a[3],f=a[4],h=a[5],p=a[6];return f+=h*t/s.pathLength,Dr.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,s,a){s===void 0&&(s=n),a===void 0&&(a=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var y=null,g=[],v=l,S=u,w,x,C,A,T,k,L,N,E,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(),B=p.shift();if(l+=D,u+=B,y="M",s.length>2&&s[s.length-1].command==="z"){for(var R=s.length-2;R>=0;R--)if(s[R].command==="M"){l=s[R].points[0]+D,u=s[R].points[1]+B;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":x=l,C=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),y="C",g.push(l,u);break;case"s":x=l,C=u,w=s[s.length-1],w.command==="C"&&(x=l+(l-w.points[2]),C=u+(u-w.points[3])),g.push(x,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":x=l,C=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l=p.shift(),u=p.shift(),y="Q",g.push(x,C,l,u);break;case"t":x=l,C=u,w=s[s.length-1],w.command==="Q"&&(x=l+(l-w.points[0]),C=u+(u-w.points[1])),l+=p.shift(),u+=p.shift(),y="Q",g.push(x,C,l,u);break;case"A":A=p.shift(),T=p.shift(),k=p.shift(),L=p.shift(),N=p.shift(),E=l,P=u,l=p.shift(),u=p.shift(),y="A",g=this.convertEndpointToCenterParameterization(E,P,l,u,L,N,A,T,k);break;case"a":A=p.shift(),T=p.shift(),k=p.shift(),L=p.shift(),N=p.shift(),E=l,P=u,l+=p.shift(),u+=p.shift(),y="A",g=this.convertEndpointToCenterParameterization(E,P,l,u,L,N,A,T,k);break}s.push({command:y||h,points:g,start:{x:v,y:S},pathLength:this.calcLength(v,S,y||h,g)})}(h==="z"||h==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(t,n,r,i){var o,s,a,l,u=Dr;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,Cd.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,Cd.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)a=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=c+h;l1&&(a*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((a*a*(l*l)-a*a*(f*f)-l*l*(d*d))/(a*a*(f*f)+l*l*(d*d)));o===s&&(p*=-1),isNaN(p)&&(p=0);var m=p*a*f/l,b=p*-l*d/a,_=(t+r)/2+Math.cos(c)*m-Math.sin(c)*b,y=(n+i)/2+Math.sin(c)*m+Math.cos(c)*b,g=function(T){return Math.sqrt(T[0]*T[0]+T[1]*T[1])},v=function(T,k){return(T[0]*k[0]+T[1]*k[1])/(g(T)*g(k))},S=function(T,k){return(T[0]*k[1]=1&&(A=0),s===0&&A>0&&(A=A-2*Math.PI),s===1&&A<0&&(A=A+2*Math.PI),[_,y,a,l,w,A,c,s]}}gh.Path=Dr;Dr.prototype.className="Path";Dr.prototype._attrsAffectingSize=["data"];(0,l1e._registerNode)(Dr);s1e.Factory.addGetterSetter(Dr,"data");Object.defineProperty(Xb,"__esModule",{value:!0});Xb.Arrow=void 0;const Yb=Et,u1e=Um,pz=We,c1e=At,Y8=gh;class Jc extends u1e.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var s=this.pointerLength(),a=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[a-2],r[a-1]],h=Y8.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=Y8.Path.getPointOnQuadraticBezier(Math.min(1,1-s/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[a-2]-p.x,u=r[a-1]-p.y}else l=r[a-2]-r[a-4],u=r[a-1]-r[a-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[a-2],r[a-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-s,d/2),t.lineTo(-s,-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(-s,d/2),t.lineTo(-s,-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}}}Xb.Arrow=Jc;Jc.prototype.className="Arrow";(0,c1e._registerNode)(Jc);Yb.Factory.addGetterSetter(Jc,"pointerLength",10,(0,pz.getNumberValidator)());Yb.Factory.addGetterSetter(Jc,"pointerWidth",10,(0,pz.getNumberValidator)());Yb.Factory.addGetterSetter(Jc,"pointerAtBeginning",!1);Yb.Factory.addGetterSetter(Jc,"pointerAtEnding",!0);var Zb={};Object.defineProperty(Zb,"__esModule",{value:!0});Zb.Circle=void 0;const d1e=Et,f1e=jr,h1e=We,p1e=At;let mh=class extends f1e.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)}};Zb.Circle=mh;mh.prototype._centroid=!0;mh.prototype.className="Circle";mh.prototype._attrsAffectingSize=["radius"];(0,p1e._registerNode)(mh);d1e.Factory.addGetterSetter(mh,"radius",0,(0,h1e.getNumberValidator)());var Jb={};Object.defineProperty(Jb,"__esModule",{value:!0});Jb.Ellipse=void 0;const ET=Et,g1e=jr,gz=We,m1e=At;class Nu extends g1e.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)}}Jb.Ellipse=Nu;Nu.prototype.className="Ellipse";Nu.prototype._centroid=!0;Nu.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,m1e._registerNode)(Nu);ET.Factory.addComponentsGetterSetter(Nu,"radius",["x","y"]);ET.Factory.addGetterSetter(Nu,"radiusX",0,(0,gz.getNumberValidator)());ET.Factory.addGetterSetter(Nu,"radiusY",0,(0,gz.getNumberValidator)());var eS={};Object.defineProperty(eS,"__esModule",{value:!0});eS.Image=void 0;const kw=sr,ed=Et,y1e=jr,v1e=At,jm=We;let Ca=class mz extends y1e.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let s;if(o){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[o,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?kw.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?kw.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=kw.Util.createImageElement();i.onload=function(){var o=new mz({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};eS.Image=Ca;Ca.prototype.className="Image";(0,v1e._registerNode)(Ca);ed.Factory.addGetterSetter(Ca,"cornerRadius",0,(0,jm.getNumberOrArrayOfNumbersValidator)(4));ed.Factory.addGetterSetter(Ca,"image");ed.Factory.addComponentsGetterSetter(Ca,"crop",["x","y","width","height"]);ed.Factory.addGetterSetter(Ca,"cropX",0,(0,jm.getNumberValidator)());ed.Factory.addGetterSetter(Ca,"cropY",0,(0,jm.getNumberValidator)());ed.Factory.addGetterSetter(Ca,"cropWidth",0,(0,jm.getNumberValidator)());ed.Factory.addGetterSetter(Ca,"cropHeight",0,(0,jm.getNumberValidator)());var Kf={};Object.defineProperty(Kf,"__esModule",{value:!0});Kf.Tag=Kf.Label=void 0;const tS=Et,_1e=jr,b1e=hh,TT=We,yz=At;var vz=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],S1e="Change.konva",w1e="none",o3="up",s3="right",a3="down",l3="left",x1e=vz.length;class AT extends b1e.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,s.x),r=Math.max(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}rS.RegularPolygon=nd;nd.prototype.className="RegularPolygon";nd.prototype._centroid=!0;nd.prototype._attrsAffectingSize=["radius"];(0,R1e._registerNode)(nd);_z.Factory.addGetterSetter(nd,"radius",0,(0,bz.getNumberValidator)());_z.Factory.addGetterSetter(nd,"sides",0,(0,bz.getNumberValidator)());var iS={};Object.defineProperty(iS,"__esModule",{value:!0});iS.Ring=void 0;const Sz=Et,I1e=jr,wz=We,O1e=At;var Z8=Math.PI*2;class rd extends I1e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,Z8,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),Z8,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)}}iS.Ring=rd;rd.prototype.className="Ring";rd.prototype._centroid=!0;rd.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,O1e._registerNode)(rd);Sz.Factory.addGetterSetter(rd,"innerRadius",0,(0,wz.getNumberValidator)());Sz.Factory.addGetterSetter(rd,"outerRadius",0,(0,wz.getNumberValidator)());var oS={};Object.defineProperty(oS,"__esModule",{value:!0});oS.Sprite=void 0;const id=Et,M1e=jr,N1e=ph,xz=We,D1e=At;class Ea extends M1e.Shape{constructor(t){super(t),this._updated=!0,this.anim=new N1e.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+0],l=o[i+1],u=o[i+2],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(s){var f=s[n],h=r*2;t.drawImage(d,a,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,a,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],s=this.frameOffsets(),a=o[i+2],l=o[i+3];if(t.beginPath(),s){var u=s[n],c=r*2;t.rect(u[c+0],u[c+1],a,l)}else t.rect(0,0,a,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Zy;function Rw(){return Zy||(Zy=u3.Util.createCanvasElement().getContext(j1e),Zy)}function J1e(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function e_e(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function t_e(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}let br=class extends F1e.Shape{constructor(t){super(t_e(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(_+=s)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=u3.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(V1e,n),this}getWidth(){var t=this.attrs.width===Ed||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===Ed||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 u3.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=Rw(),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()+Yy+this.fontVariant()+Yy+(this.fontSize()+W1e)+Z1e(this.fontFamily())}_addTextLine(t){this.align()===Vh&&(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 Rw().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` `),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,s=this.attrs.height,a=o!==Ed&&o!==void 0,l=s!==Ed&&s!==void 0,u=this.padding(),c=o-u*2,d=s-u*2,f=0,h=this.wrap(),p=h!==tR,m=h!==Q1e&&p,b=this.ellipsis();this.textArr=[],Rw().font=this._getContextFont();for(var _=b?this._getTextWidth(Pw):0,y=0,g=t.length;yc)for(;v.length>0;){for(var w=0,x=v.length,C="",A=0;w>>1,k=v.slice(0,T+1),L=this._getTextWidth(k)+_;L<=c?(w=T+1,C=k,A=L):x=T}if(C){if(m){var N,E=v[C.length],P=E===Yy||E===J8;P&&A<=c?N=C.length:N=Math.max(C.lastIndexOf(Yy),C.lastIndexOf(J8))+1,N>0&&(w=N,C=C.slice(0,w),A=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,A),f+=i;var D=this._shouldHandleEllipsis(f);if(D){this._tryToAddEllipsisToLastLine();break}if(v=v.slice(w),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!==Ed&&i!==void 0,s=this.padding(),a=i-s*2,l=this.wrap(),u=l!==tR;return!u||o&&t+r>a}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==Ed&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!o)){if(n){var a=this._getTextWidth(s.text+Pw)n?null:Gh.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=Gh.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var s=0;s=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${Oz}`).join(" "),iR="nodesRect",u_e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],c_e={"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 d_e="ontouchstart"in vs.Konva._global;function f_e(e,t){if(e==="rotater")return"crosshair";t+=gn.Util.degToRad(c_e[e]||0);var n=(gn.Util.radToDeg(t)%360+360)%360;return gn.Util._inRange(n,315+22.5,360)||gn.Util._inRange(n,0,22.5)?"ns-resize":gn.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":gn.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":gn.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":gn.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":gn.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":gn.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":gn.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(gn.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var A1=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],oR=1e8;function h_e(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 Mz(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 p_e(e,t){const n=h_e(e);return Mz(e,t,n)}function g_e(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(gn.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},s=i._attrsAffectingSize.map(a=>a+"Change."+this._getEventNamespace()).join(" ");i.on(s,o),i.on(u_e.map(a=>a+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,s=i.y-n.y;this.nodes().forEach(a=>{if(a===t||a.isDragging())return;const l=a.getAbsolutePosition();a.setAbsolutePosition({x:l.x+o,y:l.y+s}),a.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(iR),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(iR,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),s=t.getAbsolutePosition(r),a=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(vs.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:s.x+a*Math.cos(u)+l*Math.sin(-u),y:s.y+l*Math.cos(u)+a*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return Mz(c,-vs.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-oR,y:-oR,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 gn.Transform;r.rotate(-vs.Konva.getAngle(this.rotation()));var i,o,s,a;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=s=c.x,o=a=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),s=Math.max(s,c.x),a=Math.max(a,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:s-i,height:a-o,rotation:vs.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(),A1.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new s_e.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:d_e?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=vs.Konva.getAngle(this.rotation()),o=f_e(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 o_e.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()*gn.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var s=t.target.getAbsolutePosition(),a=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-s.x,y:a.y-s.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),s=o.getStage();s.setPointersPositions(t);const a=s.getPointerPosition();let l={x:a.x-this._anchorDragOffset.x,y:a.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const 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 N=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(N-=Math.PI);var f=vs.Konva.getAngle(this.rotation());const E=f+N,P=vs.Konva.getAngle(this.rotationSnapTolerance()),B=g_e(this.rotationSnaps(),E,P)-d.rotation,R=p_e(d,B);this._fitNodesInto(R,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 b=this.findOne(".top-left").x()>m.x?-1:1,_=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*b,r=i*this.sin*_,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 b=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*b,r=i*this.sin*_,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 b=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(gn.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(gn.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var s=new gn.Transform;if(s.rotate(vs.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=s.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=s.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=s.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=s.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:gn.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,l=new gn.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/a,r.height/a);const u=new gn.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/a,t.height/a);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 gn.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const b=m.decompose();d.setAttrs(b),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(gn.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(gn.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),s=this.resizeEnabled(),a=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(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+a,offsetY:l/2+a,visible:s&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+a,visible:s&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-a,offsetY:l/2+a,visible:s&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+a,visible:s&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-a,visible:s&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-a,visible:s&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-a,offsetY:l/2-a,visible:s&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*gn.Util._sign(i)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const 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=""),rR.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return nR.Node.prototype.toObject.call(this)}clone(t){var n=nR.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}lS.Transformer=Ht;function m_e(e){return e instanceof Array||gn.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){A1.indexOf(t)===-1&&gn.Util.warn("Unknown anchor name: "+t+". Available names are: "+A1.join(", "))}),e||[]}Ht.prototype.className="Transformer";(0,a_e._registerNode)(Ht);cn.Factory.addGetterSetter(Ht,"enabledAnchors",A1,m_e);cn.Factory.addGetterSetter(Ht,"flipEnabled",!0,(0,$u.getBooleanValidator)());cn.Factory.addGetterSetter(Ht,"resizeEnabled",!0);cn.Factory.addGetterSetter(Ht,"anchorSize",10,(0,$u.getNumberValidator)());cn.Factory.addGetterSetter(Ht,"rotateEnabled",!0);cn.Factory.addGetterSetter(Ht,"rotationSnaps",[]);cn.Factory.addGetterSetter(Ht,"rotateAnchorOffset",50,(0,$u.getNumberValidator)());cn.Factory.addGetterSetter(Ht,"rotationSnapTolerance",5,(0,$u.getNumberValidator)());cn.Factory.addGetterSetter(Ht,"borderEnabled",!0);cn.Factory.addGetterSetter(Ht,"anchorStroke","rgb(0, 161, 255)");cn.Factory.addGetterSetter(Ht,"anchorStrokeWidth",1,(0,$u.getNumberValidator)());cn.Factory.addGetterSetter(Ht,"anchorFill","white");cn.Factory.addGetterSetter(Ht,"anchorCornerRadius",0,(0,$u.getNumberValidator)());cn.Factory.addGetterSetter(Ht,"borderStroke","rgb(0, 161, 255)");cn.Factory.addGetterSetter(Ht,"borderStrokeWidth",1,(0,$u.getNumberValidator)());cn.Factory.addGetterSetter(Ht,"borderDash");cn.Factory.addGetterSetter(Ht,"keepRatio",!0);cn.Factory.addGetterSetter(Ht,"shiftBehavior","default");cn.Factory.addGetterSetter(Ht,"centeredScaling",!1);cn.Factory.addGetterSetter(Ht,"ignoreStroke",!1);cn.Factory.addGetterSetter(Ht,"padding",0,(0,$u.getNumberValidator)());cn.Factory.addGetterSetter(Ht,"node");cn.Factory.addGetterSetter(Ht,"nodes");cn.Factory.addGetterSetter(Ht,"boundBoxFunc");cn.Factory.addGetterSetter(Ht,"anchorDragBoundFunc");cn.Factory.addGetterSetter(Ht,"anchorStyleFunc");cn.Factory.addGetterSetter(Ht,"shouldOverdrawWholeArea",!1);cn.Factory.addGetterSetter(Ht,"useSingleNodeRotation",!0);cn.Factory.backCompat(Ht,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var uS={};Object.defineProperty(uS,"__esModule",{value:!0});uS.Wedge=void 0;const cS=Et,y_e=jr,v_e=At,Nz=We,__e=At;class vl extends y_e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,v_e.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}uS.Wedge=vl;vl.prototype.className="Wedge";vl.prototype._centroid=!0;vl.prototype._attrsAffectingSize=["radius"];(0,__e._registerNode)(vl);cS.Factory.addGetterSetter(vl,"radius",0,(0,Nz.getNumberValidator)());cS.Factory.addGetterSetter(vl,"angle",0,(0,Nz.getNumberValidator)());cS.Factory.addGetterSetter(vl,"clockwise",!1);cS.Factory.backCompat(vl,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var dS={};Object.defineProperty(dS,"__esModule",{value:!0});dS.Blur=void 0;const sR=Et,b_e=Qn,S_e=We;function aR(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var w_e=[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],x_e=[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 C_e(e,t){var n=e.data,r=e.width,i=e.height,o,s,a,l,u,c,d,f,h,p,m,b,_,y,g,v,S,w,x,C,A,T,k,L,N=t+t+1,E=r-1,P=i-1,D=t+1,B=D*(D+1)/2,R=new aR,I=null,O=R,F=null,U=null,V=w_e[t],H=x_e[t];for(a=1;a>H,k!==0?(k=255/k,n[c]=(f*V>>H)*k,n[c+1]=(h*V>>H)*k,n[c+2]=(p*V>>H)*k):n[c]=n[c+1]=n[c+2]=0,f-=b,h-=_,p-=y,m-=g,b-=F.r,_-=F.g,y-=F.b,g-=F.a,l=d+((l=o+t+1)>H,k>0?(k=255/k,n[l]=(f*V>>H)*k,n[l+1]=(h*V>>H)*k,n[l+2]=(p*V>>H)*k):n[l]=n[l+1]=n[l+2]=0,f-=b,h-=_,p-=y,m-=g,b-=F.r,_-=F.g,y-=F.b,g-=F.a,l=o+((l=s+D)0&&C_e(t,n)};dS.Blur=E_e;sR.Factory.addGetterSetter(b_e.Node,"blurRadius",0,(0,S_e.getNumberValidator)(),sR.Factory.afterSetFilter);var fS={};Object.defineProperty(fS,"__esModule",{value:!0});fS.Brighten=void 0;const lR=Et,T_e=Qn,A_e=We,k_e=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,s=s<0?0:s>255?255:s,n[a]=i,n[a+1]=o,n[a+2]=s};hS.Contrast=I_e;uR.Factory.addGetterSetter(P_e.Node,"contrast",0,(0,R_e.getNumberValidator)(),uR.Factory.afterSetFilter);var pS={};Object.defineProperty(pS,"__esModule",{value:!0});pS.Emboss=void 0;const Su=Et,gS=Qn,O_e=sr,Dz=We,M_e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,s=0,a=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,s=-1;break;case"top":o=-1,s=0;break;case"top-right":o=-1,s=1;break;case"right":o=0,s=1;break;case"bottom-right":o=1,s=1;break;case"bottom":o=1,s=0;break;case"bottom-left":o=1,s=-1;break;case"left":o=0,s=-1;break;default:O_e.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 b=f+(m-1)*4,_=s;m+_<1&&(_=0),m+_>l&&(_=0);var y=p+(m-1+_)*4,g=a[b]-a[y],v=a[b+1]-a[y+1],S=a[b+2]-a[y+2],w=g,x=w>0?w:-w,C=v>0?v:-v,A=S>0?S:-S;if(C>x&&(w=v),A>x&&(w=S),w*=t,i){var T=a[b]+w,k=a[b+1]+w,L=a[b+2]+w;a[b]=T>255?255:T<0?0:T,a[b+1]=k>255?255:k<0?0:k,a[b+2]=L>255?255:L<0?0:L}else{var N=n-w;N<0?N=0:N>255&&(N=255),a[b]=a[b+1]=a[b+2]=N}}while(--m)}while(--d)};pS.Emboss=M_e;Su.Factory.addGetterSetter(gS.Node,"embossStrength",.5,(0,Dz.getNumberValidator)(),Su.Factory.afterSetFilter);Su.Factory.addGetterSetter(gS.Node,"embossWhiteLevel",.5,(0,Dz.getNumberValidator)(),Su.Factory.afterSetFilter);Su.Factory.addGetterSetter(gS.Node,"embossDirection","top-left",null,Su.Factory.afterSetFilter);Su.Factory.addGetterSetter(gS.Node,"embossBlend",!1,null,Su.Factory.afterSetFilter);var mS={};Object.defineProperty(mS,"__esModule",{value:!0});mS.Enhance=void 0;const cR=Et,N_e=Qn,D_e=We;function Mw(e,t,n,r,i){var o=n-t,s=i-r,a;return o===0?r+s/2:s===0?r:(a=(e-t)/o,a=s*a+r,a)}const L_e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,s=t[1],a=s,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],la&&(a=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),a===s&&(a=255,s=0),c===u&&(c=255,u=0);var p,m,b,_,y,g,v,S,w;for(h>0?(m=i+h*(255-i),b=r-h*(r-0),y=a+h*(255-a),g=s-h*(s-0),S=c+h*(255-c),w=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),b=r+h*(r-p),_=(a+s)*.5,y=a+h*(a-_),g=s+h*(s-_),v=(c+u)*.5,S=c+h*(c-v),w=u+h*(u-v)),f=0;f_?b:_;var y=s,g=o,v,S,w=360/g*Math.PI/180,x,C;for(S=0;Sg?y:g;var v=s,S=o,w,x,C=n.polarRotation||0,A,T;for(c=0;ct&&(v=g,S=0,w=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return s}function Y_e(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),s=[],a=0;a=0&&h=0&&p=n))for(o=m;o=r||(s=(n*o+i)*4,a+=v[s+0],l+=v[s+1],u+=v[s+2],c+=v[s+3],g+=1);for(a=a/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o=r||(s=(n*o+i)*4,v[s+0]=a,v[s+1]=l,v[s+2]=u,v[s+3]=c)}};CS.Pixelate=obe;pR.Factory.addGetterSetter(rbe.Node,"pixelSize",8,(0,ibe.getNumberValidator)(),pR.Factory.afterSetFilter);var ES={};Object.defineProperty(ES,"__esModule",{value:!0});ES.Posterize=void 0;const gR=Et,sbe=Qn,abe=We,lbe=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)});P1.Factory.addGetterSetter(NT.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});P1.Factory.addGetterSetter(NT.Node,"blue",0,ube.RGBComponent,P1.Factory.afterSetFilter);var AS={};Object.defineProperty(AS,"__esModule",{value:!0});AS.RGBA=void 0;const Vg=Et,kS=Qn,dbe=We,fbe=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),s=this.alpha(),a,l;for(a=0;a255?255:e<0?0:Math.round(e)});Vg.Factory.addGetterSetter(kS.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});Vg.Factory.addGetterSetter(kS.Node,"blue",0,dbe.RGBComponent,Vg.Factory.afterSetFilter);Vg.Factory.addGetterSetter(kS.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var PS={};Object.defineProperty(PS,"__esModule",{value:!0});PS.Sepia=void 0;const hbe=function(e){var t=e.data,n=t.length,r,i,o,s;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(--a)}while(--o)};RS.Solarize=pbe;var IS={};Object.defineProperty(IS,"__esModule",{value:!0});IS.Threshold=void 0;const mR=Et,gbe=Qn,mbe=We,ybe=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),s=new qh.Stage({container:o,width:r,height:i}),a=new qh.Layer,l=new qh.Layer;return a.add(new qh.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new qh.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),s.add(a),s.add(l),o.remove(),s},rSe=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const s=o.getContext("2d"),a=new Image;if(!s){o.remove(),i("Unable to get context");return}a.onload=function(){s.drawImage(a,0,0),o.remove(),r(s.getImageData(0,0,t,n))},a.src=e}),_R=async(e,t)=>{const n=e.toDataURL(t);return await rSe(n,t.width,t.height)},DT=async(e,t,n,r,i)=>{const o=ge("canvas"),s=Fb(),a=Y0e();if(!s||!a){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=s.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await E1(u,d),h=await _R(u,d),p=await nSe(r?e.objects.filter(_D):[],l,i),m=await E1(p,l),b=await _R(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:b}},iSe=()=>{Te({actionCreator:G0e,effect:async(e,{dispatch:t,getState:n})=>{const r=ge("canvas"),i=n(),o=await DT(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:s}=o;if(!s){r.error("Problem getting mask layer blob"),t(Tn({title:J("toast.problemSavingMask"),description:J("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(pe.endpoints.uploadImage.initiate({file:new File([s],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:J("toast.maskSavedAssets")}}}))}})},oSe=()=>{Te({actionCreator:X0e,effect:async(e,{dispatch:t,getState:n})=>{const r=ge("canvas"),i=n(),o=await DT(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:s}=o;if(!s){r.error("Problem getting mask layer blob"),t(Tn({title:J("toast.problemImportingMask"),description:J("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery,l=await t(pe.endpoints.uploadImage.initiate({file:new File([s],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:J("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(Qc({controlNetId:e.payload.controlNet.controlNetId,controlImage:u}))}})},sSe=async()=>{const e=Fb();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),E1(t,t.getClientRect())},aSe=()=>{Te({actionCreator:W0e,effect:async(e,{dispatch:t})=>{const n=sb.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await sSe();if(!r){n.error("Problem getting base layer blob"),t(Tn({title:J("toast.problemMergingCanvas"),description:J("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=Fb();if(!i){n.error("Problem getting canvas base layer"),t(Tn({title:J("toast.problemMergingCanvas"),description:J("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()}),s=await t(pe.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:J("toast.canvasMerged")}}})).unwrap(),{image_name:a}=s;t(Jne({kind:"image",layer:"base",imageName:a,...o}))}})},lSe=()=>{Te({actionCreator:V0e,effect:async(e,{dispatch:t,getState:n})=>{const r=ge("canvas"),i=n(),o=await Bb(i);if(!o){r.error("Problem getting base layer blob"),t(Tn({title:J("toast.problemSavingCanvas"),description:J("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(pe.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:J("toast.canvasSavedGallery")}}}))}})},uSe=(e,t,n)=>{var d;if(!(Ode.match(e)||D6.match(e)||Qc.match(e)||Mde.match(e)||L6.match(e))||L6.match(e)&&((d=n.controlNet.controlNets[e.payload.controlNetId])==null?void 0:d.shouldAutoConfig)===!0)return!1;const i=t.controlNet.controlNets[e.payload.controlNetId];if(!i)return!1;const{controlImage:o,processorType:s,shouldAutoConfig:a}=i;if(D6.match(e)&&!a)return!1;const l=s!=="none",u=t.system.isProcessing;return l&&!u&&!!o},cSe=()=>{Te({predicate:uSe,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=ge("session"),{controlNetId:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(Q5({controlNetId:o}))}})},od=Le("system/sessionReadyToInvoke"),Fz=e=>(e==null?void 0:e.type)==="image_output",dSe=()=>{Te({actionCreator:Q5,effect:async(e,{dispatch:t,getState:n,take:r})=>{const i=ge("session"),{controlNetId:o}=e.payload,s=n().controlNet.controlNets[o];if(!(s!=null&&s.controlImage)){i.error("Unable to process ControlNet image");return}const a={nodes:{[s.processorNode.id]:{...s.processorNode,is_intermediate:!0,image:{image_name:s.controlImage}}}},l=t(xi({graph:a})),[u]=await r(f=>xi.fulfilled.match(f)&&f.meta.requestId===l.requestId),c=u.payload.id;t(od());const[d]=await r(f=>W5.match(f)&&f.payload.data.graph_execution_state_id===c);if(Fz(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>pe.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(Y5({controlNetId:o,processedControlImage:p.image_name}))}}})},fSe=()=>{Te({matcher:pe.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=ge("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},hSe=()=>{Te({matcher:pe.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=ge("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},LT=Le("deleteImageModal/imageDeletionConfirmed"),aMe=Fi(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],_T),Bz=Fi([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?Qr:Gl,offset:0,limit:are,is_intermediate:!1}},_T),pSe=()=>{Te({actionCreator:LT,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 s=i[0],a=o[0];if(!s||!a)return;t(Z5(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(s&&(s==null?void 0:s.image_name)===u){const{image_name:h}=s,p=Bz(l),{data:m}=pe.endpoints.listImages.select(p)(l),b=m?Ln.getSelectors().selectAll(m):[],_=b.findIndex(S=>S.image_name===h),y=b.filter(S=>S.image_name!==h),g=jl(_,0,y.length-1),v=y[g];t(ha(v||null))}a.isCanvasImage&&t(S5()),i.forEach(h=>{var p,m;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(b5()),rs(n().controlNet.controlNets,b=>{(b.controlImage===h.image_name||b.processedControlImage===h.image_name)&&(t(Qc({controlNetId:b.controlNetId,controlImage:null})),t(Y5({controlNetId:b.controlNetId,processedControlImage:null})))}),((m=n().controlNet.ipAdapterInfo.adapterImage)==null?void 0:m.image_name)===h.image_name&&t(Pb(null)),n().nodes.nodes.forEach(b=>{Kr(b)&&rs(b.data.inputs,_=>{var y;_.type==="ImageField"&&((y=_.value)==null?void 0:y.image_name)===h.image_name&&t(Lb({nodeId:b.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(pe.endpoints.deleteImage.initiate(s));await r(h=>pe.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(_u.util.invalidateTags([{type:"Board",id:s.board_id}]))}})},gSe=()=>{Te({actionCreator:LT,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(pe.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),s=Bz(o),{data:a}=pe.endpoints.listImages.select(s)(o),l=a?Ln.getSelectors().selectAll(a)[0]:void 0;t(ha(l||null)),t(Z5(!1)),i.some(u=>u.isCanvasImage)&&t(S5()),r.forEach(u=>{var c,d;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(b5()),rs(n().controlNet.controlNets,f=>{(f.controlImage===u.image_name||f.processedControlImage===u.image_name)&&(t(Qc({controlNetId:f.controlNetId,controlImage:null})),t(Y5({controlNetId:f.controlNetId,processedControlImage:null})))}),((d=n().controlNet.ipAdapterInfo.adapterImage)==null?void 0:d.image_name)===u.image_name&&t(Pb(null)),n().nodes.nodes.forEach(f=>{Kr(f)&&rs(f.data.inputs,h=>{var p;h.type==="ImageField"&&((p=h.value)==null?void 0:p.image_name)===u.image_name&&t(Lb({nodeId:f.data.id,fieldName:h.name,value:void 0}))})})})}catch{}}})},mSe=()=>{Te({matcher:pe.endpoints.deleteImage.matchPending,effect:()=>{}})},ySe=()=>{Te({matcher:pe.endpoints.deleteImage.matchFulfilled,effect:e=>{ge("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},vSe=()=>{Te({matcher:pe.endpoints.deleteImage.matchRejected,effect:e=>{ge("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},zz=Le("dnd/dndDropped"),_Se=()=>{Te({actionCreator:zz,effect:async(e,{dispatch:t})=>{const n=ge("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:mn(r),overData:mn(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:s}=r.payload;t(Pye({nodeId:o,fieldName:s.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(ha(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(D_(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROLNET_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{controlNetId:o}=i.context;t(Qc({controlImage:r.payload.imageDTO.image_name,controlNetId:o}));return}if(i.actionType==="SET_IP_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(Pb(r.payload.imageDTO));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(wD(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:s}=i.context;t(Lb({nodeId:s,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:s}=i.context;t(pe.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:s}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(pe.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:s}=i.context;t(pe.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:s}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(pe.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},bSe=()=>{Te({matcher:pe.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=ge("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},SSe=()=>{Te({matcher:pe.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=ge("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},wSe=()=>{Te({actionCreator:$de,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,s=z0e(n()),a=s.some(l=>l.isCanvasImage)||s.some(l=>l.isInitialImage)||s.some(l=>l.isControlNetImage)||s.some(l=>l.isIPAdapterImage)||s.some(l=>l.isNodesImage);if(o||a){t(Z5(!0));return}t(LT({imageDTOs:r,imagesUsage:s}))}})},qu={title:J("toast.imageUploaded"),status:"success"},xSe=()=>{Te({matcher:pe.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=ge("images"),i=e.payload,o=n(),{autoAddBoardId:s}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:a}=e.meta.arg.originalArgs;if(!(e.payload.is_intermediate&&!a)){if((a==null?void 0:a.type)==="TOAST"){const{toastOptions:l}=a;if(!s||s==="none")t(Tn({...qu,...l}));else{t(pe.endpoints.addImageToBoard.initiate({board_id:s,imageDTO:i}));const{data:u}=pi.endpoints.listAllBoards.select()(o),c=u==null?void 0:u.find(f=>f.board_id===s),d=c?`${J("toast.addedToBoard")} ${c.board_name}`:`${J("toast.addedToBoard")} ${s}`;t(Tn({...qu,description:d}))}return}if((a==null?void 0:a.type)==="SET_CANVAS_INITIAL_IMAGE"){t(wD(i)),t(Tn({...qu,description:J("toast.setCanvasInitialImage")}));return}if((a==null?void 0:a.type)==="SET_CONTROLNET_IMAGE"){const{controlNetId:l}=a;t(Qc({controlNetId:l,controlImage:i.image_name})),t(Tn({...qu,description:J("toast.setControlImage")}));return}if((a==null?void 0:a.type)==="SET_IP_ADAPTER_IMAGE"){t(Pb(i)),t(Tn({...qu,description:J("toast.setIPAdapterImage")}));return}if((a==null?void 0:a.type)==="SET_INITIAL_IMAGE"){t(D_(i)),t(Tn({...qu,description:J("toast.setInitialImage")}));return}if((a==null?void 0:a.type)==="SET_NODES_IMAGE"){const{nodeId:l,fieldName:u}=a;t(Lb({nodeId:l,fieldName:u,value:i})),t(Tn({...qu,description:`${J("toast.setNodeField")} ${u}`}));return}}}})},CSe=()=>{Te({matcher:pe.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=ge("images"),r={arg:{...I_(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(Tn({title:J("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},ESe=()=>{Te({matcher:pe.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,s=[];o.forEach(a=>{r.includes(a.image_name)?s.push({...a,starred:!0}):s.push(a)}),t(oF(s))}})},TSe=()=>{Te({matcher:pe.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,s=[];o.forEach(a=>{r.includes(a.image_name)?s.push({...a,starred:!1}):s.push(a)}),t(oF(s))}})},ASe=Le("generation/initialImageSelected"),kSe=Le("generation/modelSelected"),PSe=()=>{Te({actionCreator:ASe,effect:(e,{dispatch:t})=>{if(!e.payload){t(Tn(sa({title:J("toast.imageNotLoadedDesc"),status:"error"})));return}t(D_(e.payload)),t(Tn(sa(J("toast.sentToImageToImage"))))}})},RSe=()=>{Te({actionCreator:kSe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=ge("models"),i=t(),o=Cm.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const s=o.data,{base_model:a}=s;if(((l=i.generation.model)==null?void 0:l.base_model)!==a){let c=0;rs(i.lora.loras,(p,m)=>{p.base_model!==a&&(n(aF(m)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==a&&(n(yD(null)),c+=1);const{controlNets:f}=i.controlNet;rs(f,(p,m)=>{var b;((b=p.model)==null?void 0:b.base_model)!==a&&(n(Z$({controlNetId:m})),c+=1)});const{ipAdapterInfo:h}=i.controlNet;h.model&&h.model.base_model!==a&&(n(J$()),c+=1),c>0&&n(Tn(sa({title:`${J("toast.baseModelChangedCleared")} ${c} ${J("toast.incompatibleSubmodel")}${c===1?"":"s"}`,status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==s.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(s.base_model)?(n(Kk(1024)),n(Xk(1024)),n(Qk({width:1024,height:1024}))):(n(Kk(512)),n(Xk(512)),n(Qk({width:512,height:512})))),n(Vl(s))}})},Gg=fl({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),bR=fl({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),SR=fl({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),wR=fl({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),xR=fl({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),CR=fl({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),c3=fl({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),ISe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Wu=e=>{const t=[];return e.forEach(n=>{const r={...Jn(n),id:ISe(n)};t.push(r)}),t},Ga=_u.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${D0.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:pt}];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=Wu(t.models);return bR.setAll(bR.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${D0.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:pt}];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=Wu(t.models);return Gg.setAll(Gg.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"MainModel",id:pt},{type:"SDXLRefinerModel",id:pt},{type:"OnnxModel",id:pt}]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:pt},{type:"SDXLRefinerModel",id:pt},{type:"OnnxModel",id:pt}]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:[{type:"MainModel",id:pt},{type:"SDXLRefinerModel",id:pt},{type:"OnnxModel",id:pt}]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:[{type:"MainModel",id:pt},{type:"SDXLRefinerModel",id:pt},{type:"OnnxModel",id:pt}]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:[{type:"MainModel",id:pt},{type:"SDXLRefinerModel",id:pt},{type:"OnnxModel",id:pt}]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:[{type:"MainModel",id:pt},{type:"SDXLRefinerModel",id:pt},{type:"OnnxModel",id:pt}]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:[{type:"MainModel",id:pt},{type:"SDXLRefinerModel",id:pt},{type:"OnnxModel",id:pt}]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:pt}];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=Wu(t.models);return SR.setAll(SR.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:pt}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:pt}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:pt}];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=Wu(t.models);return wR.setAll(wR.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:pt}];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=Wu(t.models);return xR.setAll(xR.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:pt}];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=Wu(t.models);return c3.setAll(c3.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:pt}];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=Wu(t.models);return CR.setAll(CR.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${D0.stringify(t,{})}`}),providesTags:t=>{const n=[{type:"ScannedModels",id:pt}];return t&&n.push(...t.map(r=>({type:"ScannedModels",id:r}))),n}}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:lMe,useGetOnnxModelsQuery:uMe,useGetControlNetModelsQuery:cMe,useGetIPAdapterModelsQuery:dMe,useGetLoRAModelsQuery:fMe,useGetTextualInversionModelsQuery:hMe,useGetVaeModelsQuery:pMe,useUpdateMainModelsMutation:gMe,useDeleteMainModelsMutation:mMe,useImportMainModelsMutation:yMe,useAddMainModelsMutation:vMe,useConvertMainModelsMutation:_Me,useMergeMainModelsMutation:bMe,useDeleteLoRAModelsMutation:SMe,useUpdateLoRAModelsMutation:wMe,useSyncModelsMutation:xMe,useGetModelsInFolderQuery:CMe,useGetCheckpointConfigsQuery:EMe}=Ga,OSe=()=>{Te({predicate:e=>Ga.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=ge("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=Gg.getSelectors().selectAll(e.payload);if(o.length===0){n(Vl(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 a=Cm.safeParse(o[0]);if(!a.success){r.error({error:a.error.format()},"Failed to parse main model");return}n(Vl(a.data))}}),Te({predicate:e=>Ga.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=ge("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=Gg.getSelectors().selectAll(e.payload);if(o.length===0){n(P8(null)),n(Mye(!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 a=_5.safeParse(o[0]);if(!a.success){r.error({error:a.error.format()},"Failed to parse SDXL Refiner Model");return}n(P8(a.data))}}),Te({matcher:Ga.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=ge("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||wp(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const s=c3.getSelectors().selectAll(e.payload)[0];if(!s){n(Vl(null));return}const a=wne.safeParse(s);if(!a.success){r.error({error:a.error.format()},"Failed to parse VAE model");return}n(yD(a.data))}}),Te({matcher:Ga.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{ge("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;rs(i,(o,s)=>{wp(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(aF(s))})}}),Te({matcher:Ga.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{ge("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`);const i=t().controlNet.controlNets;rs(i,(o,s)=>{wp(e.payload.entities,l=>{var u,c;return(l==null?void 0:l.model_name)===((u=o==null?void 0:o.model)==null?void 0:u.model_name)&&(l==null?void 0:l.base_model)===((c=o==null?void 0:o.model)==null?void 0:c.base_model)})||n(Z$({controlNetId:s}))})}}),Te({matcher:Ga.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{ge("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},Td=e=>e.$ref.split("/").slice(-1)[0],MSe=({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},NSe=({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},DSe=({schemaObject:e,baseField:t})=>{const n=X7(e.item_default)&&wee(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},LSe=({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},$Se=({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},FSe=({schemaObject:e,baseField:t})=>{const n=X7(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},BSe=({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},zSe=({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},USe=({schemaObject:e,baseField:t})=>{const n=K7(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},jSe=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),VSe=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),GSe=({schemaObject:e,baseField:t})=>{const n=e.item_default&&See(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},HSe=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),qSe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),WSe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),KSe=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),XSe=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),QSe=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),YSe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),ZSe=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),JSe=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),e2e=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),t2e=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),n2e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),r2e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),i2e=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),o2e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),s2e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),a2e=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),l2e=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),u2e=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),c2e=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),d2e=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),f2e=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),h2e=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),p2e=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),g2e=({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]}},m2e=({baseField:e})=>({...e,type:"Collection",default:[]}),y2e=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),v2e=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),_2e=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),b2e=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),S2e=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),ER=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=Iie(e.items)?e.items.type:Td(e.items);return Cye(t)?PB[t]:void 0}else return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&Dh(t[0]))return Td(t[0])}else if(e.anyOf){const t=e.anyOf;let n,r;if(aP(t[0])){const i=t[0].items,o=t[1];Dh(i)&&Dh(o)?(n=Td(i),r=Td(o)):Ay(i)&&Ay(o)&&(n=i.type,r=o.type)}else if(aP(t[1])){const i=t[0],o=t[1].items;Dh(i)&&Dh(o)?(n=Td(i),r=Td(o)):Ay(i)&&Ay(o)&&(n=i.type,r=o.type)}if(n===r&&Eye(n))return RB[n]}},Uz={boolean:jSe,BooleanCollection:GSe,BooleanPolymorphic:VSe,ClipField:u2e,Collection:m2e,CollectionItem:y2e,ColorCollection:b2e,ColorField:v2e,ColorPolymorphic:_2e,ConditioningCollection:a2e,ConditioningField:o2e,ConditioningPolymorphic:s2e,ControlCollection:h2e,ControlField:d2e,ControlNetModelField:QSe,ControlPolymorphic:f2e,DenoiseMaskField:t2e,enum:g2e,float:LSe,FloatCollection:FSe,FloatPolymorphic:$Se,ImageCollection:e2e,ImageField:ZSe,ImagePolymorphic:JSe,integer:MSe,IntegerCollection:DSe,IntegerPolymorphic:NSe,IPAdapterField:p2e,IPAdapterModelField:YSe,LatentsCollection:i2e,LatentsField:n2e,LatentsPolymorphic:r2e,LoRAModelField:XSe,MainModelField:HSe,Scheduler:S2e,SDXLMainModelField:qSe,SDXLRefinerModelField:WSe,string:BSe,StringCollection:USe,StringPolymorphic:zSe,UNetField:l2e,VaeField:c2e,VaeModelField:KSe},w2e=e=>!!(e&&e in Uz),x2e=(e,t,n,r)=>{var d;const{input:i,ui_hidden:o,ui_component:s,ui_type:a,ui_order:l}=t,u={input:xye.includes(r)?"connection":i,ui_hidden:o,ui_component:s,ui_type:a,required:((d=e.required)==null?void 0:d.includes(n))??!1,ui_order:l},c={name:n,title:t.title??"",description:t.description??"",fieldKind:"input",...u};if(w2e(r))return Uz[r]({schemaObject:t,baseField:c})},C2e=["id","type","metadata"],E2e=["type"],T2e=["WorkflowField","MetadataField","IsIntermediate"],A2e=["graph","metadata_accumulator"],k2e=(e,t)=>!!(C2e.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),P2e=e=>!!T2e.includes(e),R2e=(e,t)=>!E2e.includes(t),I2e=e=>!A2e.includes(e.properties.type.default),O2e=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(Oie).filter(I2e).filter(s=>t?t.includes(s.properties.type.default):!0).filter(s=>n?!n.includes(s.properties.type.default):!0).reduce((s,a)=>{var g,v;const l=a.properties.type.default,u=a.title.replace("Invocation",""),c=a.tags??[],d=a.description??"",f=a.version,h=hC(a.properties,(S,w,x)=>{if(k2e(l,x))return ge("nodes").trace({node:l,fieldName:x,field:mn(w)},"Skipped reserved input field"),S;if(!lP(w))return ge("nodes").warn({node:l,propertyName:x,property:mn(w)},"Unhandled input property"),S;const C=ER(w);if(!sP(C))return ge("nodes").warn({node:l,fieldName:x,fieldType:C,field:mn(w)},"Skipping unknown input field type"),S;if(P2e(C))return ge("nodes").trace({node:l,fieldName:x,fieldType:C,field:mn(w)},"Skipping reserved field type"),S;const A=x2e(a,w,x,C);return A?(S[x]=A,S):(ge("nodes").debug({node:l,fieldName:x,fieldType:C,field:mn(w)},"Skipping input field with no template"),S)},{}),p=a.output.$ref.split("/").pop();if(!p)return ge("nodes").warn({outputRefObject:mn(a.output)},"No output schema name found in ref object"),s;const m=(v=(g=e.components)==null?void 0:g.schemas)==null?void 0:v[p];if(!m)return ge("nodes").warn({outputSchemaName:p},"Output schema not found"),s;if(!Mie(m))return ge("nodes").error({outputSchema:mn(m)},"Invalid output schema"),s;const b=m.properties.type.default,_=hC(m.properties,(S,w,x)=>{if(!R2e(l,x))return ge("nodes").trace({type:l,propertyName:x,property:mn(w)},"Skipped reserved output field"),S;if(!lP(w))return ge("nodes").warn({type:l,propertyName:x,property:mn(w)},"Unhandled output property"),S;const C=ER(w);return sP(C)?(S[x]={fieldKind:"output",name:x,title:w.title??"",description:w.description??"",type:C,ui_hidden:w.ui_hidden??!1,ui_type:w.ui_type,ui_order:w.ui_order},S):(ge("nodes").warn({fieldName:x,fieldType:C,field:mn(w)},"Skipping unknown output field type"),S)},{}),y={title:u,type:l,version:f,tags:c,description:d,outputType:b,inputs:h,outputs:_};return Object.assign(s,{[l]:y}),s},{})},M2e=()=>{Te({actionCreator:zg.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=ge("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:s}=n().config,a=O2e(i,o,s);r.debug({nodeTemplates:mn(a)},`Built ${O_(a)} node templates`),t(MB(a))}}),Te({actionCreator:zg.rejected,effect:e=>{ge("system").error({error:mn(e.error)},"Problem retrieving OpenAPI Schema")}})},N2e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),D2e=new Map(N2e),L2e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],d3=new WeakSet,$2e=e=>{d3.add(e);const t=e.toJSON();return d3.delete(e),t},F2e=e=>D2e.get(e)??Error,jz=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a})=>{if(!n)if(Array.isArray(e))n=[];else if(!a&&TR(e)){const u=F2e(e.name);n=new u}else n={};if(t.push(e),o>=i)return n;if(s&&typeof e.toJSON=="function"&&!d3.has(e))return $2e(e);const l=u=>jz({from:u,seen:[...t],forceEnumerable:r,maxDepth:i,depth:o,useToJSON:s,serialize:a});for(const[u,c]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(c)){n[u]="[object Buffer]";continue}if(c!==null&&typeof c=="object"&&typeof c.pipe=="function"){n[u]="[object Stream]";continue}if(typeof c!="function"){if(!c||typeof c!="object"){n[u]=c;continue}if(!t.includes(e[u])){o++,n[u]=l(e[u]);continue}n[u]="[Circular]"}}for(const{property:u,enumerable:c}of L2e)typeof e[u]<"u"&&e[u]!==null&&Object.defineProperty(n,u,{value:TR(e[u])?l(e[u]):e[u],enumerable:r?!0:c,configurable:!0,writable:!0});return n};function $T(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?jz({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function TR(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const B2e=()=>{Te({actionCreator:Iu.pending,effect:()=>{}})},z2e=()=>{Te({actionCreator:Iu.fulfilled,effect:e=>{const t=ge("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session canceled (${n})`)}})},U2e=()=>{Te({actionCreator:Iu.rejected,effect:e=>{const t=ge("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:$T(r)},"Problem canceling session")}}})},j2e=()=>{Te({actionCreator:xi.pending,effect:()=>{}})},V2e=()=>{Te({actionCreator:xi.fulfilled,effect:e=>{const t=ge("session"),n=e.payload;t.debug({session:mn(n)},`Session created (${n.id})`)}})},G2e=()=>{Te({actionCreator:xi.rejected,effect:e=>{const t=ge("session");if(e.payload){const{error:n,status:r}=e.payload,i=mn(e.meta.arg);t.error({graph:i,status:r,error:$T(n)},"Problem creating session")}}})},H2e=()=>{Te({actionCreator:ah.pending,effect:()=>{}})},q2e=()=>{Te({actionCreator:ah.fulfilled,effect:e=>{const t=ge("session"),{session_id:n}=e.meta.arg;t.debug({session_id:n},`Session invoked (${n})`)}})},W2e=()=>{Te({actionCreator:ah.rejected,effect:e=>{const t=ge("session"),{session_id:n}=e.meta.arg;if(e.payload){const{error:r}=e.payload;t.error({session_id:n,error:$T(r)},"Problem invoking session")}}})},K2e=()=>{Te({actionCreator:od,effect:(e,{getState:t,dispatch:n})=>{const r=ge("session"),{sessionId:i}=t().system;i&&(r.debug({session_id:i},`Session ready to invoke (${i})})`),n(ah({session_id:i})))}})},X2e=()=>{Te({actionCreator:O$,effect:(e,{dispatch:t,getState:n})=>{ge("socketio").debug("Connected");const{nodes:i,config:o}=n(),{disabledTabs:s}=o;!O_(i.nodeTemplates)&&!s.includes("nodes")&&t(zg()),t(M$(e.payload)),t(Ga.util.invalidateTags([{type:"MainModel",id:pt},{type:"SDXLRefinerModel",id:pt},{type:"LoRAModel",id:pt},{type:"ControlNetModel",id:pt},{type:"VaeModel",id:pt},{type:"TextualInversionModel",id:pt},{type:"ScannedModels",id:pt}])),t(vT.util.invalidateTags(["AppConfig","AppVersion"]))}})},Q2e=()=>{Te({actionCreator:N$,effect:(e,{dispatch:t})=>{ge("socketio").debug("Disconnected"),t(D$(e.payload))}})},Y2e=()=>{Te({actionCreator:V$,effect:(e,{dispatch:t,getState:n})=>{const r=ge("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored generator progress for canceled session");return}r.trace(e.payload,`Generator progress (${e.payload.data.node.type})`),t(X5(e.payload))}})},Z2e=()=>{Te({actionCreator:U$,effect:(e,{dispatch:t})=>{ge("socketio").debug(e.payload,"Session complete"),t(j$(e.payload))}})},Ue="positive_conditioning",He="negative_conditioning",Oe="denoise_latents",Ke="latents_to_image",Wd="nsfw_checker",Wh="invisible_watermark",Ee="noise",$r="rand_int",Xn="range_of_size",sn="iterate",Fu="main_model_loader",OS="onnx_model_loader",qs="vae_loader",Vz="lora_loader",Gt="clip_skip",Fn="image_to_latents",ra="resize_image",vf="img2img_resize",ye="canvas_output",Un="inpaint_image",bi="inpaint_image_resize_up",Di="inpaint_image_resize_down",Ut="inpaint_infill",ql="inpaint_infill_resize_down",Bn="inpaint_create_mask",_t="canvas_coherence_denoise_latents",yn="canvas_coherence_noise",Li="canvas_coherence_noise_increment",cr="canvas_coherence_mask_edge",Lt="canvas_coherence_inpaint_create_mask",_f="tomask",Oi="mask_blur",vi="mask_combine",zn="mask_resize_up",$i="mask_resize_down",e0="control_net_collect",J2e="ip_adapter",Nw="dynamic_prompt",Pt="metadata_accumulator",AR="esrgan",Mi="sdxl_model_loader",Ce="sdxl_denoise_latents",Ku="sdxl_refiner_model_loader",t0="sdxl_refiner_positive_conditioning",n0="sdxl_refiner_negative_conditioning",Ws="sdxl_refiner_denoise_latents",Ba="refiner_inpaint_create_mask",Br="seamless",As="refiner_seamless",Gz="text_to_image_graph",f3="image_to_image_graph",Hz="canvas_text_to_image_graph",h3="canvas_image_to_image_graph",MS="canvas_inpaint_graph",NS="canvas_outpaint_graph",FT="sdxl_text_to_image_graph",R1="sxdl_image_to_image_graph",DS="sdxl_canvas_text_to_image_graph",Hg="sdxl_canvas_image_to_image_graph",Bc="sdxl_canvas_inpaint_graph",zc="sdxl_canvas_outpaint_graph",ewe=["load_image"],twe=()=>{Te({actionCreator:W5,effect:async(e,{dispatch:t,getState:n})=>{const r=ge("socketio"),{data:i}=e.payload;r.debug({data:mn(i)},`Invocation complete (${e.payload.data.node.type})`);const o=e.payload.data.graph_execution_state_id,{cancelType:s,isCancelScheduled:a}=n().system;s==="scheduled"&&a&&t(Iu({session_id:o}));const{result:l,node:u,graph_execution_state_id:c}=i;if(Fz(l)&&!ewe.includes(u.type)){const{image_name:d}=l.image,{canvas:f,gallery:h}=n(),p=await t(pe.endpoints.getImageDTO.initiate(d)).unwrap();if(c===f.layerState.stagingArea.sessionId&&[ye].includes(i.source_node_id)&&t(Yne(p)),!p.is_intermediate){const{autoAddBoardId:m}=h;t(m&&m!=="none"?pe.endpoints.addImageToBoard.initiate({board_id:m,imageDTO:p}):pe.util.updateQueryData("listImages",{board_id:"none",categories:Qr},y=>{Ln.addOne(y,p)})),t(pe.util.invalidateTags([{type:"BoardImagesTotal",id:m},{type:"BoardAssetsTotal",id:m}]));const{selectedBoardId:b,shouldAutoSwitch:_}=h;_&&(m&&m!==b?(t(LC(m)),t(h1("images"))):m||t(h1("images")),t(ha(p)))}t(Lye(null))}t(K5(e.payload))}})},nwe=()=>{Te({actionCreator:z$,effect:(e,{dispatch:t})=>{ge("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(kb(e.payload))}})},rwe=()=>{Te({actionCreator:K$,effect:(e,{dispatch:t})=>{ge("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(X$(e.payload))}})},iwe=()=>{Te({actionCreator:B$,effect:(e,{dispatch:t,getState:n})=>{const r=ge("socketio");if(n().system.canceledSession===e.payload.data.graph_execution_state_id){r.trace(e.payload,"Ignored invocation started for canceled session");return}r.debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(q5(e.payload))}})},owe=()=>{Te({actionCreator:G$,effect:(e,{dispatch:t})=>{const n=ge("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load started: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(Rde(e.payload))}}),Te({actionCreator:H$,effect:(e,{dispatch:t})=>{const n=ge("socketio"),{base_model:r,model_name:i,model_type:o,submodel:s}=e.payload.data;let a=`Model load complete: ${r}/${o}/${i}`;s&&(a=a.concat(`/${s}`)),n.debug(e.payload,a),t(Ide(e.payload))}})},swe=()=>{Te({actionCreator:q$,effect:(e,{dispatch:t})=>{ge("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(W$(e.payload))}})},awe=()=>{Te({actionCreator:H5,effect:(e,{dispatch:t})=>{ge("socketio").debug(e.payload,"Subscribed"),t(L$(e.payload))}})},lwe=()=>{Te({actionCreator:$$,effect:(e,{dispatch:t})=>{ge("socketio").debug(e.payload,"Unsubscribed"),t(F$(e.payload))}})},uwe=()=>{Te({actionCreator:K0e,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(pe.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(pe.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(Tn({title:J("toast.imageSaved"),status:"success"}))}catch(i){t(Tn({title:J("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},TMe=["sd-1","sd-2","sdxl","sdxl-refiner"],cwe=["sd-1","sd-2","sdxl"],AMe=["sdxl"],kMe=["sd-1","sd-2"],PMe=["sdxl-refiner"],dwe=()=>{Te({actionCreator:HB,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const s=n(Ga.endpoints.getMainModels.initiate(cwe)),a=await s.unwrap();if(s.unsubscribe(),!a.ids.length){n(Vl(null));return}const u=Gg.getSelectors().selectAll(a).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(Vl(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(Vl({base_model:c,model_name:d,model_type:f}))}catch{n(Vl(null))}}}})},fwe=({image_name:e,esrganModelName:t})=>{const n={id:AR,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!1};return{id:"adhoc-esrgan-graph",nodes:{[AR]:n},edges:[]}},hwe=Le("upscale/upscaleRequested"),pwe=()=>{Te({actionCreator:hwe,effect:async(e,{dispatch:t,getState:n,take:r})=>{const{image_name:i}=e.payload,{esrganModelName:o}=n().postprocessing,s=fwe({image_name:i,esrganModelName:o});t(xi({graph:s})),await r(xi.fulfilled.match),t(od())}})},gwe=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("

")})},kR=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)}),mwe=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}=mwe(e.data),i=ywe(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},_we=e=>gee(e,n=>n.isEnabled&&(!!n.processedControlImage||n.processorType==="none"&&!!n.controlImage)),ls=(e,t,n)=>{const{isEnabled:r,controlNets:i}=e.controlNet,o=_we(i),s=t.nodes[Pt];if(r&&o.length&&o.length){const a={id:e0,type:"collect",is_intermediate:!0};t.nodes[e0]=a,t.edges.push({source:{node_id:e0,field:"collection"},destination:{node_id:n,field:"control"}}),o.forEach(l=>{const{controlNetId:u,controlImage:c,processedControlImage:d,beginStepPct:f,endStepPct:h,controlMode:p,resizeMode:m,model:b,processorType:_,weight:y}=l,g={id:`control_net_${u}`,type:"controlnet",is_intermediate:!0,begin_step_percent:f,end_step_percent:h,control_mode:p,resize_mode:m,control_model:b,control_weight:y};if(d&&_!=="none")g.image={image_name:d};else if(c)g.image={image_name:c};else return;if(t.nodes[g.id]=g,s!=null&&s.controlnets){const v=I_(g,["id","type"]);s.controlnets.push(v)}t.edges.push({source:{node_id:g.id,field:"control"},destination:{node_id:e0,field:"item"}})})}},Bu=(e,t)=>{const{positivePrompt:n,iterations:r,seed:i,shouldRandomizeSeed:o}=e.generation,{combinatorial:s,isEnabled:a,maxPrompts:l}=e.dynamicPrompts,u=t.nodes[Pt];if(a){cte(t.nodes[Ue],"prompt");const c={id:Nw,type:"dynamic_prompt",is_intermediate:!0,max_prompts:s?l:r,combinatorial:s,prompt:n},d={id:sn,type:"iterate",is_intermediate:!0};if(t.nodes[Nw]=c,t.nodes[sn]=d,t.edges.push({source:{node_id:Nw,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Ue,field:"prompt"}}),u&&t.edges.push({source:{node_id:sn,field:"item"},destination:{node_id:Pt,field:"positive_prompt"}}),o){const f={id:$r,type:"rand_int",is_intermediate:!0};t.nodes[$r]=f,t.edges.push({source:{node_id:$r,field:"value"},destination:{node_id:Ee,field:"seed"}}),u&&t.edges.push({source:{node_id:$r,field:"value"},destination:{node_id:Pt,field:"seed"}})}else t.nodes[Ee].seed=i,u&&(u.seed=i)}else{u&&(u.positive_prompt=n);const c={id:Xn,type:"range_of_size",is_intermediate:!0,size:r,step:1},d={id:sn,type:"iterate",is_intermediate:!0};if(t.nodes[sn]=d,t.nodes[Xn]=c,t.edges.push({source:{node_id:Xn,field:"collection"},destination:{node_id:sn,field:"collection"}}),t.edges.push({source:{node_id:sn,field:"item"},destination:{node_id:Ee,field:"seed"}}),u&&t.edges.push({source:{node_id:sn,field:"item"},destination:{node_id:Pt,field:"seed"}}),o){const f={id:$r,type:"rand_int",is_intermediate:!0};t.nodes[$r]=f,t.edges.push({source:{node_id:$r,field:"value"},destination:{node_id:Xn,field:"start"}})}else c.start=i}},us=(e,t,n)=>{var o,s;const{isIPAdapterEnabled:r,ipAdapterInfo:i}=e.controlNet;if(r&&i.model){const a={id:J2e,type:"ip_adapter",is_intermediate:!0,weight:i.weight,ip_adapter_model:{base_model:(o=i.model)==null?void 0:o.base_model,model_name:(s=i.model)==null?void 0:s.model_name},begin_step_percent:i.beginStepPct,end_step_percent:i.endStepPct};if(i.adapterImage)a.image={image_name:i.adapterImage.image_name};else return;t.nodes[a.id]=a,t.edges.push({source:{node_id:a.id,field:"ip_adapter"},destination:{node_id:n,field:"ip_adapter"}})}},yh=(e,t,n,r=Fu)=>{const{loras:i}=e.lora,o=O_(i),s=t.nodes[Pt];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===Gt&&["clip"].includes(u.source.field))));let a="",l=0;rs(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${Vz}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};s!=null&&s.loras&&s.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:Gt,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:a,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&&[MS,NS].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:_t,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Ue,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:He,field:"clip"}})),a=h,l+=1})},BT=Fi(e=>e.ui,e=>jB[e.activeTab],{memoizeOptions:{equalityCheck:wm}}),RMe=Fi(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:wm}}),IMe=Fi(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:wm}}),cs=(e,t,n=Ke)=>{const i=BT(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],s=t.nodes[Pt];if(!o)return;o.is_intermediate=!0;const a={id:Wd,type:"img_nsfw",is_intermediate:i};t.nodes[Wd]=a,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Wd,field:"image"}}),s&&t.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:Wd,field:"metadata"}})},ds=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[Br]={id:Br,type:"seamless",seamless_x:r,seamless_y:i};let o=Oe;(t.id===FT||t.id===R1||t.id===DS||t.id===Hg||t.id===Bc||t.id===zc)&&(o=Ce),t.edges=t.edges.filter(s=>!(s.source.node_id===n&&["unet"].includes(s.source.field))&&!(s.source.node_id===n&&["vae"].includes(s.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:Br,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:Br,field:"vae"}},{source:{node_id:Br,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==MS||t.id===NS||t.id===Bc||t.id===zc)&&t.edges.push({source:{node_id:Br,field:"unet"},destination:{node_id:_t,field:"unet"}})},fs=(e,t,n=Fu)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:s}=e.sdxl,a=["auto","manual"].includes(o),l=!r,u=t.nodes[Pt];l||(t.nodes[qs]={type:"vae_loader",id:qs,is_intermediate:!0,vae_model:r});const c=n==OS;(t.id===Gz||t.id===f3||t.id===FT||t.id===R1)&&t.edges.push({source:{node_id:l?n:qs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),(t.id===Hz||t.id===h3||t.id===DS||t.id==Hg)&&t.edges.push({source:{node_id:l?n:qs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:a?Ke:ye,field:"vae"}}),(t.id===f3||t.id===R1||t.id===h3||t.id===Hg)&&t.edges.push({source:{node_id:l?n:qs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Fn,field:"vae"}}),(t.id===MS||t.id===NS||t.id===Bc||t.id===zc)&&(t.edges.push({source:{node_id:l?n:qs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Un,field:"vae"}},{source:{node_id:l?n:qs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Bn,field:"vae"}},{source:{node_id:l?n:qs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ke,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:qs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Lt,field:"vae"}})),s&&(t.id===Bc||t.id===zc)&&t.edges.push({source:{node_id:l?n:qs,field:l&&c?"vae_decoder":"vae"},destination:{node_id:Ba,field:"vae"}}),r&&u&&(u.vae=r)},hs=(e,t,n=Ke)=>{const i=BT(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],s=t.nodes[Wd],a=t.nodes[Pt];if(!o)return;const l={id:Wh,type:"img_watermark",is_intermediate:i};t.nodes[Wh]=l,o.is_intermediate=!0,s?(s.is_intermediate=!0,t.edges.push({source:{node_id:Wd,field:"image"},destination:{node_id:Wh,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Wh,field:"image"}}),a&&t.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:Wh,field:"metadata"}})},bwe=(e,t)=>{const n=ge("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:s,scheduler:a,steps:l,img2imgStrength:u,vaePrecision:c,clipSkip:d,shouldUseCpuNoise:f,shouldUseNoiseSettings:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{width:b,height:_}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:y,boundingBoxScaleMethod:g,shouldAutoSave:v}=e.canvas,S=c==="fp32",w=["auto","manual"].includes(g);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let x=Fu;const C=h?f:zs.shouldUseCpuNoise,A={id:h3,nodes:{[x]:{type:"main_model_loader",id:x,is_intermediate:!0,model:o},[Gt]:{type:"clip_skip",id:Gt,is_intermediate:!0,skipped_layers:d},[Ue]:{type:"compel",id:Ue,is_intermediate:!0,prompt:r},[He]:{type:"compel",id:He,is_intermediate:!0,prompt:i},[Ee]:{type:"noise",id:Ee,is_intermediate:!0,use_cpu:C,width:w?y.width:b,height:w?y.height:_},[Fn]:{type:"i2l",id:Fn,is_intermediate:!0},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:!0,cfg_scale:s,scheduler:a,steps:l,denoising_start:1-u,denoising_end:1},[ye]:{type:"l2i",id:ye,is_intermediate:!v}},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Gt,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Fn,field:"latents"},destination:{node_id:Oe,field:"latents"}}]};return w?(A.nodes[vf]={id:vf,type:"img_resize",is_intermediate:!0,image:t,width:y.width,height:y.height},A.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:!0,fp32:S},A.nodes[ye]={id:ye,type:"img_resize",is_intermediate:!v,width:b,height:_},A.edges.push({source:{node_id:vf,field:"image"},destination:{node_id:Fn,field:"image"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(A.nodes[ye]={type:"l2i",id:ye,is_intermediate:!v,fp32:S},A.nodes[Fn].image=t,A.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),A.nodes[Pt]={id:Pt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:s,width:w?y.width:b,height:w?y.height:_,positive_prompt:"",negative_prompt:i,model:o,seed:0,steps:l,rand_device:C?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],clip_skip:d,strength:u,init_image:t.image_name},A.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(p||m)&&(ds(e,A,x),x=Br),yh(e,A,Oe),fs(e,A,x),Bu(e,A),ls(e,A,Oe),us(e,A,Oe),e.system.shouldUseNSFWChecker&&cs(e,A,ye),e.system.shouldUseWatermarker&&hs(e,A,ye),A},Swe=(e,t,n)=>{const r=ge("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,img2imgStrength:c,iterations:d,seed:f,shouldRandomizeSeed:h,vaePrecision:p,shouldUseNoiseSettings:m,shouldUseCpuNoise:b,maskBlur:_,maskBlurMethod:y,canvasCoherenceMode:g,canvasCoherenceSteps:v,canvasCoherenceStrength:S,clipSkip:w,seamlessXAxis:x,seamlessYAxis:C}=e.generation;if(!s)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:A,height:T}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:k,boundingBoxScaleMethod:L,shouldAutoSave:N}=e.canvas,E=p==="fp32",P=["auto","manual"].includes(L);let D=Fu;const B=b,R={id:MS,nodes:{[D]:{type:"main_model_loader",id:D,is_intermediate:!0,model:s},[Gt]:{type:"clip_skip",id:Gt,is_intermediate:!0,skipped_layers:w},[Ue]:{type:"compel",id:Ue,is_intermediate:!0,prompt:i},[He]:{type:"compel",id:He,is_intermediate:!0,prompt:o},[Oi]:{type:"img_blur",id:Oi,is_intermediate:!0,radius:_,blur_type:y},[Un]:{type:"i2l",id:Un,is_intermediate:!0,fp32:E},[Ee]:{type:"noise",id:Ee,use_cpu:B,is_intermediate:!0},[Bn]:{type:"create_denoise_mask",id:Bn,is_intermediate:!0,fp32:E},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:!0,steps:u,cfg_scale:a,scheduler:l,denoising_start:1-c,denoising_end:1},[yn]:{type:"noise",id:Ee,use_cpu:B,is_intermediate:!0},[Li]:{type:"add",id:Li,b:1,is_intermediate:!0},[_t]:{type:"denoise_latents",id:_t,is_intermediate:!0,steps:v,cfg_scale:a,scheduler:l,denoising_start:1-S,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:!0,fp32:E},[ye]:{type:"color_correct",id:ye,is_intermediate:!N,reference:t},[Xn]:{type:"range_of_size",id:Xn,is_intermediate:!0,size:d,step:1},[sn]:{type:"iterate",id:sn,is_intermediate:!0}},edges:[{source:{node_id:D,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:D,field:"clip"},destination:{node_id:Gt,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Un,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Oi,field:"image"},destination:{node_id:Bn,field:"mask"}},{source:{node_id:Bn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:Xn,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Ee,field:"seed"}},{source:{node_id:sn,field:"item"},destination:{node_id:Li,field:"a"}},{source:{node_id:Li,field:"value"},destination:{node_id:yn,field:"seed"}},{source:{node_id:D,field:"unet"},destination:{node_id:_t,field:"unet"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:_t,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:_t,field:"negative_conditioning"}},{source:{node_id:yn,field:"noise"},destination:{node_id:_t,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:_t,field:"latents"}},{source:{node_id:_t,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(P){const I=k.width,O=k.height;R.nodes[bi]={type:"img_resize",id:bi,is_intermediate:!0,width:I,height:O,image:t},R.nodes[zn]={type:"img_resize",id:zn,is_intermediate:!0,width:I,height:O,image:n},R.nodes[Di]={type:"img_resize",id:Di,is_intermediate:!0,width:A,height:T},R.nodes[$i]={type:"img_resize",id:$i,is_intermediate:!0,width:A,height:T},R.nodes[Ee].width=I,R.nodes[Ee].height=O,R.nodes[yn].width=I,R.nodes[yn].height=O,R.edges.push({source:{node_id:bi,field:"image"},destination:{node_id:Un,field:"image"}},{source:{node_id:zn,field:"image"},destination:{node_id:Oi,field:"image"}},{source:{node_id:bi,field:"image"},destination:{node_id:Bn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Di,field:"image"}},{source:{node_id:Di,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Oi,field:"image"},destination:{node_id:$i,field:"image"}},{source:{node_id:$i,field:"image"},destination:{node_id:ye,field:"mask"}})}else R.nodes[Ee].width=A,R.nodes[Ee].height=T,R.nodes[yn].width=A,R.nodes[yn].height=T,R.nodes[Un]={...R.nodes[Un],image:t},R.nodes[Oi]={...R.nodes[Oi],image:n},R.nodes[Bn]={...R.nodes[Bn],image:t},R.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Oi,field:"image"},destination:{node_id:ye,field:"mask"}});if(g!=="unmasked"&&(R.nodes[Lt]={type:"create_denoise_mask",id:Lt,is_intermediate:!0,fp32:E},P?R.edges.push({source:{node_id:bi,field:"image"},destination:{node_id:Lt,field:"image"}}):R.nodes[Lt]={...R.nodes[Lt],image:t},g==="mask"&&(P?R.edges.push({source:{node_id:zn,field:"image"},destination:{node_id:Lt,field:"mask"}}):R.nodes[Lt]={...R.nodes[Lt],mask:n}),g==="edge"&&(R.nodes[cr]={type:"mask_edge",id:cr,is_intermediate:!0,edge_blur:_,edge_size:_*2,low_threshold:100,high_threshold:200},P?R.edges.push({source:{node_id:zn,field:"image"},destination:{node_id:cr,field:"image"}}):R.nodes[cr]={...R.nodes[cr],image:n},R.edges.push({source:{node_id:cr,field:"image"},destination:{node_id:Lt,field:"mask"}})),R.edges.push({source:{node_id:Lt,field:"denoise_mask"},destination:{node_id:_t,field:"denoise_mask"}})),h){const I={id:$r,type:"rand_int"};R.nodes[$r]=I,R.edges.push({source:{node_id:$r,field:"value"},destination:{node_id:Xn,field:"start"}})}else R.nodes[Xn].start=f;return(x||C)&&(ds(e,R,D),D=Br),fs(e,R,D),yh(e,R,Oe,D),ls(e,R,Oe),us(e,R,Oe),e.system.shouldUseNSFWChecker&&cs(e,R,ye),e.system.shouldUseWatermarker&&hs(e,R,ye),R},wwe=(e,t,n)=>{const r=ge("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,img2imgStrength:c,iterations:d,seed:f,shouldRandomizeSeed:h,vaePrecision:p,shouldUseNoiseSettings:m,shouldUseCpuNoise:b,maskBlur:_,canvasCoherenceMode:y,canvasCoherenceSteps:g,canvasCoherenceStrength:v,infillTileSize:S,infillPatchmatchDownscaleSize:w,infillMethod:x,clipSkip:C,seamlessXAxis:A,seamlessYAxis:T}=e.generation;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:k,height:L}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:N,boundingBoxScaleMethod:E,shouldAutoSave:P}=e.canvas,D=p==="fp32",B=["auto","manual"].includes(E);let R=Fu;const I=b,O={id:NS,nodes:{[R]:{type:"main_model_loader",id:R,is_intermediate:!0,model:s},[Gt]:{type:"clip_skip",id:Gt,is_intermediate:!0,skipped_layers:C},[Ue]:{type:"compel",id:Ue,is_intermediate:!0,prompt:i},[He]:{type:"compel",id:He,is_intermediate:!0,prompt:o},[_f]:{type:"tomask",id:_f,is_intermediate:!0,image:t},[vi]:{type:"mask_combine",id:vi,is_intermediate:!0,mask2:n},[Un]:{type:"i2l",id:Un,is_intermediate:!0,fp32:D},[Ee]:{type:"noise",id:Ee,use_cpu:I,is_intermediate:!0},[Bn]:{type:"create_denoise_mask",id:Bn,is_intermediate:!0,fp32:D},[Oe]:{type:"denoise_latents",id:Oe,is_intermediate:!0,steps:u,cfg_scale:a,scheduler:l,denoising_start:1-c,denoising_end:1},[yn]:{type:"noise",id:Ee,use_cpu:I,is_intermediate:!0},[Li]:{type:"add",id:Li,b:1,is_intermediate:!0},[_t]:{type:"denoise_latents",id:_t,is_intermediate:!0,steps:g,cfg_scale:a,scheduler:l,denoising_start:1-v,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:!0,fp32:D},[ye]:{type:"color_correct",id:ye,is_intermediate:!P},[Xn]:{type:"range_of_size",id:Xn,is_intermediate:!0,size:d,step:1},[sn]:{type:"iterate",id:sn,is_intermediate:!0}},edges:[{source:{node_id:R,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:R,field:"clip"},destination:{node_id:Gt,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:Ut,field:"image"},destination:{node_id:Un,field:"image"}},{source:{node_id:_f,field:"image"},destination:{node_id:vi,field:"mask1"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Un,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:B?zn:vi,field:"image"},destination:{node_id:Bn,field:"mask"}},{source:{node_id:Bn,field:"denoise_mask"},destination:{node_id:Oe,field:"denoise_mask"}},{source:{node_id:Xn,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Ee,field:"seed"}},{source:{node_id:sn,field:"item"},destination:{node_id:Li,field:"a"}},{source:{node_id:Li,field:"value"},destination:{node_id:yn,field:"seed"}},{source:{node_id:R,field:"unet"},destination:{node_id:_t,field:"unet"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:_t,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:_t,field:"negative_conditioning"}},{source:{node_id:yn,field:"noise"},destination:{node_id:_t,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:_t,field:"latents"}},{source:{node_id:Ut,field:"image"},destination:{node_id:Bn,field:"image"}},{source:{node_id:_t,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(x==="patchmatch"&&(O.nodes[Ut]={type:"infill_patchmatch",id:Ut,is_intermediate:!0,downscale:w}),x==="lama"&&(O.nodes[Ut]={type:"infill_lama",id:Ut,is_intermediate:!0}),x==="cv2"&&(O.nodes[Ut]={type:"infill_cv2",id:Ut,is_intermediate:!0}),x==="tile"&&(O.nodes[Ut]={type:"infill_tile",id:Ut,is_intermediate:!0,tile_size:S}),B){const F=N.width,U=N.height;O.nodes[bi]={type:"img_resize",id:bi,is_intermediate:!0,width:F,height:U,image:t},O.nodes[zn]={type:"img_resize",id:zn,is_intermediate:!0,width:F,height:U},O.nodes[Di]={type:"img_resize",id:Di,is_intermediate:!0,width:k,height:L},O.nodes[ql]={type:"img_resize",id:ql,is_intermediate:!0,width:k,height:L},O.nodes[$i]={type:"img_resize",id:$i,is_intermediate:!0,width:k,height:L},O.nodes[Ee].width=F,O.nodes[Ee].height=U,O.nodes[yn].width=F,O.nodes[yn].height=U,O.edges.push({source:{node_id:bi,field:"image"},destination:{node_id:Ut,field:"image"}},{source:{node_id:vi,field:"image"},destination:{node_id:zn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Di,field:"image"}},{source:{node_id:zn,field:"image"},destination:{node_id:$i,field:"image"}},{source:{node_id:Ut,field:"image"},destination:{node_id:ql,field:"image"}},{source:{node_id:ql,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Di,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:$i,field:"image"},destination:{node_id:ye,field:"mask"}})}else O.nodes[Ut]={...O.nodes[Ut],image:t},O.nodes[Ee].width=k,O.nodes[Ee].height=L,O.nodes[yn].width=k,O.nodes[yn].height=L,O.nodes[Un]={...O.nodes[Un],image:t},O.edges.push({source:{node_id:Ut,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:vi,field:"image"},destination:{node_id:ye,field:"mask"}});if(y!=="unmasked"&&(O.nodes[Lt]={type:"create_denoise_mask",id:Lt,is_intermediate:!0,fp32:D},O.edges.push({source:{node_id:Ut,field:"image"},destination:{node_id:Lt,field:"image"}}),y==="mask"&&(B?O.edges.push({source:{node_id:zn,field:"image"},destination:{node_id:Lt,field:"mask"}}):O.edges.push({source:{node_id:vi,field:"image"},destination:{node_id:Lt,field:"mask"}})),y==="edge"&&(O.nodes[cr]={type:"mask_edge",id:cr,is_intermediate:!0,edge_blur:_,edge_size:_*2,low_threshold:100,high_threshold:200},B?O.edges.push({source:{node_id:zn,field:"image"},destination:{node_id:cr,field:"image"}}):O.edges.push({source:{node_id:vi,field:"image"},destination:{node_id:cr,field:"image"}}),O.edges.push({source:{node_id:cr,field:"image"},destination:{node_id:Lt,field:"mask"}})),O.edges.push({source:{node_id:Lt,field:"denoise_mask"},destination:{node_id:_t,field:"denoise_mask"}})),h){const F={id:$r,type:"rand_int"};O.nodes[$r]=F,O.edges.push({source:{node_id:$r,field:"value"},destination:{node_id:Xn,field:"start"}})}else O.nodes[Xn].start=f;return(A||T)&&(ds(e,O,R),R=Br),fs(e,O,R),yh(e,O,Oe,R),ls(e,O,Oe),us(e,O,Oe),e.system.shouldUseNSFWChecker&&cs(e,O,ye),e.system.shouldUseWatermarker&&hs(e,O,ye),O},vh=(e,t,n,r=Mi)=>{const{loras:i}=e.lora,o=O_(i),s=t.nodes[Pt],a=r;let l=r;[Br,Ba].includes(r)&&(l=Mi),o>0&&(t.edges=t.edges.filter(d=>!(d.source.node_id===a&&["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;rs(i,d=>{const{model_name:f,base_model:h,weight:p}=d,m=`${Vz}_${f.replace(".","_")}`,b={type:"sdxl_lora_loader",id:m,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};s&&(s.loras||(s.loras=[]),s.loras.push({lora:{model_name:f,base_model:h},weight:p})),t.nodes[m]=b,c===0?(t.edges.push({source:{node_id:a,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&&[Bc,zc].includes(t.id)&&t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:_t,field:"unet"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Ue,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:He,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Ue,field:"clip2"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:He,field:"clip2"}})),u=m,c+=1})},sd=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o}=e.sdxl;let s=i,a=o;return t&&(i.length>0?s=`${n} ${i}`:s=n,o.length>0?a=`${r} ${o}`:a=r),{craftedPositiveStylePrompt:s,craftedNegativeStylePrompt:a}},_h=(e,t,n,r,i)=>{const{refinerModel:o,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:a,refinerSteps:l,refinerScheduler:u,refinerCFGScale:c,refinerStart:d}=e.sdxl,{seamlessXAxis:f,seamlessYAxis:h,vaePrecision:p}=e.generation,{boundingBoxScaleMethod:m}=e.canvas,b=p==="fp32",_=["auto","manual"].includes(m);if(!o)return;const y=t.nodes[Pt];y&&(y.refiner_model=o,y.refiner_positive_aesthetic_score=s,y.refiner_negative_aesthetic_score=a,y.refiner_cfg_scale=c,y.refiner_scheduler=u,y.refiner_start=d,y.refiner_steps=l);const g=r||Mi,{craftedPositiveStylePrompt:v,craftedNegativeStylePrompt:S}=sd(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===g&&["vae"].includes(w.source.field))),t.nodes[Ku]={type:"sdxl_refiner_model_loader",id:Ku,model:o},t.nodes[t0]={type:"sdxl_refiner_compel_prompt",id:t0,style:v,aesthetic_score:s},t.nodes[n0]={type:"sdxl_refiner_compel_prompt",id:n0,style:S,aesthetic_score:a},t.nodes[Ws]={type:"denoise_latents",id:Ws,cfg_scale:c,steps:l,scheduler:u,denoising_start:d,denoising_end:1},f||h?(t.nodes[As]={id:As,type:"seamless",seamless_x:f,seamless_y:h},t.edges.push({source:{node_id:Ku,field:"unet"},destination:{node_id:As,field:"unet"}},{source:{node_id:Ku,field:"vae"},destination:{node_id:As,field:"vae"}},{source:{node_id:As,field:"unet"},destination:{node_id:Ws,field:"unet"}})):t.edges.push({source:{node_id:Ku,field:"unet"},destination:{node_id:Ws,field:"unet"}}),t.edges.push({source:{node_id:Ku,field:"clip2"},destination:{node_id:t0,field:"clip2"}},{source:{node_id:Ku,field:"clip2"},destination:{node_id:n0,field:"clip2"}},{source:{node_id:t0,field:"conditioning"},destination:{node_id:Ws,field:"positive_conditioning"}},{source:{node_id:n0,field:"conditioning"},destination:{node_id:Ws,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:Ws,field:"latents"}}),(t.id===Bc||t.id===zc)&&(t.nodes[Ba]={type:"create_denoise_mask",id:Ba,is_intermediate:!0,fp32:b},_?t.edges.push({source:{node_id:bi,field:"image"},destination:{node_id:Ba,field:"image"}}):t.nodes[Ba]={...t.nodes[Ba],image:i},t.edges.push({source:{node_id:_?zn:vi,field:"image"},destination:{node_id:Ba,field:"mask"}},{source:{node_id:Ba,field:"denoise_mask"},destination:{node_id:Ws,field:"denoise_mask"}})),t.id===DS||t.id===Hg?t.edges.push({source:{node_id:Ws,field:"latents"},destination:{node_id:_?Ke:ye,field:"latents"}}):t.edges.push({source:{node_id:Ws,field:"latents"},destination:{node_id:Ke,field:"latents"}})},xwe=(e,t)=>{const n=ge("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:s,scheduler:a,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{shouldUseSDXLRefiner:m,refinerStart:b,sdxlImg2ImgDenoisingStrength:_,shouldConcatSDXLStylePrompt:y}=e.sdxl,{width:g,height:v}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:S,boundingBoxScaleMethod:w,shouldAutoSave:x}=e.canvas,C=u==="fp32",A=["auto","manual"].includes(w);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let T=Mi;const k=f?d:zs.shouldUseCpuNoise,{craftedPositiveStylePrompt:L,craftedNegativeStylePrompt:N}=sd(e,y),E={id:Hg,nodes:{[T]:{type:"sdxl_model_loader",id:T,model:o},[Ue]:{type:"sdxl_compel_prompt",id:Ue,prompt:r,style:L},[He]:{type:"sdxl_compel_prompt",id:He,prompt:i,style:N},[Ee]:{type:"noise",id:Ee,is_intermediate:!0,use_cpu:k,width:A?S.width:g,height:A?S.height:v},[Fn]:{type:"i2l",id:Fn,is_intermediate:!0,fp32:C},[Ce]:{type:"denoise_latents",id:Ce,is_intermediate:!0,cfg_scale:s,scheduler:a,steps:l,denoising_start:m?Math.min(b,1-_):1-_,denoising_end:m?b:1}},edges:[{source:{node_id:T,field:"unet"},destination:{node_id:Ce,field:"unet"}},{source:{node_id:T,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:T,field:"clip2"},destination:{node_id:Ue,field:"clip2"}},{source:{node_id:T,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:T,field:"clip2"},destination:{node_id:He,field:"clip2"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Ce,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Ce,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Ce,field:"noise"}},{source:{node_id:Fn,field:"latents"},destination:{node_id:Ce,field:"latents"}}]};return A?(E.nodes[vf]={id:vf,type:"img_resize",is_intermediate:!0,image:t,width:S.width,height:S.height},E.nodes[Ke]={id:Ke,type:"l2i",is_intermediate:!0,fp32:C},E.nodes[ye]={id:ye,type:"img_resize",is_intermediate:!x,width:g,height:v},E.edges.push({source:{node_id:vf,field:"image"},destination:{node_id:Fn,field:"image"}},{source:{node_id:Ce,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(E.nodes[ye]={type:"l2i",id:ye,is_intermediate:!x,fp32:C},E.nodes[Fn].image=t,E.edges.push({source:{node_id:Ce,field:"latents"},destination:{node_id:ye,field:"latents"}})),E.nodes[Pt]={id:Pt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:s,width:A?S.width:g,height:A?S.height:v,positive_prompt:"",negative_prompt:i,model:o,seed:0,steps:l,rand_device:k?"cpu":"cuda",scheduler:a,vae:void 0,controlnets:[],loras:[],clip_skip:c,strength:_,init_image:t.image_name},E.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(h||p)&&(ds(e,E,T),T=Br),m&&(_h(e,E,Ce,T),(h||p)&&(T=As)),fs(e,E,T),vh(e,E,Ce,T),Bu(e,E),ls(e,E,Ce),us(e,E,Ce),e.system.shouldUseNSFWChecker&&cs(e,E,ye),e.system.shouldUseWatermarker&&hs(e,E,ye),E},Cwe=(e,t,n)=>{const r=ge("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,iterations:c,seed:d,shouldRandomizeSeed:f,vaePrecision:h,shouldUseNoiseSettings:p,shouldUseCpuNoise:m,maskBlur:b,maskBlurMethod:_,canvasCoherenceMode:y,canvasCoherenceSteps:g,canvasCoherenceStrength:v,seamlessXAxis:S,seamlessYAxis:w}=e.generation,{sdxlImg2ImgDenoisingStrength:x,shouldUseSDXLRefiner:C,refinerStart:A,shouldConcatSDXLStylePrompt:T}=e.sdxl;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:k,height:L}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:N,boundingBoxScaleMethod:E,shouldAutoSave:P}=e.canvas,D=h==="fp32",B=["auto","manual"].includes(E);let R=Mi;const I=m,{craftedPositiveStylePrompt:O,craftedNegativeStylePrompt:F}=sd(e,T),U={id:Bc,nodes:{[R]:{type:"sdxl_model_loader",id:R,model:s},[Ue]:{type:"sdxl_compel_prompt",id:Ue,prompt:i,style:O},[He]:{type:"sdxl_compel_prompt",id:He,prompt:o,style:F},[Oi]:{type:"img_blur",id:Oi,is_intermediate:!0,radius:b,blur_type:_},[Un]:{type:"i2l",id:Un,is_intermediate:!0,fp32:D},[Ee]:{type:"noise",id:Ee,use_cpu:I,is_intermediate:!0},[Bn]:{type:"create_denoise_mask",id:Bn,is_intermediate:!0,fp32:D},[Ce]:{type:"denoise_latents",id:Ce,is_intermediate:!0,steps:u,cfg_scale:a,scheduler:l,denoising_start:C?Math.min(A,1-x):1-x,denoising_end:C?A:1},[yn]:{type:"noise",id:Ee,use_cpu:I,is_intermediate:!0},[Li]:{type:"add",id:Li,b:1,is_intermediate:!0},[_t]:{type:"denoise_latents",id:_t,is_intermediate:!0,steps:g,cfg_scale:a,scheduler:l,denoising_start:1-v,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:!0,fp32:D},[ye]:{type:"color_correct",id:ye,is_intermediate:!P,reference:t},[Xn]:{type:"range_of_size",id:Xn,is_intermediate:!0,size:c,step:1},[sn]:{type:"iterate",id:sn,is_intermediate:!0}},edges:[{source:{node_id:R,field:"unet"},destination:{node_id:Ce,field:"unet"}},{source:{node_id:R,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:R,field:"clip2"},destination:{node_id:Ue,field:"clip2"}},{source:{node_id:R,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:R,field:"clip2"},destination:{node_id:He,field:"clip2"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Ce,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Ce,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Ce,field:"noise"}},{source:{node_id:Un,field:"latents"},destination:{node_id:Ce,field:"latents"}},{source:{node_id:Oi,field:"image"},destination:{node_id:Bn,field:"mask"}},{source:{node_id:Bn,field:"denoise_mask"},destination:{node_id:Ce,field:"denoise_mask"}},{source:{node_id:Xn,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Ee,field:"seed"}},{source:{node_id:sn,field:"item"},destination:{node_id:Li,field:"a"}},{source:{node_id:Li,field:"value"},destination:{node_id:yn,field:"seed"}},{source:{node_id:R,field:"unet"},destination:{node_id:_t,field:"unet"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:_t,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:_t,field:"negative_conditioning"}},{source:{node_id:yn,field:"noise"},destination:{node_id:_t,field:"noise"}},{source:{node_id:Ce,field:"latents"},destination:{node_id:_t,field:"latents"}},{source:{node_id:_t,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(B){const V=N.width,H=N.height;U.nodes[bi]={type:"img_resize",id:bi,is_intermediate:!0,width:V,height:H,image:t},U.nodes[zn]={type:"img_resize",id:zn,is_intermediate:!0,width:V,height:H,image:n},U.nodes[Di]={type:"img_resize",id:Di,is_intermediate:!0,width:k,height:L},U.nodes[$i]={type:"img_resize",id:$i,is_intermediate:!0,width:k,height:L},U.nodes[Ee].width=V,U.nodes[Ee].height=H,U.nodes[yn].width=V,U.nodes[yn].height=H,U.edges.push({source:{node_id:bi,field:"image"},destination:{node_id:Un,field:"image"}},{source:{node_id:zn,field:"image"},destination:{node_id:Oi,field:"image"}},{source:{node_id:bi,field:"image"},destination:{node_id:Bn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Di,field:"image"}},{source:{node_id:Di,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Oi,field:"image"},destination:{node_id:$i,field:"image"}},{source:{node_id:$i,field:"image"},destination:{node_id:ye,field:"mask"}})}else U.nodes[Ee].width=k,U.nodes[Ee].height=L,U.nodes[yn].width=k,U.nodes[yn].height=L,U.nodes[Un]={...U.nodes[Un],image:t},U.nodes[Oi]={...U.nodes[Oi],image:n},U.nodes[Bn]={...U.nodes[Bn],image:t},U.edges.push({source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:Oi,field:"image"},destination:{node_id:ye,field:"mask"}});if(y!=="unmasked"&&(U.nodes[Lt]={type:"create_denoise_mask",id:Lt,is_intermediate:!0,fp32:D},B?U.edges.push({source:{node_id:bi,field:"image"},destination:{node_id:Lt,field:"image"}}):U.nodes[Lt]={...U.nodes[Lt],image:t},y==="mask"&&(B?U.edges.push({source:{node_id:zn,field:"image"},destination:{node_id:Lt,field:"mask"}}):U.nodes[Lt]={...U.nodes[Lt],mask:n}),y==="edge"&&(U.nodes[cr]={type:"mask_edge",id:cr,is_intermediate:!0,edge_blur:b,edge_size:b*2,low_threshold:100,high_threshold:200},B?U.edges.push({source:{node_id:zn,field:"image"},destination:{node_id:cr,field:"image"}}):U.nodes[cr]={...U.nodes[cr],image:n},U.edges.push({source:{node_id:cr,field:"image"},destination:{node_id:Lt,field:"mask"}})),U.edges.push({source:{node_id:Lt,field:"denoise_mask"},destination:{node_id:_t,field:"denoise_mask"}})),f){const V={id:$r,type:"rand_int"};U.nodes[$r]=V,U.edges.push({source:{node_id:$r,field:"value"},destination:{node_id:Xn,field:"start"}})}else U.nodes[Xn].start=d;return(S||w)&&(ds(e,U,R),R=Br),C&&(_h(e,U,_t,R,t),(S||w)&&(R=As)),fs(e,U,R),vh(e,U,Ce,R),ls(e,U,Ce),us(e,U,Ce),e.system.shouldUseNSFWChecker&&cs(e,U,ye),e.system.shouldUseWatermarker&&hs(e,U,ye),U},Ewe=(e,t,n)=>{const r=ge("nodes"),{positivePrompt:i,negativePrompt:o,model:s,cfgScale:a,scheduler:l,steps:u,iterations:c,seed:d,shouldRandomizeSeed:f,vaePrecision:h,shouldUseNoiseSettings:p,shouldUseCpuNoise:m,maskBlur:b,canvasCoherenceMode:_,canvasCoherenceSteps:y,canvasCoherenceStrength:g,infillTileSize:v,infillPatchmatchDownscaleSize:S,infillMethod:w,seamlessXAxis:x,seamlessYAxis:C}=e.generation,{sdxlImg2ImgDenoisingStrength:A,shouldUseSDXLRefiner:T,refinerStart:k,shouldConcatSDXLStylePrompt:L}=e.sdxl;if(!s)throw r.error("No model found in state"),new Error("No model found in state");const{width:N,height:E}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:P,boundingBoxScaleMethod:D,shouldAutoSave:B}=e.canvas,R=h==="fp32",I=["auto","manual"].includes(D);let O=Mi;const F=m,{craftedPositiveStylePrompt:U,craftedNegativeStylePrompt:V}=sd(e,L),H={id:zc,nodes:{[Mi]:{type:"sdxl_model_loader",id:Mi,model:s},[Ue]:{type:"sdxl_compel_prompt",id:Ue,prompt:i,style:U},[He]:{type:"sdxl_compel_prompt",id:He,prompt:o,style:V},[_f]:{type:"tomask",id:_f,is_intermediate:!0,image:t},[vi]:{type:"mask_combine",id:vi,is_intermediate:!0,mask2:n},[Un]:{type:"i2l",id:Un,is_intermediate:!0,fp32:R},[Ee]:{type:"noise",id:Ee,use_cpu:F,is_intermediate:!0},[Bn]:{type:"create_denoise_mask",id:Bn,is_intermediate:!0,fp32:R},[Ce]:{type:"denoise_latents",id:Ce,is_intermediate:!0,steps:u,cfg_scale:a,scheduler:l,denoising_start:T?Math.min(k,1-A):1-A,denoising_end:T?k:1},[yn]:{type:"noise",id:Ee,use_cpu:F,is_intermediate:!0},[Li]:{type:"add",id:Li,b:1,is_intermediate:!0},[_t]:{type:"denoise_latents",id:_t,is_intermediate:!0,steps:y,cfg_scale:a,scheduler:l,denoising_start:1-g,denoising_end:1},[Ke]:{type:"l2i",id:Ke,is_intermediate:!0,fp32:R},[ye]:{type:"color_correct",id:ye,is_intermediate:!B},[Xn]:{type:"range_of_size",id:Xn,is_intermediate:!0,size:c,step:1},[sn]:{type:"iterate",id:sn,is_intermediate:!0}},edges:[{source:{node_id:Mi,field:"unet"},destination:{node_id:Ce,field:"unet"}},{source:{node_id:Mi,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:Mi,field:"clip2"},destination:{node_id:Ue,field:"clip2"}},{source:{node_id:Mi,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:Mi,field:"clip2"},destination:{node_id:He,field:"clip2"}},{source:{node_id:Ut,field:"image"},destination:{node_id:Un,field:"image"}},{source:{node_id:_f,field:"image"},destination:{node_id:vi,field:"mask1"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Ce,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Ce,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Ce,field:"noise"}},{source:{node_id:Un,field:"latents"},destination:{node_id:Ce,field:"latents"}},{source:{node_id:I?zn:vi,field:"image"},destination:{node_id:Bn,field:"mask"}},{source:{node_id:Bn,field:"denoise_mask"},destination:{node_id:Ce,field:"denoise_mask"}},{source:{node_id:Xn,field:"collection"},destination:{node_id:sn,field:"collection"}},{source:{node_id:sn,field:"item"},destination:{node_id:Ee,field:"seed"}},{source:{node_id:sn,field:"item"},destination:{node_id:Li,field:"a"}},{source:{node_id:Li,field:"value"},destination:{node_id:yn,field:"seed"}},{source:{node_id:O,field:"unet"},destination:{node_id:_t,field:"unet"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:_t,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:_t,field:"negative_conditioning"}},{source:{node_id:yn,field:"noise"},destination:{node_id:_t,field:"noise"}},{source:{node_id:Ce,field:"latents"},destination:{node_id:_t,field:"latents"}},{source:{node_id:Ut,field:"image"},destination:{node_id:Bn,field:"image"}},{source:{node_id:_t,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(w==="patchmatch"&&(H.nodes[Ut]={type:"infill_patchmatch",id:Ut,is_intermediate:!0,downscale:S}),w==="lama"&&(H.nodes[Ut]={type:"infill_lama",id:Ut,is_intermediate:!0}),w==="cv2"&&(H.nodes[Ut]={type:"infill_cv2",id:Ut,is_intermediate:!0}),w==="tile"&&(H.nodes[Ut]={type:"infill_tile",id:Ut,is_intermediate:!0,tile_size:v}),I){const Y=P.width,Q=P.height;H.nodes[bi]={type:"img_resize",id:bi,is_intermediate:!0,width:Y,height:Q,image:t},H.nodes[zn]={type:"img_resize",id:zn,is_intermediate:!0,width:Y,height:Q},H.nodes[Di]={type:"img_resize",id:Di,is_intermediate:!0,width:N,height:E},H.nodes[ql]={type:"img_resize",id:ql,is_intermediate:!0,width:N,height:E},H.nodes[$i]={type:"img_resize",id:$i,is_intermediate:!0,width:N,height:E},H.nodes[Ee].width=Y,H.nodes[Ee].height=Q,H.nodes[yn].width=Y,H.nodes[yn].height=Q,H.edges.push({source:{node_id:bi,field:"image"},destination:{node_id:Ut,field:"image"}},{source:{node_id:vi,field:"image"},destination:{node_id:zn,field:"image"}},{source:{node_id:Ke,field:"image"},destination:{node_id:Di,field:"image"}},{source:{node_id:zn,field:"image"},destination:{node_id:$i,field:"image"}},{source:{node_id:Ut,field:"image"},destination:{node_id:ql,field:"image"}},{source:{node_id:ql,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Di,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:$i,field:"image"},destination:{node_id:ye,field:"mask"}})}else H.nodes[Ut]={...H.nodes[Ut],image:t},H.nodes[Ee].width=N,H.nodes[Ee].height=E,H.nodes[yn].width=N,H.nodes[yn].height=E,H.nodes[Un]={...H.nodes[Un],image:t},H.edges.push({source:{node_id:Ut,field:"image"},destination:{node_id:ye,field:"reference"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}},{source:{node_id:vi,field:"image"},destination:{node_id:ye,field:"mask"}});if(_!=="unmasked"&&(H.nodes[Lt]={type:"create_denoise_mask",id:Lt,is_intermediate:!0,fp32:R},H.edges.push({source:{node_id:Ut,field:"image"},destination:{node_id:Lt,field:"image"}}),_==="mask"&&(I?H.edges.push({source:{node_id:zn,field:"image"},destination:{node_id:Lt,field:"mask"}}):H.edges.push({source:{node_id:vi,field:"image"},destination:{node_id:Lt,field:"mask"}})),_==="edge"&&(H.nodes[cr]={type:"mask_edge",id:cr,is_intermediate:!0,edge_blur:b,edge_size:b*2,low_threshold:100,high_threshold:200},I?H.edges.push({source:{node_id:zn,field:"image"},destination:{node_id:cr,field:"image"}}):H.edges.push({source:{node_id:vi,field:"image"},destination:{node_id:cr,field:"image"}}),H.edges.push({source:{node_id:cr,field:"image"},destination:{node_id:Lt,field:"mask"}})),H.edges.push({source:{node_id:Lt,field:"denoise_mask"},destination:{node_id:_t,field:"denoise_mask"}})),f){const Y={id:$r,type:"rand_int"};H.nodes[$r]=Y,H.edges.push({source:{node_id:$r,field:"value"},destination:{node_id:Xn,field:"start"}})}else H.nodes[Xn].start=d;return(x||C)&&(ds(e,H,O),O=Br),T&&(_h(e,H,_t,O,t),(x||C)&&(O=As)),fs(e,H,O),vh(e,H,Ce,O),ls(e,H,Ce),us(e,H,Ce),e.system.shouldUseNSFWChecker&&cs(e,H,ye),e.system.shouldUseWatermarker&&hs(e,H,ye),H},Twe=e=>{const t=ge("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,vaePrecision:l,clipSkip:u,shouldUseCpuNoise:c,shouldUseNoiseSettings:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:b,boundingBoxScaleMethod:_,shouldAutoSave:y}=e.canvas,g=l==="fp32",v=["auto","manual"].includes(_),{shouldUseSDXLRefiner:S,refinerStart:w,shouldConcatSDXLStylePrompt:x}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const C=d?c:zs.shouldUseCpuNoise,A=i.model_type==="onnx";let T=A?OS:Mi;const k=A?"onnx_model_loader":"sdxl_model_loader",L=A?{type:"t2l_onnx",id:Ce,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a}:{type:"denoise_latents",id:Ce,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a,denoising_start:0,denoising_end:S?w:1},{craftedPositiveStylePrompt:N,craftedNegativeStylePrompt:E}=sd(e,x),P={id:DS,nodes:{[T]:{type:k,id:T,is_intermediate:!0,model:i},[Ue]:{type:A?"prompt_onnx":"sdxl_compel_prompt",id:Ue,is_intermediate:!0,prompt:n,style:N},[He]:{type:A?"prompt_onnx":"sdxl_compel_prompt",id:He,is_intermediate:!0,prompt:r,style:E},[Ee]:{type:"noise",id:Ee,is_intermediate:!0,width:v?b.width:p,height:v?b.height:m,use_cpu:C},[L.id]:L},edges:[{source:{node_id:T,field:"unet"},destination:{node_id:Ce,field:"unet"}},{source:{node_id:T,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:T,field:"clip2"},destination:{node_id:Ue,field:"clip2"}},{source:{node_id:T,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:T,field:"clip2"},destination:{node_id:He,field:"clip2"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Ce,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Ce,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Ce,field:"noise"}}]};return v?(P.nodes[Ke]={id:Ke,type:A?"l2i_onnx":"l2i",is_intermediate:!0,fp32:g},P.nodes[ye]={id:ye,type:"img_resize",is_intermediate:!y,width:p,height:m},P.edges.push({source:{node_id:Ce,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(P.nodes[ye]={type:A?"l2i_onnx":"l2i",id:ye,is_intermediate:!y,fp32:g},P.edges.push({source:{node_id:Ce,field:"latents"},destination:{node_id:ye,field:"latents"}})),P.nodes[Pt]={id:Pt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:v?b.width:p,height:v?b.height:m,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:C?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:u},P.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(ds(e,P,T),T=Br),S&&(_h(e,P,Ce,T),(f||h)&&(T=As)),vh(e,P,Ce,T),fs(e,P,T),Bu(e,P),ls(e,P,Ce),us(e,P,Ce),e.system.shouldUseNSFWChecker&&cs(e,P,ye),e.system.shouldUseWatermarker&&hs(e,P,ye),P},Awe=e=>{const t=ge("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,vaePrecision:l,clipSkip:u,shouldUseCpuNoise:c,shouldUseNoiseSettings:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:b,boundingBoxScaleMethod:_,shouldAutoSave:y}=e.canvas,g=l==="fp32",v=["auto","manual"].includes(_);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d?c:zs.shouldUseCpuNoise,w=i.model_type==="onnx";let x=w?OS:Fu;const C=w?"onnx_model_loader":"main_model_loader",A=w?{type:"t2l_onnx",id:Oe,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a}:{type:"denoise_latents",id:Oe,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a,denoising_start:0,denoising_end:1},T={id:Hz,nodes:{[x]:{type:C,id:x,is_intermediate:!0,model:i},[Gt]:{type:"clip_skip",id:Gt,is_intermediate:!0,skipped_layers:u},[Ue]:{type:w?"prompt_onnx":"compel",id:Ue,is_intermediate:!0,prompt:n},[He]:{type:w?"prompt_onnx":"compel",id:He,is_intermediate:!0,prompt:r},[Ee]:{type:"noise",id:Ee,is_intermediate:!0,width:v?b.width:p,height:v?b.height:m,use_cpu:S},[A.id]:A},edges:[{source:{node_id:x,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:x,field:"clip"},destination:{node_id:Gt,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Oe,field:"noise"}}]};return v?(T.nodes[Ke]={id:Ke,type:w?"l2i_onnx":"l2i",is_intermediate:!0,fp32:g},T.nodes[ye]={id:ye,type:"img_resize",is_intermediate:!y,width:p,height:m},T.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}},{source:{node_id:Ke,field:"image"},destination:{node_id:ye,field:"image"}})):(T.nodes[ye]={type:w?"l2i_onnx":"l2i",id:ye,is_intermediate:!y,fp32:g},T.edges.push({source:{node_id:Oe,field:"latents"},destination:{node_id:ye,field:"latents"}})),T.nodes[Pt]={id:Pt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,width:v?b.width:p,height:v?b.height:m,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:S?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:u},T.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:ye,field:"metadata"}}),(f||h)&&(ds(e,T,x),x=Br),fs(e,T,x),yh(e,T,Oe,x),Bu(e,T),ls(e,T,Oe),us(e,T,Oe),e.system.shouldUseNSFWChecker&&cs(e,T,ye),e.system.shouldUseWatermarker&&hs(e,T,ye),T},kwe=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=Twe(e):i=Awe(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=xwe(e,n):i=bwe(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=Cwe(e,n,r):i=Swe(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=Ewe(e,n,r):i=wwe(e,n,r)}return i},Pwe=()=>{Te({predicate:e=>Fm.match(e)&&e.payload==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=ge("session"),o=t(),{layerState:s,boundingBoxCoordinates:a,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await DT(s,a,l,u,c);if(!d){i.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,b=vwe(h,m);if(o.system.enableImageDebugging){const x=await kR(f),C=await kR(p);gwe([{base64:C,caption:"mask b64"},{base64:x,caption:"image b64"}])}i.debug(`Generation mode: ${b}`);let _,y;["img2img","inpaint","outpaint"].includes(b)&&(_=await n(pe.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(b)&&(y=await n(pe.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=kwe(o,b,_,y);i.debug({graph:mn(g)},"Canvas graph built"),n(ZB(g));const{requestId:v}=n(xi({graph:g})),[S]=await r(x=>xi.fulfilled.match(x)&&x.meta.requestId===v),w=S.payload.id;["img2img","inpaint"].includes(b)&&_&&n(pe.endpoints.changeImageSessionId.initiate({imageDTO:_,session_id:w})),["inpaint"].includes(b)&&y&&n(pe.endpoints.changeImageSessionId.initiate({imageDTO:y,session_id:w})),o.canvas.layerState.stagingArea.boundingBox||n(ere({sessionId:w,boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(tre(w)),n(od())}})},Rwe=e=>{const t=ge("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,initialImage:l,img2imgStrength:u,shouldFitToWidthHeight:c,width:d,height:f,clipSkip:h,shouldUseCpuNoise:p,shouldUseNoiseSettings:m,vaePrecision:b,seamlessXAxis:_,seamlessYAxis:y}=e.generation;if(!l)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g=b==="fp32";let v=Fu;const S=m?p:zs.shouldUseCpuNoise,w={id:f3,nodes:{[v]:{type:"main_model_loader",id:v,model:i},[Gt]:{type:"clip_skip",id:Gt,skipped_layers:h},[Ue]:{type:"compel",id:Ue,prompt:n},[He]:{type:"compel",id:He,prompt:r},[Ee]:{type:"noise",id:Ee,use_cpu:S},[Ke]:{type:"l2i",id:Ke,fp32:g},[Oe]:{type:"denoise_latents",id:Oe,cfg_scale:o,scheduler:s,steps:a,denoising_start:1-u,denoising_end:1},[Fn]:{type:"i2l",id:Fn,fp32:g}},edges:[{source:{node_id:v,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:v,field:"clip"},destination:{node_id:Gt,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Fn,field:"latents"},destination:{node_id:Oe,field:"latents"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(c&&(l.width!==d||l.height!==f)){const x={id:ra,type:"img_resize",image:{image_name:l.imageName},is_intermediate:!0,width:d,height:f};w.nodes[ra]=x,w.edges.push({source:{node_id:ra,field:"image"},destination:{node_id:Fn,field:"image"}}),w.edges.push({source:{node_id:ra,field:"width"},destination:{node_id:Ee,field:"width"}}),w.edges.push({source:{node_id:ra,field:"height"},destination:{node_id:Ee,field:"height"}})}else w.nodes[Fn].image={image_name:l.imageName},w.edges.push({source:{node_id:Fn,field:"width"},destination:{node_id:Ee,field:"width"}}),w.edges.push({source:{node_id:Fn,field:"height"},destination:{node_id:Ee,field:"height"}});return w.nodes[Pt]={id:Pt,type:"metadata_accumulator",generation_mode:"img2img",cfg_scale:o,height:f,width:d,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:S?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:h,strength:u,init_image:l.imageName},w.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(_||y)&&(ds(e,w,v),v=Br),fs(e,w,v),yh(e,w,Oe,v),Bu(e,w),ls(e,w,Oe),us(e,w,Oe),e.system.shouldUseNSFWChecker&&cs(e,w),e.system.shouldUseWatermarker&&hs(e,w),w},Iwe=e=>{const t=ge("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,initialImage:l,shouldFitToWidthHeight:u,width:c,height:d,clipSkip:f,shouldUseCpuNoise:h,shouldUseNoiseSettings:p,vaePrecision:m,seamlessXAxis:b,seamlessYAxis:_}=e.generation,{positiveStylePrompt:y,negativeStylePrompt:g,shouldConcatSDXLStylePrompt:v,shouldUseSDXLRefiner:S,refinerStart:w,sdxlImg2ImgDenoisingStrength:x}=e.sdxl;if(!l)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const C=m==="fp32";let A=Mi;const T=p?h:zs.shouldUseCpuNoise,{craftedPositiveStylePrompt:k,craftedNegativeStylePrompt:L}=sd(e,v),N={id:R1,nodes:{[A]:{type:"sdxl_model_loader",id:A,model:i},[Ue]:{type:"sdxl_compel_prompt",id:Ue,prompt:n,style:k},[He]:{type:"sdxl_compel_prompt",id:He,prompt:r,style:L},[Ee]:{type:"noise",id:Ee,use_cpu:T},[Ke]:{type:"l2i",id:Ke,fp32:C},[Ce]:{type:"denoise_latents",id:Ce,cfg_scale:o,scheduler:s,steps:a,denoising_start:S?Math.min(w,1-x):1-x,denoising_end:S?w:1},[Fn]:{type:"i2l",id:Fn,fp32:C}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:Ce,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:A,field:"clip2"},destination:{node_id:Ue,field:"clip2"}},{source:{node_id:A,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:A,field:"clip2"},destination:{node_id:He,field:"clip2"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Ce,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Ce,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Ce,field:"noise"}},{source:{node_id:Fn,field:"latents"},destination:{node_id:Ce,field:"latents"}},{source:{node_id:Ce,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};if(u&&(l.width!==c||l.height!==d)){const E={id:ra,type:"img_resize",image:{image_name:l.imageName},is_intermediate:!0,width:c,height:d};N.nodes[ra]=E,N.edges.push({source:{node_id:ra,field:"image"},destination:{node_id:Fn,field:"image"}}),N.edges.push({source:{node_id:ra,field:"width"},destination:{node_id:Ee,field:"width"}}),N.edges.push({source:{node_id:ra,field:"height"},destination:{node_id:Ee,field:"height"}})}else N.nodes[Fn].image={image_name:l.imageName},N.edges.push({source:{node_id:Fn,field:"width"},destination:{node_id:Ee,field:"width"}}),N.edges.push({source:{node_id:Fn,field:"height"},destination:{node_id:Ee,field:"height"}});return N.nodes[Pt]={id:Pt,type:"metadata_accumulator",generation_mode:"sdxl_img2img",cfg_scale:o,height:d,width:c,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:T?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:f,strength:x,init_image:l.imageName,positive_style_prompt:y,negative_style_prompt:g},N.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(b||_)&&(ds(e,N,A),A=Br),S&&(_h(e,N,Ce),(b||_)&&(A=As)),fs(e,N,A),vh(e,N,Ce,A),ls(e,N,Ce),us(e,N,Ce),Bu(e,N),e.system.shouldUseNSFWChecker&&cs(e,N),e.system.shouldUseWatermarker&&hs(e,N),N},Owe=()=>{Te({predicate:e=>Fm.match(e)&&e.payload==="img2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=ge("session"),o=t(),s=o.generation.model;let a;s&&s.base_model==="sdxl"?a=Iwe(o):a=Rwe(o),n(YB(a)),i.debug({graph:mn(a)},"Image to Image graph built"),n(xi({graph:a})),await r(xi.fulfilled.match),n(od())}})},Mwe=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function Nwe(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+'["'+Dwe(n)+'"]';if(!Mwe.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function Dwe(e){return e.replace(/"/g,'\\"')}function Lwe(e){return e.length!==0}const $we=99,qz="; ",Wz=", or ",zT="Validation error",Kz=": ";class Xz extends Error{constructor(n,r=[]){super(n);e2(this,"details");e2(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function UT(e,t,n){if(e.code==="invalid_union")return e.unionErrors.reduce((r,i)=>{const o=i.issues.map(s=>UT(s,t,n)).join(t);return r.includes(o)||r.push(o),r},[]).join(n);if(Lwe(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 "${Nwe(e.path)}"`}return e.message}function Qz(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:zT}function OMe(e,t={}){const{issueSeparator:n=qz,unionSeparator:r=Wz,prefixSeparator:i=Kz,prefix:o=zT}=t,s=UT(e,n,r),a=Qz(s,o,i);return new Xz(a,[e])}function PR(e,t={}){const{maxIssuesInMessage:n=$we,issueSeparator:r=qz,unionSeparator:i=Wz,prefixSeparator:o=Kz,prefix:s=zT}=t,a=e.errors.slice(0,n).map(u=>UT(u,r,i)).join(r),l=Qz(a,s,o);return new Xz(l,e.errors)}const Fwe=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 s=LD.safeParse(o);if(!s.success){const{message:a}=PR(s.error,{prefix:we.t("nodes.unableToParseNode")});ge("nodes").warn({node:mn(o)},a);return}i.nodes.push(s.data)}),r.forEach(o=>{const s=$D.safeParse(o);if(!s.success){const{message:a}=PR(s.error,{prefix:we.t("nodes.unableToParseEdge")});ge("nodes").warn({edge:mn(o)},a);return}i.edges.push(s.data)}),i},Bwe=e=>{if(e.type==="ColorField"&&e.value){const t=Jn(e.value),{r:n,g:r,b:i,a:o}=e.value,s=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a:s}),t}return e.value},zwe=e=>{const{nodes:t,edges:n}=e,r=t.filter(Kr),i=JSON.stringify(Fwe(e)),o=r.reduce((u,c)=>{const{id:d,data:f}=c,{type:h,inputs:p,isIntermediate:m,embedWorkflow:b}=f,_=hC(p,(g,v,S)=>{const w=Bwe(v);return g[S]=w,g},{}),y={type:h,id:d,..._,is_intermediate:m};return b&&Object.assign(y,{workflow:i}),Object.assign(u,{[d]:y}),u},{}),a=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 a.forEach(u=>{const c=o[u.destination.node_id],d=u.destination.field;o[u.destination.node_id]=I_(c,d)}),{id:kB(),nodes:o,edges:a}},Uwe=()=>{Te({predicate:e=>Fm.match(e)&&e.payload==="nodes",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=ge("session"),o=t(),s=zwe(o.nodes);n(JB(s)),i.debug({graph:mn(s)},"Nodes graph built"),n(xi({graph:s})),await r(xi.fulfilled.match),n(od())}})},jwe=e=>{const t=ge("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f,vaePrecision:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{positiveStylePrompt:b,negativeStylePrompt:_,shouldUseSDXLRefiner:y,shouldConcatSDXLStylePrompt:g,refinerStart:v}=e.sdxl,S=f?d:zs.shouldUseCpuNoise;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const w=h==="fp32",{craftedPositiveStylePrompt:x,craftedNegativeStylePrompt:C}=sd(e,g);let A=Mi;const T={id:FT,nodes:{[A]:{type:"sdxl_model_loader",id:A,model:i},[Ue]:{type:"sdxl_compel_prompt",id:Ue,prompt:n,style:x},[He]:{type:"sdxl_compel_prompt",id:He,prompt:r,style:C},[Ee]:{type:"noise",id:Ee,width:l,height:u,use_cpu:S},[Ce]:{type:"denoise_latents",id:Ce,cfg_scale:o,scheduler:s,steps:a,denoising_start:0,denoising_end:y?v:1},[Ke]:{type:"l2i",id:Ke,fp32:w}},edges:[{source:{node_id:A,field:"unet"},destination:{node_id:Ce,field:"unet"}},{source:{node_id:A,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:A,field:"clip2"},destination:{node_id:Ue,field:"clip2"}},{source:{node_id:A,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:A,field:"clip2"},destination:{node_id:He,field:"clip2"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Ce,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Ce,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Ce,field:"noise"}},{source:{node_id:Ce,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return T.nodes[Pt]={id:Pt,type:"metadata_accumulator",generation_mode:"sdxl_txt2img",cfg_scale:o,height:u,width:l,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:S?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:c,positive_style_prompt:b,negative_style_prompt:_},T.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(p||m)&&(ds(e,T,A),A=Br),y&&(_h(e,T,Ce),(p||m)&&(A=As)),fs(e,T,A),vh(e,T,Ce,A),ls(e,T,Ce),us(e,T,Ce),Bu(e,T),e.system.shouldUseNSFWChecker&&cs(e,T),e.system.shouldUseWatermarker&&hs(e,T),T},Vwe=e=>{const t=ge("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:s,steps:a,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,shouldUseNoiseSettings:f,vaePrecision:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,b=f?d:zs.shouldUseCpuNoise;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const _=h==="fp32",y=i.model_type==="onnx";let g=y?OS:Fu;const v=y?"onnx_model_loader":"main_model_loader",S=y?{type:"t2l_onnx",id:Oe,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a}:{type:"denoise_latents",id:Oe,is_intermediate:!0,cfg_scale:o,scheduler:s,steps:a,denoising_start:0,denoising_end:1},w={id:Gz,nodes:{[g]:{type:v,id:g,is_intermediate:!0,model:i},[Gt]:{type:"clip_skip",id:Gt,skipped_layers:c,is_intermediate:!0},[Ue]:{type:y?"prompt_onnx":"compel",id:Ue,prompt:n,is_intermediate:!0},[He]:{type:y?"prompt_onnx":"compel",id:He,prompt:r,is_intermediate:!0},[Ee]:{type:"noise",id:Ee,width:l,height:u,use_cpu:b,is_intermediate:!0},[S.id]:S,[Ke]:{type:y?"l2i_onnx":"l2i",id:Ke,fp32:_}},edges:[{source:{node_id:g,field:"unet"},destination:{node_id:Oe,field:"unet"}},{source:{node_id:g,field:"clip"},destination:{node_id:Gt,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:Ue,field:"clip"}},{source:{node_id:Gt,field:"clip"},destination:{node_id:He,field:"clip"}},{source:{node_id:Ue,field:"conditioning"},destination:{node_id:Oe,field:"positive_conditioning"}},{source:{node_id:He,field:"conditioning"},destination:{node_id:Oe,field:"negative_conditioning"}},{source:{node_id:Ee,field:"noise"},destination:{node_id:Oe,field:"noise"}},{source:{node_id:Oe,field:"latents"},destination:{node_id:Ke,field:"latents"}}]};return w.nodes[Pt]={id:Pt,type:"metadata_accumulator",generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:"",negative_prompt:r,model:i,seed:0,steps:a,rand_device:b?"cpu":"cuda",scheduler:s,vae:void 0,controlnets:[],loras:[],clip_skip:c},w.edges.push({source:{node_id:Pt,field:"metadata"},destination:{node_id:Ke,field:"metadata"}}),(p||m)&&(ds(e,w,g),g=Br),fs(e,w,g),yh(e,w,Oe,g),Bu(e,w),ls(e,w,Oe),us(e,w,Oe),e.system.shouldUseNSFWChecker&&cs(e,w),e.system.shouldUseWatermarker&&hs(e,w),w},Gwe=()=>{Te({predicate:e=>Fm.match(e)&&e.payload==="txt2img",effect:async(e,{getState:t,dispatch:n,take:r})=>{const i=ge("session"),o=t(),s=o.generation.model;let a;s&&s.base_model==="sdxl"?a=jwe(o):a=Vwe(o),n(QB(a)),i.debug({graph:mn(a)},"Text to Image graph built"),n(xi({graph:a})),await r(xi.fulfilled.match),n(od())}})},Hwe=Ru(null),qwe=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,RR=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(qwe);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},IR=e=>e==="*"||e==="x"||e==="X",OR=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},Wwe=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],Kwe=(e,t)=>{if(IR(e)||IR(t))return 0;const[n,r]=Wwe(OR(e),OR(t));return n>r?1:n{for(let n=0;n{const n=RR(e),r=RR(t),i=n.pop(),o=r.pop(),s=MR(n,r);return s!==0?s:i&&o?MR(i.split("."),o.split(".")):i||o?i?-1:1:0},Qwe=(e,t)=>{const n=Jn(e),{nodes:r,edges:i}=n,o=[],s=r.filter(vC),a=v5(s,"id");return r.forEach(l=>{if(!vC(l))return;const u=t[l.data.type];if(!u){o.push({message:`${we.t("nodes.node")} "${l.data.type}" ${we.t("nodes.skipped")}`,issues:[`${we.t("nodes.nodeType")}"${l.data.type}" ${we.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&Xwe(u.version,l.data.version)!==0){o.push({message:`${we.t("nodes.node")} "${l.data.type}" ${we.t("nodes.mismatchedVersion")}`,issues:[`${we.t("nodes.node")} "${l.data.type}" v${l.data.version} ${we.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:mn(u)}});return}}),i.forEach((l,u)=>{const c=a[l.source],d=a[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${we.t("nodes.outputNodes")} "${l.source}.${l.sourceHandle}" ${we.t("nodes.doesNotExist")}`):f.push(`${we.t("nodes.outputNode")} ${l.source} ${we.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${we.t("nodes.inputFeilds")} "${l.target}.${l.targetHandle}" ${we.t("nodes.doesNotExist")}`):f.push(`${we.t("nodes.inputNode")} ${l.target} ${we.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${we.t("nodes.sourceNode")} "${l.source}" ${we.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${we.t("nodes.sourceNode")}"${l.target}" ${we.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}},Ywe=()=>{Te({actionCreator:I0e,effect:(e,{dispatch:t,getState:n})=>{const r=ge("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:s,errors:a}=Qwe(i,o);t(kye(s)),a.length?(t(Tn(sa({title:J("toast.loadedWithWarnings"),status:"warning"}))),a.forEach(({message:l,...u})=>{r.warn(u,l)})):t(Tn(sa({title:J("toast.workflowLoaded"),status:"success"}))),t(HB("nodes")),requestAnimationFrame(()=>{var l;(l=Hwe.get())==null||l.fitView()})}})},Yz=NN(),Te=Yz.startListening;xSe();CSe();PSe();pSe();gSe();mSe();ySe();vSe();U0e();wSe();ESe();TSe();Pwe();Uwe();Gwe();Owe();K2e();lSe();iSe();rve();oSe();nve();eve();aSe();uwe();D0e();Y2e();Z2e();twe();nwe();iwe();X2e();Q2e();awe();lwe();owe();swe();rwe();j2e();V2e();G2e();H2e();q2e();W2e();B2e();z2e();U2e();dSe();cSe();fSe();hSe();bSe();SSe();j0e();M2e();Ywe();_Se();RSe();B0e();OSe();$0e();L0e();pwe();dwe();const Zwe={canvas:nre,gallery:Ude,generation:One,nodes:Rye,postprocessing:Iye,system:Bye,config:fte,ui:Gye,hotkeys:Vye,controlNet:Dde,dynamicPrompts:zde,deleteImageModal:Fde,changeBoardModal:ire,lora:Gde,modelmanager:jye,sdxl:Nye,[_u.reducerPath]:_u.reducer},Jwe=rh(Zwe),exe=g0e(Jwe),txe=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlNet","dynamicPrompts","lora","modelmanager"],nxe=pN({reducer:exe,enhancers:e=>e.concat(m0e(window.localStorage,txe,{persistDebounce:300,serialize:A0e,unserialize:P0e,prefix:y0e})).concat(LN()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(_u.middleware).concat(Kye).prepend(Yz.middleware),devTools:{actionSanitizer:O0e,stateSanitizer:N0e,trace:!0,predicate:(e,t)=>!M0e.includes(t.type)}}),rxe=e=>e,ixe=e=>{const{socket:t,storeApi:n}=e,{dispatch:r,getState:i}=n;t.on("connect",()=>{ge("socketio").debug("Connected"),r(O$());const{sessionId:s}=i().system;s&&(t.emit("subscribe",{session:s}),r(H5({sessionId:s})))}),t.on("connect_error",o=>{o&&o.message&&o.data==="ERR_UNAUTHENTICATED"&&r(Tn(sa({title:o.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(N$())}),t.on("invocation_started",o=>{r(B$({data:o}))}),t.on("generator_progress",o=>{r(V$({data:o}))}),t.on("invocation_error",o=>{r(z$({data:o}))}),t.on("invocation_complete",o=>{r(W5({data:o}))}),t.on("graph_execution_state_complete",o=>{r(U$({data:o}))}),t.on("model_load_started",o=>{r(G$({data:o}))}),t.on("model_load_completed",o=>{r(H$({data:o}))}),t.on("session_retrieval_error",o=>{r(q$({data:o}))}),t.on("invocation_retrieval_error",o=>{r(K$({data:o}))})},ba=Object.create(null);ba.open="0";ba.close="1";ba.ping="2";ba.pong="3";ba.message="4";ba.upgrade="5";ba.noop="6";const j0=Object.create(null);Object.keys(ba).forEach(e=>{j0[ba[e]]=e});const p3={type:"error",data:"parser error"},Zz=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Jz=typeof ArrayBuffer=="function",eU=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,jT=({type:e,data:t},n,r)=>Zz&&t instanceof Blob?n?r(t):NR(t,r):Jz&&(t instanceof ArrayBuffer||eU(t))?n?r(t):NR(new Blob([t]),r):r(ba[e]+(t||"")),NR=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function DR(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Dw;function oxe(e,t){if(Zz&&e.data instanceof Blob)return e.data.arrayBuffer().then(DR).then(t);if(Jz&&(e.data instanceof ArrayBuffer||eU(e.data)))return t(DR(e.data));jT(e,!1,n=>{Dw||(Dw=new TextEncoder),t(Dw.encode(n))})}const LR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ap=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,s,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(s&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return u},axe=typeof ArrayBuffer=="function",VT=(e,t)=>{if(typeof e!="string")return{type:"message",data:tU(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:lxe(e.substring(1),t)}:j0[n]?e.length>1?{type:j0[n],data:e.substring(1)}:{type:j0[n]}:p3},lxe=(e,t)=>{if(axe){const n=sxe(e);return tU(n,t)}else return{base64:!0,data:e}},tU=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},nU=String.fromCharCode(30),uxe=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{jT(o,!1,a=>{r[s]=a,++i===n&&t(r.join(nU))})})},cxe=(e,t)=>{const n=e.split(nU),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 Lw;function r0(e){return e.reduce((t,n)=>t+n.length,0)}function i0(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){a.enqueue(p3);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(r0(n)e){a.enqueue(p3);break}}}})}const rU=4;function Rr(e){if(e)return hxe(e)}function hxe(e){for(var t in Rr.prototype)e[t]=Rr.prototype[t];return e}Rr.prototype.on=Rr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Rr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};Rr.prototype.off=Rr.prototype.removeListener=Rr.prototype.removeAllListeners=Rr.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 iU(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const pxe=Xo.setTimeout,gxe=Xo.clearTimeout;function LS(e,t){t.useNativeTimers?(e.setTimeoutFn=pxe.bind(Xo),e.clearTimeoutFn=gxe.bind(Xo)):(e.setTimeoutFn=Xo.setTimeout.bind(Xo),e.clearTimeoutFn=Xo.clearTimeout.bind(Xo))}const mxe=1.33;function yxe(e){return typeof e=="string"?vxe(e):Math.ceil((e.byteLength||e.size)*mxe)}function vxe(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function _xe(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function bxe(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function sU(){const e=BR(+new Date);return e!==FR?($R=0,FR=e):e+"."+BR($R++)}for(;o0{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)};cxe(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,uxe(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]=sU()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new bf(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let bf=class V0 extends Rr{constructor(t,n){super(),LS(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=iU(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new lU(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=V0.requestsCount++,V0.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=Cxe,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete V0.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};bf.requestsCount=0;bf.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",zR);else if(typeof addEventListener=="function"){const e="onpagehide"in Xo?"pagehide":"unload";addEventListener(e,zR,!1)}}function zR(){for(let e in bf.requests)bf.requests.hasOwnProperty(e)&&bf.requests[e].abort()}const HT=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),s0=Xo.WebSocket||Xo.MozWebSocket,UR=!0,Axe="arraybuffer",jR=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class kxe extends GT{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=jR?{}:iU(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=UR&&!jR?n?new s0(t,n):new s0(t):new s0(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 s={};try{UR&&this.ws.send(o)}catch{}i&&HT(()=>{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]=sU()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!s0}}class Pxe extends GT{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=fxe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=dxe();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:a,value:l})=>{a||(this.onPacket(l),o())}).catch(a=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this.writer.write(s).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&HT(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const Rxe={websocket:kxe,webtransport:Pxe,polling:Txe},Ixe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Oxe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function m3(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=Ixe.exec(e||""),o={},s=14;for(;s--;)o[Oxe[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Mxe(o,o.path),o.queryKey=Nxe(o,o.query),o}function Mxe(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 Nxe(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let uU=class Od extends Rr{constructor(t,n={}){super(),this.binaryType=Axe,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=m3(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=m3(n.host).host),LS(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=bxe(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=rU,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 Rxe[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Od.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;Od.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;Od.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 s=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function a(){s("transport closed")}function l(){s("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",a),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Od.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){Od.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,cU=Object.prototype.toString,Fxe=typeof Blob=="function"||typeof Blob<"u"&&cU.call(Blob)==="[object BlobConstructor]",Bxe=typeof File=="function"||typeof File<"u"&&cU.call(File)==="[object FileConstructor]";function qT(e){return Lxe&&(e instanceof ArrayBuffer||$xe(e))||Fxe&&e instanceof Blob||Bxe&&e instanceof File}function G0(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let s=0;s{this.io.clearTimeoutFn(o),n.apply(this,[null,...s])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((s,a)=>r?s?o(s):i(a):i(s)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Nt.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 Nt.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 Nt.EVENT:case Nt.BINARY_EVENT:this.onevent(t);break;case Nt.ACK:case Nt.BINARY_ACK:this.onack(t);break;case Nt.DISCONNECT:this.ondisconnect();break;case Nt.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:Nt.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:Nt.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}bh.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};bh.prototype.reset=function(){this.attempts=0};bh.prototype.setMin=function(e){this.ms=e};bh.prototype.setMax=function(e){this.max=e};bh.prototype.setJitter=function(e){this.jitter=e};class _3 extends Rr{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,LS(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 bh({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||qxe;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 uU(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Ss(n,"open",function(){r.onopen(),t&&t()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},s=Ss(n,"error",o);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ss(t,"ping",this.onping.bind(this)),Ss(t,"data",this.ondata.bind(this)),Ss(t,"error",this.onerror.bind(this)),Ss(t,"close",this.onclose.bind(this)),Ss(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){HT(()=>{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 dU(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 Kh={};function H0(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=Dxe(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=Kh[i]&&o in Kh[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let l;return a?l=new _3(r,t):(Kh[i]||(Kh[i]=new _3(r,t)),l=Kh[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(H0,{Manager:_3,Socket:dU,io:H0,connect:H0});const GR=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const s=_g.get();s&&(n=s.replace(/^https?\:\/\//i,""));const a=$f.get();a&&(r.auth={token:a}),r.transports=["websocket","polling"]}const i=H0(n,r);return s=>a=>l=>{const{dispatch:u,getState:c}=s;if(e||(ixe({storeApi:s,socket:i}),e=!0,i.connect()),xi.fulfilled.match(l)){const d=l.payload.id,f=c().system.sessionId;f&&(i.emit("unsubscribe",{session:f}),u($$({sessionId:f}))),i.emit("subscribe",{session:d}),u(H5({sessionId:d}))}a(l)}};function Kxe(e){if(e.sheet)return e.sheet;for(var t=0;t0?_i(Sh,--vo):0,Yf--,kr===10&&(Yf=1,FS--),kr}function Oo(){return kr=vo2||Wg(kr)>3?"":" "}function aCe(e,t){for(;--t&&Oo()&&!(kr<48||kr>102||kr>57&&kr<65||kr>70&&kr<97););return Gm(e,q0()+(t<6&&ga()==32&&Oo()==32))}function S3(e){for(;Oo();)switch(kr){case e:return vo;case 34:case 39:e!==34&&e!==39&&S3(kr);break;case 40:e===41&&S3(e);break;case 92:Oo();break}return vo}function lCe(e,t){for(;Oo()&&e+kr!==47+10;)if(e+kr===42+42&&ga()===47)break;return"/*"+Gm(t,vo-1)+"*"+$S(e===47?e:Oo())}function uCe(e){for(;!Wg(ga());)Oo();return Gm(e,vo)}function cCe(e){return yU(K0("",null,null,null,[""],e=mU(e),0,[0],e))}function K0(e,t,n,r,i,o,s,a,l){for(var u=0,c=0,d=s,f=0,h=0,p=0,m=1,b=1,_=1,y=0,g="",v=i,S=o,w=r,x=g;b;)switch(p=y,y=Oo()){case 40:if(p!=108&&_i(x,d-1)==58){b3(x+=en(W0(y),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:x+=W0(y);break;case 9:case 10:case 13:case 32:x+=sCe(p);break;case 92:x+=aCe(q0()-1,7);continue;case 47:switch(ga()){case 42:case 47:a0(dCe(lCe(Oo(),q0()),t,n),l);break;default:x+="/"}break;case 123*m:a[u++]=Zs(x)*_;case 125*m:case 59:case 0:switch(y){case 0:case 125:b=0;case 59+c:_==-1&&(x=en(x,/\f/g,"")),h>0&&Zs(x)-d&&a0(h>32?qR(x+";",r,n,d-1):qR(en(x," ","")+";",r,n,d-2),l);break;case 59:x+=";";default:if(a0(w=HR(x,t,n,u,c,i,a,g,v=[],S=[],d),o),y===123)if(c===0)K0(x,t,w,w,v,o,d,a,S);else switch(f===99&&_i(x,3)===110?100:f){case 100:case 108:case 109:case 115:K0(e,w,w,r&&a0(HR(e,w,w,0,0,i,a,g,i,v=[],d),S),i,S,d,a,r?v:S);break;default:K0(x,w,w,w,[""],S,0,a,S)}}u=c=h=0,m=_=1,g=x="",d=s;break;case 58:d=1+Zs(x),h=p;default:if(m<1){if(y==123)--m;else if(y==125&&m++==0&&oCe()==125)continue}switch(x+=$S(y),y*m){case 38:_=c>0?1:(x+="\f",-1);break;case 44:a[u++]=(Zs(x)-1)*_,_=1;break;case 64:ga()===45&&(x+=W0(Oo())),f=ga(),c=d=Zs(g=x+=uCe(q0())),y++;break;case 45:p===45&&Zs(x)==2&&(m=0)}}return o}function HR(e,t,n,r,i,o,s,a,l,u,c){for(var d=i-1,f=i===0?o:[""],h=QT(f),p=0,m=0,b=0;p0?f[_]+" "+y:en(y,/&\f/g,f[_])))&&(l[b++]=g);return BS(e,t,n,i===0?KT:a,l,u,c)}function dCe(e,t,n){return BS(e,t,n,fU,$S(iCe()),qg(e,2,-2),0)}function qR(e,t,n,r){return BS(e,t,n,XT,qg(e,0,r),qg(e,r+1,-1),r)}function Sf(e,t){for(var n="",r=QT(e),i=0;i6)switch(_i(e,t+1)){case 109:if(_i(e,t+4)!==45)break;case 102:return en(e,/(.+:)(.+)-([^]+)/,"$1"+Jt+"$2-$3$1"+I1+(_i(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~b3(e,"stretch")?_U(en(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(_i(e,t+1)!==115)break;case 6444:switch(_i(e,Zs(e)-3-(~b3(e,"!important")&&10))){case 107:return en(e,":",":"+Jt)+e;case 101:return en(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Jt+(_i(e,14)===45?"inline-":"")+"box$3$1"+Jt+"$2$3$1"+Ri+"$2box$3")+e}break;case 5936:switch(_i(e,t+11)){case 114:return Jt+e+Ri+en(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Jt+e+Ri+en(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Jt+e+Ri+en(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Jt+e+Ri+e+e}return e}var bCe=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case XT:t.return=_U(t.value,t.length);break;case hU:return Sf([Xh(t,{value:en(t.value,"@","@"+Jt)})],i);case KT:if(t.length)return rCe(t.props,function(o){switch(nCe(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Sf([Xh(t,{props:[en(o,/:(read-\w+)/,":"+I1+"$1")]})],i);case"::placeholder":return Sf([Xh(t,{props:[en(o,/:(plac\w+)/,":"+Jt+"input-$1")]}),Xh(t,{props:[en(o,/:(plac\w+)/,":"+I1+"$1")]}),Xh(t,{props:[en(o,/:(plac\w+)/,Ri+"input-$1")]})],i)}return""})}},SCe=[bCe],wCe=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 b=m.getAttribute("data-emotion");b.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||SCe,o={},s,a=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var b=m.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var TCe={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},ACe=/[A-Z]|^ms/g,kCe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,wU=function(t){return t.charCodeAt(1)===45},XR=function(t){return t!=null&&typeof t!="boolean"},$w=vU(function(e){return wU(e)?e:e.replace(ACe,"-$&").toLowerCase()}),QR=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(kCe,function(r,i,o){return Js={name:i,styles:o,next:Js},i})}return TCe[t]!==1&&!wU(t)&&typeof n=="number"&&n!==0?n+"px":n};function Kg(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 Js={name:n.name,styles:n.styles,next:Js},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)Js={name:r.name,styles:r.styles,next:Js},r=r.next;var i=n.styles+";";return i}return PCe(e,t,n)}case"function":{if(e!==void 0){var o=Js,s=n(e);return Js=o,Kg(e,t,s)}break}}if(t==null)return n;var a=t[n];return a!==void 0?a:n}function PCe(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return e}var AU=M.createContext({});AU.displayName="ColorModeContext";function ZT(){const e=M.useContext(AU);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function DMe(e,t){const{colorMode:n}=ZT();return n==="dark"?t:e}function $Ce(){const e=ZT(),t=TU();return{...e,theme:t}}function FCe(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__breakpoints)==null?void 0:a.asArray)==null?void 0:l[s]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function BCe(e,t,n){var r,i;if(t==null)return t;const o=s=>{var a,l;return(l=(a=e.__cssMap)==null?void 0:a[s])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function LMe(e,t,n){const r=TU();return zCe(e,t,n)(r)}function zCe(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const s=i.filter(Boolean),a=r.map((l,u)=>{var c,d;if(e==="breakpoints")return FCe(o,l,(c=s[u])!=null?c:l);const f=`${e}.${l}`;return BCe(o,f,(d=s[u])!=null?d:l)});return Array.isArray(t)?a:a[0]}}var JT=(...e)=>e.filter(Boolean).join(" ");function UCe(){return!1}function Za(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var $Me=e=>{const{condition:t,message:n}=e;t&&UCe()&&console.warn(n)};function pc(e,...t){return jCe(e)?e(...t):e}var jCe=e=>typeof e=="function",FMe=e=>e?"":void 0,BMe=e=>e?!0:void 0;function zMe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function UMe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var O1={exports:{}};O1.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",b="[object Number]",_="[object Null]",y="[object Object]",g="[object Proxy]",v="[object RegExp]",S="[object Set]",w="[object String]",x="[object Undefined]",C="[object WeakMap]",A="[object ArrayBuffer]",T="[object DataView]",k="[object Float32Array]",L="[object Float64Array]",N="[object Int8Array]",E="[object Int16Array]",P="[object Int32Array]",D="[object Uint8Array]",B="[object Uint8ClampedArray]",R="[object Uint16Array]",I="[object Uint32Array]",O=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,V={};V[k]=V[L]=V[N]=V[E]=V[P]=V[D]=V[B]=V[R]=V[I]=!0,V[a]=V[l]=V[A]=V[c]=V[T]=V[d]=V[f]=V[h]=V[m]=V[b]=V[y]=V[v]=V[S]=V[w]=V[C]=!1;var H=typeof dt=="object"&&dt&&dt.Object===Object&&dt,Y=typeof self=="object"&&self&&self.Object===Object&&self,Q=H||Y||Function("return this")(),j=t&&!t.nodeType&&t,K=j&&!0&&e&&!e.nodeType&&e,te=K&&K.exports===j,oe=te&&H.process,me=function(){try{var $=K&&K.require&&K.require("util").types;return $||oe&&oe.binding&&oe.binding("util")}catch{}}(),le=me&&me.isTypedArray;function ht($,G,X){switch(X.length){case 0:return $.call(G);case 1:return $.call(G,X[0]);case 2:return $.call(G,X[0],X[1]);case 3:return $.call(G,X[0],X[1],X[2])}return $.apply(G,X)}function nt($,G){for(var X=-1,fe=Array($);++X<$;)fe[X]=G(X);return fe}function $e($){return function(G){return $(G)}}function ct($,G){return $==null?void 0:$[G]}function Pe($,G){return function(X){return $(G(X))}}var qt=Array.prototype,Sr=Function.prototype,Pn=Object.prototype,bn=Q["__core-js_shared__"],Wt=Sr.toString,Rn=Pn.hasOwnProperty,wr=function(){var $=/[^.]+$/.exec(bn&&bn.keys&&bn.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),to=Pn.toString,Gr=Wt.call(Object),ar=RegExp("^"+Wt.call(Rn).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Or=te?Q.Buffer:void 0,Hr=Q.Symbol,In=Q.Uint8Array,dn=Or?Or.allocUnsafe:void 0,Ci=Pe(Object.getPrototypeOf,Object),si=Object.create,ji=Pn.propertyIsEnumerable,ps=qt.splice,xr=Hr?Hr.toStringTag:void 0,no=function(){try{var $=Yn(Object,"defineProperty");return $({},"",{}),$}catch{}}(),Ta=Or?Or.isBuffer:void 0,bo=Math.max,Aa=Date.now,On=Yn(Q,"Map"),Kt=Yn(Object,"create"),Mr=function(){function $(){}return function(G){if(!qe(G))return{};if(si)return si(G);$.prototype=G;var X=new $;return $.prototype=void 0,X}}();function Cr($){var G=-1,X=$==null?0:$.length;for(this.clear();++G-1}function zo($,G){var X=this.__data__,fe=Xe(X,$);return fe<0?(++this.size,X.push([$,G])):X[fe][1]=G,this}Nr.prototype.clear=gs,Nr.prototype.delete=Vs,Nr.prototype.get=li,Nr.prototype.has=_l,Nr.prototype.set=zo;function Wr($){var G=-1,X=$==null?0:$.length;for(this.clear();++G1?X[St-1]:void 0,wn=St>2?X[2]:void 0;for(on=$.length>3&&typeof on=="function"?(St--,on):void 0,wn&&Rt(X[0],X[1],wn)&&(on=St<3?void 0:on,St=1),G=Object(G);++fe-1&&$%1==0&&$0){if(++G>=i)return arguments[0]}else G=0;return $.apply(void 0,arguments)}}function lt($){if($!=null){try{return Wt.call($)}catch{}try{return $+""}catch{}}return""}function ze($,G){return $===G||$!==$&&G!==G}var be=mt(function(){return arguments}())?mt:function($){return ke($)&&Rn.call($,"callee")&&!ji.call($,"callee")},ae=Array.isArray;function xe($){return $!=null&&Ze($.length)&&!Se($)}function ce($){return ke($)&&xe($)}var he=Ta||Vi;function Se($){if(!qe($))return!1;var G=at($);return G==h||G==p||G==u||G==g}function Ze($){return typeof $=="number"&&$>-1&&$%1==0&&$<=s}function qe($){var G=typeof $;return $!=null&&(G=="object"||G=="function")}function ke($){return $!=null&&typeof $=="object"}function Ct($){if(!ke($)||at($)!=y)return!1;var G=Ci($);if(G===null)return!0;var X=Rn.call(G,"constructor")&&G.constructor;return typeof X=="function"&&X instanceof X&&Wt.call(X)==Gr}var $t=le?$e(le):xt;function Ft($){return ms($,Zn($))}function Zn($){return xe($)?Re($,!0):tn($)}var lr=tt(function($,G,X,fe){nn($,G,X,fe)});function Mn($){return function(){return $}}function Sn($){return $}function Vi(){return!1}e.exports=lr})(O1,O1.exports);var VCe=O1.exports;const aa=Uc(VCe);var GCe=e=>/!(important)?$/.test(e),JR=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,HCe=(e,t)=>n=>{const r=String(t),i=GCe(r),o=JR(r),s=e?`${e}.${o}`:o;let a=Za(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:t;return a=JR(a),i?`${a} !important`:a};function e4(e){const{scale:t,transform:n,compose:r}=e;return(o,s)=>{var a;const l=HCe(t,o)(s);let u=(a=n==null?void 0:n(l,s))!=null?a:l;return r&&(u=r(u,s)),u}}var l0=(...e)=>t=>e.reduce((n,r)=>r(n),t);function Vo(e,t){return n=>{const r={property:n,scale:e};return r.transform=e4({scale:e,transform:t}),r}}var qCe=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function WCe(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:qCe(t),transform:n?e4({scale:n,compose:r}):r}}var kU=["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 KCe(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...kU].join(" ")}function XCe(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...kU].join(" ")}var QCe={"--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(" ")},YCe={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 ZCe(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 JCe={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},w3={"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"},e3e=new Set(Object.values(w3)),x3=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),t3e=e=>e.trim();function n3e(e,t){if(e==null||x3.has(e))return e;if(!(C3(e)||x3.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],s=i==null?void 0:i[2];if(!o||!s)return e;const a=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=s.split(",").map(t3e).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in w3?w3[l]:l;u.unshift(c);const d=u.map(f=>{if(e3e.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],b=C3(m)?m:m&&m.split(" "),_=`colors.${p}`,y=_ in t.__cssMap?t.__cssMap[_].varRef:p;return b?[y,...Array.isArray(b)?b:[b]].join(" "):y});return`${a}(${d.join(", ")})`}var C3=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),r3e=(e,t)=>n3e(e,t??{});function i3e(e){return/^var\(--.+\)$/.test(e)}var o3e=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},Ks=e=>t=>`${e}(${t})`,jt={filter(e){return e!=="auto"?e:QCe},backdropFilter(e){return e!=="auto"?e:YCe},ring(e){return ZCe(jt.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?KCe():e==="auto-gpu"?XCe():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=o3e(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(i3e(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:r3e,blur:Ks("blur"),opacity:Ks("opacity"),brightness:Ks("brightness"),contrast:Ks("contrast"),dropShadow:Ks("drop-shadow"),grayscale:Ks("grayscale"),hueRotate:Ks("hue-rotate"),invert:Ks("invert"),saturate:Ks("saturate"),sepia:Ks("sepia"),bgImage(e){return e==null||C3(e)||x3.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=JCe[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},q={borderWidths:Vo("borderWidths"),borderStyles:Vo("borderStyles"),colors:Vo("colors"),borders:Vo("borders"),gradients:Vo("gradients",jt.gradient),radii:Vo("radii",jt.px),space:Vo("space",l0(jt.vh,jt.px)),spaceT:Vo("space",l0(jt.vh,jt.px)),degreeT(e){return{property:e,transform:jt.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:e4({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:Vo("sizes",l0(jt.vh,jt.px)),sizesT:Vo("sizes",l0(jt.vh,jt.fraction)),shadows:Vo("shadows"),logical:WCe,blur:Vo("blur",jt.blur)},X0={background:q.colors("background"),backgroundColor:q.colors("backgroundColor"),backgroundImage:q.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:jt.bgClip},bgSize:q.prop("backgroundSize"),bgPosition:q.prop("backgroundPosition"),bg:q.colors("background"),bgColor:q.colors("backgroundColor"),bgPos:q.prop("backgroundPosition"),bgRepeat:q.prop("backgroundRepeat"),bgAttachment:q.prop("backgroundAttachment"),bgGradient:q.gradients("backgroundImage"),bgClip:{transform:jt.bgClip}};Object.assign(X0,{bgImage:X0.backgroundImage,bgImg:X0.backgroundImage});var Zt={border:q.borders("border"),borderWidth:q.borderWidths("borderWidth"),borderStyle:q.borderStyles("borderStyle"),borderColor:q.colors("borderColor"),borderRadius:q.radii("borderRadius"),borderTop:q.borders("borderTop"),borderBlockStart:q.borders("borderBlockStart"),borderTopLeftRadius:q.radii("borderTopLeftRadius"),borderStartStartRadius:q.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:q.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:q.radii("borderTopRightRadius"),borderStartEndRadius:q.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:q.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:q.borders("borderRight"),borderInlineEnd:q.borders("borderInlineEnd"),borderBottom:q.borders("borderBottom"),borderBlockEnd:q.borders("borderBlockEnd"),borderBottomLeftRadius:q.radii("borderBottomLeftRadius"),borderBottomRightRadius:q.radii("borderBottomRightRadius"),borderLeft:q.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:q.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:q.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:q.borders(["borderLeft","borderRight"]),borderInline:q.borders("borderInline"),borderY:q.borders(["borderTop","borderBottom"]),borderBlock:q.borders("borderBlock"),borderTopWidth:q.borderWidths("borderTopWidth"),borderBlockStartWidth:q.borderWidths("borderBlockStartWidth"),borderTopColor:q.colors("borderTopColor"),borderBlockStartColor:q.colors("borderBlockStartColor"),borderTopStyle:q.borderStyles("borderTopStyle"),borderBlockStartStyle:q.borderStyles("borderBlockStartStyle"),borderBottomWidth:q.borderWidths("borderBottomWidth"),borderBlockEndWidth:q.borderWidths("borderBlockEndWidth"),borderBottomColor:q.colors("borderBottomColor"),borderBlockEndColor:q.colors("borderBlockEndColor"),borderBottomStyle:q.borderStyles("borderBottomStyle"),borderBlockEndStyle:q.borderStyles("borderBlockEndStyle"),borderLeftWidth:q.borderWidths("borderLeftWidth"),borderInlineStartWidth:q.borderWidths("borderInlineStartWidth"),borderLeftColor:q.colors("borderLeftColor"),borderInlineStartColor:q.colors("borderInlineStartColor"),borderLeftStyle:q.borderStyles("borderLeftStyle"),borderInlineStartStyle:q.borderStyles("borderInlineStartStyle"),borderRightWidth:q.borderWidths("borderRightWidth"),borderInlineEndWidth:q.borderWidths("borderInlineEndWidth"),borderRightColor:q.colors("borderRightColor"),borderInlineEndColor:q.colors("borderInlineEndColor"),borderRightStyle:q.borderStyles("borderRightStyle"),borderInlineEndStyle:q.borderStyles("borderInlineEndStyle"),borderTopRadius:q.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:q.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:q.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:q.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(Zt,{rounded:Zt.borderRadius,roundedTop:Zt.borderTopRadius,roundedTopLeft:Zt.borderTopLeftRadius,roundedTopRight:Zt.borderTopRightRadius,roundedTopStart:Zt.borderStartStartRadius,roundedTopEnd:Zt.borderStartEndRadius,roundedBottom:Zt.borderBottomRadius,roundedBottomLeft:Zt.borderBottomLeftRadius,roundedBottomRight:Zt.borderBottomRightRadius,roundedBottomStart:Zt.borderEndStartRadius,roundedBottomEnd:Zt.borderEndEndRadius,roundedLeft:Zt.borderLeftRadius,roundedRight:Zt.borderRightRadius,roundedStart:Zt.borderInlineStartRadius,roundedEnd:Zt.borderInlineEndRadius,borderStart:Zt.borderInlineStart,borderEnd:Zt.borderInlineEnd,borderTopStartRadius:Zt.borderStartStartRadius,borderTopEndRadius:Zt.borderStartEndRadius,borderBottomStartRadius:Zt.borderEndStartRadius,borderBottomEndRadius:Zt.borderEndEndRadius,borderStartRadius:Zt.borderInlineStartRadius,borderEndRadius:Zt.borderInlineEndRadius,borderStartWidth:Zt.borderInlineStartWidth,borderEndWidth:Zt.borderInlineEndWidth,borderStartColor:Zt.borderInlineStartColor,borderEndColor:Zt.borderInlineEndColor,borderStartStyle:Zt.borderInlineStartStyle,borderEndStyle:Zt.borderInlineEndStyle});var s3e={color:q.colors("color"),textColor:q.colors("color"),fill:q.colors("fill"),stroke:q.colors("stroke")},E3={boxShadow:q.shadows("boxShadow"),mixBlendMode:!0,blendMode:q.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:q.prop("backgroundBlendMode"),opacity:!0};Object.assign(E3,{shadow:E3.boxShadow});var a3e={filter:{transform:jt.filter},blur:q.blur("--chakra-blur"),brightness:q.propT("--chakra-brightness",jt.brightness),contrast:q.propT("--chakra-contrast",jt.contrast),hueRotate:q.degreeT("--chakra-hue-rotate"),invert:q.propT("--chakra-invert",jt.invert),saturate:q.propT("--chakra-saturate",jt.saturate),dropShadow:q.propT("--chakra-drop-shadow",jt.dropShadow),backdropFilter:{transform:jt.backdropFilter},backdropBlur:q.blur("--chakra-backdrop-blur"),backdropBrightness:q.propT("--chakra-backdrop-brightness",jt.brightness),backdropContrast:q.propT("--chakra-backdrop-contrast",jt.contrast),backdropHueRotate:q.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:q.propT("--chakra-backdrop-invert",jt.invert),backdropSaturate:q.propT("--chakra-backdrop-saturate",jt.saturate)},M1={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:jt.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:q.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:q.space("gap"),rowGap:q.space("rowGap"),columnGap:q.space("columnGap")};Object.assign(M1,{flexDir:M1.flexDirection});var PU={gridGap:q.space("gridGap"),gridColumnGap:q.space("gridColumnGap"),gridRowGap:q.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},l3e={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:jt.outline},outlineOffset:!0,outlineColor:q.colors("outlineColor")},Ho={width:q.sizesT("width"),inlineSize:q.sizesT("inlineSize"),height:q.sizes("height"),blockSize:q.sizes("blockSize"),boxSize:q.sizes(["width","height"]),minWidth:q.sizes("minWidth"),minInlineSize:q.sizes("minInlineSize"),minHeight:q.sizes("minHeight"),minBlockSize:q.sizes("minBlockSize"),maxWidth:q.sizes("maxWidth"),maxInlineSize:q.sizes("maxInlineSize"),maxHeight:q.sizes("maxHeight"),maxBlockSize:q.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:q.propT("float",jt.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(Ho,{w:Ho.width,h:Ho.height,minW:Ho.minWidth,maxW:Ho.maxWidth,minH:Ho.minHeight,maxH:Ho.maxHeight,overscroll:Ho.overscrollBehavior,overscrollX:Ho.overscrollBehaviorX,overscrollY:Ho.overscrollBehaviorY});var u3e={listStyleType:!0,listStylePosition:!0,listStylePos:q.prop("listStylePosition"),listStyleImage:!0,listStyleImg:q.prop("listStyleImage")};function c3e(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},f3e=d3e(c3e),h3e={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},p3e={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Fw=(e,t,n)=>{const r={},i=f3e(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},g3e={srOnly:{transform(e){return e===!0?h3e:e==="focusable"?p3e:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>Fw(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>Fw(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>Fw(t,e,n)}},Tp={position:!0,pos:q.prop("position"),zIndex:q.prop("zIndex","zIndices"),inset:q.spaceT("inset"),insetX:q.spaceT(["left","right"]),insetInline:q.spaceT("insetInline"),insetY:q.spaceT(["top","bottom"]),insetBlock:q.spaceT("insetBlock"),top:q.spaceT("top"),insetBlockStart:q.spaceT("insetBlockStart"),bottom:q.spaceT("bottom"),insetBlockEnd:q.spaceT("insetBlockEnd"),left:q.spaceT("left"),insetInlineStart:q.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:q.spaceT("right"),insetInlineEnd:q.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Tp,{insetStart:Tp.insetInlineStart,insetEnd:Tp.insetInlineEnd});var m3e={ring:{transform:jt.ring},ringColor:q.colors("--chakra-ring-color"),ringOffset:q.prop("--chakra-ring-offset-width"),ringOffsetColor:q.colors("--chakra-ring-offset-color"),ringInset:q.prop("--chakra-ring-inset")},Dn={margin:q.spaceT("margin"),marginTop:q.spaceT("marginTop"),marginBlockStart:q.spaceT("marginBlockStart"),marginRight:q.spaceT("marginRight"),marginInlineEnd:q.spaceT("marginInlineEnd"),marginBottom:q.spaceT("marginBottom"),marginBlockEnd:q.spaceT("marginBlockEnd"),marginLeft:q.spaceT("marginLeft"),marginInlineStart:q.spaceT("marginInlineStart"),marginX:q.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:q.spaceT("marginInline"),marginY:q.spaceT(["marginTop","marginBottom"]),marginBlock:q.spaceT("marginBlock"),padding:q.space("padding"),paddingTop:q.space("paddingTop"),paddingBlockStart:q.space("paddingBlockStart"),paddingRight:q.space("paddingRight"),paddingBottom:q.space("paddingBottom"),paddingBlockEnd:q.space("paddingBlockEnd"),paddingLeft:q.space("paddingLeft"),paddingInlineStart:q.space("paddingInlineStart"),paddingInlineEnd:q.space("paddingInlineEnd"),paddingX:q.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:q.space("paddingInline"),paddingY:q.space(["paddingTop","paddingBottom"]),paddingBlock:q.space("paddingBlock")};Object.assign(Dn,{m:Dn.margin,mt:Dn.marginTop,mr:Dn.marginRight,me:Dn.marginInlineEnd,marginEnd:Dn.marginInlineEnd,mb:Dn.marginBottom,ml:Dn.marginLeft,ms:Dn.marginInlineStart,marginStart:Dn.marginInlineStart,mx:Dn.marginX,my:Dn.marginY,p:Dn.padding,pt:Dn.paddingTop,py:Dn.paddingY,px:Dn.paddingX,pb:Dn.paddingBottom,pl:Dn.paddingLeft,ps:Dn.paddingInlineStart,paddingStart:Dn.paddingInlineStart,pr:Dn.paddingRight,pe:Dn.paddingInlineEnd,paddingEnd:Dn.paddingInlineEnd});var y3e={textDecorationColor:q.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:q.shadows("textShadow")},v3e={clipPath:!0,transform:q.propT("transform",jt.transform),transformOrigin:!0,translateX:q.spaceT("--chakra-translate-x"),translateY:q.spaceT("--chakra-translate-y"),skewX:q.degreeT("--chakra-skew-x"),skewY:q.degreeT("--chakra-skew-y"),scaleX:q.prop("--chakra-scale-x"),scaleY:q.prop("--chakra-scale-y"),scale:q.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:q.degreeT("--chakra-rotate")},_3e={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:q.prop("transitionDuration","transition.duration"),transitionProperty:q.prop("transitionProperty","transition.property"),transitionTimingFunction:q.prop("transitionTimingFunction","transition.easing")},b3e={fontFamily:q.prop("fontFamily","fonts"),fontSize:q.prop("fontSize","fontSizes",jt.px),fontWeight:q.prop("fontWeight","fontWeights"),lineHeight:q.prop("lineHeight","lineHeights"),letterSpacing:q.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},S3e={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:q.spaceT("scrollMargin"),scrollMarginTop:q.spaceT("scrollMarginTop"),scrollMarginBottom:q.spaceT("scrollMarginBottom"),scrollMarginLeft:q.spaceT("scrollMarginLeft"),scrollMarginRight:q.spaceT("scrollMarginRight"),scrollMarginX:q.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:q.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:q.spaceT("scrollPadding"),scrollPaddingTop:q.spaceT("scrollPaddingTop"),scrollPaddingBottom:q.spaceT("scrollPaddingBottom"),scrollPaddingLeft:q.spaceT("scrollPaddingLeft"),scrollPaddingRight:q.spaceT("scrollPaddingRight"),scrollPaddingX:q.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:q.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function RU(e){return Za(e)&&e.reference?e.reference:String(e)}var zS=(e,...t)=>t.map(RU).join(` ${e} `).replace(/calc/g,""),eI=(...e)=>`calc(${zS("+",...e)})`,tI=(...e)=>`calc(${zS("-",...e)})`,T3=(...e)=>`calc(${zS("*",...e)})`,nI=(...e)=>`calc(${zS("/",...e)})`,rI=e=>{const t=RU(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:T3(t,-1)},rc=Object.assign(e=>({add:(...t)=>rc(eI(e,...t)),subtract:(...t)=>rc(tI(e,...t)),multiply:(...t)=>rc(T3(e,...t)),divide:(...t)=>rc(nI(e,...t)),negate:()=>rc(rI(e)),toString:()=>e.toString()}),{add:eI,subtract:tI,multiply:T3,divide:nI,negate:rI});function w3e(e,t="-"){return e.replace(/\s+/g,t)}function x3e(e){const t=w3e(e.toString());return E3e(C3e(t))}function C3e(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function E3e(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function T3e(e,t=""){return[t,e].filter(Boolean).join("-")}function A3e(e,t){return`var(${e}${t?`, ${t}`:""})`}function k3e(e,t=""){return x3e(`--${T3e(e,t)}`)}function A3(e,t,n){const r=k3e(e,n);return{variable:r,reference:A3e(r,t)}}function jMe(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=A3(`${e}-${i}`,o);continue}n[r]=A3(`${e}-${r}`)}return n}function P3e(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function R3e(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function k3(e){if(e==null)return e;const{unitless:t}=R3e(e);return t||typeof e=="number"?`${e}px`:e}var IU=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,t4=e=>Object.fromEntries(Object.entries(e).sort(IU));function iI(e){const t=t4(e);return Object.assign(Object.values(t),t)}function I3e(e){const t=Object.keys(t4(e));return new Set(t)}function oI(e){var t;if(!e)return e;e=(t=k3(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function lp(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${k3(e)})`),t&&n.push("and",`(max-width: ${k3(t)})`),n.join(" ")}function O3e(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=iI(e),r=Object.entries(e).sort(IU).map(([s,a],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?oI(d):void 0,{_minW:oI(a),breakpoint:s,minW:a,maxW:d,maxWQuery:lp(null,d),minWQuery:lp(a),minMaxQuery:lp(a,d)}}),i=I3e(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const a=Object.keys(s);return a.length>0&&a.every(l=>i.has(l))},asObject:t4(e),asArray:iI(e),details:r,get(s){return r.find(a=>a.breakpoint===s)},media:[null,...n.map(s=>lp(s)).slice(1)],toArrayValue(s){if(!Za(s))throw new Error("toArrayValue: value must be an object");const a=o.map(l=>{var u;return(u=s[l])!=null?u:null});for(;P3e(a)===null;)a.pop();return a},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((a,l,u)=>{const c=o[u];return c!=null&&l!=null&&(a[c]=l),a},{})}}}var fi={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}`},Tl=e=>OU(t=>e(t,"&"),"[role=group]","[data-group]",".group"),Ma=e=>OU(t=>e(t,"~ &"),"[data-peer]",".peer"),OU=(e,...t)=>t.map(e).join(", "),US={_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:Tl(fi.hover),_peerHover:Ma(fi.hover),_groupFocus:Tl(fi.focus),_peerFocus:Ma(fi.focus),_groupFocusVisible:Tl(fi.focusVisible),_peerFocusVisible:Ma(fi.focusVisible),_groupActive:Tl(fi.active),_peerActive:Ma(fi.active),_groupDisabled:Tl(fi.disabled),_peerDisabled:Ma(fi.disabled),_groupInvalid:Tl(fi.invalid),_peerInvalid:Ma(fi.invalid),_groupChecked:Tl(fi.checked),_peerChecked:Ma(fi.checked),_groupFocusWithin:Tl(fi.focusWithin),_peerFocusWithin:Ma(fi.focusWithin),_peerPlaceholderShown:Ma(fi.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]"},MU=Object.keys(US);function sI(e,t){return A3(String(e).replace(/\./g,"-"),void 0,t)}function M3e(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:s,value:a}=o,{variable:l,reference:u}=sI(i,t==null?void 0:t.cssVarPrefix);if(!s){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,b=rc.negate(a),_=rc.negate(u);r[m]={value:b,var:l,varRef:_}}n[l]=a,r[i]={value:a,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:b}=sI(p,t==null?void 0:t.cssVarPrefix);return b},d=Za(a)?a:{default:a};n=aa(n,Object.entries(d).reduce((f,[h,p])=>{var m,b;if(!p)return f;const _=c(`${p}`);if(h==="default")return f[l]=_,f;const y=(b=(m=US)==null?void 0:m[h])!=null?b:h;return f[y]={[l]:_},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function N3e(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function D3e(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function L3e(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function aI(e,t,n={}){const{stop:r,getKey:i}=n;function o(s,a=[]){var l;if(L3e(s)||Array.isArray(s)){const u={};for(const[c,d]of Object.entries(s)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...a,f];if(r!=null&&r(s,h))return t(s,a);u[f]=o(d,h)}return u}return t(s,a)}return o(e)}var $3e=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function F3e(e){return D3e(e,$3e)}function B3e(e){return e.semanticTokens}function z3e(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var U3e=e=>MU.includes(e)||e==="default";function j3e({tokens:e,semanticTokens:t}){const n={};return aI(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),aI(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(U3e)}),n}function VMe(e){var t;const n=z3e(e),r=F3e(n),i=B3e(n),o=j3e({tokens:r,semanticTokens:i}),s=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:a,cssVars:l}=M3e(o,{cssVarPrefix:s});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:a,__breakpoints:O3e(n.breakpoints)}),n}var n4=aa({},X0,Zt,s3e,M1,Ho,a3e,m3e,l3e,PU,g3e,Tp,E3,Dn,S3e,b3e,y3e,v3e,u3e,_3e),V3e=Object.assign({},Dn,Ho,M1,PU,Tp),GMe=Object.keys(V3e),G3e=[...Object.keys(n4),...MU],H3e={...n4,...US},q3e=e=>e in H3e,W3e=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const s in e){let a=pc(e[s],t);if(a==null)continue;if(a=Za(a)&&n(a)?r(a):a,!Array.isArray(a)){o[s]=a;continue}const l=a.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!X3e(t),Y3e=(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},[s,a]=K3e(t);return t=(r=(n=i(s))!=null?n:o(a))!=null?r:o(t),t};function Z3e(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,s=!1)=>{var a,l,u;const c=pc(o,r),d=W3e(c)(r);let f={};for(let h in d){const p=d[h];let m=pc(p,r);h in n&&(h=n[h]),Q3e(h,m)&&(m=Y3e(r,m));let b=t[h];if(b===!0&&(b={property:h}),Za(m)){f[h]=(a=f[h])!=null?a:{},f[h]=aa({},f[h],i(m,!0));continue}let _=(u=(l=b==null?void 0:b.transform)==null?void 0:l.call(b,m,r,c))!=null?u:m;_=b!=null&&b.processResult?i(_,!0):_;const y=pc(b==null?void 0:b.property,r);if(!s&&(b!=null&&b.static)){const g=pc(b.static,r);f=aa({},f,g)}if(y&&Array.isArray(y)){for(const g of y)f[g]=_;continue}if(y){y==="&"&&Za(_)?f=aa({},f,_):f[y]=_;continue}if(Za(_)){f=aa({},f,_);continue}f[h]=_}return f};return i}var J3e=e=>t=>Z3e({theme:t,pseudos:US,configs:n4})(e);function HMe(e){return e}function qMe(e){return e}function WMe(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function eEe(e,t){if(Array.isArray(e))return e;if(Za(e))return t(e);if(e!=null)return[e]}function tEe(e,t){for(let n=t+1;n{aa(u,{[g]:f?y[g]:{[_]:y[g]}})});continue}if(!h){f?aa(u,y):u[_]=y;continue}u[_]=y}}return u}}function rEe(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,s=nEe(o);return aa({},pc((n=e.baseStyle)!=null?n:{},t),s(e,"sizes",i,t),s(e,"variants",r,t))}}function KMe(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 r4(e){return N3e(e,["styleConfig","size","variant","colorScheme"])}function iEe(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function oEe(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,s)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const a=t.get(r);if(a.has(i))return a.get(i);const l=e(r,i,o,s);return a.set(i,l),l}},aEe=sEe(oEe);function NU(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var DU=e=>NU(e,t=>t!=null);function lEe(e){return typeof e=="function"}function uEe(e,...t){return lEe(e)?e(...t):e}function XMe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var cEe=typeof Element<"u",dEe=typeof Map=="function",fEe=typeof Set=="function",hEe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Q0(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(!Q0(e[r],t[r]))return!1;return!0}var o;if(dEe&&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(!Q0(r.value[1],t.get(r.value[0])))return!1;return!0}if(fEe&&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(hEe&&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(cEe&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!Q0(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var pEe=function(t,n){try{return Q0(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 gEe=Uc(pEe);function LU(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:s}=$Ce(),a=e?aEe(o,`components.${e}`):void 0,l=r||a,u=aa({theme:o,colorMode:s},(n=l==null?void 0:l.defaultProps)!=null?n:{},DU(iEe(i,["children"]))),c=M.useRef({});if(l){const f=rEe(l)(u);gEe(c.current,f)||(c.current=f)}return c.current}function i4(e,t={}){return LU(e,t)}function QMe(e,t={}){return LU(e,t)}var mEe=new Set([...G3e,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),yEe=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function vEe(e){return yEe.has(e)||!mEe.has(e)}function _Ee(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 bEe(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var SEe=/^((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)-.*))$/,wEe=vU(function(e){return SEe.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),xEe=wEe,CEe=function(t){return t!=="theme"},lI=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?xEe:CEe},uI=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(s){return t.__emotion_forwardProp(s)&&o(s)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},EEe=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return bU(n,r,i),ICe(function(){return SU(n,r,i)}),null},TEe=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,s;n!==void 0&&(o=n.label,s=n.target);var a=uI(t,n,r),l=a||lI(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,...s}=t,a=NU(s,(d,f)=>q3e(f)),l=uEe(e,t),u=_Ee({},i,l,DU(a),o),c=J3e(u)(t.theme);return r?[c,r]:c};function Bw(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=vEe);const i=PEe({baseStyle:n}),o=kEe(e,r)(i);return vn.forwardRef(function(l,u){const{colorMode:c,forced:d}=ZT();return vn.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function REe(){const e=new Map;return new Proxy(Bw,{apply(t,n,r){return Bw(...r)},get(t,n){return e.has(n)||e.set(n,Bw(n)),e.get(n)}})}var wu=REe();function zu(e){return M.forwardRef(e)}const $U=M.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),jS=M.createContext({}),Hm=M.createContext(null),VS=typeof document<"u",o4=VS?M.useLayoutEffect:M.useEffect,FU=M.createContext({strict:!1});function IEe(e,t,n,r){const{visualElement:i}=M.useContext(jS),o=M.useContext(FU),s=M.useContext(Hm),a=M.useContext($U).reducedMotion,l=M.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:s,blockInitialAnimation:s?s.initial===!1:!1,reducedMotionConfig:a}));const u=l.current;M.useInsertionEffect(()=>{u&&u.update(n,s)});const c=M.useRef(!!window.HandoffAppearAnimations);return o4(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),M.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function Kd(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function OEe(e,t,n){return M.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Kd(n)&&(n.current=r))},[t])}function Qg(e){return typeof e=="string"||Array.isArray(e)}function GS(e){return typeof e=="object"&&typeof e.start=="function"}const s4=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],a4=["initial",...s4];function HS(e){return GS(e.animate)||a4.some(t=>Qg(e[t]))}function BU(e){return!!(HS(e)||e.variants)}function MEe(e,t){if(HS(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Qg(n)?n:void 0,animate:Qg(r)?r:void 0}}return e.inherit!==!1?t:{}}function NEe(e){const{initial:t,animate:n}=MEe(e,M.useContext(jS));return M.useMemo(()=>({initial:t,animate:n}),[dI(t),dI(n)])}function dI(e){return Array.isArray(e)?e.join(" "):e}const fI={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"]},Yg={};for(const e in fI)Yg[e]={isEnabled:t=>fI[e].some(n=>!!t[n])};function DEe(e){for(const t in e)Yg[t]={...Yg[t],...e[t]}}const l4=M.createContext({}),zU=M.createContext({}),LEe=Symbol.for("motionComponentSymbol");function $Ee({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&DEe(e);function o(a,l){let u;const c={...M.useContext($U),...a,layoutId:FEe(a)},{isStatic:d}=c,f=NEe(a),h=r(a,d);if(!d&&VS){f.visualElement=IEe(i,h,c,t);const p=M.useContext(zU),m=M.useContext(FU).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return M.createElement(jS.Provider,{value:f},u&&f.visualElement?M.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,a,OEe(h,f.visualElement,l),h,d,f.visualElement))}const s=M.forwardRef(o);return s[LEe]=i,s}function FEe({layoutId:e}){const t=M.useContext(l4).id;return t&&e!==void 0?t+"-"+e:e}function BEe(e){function t(r,i={}){return $Ee(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 zEe=["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 u4(e){return typeof e!="string"||e.includes("-")?!1:!!(zEe.indexOf(e)>-1||/[A-Z]/.test(e))}const D1={};function UEe(e){Object.assign(D1,e)}const qm=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ad=new Set(qm);function UU(e,{layout:t,layoutId:n}){return ad.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!D1[e]||e==="opacity")}const _o=e=>!!(e&&e.getVelocity),jEe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},VEe=qm.length;function GEe(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let s=0;st=>typeof t=="string"&&t.startsWith(e),VU=jU("--"),P3=jU("var(--"),HEe=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,qEe=(e,t)=>t&&typeof e=="number"?t.transform(e):e,xu=(e,t,n)=>Math.min(Math.max(n,e),t),ld={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ap={...ld,transform:e=>xu(0,1,e)},u0={...ld,default:1},kp=e=>Math.round(e*1e5)/1e5,qS=/(-)?([\d]*\.?[\d])+/g,GU=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,WEe=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Wm(e){return typeof e=="string"}const Km=e=>({test:t=>Wm(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),kl=Km("deg"),ma=Km("%"),rt=Km("px"),KEe=Km("vh"),XEe=Km("vw"),hI={...ma,parse:e=>ma.parse(e)/100,transform:e=>ma.transform(e*100)},pI={...ld,transform:Math.round},HU={borderWidth:rt,borderTopWidth:rt,borderRightWidth:rt,borderBottomWidth:rt,borderLeftWidth:rt,borderRadius:rt,radius:rt,borderTopLeftRadius:rt,borderTopRightRadius:rt,borderBottomRightRadius:rt,borderBottomLeftRadius:rt,width:rt,maxWidth:rt,height:rt,maxHeight:rt,size:rt,top:rt,right:rt,bottom:rt,left:rt,padding:rt,paddingTop:rt,paddingRight:rt,paddingBottom:rt,paddingLeft:rt,margin:rt,marginTop:rt,marginRight:rt,marginBottom:rt,marginLeft:rt,rotate:kl,rotateX:kl,rotateY:kl,rotateZ:kl,scale:u0,scaleX:u0,scaleY:u0,scaleZ:u0,skew:kl,skewX:kl,skewY:kl,distance:rt,translateX:rt,translateY:rt,translateZ:rt,x:rt,y:rt,z:rt,perspective:rt,transformPerspective:rt,opacity:Ap,originX:hI,originY:hI,originZ:rt,zIndex:pI,fillOpacity:Ap,strokeOpacity:Ap,numOctaves:pI};function c4(e,t,n,r){const{style:i,vars:o,transform:s,transformOrigin:a}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(VU(d)){o[d]=f;continue}const h=HU[d],p=qEe(f,h);if(ad.has(d)){if(l=!0,s[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,a[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=GEe(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=a;i.transformOrigin=`${d} ${f} ${h}`}}const d4=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function qU(e,t,n){for(const r in t)!_o(t[r])&&!UU(r,n)&&(e[r]=t[r])}function QEe({transformTemplate:e},t,n){return M.useMemo(()=>{const r=d4();return c4(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function YEe(e,t,n){const r=e.style||{},i={};return qU(i,r,e),Object.assign(i,QEe(e,t,n)),e.transformValues?e.transformValues(i):i}function ZEe(e,t,n){const r={},i=YEe(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 JEe=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 L1(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||JEe.has(e)}let WU=e=>!L1(e);function e5e(e){e&&(WU=t=>t.startsWith("on")?!L1(t):e(t))}try{e5e(require("@emotion/is-prop-valid").default)}catch{}function t5e(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(WU(i)||n===!0&&L1(i)||!t&&!L1(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function gI(e,t,n){return typeof e=="string"?e:rt.transform(t+n*e)}function n5e(e,t,n){const r=gI(t,e.x,e.width),i=gI(n,e.y,e.height);return`${r} ${i}`}const r5e={offset:"stroke-dashoffset",array:"stroke-dasharray"},i5e={offset:"strokeDashoffset",array:"strokeDasharray"};function o5e(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?r5e:i5e;e[o.offset]=rt.transform(-r);const s=rt.transform(t),a=rt.transform(n);e[o.array]=`${s} ${a}`}function f4(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...u},c,d,f){if(c4(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=n5e(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),s!==void 0&&o5e(h,s,a,l,!1)}const KU=()=>({...d4(),attrs:{}}),h4=e=>typeof e=="string"&&e.toLowerCase()==="svg";function s5e(e,t,n,r){const i=M.useMemo(()=>{const o=KU();return f4(o,t,{enableHardwareAcceleration:!1},h4(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};qU(o,e.style,e),i.style={...o,...i.style}}return i}function a5e(e=!1){return(n,r,i,{latestValues:o},s)=>{const l=(u4(n)?s5e:ZEe)(r,o,s,n),c={...t5e(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=M.useMemo(()=>_o(d)?d.get():d,[d]);return M.createElement(n,{...c,children:f})}}const p4=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function XU(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 QU=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 YU(e,t,n,r){XU(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(QU.has(i)?i:p4(i),t.attrs[i])}function g4(e,t){const{style:n}=e,r={};for(const i in n)(_o(n[i])||t.style&&_o(t.style[i])||UU(i,e))&&(r[i]=n[i]);return r}function ZU(e,t){const n=g4(e,t);for(const r in e)if(_o(e[r])||_o(t[r])){const i=qm.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function m4(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 JU(e){const t=M.useRef(null);return t.current===null&&(t.current=e()),t.current}const $1=e=>Array.isArray(e),l5e=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),u5e=e=>$1(e)?e[e.length-1]||0:e;function Y0(e){const t=_o(e)?e.get():e;return l5e(t)?t.toValue():t}function c5e({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const s={latestValues:d5e(r,i,o,e),renderState:t()};return n&&(s.mount=a=>n(r,a,s)),s}const ej=e=>(t,n)=>{const r=M.useContext(jS),i=M.useContext(Hm),o=()=>c5e(e,t,r,i);return n?o():JU(o)};function d5e(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=Y0(o[f]);let{initial:s,animate:a}=e;const l=HS(e),u=BU(e);t&&u&&!l&&e.inherit!==!1&&(s===void 0&&(s=t.initial),a===void 0&&(a=t.animate));let c=n?n.initial===!1:!1;c=c||s===!1;const d=c?a:s;return d&&typeof d!="boolean"&&!GS(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=m4(e,h);if(!p)return;const{transitionEnd:m,transition:b,..._}=p;for(const y in _){let g=_[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 dr=e=>e;function f5e(e){let t=[],n=[],r=0,i=!1,o=!1;const s=new WeakSet,a={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&s.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),s.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=f5e(()=>n=!0),d),{}),s=d=>o[d].process(i),a=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,h5e),1),i.timestamp=d,i.isProcessing=!0,c0.forEach(s),i.isProcessing=!1,n&&t&&(r=!1,e(a))},l=()=>{n=!0,r=!0,i.isProcessing||e(a)};return{schedule:c0.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,b=!1)=>(n||l(),h.schedule(p,m,b)),d},{}),cancel:d=>c0.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:kn,cancel:cl,state:Ii,steps:zw}=p5e(typeof requestAnimationFrame<"u"?requestAnimationFrame:dr,!0),g5e={useVisualState:ej({scrapeMotionValuesFromProps:ZU,createRenderState:KU,onMount:(e,t,{renderState:n,latestValues:r})=>{kn.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),kn.render(()=>{f4(n,r,{enableHardwareAcceleration:!1},h4(t.tagName),e.transformTemplate),YU(t,n)})}})},m5e={useVisualState:ej({scrapeMotionValuesFromProps:g4,createRenderState:d4})};function y5e(e,{forwardMotionProps:t=!1},n,r){return{...u4(e)?g5e:m5e,preloadedFeatures:n,useRender:a5e(t),createVisualElement:r,Component:e}}function Ka(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const tj=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function WS(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const v5e=e=>t=>tj(t)&&e(t,WS(t));function Ja(e,t,n,r){return Ka(e,t,v5e(n),r)}const _5e=(e,t)=>n=>t(e(n)),au=(...e)=>e.reduce(_5e);function nj(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const mI=nj("dragHorizontal"),yI=nj("dragVertical");function rj(e){let t=!1;if(e==="y")t=yI();else if(e==="x")t=mI();else{const n=mI(),r=yI();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function ij(){const e=rj(!0);return e?(e(),!1):!0}class Uu{constructor(t){this.isMounted=!1,this.node=t}update(){}}function vI(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,s)=>{if(o.type==="touch"||ij())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t),a[r]&&kn.update(()=>a[r](o,s))};return Ja(e.current,n,i,{passive:!e.getProps()[r]})}class b5e extends Uu{mount(){this.unmount=au(vI(this.node,!0),vI(this.node,!1))}unmount(){}}class S5e extends Uu{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=au(Ka(this.node.current,"focus",()=>this.onFocus()),Ka(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const oj=(e,t)=>t?e===t?!0:oj(e,t.parentElement):!1;function Uw(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,WS(n))}class w5e extends Uu{constructor(){super(...arguments),this.removeStartListeners=dr,this.removeEndListeners=dr,this.removeAccessibleListeners=dr,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=Ja(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();kn.update(()=>{oj(this.node.current,a.target)?u&&u(a,l):c&&c(a,l)})},{passive:!(r.onTap||r.onPointerUp)}),s=Ja(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=au(o,s),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const s=a=>{a.key!=="Enter"||!this.checkPressEnd()||Uw("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&kn.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=Ka(this.node.current,"keyup",s),Uw("down",(a,l)=>{this.startPress(a,l)})},n=Ka(this.node.current,"keydown",t),r=()=>{this.isPressing&&Uw("cancel",(o,s)=>this.cancelPress(o,s))},i=Ka(this.node.current,"blur",r);this.removeAccessibleListeners=au(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&&kn.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!ij()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&kn.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Ja(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Ka(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=au(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const R3=new WeakMap,jw=new WeakMap,x5e=e=>{const t=R3.get(e.target);t&&t(e)},C5e=e=>{e.forEach(x5e)};function E5e({root:e,...t}){const n=e||document;jw.has(n)||jw.set(n,{});const r=jw.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(C5e,{root:e,...t})),r[i]}function T5e(e,t,n){const r=E5e(t);return R3.set(e,n),r.observe(e),()=>{R3.delete(e),r.unobserve(e)}}const A5e={some:0,all:1};class k5e extends Uu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:A5e[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return T5e(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(P5e(t,n))&&this.startObserver()}unmount(){}}function P5e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const R5e={inView:{Feature:k5e},tap:{Feature:w5e},focus:{Feature:S5e},hover:{Feature:b5e}};function sj(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 O5e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function KS(e,t,n){const r=e.getProps();return m4(r,t,n!==void 0?n:r.custom,I5e(e),O5e(e))}const M5e="framerAppearId",N5e="data-"+p4(M5e);let D5e=dr,y4=dr;const lu=e=>e*1e3,el=e=>e/1e3,L5e={current:!1},aj=e=>Array.isArray(e)&&typeof e[0]=="number";function lj(e){return!!(!e||typeof e=="string"&&uj[e]||aj(e)||Array.isArray(e)&&e.every(lj))}const up=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,uj={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:up([0,.65,.55,1]),circOut:up([.55,0,1,.45]),backIn:up([.31,.01,.66,-.59]),backOut:up([.33,1.53,.69,.99])};function cj(e){if(e)return aj(e)?up(e):Array.isArray(e)?e.map(cj):uj[e]}function $5e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:s="loop",ease:a,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=cj(a);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:s==="reverse"?"alternate":"normal"})}function F5e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const dj=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,B5e=1e-7,z5e=12;function U5e(e,t,n,r,i){let o,s,a=0;do s=t+(n-t)/2,o=dj(s,r,i)-e,o>0?n=s:t=s;while(Math.abs(o)>B5e&&++aU5e(o,0,1,e,n);return o=>o===0||o===1?o:dj(i(o),t,r)}const j5e=Xm(.42,0,1,1),V5e=Xm(0,0,.58,1),fj=Xm(.42,0,.58,1),G5e=e=>Array.isArray(e)&&typeof e[0]!="number",hj=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,pj=e=>t=>1-e(1-t),gj=e=>1-Math.sin(Math.acos(e)),v4=pj(gj),H5e=hj(v4),mj=Xm(.33,1.53,.69,.99),_4=pj(mj),q5e=hj(_4),W5e=e=>(e*=2)<1?.5*_4(e):.5*(2-Math.pow(2,-10*(e-1))),K5e={linear:dr,easeIn:j5e,easeInOut:fj,easeOut:V5e,circIn:gj,circInOut:H5e,circOut:v4,backIn:_4,backInOut:q5e,backOut:mj,anticipate:W5e},_I=e=>{if(Array.isArray(e)){y4(e.length===4);const[t,n,r,i]=e;return Xm(t,n,r,i)}else if(typeof e=="string")return K5e[e];return e},b4=(e,t)=>n=>!!(Wm(n)&&WEe.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),yj=(e,t,n)=>r=>{if(!Wm(r))return r;const[i,o,s,a]=r.match(qS);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},X5e=e=>xu(0,255,e),Vw={...ld,transform:e=>Math.round(X5e(e))},gc={test:b4("rgb","red"),parse:yj("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Vw.transform(e)+", "+Vw.transform(t)+", "+Vw.transform(n)+", "+kp(Ap.transform(r))+")"};function Q5e(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 I3={test:b4("#"),parse:Q5e,transform:gc.transform},Xd={test:b4("hsl","hue"),parse:yj("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+ma.transform(kp(t))+", "+ma.transform(kp(n))+", "+kp(Ap.transform(r))+")"},Hi={test:e=>gc.test(e)||I3.test(e)||Xd.test(e),parse:e=>gc.test(e)?gc.parse(e):Xd.test(e)?Xd.parse(e):I3.parse(e),transform:e=>Wm(e)?e:e.hasOwnProperty("red")?gc.transform(e):Xd.transform(e)},rr=(e,t,n)=>-n*e+n*t+e;function Gw(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 Y5e({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,s=0;if(!t)i=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=Gw(l,a,e+1/3),o=Gw(l,a,e),s=Gw(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}const Hw=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},Z5e=[I3,gc,Xd],J5e=e=>Z5e.find(t=>t.test(e));function bI(e){const t=J5e(e);let n=t.parse(e);return t===Xd&&(n=Y5e(n)),n}const vj=(e,t)=>{const n=bI(e),r=bI(t),i={...n};return o=>(i.red=Hw(n.red,r.red,o),i.green=Hw(n.green,r.green,o),i.blue=Hw(n.blue,r.blue,o),i.alpha=rr(n.alpha,r.alpha,o),gc.transform(i))};function eTe(e){var t,n;return isNaN(e)&&Wm(e)&&(((t=e.match(qS))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(GU))===null||n===void 0?void 0:n.length)||0)>0}const _j={regex:HEe,countKey:"Vars",token:"${v}",parse:dr},bj={regex:GU,countKey:"Colors",token:"${c}",parse:Hi.parse},Sj={regex:qS,countKey:"Numbers",token:"${n}",parse:ld.parse};function qw(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 F1(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&qw(n,_j),qw(n,bj),qw(n,Sj),n}function wj(e){return F1(e).values}function xj(e){const{values:t,numColors:n,numVars:r,tokenised:i}=F1(e),o=t.length;return s=>{let a=i;for(let l=0;ltypeof e=="number"?0:e;function nTe(e){const t=wj(e);return xj(e)(t.map(tTe))}const Cu={test:eTe,parse:wj,createTransformer:xj,getAnimatableNone:nTe},Cj=(e,t)=>n=>`${n>0?t:e}`;function Ej(e,t){return typeof e=="number"?n=>rr(e,t,n):Hi.test(e)?vj(e,t):e.startsWith("var(")?Cj(e,t):Aj(e,t)}const Tj=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,s)=>Ej(o,t[s]));return o=>{for(let s=0;s{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Ej(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},Aj=(e,t)=>{const n=Cu.createTransformer(t),r=F1(e),i=F1(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?au(Tj(r.values,i.values),n):Cj(e,t)},Zg=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},SI=(e,t)=>n=>rr(e,t,n);function iTe(e){return typeof e=="number"?SI:typeof e=="string"?Hi.test(e)?vj:Aj:Array.isArray(e)?Tj:typeof e=="object"?rTe:SI}function oTe(e,t,n){const r=[],i=n||iTe(e[0]),o=e.length-1;for(let s=0;st[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=oTe(t,r,i),a=s.length,l=u=>{let c=0;if(a>1)for(;cl(xu(e[0],e[o-1],u)):l}function sTe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Zg(0,t,r);e.push(rr(n,1,i))}}function aTe(e){const t=[0];return sTe(t,e.length-1),t}function lTe(e,t){return e.map(n=>n*t)}function uTe(e,t){return e.map(()=>t||fj).splice(0,e.length-1)}function B1({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=G5e(r)?r.map(_I):_I(r),o={done:!1,value:t[0]},s=lTe(n&&n.length===t.length?n:aTe(t),e),a=kj(s,t,{ease:Array.isArray(i)?i:uTe(t,i)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}function Pj(e,t){return t?e*(1e3/t):0}const cTe=5;function Rj(e,t,n){const r=Math.max(t-cTe,0);return Pj(n-e(r),t-r)}const Ww=.001,dTe=.01,wI=10,fTe=.05,hTe=1;function pTe({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;D5e(e<=lu(wI));let s=1-t;s=xu(fTe,hTe,s),e=xu(dTe,wI,el(e)),s<1?(i=u=>{const c=u*s,d=c*e,f=c-n,h=O3(u,s),p=Math.exp(-d);return Ww-f/h*p},o=u=>{const d=u*s*e,f=d*n+n,h=Math.pow(s,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=O3(Math.pow(u,2),s);return(-i(u)+Ww>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-Ww+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const a=5/e,l=mTe(i,o,a);if(e=lu(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:e}}}const gTe=12;function mTe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function _Te(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!xI(e,vTe)&&xI(e,yTe)){const n=pTe(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function Ij({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],s={done:!1,value:i},{stiffness:a,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=_Te(r),h=c?-el(c):0,p=l/(2*Math.sqrt(a*u)),m=o-i,b=el(Math.sqrt(a/u)),_=Math.abs(m)<5;n||(n=_?.01:2),t||(t=_?.005:.5);let y;if(p<1){const g=O3(b,p);y=v=>{const S=Math.exp(-p*b*v);return o-S*((h+p*b*m)/g*Math.sin(g*v)+m*Math.cos(g*v))}}else if(p===1)y=g=>o-Math.exp(-b*g)*(m+(h+b*m)*g);else{const g=b*Math.sqrt(p*p-1);y=v=>{const S=Math.exp(-p*b*v),w=Math.min(g*v,300);return o-S*((h+p*b*m)*Math.sinh(w)+g*m*Math.cosh(w))/g}}return{calculatedDuration:f&&d||null,next:g=>{const v=y(g);if(f)s.done=g>=d;else{let S=h;g!==0&&(p<1?S=Rj(y,g,v):S=0);const w=Math.abs(S)<=n,x=Math.abs(o-v)<=t;s.done=w&&x}return s.value=s.done?o:v,s}}}function CI({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>a!==void 0&&Cl,p=C=>a===void 0?l:l===void 0||Math.abs(a-C)-m*Math.exp(-C/r),g=C=>_+y(C),v=C=>{const A=y(C),T=g(C);f.done=Math.abs(A)<=u,f.value=f.done?_:T};let S,w;const x=C=>{h(f.value)&&(S=C,w=Ij({keyframes:[f.value,p(f.value)],velocity:Rj(g,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return x(0),{calculatedDuration:null,next:C=>{let A=!1;return!w&&S===void 0&&(A=!0,v(C),x(C)),S!==void 0&&C>S?w.next(C-S):(!A&&v(C),f)}}}const bTe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>kn.update(t,!0),stop:()=>cl(t),now:()=>Ii.isProcessing?Ii.timestamp:performance.now()}},EI=2e4;function TI(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=EI?1/0:t}const STe={decay:CI,inertia:CI,tween:B1,keyframes:B1,spring:Ij};function z1({autoplay:e=!0,delay:t=0,driver:n=bTe,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:s=0,repeatType:a="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,b;const _=()=>{b=new Promise(F=>{m=F})};_();let y;const g=STe[i]||B1;let v;g!==B1&&typeof r[0]!="number"&&(v=kj([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let w;a==="mirror"&&(w=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let x="idle",C=null,A=null,T=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=TI(S));const{calculatedDuration:k}=S;let L=1/0,N=1/0;k!==null&&(L=k+s,N=L*(o+1)-s);let E=0;const P=F=>{if(A===null)return;h>0&&(A=Math.min(A,F)),h<0&&(A=Math.min(F-N/h,A)),C!==null?E=C:E=Math.round(F-A)*h;const U=E-t*(h>=0?1:-1),V=h>=0?U<0:U>N;E=Math.max(U,0),x==="finished"&&C===null&&(E=N);let H=E,Y=S;if(o){const te=E/L;let oe=Math.floor(te),me=te%1;!me&&te>=1&&(me=1),me===1&&oe--,oe=Math.min(oe,o+1);const le=!!(oe%2);le&&(a==="reverse"?(me=1-me,s&&(me-=s/L)):a==="mirror"&&(Y=w));let ht=xu(0,1,me);E>N&&(ht=a==="reverse"&&le?1:0),H=ht*L}const Q=V?{done:!1,value:r[0]}:Y.next(H);v&&(Q.value=v(Q.value));let{done:j}=Q;!V&&k!==null&&(j=h>=0?E>=N:E<=0);const K=C===null&&(x==="finished"||x==="running"&&j);return d&&d(Q.value),K&&R(),Q},D=()=>{y&&y.stop(),y=void 0},B=()=>{x="idle",D(),m(),_(),A=T=null},R=()=>{x="finished",c&&c(),D(),m()},I=()=>{if(p)return;y||(y=n(P));const F=y.now();l&&l(),C!==null?A=F-C:(!A||x==="finished")&&(A=F),x==="finished"&&_(),T=A,C=null,x="running",y.start()};e&&I();const O={then(F,U){return b.then(F,U)},get time(){return el(E)},set time(F){F=lu(F),E=F,C!==null||!y||h===0?C=F:A=y.now()-F/h},get duration(){const F=S.calculatedDuration===null?TI(S):S.calculatedDuration;return el(F)},get speed(){return h},set speed(F){F===h||!y||(h=F,O.time=el(E))},get state(){return x},play:I,pause:()=>{x="paused",C=E},stop:()=>{p=!0,x!=="idle"&&(x="idle",u&&u(),B())},cancel:()=>{T!==null&&P(T),B()},complete:()=>{x="finished"},sample:F=>(A=0,P(F))};return O}function wTe(e){let t;return()=>(t===void 0&&(t=e()),t)}const xTe=wTe(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),CTe=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),d0=10,ETe=2e4,TTe=(e,t)=>t.type==="spring"||e==="backgroundColor"||!lj(t.ease);function ATe(e,t,{onUpdate:n,onComplete:r,...i}){if(!(xTe()&&CTe.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let s=!1,a,l;const u=()=>{l=new Promise(y=>{a=y})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(TTe(t,i)){const y=z1({...i,repeat:0,delay:0});let g={done:!1,value:c[0]};const v=[];let S=0;for(;!g.done&&Sp.cancel(),b=()=>{kn.update(m),a(),u()};return p.onfinish=()=>{e.set(F5e(c,i)),r&&r(),b()},{then(y,g){return l.then(y,g)},attachTimeline(y){return p.timeline=y,p.onfinish=null,dr},get time(){return el(p.currentTime||0)},set time(y){p.currentTime=lu(y)},get speed(){return p.playbackRate},set speed(y){p.playbackRate=y},get duration(){return el(d)},play:()=>{s||(p.play(),cl(m))},pause:()=>p.pause(),stop:()=>{if(s=!0,p.playState==="idle")return;const{currentTime:y}=p;if(y){const g=z1({...i,autoplay:!1});e.setWithVelocity(g.sample(y-d0).value,g.sample(y).value,d0)}b()},complete:()=>p.finish(),cancel:b}}function kTe({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:dr,pause:dr,stop:dr,then:o=>(o(),Promise.resolve()),cancel:dr,complete:dr});return t?z1({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const PTe={type:"spring",stiffness:500,damping:25,restSpeed:10},RTe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ITe={type:"keyframes",duration:.8},OTe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},MTe=(e,{keyframes:t})=>t.length>2?ITe:ad.has(e)?e.startsWith("scale")?RTe(t[1]):PTe:OTe,M3=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Cu.test(t)||t==="0")&&!t.startsWith("url(")),NTe=new Set(["brightness","contrast","saturate","opacity"]);function DTe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(qS)||[];if(!r)return e;const i=n.replace(r,"");let o=NTe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const LTe=/([a-z-]*)\(.*?\)/g,N3={...Cu,getAnimatableNone:e=>{const t=e.match(LTe);return t?t.map(DTe).join(" "):e}},$Te={...HU,color:Hi,backgroundColor:Hi,outlineColor:Hi,fill:Hi,stroke:Hi,borderColor:Hi,borderTopColor:Hi,borderRightColor:Hi,borderBottomColor:Hi,borderLeftColor:Hi,filter:N3,WebkitFilter:N3},S4=e=>$Te[e];function Oj(e,t){let n=S4(e);return n!==N3&&(n=Cu),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Mj=e=>/^0[^.\s]+$/.test(e);function FTe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||Mj(e)}function BTe(e,t,n,r){const i=M3(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const s=r.from!==void 0?r.from:e.get();let a;const l=[];for(let u=0;ui=>{const o=Nj(r,e)||{},s=o.delay||r.delay||0;let{elapsed:a=0}=r;a=a-lu(s);const l=BTe(t,e,n,o),u=l[0],c=l[l.length-1],d=M3(e,u),f=M3(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-a,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(zTe(o)||(h={...h,...MTe(e,h)}),h.duration&&(h.duration=lu(h.duration)),h.repeatDelay&&(h.repeatDelay=lu(h.repeatDelay)),!d||!f||L5e.current||o.type===!1)return kTe(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=ATe(t,e,h);if(p)return p}return z1(h)};function U1(e){return!!(_o(e)&&e.add)}const Dj=e=>/^\-?\d*\.?\d+$/.test(e);function x4(e,t){e.indexOf(t)===-1&&e.push(t)}function C4(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class E4{constructor(){this.subscriptions=[]}add(t){return x4(this.subscriptions,t),()=>C4(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 jTe{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:s}=Ii;this.lastUpdated!==s&&(this.timeDelta=o,this.lastUpdated=s,kn.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=()=>kn.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=UTe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new E4);const r=this.events[t].add(n);return t==="change"?()=>{r(),kn.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?Pj(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 Zf(e,t){return new jTe(e,t)}const Lj=e=>t=>t.test(e),VTe={test:e=>e==="auto",parse:e=>e},$j=[ld,rt,ma,kl,XEe,KEe,VTe],Qh=e=>$j.find(Lj(e)),GTe=[...$j,Hi,Cu],HTe=e=>GTe.find(Lj(e));function qTe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Zf(n))}function WTe(e,t){const n=KS(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const s in o){const a=u5e(o[s]);qTe(e,s,a)}}function KTe(e,t,n){var r,i;const o=Object.keys(t).filter(a=>!e.hasValue(a)),s=o.length;if(s)for(let a=0;al.remove(d))),u.push(m)}return s&&Promise.all(u).then(()=>{s&&WTe(e,s)}),u}function D3(e,t,n={}){const r=KS(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(Fj(e,r,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return ZTe(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,u]=a==="beforeChildren"?[o,s]:[s,o];return l().then(()=>u())}else return Promise.all([o(),s(n.delay)])}function ZTe(e,t,n=0,r=0,i=1,o){const s=[],a=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(JTe).forEach((u,c)=>{u.notify("AnimationStart",t),s.push(D3(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(s)}function JTe(e,t){return e.sortNodePosition(t)}function e4e(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>D3(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=D3(e,t,n);else{const i=typeof t=="function"?KS(e,t,n.custom):t;r=Promise.all(Fj(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const t4e=[...s4].reverse(),n4e=s4.length;function r4e(e){return t=>Promise.all(t.map(({animation:n,options:r})=>e4e(e,n,r)))}function i4e(e){let t=r4e(e);const n=s4e();let r=!0;const i=(l,u)=>{const c=KS(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function s(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let _=0;_m&&S;const T=Array.isArray(v)?v:[v];let k=T.reduce(i,{});w===!1&&(k={});const{prevResolvedValues:L={}}=g,N={...L,...k},E=P=>{A=!0,h.delete(P),g.needsAnimating[P]=!0};for(const P in N){const D=k[P],B=L[P];p.hasOwnProperty(P)||(D!==B?$1(D)&&$1(B)?!sj(D,B)||C?E(P):g.protectedKeys[P]=!0:D!==void 0?E(P):h.add(P):D!==void 0&&h.has(P)?E(P):g.protectedKeys[P]=!0)}g.prevProp=v,g.prevResolvedValues=k,g.isActive&&(p={...p,...k}),r&&e.blockInitialAnimation&&(A=!1),A&&!x&&f.push(...T.map(P=>({animation:P,options:{type:y,...l}})))}if(h.size){const _={};h.forEach(y=>{const g=e.getBaseTarget(y);g!==void 0&&(_[y]=g)}),f.push({animation:_})}let b=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,b?t(f):Promise.resolve()}function a(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=s(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:s,setActive:a,setAnimateFunction:o,getState:()=>n}}function o4e(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!sj(t,e):!1}function Xu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function s4e(){return{animate:Xu(!0),whileInView:Xu(),whileHover:Xu(),whileTap:Xu(),whileDrag:Xu(),whileFocus:Xu(),exit:Xu()}}class a4e extends Uu{constructor(t){super(t),t.animationState||(t.animationState=i4e(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),GS(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 l4e=0;class u4e extends Uu{constructor(){super(...arguments),this.id=l4e++}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 c4e={animation:{Feature:a4e},exit:{Feature:u4e}},AI=(e,t)=>Math.abs(e-t);function d4e(e,t){const n=AI(e.x,t.x),r=AI(e.y,t.y);return Math.sqrt(n**2+r**2)}class Bj{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=Xw(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=d4e(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=Ii;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=Kw(c,this.transformPagePoint),kn.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=Xw(u.type==="pointercancel"?this.lastMoveEventInfo:Kw(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!tj(t))return;this.handlers=n,this.transformPagePoint=r;const i=WS(t),o=Kw(i,this.transformPagePoint),{point:s}=o,{timestamp:a}=Ii;this.history=[{...s,timestamp:a}];const{onSessionStart:l}=n;l&&l(t,Xw(o,this.history)),this.removeListeners=au(Ja(window,"pointermove",this.handlePointerMove),Ja(window,"pointerup",this.handlePointerUp),Ja(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),cl(this.updatePoint)}}function Kw(e,t){return t?{point:t(e.point)}:e}function kI(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xw({point:e},t){return{point:e,delta:kI(e,zj(t)),offset:kI(e,f4e(t)),velocity:h4e(t,.1)}}function f4e(e){return e[0]}function zj(e){return e[e.length-1]}function h4e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=zj(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>lu(t)));)n--;if(!r)return{x:0,y:0};const o=el(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Lo(e){return e.max-e.min}function L3(e,t=0,n=.01){return Math.abs(e-t)<=n}function PI(e,t,n,r=.5){e.origin=r,e.originPoint=rr(t.min,t.max,e.origin),e.scale=Lo(n)/Lo(t),(L3(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=rr(n.min,n.max,e.origin)-e.originPoint,(L3(e.translate)||isNaN(e.translate))&&(e.translate=0)}function Pp(e,t,n,r){PI(e.x,t.x,n.x,r?r.originX:void 0),PI(e.y,t.y,n.y,r?r.originY:void 0)}function RI(e,t,n){e.min=n.min+t.min,e.max=e.min+Lo(t)}function p4e(e,t,n){RI(e.x,t.x,n.x),RI(e.y,t.y,n.y)}function II(e,t,n){e.min=t.min-n.min,e.max=e.min+Lo(t)}function Rp(e,t,n){II(e.x,t.x,n.x),II(e.y,t.y,n.y)}function g4e(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?rr(n,e,r.max):Math.min(e,n)),e}function OI(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 m4e(e,{top:t,left:n,bottom:r,right:i}){return{x:OI(e.x,n,i),y:OI(e.y,t,r)}}function MI(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Zg(t.min,t.max-r,e.min):r>i&&(n=Zg(e.min,e.max-i,t.min)),xu(0,1,n)}function _4e(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 $3=.35;function b4e(e=$3){return e===!1?e=0:e===!0&&(e=$3),{x:NI(e,"left","right"),y:NI(e,"top","bottom")}}function NI(e,t,n){return{min:DI(e,t),max:DI(e,n)}}function DI(e,t){return typeof e=="number"?e:e[t]||0}const LI=()=>({translate:0,scale:1,origin:0,originPoint:0}),Qd=()=>({x:LI(),y:LI()}),$I=()=>({min:0,max:0}),Ar=()=>({x:$I(),y:$I()});function Qs(e){return[e("x"),e("y")]}function Uj({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function S4e({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function w4e(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 Qw(e){return e===void 0||e===1}function F3({scale:e,scaleX:t,scaleY:n}){return!Qw(e)||!Qw(t)||!Qw(n)}function tc(e){return F3(e)||jj(e)||e.z||e.rotate||e.rotateX||e.rotateY}function jj(e){return FI(e.x)||FI(e.y)}function FI(e){return e&&e!=="0%"}function j1(e,t,n){const r=e-n,i=t*r;return n+i}function BI(e,t,n,r,i){return i!==void 0&&(e=j1(e,i,r)),j1(e,n,r)+t}function B3(e,t=0,n=1,r,i){e.min=BI(e.min,t,n,r,i),e.max=BI(e.max,t,n,r,i)}function Vj(e,{x:t,y:n}){B3(e.x,t.translate,t.scale,t.originPoint),B3(e.y,n.translate,n.scale,n.originPoint)}function x4e(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,s;for(let a=0;a1.0000000000001||e<.999999999999?e:1}function Ml(e,t){e.min=e.min+t,e.max=e.max+t}function UI(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,s=rr(e.min,e.max,o);B3(e,t[n],t[r],s,t.scale)}const C4e=["x","scaleX","originX"],E4e=["y","scaleY","originY"];function Yd(e,t){UI(e.x,t,C4e),UI(e.y,t,E4e)}function Gj(e,t){return Uj(w4e(e.getBoundingClientRect(),t))}function T4e(e,t,n){const r=Gj(e,n),{scroll:i}=t;return i&&(Ml(r.x,i.offset.x),Ml(r.y,i.offset.y)),r}const A4e=new WeakMap;class k4e{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=Ar(),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(WS(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=rj(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),Qs(p=>{let m=this.getAxisMotionValue(p).get()||0;if(ma.test(m)){const{projection:b}=this.visualElement;if(b&&b.layout){const _=b.layout.layoutBox[p];_&&(m=Lo(_)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&kn.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},s=(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=P4e(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)},a=(l,u)=>this.stop(l,u);this.panSession=new Bj(t,{onSessionStart:i,onStart:o,onMove:s,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&kn.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||!f0(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let s=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(s=g4e(s,this.constraints[t],this.elastic[t])),o.set(s)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&Kd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=m4e(r.layoutBox,t):this.constraints=!1,this.elastic=b4e(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Qs(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=_4e(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Kd(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=T4e(r,i.root,this.visualElement.getTransformPagePoint());let s=y4e(i.layout.layoutBox,o);if(n){const a=n(S4e(s));this.hasMutatedConstraints=!!a,a&&(s=Uj(a))}return s}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Qs(c=>{if(!f0(c,n,this.currentDirection))return;let d=l&&l[c]||{};s&&(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(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(w4(t,r,0,n))}stopAnimation(){Qs(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){Qs(n=>{const{drag:r}=this.getProps();if(!f0(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:a}=i.layout.layoutBox[n];o.set(t[n]-rr(s,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Kd(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Qs(s=>{const a=this.getAxisMotionValue(s);if(a){const l=a.get();i[s]=v4e({min:l,max:l},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Qs(s=>{if(!f0(s,t,null))return;const a=this.getAxisMotionValue(s),{min:l,max:u}=this.constraints[s];a.set(rr(l,u,i[s]))})}addListeners(){if(!this.visualElement.current)return;A4e.set(this.visualElement,this);const t=this.visualElement.current,n=Ja(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Kd(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const s=Ka(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Qs(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{s(),n(),o(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:s=$3,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function f0(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function P4e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class R4e extends Uu{constructor(t){super(t),this.removeGroupControls=dr,this.removeListeners=dr,this.controls=new k4e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||dr}unmount(){this.removeGroupControls(),this.removeListeners()}}const jI=e=>(t,n)=>{e&&kn.update(()=>e(t,n))};class I4e extends Uu{constructor(){super(...arguments),this.removePointerDownListener=dr}onPointerDown(t){this.session=new Bj(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:jI(t),onStart:jI(n),onMove:r,onEnd:(o,s)=>{delete this.session,i&&kn.update(()=>i(o,s))}}}mount(){this.removePointerDownListener=Ja(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 O4e(){const e=M.useContext(Hm);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=M.useId();return M.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function YMe(){return M4e(M.useContext(Hm))}function M4e(e){return e===null?!0:e.isPresent}const Z0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function VI(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Yh={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(rt.test(e))e=parseFloat(e);else return e;const n=VI(e,t.target.x),r=VI(e,t.target.y);return`${n}% ${r}%`}},N4e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Cu.parse(e);if(i.length>5)return r;const o=Cu.createTransformer(e),s=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+s]/=a,i[1+s]/=l;const u=rr(a,l,.5);return typeof i[2+s]=="number"&&(i[2+s]/=u),typeof i[3+s]=="number"&&(i[3+s]/=u),o(i)}};class D4e extends vn.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;UEe(L4e),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()})),Z0.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,s=r.projection;return s&&(s.isPresent=o,i||t.layoutDependency!==n||n===void 0?s.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?s.promote():s.relegate()||kn.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Hj(e){const[t,n]=O4e(),r=M.useContext(l4);return vn.createElement(D4e,{...e,layoutGroup:r,switchLayoutGroup:M.useContext(zU),isPresent:t,safeToRemove:n})}const L4e={borderRadius:{...Yh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Yh,borderTopRightRadius:Yh,borderBottomLeftRadius:Yh,borderBottomRightRadius:Yh,boxShadow:N4e},qj=["TopLeft","TopRight","BottomLeft","BottomRight"],$4e=qj.length,GI=e=>typeof e=="string"?parseFloat(e):e,HI=e=>typeof e=="number"||rt.test(e);function F4e(e,t,n,r,i,o){i?(e.opacity=rr(0,n.opacity!==void 0?n.opacity:1,B4e(r)),e.opacityExit=rr(t.opacity!==void 0?t.opacity:1,0,z4e(r))):o&&(e.opacity=rr(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let s=0;s<$4e;s++){const a=`border${qj[s]}Radius`;let l=qI(t,a),u=qI(n,a);if(l===void 0&&u===void 0)continue;l||(l=0),u||(u=0),l===0||u===0||HI(l)===HI(u)?(e[a]=Math.max(rr(GI(l),GI(u),r),0),(ma.test(u)||ma.test(l))&&(e[a]+="%")):e[a]=u}(t.rotate||n.rotate)&&(e.rotate=rr(t.rotate||0,n.rotate||0,r))}function qI(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const B4e=Wj(0,.5,v4),z4e=Wj(.5,.95,dr);function Wj(e,t,n){return r=>rt?1:n(Zg(e,t,r))}function WI(e,t){e.min=t.min,e.max=t.max}function Go(e,t){WI(e.x,t.x),WI(e.y,t.y)}function KI(e,t,n,r,i){return e-=t,e=j1(e,1/n,r),i!==void 0&&(e=j1(e,1/i,r)),e}function U4e(e,t=0,n=1,r=.5,i,o=e,s=e){if(ma.test(t)&&(t=parseFloat(t),t=rr(s.min,s.max,t/100)-s.min),typeof t!="number")return;let a=rr(o.min,o.max,r);e===o&&(a-=t),e.min=KI(e.min,t,n,a,i),e.max=KI(e.max,t,n,a,i)}function XI(e,t,[n,r,i],o,s){U4e(e,t[n],t[r],t[i],t.scale,o,s)}const j4e=["x","scaleX","originX"],V4e=["y","scaleY","originY"];function QI(e,t,n,r){XI(e.x,t,j4e,n?n.x:void 0,r?r.x:void 0),XI(e.y,t,V4e,n?n.y:void 0,r?r.y:void 0)}function YI(e){return e.translate===0&&e.scale===1}function Kj(e){return YI(e.x)&&YI(e.y)}function G4e(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 Xj(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 ZI(e){return Lo(e.x)/Lo(e.y)}class H4e{constructor(){this.members=[]}add(t){x4(this.members,t),t.scheduleRender()}remove(t){if(C4(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 JI(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 s=e.x.scale*t.x,a=e.y.scale*t.y;return(s!==1||a!==1)&&(r+=`scale(${s}, ${a})`),r||"none"}const q4e=(e,t)=>e.depth-t.depth;class W4e{constructor(){this.children=[],this.isDirty=!1}add(t){x4(this.children,t),this.isDirty=!0}remove(t){C4(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(q4e),this.isDirty=!1,this.children.forEach(t)}}function K4e(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(cl(r),e(o-t))};return kn.read(r,!0),()=>cl(r)}function X4e(e){window.MotionDebug&&window.MotionDebug.record(e)}function Q4e(e){return e instanceof SVGElement&&e.tagName!=="svg"}function Y4e(e,t,n){const r=_o(e)?e:Zf(e);return r.start(w4("",r,t,n)),r.animation}const eO=["","X","Y","Z"],tO=1e3;let Z4e=0;const nc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Qj({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},a=t==null?void 0:t()){this.id=Z4e++,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=()=>{nc.totalNodes=nc.resolvedTargetDeltas=nc.recalculatedProjection=0,this.nodes.forEach(tAe),this.nodes.forEach(sAe),this.nodes.forEach(aAe),this.nodes.forEach(nAe),X4e(nc)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(s,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=K4e(f,250),Z0.hasAnimatedSinceResize&&(Z0.hasAnimatedSinceResize=!1,this.nodes.forEach(rO))})}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()||fAe,{onLayoutAnimationStart:b,onLayoutAnimationComplete:_}=c.getProps(),y=!this.targetLayout||!Xj(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={...Nj(m,"layout"),onPlay:b,onComplete:_};(c.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else f||rO(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,cl(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(lAe),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(rAe),this.sharedNodes.forEach(uAe)}scheduleUpdateProjection(){kn.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){kn.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;iO(d.x,s.x,S),iO(d.y,s.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Rp(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),cAe(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&G4e(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=Ar()),Go(g,this.relativeTarget)),m&&(this.animationValues=c,F4e(c,u,this.latestValues,S,y,_)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(cl(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=kn.update(()=>{Z0.hasAnimatedSinceResize=!0,this.currentAnimation=Y4e(0,tO,{...s,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(tO),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:c}=s;if(!(!a||!l||!u)){if(this!==s&&this.layout&&u&&Yj(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Ar();const d=Lo(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+d;const f=Lo(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+f}Go(a,l),Yd(a,c),Pp(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new H4e),this.sharedNodes.get(s).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){var s;const{layoutId:a}=this.options;return a?((s=this.getStack())===null||s===void 0?void 0:s.lead)||this:this}getPrevLead(){var s;const{layoutId:a}=this.options;return a?(s=this.getStack())===null||s===void 0?void 0:s.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const u={};for(let c=0;c{var a;return(a=s.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(nO),this.root.sharedNodes.clear()}}}function J4e(e){e.updateLayout()}function eAe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,s=n.source!==e.layout.source;o==="size"?Qs(d=>{const f=s?n.measuredBox[d]:n.layoutBox[d],h=Lo(f);f.min=r[d].min,f.max=f.min+h}):Yj(o,n.layoutBox,r)&&Qs(d=>{const f=s?n.measuredBox[d]:n.layoutBox[d],h=Lo(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const a=Qd();Pp(a,r,n.layoutBox);const l=Qd();s?Pp(l,e.applyTransform(i,!0),n.measuredBox):Pp(l,r,n.layoutBox);const u=!Kj(a);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=Ar();Rp(p,n.layoutBox,f.layoutBox);const m=Ar();Rp(m,r,h.layoutBox),Xj(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:a,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function tAe(e){nc.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 nAe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function rAe(e){e.clearSnapshot()}function nO(e){e.clearMeasurements()}function iAe(e){e.isLayoutDirty=!1}function oAe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function rO(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function sAe(e){e.resolveTargetDelta()}function aAe(e){e.calcProjection()}function lAe(e){e.resetRotation()}function uAe(e){e.removeLeadSnapshot()}function iO(e,t,n){e.translate=rr(t.translate,0,n),e.scale=rr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function oO(e,t,n,r){e.min=rr(t.min,n.min,r),e.max=rr(t.max,n.max,r)}function cAe(e,t,n,r){oO(e.x,t.x,n.x,r),oO(e.y,t.y,n.y,r)}function dAe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const fAe={duration:.45,ease:[.4,0,.1,1]},sO=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),aO=sO("applewebkit/")&&!sO("chrome/")?Math.round:dr;function lO(e){e.min=aO(e.min),e.max=aO(e.max)}function hAe(e){lO(e.x),lO(e.y)}function Yj(e,t,n){return e==="position"||e==="preserve-aspect"&&!L3(ZI(t),ZI(n),.2)}const pAe=Qj({attachResizeListener:(e,t)=>Ka(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Yw={current:void 0},Zj=Qj({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Yw.current){const e=new pAe({});e.mount(window),e.setOptions({layoutScroll:!0}),Yw.current=e}return Yw.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),gAe={pan:{Feature:I4e},drag:{Feature:R4e,ProjectionNode:Zj,MeasureLayout:Hj}},mAe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function yAe(e){const t=mAe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function z3(e,t,n=1){const[r,i]=yAe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const s=o.trim();return Dj(s)?parseFloat(s):s}else return P3(i)?z3(i,t,n+1):i}function vAe(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(!P3(o))return;const s=z3(o,r);s&&i.set(s)});for(const i in t){const o=t[i];if(!P3(o))continue;const s=z3(o,r);s&&(t[i]=s,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const _Ae=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Jj=e=>_Ae.has(e),bAe=e=>Object.keys(e).some(Jj),uO=e=>e===ld||e===rt,cO=(e,t)=>parseFloat(e.split(", ")[t]),dO=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return cO(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?cO(o[1],e):0}},SAe=new Set(["x","y","z"]),wAe=qm.filter(e=>!SAe.has(e));function xAe(e){const t=[];return wAe.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 Jf={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:dO(4,13),y:dO(5,14)};Jf.translateX=Jf.x;Jf.translateY=Jf.y;const CAe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:s}=o,a={};s==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{a[u]=Jf[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(a[u]),e[u]=Jf[u](l,o)}),e},EAe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(Jj);let o=[],s=!1;const a=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=Qh(c);const f=t[l];let h;if($1(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=Qh(c);for(let b=m;b=0?window.pageYOffset:null,u=CAe(t,e,a);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),VS&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function TAe(e,t,n,r){return bAe(t)?EAe(e,t,n,r):{target:t,transitionEnd:r}}const AAe=(e,t,n,r)=>{const i=vAe(e,t,r);return t=i.target,r=i.transitionEnd,TAe(e,t,n,r)},U3={current:null},eV={current:!1};function kAe(){if(eV.current=!0,!!VS)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>U3.current=e.matches;e.addListener(t),t()}else U3.current=!1}function PAe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],s=n[i];if(_o(o))e.addValue(i,o),U1(r)&&r.add(i);else if(_o(s))e.addValue(i,Zf(o,{owner:e})),U1(r)&&r.remove(i);else if(s!==o)if(e.hasValue(i)){const a=e.getValue(i);!a.hasAnimated&&a.set(o)}else{const a=e.getStaticValue(i);e.addValue(i,Zf(a!==void 0?a:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const fO=new WeakMap,tV=Object.keys(Yg),RAe=tV.length,hO=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],IAe=a4.length;class OAe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>kn.render(this.render,!1,!0);const{latestValues:a,renderState:l}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=s,this.isControllingVariants=HS(n),this.isVariantNode=BU(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];a[d]!==void 0&&_o(f)&&(f.set(a[d],!1),U1(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,fO.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)),eV.current||kAe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:U3.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){fO.delete(this.current),this.projection&&this.projection.unmount(),cl(this.notifyUpdate),cl(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=ad.has(t),i=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&kn.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let s,a;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return a}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ar()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Zf(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=m4(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&&!_o(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 E4),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class nV extends OAe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let s=QTe(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),s&&(s=i(s))),o){KTe(this,r,s);const a=AAe(this,r,s,n);n=a.transitionEnd,r=a.target}return{transition:t,transitionEnd:n,...r}}}function MAe(e){return window.getComputedStyle(e)}class NAe extends nV{readValueFromInstance(t,n){if(ad.has(n)){const r=S4(n);return r&&r.default||0}else{const r=MAe(t),i=(VU(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return Gj(t,n)}build(t,n,r,i){c4(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return g4(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;_o(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){XU(t,n,r,i)}}class DAe extends nV{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(ad.has(n)){const r=S4(n);return r&&r.default||0}return n=QU.has(n)?n:p4(n),t.getAttribute(n)}measureInstanceViewportBox(){return Ar()}scrapeMotionValuesFromProps(t,n){return ZU(t,n)}build(t,n,r,i){f4(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){YU(t,n,r,i)}mount(t){this.isSVGTag=h4(t.tagName),super.mount(t)}}const LAe=(e,t)=>u4(e)?new DAe(t,{enableHardwareAcceleration:!1}):new NAe(t,{enableHardwareAcceleration:!0}),$Ae={layout:{ProjectionNode:Zj,MeasureLayout:Hj}},FAe={...c4e,...R5e,...gAe,...$Ae},BAe=BEe((e,t)=>y5e(e,t,FAe,LAe));function rV(){const e=M.useRef(!1);return o4(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function zAe(){const e=rV(),[t,n]=M.useState(0),r=M.useCallback(()=>{e.current&&n(t+1)},[t]);return[M.useCallback(()=>kn.postRender(r),[r]),t]}class UAe extends M.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 jAe({children:e,isPresent:t}){const n=M.useId(),r=M.useRef(null),i=M.useRef({width:0,height:0,top:0,left:0});return M.useInsertionEffect(()=>{const{width:o,height:s,top:a,left:l}=i.current;if(t||!r.current||!o||!s)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${o}px !important; height: ${s}px !important; top: ${a}px !important; left: ${l}px !important; } `),()=>{document.head.removeChild(u)}},[t]),M.createElement(UAe,{isPresent:t,childRef:r,sizeRef:i},M.cloneElement(e,{ref:r}))}const Zw=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:s})=>{const a=JU(VAe),l=M.useId(),u=M.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{a.set(c,!0);for(const d of a.values())if(!d)return;r&&r()},register:c=>(a.set(c,!1),()=>a.delete(c))}),o?void 0:[n]);return M.useMemo(()=>{a.forEach((c,d)=>a.set(d,!1))},[n]),M.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),s==="popLayout"&&(e=M.createElement(jAe,{isPresent:n},e)),M.createElement(Hm.Provider,{value:u},e)};function VAe(){return new Map}function GAe(e){return M.useEffect(()=>()=>e(),[])}const Md=e=>e.key||"";function HAe(e,t){e.forEach(n=>{const r=Md(n);t.set(r,n)})}function qAe(e){const t=[];return M.Children.forEach(e,n=>{M.isValidElement(n)&&t.push(n)}),t}const WAe=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:s="sync"})=>{const a=M.useContext(l4).forceRender||zAe()[0],l=rV(),u=qAe(e);let c=u;const d=M.useRef(new Map).current,f=M.useRef(c),h=M.useRef(new Map).current,p=M.useRef(!0);if(o4(()=>{p.current=!1,HAe(u,h),f.current=c}),GAe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return M.createElement(M.Fragment,null,c.map(y=>M.createElement(Zw,{key:Md(y),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:s},y)));c=[...c];const m=f.current.map(Md),b=u.map(Md),_=m.length;for(let y=0;y<_;y++){const g=m[y];b.indexOf(g)===-1&&!d.has(g)&&d.set(g,void 0)}return s==="wait"&&d.size&&(c=[]),d.forEach((y,g)=>{if(b.indexOf(g)!==-1)return;const v=h.get(g);if(!v)return;const S=m.indexOf(g);let w=y;if(!w){const x=()=>{h.delete(g),d.delete(g);const C=f.current.findIndex(A=>A.key===g);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;a(),r&&r()}};w=M.createElement(Zw,{key:Md(v),isPresent:!1,onExitComplete:x,custom:t,presenceAffectsLayout:o,mode:s},v),d.set(g,w)}c.splice(S,0,w)}),c=c.map(y=>{const g=y.key;return d.has(g)?y:M.createElement(Zw,{key:Md(y),isPresent:!0,presenceAffectsLayout:o,mode:s},y)}),M.createElement(M.Fragment,null,d.size?c:c.map(y=>M.cloneElement(y)))};var KAe=DCe({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),iV=zu((e,t)=>{const n=i4("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:s="transparent",className:a,...l}=r4(e),u=JT("chakra-spinner",a),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${KAe} ${o} linear infinite`,...n};return Z.jsx(wu.div,{ref:t,__css:c,className:u,...l,children:r&&Z.jsx(wu.span,{srOnly:!0,children:r})})});iV.displayName="Spinner";var j3=zu(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...s}=t;return Z.jsx("img",{width:r,height:i,ref:n,alt:o,...s})});j3.displayName="NativeImage";function XAe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:s,sizes:a,ignoreFallback:l}=e,[u,c]=M.useState("pending");M.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=M.useRef(),f=M.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,s&&(p.crossOrigin=s),r&&(p.srcset=r),a&&(p.sizes=a),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,s,r,a,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return LCe(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var QAe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function YAe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var T4=zu(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:s,align:a,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,b=u!=null||c||!m,_=XAe({...t,crossOrigin:d,ignoreFallback:b}),y=QAe(_,f),g={ref:n,objectFit:l,objectPosition:a,...b?p:YAe(p,["onError","onLoad"])};return y?i||Z.jsx(wu.img,{as:j3,className:"chakra-image__placeholder",src:r,...g}):Z.jsx(wu.img,{as:j3,src:o,srcSet:s,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});T4.displayName="Image";var oV=zu(function(t,n){const r=i4("Text",t),{className:i,align:o,decoration:s,casing:a,...l}=r4(t),u=bEe({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return Z.jsx(wu.p,{ref:n,className:JT("chakra-text",t.className),...u,...l,__css:r})});oV.displayName="Text";var V3=zu(function(t,n){const r=i4("Heading",t),{className:i,...o}=r4(t);return Z.jsx(wu.h2,{ref:n,className:JT("chakra-heading",t.className),...o,__css:r})});V3.displayName="Heading";var V1=wu("div");V1.displayName="Box";var sV=zu(function(t,n){const{size:r,centerContent:i=!0,...o}=t,s=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return Z.jsx(V1,{ref:n,boxSize:r,__css:{...s,flexShrink:0,flexGrow:0},...o})});sV.displayName="Square";var ZAe=zu(function(t,n){const{size:r,...i}=t;return Z.jsx(sV,{size:r,ref:n,borderRadius:"9999px",...i})});ZAe.displayName="Circle";var A4=zu(function(t,n){const{direction:r,align:i,justify:o,wrap:s,basis:a,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:s,flexBasis:a,flexGrow:l,flexShrink:u};return Z.jsx(wu.div,{ref:n,__css:d,...c})});A4.displayName="Flex";const JAe=""+new URL("logo-13003d72.png",import.meta.url).href,eke=()=>Z.jsxs(A4,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[Z.jsx(T4,{src:JAe,w:"8rem",h:"8rem"}),Z.jsx(iV,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),tke=M.memo(eke);function G3(e){"@babel/helpers - typeof";return G3=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},G3(e)}var aV=[],nke=aV.forEach,rke=aV.slice;function H3(e){return nke.call(rke.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function lV(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":G3(XMLHttpRequest))==="object"}function ike(e){return!!e&&typeof e.then=="function"}function oke(e){return ike(e)?e:Promise.resolve(e)}function ske(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 q3={exports:{}},h0={exports:{}},pO;function ake(){return pO||(pO=1,function(e,t){var n=typeof self<"u"?self:dt,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(s){var a={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(E){return E&&DataView.prototype.isPrototypeOf(E)}if(a.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(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function d(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function h(E){var P={next:function(){var D=E.shift();return{done:D===void 0,value:D}}};return a.iterable&&(P[Symbol.iterator]=function(){return P}),P}function p(E){this.map={},E instanceof p?E.forEach(function(P,D){this.append(D,P)},this):Array.isArray(E)?E.forEach(function(P){this.append(P[0],P[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(P){this.append(P,E[P])},this)}p.prototype.append=function(E,P){E=d(E),P=f(P);var D=this.map[E];this.map[E]=D?D+", "+P:P},p.prototype.delete=function(E){delete this.map[d(E)]},p.prototype.get=function(E){return E=d(E),this.has(E)?this.map[E]:null},p.prototype.has=function(E){return this.map.hasOwnProperty(d(E))},p.prototype.set=function(E,P){this.map[d(E)]=f(P)},p.prototype.forEach=function(E,P){for(var D in this.map)this.map.hasOwnProperty(D)&&E.call(P,this.map[D],D,this)},p.prototype.keys=function(){var E=[];return this.forEach(function(P,D){E.push(D)}),h(E)},p.prototype.values=function(){var E=[];return this.forEach(function(P){E.push(P)}),h(E)},p.prototype.entries=function(){var E=[];return this.forEach(function(P,D){E.push([D,P])}),h(E)},a.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function b(E){return new Promise(function(P,D){E.onload=function(){P(E.result)},E.onerror=function(){D(E.error)}})}function _(E){var P=new FileReader,D=b(P);return P.readAsArrayBuffer(E),D}function y(E){var P=new FileReader,D=b(P);return P.readAsText(E),D}function g(E){for(var P=new Uint8Array(E),D=new Array(P.length),B=0;B-1?P:E}function C(E,P){P=P||{};var D=P.body;if(E instanceof C){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,P.headers||(this.headers=new p(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!D&&E._bodyInit!=null&&(D=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new p(P.headers)),this.method=x(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 A(E){var P=new FormData;return E.trim().split("&").forEach(function(D){if(D){var B=D.split("="),R=B.shift().replace(/\+/g," "),I=B.join("=").replace(/\+/g," ");P.append(decodeURIComponent(R),decodeURIComponent(I))}}),P}function T(E){var P=new p,D=E.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(B){var R=B.split(":"),I=R.shift().trim();if(I){var O=R.join(":").trim();P.append(I,O)}}),P}S.call(C.prototype);function k(E,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(E)}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 E=new k(null,{status:0,statusText:""});return E.type="error",E};var L=[301,302,303,307,308];k.redirect=function(E,P){if(L.indexOf(P)===-1)throw new RangeError("Invalid status code");return new k(null,{status:P,headers:{location:E}})},s.DOMException=o.DOMException;try{new s.DOMException}catch{s.DOMException=function(P,D){this.message=P,this.name=D;var B=Error(P);this.stack=B.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function N(E,P){return new Promise(function(D,B){var R=new C(E,P);if(R.signal&&R.signal.aborted)return B(new s.DOMException("Aborted","AbortError"));var I=new XMLHttpRequest;function O(){I.abort()}I.onload=function(){var F={status:I.status,statusText:I.statusText,headers:T(I.getAllResponseHeaders()||"")};F.url="responseURL"in I?I.responseURL:F.headers.get("X-Request-URL");var U="response"in I?I.response:I.responseText;D(new k(U,F))},I.onerror=function(){B(new TypeError("Network request failed"))},I.ontimeout=function(){B(new TypeError("Network request failed"))},I.onabort=function(){B(new s.DOMException("Aborted","AbortError"))},I.open(R.method,R.url,!0),R.credentials==="include"?I.withCredentials=!0:R.credentials==="omit"&&(I.withCredentials=!1),"responseType"in I&&a.blob&&(I.responseType="blob"),R.headers.forEach(function(F,U){I.setRequestHeader(U,F)}),R.signal&&(R.signal.addEventListener("abort",O),I.onreadystatechange=function(){I.readyState===4&&R.signal.removeEventListener("abort",O)}),I.send(typeof R._bodyInit>"u"?null:R._bodyInit)})}return N.polyfill=!0,o.fetch||(o.fetch=N,o.Headers=p,o.Request=C,o.Response=k),s.Headers=p,s.Request=C,s.Response=k,s.fetch=N,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(h0,h0.exports)),h0.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof dt<"u"&&dt.fetch?n=dt.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof ske<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||ake();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(q3,q3.exports);var uV=q3.exports;const cV=Uc(uV),gO=NO({__proto__:null,default:cV},[uV]);function G1(e){"@babel/helpers - typeof";return G1=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},G1(e)}var tl;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?tl=global.fetch:typeof window<"u"&&window.fetch?tl=window.fetch:tl=fetch);var Jg;lV()&&(typeof global<"u"&&global.XMLHttpRequest?Jg=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Jg=window.XMLHttpRequest));var H1;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?H1=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(H1=window.ActiveXObject));!tl&&gO&&!Jg&&!H1&&(tl=cV||gO);typeof tl!="function"&&(tl=void 0);var W3=function(t,n){if(n&&G1(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},mO=function(t,n,r){tl(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)},yO=!1,lke=function(t,n,r,i){t.queryStringParams&&(n=W3(n,t.queryStringParams));var o=H3({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var s=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,a=H3({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},yO?{}:s);try{mO(n,a,i)}catch(l){if(!s||Object.keys(s).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(s).forEach(function(u){delete a[u]}),mO(n,a,i),yO=!0}catch(u){i(u)}}},uke=function(t,n,r,i){r&&G1(r)==="object"&&(r=W3("",r).slice(1)),t.queryStringParams&&(n=W3(n,t.queryStringParams));try{var o;Jg?o=new Jg:o=new H1("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var s=t.customHeaders;if(s=typeof s=="function"?s():s,s)for(var a in s)o.setRequestHeader(a,s[a]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},cke=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},tl&&n.indexOf("file:")!==0)return lke(t,n,r,i);if(lV()||typeof ActiveXObject=="function")return uke(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function em(e){"@babel/helpers - typeof";return em=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},em(e)}function dke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vO(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};dke(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return fke(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=H3(i,this.options||{},gke()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,s){var a=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=oke(l),l.then(function(u){if(!u)return s(null,{});var c=a.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});a.loadUrl(c,s,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var s=this,a=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(a,l);this.options.request(this.options,n,u,function(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=s.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,s){var a=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=a.options.addPath;typeof a.options.addPath=="function"&&(h=a.options.addPath(f,r));var p=a.services.interpolator.interpolate(h,{lng:f,ns:r});a.options.request(a.options,p,l,function(m,b){u+=1,c.push(m),d.push(b),u===n.length&&typeof s=="function"&&s(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,s=r.logger,a=i.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(a),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&&s.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&s.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();fV.type="backend";const mke=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,yke={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},vke=e=>yke[e],_ke=e=>e.replace(mke,vke);let K3={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:_ke};function bke(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};K3={...K3,...e}}function JMe(){return K3}let hV;function Ske(e){hV=e}function eNe(){return hV}const wke={type:"3rdParty",init(e){bke(e.options.react),Ske(e)}};we.use(fV).use(wke).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const XS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wh(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function k4(e){return"nodeType"in e}function eo(e){var t,n;return e?wh(e)?e:k4(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function P4(e){const{Document:t}=eo(e);return e instanceof t}function Qm(e){return wh(e)?!1:e instanceof eo(e).HTMLElement}function xke(e){return e instanceof eo(e).SVGElement}function xh(e){return e?wh(e)?e.document:k4(e)?P4(e)?e:Qm(e)?e.ownerDocument:document:document:document}const Sa=XS?M.useLayoutEffect:M.useEffect;function QS(e){const t=M.useRef(e);return Sa(()=>{t.current=e}),M.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=M.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function tm(e,t){t===void 0&&(t=[e]);const n=M.useRef(e);return Sa(()=>{n.current!==e&&(n.current=e)},t),n}function Ym(e,t){const n=M.useRef();return M.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function q1(e){const t=QS(e),n=M.useRef(null),r=M.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function W1(e){const t=M.useRef();return M.useEffect(()=>{t.current=e},[e]),t.current}let Jw={};function YS(e,t){return M.useMemo(()=>{if(t)return t;const n=Jw[e]==null?0:Jw[e]+1;return Jw[e]=n,e+"-"+n},[e,t])}function pV(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const a=Object.entries(s);for(const[l,u]of a){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const wf=pV(1),K1=pV(-1);function Eke(e){return"clientX"in e&&"clientY"in e}function R4(e){if(!e)return!1;const{KeyboardEvent:t}=eo(e.target);return t&&e instanceof t}function Tke(e){if(!e)return!1;const{TouchEvent:t}=eo(e.target);return t&&e instanceof t}function nm(e){if(Tke(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 Eke(e)?{x:e.clientX,y:e.clientY}:null}const rm=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[rm.Translate.toString(e),rm.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),_O="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ake(e){return e.matches(_O)?e:e.querySelector(_O)}const kke={display:"none"};function Pke(e){let{id:t,value:n}=e;return vn.createElement("div",{id:t,style:kke},n)}const Rke={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 Ike(e){let{id:t,announcement:n}=e;return vn.createElement("div",{id:t,style:Rke,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function Oke(){const[e,t]=M.useState("");return{announce:M.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const gV=M.createContext(null);function Mke(e){const t=M.useContext(gV);M.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Nke(){const[e]=M.useState(()=>new Set),t=M.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[M.useCallback(r=>{let{type:i,event:o}=r;e.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[e]),t]}const Dke={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. `},Lke={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 $ke(e){let{announcements:t=Lke,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Dke}=e;const{announce:o,announcement:s}=Oke(),a=YS("DndLiveRegion"),[l,u]=M.useState(!1);if(M.useEffect(()=>{u(!0)},[]),Mke(M.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=vn.createElement(vn.Fragment,null,vn.createElement(Pke,{id:r,value:i.draggable}),vn.createElement(Ike,{id:a,announcement:s}));return n?Cs.createPortal(c,n):c}var Fr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Fr||(Fr={}));function X1(){}function bO(e,t){return M.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Fke(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Fs=Object.freeze({x:0,y:0});function Bke(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zke(e,t){const n=nm(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 Uke(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function jke(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Vke(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 Gke(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function Hke(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),s=i-r,a=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=Hke(a,t);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(jke)};function Wke(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 Kke=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:s}=o,a=n.get(s);if(a&&Wke(r,a)){const u=Vke(a).reduce((d,f)=>d+Bke(r,f),0),c=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:c}})}}return i.sort(Uke)};function Xke(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function mV(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fs}function Qke(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const Yke=Qke(1);function yV(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 Zke(e,t,n){const r=yV(t);if(!r)return e;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=e.left-s-(1-i)*parseFloat(n),u=e.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),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 Jke={ignoreTransform:!1};function Zm(e,t){t===void 0&&(t=Jke);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=eo(e).getComputedStyle(e);u&&(n=Zke(n,u,c))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function SO(e){return Zm(e,{ignoreTransform:!0})}function ePe(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function tPe(e,t){return t===void 0&&(t=eo(e).getComputedStyle(e)),t.position==="fixed"}function nPe(e,t){t===void 0&&(t=eo(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 I4(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(P4(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Qm(i)||xke(i)||n.includes(i))return n;const o=eo(e).getComputedStyle(i);return i!==e&&nPe(i,o)&&n.push(i),tPe(i,o)?n:r(i.parentNode)}return e?r(e):n}function vV(e){const[t]=I4(e,1);return t??null}function ex(e){return!XS||!e?null:wh(e)?e:k4(e)?P4(e)||e===xh(e).scrollingElement?window:Qm(e)?e:null:null}function _V(e){return wh(e)?e.scrollX:e.scrollLeft}function bV(e){return wh(e)?e.scrollY:e.scrollTop}function X3(e){return{x:_V(e),y:bV(e)}}var ti;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ti||(ti={}));function SV(e){return!XS||!e?!1:e===document.scrollingElement}function wV(e){const t={x:0,y:0},n=SV(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const rPe={x:.2,y:.2};function iPe(e,t,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=rPe);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=wV(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=ti.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=ti.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&a>=t.right-m.width?(h.x=ti.Forward,p.x=r*Math.abs((t.right-m.width-a)/m.width)):!d&&s<=t.left+m.width&&(h.x=ti.Backward,p.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:p}}function oPe(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function xV(e){return e.reduce((t,n)=>wf(t,X3(n)),Fs)}function sPe(e){return e.reduce((t,n)=>t+_V(n),0)}function aPe(e){return e.reduce((t,n)=>t+bV(n),0)}function CV(e,t){if(t===void 0&&(t=Zm),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);vV(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const lPe=[["x",["left","right"],sPe],["y",["top","bottom"],aPe]];class O4{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=I4(n),i=xV(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,s,a]of lPe)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ip{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 uPe(e){const{EventTarget:t}=eo(e);return e instanceof t?e:xh(e)}function tx(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 qo;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(qo||(qo={}));function wO(e){e.preventDefault()}function cPe(e){e.stopPropagation()}var En;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(En||(En={}));const EV={start:[En.Space,En.Enter],cancel:[En.Esc],end:[En.Space,En.Enter]},dPe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case En.Right:return{...n,x:n.x+25};case En.Left:return{...n,x:n.x-25};case En.Down:return{...n,y:n.y+25};case En.Up:return{...n,y:n.y-25}}};class TV{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 Ip(xh(n)),this.windowListeners=new Ip(eo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qo.Resize,this.handleCancel),this.windowListeners.add(qo.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qo.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&CV(r),n(Fs)}handleKeyDown(t){if(R4(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=EV,coordinateGetter:s=dPe,scrollBehavior:a="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:Fs;this.referenceCoordinates||(this.referenceCoordinates=c);const d=s(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=K1(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const b=t.code,{isTop:_,isRight:y,isLeft:g,isBottom:v,maxScroll:S,minScroll:w}=wV(m),x=oPe(m),C={x:Math.min(b===En.Right?x.right-x.width/2:x.right,Math.max(b===En.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(b===En.Down?x.bottom-x.height/2:x.bottom,Math.max(b===En.Down?x.top:x.top+x.height/2,d.y))},A=b===En.Right&&!y||b===En.Left&&!g,T=b===En.Down&&!v||b===En.Up&&!_;if(A&&C.x!==d.x){const k=m.scrollLeft+f.x,L=b===En.Right&&k<=S.x||b===En.Left&&k>=w.x;if(L&&!f.y){m.scrollTo({left:k,behavior:a});return}L?h.x=m.scrollLeft-k:h.x=b===En.Right?m.scrollLeft-S.x:m.scrollLeft-w.x,h.x&&m.scrollBy({left:-h.x,behavior:a});break}else if(T&&C.y!==d.y){const k=m.scrollTop+f.y,L=b===En.Down&&k<=S.y||b===En.Up&&k>=w.y;if(L&&!f.x){m.scrollTo({top:k,behavior:a});return}L?h.y=m.scrollTop-k:h.y=b===En.Down?m.scrollTop-S.y:m.scrollTop-w.y,h.y&&m.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,wf(K1(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()}}TV.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=EV,onActivation:i}=t,{active:o}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function xO(e){return!!(e&&"distance"in e)}function CO(e){return!!(e&&"delay"in e)}class M4{constructor(t,n,r){var i;r===void 0&&(r=uPe(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=xh(s),this.documentListeners=new Ip(this.document),this.listeners=new Ip(r),this.windowListeners=new Ip(eo(s)),this.initialCoordinates=(i=nm(o))!=null?i:Fs,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(qo.Resize,this.handleCancel),this.windowListeners.add(qo.DragStart,wO),this.windowListeners.add(qo.VisibilityChange,this.handleCancel),this.windowListeners.add(qo.ContextMenu,wO),this.documentListeners.add(qo.Keydown,this.handleKeydown),n){if(xO(n))return;if(CO(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(qo.Click,cPe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qo.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=nm(t))!=null?n:Fs,u=K1(i,l);if(!r&&a){if(CO(a))return tx(u,a.tolerance)?this.handleCancel():void 0;if(xO(a))return a.tolerance!=null&&tx(u,a.tolerance)?this.handleCancel():tx(u,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===En.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const fPe={move:{name:"pointermove"},end:{name:"pointerup"}};class AV extends M4{constructor(t){const{event:n}=t,r=xh(n.target);super(t,fPe,r)}}AV.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 hPe={move:{name:"mousemove"},end:{name:"mouseup"}};var Q3;(function(e){e[e.RightClick=2]="RightClick"})(Q3||(Q3={}));class kV extends M4{constructor(t){super(t,hPe,xh(t.event.target))}}kV.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Q3.RightClick?!1:(r==null||r({event:n}),!0)}}];const nx={move:{name:"touchmove"},end:{name:"touchend"}};class PV extends M4{constructor(t){super(t,nx)}static setup(){return window.addEventListener(nx.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(nx.move.name,t)};function t(){}}}PV.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 Op;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Op||(Op={}));var Q1;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Q1||(Q1={}));function pPe(e){let{acceleration:t,activator:n=Op.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=Q1.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=mPe({delta:d,disabled:!o}),[p,m]=Cke(),b=M.useRef({x:0,y:0}),_=M.useRef({x:0,y:0}),y=M.useMemo(()=>{switch(n){case Op.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Op.DraggableRect:return i}},[n,i,l]),g=M.useRef(null),v=M.useCallback(()=>{const w=g.current;if(!w)return;const x=b.current.x*_.current.x,C=b.current.y*_.current.y;w.scrollBy(x,C)},[]),S=M.useMemo(()=>a===Q1.TreeOrder?[...u].reverse():u,[a,u]);M.useEffect(()=>{if(!o||!u.length||!y){m();return}for(const w of S){if((r==null?void 0:r(w))===!1)continue;const x=u.indexOf(w),C=c[x];if(!C)continue;const{direction:A,speed:T}=iPe(w,C,y,t,f);for(const k of["x","y"])h[k][A[k]]||(T[k]=0,A[k]=0);if(T.x>0||T.y>0){m(),g.current=w,p(v,s),b.current=T,_.current=A;return}}b.current={x:0,y:0},_.current={x:0,y:0},m()},[t,v,r,m,o,s,JSON.stringify(y),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const gPe={x:{[ti.Backward]:!1,[ti.Forward]:!1},y:{[ti.Backward]:!1,[ti.Forward]:!1}};function mPe(e){let{delta:t,disabled:n}=e;const r=W1(t);return Ym(i=>{if(n||!r||!i)return gPe;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[ti.Backward]:i.x[ti.Backward]||o.x===-1,[ti.Forward]:i.x[ti.Forward]||o.x===1},y:{[ti.Backward]:i.y[ti.Backward]||o.y===-1,[ti.Forward]:i.y[ti.Forward]||o.y===1}}},[n,t,r])}function yPe(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Ym(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function vPe(e,t){return M.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...o]},[]),[e,t])}var im;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(im||(im={}));var Y3;(function(e){e.Optimized="optimized"})(Y3||(Y3={}));const EO=new Map;function _Pe(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,s]=M.useState(null),{frequency:a,measure:l,strategy:u}=i,c=M.useRef(e),d=b(),f=tm(d),h=M.useCallback(function(_){_===void 0&&(_=[]),!f.current&&s(y=>y===null?_:y.concat(_.filter(g=>!y.includes(g))))},[f]),p=M.useRef(null),m=Ym(_=>{if(d&&!n)return EO;if(!_||_===EO||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 O4(l(v),v):null;g.rect.current=S,S&&y.set(g.id,S)}return y}return _},[e,o,n,d,l]);return M.useEffect(()=>{c.current=e},[e]),M.useEffect(()=>{d||h()},[n,d]),M.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),M.useEffect(()=>{d||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},a))},[a,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function b(){switch(u){case im.Always:return!1;case im.BeforeDragging:return n;default:return!n}}}function N4(e,t){return Ym(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function bPe(e,t){return N4(e,t)}function SPe(e){let{callback:t,disabled:n}=e;const r=QS(t),i=M.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return M.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function ZS(e){let{callback:t,disabled:n}=e;const r=QS(t),i=M.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return M.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function wPe(e){return new O4(Zm(e),e)}function TO(e,t,n){t===void 0&&(t=wPe);const[r,i]=M.useReducer(a,null),o=SPe({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}}}}),s=ZS({callback:i});return Sa(()=>{i(),e?(s==null||s.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),o==null||o.disconnect())},[e]),r;function a(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function xPe(e){const t=N4(e);return mV(e,t)}const AO=[];function CPe(e){const t=M.useRef(e),n=Ym(r=>e?r&&r!==AO&&e&&t.current&&e.parentNode===t.current.parentNode?r:I4(e):AO,[e]);return M.useEffect(()=>{t.current=e},[e]),n}function EPe(e){const[t,n]=M.useState(null),r=M.useRef(e),i=M.useCallback(o=>{const s=ex(o.target);s&&n(a=>a?(a.set(s,X3(s)),new Map(a)):null)},[]);return M.useEffect(()=>{const o=r.current;if(e!==o){s(o);const a=e.map(l=>{const u=ex(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,X3(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(o)};function s(a){a.forEach(l=>{const u=ex(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),M.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,s)=>wf(o,s),Fs):xV(e):Fs,[e,t])}function kO(e,t){t===void 0&&(t=[]);const n=M.useRef(null);return M.useEffect(()=>{n.current=null},t),M.useEffect(()=>{const r=e!==Fs;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?K1(e,n.current):Fs}function TPe(e){M.useEffect(()=>{if(!XS)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 APe(e,t){return M.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,t)},n},{}),[e,t])}function RV(e){return M.useMemo(()=>e?ePe(e):null,[e])}const rx=[];function kPe(e,t){t===void 0&&(t=Zm);const[n]=e,r=RV(n?eo(n):null),[i,o]=M.useReducer(a,rx),s=ZS({callback:o});return e.length>0&&i===rx&&o(),Sa(()=>{e.length?e.forEach(l=>s==null?void 0:s.observe(l)):(s==null||s.disconnect(),o())},[e]),i;function a(){return e.length?e.map(l=>SV(l)?r:new O4(t(l),l)):rx}}function IV(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Qm(t)?t:e}function PPe(e){let{measure:t}=e;const[n,r]=M.useState(null),i=M.useCallback(u=>{for(const{target:c}of u)if(Qm(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=ZS({callback:i}),s=M.useCallback(u=>{const c=IV(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[a,l]=q1(s);return M.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const RPe=[{sensor:AV,options:{}},{sensor:TV,options:{}}],IPe={current:{}},J0={draggable:{measure:SO},droppable:{measure:SO,strategy:im.WhileDragging,frequency:Y3.Optimized},dragOverlay:{measure:Zm}};class Mp 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 OPe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Mp,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:X1},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:J0,measureDroppableContainers:X1,windowRect:null,measuringScheduled:!1},OV={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:X1,draggableNodes:new Map,over:null,measureDroppableContainers:X1},Jm=M.createContext(OV),MV=M.createContext(OPe);function MPe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Mp}}}function NPe(e,t){switch(t.type){case Fr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Fr.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Fr.DragEnd:case Fr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Fr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Mp(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Fr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new Mp(e.droppable.containers);return s.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:s}}}case Fr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Mp(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function DPe(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=M.useContext(Jm),o=W1(r),s=W1(n==null?void 0:n.id);return M.useEffect(()=>{if(!t&&!r&&o&&s!=null){if(!R4(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=Ake(c);if(d){d.focus();break}}})}},[r,t,i,s,o]),null}function NV(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function LPe(e){return M.useMemo(()=>({draggable:{...J0.draggable,...e==null?void 0:e.draggable},droppable:{...J0.droppable,...e==null?void 0:e.droppable},dragOverlay:{...J0.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 $Pe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=M.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;Sa(()=>{if(!s&&!a||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=mV(c,r);if(s||(d.x=0),a||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=vV(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const JS=M.createContext({...Fs,scaleX:1,scaleY:1});var Nl;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Nl||(Nl={}));const FPe=M.memo(function(t){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:c=RPe,collisionDetection:d=qke,measuring:f,modifiers:h,...p}=t;const m=M.useReducer(NPe,void 0,MPe),[b,_]=m,[y,g]=Nke(),[v,S]=M.useState(Nl.Uninitialized),w=v===Nl.Initialized,{draggable:{active:x,nodes:C,translate:A},droppable:{containers:T}}=b,k=x?C.get(x):null,L=M.useRef({initial:null,translated:null}),N=M.useMemo(()=>{var On;return x!=null?{id:x,data:(On=k==null?void 0:k.data)!=null?On:IPe,rect:L}:null},[x,k]),E=M.useRef(null),[P,D]=M.useState(null),[B,R]=M.useState(null),I=tm(p,Object.values(p)),O=YS("DndDescribedBy",s),F=M.useMemo(()=>T.getEnabled(),[T]),U=LPe(f),{droppableRects:V,measureDroppableContainers:H,measuringScheduled:Y}=_Pe(F,{dragging:w,dependencies:[A.x,A.y],config:U.droppable}),Q=yPe(C,x),j=M.useMemo(()=>B?nm(B):null,[B]),K=Aa(),te=bPe(Q,U.draggable.measure);$Pe({activeNode:x?C.get(x):null,config:K.layoutShiftCompensation,initialRect:te,measure:U.draggable.measure});const oe=TO(Q,U.draggable.measure,te),me=TO(Q?Q.parentElement:null),le=M.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:V,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ht=T.getNodeFor((n=le.current.over)==null?void 0:n.id),nt=PPe({measure:U.dragOverlay.measure}),$e=(r=nt.nodeRef.current)!=null?r:Q,ct=w?(i=nt.rect)!=null?i:oe:null,Pe=!!(nt.nodeRef.current&&nt.rect),qt=xPe(Pe?null:oe),Sr=RV($e?eo($e):null),Pn=CPe(w?ht??Q:null),bn=kPe(Pn),Wt=NV(h,{transform:{x:A.x-qt.x,y:A.y-qt.y,scaleX:1,scaleY:1},activatorEvent:B,active:N,activeNodeRect:oe,containerNodeRect:me,draggingNodeRect:ct,over:le.current.over,overlayNodeRect:nt.rect,scrollableAncestors:Pn,scrollableAncestorRects:bn,windowRect:Sr}),Rn=j?wf(j,A):null,wr=EPe(Pn),to=kO(wr),Gr=kO(wr,[oe]),ar=wf(Wt,to),Or=ct?Yke(ct,Wt):null,Hr=N&&Or?d({active:N,collisionRect:Or,droppableRects:V,droppableContainers:F,pointerCoordinates:Rn}):null,In=Gke(Hr,"id"),[dn,Ci]=M.useState(null),si=Pe?Wt:wf(Wt,Gr),ji=Xke(si,(o=dn==null?void 0:dn.rect)!=null?o:null,oe),ps=M.useCallback((On,Kt)=>{let{sensor:Mr,options:Cr}=Kt;if(E.current==null)return;const Er=C.get(E.current);if(!Er)return;const qr=On.nativeEvent,Ei=new Mr({active:E.current,activeNode:Er,event:qr,options:Cr,context:le,onStart(ai){const Nr=E.current;if(Nr==null)return;const gs=C.get(Nr);if(!gs)return;const{onDragStart:Vs}=I.current,li={active:{id:Nr,data:gs.data,rect:L}};Cs.unstable_batchedUpdates(()=>{Vs==null||Vs(li),S(Nl.Initializing),_({type:Fr.DragStart,initialCoordinates:ai,active:Nr}),y({type:"onDragStart",event:li})})},onMove(ai){_({type:Fr.DragMove,coordinates:ai})},onEnd:ro(Fr.DragEnd),onCancel:ro(Fr.DragCancel)});Cs.unstable_batchedUpdates(()=>{D(Ei),R(On.nativeEvent)});function ro(ai){return async function(){const{active:gs,collisions:Vs,over:li,scrollAdjustedTranslate:_l}=le.current;let zo=null;if(gs&&_l){const{cancelDrop:Wr}=I.current;zo={activatorEvent:qr,active:gs,collisions:Vs,delta:_l,over:li},ai===Fr.DragEnd&&typeof Wr=="function"&&await Promise.resolve(Wr(zo))&&(ai=Fr.DragCancel)}E.current=null,Cs.unstable_batchedUpdates(()=>{_({type:ai}),S(Nl.Uninitialized),Ci(null),D(null),R(null);const Wr=ai===Fr.DragEnd?"onDragEnd":"onDragCancel";if(zo){const ka=I.current[Wr];ka==null||ka(zo),y({type:Wr,event:zo})}})}}},[C]),xr=M.useCallback((On,Kt)=>(Mr,Cr)=>{const Er=Mr.nativeEvent,qr=C.get(Cr);if(E.current!==null||!qr||Er.dndKit||Er.defaultPrevented)return;const Ei={active:qr};On(Mr,Kt.options,Ei)===!0&&(Er.dndKit={capturedBy:Kt.sensor},E.current=Cr,ps(Mr,Kt))},[C,ps]),no=vPe(c,xr);TPe(c),Sa(()=>{oe&&v===Nl.Initializing&&S(Nl.Initialized)},[oe,v]),M.useEffect(()=>{const{onDragMove:On}=I.current,{active:Kt,activatorEvent:Mr,collisions:Cr,over:Er}=le.current;if(!Kt||!Mr)return;const qr={active:Kt,activatorEvent:Mr,collisions:Cr,delta:{x:ar.x,y:ar.y},over:Er};Cs.unstable_batchedUpdates(()=>{On==null||On(qr),y({type:"onDragMove",event:qr})})},[ar.x,ar.y]),M.useEffect(()=>{const{active:On,activatorEvent:Kt,collisions:Mr,droppableContainers:Cr,scrollAdjustedTranslate:Er}=le.current;if(!On||E.current==null||!Kt||!Er)return;const{onDragOver:qr}=I.current,Ei=Cr.get(In),ro=Ei&&Ei.rect.current?{id:Ei.id,rect:Ei.rect.current,data:Ei.data,disabled:Ei.disabled}:null,ai={active:On,activatorEvent:Kt,collisions:Mr,delta:{x:Er.x,y:Er.y},over:ro};Cs.unstable_batchedUpdates(()=>{Ci(ro),qr==null||qr(ai),y({type:"onDragOver",event:ai})})},[In]),Sa(()=>{le.current={activatorEvent:B,active:N,activeNode:Q,collisionRect:Or,collisions:Hr,droppableRects:V,draggableNodes:C,draggingNode:$e,draggingNodeRect:ct,droppableContainers:T,over:dn,scrollableAncestors:Pn,scrollAdjustedTranslate:ar},L.current={initial:ct,translated:Or}},[N,Q,Hr,Or,C,$e,ct,V,T,dn,Pn,ar]),pPe({...K,delta:A,draggingRect:Or,pointerCoordinates:Rn,scrollableAncestors:Pn,scrollableAncestorRects:bn});const Ta=M.useMemo(()=>({active:N,activeNode:Q,activeNodeRect:oe,activatorEvent:B,collisions:Hr,containerNodeRect:me,dragOverlay:nt,draggableNodes:C,droppableContainers:T,droppableRects:V,over:dn,measureDroppableContainers:H,scrollableAncestors:Pn,scrollableAncestorRects:bn,measuringConfiguration:U,measuringScheduled:Y,windowRect:Sr}),[N,Q,oe,B,Hr,me,nt,C,T,V,dn,H,Pn,bn,U,Y,Sr]),bo=M.useMemo(()=>({activatorEvent:B,activators:no,active:N,activeNodeRect:oe,ariaDescribedById:{draggable:O},dispatch:_,draggableNodes:C,over:dn,measureDroppableContainers:H}),[B,no,N,oe,_,O,C,dn,H]);return vn.createElement(gV.Provider,{value:g},vn.createElement(Jm.Provider,{value:bo},vn.createElement(MV.Provider,{value:Ta},vn.createElement(JS.Provider,{value:ji},u)),vn.createElement(DPe,{disabled:(a==null?void 0:a.restoreFocus)===!1})),vn.createElement($ke,{...a,hiddenTextDescribedById:O}));function Aa(){const On=(P==null?void 0:P.autoScrollEnabled)===!1,Kt=typeof l=="object"?l.enabled===!1:l===!1,Mr=w&&!On&&!Kt;return typeof l=="object"?{...l,enabled:Mr}:{enabled:Mr}}}),BPe=M.createContext(null),PO="button",zPe="Droppable";function tNe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=YS(zPe),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=M.useContext(Jm),{role:h=PO,roleDescription:p="draggable",tabIndex:m=0}=i??{},b=(l==null?void 0:l.id)===t,_=M.useContext(b?JS:BPe),[y,g]=q1(),[v,S]=q1(),w=APe(s,t),x=tm(n);Sa(()=>(d.set(t,{id:t,key:o,node:y,activatorNode:v,data:x}),()=>{const A=d.get(t);A&&A.key===o&&d.delete(t)}),[d,t]);const C=M.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":b&&h===PO?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,b,p,c.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:C,isDragging:b,listeners:r?void 0:w,node:y,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:_}}function UPe(){return M.useContext(MV)}const jPe="Droppable",VPe={timeout:25};function nNe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=YS(jPe),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=M.useContext(Jm),c=M.useRef({disabled:n}),d=M.useRef(!1),f=M.useRef(null),h=M.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:b}={...VPe,...i},_=tm(m??r),y=M.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(_.current)?_.current:[_.current]),h.current=null},b)},[b]),g=ZS({callback:y,disabled:p||!s}),v=M.useCallback((C,A)=>{g&&(A&&(g.unobserve(A),d.current=!1),C&&g.observe(C))},[g]),[S,w]=q1(v),x=tm(t);return M.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),Sa(()=>(a({type:Fr.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:x}}),()=>a({type:Fr.UnregisterDroppable,key:o,id:r})),[r]),M.useEffect(()=>{n!==c.current.disabled&&(a({type:Fr.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,a]),{active:s,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:w}}function GPe(e){let{animation:t,children:n}=e;const[r,i]=M.useState(null),[o,s]=M.useState(null),a=W1(n);return!n&&!r&&a&&i(a),Sa(()=>{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]),vn.createElement(vn.Fragment,null,n,r?M.cloneElement(r,{ref:s}):null)}const HPe={x:0,y:0,scaleX:1,scaleY:1};function qPe(e){let{children:t}=e;return vn.createElement(Jm.Provider,{value:OV},vn.createElement(JS.Provider,{value:HPe},t))}const WPe={position:"fixed",touchAction:"none"},KPe=e=>R4(e)?"transform 250ms ease":void 0,XPe=M.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:s,rect:a,style:l,transform:u,transition:c=KPe}=e;if(!a)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...WPe,width:a.width,height:a.height,top:a.top,left:a.left,transform:rm.Transform.toString(d),transformOrigin:i&&r?zke(r,a):void 0,transition:typeof c=="function"?c(r):c,...l};return vn.createElement(n,{className:s,style:f,ref:t},o)}),QPe=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:s}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(i[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);s!=null&&s.active&&n.node.classList.remove(s.active)}},YPe=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:rm.Transform.toString(t)},{transform:rm.Transform.toString(n)}]},ZPe={duration:250,easing:"ease",keyframes:YPe,sideEffects:QPe({styles:{active:{opacity:"0"}}})};function JPe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return QS((o,s)=>{if(t===null)return;const a=n.get(o);if(!a)return;const l=a.node.current;if(!l)return;const u=IV(s);if(!u)return;const{transform:c}=eo(s).getComputedStyle(s),d=yV(c);if(!d)return;const f=typeof t=="function"?t:e6e(t);return CV(l,i.draggable.measure),f({active:{id:o,data:a.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:s,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function e6e(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...ZPe,...e};return o=>{let{active:s,dragOverlay:a,transform:l,...u}=o;if(!t)return;const c={x:a.rect.left-s.rect.left,y:a.rect.top-s.rect.top},d={scaleX:l.scaleX!==1?s.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?s.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:s,dragOverlay:a,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const b=r==null?void 0:r({active:s,dragOverlay:a,...u}),_=a.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{_.onfinish=()=>{b==null||b(),y()}})}}let RO=0;function t6e(e){return M.useMemo(()=>{if(e!=null)return RO++,RO},[e])}const n6e=vn.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:s,wrapperElement:a="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:b,over:_,measuringConfiguration:y,scrollableAncestors:g,scrollableAncestorRects:v,windowRect:S}=UPe(),w=M.useContext(JS),x=t6e(d==null?void 0:d.id),C=NV(s,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:b.rect,over:_,overlayNodeRect:b.rect,scrollableAncestors:g,scrollableAncestorRects:v,transform:w,windowRect:S}),A=N4(f),T=JPe({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:y}),k=A?b.setRef:void 0;return vn.createElement(qPe,null,vn.createElement(GPe,{animation:T},d&&x?vn.createElement(XPe,{key:x,id:d.id,ref:k,as:a,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:A,style:{zIndex:u,...i},transform:C},n):null))}),r6e=()=>w$(),i6e=p$,o6e=Fi([rxe,BT],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),s6e=()=>{const e=i6e(o6e);return M.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=nm(n);if(!o)return i;const s=o.x-r.left,a=o.y-r.top,l=i.x+s-r.width/2,u=i.y+a-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])};function a6e(e){return Z.jsx(FPe,{...e})}const p0=28,IO={w:p0,h:p0,maxW:p0,maxH:p0,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},l6e=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return Z.jsx(V1,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:Z.jsx(oV,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return Z.jsx(V1,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:Z.jsx(T4,{sx:{...IO},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?Z.jsxs(A4,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...IO},children:[Z.jsx(V3,{children:e.dragData.payload.imageDTOs.length}),Z.jsx(V3,{size:"sm",children:"Images"})]}):null},u6e=M.memo(l6e),c6e=e=>{const[t,n]=M.useState(null),r=ge("images"),i=r6e(),o=M.useCallback(d=>{r.trace({dragData:mn(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),s=M.useCallback(d=>{var h;r.trace({dragData:mn(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(zz({overData:f,activeData:t})),n(null))},[t,i,r]),a=bO(kV,{activationConstraint:{distance:10}}),l=bO(PV,{activationConstraint:{distance:10}}),u=Fke(a,l),c=s6e();return Z.jsxs(a6e,{onDragStart:o,onDragEnd:s,sensors:u,collisionDetection:Kke,autoScroll:!1,children:[e.children,Z.jsx(n6e,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"none",userSelect:"none",padding:"10rem"},children:Z.jsx(WAe,{children:t&&Z.jsx(BAe.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:Z.jsx(u6e,{dragData:t})},"overlay-drag-image")})})]})},d6e=M.memo(c6e),OO=Ru(void 0),MO=Ru(void 0),f6e=M.lazy(()=>KM(()=>import("./App-dbf8f111.js"),["./App-dbf8f111.js","./menu-c9cc8c3d.js","./App-6125620a.css"],import.meta.url)),h6e=M.lazy(()=>KM(()=>import("./ThemeLocaleProvider-a3380d0c.js"),["./ThemeLocaleProvider-a3380d0c.js","./menu-c9cc8c3d.js","./ThemeLocaleProvider-90f0fcd3.css"],import.meta.url)),p6e=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,selectedImage:s,customStarUi:a})=>(M.useEffect(()=>(t&&$f.set(t),e&&_g.set(e),o&&bg.set(o),qB(),i&&i.length>0?JC(GR(),...i):JC(GR()),()=>{_g.set(void 0),$f.set(void 0),bg.set(void 0)}),[e,t,i,o]),M.useEffect(()=>(a&&OO.set(a),()=>{OO.set(void 0)}),[a]),M.useEffect(()=>(r&&MO.set(r),()=>{MO.set(void 0)}),[r]),Z.jsx(vn.StrictMode,{children:Z.jsx(Jce,{store:nxe,children:Z.jsx(vn.Suspense,{fallback:Z.jsx(tke,{}),children:Z.jsx(h6e,{children:Z.jsx(d6e,{children:Z.jsx(f6e,{config:n,selectedImage:s})})})})})})),g6e=M.memo(p6e);ix.createRoot(document.getElementById("root")).render(Z.jsx(g6e,{}));export{pc as $,Es as A,Ege as B,yo as C,ou as D,Ys as E,ZIe as F,dT as G,Xwe as H,zu as I,$Ce as J,wu as K,JT as L,zMe as M,$Me as N,WAe as O,kge as P,BAe as Q,QMe as R,sg as S,r4 as T,iV as U,i4 as V,FMe as W,BMe as X,LCe as Y,DCe as Z,UMe as _,i5 as a,yee as a$,Uc as a0,u1 as a1,Cq as a2,vn as a3,uEe as a4,XMe as a5,bEe as a6,Za as a7,TU as a8,O4e as a9,SU as aA,CCe as aB,Cs as aC,F4 as aD,ZT as aE,B9e as aF,QRe as aG,dIe as aH,fIe as aI,zRe as aJ,FRe as aK,oV as aL,wp as aM,z0e as aN,ez as aO,x9e as aP,$Ie as aQ,Z5 as aR,LT as aS,eMe as aT,T4 as aU,JAe as aV,we as aW,nIe as aX,cIe as aY,Nde as aZ,S5 as a_,GMe as aa,A3 as ab,LMe as ac,KMe as ad,Fi as ae,_T as af,wm as ag,i6e as ah,KRe as ai,Mm as aj,CL as ak,QL as al,sb as am,ge as an,r6e as ao,A9e as ap,Tn as aq,sa as ar,V1 as as,A4 as at,V3 as au,rxe as av,BT as aw,uIe as ax,wCe as ay,YT as az,C_ as b,SR as b$,P6e as b0,K9e as b1,M9e as b2,tMe as b3,J9e as b4,y0e as b5,O9e as b6,L9e as b7,Rne as b8,$ye as b9,VIe as bA,y6e as bB,w6e as bC,x6e as bD,C6e as bE,E6e as bF,Q6e as bG,Y6e as bH,f9e as bI,h9e as bJ,R6e as bK,i8e as bL,A6e as bM,H6e as bN,M6e as bO,kSe as bP,k6e as bQ,Z6e as bR,T6e as bS,u8e as bT,I6e as bU,Kk as bV,O6e as bW,Xk as bX,F6e as bY,W6e as bZ,fMe as b_,Fye as ba,H9e as bb,W9e as bc,D9e as bd,Q9e as be,WRe as bf,T9e as bg,tIe as bh,sre as bi,vIe as bj,yIe as bk,JRe as bl,qIe as bm,nNe as bn,tNe as bo,kB as bp,HIe as bq,YRe as br,ZRe as bs,oIe as bt,LC as bu,eIe as bv,jl as bw,vy as bx,GIe as by,jIe as bz,CK as c,v6e as c$,D6e as c0,YIe as c1,ASe as c2,N6e as c3,P8 as c4,m9e as c5,y9e as c6,v9e as c7,B6e as c8,_9e as c9,fT as cA,rs as cB,j6e as cC,Fm as cD,Z9e as cE,K7 as cF,jOe as cG,HOe as cH,KOe as cI,WOe as cJ,VOe as cK,GOe as cL,qOe as cM,Fwe as cN,u9e as cO,iOe as cP,jRe as cQ,URe as cR,lOe as cS,tte as cT,YOe as cU,tOe as cV,SOe as cW,wOe as cX,L6e as cY,cMe as cZ,AOe as c_,z6e as ca,b9e as cb,U6e as cc,S9e as cd,Le as ce,OO as cf,SIe as cg,_Ie as ch,bIe as ci,$de as cj,I0e as ck,HB as cl,wD as cm,BRe as cn,Bz as co,rIe as cp,f1 as cq,oF as cr,DMe as cs,iIe as ct,Ey as cu,h1 as cv,k9e as cw,Iu as cx,R9e as cy,Kr as cz,dee as d,S8e as d$,TOe as d0,Lb as d1,xne as d2,EOe as d3,Cm as d4,xMe as d5,uMe as d6,kMe as d7,lMe as d8,xOe as d9,hIe as dA,pIe as dB,Qc as dC,Qk as dD,Ode as dE,Id as dF,L6 as dG,Q0e as dH,X0e as dI,kIe as dJ,PIe as dK,RIe as dL,Mde as dM,IIe as dN,Z$ as dO,CIe as dP,TIe as dQ,DIe as dR,LIe as dS,OIe as dT,Pb as dU,NIe as dV,MIe as dW,wIe as dX,_we as dY,wR as dZ,xIe as d_,bOe as da,PMe as db,POe as dc,AMe as dd,ROe as de,_Oe as df,wne as dg,pMe as dh,COe as di,$6e as dj,dMe as dk,kOe as dl,QOe as dm,UIe as dn,FIe as dp,BIe as dq,zIe as dr,KIe as ds,XIe as dt,aF as du,WIe as dv,O_ as dw,D6 as dx,AIe as dy,gIe as dz,U7 as e,_6e as e$,c8e as e0,y8e as e1,X6e as e2,v8e as e3,_8e as e4,hMe as e5,p9e as e6,_5 as e7,Mye as e8,K6e as e9,hte as eA,g8e as eB,m8e as eC,p8e as eD,b5 as eE,d9e as eF,hwe as eG,j9e as eH,pe as eI,pi as eJ,Ln as eK,ha as eL,aMe as eM,EMe as eN,vMe as eO,F9e as eP,yMe as eQ,TMe as eR,CMe as eS,$9e as eT,bMe as eU,_Me as eV,gMe as eW,wMe as eX,b6e as eY,mMe as eZ,SMe as e_,cwe as ea,yD as eb,IMe as ec,x8e as ed,Ine as ee,w8e as ef,xs as eg,q6e as eh,s8e as ei,S6e as ej,pte as ek,l8e as el,g9e as em,t8e as en,n8e as eo,r8e as ep,J6e as eq,e8e as er,Pne as es,f8e as et,d8e as eu,R8e as ev,Y8e as ew,NRe as ex,Z8e as ey,b8e as ez,qN as f,iG as f$,hB as f0,nOe as f1,hC as f2,Sye as f3,dOe as f4,i9e as f5,r9e as f6,oOe as f7,xye as f8,aOe as f9,gOe as fA,NOe as fB,fOe as fC,zOe as fD,UOe as fE,ZOe as fF,Hwe as fG,e9e as fH,n9e as fI,t9e as fJ,pye as fK,OMe as fL,FD as fM,PR as fN,mn as fO,Aye as fP,zg as fQ,bu as fR,DOe as fS,LOe as fT,FOe as fU,BOe as fV,s9e as fW,$Oe as fX,yOe as fY,TB as fZ,rz as f_,PB as fa,qF as fb,$m as fc,JIe as fd,Fa as fe,c9e as ff,Y9e as fg,p$ as fh,wye as fi,a9e as fj,l9e as fk,eOe as fl,IOe as fm,OOe as fn,VRe as fo,x1 as fp,Je as fq,MOe as fr,sOe as fs,Pye as ft,rOe as fu,XOe as fv,uOe as fw,cOe as fx,pOe as fy,hOe as fz,t7 as g,J8e as g$,At as g0,uRe as g1,kRe as g2,ARe as g3,W8e as g4,vRe as g5,RRe as g6,Y0e as g7,B8e as g8,iRe as g9,U8e as gA,DT as gB,vwe as gC,X8e as gD,cRe as gE,lRe as gF,oRe as gG,A8e as gH,k8e as gI,$Re as gJ,rMe as gK,nMe as gL,yRe as gM,fRe as gN,dRe as gO,G0e as gP,q8e as gQ,F8e as gR,CRe as gS,xRe as gT,gRe as gU,hRe as gV,pRe as gW,DRe as gX,SRe as gY,LRe as gZ,eRe as g_,qh as ga,tRe as gb,z8e as gc,Fb as gd,rRe as ge,L8e as gf,nRe as gg,$8e as gh,V8e as gi,T8e as gj,E8e as gk,C8e as gl,PRe as gm,X7 as gn,_D as go,$f as gp,Xne as gq,I8e as gr,O8e as gs,M8e as gt,TRe as gu,H8e as gv,G8e as gw,Zne as gx,ERe as gy,K0e as gz,zi as h,D8e as h0,N8e as h1,MRe as h2,P8e as h3,K8e as h4,W0e as h5,V0e as h6,H0e as h7,q0e as h8,RMe as h9,jB as ha,sIe as hb,J as hc,$T as hd,z9e as he,U9e as hf,dte as hg,F0e as hh,MO as hi,NMe as hj,AU as hk,WMe as hl,HMe as hm,jMe as hn,qMe as ho,aa as hp,VMe as hq,MMe as hr,aEe as hs,J3e as ht,YMe as hu,JMe as hv,eNe as hw,iee as i,A_ as j,_m as k,s5 as l,GN as m,f5 as n,N7 as o,oh as p,WN as q,VW as r,ute as s,Sm as t,M as u,Z as v,as as w,hr as x,mf as y,oi as z};